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

typedef long long ll;

void fill(vector<vector<ll>>& grid,int i,int j,ll x)
{
	int h=grid.size(),w=grid[0].size();
	if(i<0 || h<=i || j<0 || w<=j || grid[i][j]!=x) return;
	grid[i][j]=0;
	fill(grid,i-1,j,x);
	fill(grid,i+1,j,x);
	fill(grid,i,j-1,x);
	fill(grid,i,j+1,x);
}

int main()
{
	for(int n;cin>>n && n;){
		vector<int> ls(n),ts(n),rs(n),bs(n);
		for(int i=0;i<n;i++) cin>>ls[i]>>ts[i]>>rs[i]>>bs[i];
		vector<int> xs={-1,1000001},ys={-1,1000001};
		for(int i=0;i<n;i++){
			xs.push_back(ls[i]);
			xs.push_back(rs[i]);
			ys.push_back(ts[i]);
			ys.push_back(bs[i]);
		}
		sort(begin(xs),end(xs)); xs.erase(unique(begin(xs),end(xs)),end(xs));
		sort(begin(ys),end(ys)); ys.erase(unique(begin(ys),end(ys)),end(ys));
		
		int w=xs.size(),h=ys.size();
		vector<vector<ll>> grid(h,vector<ll>(w,1ll<<n));
		for(int k=0;k<n;k++){
			int l=lower_bound(begin(xs),end(xs),ls[k])-begin(xs);
			int r=lower_bound(begin(xs),end(xs),rs[k])-begin(xs);
			int t=lower_bound(begin(ys),end(ys),ts[k])-begin(ys);
			int b=lower_bound(begin(ys),end(ys),bs[k])-begin(ys);
			for(int i=b;i<t;i++)
				for(int j=l;j<r;j++)
					grid[i][j]|=1ll<<k;
		}
		int res=0;
		for(int i=0;i<h;i++)
			for(int j=0;j<w;j++)
				if(grid[i][j]){
					fill(grid,i,j,grid[i][j]);
					res++;
				}
		cout<<res<<endl;
	}
}

Measured memory_bytes: 1912
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <utility>
#include <algorithm>
#include <vector>
#include <cmath>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl

using namespace std;

const int mod=1e9+7;

void run();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(12);
}

signed main(){
    init();
    run();
    return 0;
}

void run(){
  int n,k;
  cin>>n>>k;
  vi p(n);
  rep(i,n)cin>>p[i];
  sort(all(p));
  int ans=inf;
  rep(i,n-k+1)ans=min(ans,p[i+k-1]-p[i]);
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define fr(i, n) for (int i = 0; i < n; i++)
#define frab(i, a, b) for (int i = a; i < b; i++)
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;

const ll MOD = 998244353;
const ll INF = 2e9 + 10;
const ll MAX = 1e14 + 10;
const ld EPS = 1e-9;
const int N = 3e5 + 10;

int a[N];
ll dp[N];

void solve() {
    int n, k;
    cin >> n >> k;
    fr(i, n)
        cin >> a[i];

    fill(dp + 1, dp + n + 1, INF);
    fr(i, n)
        frab(j, 1, k + 1) {
            if (i + j < n)
                dp[i + j] = min(dp[i + j], dp[i] + abs(a[i] - a[i + j]));
            else
                break;
        }
    cout << dp[n - 1];
}



int main() {
    //freopen("a.in", "r", stdin);
    ios_base::sync_with_stdio(false);
    solve();
}


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
    }
    vector<int> cnt(n + 1, 0);
    for (int i = 0; i < n; i++) {
        cnt[p[i]] = cnt[p[i] - 1] + 1;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = max(ans, cnt[i]);
    }
    ans = n - ans;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int k, s, ans = 0;
	cin >> k >> s;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			if (s < i + j) break;
			ans += s - i - j <= k;
		}
	}
	cout << ans << "\n";
}


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


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;


public class Main{
    static long MOD = 998244353L;
    static long [] fac;
    static int[][] dir = new int[][]{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    static long lMax = 0x3f3f3f3f3f3f3f3fL;
    static int iMax = 0x3f3f3f3f;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        // Start writing your solution here. -------------------------------------
        //int t = sc.nextInt();
        int t = 1;
        while(t-- > 0)
        {
           int a = sc.nextInt(), b= sc.nextInt();
           double H = sc.nextDouble(), M = sc.nextDouble();
           double ang1 = 2.0 * Math.PI * (H + M / 60) / 12, ang2 = 2.0 * Math.PI * M / 60;
           double ang = ang1 - ang2;
           double res = Math.sqrt(1.0 * a * a + 1.0 *b * b - 2.0 * a * b * Math.cos(ang));
           out.println(res);
        }
        out.close();
    }
    public static long C(int n, int m)
    {
        if(m == 0 || m == n) return 1l;
        if(m > n || m < 0) return 0l;
        long res = fac[n] * quickPOW((fac[m] * fac[n - m]) % MOD, MOD - 2) % MOD;

        return res;
    }
    public static long quickPOW(long n, long m)
    {
        long ans = 1l;
        while(m > 0)
        {
            if(m % 2 == 1)
                ans = (ans * n) % MOD;
            n = (n * n) % MOD;
            m >>= 1;
        }
        return ans;
    }
    public static int gcd(int a, int b)
    {
        if(a % b == 0) return b;
        return gcd(b, a % b);
    }
    public static long gcd(long a, long b)
    {
        if(a % b == 0) return b;
        return gcd(b, a % b);
    }
    public static long solve(long x, long[] res){
        int n = res.length;
        long a = x / n;
        int b = (int)(x % n);
        return res[n - 1] * a + res[b];
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------
}

Measured memory_bytes: 33500
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
    long long a,b,x;
    cin >> a >> b >> x;
    if(a%x == 0){
        cout << b/x-a/x+1 << endl;
    }else{
        cout << b/x-a/x << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int read(){
	int rt=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9'){rt=rt*10+ch-'0';ch=getchar();}
	return rt;
}
int n,a[1<<18];
struct _{
	int v[2];
}data[1<<18];
bool cmp(int x,int y){
	return a[x]<a[y];
}
_ Merge(_ x,_ y){
	_ ret;
	ret.v[0]=ret.v[1]=-1;
	int buf[5],tot=0;
	for(int i=0;i<2;i++)
		if(x.v[i]!=-1){
			buf[++tot]=x.v[i];
		}
	for(int i=0;i<2;i++){
		if(y.v[i]!=-1){
			buf[++tot]=y.v[i];
		}
	}
	sort(buf+1,buf+1+tot);
	tot=unique(buf+1,buf+1+tot)-buf-1;
	sort(buf+1,buf+1+tot,cmp);
	for(int i=0;i<2;i++){
		if(tot>0){
			ret.v[i]=buf[tot--];
		}
	}
	return ret;
}
int main(){
	n=read();
	int m=n;
	n=(1<<n);
	for(int i=0;i<n;i++){
		a[i]=read();
		data[i].v[0]=i;
		data[i].v[1]=-1;
	}
	for(int i=0;i<m;i++){
		for(int j=n-1;j>=0;j--){
			if(j&(1<<i)){
				data[j]=Merge(data[j],data[j^(1<<i)]);	
			}
		//	cout<<data[j].v[0]<<" "<<data[j].v[1]<<" "<<i<<" "<<j<<endl;
		}
	}
	int ans = 0;
	for(int i=1;i<n;i++){
		
		if(data[i].v[0]+1 && data[i].v[1]+1){
			ans = max(ans,a[data[i].v[0]]+a[data[i].v[1]]);
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 6144
s = gets.to_i
h = {}
i = 0
loop do
  i += 1
  if h.has_key?(s)
    puts i
    exit
  else
    h[s] = 1
    if s.odd?
      s = 3*s + 1
    else
      s /= 2
    end
  end
end

Measured memory_bytes: 1788
using System;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split('/');

            int year = int.Parse(s[0]);

            if(year > 2019)
            {
                Console.WriteLine("TBD");
            }
            else if(year < 2019)
            {
                Console.WriteLine("Heisei");
            }
            else
            {
                int month = int.Parse(s[1]);
                if(month > 4)
                {
                    Console.WriteLine("TBD");
                }
                else
                {
                    Console.WriteLine("Heisei");
                }
            }
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
int main() {
    int a,b; cin >> a >> b;
    int max = a + b;
    if(max < a * b) max = a * b;
    if(max < a - b) max = a - b;
    cout << max << endl;
    return 0;
}

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

int main(){
  string s;
  cin>>s;
  for(int i=0;i<=3;i++){
    cout<<s[i];
  }
  cout<<" ";
  for(int i=4;i<=s.size()-1;i++){
    cout<<s[i];
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, m, s, t;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    cin >> n >> m;
    vector<ll> e[n+1];
    rep(j, 1, m){
        cin >> s >> t;
        e[s].push_back(t);
    }
    
    double ans = 600;
    rep(b, 1, n-1){
        double dp[n+1];
        dp[n] = 0;
        rrep(i, n-1, 1){
            double sum = 0;
            double l = e[i].size();
            double mx = 0;
            rep(j, 0, l-1){
                sum += dp[e[i][j]];
                mx = max(dp[e[i][j]], mx);
            }
            if(i == b && l > 1){
                sum -= mx;
                dp[i] = sum/(l-1);
            }
            else{
                dp[i] = sum/l;
            }
            dp[i]++;
        }
        ans = min(dp[1], ans);
    }
    
    cout << setprecision(10) << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define Would
#define you
#define please

int main() {
	//おまじない
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll N, C, x[200000], v[200000];
	cin >> N >> C;
	rep(i, N) {
		cin >> x[i + 100000] >> v[i + 100000];
		x[i + 100000 - N] = x[i + 100000];
		v[i + 100000 - N] = v[i + 100000];
		x[i + 100000] += C;
	}

	ll best1 = -1e15;
	ll best2 = -1e15;
	ll migibest = 0;
	ll hidaribest = 0;
	ll migibestA[100000] = {};
	ll hidaribestA[100000] = {};

	ll kari = 0;
	ll maeiti = C;
	for (int i = 0; i < N; i++) {
		kari += v[i + 100000] - abs(x[i + 100000] - maeiti);
		maeiti = x[i + 100000];
		if (best1 < kari) {
			migibest = i + 100000;
			best1 = kari;
		}
		migibestA[i] = migibest;
	}

	kari = 0;
	maeiti = C;
	for (int i = 1; i <= N; i++) {
		kari += v[100000 - i] - abs(x[100000 - i] - maeiti);
		maeiti = x[100000 - i];
		if (best2 < kari) {
			hidaribest = 100000 - i;
			best2 = kari;
		}
		hidaribestA[i - 1] = hidaribest;
	}
	ll best = max(best1, best2);

	ll vs[200002] = {};
	vs[100000 - N] = v[100000 - N];
	rep1(i, 2 * N - 1) {
		vs[i + 100000 - N] = vs[i + 100000 - N - 1] + v[i + 100000 - N];
	}

	rep1(ii, N - 1) {
		if (x[100000 - ii] > C / 2) {
			kari = -abs(x[100000 - ii] - C);
			maeiti = x[100000 - ii];
			kari += vs[migibestA[N - ii - 1]] - vs[100000 - ii - 1] - abs(x[migibestA[N - ii - 1]] - maeiti);
			best = max(best, kari);
		}
	}





	rep(ii, N - 1) {
		if (x[ii + 100000] < C + C / 2) {
			kari = - abs(x[ii + 100000] - C);
			maeiti = x[ii + 100000];
			kari += vs[ii + 100000] - vs[hidaribestA[N - ii - 2] - 1] - abs(x[hidaribestA[N - ii - 2]] - maeiti);
			best = max(best, kari);
		}
	}

	if (best < 0) best = 0;
	co(best);
	Would you please return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;

int main() {
    int N;
    string S, T;
    cin >> N >> S >> T;
    rep(i, N) cout << S.at(i) << T.at(i);
    cout << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

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

    vector<int> p(n);
    rep(i,n) p[i] = i;

    auto dist = [&](int a, int b){
        int X = x[a]-x[b];
        int Y = y[a]-y[b];
        return sqrt(X*X+Y*Y);
    };

    int ct = 0;
    double ans = 0;
    do{
        ++ct;
        rep(i,n-1) ans += dist(p[i],p[i+1]);
    }while(next_permutation(all(p)));
    ans /= ct;
    printf("%.15f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	int n = 0;
	string s;
	cin >> s;
	for(int i = 0; i < 4; i++){
		if(s[i] == '+') n += 1;
		else n -= 1;
	}
	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
// 2013/09/17 Tazoe

#include <iostream>
using namespace std;

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

		if(n==0)
			break;

		int cnt[10] = {0};
		for(int i=0; i<n; i++){
			int m;
			cin >> m;

			cnt[m]++;
		}

		for(int i=0; i<10; i++){
			if(cnt[i]==0){
				cout << '-' << endl;
				continue;
			}

			for(int j=0; j<cnt[i]; j++){
				cout << '*';
			}
			cout << endl;
		}
        }

	return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fast_I_O ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int mod = 1e9+7 , INF = 1e9 ,  mx = 100005 ;
main()
{
    fast_I_O;
    int i,j,n,m,x,y,sum=0,p=0,l,d;
    cin>>n>>d;
    while(n--)
    {
        cin>>x>>y;
        double kk=(double)(x*x)+(double)(y*y);
        kk=sqrt(kk);
        if(kk<=(double)d)++p;
    }
    cout<<p;

    return 0;
}

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

using namespace std;

const int MAX_H = 10;
const int W = 5;
int H;

int S[MAX_H][W];

int del(){
    int ret = 0;

    for(int i=0; i<H; i++){
        vector<pair<int, int>> d;
        int cnt = 1;
        int s = 0;
        for(int j=0; j<W-1; j++){
            if(S[i][j] == S[i][j+1]){
                cnt++;
            }else{
                d.push_back(make_pair(s, cnt));
                cnt = 1;
                s = j+1;
            }
        }
        d.push_back(make_pair(s, cnt));
        for(int j=0; j<d.size(); j++){
            if(S[i][d[j].first] == -1) continue;
            if(d[j].second >= 3){
                ret += S[i][d[j].first]*d[j].second;
                for(int k=0; k<d[j].second; k++){
                    S[i][d[j].first+k] = -1;
                }
            }
        }
    }
    return ret;
}

bool move(){
    bool fl = false;
    for(int i=H-2; i>=0; i--){
        for(int j=0; j<W; j++){
            if(S[i][j] == -1) continue;
            if(S[i+1][j] == -1){
                S[i+1][j] = S[i][j];
                S[i][j] = -1;
                fl = true;
            }
        }
    }
    return fl;
}

int main(){
    vector<int> ans;
    while(true){
        cin >> H;
        if(H ==0) break;

        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                cin >> S[i][j];
            }
        }

        int ta = 0;
        while(true){
            int add = del();
            if(add == 0) break;
            ta += add;
            while(move());
        }
        ans.push_back(ta);
    }

    for(int i=0; i<ans.size(); i++){
        cout << ans[i] << endl;
    }

    return 0;
}


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

int main(){
  int N,rate,member[9]={},min=0,max=0;
  cin>>N;
  for(int i=0;i<N;i++){
    cin>>rate;
      for(int j=0;j<8;j++){
        if(400*j<=rate && rate<400*(j+1)){
          member[j] += 1;
          break;
        }
      }
      if(3200<=rate){
        member[8] += 1;
      }
    }

  for(int k=0;k<8;k++){
    if(member[k] != 0){
      min += 1;
    }
  }

  max = min + member[8];
  if(min ==0){
    min =1;
  }
  cout<<min<<" "<<max<<endl;
  return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  vector<vector<int>> p(n);
  for (int i = 0; i < m; i++) {
    int t, f;
    cin >> t >> f;
    t--;
    f--;
    p[t].push_back(f);
    p[f].push_back(t);
  }
  int r[202020] = {0}, b[202020] = {0};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < p[i].size(); j++)
      if (s[p[i][j]] == 'A')
        r[i]++;
      else
        b[i]++;
  set<int> st;
  bool used[202020] = {0};
  for (int i = 0; i < n; i++)
    if ((r[i] == 0 || b[i] == 0) && !used[i]) {
      st.insert(i);
    }
  while (st.size() > 0) {
    int i = *st.begin();
    st.erase(st.begin());
    if (used[i])
      continue;
    used[i] = true;
    for (int j = 0; j < p[i].size(); j++) {
      if (s[i] == 'A')
        r[p[i][j]]--;
      else
        b[p[i][j]]--;
      if (r[p[i][j]] == 0 || b[p[i][j]] == 0)
        st.insert(p[i][j]);
    }
  }
  for (int i = 0; i < n; i++)
    if (r[i] > 0 && b[i] > 0) {
      cout << "Yes" << endl;
      return 0;
    }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 17412
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-7
#define PII pair<int,int>
#define s second
#define f first
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
ll MOD = 1e9+7;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int random_int(int l,int r){return uniform_int_distribution<int>(l,r)(rng);}
ll fast_power(ll x, ll p){
    ll res = 1;
    while(p > 0){
        if(p & 1){
            res = (res * x)%MOD;
        }
        p = p >> 1;
        x = (x*x)%MOD;
    }
    return res;
}
vector<vector<int>> v;
ll n;
vector<ll> dp;
ll solve(int mask){
    if(mask == ((1LL << n)-1)){
        return 1;
    }
    if(dp[mask] != -1){
        return dp[mask];
    }
    int indx = __builtin_popcount(mask);
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(v[indx][i] && !((1LL << i) & mask)){
               ans += solve(mask | (1LL << i));
               ans %= MOD;
        }
    }
    return dp[mask] = ans;
}
int main() {
    IO;
    cin >> n;
    v.resize(n);
    dp.resize(1LL << n);
    fill(dp.begin(), dp.end(),-1);
    for(int i = 0; i < n; i++){
        v[i].resize(n);
        for(int j = 0; j < n; j++){
            cin >> v[i][j];
        }
    }
    cout << solve(0);


    return 0;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

template <class Abel> struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<Abel> diff_weight;

    UnionFind(int n = 1, Abel SUM_UNITY = 0) { init(n, SUM_UNITY); }

    void init(int n = 1, Abel SUM_UNITY = 0) {
        par.resize(n);
        rank.resize(n);
        diff_weight.resize(n);
        for (int i = 0; i < n; ++i)
            par[i] = i, rank[i] = 0, diff_weight[i] = SUM_UNITY;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        } else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]];
            return par[x] = r;
        }
    }

    Abel weight(int x) {
        root(x);
        return diff_weight[x];
    }

    bool issame(int x, int y) { return root(x) == root(y); }

    bool merge(int x, int y, Abel w) {
        w += weight(x);
        w -= weight(y);
        x = root(x);
        y = root(y);
        if (x == y)
            return false;
        if (rank[x] < rank[y])
            swap(x, y), w = -w;
        if (rank[x] == rank[y])
            ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        return true;
    }

    Abel diff(int x, int y) { return weight(y) - weight(x); }
};

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

    int N, M;
    cin >> N >> M;
    UnionFind<int> tree(N);

    rep(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        if (tree.issame(a, b)) {
            ll diff = tree.diff(a, b);
            if (diff != c) {
                cout << "No" << endl;
                return 0;
            }
        } else {
            tree.merge(a, b, c);
        }
    }

    cout << "Yes" << endl;
}

Measured memory_bytes: 4524
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

int main() {
    string s;
    cin >> s;
    int a = 0, b = 0, c = 0;
    for (auto t : s) {
        if (t == 'a') a++;
        else if (t == 'b') b++;
        else c++;
    }
    int mx = max({a, b, c});
    bool ch = (mx - a <= 1 && mx - b <= 1 && mx - c <= 1);
    cout << (ch ? "YES" : "NO") << endl;
    return 0;
}

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

using ll = long long;
#define int long long

#define LOG(variable) cout << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cout << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= 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 { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
int in() {int x; cin>>x; return x;}
string stin() {string s; cin>>s; return s;}
/***** MAIN *****/
signed main() {
  int a, b, c, distance;
  cin >> a >> b >> c >> distance;
  if(abs(a-c) <= distance) {
   	cout << "Yes" << endl;
    return 0;
  }
  if(abs(a-b) <= distance && abs(b-c) <= distance) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  cout << "\n";
  return 0;
}
/***** MAIN *****/


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

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n, m, a, b;
	cin >> n >> m >> a >> b;
	int n2 = n & 1;
	int m2 = m & 1;
	if(a > (m / 2) * n){
		cout << "NO" << '\n';
		return 0;
	}
	if(b > (n / 2) * m){
		cout << "NO" << '\n';
		return 0;
	}
	if(a + b > n * m / 2){
		cout << "NO" << '\n';
		return 0;		
	}
	vector<string> s(n, string(m, '.'));
	if(m & 1){
		for(int i = 0; i + 1 < n; i += 2){
			if(b > 0){
				s[i][m-1] = '^';
				s[i+1][m-1] = 'v';
				b -= 1;
			}
		}
		m -= 1;
	}
	if(n & 1){
		for(int j = 0; j + 1 < m; j += 2){
			if(a > 0){
				s[n-1][j] = '<';
				s[n-1][j+1] = '>';
				a -= 1;
			}
		}
		n -= 1;
	}
	for(int i = 0; i + 1 < n; i += 2){
		for(int j = 0; j + 1 < m; j += 2){
			if(a >= 2 || (b <= 1 && a > 0)){
				s[i][j] = '<';
				s[i][j+1] = '>';
				a -= 1;
				if(a > 0){
					s[i+1][j] = '<';
					s[i+1][j+1] = '>';
					a -= 1;
				}
			} else if(b > 0){
				s[i][j] = '^';
				s[i+1][j] = 'v';
				b -= 1;
				if(b > 0){
					s[i][j+1] = '^';
					s[i+1][j+1] = 'v';
					b -= 1;
				}
			}
		}
	}
	if(a > 0 || b > 0){
		if(n2 & m2){
			s[n-2] = s[n-2].substr(0, m-2) + "<>^";
			s[n-1] = s[n-1].substr(0, m-2) + "^.v";
			s[n  ] = s[n  ].substr(0, m-2) + "v<>";			
		} else {
			cout << "NO" << '\n';
			return 0;
		}
	}
	cout << "YES" << '\n';
	for(string x : s){
		cout << x << '\n';
	}
}

Measured memory_bytes: 2304
#include <iostream>
#include <string>
#include <utility>

using namespace std;

class mqueue {
	private:
		pair<string,int> a[100005];
		int size,f,b;
	public:
		mqueue() {
			size = 100005;
			f = 0;
			b = 0;
		}
		bool empty() {
			return f == b;
		}
		void push(pair<string,int> e) {
			if((f + 1) % size== b) throw "Error: full";
			a[f] = e;
			f++;
			if(f == size) f = 0;
		}
		pair<string,int> front() {
			return a[b];
		}
		void pop() {
			if(!empty()) {
				b++;
				if(b == size) b = 0;
			}
			else throw "Error: empty";
		}
};

int main(void) {
	int n,q;
	mqueue m;
	cin >> n >> q;
	string name;
	int time;
	for(int i = 0;i < n;i++) {
		cin >> name >> time;
		m.push(make_pair(name,time));
	}
	int elapsed = 0;
	while(!m.empty()) {
		auto c = m.front();
		m.pop();
		c.second -= q;
		elapsed += q;
		if(c.second > 0) m.push(c);
		else {
			elapsed += c.second;
			cout << c.first <<" "<< elapsed << endl;
		}
	}
}



Measured memory_bytes: 7004
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"

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

	int n;
	cin>>n;
	vvi in(n,vi(3));
	rep(i,n)rep(j,3)cin>>in[i][j];

	vvi dp(n+1,vi(3));

	rep(i,n)rep(j,3)rep(k,3)if(j-k)
		cmax(dp[i+1][k],dp[i][j]+in[i][k]);
	cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;
}






Measured memory_bytes: 11264
#include <cstdio> 
#define llg long long 
using namespace std; 

llg A, B, T, ans = 0, K, L; 
int t, k = 0; 

int main() {
	scanf("%lld%lld", &A, &B); 
	if (A == B) return puts("1"), 0; 
	for (int i = 61; i >= 0; --i) {
		T = 1ll << i; t = i; 
		if ((A & T) != (B & T)) break; 
		if ((A & T)) A ^= T, B ^= T; 
	} 
	for (int i = t - 1; i >= 0; --i) 
		if (B & (1ll << i)) 
			{k = i; K = (1ll << (k + 1)) - 1; break; } 
	ans += T - A; 
	if (K >= A) ans += T; 
	else ans += K + T - A + 1; 
	printf("%lld\n", ans); 
	return 0; 
} 

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

typedef long long ll;
const int N=2000;
ll x[N],y[N],sumx,sumy;int n;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>x[i]>>y[i];
		if((x[i]+y[i]+x[1]+y[1])&1){
			cout<<"-1\n";
			return 0;
		}
	}
	int op=(x[1]+y[1])&1;
	cout<<40-op<<'\n';if(!op)cout<<1<<' ';
	for(int i=0;i<39;++i)cout<<(1ll<<i)<<" \n"[i==38];
	for(int i=1;i<=n;++i){
		if(!op)cout<<'D',y[i]++;
		for(int j=0;j<39;++j){
			if(x[i]>>j&1){
				if((((x[i]+(1ll<<j))^y[i])>>(j+1)&1)^(j==38))cout<<'L',x[i]+=1ll<<j;
				else cout<<'R',x[i]-=1ll<<j;
			}else{
				if((((y[i]+(1ll<<j))^x[i])>>(j+1)&1)^(j==38))cout<<'D',y[i]+=1ll<<j;
				else cout<<'U',y[i]-=1ll<<j;
			}
		}
		cout<<'\n';
	}
	return 0;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.nextString();

            out.println("" + s.charAt(0) + (s.length() - 2) + s.charAt(s.length() - 1));
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 21588
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {

		int num = 1;
		for (int i = 1; i <= 365; i++) {

			out(num++);
			if (num == 27) {
				num = 1;
			}
		}

	}

	/*
	 * 以下メソッド集
	 */
	static int[] sort(int[] n) {
		Arrays.sort(n);
		return n;
	}

	static void debug() {
		out("---");
	}

	static void debug(long a) {
		out("-------");
		out(a);
		out("-------");
	}

	static void debug(String a) {
		out("-------");
		out(a);
		out("-------");
	}

	static long[] sort(long[] n) {
		Arrays.sort(n);
		return n;
	}

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int account(String str) {
		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

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

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static long min(long d, long e) {
		return Math.min(d, e);
	}

	static int min(int a, int b) {
		return (int) Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 36336
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int N;
    cin >> N;

    int ans = 0;
    REP(i, N + 1) {
        int cnt = 0;
        int c = i;
        while(c > 0) cnt++, c /= 10;

        if (cnt & 1) ans++;
    }

    print(ans);
    
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define forloop(n) for(int i = 0; i < n; i++)
#define ll long long
#define mod 1000000007
long long exp(long long taban, long long us) {
    long long carpan = taban;
    long long temp = us;
    long long res = 1;
    for(int i = 0;;i++){
        if(temp % 2) res = (res*carpan) % mod;
        temp /= 2;
        carpan = (carpan*carpan) % mod;
        if(temp == 0) break;
    }
    return res;
}
ll ebob(ll a, ll b){
	if(!a)return b;
	return ebob(b%a, a);
}
ll ekok(ll a, ll b){
	return (((a*b)%mod)*(exp(ebob(a,b), (ll)mod-2))) % mod;
}
/*void set_levels(int cur, int dont){
	level[cur] = level[dont] + 1;
	parent[cur] = dont;
	for(int i = 0; i < vec[cur].size(); i++){
		if(vec[cur][i] != dont) set_levels(vec[cur][i], cur);
	}
}*/
/*ll fact[2000005];
ll komb(ll a, ll b){
	a++;
	ll payda = (fact[a]*fact[b]) % mod;
	return (fact[a+b] * (exp(payda, mod - 2))) % mod;
}*/

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin>>n;
	map<int, int> mp;
	while(n--){
		int sayi; cin>>sayi;
		if(mp[sayi]){
			cout<<"NO";
			return 0;
		}
		mp[sayi]++;
	}
	cout<<"YES";
}


Measured memory_bytes: 9600
#include<set>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<climits>
#include<iostream>
#include<iterator>
#include<string.h>
#include<algorithm>
#include<unordered_map>
#pragma GCC optimize "trapv"
using namespace std;

#define ld long double
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(int i=a;i<b;i++)
#define pp pair<int,pair<int,int>>
#define ppp pair<pair<int,int>,pair<int,int>>

const ll M=998244353,N=1e5+2;

struct hash_pair{
	template <class T1, class T2>
	size_t operator()(const pair<T1, T2>& p) const{
		auto hash1 = hash<T1>{}(p.first);
		auto hash2 = hash<T2>{}(p.second);
		return hash1 ^ hash2;
	}
};

void sieve(){
	bool prime[N+1];
	memset(prime,true,sizeof(prime));
	for(ll p=2;p*p<=N;p++){
		if(prime[p] == true){
			for(ll i=p*p;i<=N;i+=p)
				prime[i] = false;
		}
	}
}

ll power(ll x,ll y,ll p){
	ll res = 1;
	x = x%p;
	while(y > 0){
		if(y&1)
			res = (res*x)%p;
		y = y>>1;
		x = (x*x)%p;
	}
	return res;
}

int root(int i,int A[]){
	while(A[i] != i){
		A[i] = A[A[i]];
		i = A[i];
	}
	return i;
}

void unite(int a,int b,int A[],int B[]){
	int c = root(a,A);
	int d = root(b,A);
	if(c == d)
		return;
	if(B[c] < B[d]){
		A[c] = d;
		B[d] += B[c];
	}
	else{
		A[d] = c;
		B[c] += B[d];
	}
}

inline ll in()
{
	ll n=0;
	bool check=0;
	register char c=getchar();
	while(c<'0' || c>'9')
	{
		if(c=='-')
			check=1;
		c=getchar();
	}
	while(c>='0' && c<='9')
	{
		n = (n<<1)+(n<<3)+c-'0';
		c=getchar();
	}
	return n-2*n*check;
}

string ip()
{
    string i="";
    int temp=getchar();
    while(temp<'a'||temp>'z')
        temp=getchar();
    while(temp>='a'&&temp<='z')
    {
        i+=(char)temp;
        temp=getchar();
    }
    return i;
}

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

	

	string S;
	cin>>S;
	int n=S.size();
	bool check = true;
	for(int i=0;i<n/2;i++){
		if(S[i] != S[n-i-1])
			check = false;
	}
	for(int i=0;i<(n/2)/2;i++){
		if(S[i] != S[n/2-i-1])
			check = false;
	}

	check ? cout<<"Yes\n" : cout<<"No\n";

	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons;

alias MP = Tuple!(int, "i", int, "p");

int[11] PS, CS;

void main()
{
    auto dg = readln.split.to!(int[]);
    auto D = dg[0];
    auto G = dg[1] / 100;

    foreach (i; 1..D+1) {
        auto pc = readln.split.to!(int[]);
        PS[i] = pc[0];
        CS[i] = pc[1] / 100;
    }

    int solve(int i, int c, uint m) {
        if (i == D+1) {
            foreach_reverse (j; 1..D+1) {
                if (m & (1<<j)) continue;
                if (c >= PS[j]) continue;
                return j * c;
            }
            return 0;
        }

        auto r1 = solve(i + 1, c, m);
        if (c >= PS[i]) {
            auto r2 = PS[i] * i + CS[i] + solve(i + 1, c - PS[i], m | (1<<i));
            return max(r1, r2);
        } else {
            return r1;
        }
    }

    foreach (i; 1..1001) {
        if (solve(1, i, 0) >= G) {
            writeln(i);
            return;
        }
    }
}

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

#define ll long long
#define int long long
#define loop(i,s,e) for(int i=s;i<e;i++)
#define rloop(i,s,e) for(int i=e;i>=s;i--)
#define fr first
#define sc second
#define pb push_back
#define  vii vector<int>
#define vll vector<ll>
#define vpii vector<pair<int ,int >>
#define vpll vector<pair<ll, ll> >
#define  pii pair<int,int>
#define lb(v,x) lower_bound(v.begin(),v.end(),x);
#define ub(v,x) upper_bound(v.begin(),v.end(),x);
const long mod =1e8;
const int N = 5e6+5;
const long long inf= 1e18;

ll gcd(ll a ,ll b){if(b==0) return a;return gcd(b,a%b);}
ll mul(ll a ,ll b){return (a%mod * b%mod )%mod;}
ll mpower(ll a, ll b){if(b==0) return 1;ll temp=mpower(a,b/2);if(b%2==0){return mul(temp,temp);}else{	return mul(mul(temp,temp) , a);}}
ll inv(ll a){return mpower(a,mod-2);}
ll ncr(ll n, ll r){if(r==0)return 1;ll ans=n%mod;ans=mul(ans,ncr(n-1,r-1));ans=mul(ans,inv(r));	return ans;}
ll power(ll a, ll b){if(b==0) return 1;ll temp=power(a,b/2);if(b%2==0)return temp*temp;else return temp*temp*a;}
ll add(ll a, ll b){return (a%mod + b%mod)%mod;}

void solve()
{
     
  ll n,m;
  cin>>n>>m;
  ll ans=0;
  if(n>=2) ans+=(n*(n-1))/2;
  if(m>=2) ans+=(m*(m-1))/2;
  cout<<ans<<"\n";
   
}

int32_t main()
{
	ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t=1;//cin>>t;
	while(t--){
        solve();
	}
}

Measured memory_bytes: 256
num = gets.to_i

if num >= 3600
  h = num/3600
  m = num - h*3600
  m2 = m/60
  s = m - m2*60
  puts "#{h}:#{m2}:#{s}"
elsif 3600 > num && num >= 60
  m = num/60
  s = num - m*60
  puts "0:#{m}:#{s}"
else
  puts "0:0:#{num}"
end



Measured memory_bytes: 6872
//
// Created by Jaikirat Sandhu on 16/06/18.
//

#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int findPower(long long n) {
    int po = 0;

    while(n%2 == 0) {
        n/=2;
        po++;
    }

    return po;
}

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

    int N;
    cin >> N;

    vector<long long> A(N);

    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int times = 0;

    for(int i = 0; i < N; i++) {
        times += findPower(A[i]);
    }

    cout << times << endl;
}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, W;
  cin >> n >> W;
  vector<ll> dp(W+1); // dp[i] the maximum value at wieght i
  for (int i = 0; i < n; i++) {
    int weight, value;
    cin >> weight >> value;
    for (int weight_already = W - weight; weight_already >= 0; weight_already--){
      dp[weight_already + weight] = max(dp[weight_already + weight], dp[weight_already] + value);
    }
  }
  ll ans = 0;
  for (int i = 0; i <= W; i++){
    ans = max(ans, dp[i]);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3960
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b){
        if(b > a){
                ll tmp = b;
                b = a;
                a = tmp;
        }
        if(b == 0) return a;
        else return gcd(b,a%b);
}
ll lcm(ll a, ll b){
        ll g = gcd(a,b);
        return a/g*b;
}

ll N, M;
char S[100001];
char T[100001];
map<ll,char> m;
int main(){
        scanf("%lld %lld",&N,&M);
        scanf("%s",S);
        scanf("%s",T);

        ll l = lcm(N,M);
        //printf("%lld\n",l);


        for(ll i = 0; i < N; i++){
                m[i*(l/N)] = S[i];
        }

        for(ll j = 0; j < M; j++){
                if(m[j*(l/M)] != 0 && m[j*(l/M)]!= T[j]){
                        puts("-1");
                        return 0;
                }
        }
        printf("%lld\n",l);

}

Measured memory_bytes: 10752
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int W[300000 + 1], E[300000 + 1];

int main(){

	int N;
	string S;

	cin >> N;
	cin >> S;

	for (int i = 0; i < N; i++)
		if (S[i] == 'W') W[i] ++; else E[i]++;

	for (int i = 1; i < N; i++){
		W[i] = W[i - 1] + W[i];
		E[i] = E[i - 1] + E[i];
	}

	int result = 1000000000, t;
	for (int i = 0; i < N; i++){
		t = W[i - 1] + (E[N-1] - E[i]);
		if (t < result) result = t;
	}
	cout << result << endl;

	return 0;
}


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

int main() {
	int n;
	cin >> n;
	vector<int> w(n);
	for (int i = 0; i < n; i++) {
		cin >> w[i];
	}

	vector<int> sum(n);
	sum[0] = w[0];
	for (int i = 1; i < n; i++) {
		sum[i] = sum[i - 1] + w[i];
	}
	int ans = INT_MAX;
	for (int i = 0; i < n; i++) {
		ans = min(ans, abs(sum[n - 1] - 2 * sum[i]));
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, m, r;
  cin >> n >> m >> r;
  vector<int> rv(r);
  rep(i, 0, r) {
    cin >> rv[i];
    rv[i]--;
  }

  vector<vector<ll>> d(n, vector<ll>(n, 1e18));
  rep(i, 0, m) {
    int a, b, c;
    cin >> a >> b >> c;
    a--, b--;
    d[a][b] = c;
    d[b][a] = c;
  }

  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);

  sort(rv.begin(), rv.end());
  ll ans = 1e18;
  do {
    ll x = 0, from = rv[0];
    rep(to, 1, r) {
      x += d[from][rv[to]];
      from = rv[to];
    }
    chmin(ans, x);
  } while (next_permutation(rv.begin(), rv.end()));

  cout << ans << endl;
}


Measured memory_bytes: 640