akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a,b,c,k;
	scanf("%d%d%d%d",&a,&b,&c,&k);
	int ret=0;
	int t=min(a,k);
	ret+=t;
	k-=t;
	t=min(b,k);
	k-=t;
	t=min(c,k);
	ret-=t;
	printf("%d\n",ret);
}


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

typedef long long ll;

const int mod = 1000000007;

int x, y;
int res;

int toPower(int a, int p)
{
    int res = 1;
    while (p) {
        if (p & 1) res = ll(res) * a % mod;
        p >>= 1; a = ll(a) * a % mod;
    }
    return res;
}

int Inv(int x) { return toPower(x, mod - 2); }

int C(int n, int k)
{
    int res = 1;
    for (int i = 1; i <= k; i++) {
        res = ll(res) * (n - i + 1) % mod;
        res = ll(res) * Inv(i) % mod;
    }
    return res;
}

int main()
{
    cin >> x >> y;
    for (int i = 0; i <= x && i <= y; i++) {
        int lft = x - i + y - i;
        if (lft == i) {
            printf("%d\n", C(lft, x - i));
            return 0;
        }
    }
    printf("0\n");
    return 0;
}


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

int main(){
    string s,t;
    cin>>s>>t;
    map<int,int> mp,tmp;
    int n=s.size();
    int c[26]={},tc[26]={};
    bool ok=true;
    for(int i=0;i<n;i++){
        if(c[s[i]-'a']){
            if(t[mp[s[i]-'a']]!=t[i]){
                ok=false;
                break;
            }
        }
        if(tc[t[i]-'a']){
            if(s[tmp[t[i]-'a']]!=s[i]){
                ok=false;
                break;
            }
        }
        c[s[i]-'a']++;
        tc[t[i]-'a']++;
        mp[s[i]-'a']=i;
        tmp[t[i]-'a']=i;
    }

    if(ok) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 776
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% mod + mod) % mod) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint & a) {
		if ((x += a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator-=(const mint & a) {
		if ((x += mod - a.x) >= mod) x -= mod;
		return *this;
	}
	mint & operator*=(const  mint & a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint & a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

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



//小文字=大文字+32
int main() {
	int n, x;
	cin >> n >> x;
	vector<ll>l(n+1);
	l[0]=0;
for(int i=1;i<n+1;i++){
		cin >> l[i];
		l[i] += l[i - 1];
	}

ll ans=0;
for (int i = 0; i < n + 1; i++) {
	if (l[i] <= x) {
		ans++;
	}
}
cout << ans;
}
	



Measured memory_bytes: 3520
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << '\n';
#define CFYN(n) cout << ( (n) ? "YES":"NO") << '\n';
#define OUT(n) cout << (n) << '\n';
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

constexpr int MOD = 1000000007;

int mod(const ll &x){
    return x > 0 ? x % MOD : (x+MOD) % MOD;
}

int modm(const ll &x,const ll &m){
    return (x % MOD) * (m % MOD) % MOD;
}

int modpow(ll x, ll p) {
    int ret = 1;
    while(p > 0) {
        if (p & 1) ret = modm(ret,x);
        x = modm(x,x);
        p >>= 1;
    }
    return ret;
}

// x * modinv(d)
int modd(ll x,ll d) {
    return modm(x,modpow(d,MOD-2));
}

int main(void)
{
    IOS
    int N; cin >> N;
    vector<int> A(N);
    int msum = 0;
    REP(i,N) {
        cin >> A[i];
        msum = mod(msum + A[i]);
    }

    int ans = 0;
    REP(i,N-1) {
        msum = mod(msum - A[i]);
        ans = mod(ans + modm(A[i],msum));
    }

    cout << ans << '\n';

    return 0;
}

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

#define INF 1000010000
#define nl '\n'
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
#define pdd pair<double,double>
#define all(c) (c).begin(), (c).end()
#define SORT(c) sort(all(c))
#define sz(c) (c).size()
#define rep(i,n) for( int i = 0; i < n; ++i )
#define repi(i,n) for( int i = 1 ; i <= n; ++i )
#define repn(i,n) for( int i = n - 1 ; i >= 0 ; --i )
#define repf(j,i,n) for( int j = i ; j < n ; ++j )
#define die(s) {std::cout << s << nl;}
#define dier(s) {std::cout << s; return 0;}
#define dbg(var) {std::cout << #var << "  = " << var << nl;}
#define vi vector<int>
typedef long long ll;

using namespace std;
vector<ll> v;
map<int , int> memo;


int rec(int n){
	if(n < 6) return n;
	if(memo.find(n) != memo.end()) return memo[n];
	int ans = n;
	for(auto e : v){
		if(n - e >= 0){
			ans = min(ans , 1 + rec(n - e));
		}
	}
	return memo[n] = ans;
}

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

	ll a = 6;
	while(a <= 100000LL)v.pb(a), a *= 6;
	a = 9;
	while(a <= 100000LL)v.pb(a), a *= 9;
	SORT(v);
	
	int n;
	cin >> n;
	int ans = rec(n); 
	
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
using namespace std;
const int Nmax = 100000, Mmax = 100000;
int N,M;
long K;
long X[Nmax];
int A[Mmax];
long d0[Nmax];
int s[Nmax], t[Nmax];
int tmp[Nmax];

void pow(int* sub, long n, int* res){
    if(n == 1){
        for(int i=0; i<N; i++) res[i] = sub[i];
    }
    else if(n%2 == 1){
        pow(sub, n-1, res);
        for(int i=0; i<N; i++) tmp[i] = res[sub[i]];
        for(int i=0; i<N; i++) res[i] = tmp[i];
    }
    else{
        pow(sub, n/2, res);
        for(int i=0; i<N; i++) tmp[i] = res[res[i]];
        for(int i=0; i<N; i++) res[i] = tmp[i];
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin >> N;
    for(int i=0; i<N; i++){
        cin >> X[i];
    }
    cin >> M >> K;
    for(int i=0; i<M; i++){
        cin >> A[i];
    }

    for(int i=0; i<N-1; i++){
        d0[i] = X[i+1] - X[i];
    }

    for(int i=0; i<N; i++){
        s[i] = i;
    }

    for(int i=0; i<M; i++){
        int tmp = s[A[i]-2];
        s[A[i]-2] = s[A[i]-1];
        s[A[i]-1] = tmp;
    }
    /*
    for(int i=0; i<N; i++) cout << s[i] << " ";
    cout << endl;
    */

    pow(s, K, t);

    /*
    for(int i=0; i<N; i++) cout << t[i] << " ";
    cout << endl;
    */

    long ans=X[0];
    cout << ans << endl;
    for(int i=0; i<N-1; i++){
        ans += d0[t[i]];
        cout << ans << endl;
    }

    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
typedef long long ll;

string divide[4] = {"dream","dreamer","erase","eraser"};
    bool dp[100010];

int main() {
    string S; cin >> S;
    dp[0] = 1;
    rep(i,S.size()){
        if(!dp[i]) continue;
        for(int j = 0; j < 4; j++){
            string d = divide[j];
            if(S.substr(i,d.size()) == d){
                dp[i + d.size()] = 1;
            }
        }
    }
    cout << (dp[S.size()] ? "YES" : "NO") << endl;
    return 0;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>
#include <bitset>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

ll H, W;

int main() {

	cin >> H >> W;

	if (H == 1 || W == 1) {
		cout << 1 << endl;
		return 0;
	}

	cout << (H * W + 1) / 2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
 
using namespace std;
 
#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define chmax(x,y) x = max(x,y)

 
typedef vector<int> VI;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    VI a(n+1);
    for(int i = 1; i <= 100; i++) {
        for(int j = 1; j<= 100; j++) {
            for(int k = 1; k<=100; k++) {
                int t = i*i + j*j + k*k + i*j + i*k + j*k;
                if(t <= n) a[t]++;
            }
        }
    }
    int cnt = 0;

    for(int i = 1; i<=n; i++) {
        cout << a[i] << endl;
    }

}


Measured memory_bytes: 3596
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == t[i]) {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int h, w;

bool ok(int i, int j) {
    return i >= 0 && i < h && j >= 0 && j < w;
}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    cin >> h >> w;
    int n;cin >> n;
    int si, sj;cin >> si >> sj;si--;sj--;
    string s, t;cin >> s >> t;
    string ans = "YES";
    char a[] = {'R', 'U', 'L', 'D'};
    char b[] = {'L', 'D', 'R', 'U'};
    inc(k, 0, 4){
        int ci = si;
        int cj = sj;
        inc(i, 0, n){
            if(s[i] == a[k]){
                ci += di[k];
                cj += dj[k];
                if(!ok(ci, cj)) ans = "NO";
            }
            if(t[i] == b[k]){
                ci += di[(k+2)%4];
                cj += dj[(k+2)%4];
                if(!ok(ci, cj)){
                    ci -= di[(k+2)%4];
                    cj -= dj[(k+2)%4];
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 920
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<string>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
int main() {
	ll a, b;
	cin >> a >> b;
	if (a*b %2 == 0)
		cout << "Even" << endl;
	else
		cout << "Odd" << endl;
}

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define REPV(iter, v) for(auto (iter)=(v).begin(); (iter)!=(v).end();++(iter))
#define ALL(v) (v).begin(),(v).end()

#define MOD 1000000007

using namespace std;

typedef long long ll;

int main()
{
    ll N, K;
    cin >> N >> K;
    vector<ll> x(N), y(N), sortX(N), sortY(N);
    REP(i, N)
    {
        cin >> x[i] >> y[i];
        sortX[i] = x[i];
        sortY[i] = y[i];
    }
    sort(ALL(sortX));
    sort(ALL(sortY));

    ll ans = LONG_MAX;
    for (ll i = 0; i < N - 1; ++i)
    {
        for (ll j = i + 1; j < N; ++j)
        {
            for (ll k = 0; k < N - 1; ++k)
            {
                for (ll l = k + 1; l < N; ++l)
                {
                    ll x1 = sortX[i], x2 = sortX[j], y1 = sortY[k], y2 = sortY[l];
                    // cout << x1 << " " << x2 << " " << y1 << " " << y2 << endl;
                    ll countP = 0;
                    REP(i, N)
                    {
                        if (x[i] >= x1 && x[i] <= x2 && y[i] >= y1 && y[i] <= y2) countP++;
                    }
                    if (countP >= K)
                    {
                        if (x1 < x2 && y1 < y2)
                        {
                            ans = min(ans, (x2 - x1) * (y2 - y1));
                        }
                    }
                }
            }
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
#define INF 1e18
#define x first
#define y second
string k;
const ll MOD = 1e9+7, a = 10007, b = 107, c = 2;
int mod;
ll dp[a][b][c];
void init(){
    for (int i = 0; i < a; ++i) {
        for (int j = 0; j < b; ++j) {
            for (int l = 0; l < c; ++l) {
                dp[i][j][l] = -1;
            }
        }
    }
}
ll solve(int index, int m, bool good)
{
    if(index == k.length()) {
        if(m%mod==0)
            return 1;
        else
            return 0;
    }
    if(dp[index][m][good] != -1)
        return dp[index][m][good];
    else{
        int last = int(k[index]) - 48;
        ll ans = 0;
        if(good) {
            for (int i = 0; i <= 9; ++i) {
                ans = (ans + solve(index + 1, (m + i) % mod, true)) % MOD;
            }
        }
        else{
            for (int i = 0; i < last; ++i) {
                ans = (ans + solve(index + 1, (m + i) % mod, true)) % MOD;
            }
            ans = (ans + solve(index + 1, (m + last) % mod, false)) % MOD;
        }
        return dp[index][m][good] = ans;
    }
}
int main() {
    fast;
    cin>>k>>mod;
    init();
    ll answer = solve(0, 0, false) - 1;
    if(answer < 0)
        answer += MOD;
    cout<<answer;
}

Measured memory_bytes: 17792
#include <iostream>
#include <string>
#include <cmath>
#include<iomanip>

using namespace std; 

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


int main() {
    
  int A, B;
  int ans;
  
  cin >> A >> B;

  if(A >= 13){
	  ans = B;
  } else if( 6 <= A ){
	  ans = B / 2;
  } else {
	  ans = 0;
  }

  cout << ans << endl;

  return 0;
}

/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define vec vector
#define rep(i,n) for (int i=0; i<(n); i++)
#define reps(i,s,n) for (int i=(s); i<(n); i++)
#define rep1(i,n) for (int i=1; i<=(n); i++)
#define repr(i,s,n) for (int i=(s)-1; i>=(n); i--)
#define print(a) cout << a << endl
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()


int main() {
  string s;
  cin >> s;
  int n = s.size();
  if (s[n-1] == '1' || s[0] == '0') {
    print(-1);
    return 0;
  }
  rep(i,n/2) {
    if (s[i] != s[n-i-2]) {
      print(-1);
      return 0;
    }
  }
  int par=1,node=2;
  rep(i,n/2) {
    if (s[i] == '1') {
      print(par << ' ' << node);
      par = node;
      node++;
    } else {
      print(par << ' ' << node);
      node++;
    }
  }
  while (node <= n) {
    print(par << ' ' << node);
    node++;
  }
  return 0;
}

Measured memory_bytes: 3756
#include<stdio.h>
int main() {
	int n = 0;
	int m = 0;
	double a;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		if ((i + 1) % 2 == 1) {
			m++;
		}
	}
	a = (double)m / n;
	printf("%f\n", a);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll n, ans = 0; cin >> n;
    vector<ll> a(n+1);
    vector<ll> nonLeaf(n+1);
    bool possible = true;

    rep(i, n+1){
        cin >> a[i];
        if(i == 0) nonLeaf[i] = 1 - a[i];
        else nonLeaf[i] = ((nonLeaf[i-1]>=1 && nonLeaf[i-1]<=(1LL<<61)) ? nonLeaf[i-1]*2 : nonLeaf[i-1]) -a[i];
        if(nonLeaf[i] < 0) possible = false;
    }

    if(!possible) ans = -1;
    else{
        vector<ll> b(n+1);
        for(ll i=n; i>=0; i--){
            if(i == n) b[i] = a[i];
            else b[i] = min(nonLeaf[i], b[i+1]) + a[i];
            ans += b[i];
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 5572
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        int a = inp.nextInt();
        int b = inp.nextInt();
        int c = inp.nextInt();
        if (a == b && a != c || a == c && a != b || b == c && a != b) {
            System.out.println("Yes");
        }
        else {
            System.out.println("No");
        }
    }
}

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

int main()
{
  int64_t A, B, N, a;
  cin >> A >> B >> N;
  a = B - 1;
  if (a > N)
  {
    a = N;
  }
  int64_t ans = (A * a) / B;
  cout << ans << endl;
}


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

using namespace std;

int main()
{
  int c[2] = {0};
  for(int i = 0; i < 3; i++) {
    int a; cin >> a;
    if(a == 5) c[0]++;
    if(a == 7) c[1]++;
  }
  if(c[0] == 2 && c[1] == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	h := make([]int, n)
	hh := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
		hh[i] = 0
	}

	for i := 0; i < n-1; i++ {
		if h[i] >= h[i+1] {
			hh[i] = 1
		}
	}

	cnt := 0
	max := 0
	for _, j := range hh {
		if j == 1 {
			cnt++
			if max < cnt {
				max = cnt
			}
		} else {
			cnt = 0
		}
	}
	fmt.Println(max)
}


Measured memory_bytes: 5504
#include <stdio.h>
int main(void)
{
int w[200][3];
int a,b,c,x,sc,co;
scanf("%d",&x);
for(a=0;a<x;a++){
	for(b=0;b<3;b++){
		scanf("%d",&w[a][b]);
	}
}
	for(a=0;a<x;a++){
		sc=0;
		for(b=0;b<3;b++){
			co=0;
		for(c=0;c<x;c++){
			if(w[c][b]==w[a][b]){
				co++;
			}
		}
		if(co==1){
			sc+=w[a][b];
		}
	}
	printf("%d\n",sc);
}
	return 0;
}

Measured memory_bytes: 1784
n = int(input())

if 400 <= n <= 599:
    print(8)
elif  600 <= n <= 799:
    print(7)
elif  800 <= n <= 999:
    print(6)
elif  1000 <= n <= 1199:
    print(5)
elif  1200 <= n <= 1399:
    print(4)
elif  1400 <= n <= 1599:
    print(3)
elif  1600 <= n <= 1799:
    print(2)
elif  1800 <= n <= 1999:
    print(1)
else:
    print('error')

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    ll ans = 0;
    for(int i = 0; i <= n; ++i){
        for(int j = 0; j <= n; ++j){
            if(n - i*r - j*g >= 0 && (n - i*r -j*g) % b == 0) ++ ans;
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
# coding: utf-8
def main():
    n = int(input())
    s, t = input().split(' ')
    sent = ''

    
    for i in range(n):
        sent += s[i] + t[i]
        
    print(sent)
    
    return 0
    
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,i;
    string s;
    cin>>k;
    cin>>s;
    if(s.size()<=k)
        cout<<s<<endl;
    else
    {
        for(i=0;i<k;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
}


Measured memory_bytes: 3604
using System;
using System.Linq;

namespace AtCoder.BeginnersSelections
{
    class Test
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int count = 0;

            Array.Sort(d);
            for (int i = d[N / 2 - 1]; i < d[N / 2]; i++)
                count++;

            Console.WriteLine(count);
        }
    }
}

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

using namespace std;
typedef long long ll;
const ll mx = 10000007;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
#define    ss   second
#define    ff   first
#define    pb   push_back
#define gcd(a, b) __gcd((a), (b))
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
#define FIO ios_base::sync_with_stdio(false);  cin.tie(NULL);


int main() {
    FIO;
   string a, b;
   cin >> a >> b;
   ll c = 0;
   for (ll i = 0; i < a.size(); i++) {
    if(a[i] != b[i]) {
        c++;
    }
   }

   cout << c << endl;
}


Measured memory_bytes: 3800
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int a,b,c;
    cin>>a>>b;
    if(a<b)
        c=0;
    else
        c=10;
    cout<<c<<endl;

    return 0;
}


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

using namespace std;

vector<pair<int, int>> pt;
vector<int> id;
int n;

double getDist(pair<int, int> a, pair<int, int> b){
    return sqrt((a.first - b.first) * (a.first - b.first)
                + (a.second - b.second) * (a.second - b.second));
}

int fact(int a){
    if(a <= 1) return 1;
    int res = 1;
    for(int i = 2; i <= a; i++) res *= i;
    return res;
}

int main(){
    cin >> n;
    for(int i = 0; i < n; i++){
        int x, y;
        cin >> x >> y;
        pt.emplace_back(x, y);
        id.push_back(i);
    }
    double sm = 0;
    do{
        for(int i = 0; i < n - 1; i++){
            sm += getDist(pt[id[i]], pt[id[i + 1]]);
        }
    } while(next_permutation(id.begin(), id.end()));
    double ans = sm / (double) fact(n);
    cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int l,r,d,cnt=0;
     cin>>l>>r>>d;
     for(int i=l;i<=r;i++)
         if(i>=d&&(i%d==0))
            cnt++;
     cout<<cnt<<endl;
     return 0;
}


Measured memory_bytes: 3576
import numpy as np
n,m=map(int,input().split())
ks=[list(map(int,input().split())) for i in range(m)]
p=list(map(int,input().split()))

s=np.array([[0]*n for i in range(m)])
for i in range(m):
  for j in range(n):
    if j+1 in ks[i][1:]:
      s[i,j] = 1

cnt=0
for i in range(2**n):
  on_off=np.array(list(map(int,list(bin(i)[2:].zfill(n)))))
  for i in range(m):
    if sum(on_off*s[i])%2!=p[i]:
      break
  else:
    cnt+=1
print(cnt)

Measured memory_bytes: 12452
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>


#define REP(i,N) for(auto i = 0; i <N; i++)


typedef long long ll;
//const int MOD = pow(10,9)+7;
//const int MAX = 100001;

using namespace std;
int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}




void dfs(int &flag, int st, int gl, vector<int> *links, int depth, int *visited){
    
    if (depth == 2 && st == gl)  {  //条件を満たすパスを発見
        flag = 1;
        return;
    }
    
    if (depth >= 2) return;
    if (flag == 1) return; ///ルートが一度発見されたらもう再帰は必要ない。
    
    
    for(auto it = links[st].begin(); it != links[st].end() ;it++){
        
        if (visited[*it] == 1) continue;
        visited[*it] = 1;
        dfs(flag,*it, gl,links,depth+1,visited);
        visited[*it] = 0;
        
    }
    
}

int main() {
    
    int N = in(); int M = in();
    
    vector<int> links[N+1];
    
    int st,gl;
    REP(i,M){
        st = in();
        gl = in();
        links[st].push_back(gl);
        links[gl].push_back(st);
    }
    
    
    int visited[N+1];
    REP(i,N+1){
        visited[i] = 0;
    }
    
    visited[1] = 1;
    
    int flag = 0;
    dfs(flag ,1,N,links,0,visited);
    
    
    if(flag == 1){
        cout << "POSSIBLE" << endl;
    }else{
        cout << "IMPOSSIBLE" << endl;
    }
    
    
    return 0;
    
    
}









Measured memory_bytes: 12784
#include <iostream>
#include <algorithm>
using namespace std;
int i,g[10000000],a[10000000],len;
const int inf=0x7f7f7f7f;
int main()
{
    int n; cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    reverse(a + 1, a + n + 1);
    g[0]=-inf;
    for (int i = 1; i <= n; i++)
    {
        if(a[i]>=g[len])
        {
            len++;
            g[len]=a[i];
            continue;
        }
        int x=0,y=len,mid;
        while(x<y)
        {
            mid=(x+y)>>1;
            if(g[mid]>a[i])
                y=mid;
            else
                x=mid+1;
        }//二分在g数组里找第一个大于等于a[i]的数
        g[x]=min(g[x],a[i]);//进行比较，贪心思想
    }
    cout<<len<<endl;
    return 0;
}



Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
int c[10][10];
bool yes;
int main()
{
    for (int i=0;i<3;i++)
    {
        for (int j=0;j<3;j++)
            cin >>c[i][j];
    }
    for (int i=0;i<=100;i++)
    {
        for (int j=0;j<=100;j++)
        {
            for (int k=0;k<=100;k++)
            {
                bool flag=true;
                int a[]={i,j,k},a1=i;
                int b[]={(c[0][0]-a1),(c[0][1]-a1),(c[0][2]-a1)};
                for (int q=0;q<3;q++)
                {
                    for (int u=0;u<3;u++)
                    {
                        if (a[q]+b[u]!=c[q][u])
                            flag=false;
                    }
                }
                yes|=flag;
            }
        }
    }
    yes?cout<<"Yes":cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 0x7fffffff
using namespace std;
typedef long long ll;
string s1,s2;
int len1,len2;
bool mark;
int main()
{
    char c;
    cin>>s1>>s2;
    len1=s1.size();
    len2=s2.size();
    if(len1!=len2)
    {
        puts("No");
        return 0;
    }
    for(int i=0;i<len1;i++)
    {
        mark=true;
        for(int j=0;j<len1;j++)
            if(s1[j]!=s2[(i+j)%len1])
            {
                mark=false;
                break;
            }
        if(mark)
        {
            puts("Yes");
            return 0;
        }
    }
    puts("No");
    return 0;
}

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

int main(){
  int N, K;
  cin >> N >> K;
  string S;
  cin >> S;
  
  if(S[K-1] == 'A')S[K-1] = 'a';
  if(S[K-1] == 'B')S[K-1] = 'b';
  if(S[K-1] == 'C')S[K-1] = 'c';
  cout << S;

}


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

#define debug(x) cout << #x << " = " << x << endl

const int INF = 1<<29;

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

ll MOD = 1000000007;

int main(){
   int N;
   cin >> N;
   ll T[N], A[N],B[N];
   for(int i=0; i<N; i++) cin >> T[i];
   for(int i=0; i<N; i++) cin >> A[i];
   fill(B,B+N,-1);

   ll ans = 1;
   bool ok = T[N-1] == A[0];
   
   for(int i=0; i<N-1; i++){
	  if(T[i] == T[i+1])continue;
	  if(T[i+1] > A[i+1]){
		 ok = false;
	  }
   }

   for(int i=N-1; i>0; i--){
   	  if(A[i] == A[i-1])continue;
   	  if(A[i-1] > T[i-1]){
   		 ok = false;
   	  }
   }
   

   if(!ok) cout << 0 << endl;
   
   else {
	  for(int i=1; i<N; i++){
		 if(T[i-1] != T[i]){
			B[i] = 0;
			continue;
		 }
		 B[i] = T[i];
	  }

	  for(int i=N-2; i>=0; i--){
		 if(A[i] != A[i+1]){
			B[i] = 0;
			continue;
		 }

		 if(B[i] == -1) B[i] = A[i];
		 else {
			B[i] = min(B[i],A[i]);
		 }
	  }
	  
	  B[0] = 0, B[N-1] = 0;

	  for(int i=1; i<N-1; i++){
		 if(B[i] <= 0)continue;
		 ans = (ans * B[i]) % MOD;
	  }
	  
	  cout << ans << endl;
   }
   return 0;
}


Measured memory_bytes: 2560
N = int(input())
list = []
bool = True

for i in range(N):
    list.append(input())
if len(set(list)) != len(list):
    bool = False
else:
    for i in range(N - 1):
        if list[i][-1] != list[i+1][0]:
            bool = False

if bool:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
num=[]
a=[] 
time = 0 
for i in range(5):
    num.append(int(input()))
    if num[i]%10 == 0:
        a.append(0)
    else:
        a.append(10 - num[i]%10)
    time += num[i] + a[i]

time -= max(a)

print(time)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int A,B;
  cin >> A >> B;
  if(A%3==0 || B%3==0 || (A+B)%3==0 ){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
  return 0;
    

}


Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a-1;i>=0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

int main(){
    ll n;
    cin >> n;
    VE a(n);
    REP(i, n)cin >> a[i];
    sort(a.begin(), a.end());
    while(true){
        ll m = 0;
        REP(i, n)if(a[i]){m = a[i];break;}
        REP(i, n){
            if(a[i] == m)continue;
            a[i] = a[i] % m;
        }
        sort(a.begin(), a.end());
        bool f = true;
        REP(i, n)if(a[i] != m && a[i] != 0)f = false;
        if(f)break;
    }
    print(a[n-1]);
}

Measured memory_bytes: 1024
// AOJ 2169 Colored Octahedra
// 2018.3.20 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int  hash[16777218];

int tbl[24][8] = {
{0,1,2,3,4,5,6,7},{0,3,7,4,1,2,6,5},{0,4,5,1,3,7,6,2},
{1,0,4,5,2,3,7,6},{1,2,3,0,5,6,7,4},{1,5,6,2,0,4,7,3},
{2,1,5,6,3,0,4,7},{2,3,0,1,6,7,4,5},{2,6,7,3,1,5,4,0},
{3,0,1,2,7,4,5,6},{3,2,6,7,0,1,5,4},{3,7,4,0,2,6,5,1},
{4,0,3,7,5,1,2,6},{4,5,1,0,7,6,2,3},{4,7,6,5,0,3,2,1},
{5,1,0,4,6,2,3,7},{5,4,7,6,1,0,3,2},{5,6,2,1,4,7,3,0},
{6,2,1,5,7,3,0,4},{6,5,4,7,2,1,0,3},{6,7,3,2,5,4,0,1},
{7,3,2,6,4,0,1,5},{7,4,0,3,6,5,1,2},{7,6,5,4,3,2,1,0}};

char name[8][22];
int id[8]; int n;
char used[8];
int color[8];
int ans;

int check()
{
	int i, j, id;
	int t[8];

	id = 0; for (i = 0; i < 8; i++) id = (id << 3) | color[i];
	if (hash[id]) return 0;
	hash[id] = 1;
	for (j = 0; j < 24; j++) {
		for (i = 0; i < 8; i++) t[i] = color[tbl[j][i]];
		id = 0; for (i = 0; i < 8; i++) id = (id << 3) | t[i];
		hash[id] = 1;
	}
	return 1;
}

void rec(int k)
{
	int i, p;

	if (k == 8) {
		if (check()) ans++;
		return;
	}
	p = -1;
	for (i = 0; i < 8; i++) {
		if (used[i] || id[i] == p) continue;
		color[k] = p = id[i];
		used[i] = 1, rec(k+1), used[i] = 0;
	}
}

int cmp(char *a, char *b) { return *a - *b; }

int main()
{
	int i, j, p;

    while(1) {
		memset(hash, 0, sizeof(hash));
		n = 0;
		for (i = 0; i < 8; i++) {
			if (scanf("%s", name[i]) != 1) return 0;
			for (j = 0; ; j++) {
				if (j == i) { id[i] = n++; break; }
				if (!strcmp(name[j], name[i])) { id[i] = id[j]; break; }
			}
		}
		if (n == 1) { puts("1"); continue; }
		if (n == 8) { puts("1680"); continue; }
		qsort(id, 8, sizeof(int), cmp);

		ans = 0; p = -1;
		memset(used, 0, sizeof(used));
		for (i = 0; i < 8; i++) {
			if (id[i] == p) continue;
			color[0] = p = id[i];
			used[i] = 1, rec(1), used[i] = 0;
		}
		printf("%d\n", ans);
	}
	return 0;
}


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

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

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

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

using namespace std;

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

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

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

// Problem Specific Parameter:

int main(void){
	int t;
	cin >> t;
	rep(loop,t){
		ll a,b,c,d;
		cin >> a >> b >> c >> d;
		bool ok = true;
		if(a < b) ok = false;
		if(b > d) ok = false;
		const ll g = __gcd(b,d);
		ll tar = c / g;
		ll cmin = tar * g + (a % g);
		while(cmin - g >= c) cmin -= g;
		while(cmin <= c) cmin += g;
		
		if(cmin < b) ok = false;

		if(ok)
			puts("Yes");
		else
			puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)
#define speed ios::sync_with_stdio(0); cin.tie(0);
int const N = 1e5 + 2;

bool solve(int n){
	int x = n, an = 0;
	while(x){
		an += x % 10;
		x /= 10;
	}
	if (!(n % an)) return 1; else return 0;
}

int main(){
	speed
	int n;
	cin >> n;
	cout << (solve(n) ? "Yes" : "No") << endl;
}


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

using namespace std;
using ll = long long;

const int mod = 1e9 + 7;

int n, k;
vector<ll> a;
vector<ll> dp;

int main(){
    cin>>n>>k;
    a.resize(n+1); dp.resize(k+1);
    for(int i = 1; i <= n; i++){
        cin>>a[i];
    }
    dp[0] = 1;
    for(int i = 1; i <= n; i++){
        vector<ll> csum(k+1);
        csum[0] = dp[0];
        for(int u = 1; u <= k; u++){
            csum[u] = (dp[u] + csum[u-1]) % mod;
        }
        for(int j = 0; j <= k; j++){
            // j - a[i] to j
            if(j - a[i] > 0){
                dp[j] = (mod + csum[j] - csum[j-a[i]-1]) % mod;
            }else{
                dp[j] = csum[j] % mod;
            }
        }
    }
    ll res = dp[k];
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<cmath>
#include<queue>
#include<limits>
#include<cassert>
#include<set>
#include<tuple>
#include<map>
typedef long long ll;
using namespace std;

int main() {
	string s; cin >> s;
	int a =200001;
	int z = 0;
	for (int i = 0; i < s.size(); ++i) {
		if (s[i] == 'A' && i < a) {
			a = i;
		}
		if (s[i] == 'Z' && i > z) {
			z = i;
		}
	}
	cout << z - a + 1 << endl;
}


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

int main(){
    
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int a[200001], n, k;
    long long sum = 0;
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
        cin >> a[i];
    sort(a, a + n, greater<int>());
    for(int i = k; i < n; ++i)
        sum += a[i];
    cout << sum << '\n';
    return 0;
}


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

namespace ABC156B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NK = Console.ReadLine().Split(' ');
            int N = int.Parse(NK[0]);
            int K = int.Parse(NK[1]);
            int max = 1;
            int n = 1;
            while (max * K <= N)
            {
                max *= K;
                n += 1;
            }
            Queue<int> ans = new Queue<int>();
            for(int i = n; i > 0; i--)
            {
                int a = 0;
                while (N >= max)
                {
                    N -= max;
                    a += 1;
                }
                max /= K;
                ans.Enqueue(a);
            }
            //Console.WriteLine(string.Join("", ans));
            Console.WriteLine(n);
        }
    }
}


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

int top, a[1000];

void push(int x){
	top++;
	a[top] = x;
}

int pop(){
	top--;
	return a[top+1];
}


int main(void)
{
	int x, y;
	top = 0;
	char c[100];
	
	while( scanf("%s", &c) != EOF ){
		if( c[0] == '+' ){
			x = pop();
			y = pop();
			push(x+y);
		}else if( c[0] == '-' ){
			x = pop();
			y = pop();
			push(y-x);
		}else if( c[0] == '*' ){
			x = pop();
			y = pop();
			push(x*y);
		}else{
			push(atoi(c));
		}
	}
	
	printf( "%d\n", pop() );
	
	return 0;
}


Measured memory_bytes: 2092
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define FF first
#define SS second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(x) (int)x.size()
typedef long double f80;
#define all(x) x.begin(), x.end()

const int mod = 1e9 + 7;

const int N = 5005;
ll dp1[N], dp[N];
int U[N],V[N],W[N];

signed main()
{
    #ifdef LOCAL
        freopen("inp.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, m, p;
    cin >> n >> m >> p;
    fr(i, 1, m) {
        cin >> U[i] >> V[i] >> W[i];
        W[i] = -W[i] + p;
    }
    dp[1] = 0;
    fr(i, 2, n) {
        dp[i] = 1e18;
    }
    fr(i, 1, n - 1) {
        fr(j, 1, m) {
            if(dp[U[j]] != 1e18 && dp[V[j]] > dp[U[j]] + W[j]) {
                dp[V[j]] = dp[U[j]] + W[j];
            }
        }
    }
    fr(i, 1, n) {
        dp1[i] = dp[i];
    }
    fr(i, 1, n - 1) {
        fr(j, 1, m) {
            if(dp[U[j]] != 1e18 && dp[V[j]] > dp[U[j]] + W[j]) {
                dp[V[j]] = dp[U[j]] + W[j];
            }
        }
    }
    fr(i, 1, n) {
        if(dp1[i] != dp[i]) dp[i] = -1e18;
    }
    fr(i, 1, n - 1) {
        fr(j, 1, m) {
            ll val = dp[U[j]] + W[j];
            if(dp[U[j]] == -1e18) val = -1e18;
            if(dp[U[j]] == 1e18) continue;
            if(dp[V[j]] > val) {
                dp[V[j]] = val;
            }
        }
    }
    if(dp[n] == -1e18) {
        cout << -1 << endl;
    }
    else {
        cout << max(0ll, -dp[n]);
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main()
{
    long long a,b,c,d;
    cin >> a >> b >> c >> d;
    if(a>=0 && b>=0)
    {
        if(c>=0 && d>=0)
        cout << b*d << endl;
        else if(c<=0 && d<=0)
        cout << a*d << endl;
        else
        cout << b*d << endl;
    }
    else if(a<=0 && b<=0)
    {
        if(c>=0 && d>=0)
        cout << b*c << endl;
        else if(c<=0 && d<=0)
        cout << a*c << endl;
        else
        cout << a*c << endl;
    }
    else if(a<0 && b>=0)
    {
        if(c>=0 && d>=0)
        cout << b*d << endl;
        else if(c<=0 && d<=0)
        cout << a*c << endl;
        else if((a*c)>(b*d))
        cout << a*c << endl;
        else
        cout << b*d << endl;
        
    }
    
    return 0;
}


Measured memory_bytes: 3580
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;

std::string S;
LL fX,X;

int main()
{
	in >> S;

	for (auto c : S) { fX += c - '0'; }
	X = std::stoi(S);

	out << (X%fX == 0 ? "Yes" : "No") << std::endl;
	return 0;
}

Measured memory_bytes: 256
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


N, K = map(int, input().split())
D = list(map(int, input().split()))

kouho = [i for i in range(10) if i not in D]

from queue import deque
q = deque([0])
while True:
    n = q.popleft()
    if n>=N:
        break
    for i in kouho:
        q.append(n*10+i)
print(n)

Measured memory_bytes: 74560
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const int MOD=1000000007;

int main(){
    ld n,m;
    cin>>n>>m;
    int i;
    vector<ld> a(n);
    ld sum=0;
    ll ans=0;
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    rep(i,n){
        if(a[i]*4*m>=sum) ans++;
    }
    if(ans>=m){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m;
int po[1000100];

int mlg;
vector<int>li[22];
int mr[22][1000100];
int ml[22][1000100];
void get_line(int pos,int ma)
{
	li[pos].push_back(0);
	for(int i=1;i<=n;++i)
		if(i==1||po[i]-po[i-1]>ma)
			li[pos].push_back(i);
	li[pos].push_back(n+1);
	for(int i=1,p=0;i<=n;++i)
	{
		mr[pos][i]=mr[pos][i-1];
		if(i==li[pos][p+1])
			p++,mr[pos][i]=li[pos][p+1]-1;
	}
	mr[pos][n+1]=n;
	ml[pos][n+1]=n+1;
	for(int i=n,p=li[pos].size()-1;i;--i)
	{
		ml[pos][i]=ml[pos][i+1];
		if(i==li[pos][p]-1)
			p--,ml[pos][i]=li[pos][p];
	}
}

int pre[1000100],suf[1000100];
int ans[22];
void out(int ma)
{
	for(int i=1;i<=ma;++i)
		for(int j=li[0][i];j<li[0][i+1];++j)
			puts(ans[i]?"Possible":"Impossible");
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)scanf("%d",&po[i]);
	for(int tm=m;tm;mlg++,tm>>=1) get_line(mlg,tm);
	get_line(mlg,0);mlg++; 
	int s=1<<mlg,nxt;
	memset(suf,0x3f,sizeof(suf));
	suf[0]=n+1;
	for(int i=0;i<s;++i)
	{
		for(int j=0;j<mlg;++j)
		{
			if((i>>j)&1)continue;
			nxt=(i|(1<<j));
			pre[nxt]=max(pre[nxt],mr[j][pre[i]+1]);
			suf[nxt]=min(suf[nxt],ml[j][suf[i]-1]);
		}
	}
	int ma=li[0].size()-2;
	if(ma>mlg)
	{
		for(int i=1;i<=n;++i)puts("Impossible");
		return 0;
	}
	s--;
	int ls=(s^1);
	for(int i=1,L,R;i<=ma;++i)
	{
		L=li[0][i];R=li[0][i+1]-1;
		for(int j=0;j<=s;++j)
		{
			if(j&1)continue;
			if(pre[j]>=L-1&&suf[(s^j)&ls]<=R+1)
			{
				ans[i]=1;
				break;
			}
		}
	}
	out(ma);
	return 0;
}


Measured memory_bytes: 118772
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
  int a, b, c, d, num = 0;

  cin >> a >> b >> c >> d;

  if (abs(a-c) <= d){
    cout << "Yes" << endl;
  } else if (abs(a-b) <= d && abs(b-c) <= d){
    cout << "Yes" << endl;
  } else{
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256