akhauriyash/Code-Regression huggingface dataset:
#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;
 
// 辺（方向と重み）
struct edge{ ll to, cost; };
 
// 幅優先探索
void bfs(vector<vector<edge>> &g, ll n, ll node, vi &color, vi &dst, bool &ans, ll cost){
    if(color[node] == 1){
        if(dst[node] != cost) ans = false;
    }
    else{
        color[node] = 1;
        dst[node] = cost;
        rep(i, g[node].size()){
            bfs(g, n, g[node][i].to, color, dst, ans, cost + g[node][i].cost);
        }
    }
}
 
int main(){
    Init();
    ll n, m; cin >> n >> m;
    vector<vector<edge>> g(n, vector<edge>(0));
 
    // グラフの生成
    rep(i, m){
        ll l, r, d; cin >> l >> r >> d;
        l--; r--; // 0-based
        // 双方向に辺を張る（逆向きはコストもマイナスにする）
        g[l].push_back((edge){r, d});
        g[r].push_back((edge){l, -d});
    }
 
    // 回答出力用
    bool ans = true;
 
    // グラフ巡回確認
    vi color(n, 0);
    vi dst(n, -INFLL);
 
    // 矛盾がないか確認
    rep(i, n){
        if(color[i] == 0){
            //dst[i] = 0;
            bfs(g, n, i, color, dst, ans, 0LL);
        }
    }
 
    // 結果出力
    (ans) ? Yes() : No();
}

Measured memory_bytes: 20992
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	string s;
	getline(cin,s);
//	cout<<s<<endl;
	int flag=0,len=s.length();
	for(int i=0;i<len;i++)
	{
		if(!flag)
		{
			if(s[i]=='C') flag=1;
		}
		if(flag==1)
		{
			if(s[i]=='F')
			{
				flag=2;
				break;
			}
		}
	}
	if(flag==2) cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

constexpr ll MAX_N = 200000;
ll fact[MAX_N + 1];
ll ifact[MAX_N + 1];
constexpr ll MOD = 1000000007;
// a^-1 mod p
ll inv(ll a,ll p){
  return ( a == 1 ? 1 : (1 - p*inv(p%a,a)) / a + p );
}

int main() {
  fact[0] = 1;
  REP(i,MAX_N) {
    fact[i+1] = (i+1) * fact[i] % MOD;
  }
  ifact[MAX_N] = inv(fact[MAX_N], MOD);
  REP(i,MAX_N) {
    int j = MAX_N-i;
    ifact[j-1] = j * ifact[j] % MOD;
  }
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin>>n;
  vecll a(n);
  REP(i,n)cin>>a[i];
  vecll nval(n+1);
  vecll eval(n+1);
  vecll lval(n+1);
  vecll mval(n+1);
  FOR(i,1,n) {
    if (i < n-1) {
      nval[i] = fact[n] * fact[2] % MOD * fact[i] % MOD * ifact[i+2] % MOD;
      lval[i] = i * nval[i];
      mval[i] = (n - i - 1) * nval[i];
    }
    if (i < n) {
      eval[i] = fact[n] * fact[i] % MOD * ifact[i+1] % MOD;
    }
  }
  vecll psn(n+1);
  vecll pse(n+1);
  vecll psl(n+1);
  vecll psm(n+1);
  partial_sum(ALL(nval), begin(psn));
  partial_sum(ALL(eval), begin(pse));
  partial_sum(ALL(lval), begin(psl));
  partial_sum(ALL(mval), begin(psm));
  REP(i,n+1) psn[i] %= MOD;
  REP(i,n+1) pse[i] %= MOD;
  REP(i,n+1) psl[i] %= MOD;
  REP(i,n+1) psm[i] %= MOD;
  ll ans = 0;
  REP(i,n) {
    ll left = i;
    ll right = n-i-1;
    ll mn = min(left, right);
    ll mx = max(left, right);
    ll tmp = 0;
    if (mn > 0) {
      tmp += (psl[mn] + MOD - psl[0])
        + (psn[mx] + MOD - psn[mn]) * mn  % MOD
        + (pse[mx] + MOD - pse[mn])
        + (psm[n-1] + MOD - psm[mx])
        + (pse[n-1] + MOD - pse[mx]) * 2 % MOD
        + fact[n];
    } else {
      tmp += (pse[mx] + MOD - pse[0])
        + fact[n];
    }
    tmp %= MOD;
    cerr<<tmp<<endl;
    ans += tmp * a[i] % MOD;
    ans %= MOD;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 10496
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
// memo  fixed  setprecision(20);
using vvll = vector<vector<ll>>;
ll mod =1e9+7;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX Euclidean */           ll gcd(ll a,ll b){if(b==0)return a; return gcd(b,a%b);}
/*"lcm"   MIN*/                      ll lcm(ll a,ll b){ll g = gcd(a,b);return a/g*b;}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
ll modpow(ll a,ll n, ll mod){ll res = 1;while(n>0){if (n%2==1){res = res * a % mod;}a = a * a % mod;n/=2;}return res;}
int main() {
    double n;
    cin >> n;
    vector<double>a(n);
    double sum =0;
    for(int i=0;i<n;i++){
        cin >>a.at(i);
        sum+=a.at(i);
    }
    sum/=n;
    vector<pair<double,int>>d(n);
    for(int i=0;i<n;i++){
        if(sum==a.at(i)){
            cout <<i<<endl;
            return 0;
        }
        d.at(i)=make_pair(abs(sum-a.at(i)),i);
    }
    sort(d.begin(),d.end());
    cout << d.at(0).second<<endl;
}
    



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using std::max;
using std::sort;
using std::lower_bound;
using std::upper_bound;
#define reg register
#define abs(x) ( (x) < 0 ? ( - (x) ) : (x) )
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
static char buf[100000],*p1=buf,*p2=buf;
inline int read(void){
	reg bool f=false;
	reg char ch=getchar();
	reg int res=0;
	while(ch<'0'||'9'<ch)f|=(ch=='-'),ch=getchar();
	while('0'<=ch&&ch<='9')res=10*res+ch-'0',ch=getchar();
	return f?-res:res;
}

const int MAXN=2000+5;

int n;
int l[MAXN];

int main(void){
	reg int i,j,k,ans=0;
	n=read();
	for(i=1;i<=n;++i)
		l[i]=read();
	sort(l+1,l+n+1);
	for(i=1;i<=n-2;++i)
		for(j=i+1;j<n;++j)
			for(k=j+1;k<=n;++k)
				if(l[i]+l[j]>l[k])
					++ans;
				else
					break;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
	int A, B, K, i;
	scanf("%d%d%d", &A, &B, &K);
	for (i = 0; i < K; ++i) {
		if (i % 2) {
			A += B / 2;
			B /= 2;
		}
		else {
			B += A / 2;
			A /= 2;
		}
	}
	printf("%d %d", A, B);
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            if(ret != null) Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        return n==0 ? 1 : 0;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 27240
program main;
var a,b,c,d : integer;
begin
    readln(a,b,c,d);
    repeat
    c:=c-b;
    if c > 0  
    then a:=a-d;
    until (a <= 0) or (c <= 0);
    if a <= 0
    then writeln('No')
    else writeln('Yes');
end.

Measured memory_bytes: 1384
using System;
using System.Collections.Generic;

namespace AOJ0029
{
    class Program
    {
        static void Main()
        {
            var wordMap = new Dictionary<string, int>();
            foreach (var word in (Console.ReadLine() ?? "").ToLowerInvariant().Split(' '))
            {
                if (wordMap.ContainsKey(word))
                {
                    wordMap[word]++;
                }
                else
                {
                    wordMap[word] = 1;
                }
            }

            var freqWord = "";
            var freq = 0;
            var longWord = "";

            foreach (var word in wordMap)
            {
                if (freq < word.Value)
                {
                    freq = word.Value;
                    freqWord = word.Key;
                }

                if (longWord.Length < word.Key.Length)
                {
                    longWord = word.Key;
                }
            }

            Console.WriteLine("{0} {1}", freqWord, longWord);
        }
    }
}

Measured memory_bytes: 5524
//Krzysztof Boryczka
#pragma GCC optimize "O3"
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;

#define FOR(i, b, e) for(int i=b; i<=e; i++)
#define FORD(i, b, e) for(int i=b; i>=e; i--)
#define SIZE(x) ((int)x.size())
#define pb push_back
#define st first
#define nd second
#define sp ' '
#define ent '\n'

const int N=20;

int n, ans;
vii test[N];
bool gut[N];

int rozm(){
	int ret=0;
	FOR(i, 1, n) ret+=gut[i];
	return ret;
}

bool check(){
	FOR(i, 1, n){
		if(gut[i]){
			for(auto &x: test[i]){
				if(gut[x.st]!=x.nd) return 0;
			}
		}
	}
	return 1;
}

void generuj(int kt){
	if(kt==n+1){
		if(check()) ans=max(ans, rozm());
		return;
	}
	gut[kt]=0;
	generuj(kt+1);
	gut[kt]=1;
	generuj(kt+1);
}

void solve(){
	cin>>n;
	FOR(i, 1, n){
		int n2, a, b;
		cin>>n2;
		FOR(j, 1, n2){
			cin>>a>>b;
			test[i].pb({a, b});
		}
	}
	generuj(1);
	cout<<ans<<ent;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	// int tt; cin>>tt;
	// FOR(te, 1, tt)
	solve();
	return 0;
}


Measured memory_bytes: 256
import sys

INF = float('inf')

def Bellmanford(n, edges, r): #r: 始点
    d = [INF] * n
    d[r] = 0
    
    for i in range(n):
        for (u, v, c) in edges:
            if d[u] != INF and d[u] + c < d[v]:
                d[v] = d[u] + c
                if i == n-1 and v == n-1:
                    return 'inf'
    
    return -d[n-1]
    

N, M = map(int, sys.stdin.readline().split())
Edges = [None] * M

for i in range(M):
    ai, bi, ci = map(int, sys.stdin.readline().split())
    Edges[i] = (ai-1, bi-1, -ci)
    
ans = Bellmanford(N, Edges, 0)

print(ans)

Measured memory_bytes: 3316
// abc152-A.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>

int main()
{
    using namespace std;

    int N, M;
    cin >> N >> M;
    if (N == M) {
        cout << "Yes";
    }
    else {
        cout << "No";
    }

}




Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, L[2019], cnt[1009];
vector<int> vec;
long long sum;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> L[i];
		cnt[L[i]]++;
		vec.pb(L[i]);
	}
	sort(vec.begin(), vec.end());
	int len = vec.size();
	//reverse(vec.begin(), vec.end());
	for (int i = 0; i < n - 2; i++) {
		for (int j = i + 1; j < n - 1; j++) {
			int l = vec[j] - vec[i] + 1;
			int r = vec[j] + vec[i];
			auto tmp1 = lower_bound(vec.begin() + j + 1, vec.end(), l);
			auto tmp2 = lower_bound(vec.begin() + j + 1, vec.end(), r);
			sum += tmp2 - tmp1;
		}
	}
	cout << sum << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)998244353;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            Out.Flush();
            Read();
        }
        static void Solve()
        {
            var NC = Sarray();
            var N = NC[0];
            var C = NC[1];
            var lst = new List<Tuple<long, long, long>>();//s,t,c
            for (var i = 0; i < N; ++i)
            {
                var stc = Sarray();
                lst.Add(Tuple.Create(stc[0], stc[1], stc[2]));
            }
            var tlst = lst.OrderBy(l => l.Item3).ThenBy(l => l.Item1).ToArray();
            var slst = new List<Tuple<long, long, long>>();
            for (var i = 0; i < N; ++i)
            {
                var s = tlst[i].Item1;
                var t = tlst[i].Item2;
                var c = tlst[i].Item3;
                while (i < N - 1 && tlst[i].Item2 == tlst[i + 1].Item1 && tlst[i].Item3 == tlst[i + 1].Item3)
                {
                    t = tlst[i + 1].Item2;
                    ++i;
                }
                slst.Add(Tuple.Create(s, t, c));
            }
            slst.Sort((l, r) => (int)(l.Item1 - r.Item1));
            var ch = 0;
            while (slst.Any())
            {
                ++ch;
                var s = slst[0];
                var rem = new List<Tuple<long, long, long>>();
                for (var i = 1; i < slst.Count; ++i)
                {
                    if (s.Item2 < slst[i].Item1)
                        s = slst[i];
                    else
                        rem.Add(slst[i]);
                }
                slst = rem;
            }
            WriteLine(ch);
        }
    }
}

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


int n,m,s,t;
double dist[60010];

int vnum(int i,int j,int v,int b) {
    return i*900+j*30+v-1+27000*b;
}

signed main() {
    cout<<fixed<<setprecision(10);

    while(cin>>n>>m,n) {
        fill(dist,dist+60010,2e9);

        cin>>s>>t;
        s--,t--;
        vector<vector<pair<int,double>>> G(60010);

        for(int i=0; i<n; ++i) {
            for(int j=0; j<n; ++j) {
                for(int v=1; v<=30; ++v) {
                    for(int k=-1; k<=1; ++k) {
                        if(v+k>0 && v+k<=30) {
                            G[vnum(i,j,v,0)].emplace_back(vnum(i,j,v+k,1),0);
                        }
                    }
                }
            }
        }

        while(m--) {
            int x,y,c;
            double d;
            cin>>x>>y>>d>>c;
            x--,y--;

            for(int v=1; v<=c; ++v) {
                for(int  j=0; j<n; ++j) {
                    if(j!=x) {
                        G[vnum(y,j,v,1)].emplace_back(vnum(x,y,v,0),d/(double)v);
                    }
                    if(j!=y) {
                        G[vnum(x,j,v,1)].emplace_back(vnum(y,x,v,0),d/(double)v);
                    }
                }
            }
        }

        priority_queue<pair<double,int>> mhp;
        mhp.emplace(0,vnum(s,s,1,1));
        dist[vnum(s,s,1,1)]=0;

        while(!mhp.empty()) {
            int v; double d;
            tie(d,v)=mhp.top();
            d=-d;
            mhp.pop();
            if(d>dist[v]) continue;
            for(auto &e:G[v]) {
                if(d+e.second<dist[e.first]) {
                    dist[e.first]=d+e.second;
                    mhp.emplace(-dist[e.first],e.first);
                }
            }
        }

        double ans=2e9;
        for(int j=0; j<n; ++j) {
            if(j!=t) ans=min(ans,dist[vnum(t,j,1,0)]);
        }

        if(ans<2e9) cout<<ans<<endl;
        else cout<<"unreachable\n";
    }
}


Measured memory_bytes: 21884
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define trav(x,a) for (const auto& x: a)
#define sz(x) (int)(x).size()
#define mem(a,v) memset((a), (v), sizeof (a))
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%lld", &(n))
#define nai(a, n) for (int _i = 0; _i < (n); _i++) ni(a[_i])
#define nal(a, n) for (int _i = 0; _i < (n); _i++) nl(a[_i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%lld\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vll vector<pll>
#define vi vector<int>
#define vl vector<long long>
#define pb push_back
#define mp make_pair
#define st first
#define nd second
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef cc_hash_table<int,int,hash<int>> ht;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;
const double pi = acos(-1);
const int mod = 1e9 + 7;
const ld inf = 1e12 + 7;
const int N = 6e2 + 5;
const double eps = 1e-9;
int deg[N], n, m;
vi adj[N], radj[N];
ld dp[N];

string f(ld x) {
  stringstream s;
  s << fixed << setprecision(2);
  if (x < 0) s << x;
  else s << "+" << x;
  return s.str();
}

ld inv(int b) {
  for (int i = 1; i <= n; i++)
    dp[i] = 0, deg[i] = sz(adj[i]);
  deque<int> pq;
  pq.pb(n);
  while (sz(pq)) {
    int u = pq.front(); pq.pop_front();
    if (u != n) {
      ld d = sz(adj[u]);
      if (u == b && sz(adj[u]) > 1) {
        ld mx = 0;
        int i = -1;
        trav(v, adj[u]) {
          if (dp[v] > mx)
            i = v;
          mx = max(mx, dp[v]);
        }
        dp[u] -= mx;
        d--;
      }
      dp[u] /= d;
      dp[u] += 1;
    }
    trav(v, radj[u]) {
      deg[v]--;
      dp[v] += dp[u];
      if (!deg[v])
        pq.pb(v);
    }
  }
  return dp[1];
}

int main() {
  cout << fixed << setprecision(10);
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v; scanf("%d %d", &u, &v);
    adj[u].pb(v);
    radj[v].pb(u);
  }
  ld ans = inf;
  for (int i = 0; i < n; i++)
    ans = min(ans, inv(i));
  cout << ans << endl;
  return 0;
}


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

class Jud
{
public:
    int res,cnt,t;
    int calc(int n){
    res=n;
    for(int i=0;i<=n;i++){
        t=i;
        cnt=0;
        while(t>0){
          cnt+=t%6;
          t/=6;
        }
        t=n-i;
        while(t>0){
            cnt+=t%9;
            t/=9;
        }
        if(res>cnt)res=cnt;
    }
    return res;
    }
        
};
void solve(){
    Jud jud;
    int n,ans;
    cin>>n;
    ans=jud.calc(n);
    cout<<ans<<endl;
}

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

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
a, b, x = [int(x) for x in input().split()]
B = 1 + b // x
if a == 0:
    print(B)
elif a % x == 0:
    A = 1 + a // x
    print(B - A + 1)
else:
    A = 1 + a // x
    print(B - A)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

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

    for (int i = 0; i < n.size(); i++)
    {
        if (n[i] - '0' == 9)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

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

using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T>void println(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
//lambda: [](int x, int y){return x<y;}



signed main(void){
    int x,y,a,b,c;cin>>x>>y>>a>>b>>c;
    vint p(a),q(b),r(c);vin(p);vin(q);vin(r);
    sort(rall(p));sort(rall(q));
    int ans=0;
    rep(i,x)r.push_back(p[i]);
    rep(i,y)r.push_back(q[i]);
    sort(rall(r));
    rep(i,x+y)ans+=r[i];
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) (x).size()

ll mod = 1000000007;

ll gcd(ll a, ll b){
  if (a%b == 0)return(b);
  else return(gcd(b, a%b));
}

ll inv(ll x){
  ll res = 1;
  ll k = mod - 2;
  ll y = x;
  while(k){
    if(k&1)res = (res*y)%mod;
    y = (y*y) % mod;
    k /= 2;
  }
  return res;
}


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

  int x;
  cin >> x;
  if(x >= 30){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3608
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = int.Parse(Console.ReadLine());
        long min = 100000000;
        long sum = 0;
        for(int i=0;i<N;i++){
            int S = int.Parse(Console.ReadLine());
            if(S % 10 != 0){
                min = Math.Min(min,S);
            }
            sum += S;
        }
        long count;
        if(sum % 10 == 0){
            if(min == 100000000){
                count = 0;
            }
            else{
                count = sum - min;
            }
        }
        else{
            count = sum;
        }
        sb.Append(count+"\n");
    }
}

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


#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

using namespace std;

inline bool isvowel (char c) {
	c = tolower(c);
    if (c == 'a' || c == 'e' || c == 'i' || c == 'y' || c == 'o' || c == 'u') return 1;
    return 0;
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 1e6 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
int n;
int f[N];
int a[N], d[N];
void upd (int pos, int x) {
	for (int i = pos; i <= n; i = (i | (i + 1)))
		f[i] += x;
}

int get (int r) {
	int res = 0;
	while (r >= 0) {
		res += f[r];
		r = (r & (r + 1)) - 1;
	}
	return res;
}
int main () {
	cin >> n;
	int mx = 0;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
		d[a[i]] = d[a[i] - 1] + 1;
		mx = max (mx, d[a[i]]);
	}
	cout << n - mx;
}

Measured memory_bytes: 5120
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=1e5+5;
struct eg{int v,nx;}e[N<<1];int head[N],tot;
inline void add(R int u,R int v){e[++tot]={v,head[u]},head[u]=tot;}
int deg[N],d[N],st[N],ins[N],ans[N],q[N],t,top,n;
inline void ck(){
	fp(i,1,n)if(ans[i]!=q[i]){
		if(ans[i]>q[i])fp(j,1,n)ans[j]=q[j];
		return;
	}
}
void dfs(int u,int fa){st[++top]=d[u];go(u)if(v!=fa&&!ins[v])dfs(v,u);}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d",&n);
	for(R int i=1,u,v;i<n;++i){
		scanf("%d%d",&u,&v),add(u,v),add(v,u);
		++deg[u],++deg[v];
	}
	fp(i,1,n)ans[i]=n+1,d[i]=deg[i];
	fp(u,1,n)if(deg[u]==1)st[++top]=u,ins[u]=1;
	fp(p,1,top)go(st[p])--deg[v];
	fp(i,1,n)if(!ins[i]&&deg[i]>2)return puts("-1"),0;
	fp(i,1,n)if(!ins[i]&&deg[i]<=1){top=1;dfs(i,0);break;}
	st[1]=0,st[++top]=0;
	fp(i,2,top-1)st[i]-=2;
	q[t=1]=1;
	for(R int i=2,k=2;i<=top;++i){
		q[t+st[i]+1]=k++;
		fp(j,1,st[i])q[++t]=k++;
		++t;
	}
	ck();
	reverse(st+1,st+1+top);
	q[t=1]=1;
	for(R int i=2,k=2;i<=top;++i){
		q[t+st[i]+1]=k++;
		fp(j,1,st[i])q[++t]=k++;
		++t;
	}
	ck();
	fp(i,1,n)printf("%d%c",ans[i]," \n"[i==n]);
	return 0;
}

Measured memory_bytes: 7808
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    ll x, y = 100;
    int z = 0;
    cin >> x;
    while (y < x) {
        y += y / 100;
        z++;
    }
    cout << z;
}


Measured memory_bytes: 3608
A,B=map(int,input().split())
Board_up=[["#"]*99 for i in range(50)]
Board_down=[["."]*99 for i in range(50)]
for a in range(1,A):
  i,j=(a-1)//50,(a-1)%50
  Board_up[2*i][2*j]="."
for b in range(1,B):
  i,j=(b-1)//50,(b-1)%50
  Board_down[2*i+1][2*j]="#"
print(100,99)
for i in Board_up:
  print("".join(i))
for i in Board_down:
  print("".join(i))
  

Measured memory_bytes: 38384
// This amazing code is by Eric Sunli Chen.
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
using namespace std;
template<typename T> bool get_int(T &x)
{
	char t=getchar();
	bool neg=false;
	x=0;
	for(; (t>'9'||t<'0')&&t!='-'&&t!=EOF; t=getchar());
	if(t=='-')neg=true,t=getchar();if(t==EOF)return false;
	for(; t<='9'&&t>='0'; t=getchar())x=x*10+t-'0';
	if(neg)x=-x;return true;
}
template<typename T> void print_int(T x)
{
	if(x<0)putchar('-'),x=-x;
	short a[20]= {},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1; i>=0; i--)putchar('0'+a[i]);
}
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define get1(a) get_int(a)
#define get2(a,b) (get1(a)&&get1(b))
#define get3(a,b,c) (get1(a)&&get2(b,c))
#define printendl(a) print_int(a),puts("")
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int,int> pii;
const int inf=0x3f3f3f3f;
const LL Linf=1ll<<61;
const double pi=acos(-1.0);

int main()
{
	int a,b;get2(a,b);
	if(a<=0&&b>=0)puts("Zero");
	else if(a<0&&(b-a)%2==0)puts("Negative");
	else puts("Positive");
	return 0;
}

Measured memory_bytes: 256
x = int(input())
if 400 <= x <= 599:
    print(8)
if 600 <= x <= 799:
    print(7)
if 800 <= x <= 999:
    print(6)
if 1000 <= x <=1199:
    print(5)
if 1200 <= x <= 1399:
    print(4)
if 1400 <= x <= 1599:
    print(3)
if 1600 <= x <= 1799:
    print(2)
if 1800 <= x <= 1999:
    print(1)


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

int X, N;

void Solve()
{
	double lowerX = N / 1.08f;
	double upperX = (N + 1) / 1.08f;

	for (int i = int(lowerX); i <= upperX; ++i){
		if (int(i * 1.08) == N){
			cout << i << endl;
			return;
		}
	}
	cout << ":(" << endl;
}

void Init()
{
	cin >> N;
}

void Clean(){}
int main(){ Init(); Solve(); Clean(); return 0; }


Measured memory_bytes: 504
#include<stdio.h>
#include<stdlib.h>

int main(){
  int a=0;
  char s[10];
  
  scanf("%d",&a); 
  scanf("%s",s); 
  
  if(2800>a || a>=5000){
    exit (-1);
  }
  
  if(a>=3200){
    printf("%s",s);
  }
  else{
    printf("red");
  }
  return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include <string>
#include<vector>
#include<algorithm>
#include <cstdlib>
using namespace std;
int main(){
    int n,ans=1;
    long long m;
    cin >> n >> m;
    int d = m/n;
    if(d < 100000000){
    for(int j=1;j<=d;j++){
        if(m%j == 0){
            ans = j;
        }
    }
    cout << ans << endl;
    }
    else{
        for(int i=n;i<100000000;i++){
            if(m%i == 0){
                ans = m/i;
                break;
            }
        }
        cout << ans << endl;
    }
 
    return 0;
    
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    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 std::istream &operator>>(std::istream &in, mint &o) {
        ll a;
        in >> a;
        o = a;
        return in;
    }

    friend std::ostream &operator<<(std::ostream &out, const mint &o) {
        out << o.x;
        return out;
    }

};

int main() {

    int a, b, c, d;
    cin >> a >> b >> c >> d;

    vector<vector<mint>> dp(c, vector<mint>(d));

    auto calc = [&](int y, int x) -> mint {
        if (y < a && x < b) return 1;
        if (y < a) return mint(a).pow(x - b + 1);
        if (x < b) return mint(b).pow(y - a + 1);

        mint d = dp[y - 1][x];
        mint l = dp[y][x - 1];
        mint u = d * (x + 1);
        mint r = l * (y + 1);
        mint h = y * x;
        mint hc = h * dp[y - 1][x - 1];

        mint now = u + r - hc;
        return now;

    };

    rep(y, c) rep(x, d) {
            dp[y][x] = calc(y, x);
        }
    cout << dp.back().back() << endl;
}

Measured memory_bytes: 73580
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){

	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
	return ret;
}

// lcm(a.b)
int lcm(int a,int b){
	return (a * b) / gcd(a,b);
}

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[]){
	int a,b;
	scanf("%d%d",&a,&b);
	if(a + b < 10)	printf("%d\n", a + b);
	else printf("error\n");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
using namespace std;

int main(int argc, const char * argv[]) {
    int i, n;
    cin >> n;
    int a[n];
    for(i=0;i<n;i++){
        cin >> a[i];
        
    }
    for(i=0;i<n;i++){
        if (i) printf(" ");
        cout <<  a[n-i-1];
    }
    
    cout << endl;
    
    return 0;
}

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

int main(){
  int K;
  string S;
  cin >> K >> S;
  if(S.size() <= K) cout << S << endl;
  else{
    for(int i = 0; i < K; i++){
      cout << S.at(i);
    }
    cout << "..." << endl;
  }
}


Measured memory_bytes: 3632
map=[]
map[2020]=0
pieces=[]
gets
gets.split.map(&:to_i).each.with_index(1){|x,i|
  map[x]=i
  pieces[i]=x
}
gets
gets.split.map(&:to_i).each{|i|
  unless map[pieces[i]+1]
    map[pieces[i],2]=[nil,i]
    pieces[i]+=1
  end
}
puts pieces.drop(1)


Measured memory_bytes: 6888
#include <bits/stdc++.h>
#define rep(i, n) for(ll i=0;i<n;i++)
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (b>a) { 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; }
const long long INF = 2LL << 60;
using ll = long long;
using P = pair<ll, ll>;
int main(int argc, char const *argv[]){
    ll n;
    ll ans=0;
    cin >> n;
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j+=i){
            ans+=j;
        }
    }
    cout << ans << endl;
    return 0;
}




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

using ll = long long;
#define repi(n) for (int i = 0; i < n; i++)
#define repj(n) for (int j = 0; j < n; j++)
#define repk(n) for (int k = 0; j < n; k++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (auto i = a; i < b; i++)
#define repv(itr) for (auto&& v : itr)
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}

const ll bigll = 1e+12;
ll s[100010], t[100010];
int main() {
  int a, b, q;
  cin >> a >> b >> q;
  repi(a) cin >> s[i];
  repi(b) cin >> t[i];
  repi(q) {
    ll x;
    cin >> x;
    auto si = upper_bound(s, s + a, x), ti = upper_bound(t, t + b, x);
    ll s1 = *si == x ? x : si == s ? -bigll : *(si - 1);
    ll s2 = *si == x ? x : si == s + a ? bigll : *si;
    ll t1 = *ti == x ? x : ti == t ? -bigll : *(ti - 1);
    ll t2 = *ti == x ? x : ti == t + b ? bigll : *ti;
    // cout << i << ": " << s1 << " " << s2 << " " << t1 << " " << t2 << endl;
    ll re = LLONG_MAX;
    re = min(re, abs(x - t1) + abs(t1 - s1));
    re = min(re, abs(x - t1) + abs(t1 - s2));
    re = min(re, abs(x - t2) + abs(t2 - s1));
    re = min(re, abs(x - t2) + abs(t2 - s2));
    re = min(re, abs(x - s1) + abs(s1 - t1));
    re = min(re, abs(x - s1) + abs(s1 - t2));
    re = min(re, abs(x - s2) + abs(s2 - t1));
    re = min(re, abs(x - s2) + abs(s2 - t2));
    cout << re << endl;
  }
}


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

using namespace std;

#ifdef SG
	#include <debug.h>
#else
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned char uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

const ld pi = 3.1415926535897932384626433832795l;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 200100;
int a[N];
int pos[N];

void put(int where, int x) {
	int from = pos[x], y = a[where];
	swap(a[where], a[from]);
	pos[x] = where;
	pos[y] = from;
}

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);
#ifdef SG
//	freopen((problemname + ".in").c_str(), "r", stdin);
//	freopen((problemname + ".out").c_str(), "w", stdout);
#endif
	int n, x;
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	x--;
	n *= 2;
	n--;
	forn(i, n) {
		a[i] = i;
		pos[i] = i;
	}
	put(n / 2, x);
	put(n / 2 + 1, x - 1);
	put(n / 2 - 1, x + 1);
	if (x != 1 && x != n - 2) {
		put(n / 2 - 2, x - 2);
		put(n / 2 + 2, x + 2);
	}
	forn(i, n) {
		printf("%d\n", a[i] + 1);
	}
	return 0;
}


Measured memory_bytes: 3072
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#define ms(a,b) memset(a,b,sizeof(a))
#ifdef XLor
  #define dbg(args...) do {cout << #args << " -> "; err(args);} while (0)
#else
  #define dbg(...)
#endif
void err() {std::cout << std::endl;}
template<typename T, typename...Args>
void err(T a, Args...args){std::cout << a << ' '; err(args...);}
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 1e9 + 7;
const int inf = 1 << 30;
const int maxn = 100000 + 5;

ll qpow(ll x, ll n) {
    ll r = 1;
    while (n > 0) {
        if (n & 1) r = r * x % mod;
        n >>= 1; x = x * x % mod;
    }
    return r;
}
ll inv(ll x) { return qpow(x, mod - 2); }
inline void add(ll& x, ll y) {
    x += y; if (x >= mod) x -= mod;
}

int n, x, a[205];
ll dp[205][maxn];

int main() {
    scanf("%d%d", &n, &x);
    for (int i = 0; i < n; i++) scanf("%d", a + i);
    sort(a, a + n); dp[n][x] = 1;
    for (int i = n - 1; i >= 0; i--) {
        ll iv = inv(i + 1);
        for (int j = 0; j <= x; j++) {
            add(dp[i][j % a[i]], dp[i + 1][j] * iv % mod);
            add(dp[i][j], (dp[i + 1][j] - dp[i + 1][j] * iv % mod + mod) % mod);
        }
    }
    ll ans = 0, f = 1;
    for (int i = 1; i <= n; i++) f = f * i % mod;
    for (int i = 0; i <= x; i++) add(ans, i * dp[0][i] % mod);
    cout << ans * f % mod << endl;
    return 0;
}

Measured memory_bytes: 157952
#include<iostream>
#include<map>
#define ll long long
using namespace std;

ll nc(ll n){
  return (n*(n-1))/2;
}
int main(){
  ll n;
  cin>>n;
  ll *a=new ll[n+1];
  map<ll,ll> ma;
  a[0]=0;
  ma[0]++;
  for(int i=0;i<n;i++){
    ll temp;
    cin>>temp;
    a[i+1]=a[i]+temp;
    ma[a[i+1]]++;
  }
  ll count=0;
  for(auto itr:ma){
    count+=nc(itr.second);
  }
  cout<<count;
}


Measured memory_bytes: 14336
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N; cin >> N;
  vector<string> words(N);
  rep(i,N) cin >> words[i];
  rep(i,N){
    if(i==0) continue;
    if(words[i-1][(int)words[i-1].size()-1] != words[i][0]){
      cout << "No" << endl;
      return 0;
    }
  }
  rep(i,N){
    rep(j,N){
      if(i==j) continue;
      if(words[i] == words[j]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int mx=1e5+123;
#define mem(a,b) memset(a,b,sizeof(a));


int w[120],v[120],W,n;  long long dp[120][mx];

long long solve(int i,int j){

       if(i>n)
           return 0;
       if(dp[i][j]!=-1)
           return dp[i][j];

       long long left=0,right=0;

       if(j+w[i]<=W)
            left=v[i]+solve(i+1,j+w[i]);
        right=solve(i+1,j);

      return dp[i][j] = max(left, right);

}

int main() {

     cin>>n>>W;

    for(int i=1;i<=n;i++)
        cin>>w[i]>>v[i];

     mem(dp,-1);
       cout<<solve(1,0)<<endl;

    return 0;
}


Measured memory_bytes: 97472
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
  int n;
  string s;
  cin >> n >> s;
  vector<int> cntE(n), cntW(n);
  int e=0, w=0;
  for(int i=0;i<n;i++){
    if(s[i]=='W') w++;
    if(s[n-1-i]=='E') e++;
    cntW[n-1-i]=w;
    cntE[i]=e;
  }
  int ans=3e5;
  for(int i=0;i<n;i++){
    if(ans>cntE[i]+cntW[i]) ans=cntE[i]+cntW[i];
  }
  cout << ans-1 << endl;
}

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int X; cin >> X;
	int count = 1;
	int rep = X;
	while (rep % 360 != 0) {
		count++;
		rep += X;
	}
	print(count);
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){

string a,b,c;
cin>>a>>b>>c;

int arr[3];
for(char i='a';i<='z';i++){

if (a[0]==i)
a[0]=(int)i;
if(b[0]==i)
b[0]=(int)i;
if(c[0]==i)
c[0]=(int)i;
}
cout<<(char)(a[0]-32)<<(char)(b[0]-32)<<(char)(c[0]-32);

return 0;
} 


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,ans;
	cin>>a>>b>>c>>d;
	ans=min(b,d)-max(a,c);
	if(ans<0){
		cout<<"0"<<endl;
	}
	else{
		cout<<ans<<endl;
	}
  return(0);
}

Measured memory_bytes: 256