akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <tuple>

using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)

int inf = 1000000000;

int num(int j){
    
    switch(j){
        case 1:
          return 2;
        case 2:
          return 5;
        case 3:
          return 5;
        case 4:
          return 4;
        case 5:
          return 5;
          break;
        case 6:
          return 6;
        case 7:
          return 3;
        case 8:
          return 7;
        case 9:
          return 6;
    }
    return 0;
}

void solve(){
  int n,m;
  cin >> n >> m;
  int a[9];
  rep(i,m){
    int tmp;
    cin >> tmp;
    a[i] = tmp;
  }
  
  const int n1 = n+100;
  int dp[n1];
  dp[0]=0;
  for(int i=1; i <= n; i++){
    int dmax=-inf;
    rep(j,m){
        int v;
        if(i-num(a[j]) >= 0){
        v = dp[i-num(a[j])];
        dmax = max(v+1,dmax);
        }
    }
    dp[i] = dmax;
    //cout << "dp[" << i << "]:" << dp[i] << endl;
  }
  //cout << dp[n] << endl;
  
  sort(a,a+m, greater<int>());
  
  //cout << a[0] << a[1] << a[2] << endl;
  
  string s = "";
  int j = n;
  while(j>0){
    rep(i,m){
          // cout << a[i] << " j:" << j <<  " dp[j] " << dp[j] << " dp[j-num(a[i])] " << dp[j-num(a[i])] << endl; 
          if(j >= num(a[i]) && dp[j]==dp[j-num(a[i])]+1) {
              s += to_string(a[i]);
              j = j - num(a[i]);
              break;
          }
    }
  }
  cout << s << endl;
  
  
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PLL = pair<ll, ll>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repn(i,n) for(int i = 0; i <= (int)(n); i++)
#define srep(i,l,n) for(int i = l; i < (int)(n); i++)
#define srepn(i,l,n) for(int i = l; i <= (int)(n); i++)
#define drep(i,n) for(int i = (int)(n-1); i >= 0; i--)
#define drepn(i,n) for(int i = (int)(n); i >= 0; i--)
#define size(s) (int)s.size()
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
template<typename T> inline istream& operator>>(istream &i, vector<T> &v) {rep(j, size(v)) i >> v[j]; return i;}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> T gcd(T a, T b) {if(b==0)return a; else return gcd(b,a%b);}
template<class T> T lcm(T a, T b) {return a/gcd(a,b)*b;}
template<class T = int> using V = vector<T>;
template<class T = int> using VV = vector<V<T>>;
bool isIn(int i, int j, int h, int w) {return i >= 0 && i < h && j >= 0 && j < w;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void err() {cout << -1 << endl;}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define ep emplace_back

const int MOD = 1000000007;
const int INF = 1e9;

#define PI acos(-1);
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};
int ddx[8] = {1,1,1,-1,-1,-1,0,0};
int ddy[8] = {0,1,-1,0,1,-1,1,-1};


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    srepn(i, 1, 9) {
        int next = i * 100 + i * 10 + i;
        if(n <= next) {
            cout << next << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

void s_print(set<int> &S){for(auto s:S){printf("%d, ",s);}puts("");}///

void solve(int w1,int w2, int s1, int s2, int solute, int
volume){

	// printf("w %d %d s %d %d solute %d volume %d\n",w1,w2,s1,s2,solute,volume);//

	set<int> X, Y;
	rp(i, 0, volume/100+1){
		rp(j, 0, volume/100+1){
			int x = 100*w1*i + 100*w2*j;
			// printf("x %d\n",x);//
			if(0 < x && x <= volume){
				X.insert(x);
			}
		}
	}

	rp(i, 0, volume+1){
		rp(j, 0, volume+1){
			int y = s1*i + s2*j;
			// if(0 < y && y <= volume){
			if(y <= volume){
				Y.insert(y);
			}
		}
	}

	// s_print(X);puts("--");//
	// s_print(Y);puts("--");//

	// int W = 0, S = 0;
	int W = w1*100, S = 0;
	double maxper = 0.0;
	for(auto x:X){
		int maxsol = solute * x / 100;
		for(auto y:Y){
			if(x+y <= volume && y <= maxsol){
				double per = 100.0*y/(x+y);
				if(maxper < per){
					// printf("(%d %d, %d, %.10f)\n",x,y,maxsol,per);//
					maxper = per;
					W = x;
					S = y;
				}
			}
		}
	}
	printf("%d %d\n",W+S,S);
}

int main(){
	int a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f;
	solve(a,b,c,d,e,f);
}


Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#define INF 2333333
#define MIN(_A, _B) (((_A) < (_B)) ? (_A) : (_B))
 
int n, Q;
int B[233333];
 
struct Data{
	int l, r;
	bool operator <(const Data a)const{
		if(l == a.l) return r > a.r;
		return l < a.l;
	}
}d[233333];
 
 
//Seg_Tree
int ql, qr;
int t[999999];
int query(int now, int l, int r){
	if(l >= ql && r <= qr) return t[now];
	int mid = l + r >> 1, qa = INF, qb = INF;
	if(ql <= mid) qa = query(now << 1, l, mid);
	if(qr > mid) qb = query(now << 1 | 1, mid + 1, r);
	return MIN(qa, qb);
}
void modify(int now, int l, int r, int q, int v){
	if(l == r) {t[now] = v; return;}
	int mid = l + r >> 1;
	if(q <= mid) modify(now << 1, l, mid, q, v);
	else modify(now << 1 | 1, mid + 1, r, q, v);
	t[now] = MIN(t[now << 1], t[now << 1 | 1]);
}
void modifm(int now, int l, int r, int q, int v){
	if(l == r) {t[now] = MIN(t[now], v); return;} 
	int mid = l + r >> 1;
	if(q <= mid) modifm(now << 1, l, mid, q, v);
	else modifm(now << 1 | 1, mid + 1, r, q, v);
	t[now] = MIN(t[now << 1], t[now << 1 | 1]);
}
 
int ans = 0;
void input(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &B[i]), (B[i] == 0) && (ans++);
	scanf("%d", &Q);
	for(int i = 1; i <= Q; i++)
		scanf("%d %d", &d[i].l, &d[i].r);
	std::sort(d + 1, d + Q + 1);
	memset(t, 63, sizeof(t));
}
 
void work(){
	int now = 1;
	for(int i = 1, tmp = 0; i <= n; i++){
		while(now <= Q && d[now].l == i){
			ql = i - 1, qr = d[now].r;
			tmp = query(1, 1, n);
			if(ql == 0) tmp = MIN(tmp, 0);
			modifm(1, 1, n, qr, tmp);
			now++;
		}
		ql = qr = i - 1;
		if(i == 1) tmp = 0;
		else tmp = query(1, 1, n);
		(B[i] == 0) ? (tmp--) : (tmp++);
		modifm(1, 1, n, i, tmp);
		ql = qr = i;
	}
	ql = qr = n;
	printf("%d\n", ans + query(1, 1, n));
}
 
int main(){
	input();
	work();
	return 0;
}

Measured memory_bytes: 6656
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
using namespace std;
const int maxn=500010,inf=1e9;
int n;
int pos[maxn][26],f[maxn];
char s[maxn];
void read(int &k)
{
    int f=1;k=0;char c=getchar();
    while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
    while(c<='9'&&c>='0')k=k*10+c-'0',c=getchar();
    k*=f;
}
int main()
{
    scanf("%s",s+1);n=strlen(s+1);
    memset(f,32,(n+1)<<2);f[n+1]=1;f[n+2]=0;
    for(int i=0;i<26;i++)pos[n+1][i]=n+1;
    for(int i=n;i;i--)
    {
        for(int j=0;j<26;j++)
        pos[i][j]=pos[i+1][j];
        pos[i][s[i]-'a']=i;
    }
    for(int i=n;i;i--)
    for(int j=0;j<26;j++)
    f[i]=min(f[i],f[pos[i][j]+1]+1);
    int now=1;
    for(int j=f[1];j;j--)
    for(int i=0;i<26;i++)
    if(f[now]==f[pos[now][i]+1]+1)
    {
        putchar(i+'a');
        now=pos[now][i]+1;
        break;
    }
}

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

// str は t の部分文字列化を判定
bool f(string str, string t){

    int pos = 0;
    for(int i = 0; i < (int)t.size(); i++){
        if(str[pos] == t[i]){
            pos++;
        }

        if(pos == (int)str.size()) return true;
    }

    return false;
}

int main(){

    string s, t; cin >> s >> t;
    string str1 = "";
    string str2 = "";
    for(int i = 0; i < (int)s.size(); i++){
        if(i % 2 == 0) str1 = str1 + s[i];
        if(i % 2 == 1) str2 = str2 + s[i];
    }

    //cout << str1 << " " << str2 << " " << t << endl;
    if(f(str1, t) || f(str2, t)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3228
#include<iostream>
using namespace std;
int main() {
	int a[5], b[5];
	int h;
	int br;
	while (cin >> a[1] >> a[2] >> a[3] >> a[4]) {
		br = 0;
		h = 0;
		cin >> b[1] >> b[2] >> b[3] >> b[4];
		for (int i = 1; i <= 4; i++) {
			if (a[i] == b[i]) {
				h = h + 1;
				b[i] = -1;
			}
		}
		for (int i = 1; i <= 4; i++) {
			for (int z = 1; z <= 4; z++) {
				if (a[i] == b[z]) {
					br = br + 1;
					b[z] = -1;
				}
			}
		}
		cout << h << " " << br << endl;
	}
}


Measured memory_bytes: 3100
#include <iostream>
#include <vector>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
    cout << 0 << endl;
    return 0;
  }
  cout << min(b*c, min(a*b, a*c)) << endl;
  return 0;
 
}

Measured memory_bytes: 504
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
bool Finish_read;
template<class T>
inline void read(T &x) {
	Finish_read=0;x=0;int f=1;char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	x*=f;Finish_read=1;
}
template<class T>
inline void print(T x) {
	if(x/10!=0)
		print(x/10);
	putchar(x%10+'0');
}
template<class T>
inline void writeln(T x) {
	if(x<0)
		putchar('-');
	x=abs(x);
	print(x);
	putchar('\n');
}
template<class T>
inline void write(T x) {
	if(x<0)
		putchar('-');
	x=abs(x);
	print(x);
}
/*================Header Template==============*/
string s,t;
int main() {
	cin>>s>>t;
	int l=s.length(),lt=t.length();
	bool flg=0;
	for(int i=l-lt;i>=0;i--) {
		bool f=1;
		for(int j=0;j<lt;j++) {
			if(s[i+j]=='?')
				continue;
			else {
				if(s[i+j]!=t[j]) {
					f=0;
					break;
				}
			}
		}
		if(f) {
			for(int j=0;j<lt;j++)
				s[i+j]=t[j];
			flg=1;
			break;
		}
	}
	if(!flg) {
		puts("UNRESTORABLE");
		return 0;
	}
	for(int i=0;i<l;i++) {
		if(s[i]=='?')
			s[i]='a';
	}
	cout<<s<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()

using namespace std;

const int MAXN = 1e6 + 7;

int d[MAXN];
vector <int> p;

void sieve() {
	for (int i = 0; i < MAXN; i++) {
		d[i] = -1;
	}
	for (int i = 2; i < MAXN; i++) {
		if (d[i] == -1) {
			p.push_back(i);
			d[i] = p.size() - 1;
		}
		for (int j = 0; j <= d[i]; j++) {
			if (i * (ll) p[j] >= MAXN) break;
			d[i * p[j]] = j;
		}
	}
}

vector <pair <int, int> > factorize(int n) {
	vector <pair <int, int> > res;
	while (n != 1) {
		int now = p[d[n]];
		if (res.size() && res.back().first == now) {
			res.back().second++;
		} else {
			res.push_back({now, 1});
		}
		n /= now;
	}
	return res;
}

vector <int> divisiors;

void force(vector <pair <int, int> > &fact, int pos, int now) {
	if (pos == fact.size()) {
		divisiors.push_back(now);
		return;
	}
	for (int i = 0; i <= fact[pos].second; i++) {
		force(fact, pos + 1, now);
		now *= fact[pos].first;
	}
}

void get_divisiors(int n) {
	divisiors.clear();
	auto mas = factorize(n);
	force(mas, 0, 1);
}

int sumd[MAXN];

int now_res;

const int MOD = 998244353;

void add(int &x, int y) {
	x += y;	
	if (x >= MOD) {
		x -= MOD;
	}
	if (x < 0) {
		x += MOD;
	}
}

void inc(vector <pair <int, int> > &fact, int pos, int now, int cnt) {
	if (pos == (int) fact.size()) {
		add(now_res, (cnt % 2 ? -1 : 1) * sumd[now]);
		return;
	}
	inc(fact, pos + 1, now, cnt);
	inc(fact, pos + 1, now * fact[pos].first, cnt + 1);
}


int get_sum(int n, int d) {
	assert(n % d == 0);
	auto mas = factorize(n / d);
	now_res = 0;
	inc(mas, 0, d, 0);
	return now_res;
}


int main(){
#ifdef LOCAL
	freopen("C_input.txt", "r", stdin);
	//freopen("C_output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	sieve();
	int n;
	cin >> n;
	int res = 0;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		get_divisiors(x);
		for (int d : divisiors) {
			add(res, get_sum(x, d) * (ll) (x / d) % MOD);
		}
		for (int d : divisiors) {
			add(sumd[d], x);
		}
	}
	cout << res << "\n";
}



Measured memory_bytes: 8568
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	cout<<s[0]<<s.size()-2<<s[s.size()-1];
}
/*map<string,string> mp;
map<int,string> tt;
map<string,bool> ss;
inline bool cap(char c)
{
	return c>='A'&&c<='Z';
}
inline char ctos(char c)
{
	if(cap(c))
		return c-'A'+'a';
	return c;
}
inline char stoc(char c)
{
	if(!cap(c))
		return c-'a'+'A';
	return c;
}
inline bool fen(char c)
{
	return c=='-'||c==','||c=='.'||c=='"'||c=='('||c==')'||c==':'||c==';'||c=='!'||c=='?'||c==' '; 
}
inline bool chun(string t)
{
	for(int i=0; i<t.size(); i++)
			if(!isalpha(t[i]))
				return false;
		return true;
}
inline void add(string t)
{
	string a="", b="", c="", A, B, C;//T34T  T23t t23t
	int yy=t.size()-2;
	A=B=C=t;
	string oo="";
	if(yy<10)
		oo+=yy+'0';
	else
		oo+=(yy/10+'0'), oo+=(yy%10+'0'); 
	a+=stoc(t[0]);
	a+=oo;
	a+=stoc(t[t.size()-1]);
	b+=stoc(t[0]);
	b+=oo;
	b+=ctos(t[t.size()-1]);
	c=ctos(t[0]);
	c+=oo;
	c+=ctos(t[t.size()-1]);
	
	for(int i=0; i<yy+2; i++)
		A[i]=stoc(A[i]), B[i]=ctos(B[i]), C[i]=ctos(C[i]);
	
	B[0]=stoc(B[0]);
	
	if(ss[a])
		mp[a]=a, mp[b]=b, mp[c]=c;
	else
		ss[a]=ss[b]=ss[c]=true, mp[a]=A, mp[b]=B, mp[c]=C;
//	cout<<a<<endl<<b<<endl<<c<<endl<<mp[a]<<endl;
}
string s, prev[1005], ans, t, g;
int y=0;
int main()
{
	freopen("i18n.in", "r", stdin);
	freopen("i18n.out", "w", stdout);
	while(getline(cin, s))
	{
		tt.clear();//fuhao
		int it=0;
		t="";//top
		while(fen(s[it]))
			t+=s[it], s[it]=' ', it++;
		cout<<t;
		int nn=it;
		it=0;
		for(int i=nn+1; i<s.size(); i++)
			if(fen(s[i]))
			{
				it++;
				while(fen(s[i]))
					tt[it]+=s[i], s[i]=' ', i++;
				i--;
			}
		istringstream ss(s);
		it=0;
		while(ss>>g)
		{
			if(mp.count(g))
			{
				cout<<mp[g]<<tt[++it];
				continue;
			}
			if(g.size()<=3||!chun(g)) 
			{
				cout<<g<<tt[++it];
				continue;
			}
			add(g);
			cout<<g<<tt[++it];
		}
		cout<<endl;
	}
	return 0;
}
/*
rtmrete..dgdgoerjw;fdgds'wrewsgnkdg
R5e,,sfdr5e   r5eal v,,sgoag;
d7w rosmvee algjs..af s,wer,asfd,,ag..
a,f,dfs.qehsdflma
*/

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



int main()
{
	int S;
	cin >> S;
	int h = S / 3600;
	int m = (S % 3600) / 60;
	int s = (S % 3600) % 60;
	cout << h << ":" << m << ":" << s << endl;

	return 0;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define mod 1000000007

const int sz=1e6+5;
ll inf=1e15;

vector<int> ar[sz];
bool visited[sz];

int res=0;
int dp[sz];

void dfs(int x)
{
    visited[x]=true;
    // dp[x]=0;
    for(auto& i : ar[x])
    {
        if(visited[i]==false)
        {
            dfs(i);
            

        }
        dp[x]=max(dp[x],1+dp[i]);
    }

    // res=max(res,dp[x]);
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    // cin>>t;
    
    while(t--)
    {
        
        int n,m;
        cin>>n>>m;
        memset(visited,false,sizeof(visited));
        for(int i=0;i<m;i++)
        {
            int u,v;
            cin>>u>>v;
            ar[u].push_back(v);
        }
        for(int i=1;i<=n;i++)
        {
            if(!visited[i])
                dfs(i);
        }
        for(int i=1;i<=n;i++)
            res=max(res,dp[i]);
        cout<<res<<endl;
    }

    return 0;
}

Measured memory_bytes: 33512
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vdo=vector<double>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vvdo=vector<vector<double>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using pqin=priority_queue<int>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG
int main()
{
    string s;
    cin>>s;
    int d=s.size();
    int sum=0;
    int max=0;
    rep(i,d){
        if(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T'){
            sum++;
            if(max<sum)max=sum;
        }
        else if(!(s[i]=='A'||s[i]=='C'||s[i]=='G'||s[i]=='T')){
            sum=0;
        }
    }
    cout<<max<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    if (a >= 13) {
        cout << b;
    } else if (a >= 6 && a <= 12) {
        cout << b / 2;
    } else {
        cout << 0;
    }
}

Measured memory_bytes: 256
//21171_somesh || asomesh999

#include<bits/stdc++.h>
using namespace std;
#define fr(i,a,b) for(long long i=a;i<b;i++)
#define io ios::sync_with_stdio(false);cin.tie(NULL);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
long int mod=1000000007;

int main()
{
	io
	#ifdef SOMU
		clock_t startTime = clock();
		freopen("input.txt","r",stdin);
	#endif

	int n;
	cin >> n;
	set<int> st;
	fr(i, 1, 10) {
		fr(j, 1, 10) {
			st.insert(i * j);
		}
	}
	if (st.find(n) == st.end()) {
		cout << "No";
	} else {
		cout << "Yes";
	}

	#ifdef SOMU
		cerr << endl <<setprecision(20)<< double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
	#endif
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}
int main()
{
	int a,b,c;
	scanf("%d%d",&a,&b);
	c=gcd(a,b);
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 592
import sys
if __name__ == "__main__":

	N,X = map(int, input().split())
	res = 2 * N - 1
	if (X == 1 or X == 2 * N - 1):
		print ("No")
		sys.exit()
	result = [0] * res
	left = X - 1
	result[N-1] = X
	right = X + 1
	left_idx = N - 2
	right_idx = N

	cnt = 0
	while (left > 0 and right < 2 * N):
		if (cnt % 2 == 0):
			result[left_idx] = left
			result[right_idx] = right
		else:
			result[left_idx] = right
			result[right_idx] = left

		left_idx -= 1
		left -= 1

		right_idx += 1
		right += 1

		cnt += 1
	if (left > 0):
		for x in range(left_idx, -1, -1):
			result[x] = left
			left -= 1
		for x in range(right_idx, 2 * N-1):
			result[x] = left
			left -= 1
	if (right < 2 * N):
		for x in range(left_idx, -1, -1):
			result[x] = right
			right += 1
		for x in range(right_idx, 2 * N-1):
			result[x] = right
			right += 1

	print ("Yes")
	for x in result:
		print (x)


Measured memory_bytes: 12560
#include<stdio.h>

int main(void)
{
  int S, h, m, s;

  scanf("%d", &S);

  h = S / 3600;
  S = S % 3600;
  m = S / 60;
  S = S % 60;
  s = S;

  printf("%d:%d:%d\n", h, m, s);

  return 0;
}

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

int main() {
    int n;
    scanf("%d", &n);
    set<string> dic;
    deque<string> ans;
    rep(i, n) {
        char order[7], str[13];
        scanf("%s %s", order, str);
        if (order[0] == 'i') {
            dic.insert(str);
        } else if (order[0] == 'f') {
            if (dic.find(str) != dic.end()) {
                ans.push_back("yes");
            } else {
                ans.push_back("no");
            }
        }
    }
    rep(i, ans.size()) {
        printf("%s\n", ans[i].c_str());
    }
}


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

bool is_palindrome(int n)
{
    if (n / 10000 == n % 10 && (n / 1000) % 10 == (n / 10) % 10)
    {
        return true;
    }
    else
    {
        return false;
    }
}

int main()
{
    int a,b,ans;
    ans=0;
    cin>>a>>b;
    for (size_t i = a; i <= b; i++)
    {
        if(is_palindrome(i)){
            ans++;
        }
        /* code */
    }
    cout << ans << endl;

    return 0;
}

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

bool is_prime_honest(int n) {
  if (n <= 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (int i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  int N;
  cin >> N;
  int ans = 0;
  for (int i = 0; i < N; i++) {
    long long n;
    cin >> n;
    ans += is_prime_honest(n);
  }
  cout << ans << endl;
}



Measured memory_bytes: 3080
#include "stdio.h"
#include "math.h"

int N;

int main(int argc, char* argv[])
{
	int i;
	int a[100002];
	int a_sum=0;

	scanf("%d", &N);

	a[0] = 0;
	a[N+1] = 0;
	for(i=0;i<N;i++){
		scanf("%d", &a[i+1]);
		a_sum += abs(a[i+1]-a[i]);
	}
	a_sum += abs(a[i+1]-a[i]);

	for(i=0;i<N;i++){
		printf("%d\n", a_sum - abs(a[i+1] - a[i]) - abs(a[i+2] - a[i+1]) + abs(a[i+2] - a[i]));

	}


	return 0;
}



Measured memory_bytes: 1536
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long ans = min(n, m / 2);
  m -= ans * 2;
  ans += m / 4;
  cout << ans << endl;
  return 0;	
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int n,a[333333];
int main(){
	scanf("%d",&n);
	for(int i=0; i<n*3; i++)
		scanf("%d",&a[i]);
	sort(a,a+(3*n));
	long long int res = 0;
	for(int i=0,j=n*3-2; i<n; i++,j-=2){
		res += a[j];
	}
	cout<<res<<endl;
	return 0;
}

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

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

  for (int a = 1; a < 10; ++a) {
    for (int b = 1; b < 10; ++b) {
      if (a * b == N) {
        cout << "Yes\n";
        return 0;
      }
    }
  }
  cout << "No\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;


int main(){
    cin.sync_with_stdio(0); cin.tie(0);
    cin.exceptions(cin.failbit);

    int h,w,n;
    cin >> h >> w >> n;
    vector<pii> yx(n);
    int x,y;
    rep(i,0,n){ 
        cin >> x >> y;
        yx[i] = pii(y,x);
    }
    sort(all(yx));
    int cx=1, cy=1;
    int ans = h;
    rep(i,0,n){
        x = yx[i].second;
        y = yx[i].first;
        cx += y-cy;
        cy = y;
        
        if(x>cx){
            ans = min(ans, x-1);
        }else if(x==cx){
            cx++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
n,d=map(int,input().split())
xy=[list(map(int,input().split())) for i in range(n)]

import math
count = 0
for i in range(n):
  dis = math.sqrt(xy[i][0]**2 + xy[i][1]**2)
  if dis <= d:
    count += 1
print(count)

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


int main(){  
  long long n,a,b,c,d,e;
  scanf("%lld",&n);
  scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e);

  cout << max({ (n - 1) / a, (n - 1) / b, (n - 1) / c, (n - 1) / d, (n - 1) / e }) + 5 << endl;
  return 0;
}

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

typedef long long int ll;

int main()
{
    ll x, y, ans = 0;
    cin >> x >> y;
    if(x == 1){
        ans += 300000;
    }
    else if(x == 2){
        ans += 200000;
    }
    else if(x == 3){
        ans += 100000;
    }
    if(y == 1){
        ans += 300000;
    }
    else if(y == 2){
        ans += 200000;
    }
    else if(y == 3){
        ans += 100000;
    }

    if(x == 1 && y == 1){
        ans += 400000;
    }
    
    cout << ans;
    return 0;
}

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

int main() {
 int N;
 cin>>N;
 long long int sum=0;
  
 for(int i=1;i<=N;i++){
   if(i%3!=0&&i%5!=0){
     sum+=i;
   }
 }
  cout<<sum<<endl;
}
  
 


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout cout << fixed << setprecision(10)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acos(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


struct TopologicalSort {
    vector<set<int>> G;
    vector<int> indeg;
    vector<bool> used;
    TopologicalSort() = default;
    TopologicalSort(int n) : G(n), indeg(n, 0), used(n, 0){}
    void addEdge(int s, int t){
        G[s].emplace(t);
        indeg[t]++;
    }
    void bfs(int s, vector<int>& ps){
        queue<int> q;
        q.emplace(s);
        used[s] = true;
        while(!q.empty()){
            int v = q.front(); q.pop();
            ps.emplace_back(v);
            for(int u : G[v]){
                indeg[u]--;
                if(indeg[u] == 0 and !used[u]){
                    used[u] = true;
                    q.emplace(u);
                }
            }
        }
    }
    vector<int> build(){
        vector<int> res;
        int n = G.size();
        for(int i = 0;i < n;i++) if(indeg[i] == 0 and !used[i]) bfs(i, res);
        return res;
    }
};


int N, M;
VI g[100010];
TopologicalSort ts;
int dp[100010];


signed main(){
    cin >> N >> M;
    ts = TopologicalSort(N);
    rep(i, 0, M){
        int x, y;
        cin >> x >> y;
        x--; y--;
        g[x].eb(y);
        ts.addEdge(x, y);
    }

    auto ord = ts.build();
    rep(i, 0, N){
        for(int x : g[ord[i]]) chmax(dp[x], dp[ord[i]]+1);
    }

    cout << *max_element(dp, dp+N) << endl;

    return 0;
}

Measured memory_bytes: 17532
#include<stdio.h>
int main(){
 int a,b,c,i,j;
 scanf("%d %d %d",&a,&b,&c);
 for(i=a;i<=b;i++){
  if(c%i==0){
   j=j+1;
   }
  }
 printf("%d\n",j);
 return 0;
}

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

main() {
    int K;
    cin >> K;
    vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << a.at(K - 1) << endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, M: int):
    if M//2 < N:
        print(M//2)
    else:
        print(N + (M-N*2)//4)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
//g++ -std=c++14 test.cpp -o test.out
//問題URL
//https://atcoder.jp/contests/abc126/tasks/abc126_d
//各点と根の間の距離を求めれば各点同士の距離もわかる
//二つの間の距離や重みを計算できない！と思った時は
//各点の最初からの距離や重みを求め、それの差分を取ることで求める手法を考えてみるべき
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <utility>
#include <limits.h>
using namespace std;

int N;

int ans[100001];//頂点iをans[i]色に塗る

void solve(){
	vector<vector<int>> next(N+1);//点iから行ける点の集合を配列dest[i]とする
	map<pair<int,int>,bool> value;//iとjの間の距離をvalue[pair(i,j)]とする
	for(int i=0;i<N-1;i++){
		int u,v;
		long w;
		cin >> u >> v >> w;
		next[u].push_back(v);
		next[v].push_back(u);
		value[make_pair(u,v)] = w%2;
		value[make_pair(v,u)] = w%2;
	}
	//根と点iの距離をans[i]とする
	memset(ans,-1,sizeof(int)*100001);
	ans[1] = 0;//根を点1とする。この時根と点1の距離は明らかに0
	//幅優先探索を用いて根と点の距離を求める
	queue<int> q;
	q.push(1);
	while(!q.empty()){
		int present_point = q.front();
		q.pop();
		for(int i=0;i<next[present_point].size();i++){
			int next_candidate = next[present_point][i];//次に行く点の候補の一つをnext_candidateとする
			if(ans[next_candidate]==-1){//next_candidateにまだ行ってないなら
				q.push(next_candidate);
				ans[next_candidate] = value[make_pair(present_point,next_candidate)]^ans[present_point];
			}
		}
	}
}
 
int main(){
	cin >> N;
 
	solve();

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


Measured memory_bytes: 18688
while True:
    n,x = map(int,input().split())
    if n == 0 and x == 0:
        break
    ans = 0
    for i in range(1,n+1):
        if i > x/3:
            break
        for j in range(i+1,n+1):
            if j > x/2:
                break
            for k in range(j+1,n+1):
                #print(i,j,k)
                if i+j+k==x:
                    ans+=1
    print(ans)


Measured memory_bytes: 5596
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for (int i = (m) ; i < (n) ; i++)
#define per(i,n,m) for (int i = (n-1) ; i >= (m) ; i--)
#define all(x)     (x).begin(), (x).end()
#define sz(x)      ((int) (x).size())
ll gcd(ll x,ll y){
    if(y==0)return x;
    else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}
int main(void){
    ll X,x=100,ans=0;
    cin>>X;
    while(x<X){
        x*=1.01;
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3608
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors
n=int(input())
s=make_divisors(n)
print(len(str(s[len(s)//2])))

Measured memory_bytes: 3060
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define all(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
int gcd(int a, int b) // assuming a,b >= 1
{
    if (a < b)
        swap(a, b);
    if (b == 0)
        return a;
    if (a % b == 0)
        return b;
    return gcd(b, a % b);
}
int lcm(int a, int b) // assuming a,b >= 1
{
    return  a * b / gcd(a, b);
}
using namespace std;
#pragma endregion
signed main() {
    int D;
    cin >> D;
    if(D==3 || D==5 || D==7)
        cout << "YES";
    else
        cout << "NO";
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <ostream>

void print_array(const int a[], int n) {
  for (int i = 0; i < n; ++i) {
    if (i > 0)
      std::cout << " ";
    std::cout << a[i];
  }
  std::cout << std::endl;
}

int main(int argc, char *argv[]) {
  int n;
  std::cin >> n;
  int a[10];
  for (int i = 0; i < n; ++i)
    std::cin >> a[i];

  if (std::prev_permutation(a, a + n))
    print_array(a, n);
  std::next_permutation(a, a + n);
  print_array(a, n);
  if (std::next_permutation(a, a + n))
    print_array(a, n);
}



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

string s;

int main()
{
	cin>>s;
	if((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3]))
        puts("Yes");
	else
	    puts("No");
	return 0;
}

Measured memory_bytes: 256
a = int(input())
list = list(map(int, input().split()))
i = 0
max = 0
while (i + 1) < a:
    ct = 0
    while list[i] >= list[i+1]:
        i += 1
        ct += 1
        if (i + 1) >= a:
            break
    if max < ct:
        max = ct
    i += 1

print(max)


Measured memory_bytes: 15020
from collections import deque

N, Q = list(map(int, input().split(" ")))
AB = [list(map(int, input().split(" "))) for _ in range(N-1)]
PX = [list(map(int, input().split(" "))) for _ in range(Q)]

points = [0 for _ in range(N+1)]
g = [[] for _ in range(N+1)]
for a, b in AB:
    g[a].append(b)

# print(g)

for p, x in PX:
    points[p] += x

q = deque([1])
while q:
    node = q.popleft()
    for child in g[node]:
        points[child] += points[node]
        q.append(child)

for point in points[1:]:
    print(point)

Measured memory_bytes: 121816
# 縦線の数に対する横線の引き方
border_num = [1, 1, 2, 3, 5, 8, 13, 21, 34]


def noborder_both_side(cw: int, W: int) -> int:
    """縦線 cw の両隣に横線が存在しない場合の数
    """
    # (cw より左側の縦線間での横線の引き方) x (右側でのそれ)
    return border_num[cw-1] * border_num[W-cw]


def border_only_leftside(cw: int, W: int) -> int:
    """縦線 cw の左側のみに横線が存在する場合の数
    """
    # 左端にいるなら左側に横線は引けない
    if cw == 1:
        return 0

    # (cw より左側の縦線間での横線の引き方) x (右側でのそれ)
    # cw より左側は、cw と隣、隣とその隣の間の引き方は一意に決まるので、
    # それよりさらに左側の cw-2 本の縦線間での引き方を考える。
    return border_num[cw-2] * border_num[W-cw]


def border_only_rightside(cw: int, W: int) -> int:
    """縦線 cw の右側のみに縦線が存在する場合の数
    """
    # 右端にいるなら右側に横線は引けない
    if cw == W:
        return 0

    # (cw より左側の縦線間での横線の引き方) x (右側でのそれ)
    # cw より右側は、cw と隣、隣とその隣の間の引き方は一意に決まるので、
    # それよりさらに右側の W-cw-1 本の縦線間での引き方を考える。
    return border_num[cw-1] * border_num[W-cw-1]


def number_of_amidakuji(H: int, W: int, K: int) -> int:
    # 場合分けを減らすため、w 方向は余計にとってある。
    dp = [[0 for _ in range(W+2)] for _ in range(H+1)]
    dp[0][1] = 1

    for h in range(H):
        for w in range(1, W+1):
            # (h, w) -> (h+1, w) への行き方は次のように求める
            # ((h, w) への到達方法)
            # x (h+1 の横線の引き方の内 w の両隣に横線がない場合の数)
            dp[h+1][w] += dp[h][w] * noborder_both_side(w, W)

            # (h, w) -> (h+1, w-1) への行き方は次のように求める
            # ((h, w) への到達方法)
            # x (h+1 の横線の引き方の内 w の左にのみ横線がある場合の数)
            dp[h+1][w-1] += dp[h][w] * border_only_leftside(w, W)

            # (h, w) -> (h+1, w+1) への行き方は次のように求める
            # ((h, w) への到達方法)
            # x (h+1 の横線の引き方の内 w の右にのみ横線がある場合の数)
            dp[h+1][w+1] += dp[h][w] * border_only_rightside(w, W)

    return dp[H][K]


if __name__ == "__main__":
    H, W, K = map(int, input().split())
    ans = number_of_amidakuji(H, W, K)
    print(ans % 1000000007)


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

int main(void) {
	int N;
	char S[128];
	if (scanf("%d", &N) != 1) return 1;
	if (scanf("%127s", S) != 1) return 1;
	if (N < 1 || 100 < N) {
		puts("danger!!!!!");
		return 2;
	}
	puts(N % 2 == 0 && strncmp(S, S + N / 2, N / 2) == 0 ? "Yes" : "No");
	return 0;
}


Measured memory_bytes: 128
n=str(input())
s=int(n)
k=len(n)
ans=0
if k==1:
    ans=s
elif k==2:
    ans=9
elif k==3:
    ans=9+s-99
elif k==4:
    ans=909
elif k==5:
    ans=909+s-9999
elif k==6:
    ans=90909
print(ans)

Measured memory_bytes: 3060
#include <cstdio>
#include <map>
#include <set>
using namespace std;

int MX[333333], MY[333333];
int h, w, m;
int cnt;
int nx, ny;
set<int>SX, SY;
set<pair<int, int>> vis;

int main(){
	scanf("%d%d%d", &h, &w, &m);
	int sbx, sby;
	for(int i = 1; i <= m; i++){
		scanf("%d%d", &sbx, &sby);
		vis.insert(make_pair(sbx, sby));
		MX[sbx]++;
		MY[sby]++;
		if(MX[sbx] > nx){
			nx = MX[sbx];
			SX.clear();
			SX.insert(sbx);
		}
		else if(MX[sbx] == nx) SX.insert(sbx);
		
		if(MY[sby] > ny){
			ny = MY[sby];
			SY.clear();
			SY.insert(sby);
		}
		else if(MY[sby] == ny) SY.insert(sby);
		
	}
	
	for(auto i : SX){
		for(auto j : SY){
			cnt = MX[i] + MY[j];
			if(vis.count(make_pair(i, j)) == 1) cnt--;
			else{
				printf("%d\n", cnt);
				return 0;
			}
		}
	}
	printf("%d\n", cnt);
	return 0;
}


Measured memory_bytes: 47828
#include<bits/stdc++.h>
#define int long long
#define Inf 1000000000LL
using namespace std;
signed main(){
  int a,b,c,x,y,n,m;
  cin>>a>>b>>c>>x>>y;
  if(a+b<c*2){
    cout<<x*a+y*b<<"\n";
  }else{
    n = c*(max(x,y)*2);
    m = c*(min(x,y)*2);
    if(y<x){
      m+=(a*(x-y));
    }else{
      m+=(b*(y-x));
    }
    if(n<m){
      cout<<n<<"\n";
    }else{
      cout<<m<<"\n";
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int kai(int a){
  int p=1;
  for(int i=0;i<a;i++) p*=a-i;
  return p;
}

int main(){
  int n;
  double sum=0,a,b;
  scanf("%d",&n);
  
  int x[n+1],y[n+1];
  for(int i=1;i<=n;i++) scanf("%d %d",&x[i],&y[i]);
  
  for(int i=1;i<n;i++)
    for(int j=i+1;j<=n;j++){
      a=x[i]-x[j];
      b=y[i]-y[j];
      sum+=sqrt(a*a+b*b);
    }
  sum=(sum*2*kai(n-1))/kai(n);
  
  printf("%.10lf",sum);
  return 0;
}

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

int main() {

  vector<pair<int, int>> time(5);

  for (int i = 0; i < 5; i++) {
    int a;
    cin >> a;
    int b = 10 - a % 10;
    if (b == 10) {
      b = 0;
    }
    time[i] = make_pair(b, a);
  }

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

  int answer = 0;
  
  for (int i = 0; i < 5; i++) {
    if (i != 4) {
      answer += time[i].second;
      answer += time[i].first;
    } else {
      answer += time[i].second;
    } 
  }

  cout << answer << endl;

}

Measured memory_bytes: 256
n,k=gets.split.map &:to_i
s=gets.chomp.chars
h=0
rl=0
lr=0
0.upto(n-2) do |i|
  h+=1 if s[i]==s[i+1]
  rl+=1 if s[i]=="R"&&s[i+1]=="L"
  lr+=1 if s[i]=="L"&&s[i+1]=="R"
end
puts h+((rl+1)/2+(lr+1)/2>k ? k*2:rl+lr)

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

ans = ["No"] * n
success = 0
foreigner = 0

for i in range(n):
    if s[i] == "a":
        ans[i] = "Yes"
        success += 1
    elif s[i] == "b" and foreigner < b:
        ans[i] = "Yes"
        success += 1
        foreigner += 1
    if success == a + b:
        break

for i in ans:
    print(i)

Measured memory_bytes: 4784
package main

import(
	"fmt"
)

func main() {
	var r,g,b int
	fmt.Scan(&r,&g,&b)
	
	num := 100*r + 10*g + 1*b
	if num % 4 == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}	
}


Measured memory_bytes: 512
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	static int cnt = 0;
	static PrintWriter out =new PrintWriter(System.out);
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	
    	int n = sc.nextInt();
    	int array[] = new int[n];
    	for(int i=0;i<n;i++) {
    		array[i] = sc.nextInt();
    	}
    	slection(array,n);
    	out.print(array[0]);
    	for(int i=1;i<n;i++) {
    		out.print(" "+array[i]);
    	}
    	out.println();
    	out.println(cnt);
    	out.flush();
    }
    
    static void slection(int[] a,int n) {
    	for(int i=0;i<n-1;i++) {
    		int minj = i;
    		for(int j=i;j<n;j++) {
    			if(a[j]<a[minj]) 
    				minj = j;
    		}
    		if(a[minj]!=a[i]) {
    			cnt++;
    			int tmp = a[minj];
    			a[minj] = a[i];
   				a[i] = tmp;
    		}
    	}
    }
    	
}


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

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

    bool mod[100] = {};
    int i = 0;

    while (true) {
        i++;

        int j = i * a - c;
        if (j <= 0) continue;

        if (j % b == 0) {
            cout << "YES" << endl;
            return 0;
        }

        if (mod[j % b]) {
            cout << "NO" << endl;
            return 0;
        }

        mod[j % b] = true;
    }

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Class307
    {
        static void Main()
        {
            int K = int.Parse(Console.ReadLine());
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = ab[0], b = ab[1];
            bool frag = false;
            for(int i = a; i <= b; i++)
            {
                if (i % K == 0) frag = true;
            }
            Console.WriteLine(frag?"OK":"NG");
        }
    }
}


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

int main(){
	int a, b, sum=0, n=0, sumb=0, ave;
	while(scanf("%d,%d", &a, &b) != EOF){
		sum += a*b;
		sumb += b;
		n++;
	}
	ave = (sumb/(double)n) +0.5;
	cout << sum << endl << ave << endl;
	
	return 0;
}

Measured memory_bytes: 1204
#include<cstdio>
#include<cmath>
#include<climits>
#include<algorithm>
#include<sstream>
#include<iostream>
#include<iomanip>
#include<utility>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<unordered_set>
#include<unordered_map>
#include<set>
#include<map>
#include<list>

using namespace std;
using ll = long long;

#define in(s) cin >> s
#define out(s) cout << s << endl
#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define pcnt __builtin_popcount
#define pcntll(x) __builtin_popcountll(x)
#define DMAX DBL_MAX;
#define IMIN INT_MIN;
#define IMAX INT_MAX;

const long long MOD = 1e9+7;
const long long MAX = 3e5+1;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    ll N, K;
    in(N); in(K);
    vector<int> A(N);
    rep(i, N) {
        in(A[i]);
        A[i]--;
    }

    int idx = 0;
    ll cnt = 0;
    unordered_map<int, int> visited;
    visited[idx] = 0;
    rep(i, N+1) {
        cnt++;
        idx = A[idx];
        if (cnt == K || visited.find(idx) != visited.end()) break;
        visited[idx] = cnt;
    }
    if (cnt == K) {
        out(idx+1);
        exit(0);
    }
    K -= visited[idx];
    ll loop = cnt - visited[idx];
    K %= loop;
    rep(i, K) {
        idx = A[idx];
    }
    out(idx+1);

    return 0;
}


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


int main(){
    ll n;
    cin >> n;
    string s = "";
    int i = 0;
    if (n == 0) s = "0";
    while (n != 0){
        if (n % (-2) == 1){
            s = '1' + s;
            n /= -2;
        }
        else if (n % (-2) == -1){
            s = '1' + s;
            n /= -2;
            n ++;
        }
        else{
            s = '0' + s;
            n /= -2;
        }
        i ++;
    }
    cout << s << endl;
}

Measured memory_bytes: 256
/**
 *    author:  FromDihPout
 *    created: 2020-08-19
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int n = s.length();
    vector<int> left(n), right(n);
    for (int i = n - 1; i >= 0; i--) {
        left[i] = (s[i] == 'L' ? i : left[i+1]);
    }
    for (int i = 0; i < n; i++) {
        right[i] = (s[i] == 'R' ? i : right[i-1]);
    }
    
    vector<int> ans(n);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'L') {
            if ((right[i] - i) % 2 == 0) {
                ans[right[i]]++;
            }
            else {
                ans[right[i] + 1]++;
            }
        }
        else {
            if ((left[i] - i) % 2 == 0) {
                ans[left[i]]++;
            }
            else {
                ans[left[i] - 1]++;
            }
        }
    }
    
    for (int i = 0; i < n; i++) { 
        cout << ans[i] << ' ';
    }
    cout << '\n';
}

Measured memory_bytes: 4444
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i=0; i<(long long)(n); i++)
#define REP(i, k, n) for(long long i=(long long)(k); i<(long long)(n); i++)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define PQ(T) priority_queue<T>
#define PQS(T) priority_queue<T, vector<T>, greater<T> >
#define deci cout << fixed << setprecision(15);
typedef long long ll;
const ll inf = 1020304050607080910;
const ll mod = 1000000007;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
template<class T> bool chmin(T&x,T y){if(x>y){x=y;return true;}return false;}
template<class T> bool chmax(T&x,T y){if(x<y){x=y;return true;}return false;}
ll gcd(ll x,ll y){if(x>y)swap(x, y);while(x!=0){y%=x;swap(x, y);}return y;}
ll mpow(ll x,ll r){if(r==0)return 1;if(r%2==1){return x*mpow(x,r-1)%mod;}else{ll aa=mpow(x,r/2);return aa*aa%mod;}}

int n, a, b, sum, f, deg[100000], d[100000];
vector<int> G[100000];
vector<int> ans;
vector<int> pt;

int far(int v){
	int res = v;
	queue<int> que;
	rep(i, n) d[i] = 1e9;
	que.push(v);
	d[v] = 0;
	while(que.size()){
		int now = que.front(); que.pop();
		if(d[res] < d[now]) res = now;
		for(auto to:G[now])if(d[to]==1e9){
			d[to] = d[now] + 1;
			que.push(to);
		}
	}
	return res;
}

void path(void){
	int now = b;
	while(now != a){
		pt.pb(now);
		for(auto to:G[now])if(d[to]==d[now]-1) now = to;
	}
	pt.pb(a);
}

int main(){
	cin >> n;
	rep(i, n-1){
		int v, w; cin >> v >> w;
		v--; w--;
		G[w].pb(v); G[v].pb(w);
		deg[v]++; deg[w]++;
	}
	rep(i, n)if(deg[i]==1) a = i;
	a = far(a);
	b = far(a);
	path();
	rep(i, pt.size()){
		if(i==0 || i==pt.size()-1){
			sum++; ans.pb(1); continue;
		}
		sum += deg[pt[i]]-1;
		ans.pb(deg[pt[i]]-1);
	}
	if(sum != n){
		cout << -1 << endl; return 0;
	}
	rep(i, ans.size()){
		if(ans[i] < ans[ans.size()-i-1]){
			f = 0; break;
		}
		if(ans[i] > ans[ans.size()-i-1]){
			f = 1; break;
		}
	}
	int su = 0;
	if(f) reverse(all(ans));
	rep(i, ans.size()){
		rep(j, ans[i]-1) cout << su+2+j << " ";
		cout << su+1 << " ";
		su += ans[i];
	}
	return 0;
}


Measured memory_bytes: 7928