akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=a;i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream& os,const pair<t,u>& p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream& operator<<(ostream& os,const vc<t>& v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class t> void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

ll read(){ll i;cin>>i;return i;}

using ld=long double;
using cm=complex<ld>;
#define x real()
#define y imag()
const ld eps=1e-7;
const ld PI=acos(ld(-1));
int sgn(ld a){return a<-eps?-1:(a>eps?1:0);}
auto cmcmp=[](const cm&a,const cm&b){
	if(sgn(a.x-b.x))return a.x<b.x;
	else return sgn(a.y-b.y)<0;
};
ld dot(cm a,cm b){return a.x*b.x+a.y*b.y;}
ld crs(cm a,cm b){return a.x*b.y-a.y*b.x;}
int ccw(cm a,cm b){return sgn(crs(a,b));}
int ccw(cm a,cm b,cm c){return ccw(b-a,c-a);}
//AOJ1183
int qeq(ld a,ld b,ld c,ld&d,ld&e){
	ld f=b*b-4*a*c;
	if(sgn(f)<0)return 0;
	ld g=sqrt(max(f,ld(0)));
	d=(-b+g)/(2*a);
	e=(-b-g)/(2*a);
	return sgn(f)+1;
}
//(-2)[a,-1](0)[b,1](2)
int bet(cm a,cm b,cm c){
	cm d=b-a;
	ld e=dot(d,c-a);
	if(sgn(e)<=0)return sgn(e)-1;
	return sgn(e-norm(d))+1;
}
ld tri2(cm a,cm b,cm c){
	return crs(b-a,c-a);
}
//AOJ0153
//0-no,1-edge,2-in
int cont(cm a,cm b,cm c,cm d){
	if(ccw(a,b,c)==-1)
		swap(b,c);
	return min({ccw(a,b,d),ccw(b,c,d),ccw(c,a,d)})+1;
}
//AOJ1183
//arg between ab
//assume given lengths are valid
ld arg(ld a,ld b,ld c){
	return acos(min(max((a*a+b*b-c*c)/(2*a*b),ld(-1)),ld(1)));
}

//a->b->c と進むときに曲がる角度
//a-b-cが一直線上にあれば0が帰る
ld turn(cm a,cm b,cm c){
	return arg((c-b)/(b-a));
}

const int N=22;
const int R=10010;
bool can[N][N][N];
ld ds[N][N],dp[R][N][N];

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);
	
	rep(i,R)rep(j,N)rep(k,N)
		dp[i][j][k]=1e9;
	
	int n=read();
	ld r,t;
	cin>>r>>t;
	t*=PI/180;
	vc<cm> a;
	rep(i,n){
		int b=read(),c=read();
		a.eb(b,c);
	}
	rep(i,n)rep(j,n)if(i!=j)rep(k,n)if(i!=k&&j!=k)
		can[i][j][k]=sgn(abs(turn(a[i],a[j],a[k]))-t)<=0;
	
	rep(i,n)rep(j,n)if(i!=j)
		ds[i][j]=abs(a[i]-a[j]);
	rng(i,1,n)
		dp[1][0][i]=ds[0][i];
	
	int ans=0;
	rng(z,1,R-1){
		rep(i,n)rep(j,n)if(sgn(dp[z][i][j]-r)<=0){
			ans=z;
			rep(k,n)if(can[i][j][k])
				chmin(dp[z+1][j][k],dp[z][i][j]+ds[j][k]);
		}
	}
	
	cout<<ans<<endl;
	
}



Measured memory_bytes: 79088
a=int(input())
num=[int(i) for i in input().split()]
num_dict={}
num_min1_dict={}
sum_num=0
for i in num:
    if i not in num_dict:
        num_dict[i]=1
    else:
        num_dict[i]+=1

num_to_sum_dict={}
for key, value in num_dict.items():
    sum_num+=value*(value-1)/2

for key,value in num_dict.items():
    tmp=sum_num-value*(value-1)/2+(value-1)*(value-2)/2
    num_to_sum_dict[key]=tmp

for i in range(a):
    print(int(num_to_sum_dict[num[i]]))



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

int main(){
  int c;
  cin >> c;
  if(c>=30) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define debug(args...) fprintf(stderr, args)

typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef vector<pair<int,int>> vpii;
typedef vector<tuple<int,int,int>> vtiii;


int main() {
    string s;
    cin >> s;
    int ini, fim;



    for (int i = 0; i < s.size(); i++) {
        if(s[i] == 'A') {
            ini = i;
            break;
        }
    }
    for (int i = s.size()-1; i >= 0; i--) {
        if(s[i] == 'Z') {
            fim = i;
            break;
        }
    }
    
    cout << fim+1 - ini << endl;
    
    
    


    return 0;
}

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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

//////////////////

#define int long long
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
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 (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)

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

struct Edge {
    int to;     // 辺の行き先
    int weight; // 辺の重み
    Edge(int t, int w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;

void solve(){
    int H, W, M;
    cin >> H >> W >> M;
    vector<int> ch(H), cw(W);
    map<int,map<int,int>> m;
    rep(i,M){
        int h, w;
        cin >> h >> w;
        h--; w--;
        ch[h]++;
        cw[w]++;
        m[h][w]=1;
    }
    
    int ans = 0;
    int mah = -INF, maw = -INF;
    rep(i,H) chmax(mah, ch[i]);
    rep(i,W) chmax(maw, cw[i]);
    
    vector<int> vx, vy;
    rep(i,H) if(ch[i]==mah) vx.push_back(i);
    rep(i,W) if(cw[i]==maw) vy.push_back(i);
    
    if(vx.size()*vy.size()>1000000000)
        cout << mah + maw  << endl;  // テキトー

    else{
        for(int xx: vx)for(int yy : vy){
            if(m[xx][yy]==0){
                cout << mah + maw << endl;
                return;
            }
        }
        cout << mah + maw -1 << endl;
    }
}


signed main(){
    cout << fixed << setprecision(18);
//    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 63116
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5+5;

int main(){
	int n,m;
	while(cin >> n >> m){
		priority_queue<int> q;
		for(int i=0;i<n;i++){
			ll a;
			cin >> a;
			q.push(a);
		}
		for(int i=0;i<m;i++){
			ll p=q.top()/2;
			q.pop();
			q.push(p);
		}
		ll s=0;
		while(!q.empty()){
			s+=q.top();
			q.pop();
		}
		cout << s << endl;
	}
}

Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>
#include <sstream>
#include <istream>

using namespace std;

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


int main(){
	int n,m;
	vector<P> v;
	cin >> n >> m;
	for(int i=0;i<n;i++){
		ll a,b;
		cin >> a >> b;
		v.push_back(make_pair(a,b));
	}
	sort(v.begin(),v.end());

	ll ans = 0;
	int t = 0;
	for(int i=0;t<m;i++){
		int k = min(v[i].second,m-t);
		ans += v[i].first * k;
		t += k;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 2420
#!/usr/bin/env python3
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x
    

    def same(self, x, y):
        return self.find(x) == self.find(y)
        
import numpy as np
N, M = map(int, input().split())
edge = []
for _ in range(M):
    edge.append(list(map(int, input().split())))
ans = 0 
for i in range(M):
    unionfind = UnionFind(N)
    for j in [k for k in range(M) if k != i]:
        a, b = edge[j][0] - 1, edge[j][1] - 1
        unionfind.union(a, b)
    if np.count_nonzero(np.array(unionfind.parents) < 0) >= 2:
        ans += 1
print(ans)

Measured memory_bytes: 12108
a, b, h, m = map(int, input().split())

import math
deg1 = h * 30 + m * 0.5
deg2 = 6 * m

co1 = [a * math.cos(math.radians(deg1)), a * math.sin(math.radians(deg1))]
co2 = [b * math.cos(math.radians(deg2)), b * math.sin(math.radians(deg2))]

d = (co1[0] - co2[0]) ** 2 + (co1[1] - co2[1]) ** 2
print(d ** 0.5)


Measured memory_bytes: 62444
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();

		if (A <= 8 && B <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}
}


Measured memory_bytes: 21844
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
			solve();
  }

	public static void solve() {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int h = sc.nextInt();
				int w = sc.nextInt();
				int n = sc.nextInt();
				int[] a = new int[n];
				for(int i = 0; i < n; i++){
					a[i] = sc.nextInt();
				}
				sc.close();
				
				int[][] ans = new int[h][w];
				int nowh = 0, noww = 0, nowa = 0;
				for(int i = 0; i < h * w; i++){
					ans[nowh][noww] = nowa+1;
					a[nowa]--;
					if(a[nowa] == 0) nowa++;
					if(nowh % 2 == 0){
						if(noww == w-1){
							nowh++;
						}else{
							noww++;
						}
					}else{
						if(noww == 0){
							nowh++;
						}else{
							noww--;
						}
					}

				}
				for(int i = 0; i < h; i++){
					for(int j = 0; j < w; j++){
						out.print(ans[i][j]);
						if(j != w-1) out.print(" ");
					}
					out.println();
				}
        out.flush();
	}
}

Measured memory_bytes: 32336
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <map>
#include <stack>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <math.h>
using namespace std;

typedef pair<int, int> P;
#define ll long long
#define int ll
#define INF (1LL<<60)
#define mod 1000000007
int dx[4] = { 0, 1, 0, -1 };
int dy[4] = { 1, 0, -1, 0 };


int c[9];
int N;
signed main(){
	int N;
	cin >> N;
	for (int i = 0; i < N; i++){
		int t;
		cin >> t;
		if (t <= 3199) c[t / 400]++;
		else
			c[8]++;
	}

	int cnt = 0;
	for (int i = 0; i <= 7; i++)
		if (c[i]>0) cnt++;

	cout << max(1LL,cnt) << " " << cnt + c[8] << endl;

	return 0;
}


Measured memory_bytes: 256
/*
 * 	Heart beats fast
 * 		Colors and promises
 * 			How to be brave
 * 				How can I love when I am afraid to fall...
*/
#include<bits/stdc++.h>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define F first
#define S second

void solve()
{
  int n,a,b;
  cin >> n >> a >> b;
  int x=(n/(a+b))*a;
  if((n%(a+b))>a)
  {
    x+=a;
  }
  else
  {
    x+=(n%(a+b));
  }
  cout << x << '\n';
  return;
}

signed main()
{
  FAST;
	int T=1;
	// cin >> T;
	while(T--)
	{
		solve();
	}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
typedef long long lint;
const int N=262144;
const int mod=924844033;
//5
int n,cal[N],fac[N],inv[N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

inline int fpow(int x,int t){
	int ans=1;
	for(; t; x=(lint)x*x%mod,t>>=1){
		if(t&1) ans=(lint)ans*x%mod; 
	}
	return ans;
}

inline void init(){
	fac[0]=1;
	for(int i=1; i<N; ++i) fac[i]=(lint)fac[i-1]*i%mod;
	inv[N-1]=fpow(fac[N-1],mod-2);
	for(int i=N-1; i; --i) inv[i-1]=(lint)inv[i]*i%mod;
}

inline int C(const int x,const int y){
	if(x<y) return 0;
	return (lint)fac[x]*inv[y]%mod*inv[x-y]%mod;
}

namespace G{
	int cnt,fir[N],sz[N];
	struct edge{
		int to,nx;
	}eg[N<<1];

	inline void add(const int a,const int b){
		eg[++cnt]=(edge){b,fir[a]};
		fir[a]=cnt;
	}

	inline void dfs_cal(const int x){
		sz[x]=1;
		for(int i=fir[x]; i; i=eg[i].nx){
			const int y=eg[i].to;
			if(!sz[y]){
				dfs_cal(y);
				++cal[sz[y]];
				sz[x]+=sz[y];
			}
		}
		++cal[n-sz[x]];
	}
}

namespace P{

	void ntt(int *a,int len,bool f){
		static int rev[N<<1];
		for(int i=1; i<len; ++i){
			rev[i]=rev[i>>1]>>1|(i&1?len>>1:0);
			if(i<rev[i]) std::swap(a[i],a[rev[i]]);
		}
		for(int i=1; i<len; i<<=1){
			int t=fpow(5,(mod-1)/(i<<1));
			for(int j=0; j<len; j+=i<<1){
				for(int w=1,k=0; k<i; ++k,w=(lint)w*t%mod){
					lint p=(lint)w*a[j+k+i];
					a[j+k+i]=(a[j+k]-p)%mod;
					a[j+k]=(a[j+k]+p)%mod;
				}
			}
		}
		for(int i=0; i<len; ++i){
			if(a[i]<0) a[i]+=mod;
		}
		if(f==0) return;
		std::reverse(a+1,a+len);
		int tmp=fpow(len,mod-2);
		for(int i=0; i<len; ++i){
			a[i]=(lint)a[i]*tmp%mod;
		}
	}

	class poly{
		public:
			int len,*n;
			poly(int len=0){
				this->len=len;
				n=new int[len+1];
			}
			friend poly operator * (poly a,poly b);
	}ans;

	poly operator * (poly a,poly b){
		static int buka[N<<1],bukb[N<<1];
		poly c(a.len+b.len);
		int len=1;
		while(len<=c.len) len<<=1;
		memset(buka,0,len*sizeof(int));
		memset(bukb,0,len*sizeof(int));
		memcpy(buka,a.n,(a.len+1)*sizeof(int));
		memcpy(bukb,b.n,(b.len+1)*sizeof(int));
		ntt(buka,len,0);
		ntt(bukb,len,0);
		for(int i=0; i<len; ++i){
			buka[i]=(lint)buka[i]*bukb[i]%mod;
		}
		ntt(buka,len,1);
		memcpy(c.n,buka,(c.len+1)*sizeof(int));
		return c;
	}

	inline void get_poly(){
		poly a(n),b(n);
		for(int i=1; i<n; ++i){
			a.n[i]=(lint)cal[i]*fac[i]%mod;
			b.n[i]=inv[n-i-1];
		}
		ans=a*b;
	}
}

int main(){
	init();
	n=nxi();
	for(int i=1; i<n; ++i){
		const int a=nxi(),b=nxi();
		G::add(a,b);
		G::add(b,a);
	}
	G::dfs_cal(1);
	P::get_poly();
	for(int i=1; i<=n; ++i){
		const int all=(lint)n*C(n,i)%mod;
		const int invld=(lint)inv[i]*P::ans.n[n-1+i]%mod;
		printf("%d\n",(all+mod-invld)%mod);
	}
	return 0;
}


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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  string s1; cin >> s1;
  bool ok = false;

  bool n=false ,e = false ,s= false, w = false;
  rep(i, s1.size()) {
    switch(s1[i]) {
    case 'S':
      s = true;
      break;
    case 'E':
      e = true;
      break;
    case 'N':
      n = true;
      break;
    case 'W':
      w = true;
      break;
    }
  }

  ok = (s == n) && (e == w);
  
  cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 3716
n = gets.split.map {|e| e.to_i }.first
hs = gets.split.map {|e| e.to_i }

def cmp(xs,ys)
  y = ys.first
  xs.each { |x|
    if x > y
      return false
    end
  }
  return true
end

count = 1
x, *ys = hs
xs = [x]
(n-1).times { |i|
  # p [i, xs, ys]
  if cmp(xs, ys)
    count += 1
  end
  xs.push(ys.shift)
}
puts count


Measured memory_bytes: 1788
from array import array
n,q = [int(i) for i in input().split()]

count = [0 for i in range(n)]
input_ = [0 for i in range(q)] 
for i in range(q):
	input_[i] = input()
	a = [int(i) for i in input_[i].split()]
	if a[0] == 0:
		count[a[1]] += 1
A = [array('i',[0 for i in range(count[j]+1)]) for j in range(n)]
cursor = [-1 for i in range(n)]

def pushBack(t, x):
	cursor[t] += 1
	A[t][cursor[t]] = x
def dump(t):
	print(*A[t][:cursor[t]+1], sep=' ')
def clear(t):
	cursor[t] = -1

for input__ in input_:
	a = [int(i) for i in input__.split()]
	if a[0] == 0:
		pushBack(a[1],a[2])
	elif a[0] == 1:
		dump(a[1])
	else:
		clear(a[1])





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


int main()
{
   int n;
   cin>>n;
   string s, ck1, ck2;
   cin>>s;
   if(n&1) cout<<"No\n";
   else
   {
       int x=n/2;
       ck1=s.substr(0, x);
       ck2=s.substr(x, n);
       if(ck1==ck2) cout<<"Yes\n";
       else cout<<"No\n";
   }
}





Measured memory_bytes: 3628
n=int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i]=="R":
        R.append(i)
    elif s[i]=="G":
        G.append(i)
    else:
        B.append(i)

#print(B)
count = len(R)*len(G)*len(B)
d={}
for i in R:
    for j in G:
        big = max(i,j)
        small = min(i,j)
        
        x = 2*big-small
        y = 2*small-big
        z = (big+small)/2
        
        if x in d:
            d[x] += 1
        else:
            d[x] = 1
        if y in d:
            d[y] += 1
        else:
            d[y] = 1
        if z%1==0:
            if z in d:
                d[z] += 1
            else:
                d[z] = 1
        
        #if 2*big-small in B:
            #count -= 1
            #print(i,j)
            #print("hoi")
        #if 2*small-big in B:
            #count -= 1
            #print(i,j)
        #if (big+small)/2 in B:
            #print((big+small)/2)
            #count -= 1
            #print(i,j)
    
for i in B:
    if i in d:
        count -= d[i]
    
print(count)
        


Measured memory_bytes: 72468
n = int(input())
a = map(int,input().split())

num = [i for i in a if i % 2 == 0]
#print(num)
for i in num :
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()
print("APPROVED")

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

int main() {
    int N; cin >> N;
    vector<int> ans(N);
    for(int i=1; i<N; i++){
        int a; cin >> a;
        ans.at(a-1)++;
    }
    for(int i=0; i<N; i++){
        cout << ans.at(i) << endl;
    }
}


Measured memory_bytes: 4000
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
template<class T> inline bool chmin(T &a, T b){ if(a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){ if(a < b) { a = b; return true;} return false;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int D,N; cin >> D >> N;
    ll ans = N; ll one = 1;
    REP(i,D) ans *= 100, one *= 100;
    cout << ans + (N==100 ? one : 0)<< '\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a,b,c,k; cin>>a>>b>>c>>k;
  for(int i=0;i<k;i++){
    if(a>=b) b*=2;
    else c*=2; 
  }
  cout<<((a<b&&b<c)?"Yes":"No");
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int h,w,k;
	cin>>h>>w>>k;
	vector<string> s(h);
	vector<vector<int>> g(h,vector<int>(w));
	rep(i,h){
		cin>>s[i];
		rep(j,w){
			g[i][j]=s[i][j]-'0';
		}
	}
	vector<vector<int>> sum(h,vector<int>(w+1,0));
	rep(i,h){
		rep(j,w){
			sum[i][j+1]=sum[i][j]+g[i][j];
		}
	}
	int ans=INF;
	rep(S,1<<(h-1)){
		int m=__builtin_popcount(S);
		map<vector<int>,int> mp;
		int st=0;
		int T=S+(1<<(h-1));
		rep(i,h){
			if(1<<i & T){
				vector<int> now;
				FOR(j,st,i+1){
					now.push_back(j);
				}
				mp[now]=0;
				st=i+1;
				//cout<<now<<endl;
			}
		}
		st=0;
		int now=m;
		rep(j,w){
			bool flag=false;
			for(auto itr:mp){
				int cnt=0;
				for(auto x:itr.first){
					cnt+=sum[x][j+1]-sum[x][st];
				}
				if(cnt>k){
					flag=true;
				}
			}
			if(flag){
				for(auto itr:mp){
					int cnt=0;
					for(auto x:itr.first){
						cnt+=sum[x][j+1]-sum[x][j];
					}
					if(cnt>k){
						now=INF;
						break;
					}
				}
				if(now==INF) break;
				now++;
				st=j;
			}
		}
		chmin(ans,now);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 384
from heapq import*
import sys
r=sys.stdin.readline
def g(n,E,S,G):
 F=[1e7]*-~n;F[S]=0;H=[(0,S)]
 while H:
  c,u=heappop(H)
  if u==G:return c
  for f,v in E[u]:
   t=c+f
   if t<F[v]:F[v]=t;heappush(H,(t,v))
 return-1
def s(n,k,a):
 E=[[]for _ in[0]*-~n]
 for _ in[0]*k:
  f=r();p=map(int,f[2:].split())
  if'0'==f[0]:a+=f'{g(n,E,*p)}\n'
  else:c,d,e=p;E[c]+=[(e,d)];E[d]+=[(e,c)]
 print(a[:-1])
for e in iter(r,'0 0\n'):s(*map(int,e.split()),'')


Measured memory_bytes: 6000
#include <iostream>

using namespace std;

const static int M = 1000000;

int main()
{
    int K, X, count = 0;

    cin >> K >> X;

    for (int i = X - K + 1; i < X + K; i++)
    {
        if (i >= -M && i <= M)
        {
            if (count++ != 0)
                cout << " ";
            cout << i;
        }
    }
    cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int W,H,N;
  cin>>W>>H>>N;
  vector<int> X(N),Y(N),A(N);
  for(int i=0;i<N;i++){
    cin>>X.at(i)>>Y.at(i)>>A.at(i);
  }
  int count_1=0,count_2=W,count_3=0,count_4=H;
  for(int i=0;i<N;i++){
    if(A.at(i)==1){
      count_1=max(count_1,X.at(i));
    }
    if(A.at(i)==2){
      count_2=min(count_2,X.at(i));
    }
    if(A.at(i)==3){
      count_3=max(count_3,Y.at(i));
    }
    if(A.at(i)==4){
      count_4=min(count_4,Y.at(i));
    }
  }
  cout<<max(count_2-count_1,0)*max(count_4-count_3,0)<<endl;
}

Measured memory_bytes: 256
// kartikay26
#include <bits/stdc++.h>
using namespace std;
#define debug(x...) 
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
template<typename L>void print(L x){cout << x << endl;}
template<typename T, typename... A>
void print(T x,A... r){cout << x << " ";print(r...);}
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long int ll;
#define int ll
const int inf = LLONG_MAX;
typedef double db;
typedef vector<int> vi;
typedef pair<int, int> pii;

const int mod = 1e9+7;
const int N = 1e6+1;

int32_t main(){
	fast_io();
	int n; cin >> n;
	vi a(n), b(n), c(n-1);
	for(auto &i : a){
		cin >> i;
	}for(auto &i : b){
		cin >> i;
	}for(auto &i : c){
		cin >> i;
	}
	int ans = 0;
	int last = -2;
	for(auto i : a){
		i -= 1;
		ans += b[i];
		if (last + 1 == i) {
			ans += c[last];
		}
		last = i;
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main(){
	int N;
	vector<i64> A;
	cin >> N;
	A.resize(N);
	for(int i = 0;i < N;i++){
		cin >> A[i];
	}
	i64 XOR = 0;
	int r = 0;
	i64 ans = 0;
	for(int l = 0;l < N;l++){
		while(r < N && (XOR & A[r]) == 0){
			XOR |= A[r];
			r++;
		}
		ans += r - l;
		if(l == r){
			r++;
		}
		else{
			XOR = XOR & ~A[l];
		}
	}
	cout << ans << endl;
}


	

Measured memory_bytes: 1792
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MOZI_COUNT 80

/*文書Tの単語と単語のカウント*/
typedef struct bunsyo
{
        char *tango;
         int  count;
}BUN;

int main(void)
{

        int i = 0, j = 0,flag = 0;
        int count = 0;/*一致した単語の数のカウント*/
        char text[80];
        ;/*文章Tの中の単語をそれぞれ格納するもの*/

        while(gets(text) != '\0')
        {
                while(1)
                {
                        if(text[count] == '\0')
                        {
                                break;
                        }
                        count++;
                }
                while(1)
                {
                        while(count != i)
                        {
                                if(text[i] =='\0')
                                {
                                        break;
                                }
                                if(text[i] == 'z')
                                {
                                        text[i] = 'a';
                                }
                                else if( text[i] >= 0x61 && text[i] <= 0x79)
                                {
                                        text[i] += 0x01;
                                }
                                i++;
                        }
                        for(i=0; i < count ; i++)
                        {
                                if(text[i] == 't')
                                {
                                        if((text[i+1] == 'h' &&
                                            text[i+2] == 'i' &&
                                            text[i+3] == 's' )
                                         ||(text[i+1] == 'h' &&
                                            text[i+2] == 'a' &&
                                            text[i+3] == 't' )
                                         ||(text[i+1] == 'h' &&
                                            text[i+2] == 'e' ))
                                        {
                                                flag = 1;
                                                printf("%s\n",text);
                                                break;
                                        }
                                }
                        }
                        i = 0;
                        if(flag == 1)
                        {
                                flag = 0;
                                break;
                        }

                }
                count=0;
        }
        return 0;
}

Measured memory_bytes: 524
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = float("inf")


def main():
    i, o, t, j, l, s, z = map(int, input().split())

    ans = o * 2 + (i // 2) * 4 + (j // 2) * 4 + (l // 2) * 4
    if i >= 1 and j >= 1 and l >= 1:
        i -= 1
        j -= 1
        l -= 1
        ans = max(ans, 6 + o * 2 + (i // 2) * 4 + (j // 2) * 4 + (l // 2) * 4)

    print(ans // 2)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <cstdio>
#include <math.h>
#include <utility>
#include <list>
#include <functional>
#include <queue>
using namespace std;

#define ll long long
#define vecint vector<int>
#define Pii pair<int, int>

string A,B,C;

void solve(){
    if(A[A.size()-1]==B[0]&&B[B.size()-1]==C[0]){
        cout<<"YES";
    }else{
        cout<<"NO";
    }
    cout<<endl;
    return;
}

int main(){
    cin>>A>>B>>C;
    solve();
    return 0;
}


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

#define REPI(i, n) for(int i = 0; i < n; i++)
#define REPJ(j, n) for(int j = 0; j < n; j++)

using ll = long long;
using namespace std;

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

    int a, b, ans = 0; cin >> a >> b;
    a -= 1; b -= 1;

    while(b > 0){
        b -= a; ans++;
    }cout << ans;
}


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

int main()
{
 vector<int>arr(5);
  for(int i=0;i<5;i++)
  {
    cin>>arr[i];
  }
  int ans;
  for(int i=0;i<5;i++)
  {
    if(arr[i] == 0)
    {
      ans=i+1;
    }
  }
  cout<<ans<<endl;
  
}

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

int main()
{
    ll n,W;
    cin>>n>>W;
    ll wt[n+1],v[n+1];
    for(ll i=1;i<=n;i++)
        cin>>wt[i]>>v[i];
        
    
    ll dp[n+1][W+1];
    
    for(ll w=0;w<=W;w++)
        dp[1][w]=0;
    
    
    
    dp[1][wt[1]]=v[1];
    
    for(ll i=2;i<=n;i++)
    {
        for(ll w=0;w<=W;w++)
        {
            dp[i][w]=dp[i-1][w];
            if(wt[i]>=w)
                continue;
            dp[i][w]=max(dp[i][w],dp[i-1][w-wt[i]]+v[i]);
            
        }
    }
    //for(ll i=0;i<=W;i++)
    sort(dp[n],dp[n]+W+1);
    cout<<dp[n][W];

}

Measured memory_bytes: 78336
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val tList = mutableListOf<Int>()
    for (i in 0 until n) {
        tList.add(sc.nextInt())
    }
    val m = sc.nextInt()
    val pxList = mutableListOf<Pair<Int, Int>>()
    for (i in 0 until m) {
        pxList.add((sc.nextInt() to sc.nextInt()))
    }

    pxList.forEach { pair ->
        var sum = 0
        tList.forEachIndexed { i, it ->
            sum += if (i + 1 == pair.first) {
                pair.second
            } else {
                it
            }
        }
        println(sum)
    }
}

Measured memory_bytes: 31388
/*
	Author: zxy_hhhh
	date: 2020/04/25
*/
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include<queue>
#include<iostream>
#define ll long long
inline ll rd() {
	ll _x=0;int _ch=getchar(),_f=1;
	for(;!isdigit(_ch)&&(_ch!='-')&&(_ch!=EOF);_ch=getchar());
	if (_ch=='-'){_f=0;_ch=getchar();}
	for(;isdigit(_ch);_ch=getchar()) _x=_x*10+_ch-'0';
	return _f?_x:-_x;
}
void write(ll _x){if (_x>=10) write(_x/10),putchar(_x%10+'0'); else putchar(_x+'0'); }
inline void wrt(ll _x,char _p){if (_x<0) putchar('-'),_x=-_x; write(_x); if (_p) putchar(_p);}
#include<unordered_map>
#define maxn 21
int n;
int bit;
inline ll id(int l,int r,int x,int y) {return 1ll*l*n*bit*bit+1ll*r*bit*bit+x*bit+y;}
std::unordered_map<ll,ll> mp;
int a[maxn];
std::pair<int,int> c[maxn];
ll dfs(int l,int r,int L,int R) {
	if (l>r) return 0;
	// printf("id[%d][%d][%d][%d]=%lld\n",l,r,L,R,id(l,r,L,R));
	if (mp.count(id(l,r,L,R))) return mp[id(l,r,L,R)];
	ll ans=1e18;
	for(int i=l;i<=r;i++) {
		c[i]=std::make_pair(L,R);
		ans=std::min(ans,1ll*a[i]*(L+R)+dfs(l,i-1,c[i].first+c[l-1].first,c[i].second+c[l-1].second)
		                               +dfs(i+1,r,c[i].first+c[r+1].first,c[i].second+c[r+1].second));
	}
	return mp[id(l,r,L,R)]=ans;
}
int main() {
	n=rd();bit=(1<<n);
	for(int i=1;i<=n;i++) {
		a[i]=rd();
	}
	c[1]=std::make_pair(1,0),c[n]=std::make_pair(0,1);
	wrt(a[1]+a[n]+dfs(2,n-1,1,1),'\n');
}

Measured memory_bytes: 14280
// Maximum profit
#include<stdio.h>

int max(int a, int b){
    return (a > b) ? a : b;
}

int min(int a, int b){
    return (a < b) ? a : b;
}

int main(void){
    int n;
    int i;
    int R, minv, maxv;

    scanf("%d", &n);
    
    scanf("%d", &minv);
    scanf("%d", &R);
    maxv = R - minv;
    minv = min(minv ,R);

    for(i = 2; i < n; i++){
        scanf("%d", &R);
        maxv = max(maxv, R - minv);
        minv = min(minv, R);
    }

    printf("%d\n", maxv);

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> d(N);
  for (int i = 0; i < N; i++) {
   	cin >> d.at(i);
  }

  sort(d.begin(), d.end());
  
  int same =0;
  
  for (int i = 1; i <= N; i++) {
  	if(d[i - 1] == d[i]) {
    	same++;
    }
  }
  
  cout << N -same << endl;
  
}


Measured memory_bytes: 256
def Compare(Ca,Ta):
    if all(Ca[i]==Ta[i] or Ca[i] == "?" for i in range(len(Ca))):
        return 1
    else: return 0
           
S = input()
T = input()
ans = "UNRESTORABLE"
for i in range(1+len(S)-len(T)):
    Comp = S[len(S)-len(T)-i:len(S)-i]
    if Compare(Comp,T):
        ans = S[:len(S)-len(T)-i]+T+S[len(S)-i:]
        ans = ans.replace("?","a")
        break
print(ans)

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    long long n, a, b;
    cin >> n >> a >> b;

    long long ans;
    if (n == a + b) {
      ans = a;
      cout << ans << endl;
    }
    else if (n < a + b) {
      if (n < a) {
        ans = n;
      }
      else {
        ans = a;
      }
      cout << ans << endl;
    }
    else {
      long long t1 = a * (n / (a + b));
      long long t2 = n % (a + b);
      if (t2 > a) {
        ans = t1 + a;
      }
      else {
        ans = t1 + t2;
      }
      cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys

while True:
  n = sys.stdin.readline()
  if not n: break
  n = int(n.rstrip())
  count=0
  for a in range(10):
    for b in range(10):
      for c in range(10):
        if 0 <= n-a-b-c and n-a-b-c <= 9:
          count+=1
  print count

Measured memory_bytes: 6432
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 998244353
#define inf 1e18 
 
using namespace std;
 
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    string s;
    cin>>s;
    for(int i=0;i<3;i++) 
    {
        if(s[i]=='7')
        {
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No";
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    int x;
    cin >> x;
    if(x == 0){
        cout << 1 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 3676
import math 

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

factorization(24) 
if __name__ == "__main__":
    s = int(input())
    a = factorization(s) #行列
    if a[0][0] == 1:
        print(0)
    else:
        an = 0
        for list1 in a: #[3,6]の形
            z = 0
            check = 0
            count = list1[1]
            while True:
                z += 1
                count -= z
                if count < 0:
                    break
                check += 1
            an += check
        print(an)                



Measured memory_bytes: 9500
package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	h := make([]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}
	h[n] = 1000000000 + 1
	ans := 0
	for pos, step := 0, 0; pos < n; pos++ {
		if h[pos] >= h[pos+1] {
			step++
		} else {
			if ans < step {
				ans = step
			}
			step = 0
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
 
using namespace std;
 
int main() {
	int n,m;
	cin >> n >> m;
	int ara[n+1];
	int sum = 0;
	for(int i = 1; i <= n; i++)
	{
		cin >> ara[i];
		sum += ara[i];
	}
	double k = sum/(4.0*m);
	sort(ara+1,ara+n+1);
	int bd = 0;
	for(int i = n; i > 0; i--)
	{
		if(ara[i] >= k)
			bd++;
	}
	if(bd >= m)
		cout <<"Yes" << endl;
	else
		cout <<"No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>

using namespace std;

int main(){
    int a,b,c,d,e;
    scanf( "%d %d\n", &a, &b );
    c = 2 * a - 1;
    d = 2 * b - 1;
    e = a + b;   
    if( d < c && e < c ){
        printf( "%d\n", c );
    }
    else if( c < d && e < d ){
        printf( "%d\n", d );
    } 
    else
    {
        printf( "%d\n", e );
    }
    return 0;
}

Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
ans = []
ans.append(((b-1)//10+1+(c-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+a)
ans.append(((a-1)//10+1+(c-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+b)
ans.append(((a-1)//10+1+(b-1)//10+1+(d-1)//10+1+(e-1)//10+1)*10+c)
ans.append(((a-1)//10+1+(b-1)//10+1+(c-1)//10+1+(e-1)//10+1)*10+d)
ans.append(((a-1)//10+1+(b-1)//10+1+(c-1)//10+1+(d-1)//10+1)*10+e)
print(min(ans))

Measured memory_bytes: 9244
/*************************************************************************
	> File Name: 1.cpp
	> Author: Knowledge_llz
	> Mail: 925538513@qq.com 
	> Blog: https://blog.csdn.net/Pig_cfbsl 
	> Created Time: 2020/5/17 20:32:34
 ************************************************************************/

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#define For(i,a,b) for(register int i=(a);i<=(b);++i)
#define LL long long
using namespace std;
int read(){
	char x=getchar(); int u=0,fg=0;
	while(!isdigit(x)){ if(x=='-') fg=1; x=getchar(); }
	while(isdigit(x)){ u=(u<<3)+(u<<1)+(x^48); x=getchar(); }
	return fg?-u:u;
}
const int maxx=2e5+10;
int n,m,e=0,to[maxx<<1],be[maxx],ne[maxx<<1],dis[maxx],q[maxx<<4];
bool vis[maxx];
void add(int x,int y){
	to[++e]=y;
	ne[e]=be[x];
	be[x]=e;
}
int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.in", "r", stdin);
	freopen("output.out", "w", stdout);
#endif
	int u,v,f=0,l=0;
	n=read(); m=read();
	For(i,1,m){
		u=read(); v=read();
		add(u,v); add(v,u);
	}
	q[++l]=1; vis[1]=1;
	while(f<l){
		int now=q[++f];
		for(int i=be[now];i;i=ne[i]){
			int go=to[i];
			if(vis[go]) continue;
			vis[go]=1;
			dis[go]=now;
			q[++l]=go;
		}
	}
	For(i,2,n){
		if(!dis[i]){
			printf("No");
			return 0;
		}
	}
	printf("Yes\n");
	For(i,2,n) printf("%d\n",dis[i]);

	return 0;
}


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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define Cin(x) cin >> x
#define Cin2(x,y) cin >> x >> y
#define Cin3(x,y,z) cin >> x >> y >> z
#define Cin4(w,x,y,z) cin >> w >> x >> y >> z
#define Cout(x) cout << x << "\n"
#define Cout2(x,y) cout << x << y << "\n"
#define Cout3(x,y,z) cout << x << y << z << "\n"
#define Cout4(w,x,y,z) cout << w << x << y << z << "\n"
#define Kaigyou cout << "\n"
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define Size(n) (n).size()
#define All(v) (v).begin(), (v).end()

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

    ll w,h,n,x[101],y[101],a[101],ans,m1=0,n1=0,m2,n2;
    Cin3(w,h,n);
    m2 = w;
    n2 = h;
    rep(i,n) Cin3(x[i],y[i],a[i]);
    rep(i,n){
        if(a[i]==1){
            if(x[i] > m1)
                m1 = x[i];
        }else if(a[i]==2){
            if(x[i] < m2)
                m2 = x[i];
        }else if(a[i]==3){
            if(y[i] > n1)
                n1 = y[i];
        }else{
            if(y[i] < n2)
                n2 = y[i];
        }
    }
    if(m2-m1<=0 || n2-n1<=0) ans = 0;
    else ans = (m2-m1)*(n2-n1);
    Cout(ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  while(a!=0&&b!=0){
    for(int i=0;i<a;i++){
      for(int j=0;j<b;j++){
	cout<<"#";
      }
      cout<<endl;
    }
    cout<<endl;
    cin>>a>>b;
  }
  return 0;
}

Measured memory_bytes: 3072
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { cout << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	int x;
	while(cin >> n >> x){
		if(n == 2){
			if(x != 2){
				cout << "No" << endl;
			}else{
				cout << "Yes" << endl;
				cout << 1 << endl << 2 << endl << 3 << endl;
			}
		}else{
			if(x == 1 or x == 2*n-1){
				cout << "No" << endl;
			}else{
				vector<int> ans(2*n-1,-1);
				if(x == 2){
					ans[n-1] = 2;
					ans[n-1-1] = 3;
					ans[n-2-1] = 5;
					ans[n+1-1] = 1;
					ans[n+2-1] = 4;
					int p = 1;
					REP(i,SZ(ans)){
						if(!(n-3 <= i and i <= n+1)){
							while(1 <= p  and p <= 5) p++;
							ans[i] = p;
							p++;
						}
					}
				}else if(x == 2*n-2){
					ans[n-2-1] = x-1;
					ans[n-1-1] = x+1;
					ans[n-1] = x;
					ans[n+1-1] = x-2;
					ans[n+2-1] = x-3;
					int p = 1;
					REP(i,SZ(ans)){
						if(!(n-3 <= i and i <= n+1)){
							while(x-3 <= p  and p <= x+1) p++;
							ans[i] = p;
							p++;
						}
					}
				}else{
					DEBUG("hoge");
					ans[n-1] = x;
					ans[n-1-1] = x+1;
					ans[n-2-1] = x-2;
					ans[n+1-1] = x-1;
					ans[n+2-1] = x+2;
					int p = 1;
					REP(i,SZ(ans)){
						DEBUG(i);
						if(!(n-3 <= i and i <= n+1)){
							while(x-2 <= p  and p <= x+2) p++;
							ans[i] = p;
							p++;
						}
					}
				}
				cout << "Yes" << endl;
				REP(i,SZ(ans)){
					cout << ans[i] << endl;
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int h,a;
    cin>>h>>a;
    double x=(1.0*h)/a;
    int m=x;
    if(m==x)
    {
        cout<<m<<endl;
    }
    else{
        cout<<m+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  set<int>s;
  vector<int>a(n);
  vector<int>c(3);
  for(int i=0;i<n;i++)
  {
    int d;
    cin>>d;
    s.insert(d);
    a[i]=d;
  }
  vector<int>f;
  for(auto x:s)
  {
    f.push_back(x);
  }
  for(int i=0;i<n;i++)
  {
    if(a[i]==f[0])c[0]++;
    if(a[i]==f[1])c[1]++;
    if(a[i]==f[2])c[2]++;
  }
  if(s.size()>3)cout<<"No"<<endl;
  else if(s.size()==1 && f[0]==0)cout<<"Yes"<<endl;
  else if(s.size()==2 && f[0]==0 && c[1]==(2*n)/3 && c[0]==n/3)cout<<"Yes"<<endl;
  else if(s.size()==3 && ((f[0]^f[1])^f[2])==0 && c[0]==n/3 && c[1]==n/3)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  //cout<<s.size()<<endl;
  return 0;
}

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

#define rep(i,a,n) for(int i=a; i<n; i++)
#define repr(i,a,n) for(int i=a; i>=n; i--)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 999999999

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long int ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int const MOD = 1000000007;

int main() {
    int a[110];
    memset(a, 0, sizeof(a));
    int n;
    int m_num = 0;
    while(cin >> n) {
        // if(n == 0) break;
        a[n]++;
        m_num = max(m_num, a[n]);
    }

    rep(i,1,101) {
        if(a[i] == m_num) cout << i << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N;
    cin >> N;
    ll pow = 1;
    for(int i = 1; i <= N; i++){
        pow *= i;
        pow %= 1000000007;
    }
    cout << pow << endl;
}


Measured memory_bytes: 3540
N = int(input())
A = list(map(int, input().split()))
 
Asum = sum(A)
 
s=0
t=0
for i,Ai in enumerate(A):
    s+=Ai
    if s == Asum/2:
        print(0)
        exit()
    if s >= Asum/2:
        s = i
        break
for i,Ai in enumerate(A[::-1]):
    t+=Ai
    if t >= Asum/2:
        t = i
        break
 
ans1 = abs(sum(A[:s])-(Asum-sum(A[:s])))
ans2 = abs(sum(A[::-1][:t])-(Asum-sum(A[::-1][:t])))
 
print(min(ans1,ans2))

Measured memory_bytes: 26060