akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC117C
{
    class MainClass
    {

        static int[] n;
        static int[] x;

        public static void Main(string[] args)
        {

            n = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);
            x = Array.ConvertAll(Console.ReadLine().Split().ToArray(), int.Parse);

            Array.Sort(x);


            var lst = new List<int>();
            int tmp = 0;
            int sum = 0;
            for(int i = 0; i < n[1]-1; i++)
            {
                tmp = x[i + 1] - x[i];
                lst.Add(tmp);
                sum += tmp;
            }
            lst.Sort();



            for(int j = 0; j < n[0]-1; j++)
            {
                if (lst.Any())
                {
                    sum -= lst.Last();
                    lst.RemoveAt(lst.Count()-1);
                }
                else
                {
                    break;
                }

            }



            Console.WriteLine(Math.Max(sum,0));

            return;


        }
    }
}


Measured memory_bytes: 28640
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
using namespace std;

int main()
{
	long long N, K;
	cin >> N >> K;
	vector<long long> x;
	for (auto i = 0; i < N; ++i)
	{
		long long temp;
		cin >> temp;
		x.push_back(temp);
	}

	auto result = LLONG_MAX;
	for (auto i = 0; i < N - K + 1; ++i)
	{
		auto left = x[i];
		auto right = x[i + K - 1];
		auto time = right - left;
		if (left >= 0)
		{
			time += abs(left);
		}
		else if (right <= 0)
		{
			time += abs(right);
		}
		else
		{
			time += min(abs(left), abs(right));
		}
		result = min(result, time);
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 1400
//Water Bottle

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18
const double PI=3.14159265358979323846;

signed main (){
    double a,b,x;cin>>a>>b>>x;
    if(a*a*b/2>x){
        double ha = x/a/b*2;
        cout15(atan(b/ha)*(180/PI));
    }else{
        double ha = (a*a*b-x)/a/a*2;
        cout15(atan(ha/a)*(180/PI));
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
	int cnt1=0,cnt2=0;
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if(a%d==0)
	{
		cnt1=a/d;
	}
	else
	{
		cnt1=a/d+1;
	}
	if(c%b==0)
	{
		cnt2=c/b;
	}
	else
	{
		cnt2=c/b+1;
	}
	if(cnt2>cnt1)
	{
		printf("No\n");
	}
	else
	{
		printf("Yes\n");
	}
	return 0;
} 


Measured memory_bytes: 1612
#include <cstdio>
#include <cmath>

int A,B,H,M;

const double pi= 3.141592653589793;

int main(){
    scanf("%d%d%d%d",&A,&B,&H,&M);

    double Mx,My;
    double Mangle=2.0*pi*(double)M/(double)60;
    Mx=B*sin(Mangle),My=B*cos(Mangle);
    double Hangle=2.0*pi*(double)(M+60*H)/(double)720;
    double Hx,Hy;
    Hx=A*sin(Hangle),Hy=A*cos(Hangle);

    double dist=sqrt((Mx-Hx)*(Mx-Hx)+(My-Hy)*(My-Hy));
    printf("%.10lf\n",dist);
    return 0;
}

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

int main() {

	//float A, B, H, M,kaku;

	int N, sum;
	cin >> N;

	sum = 1000 - N % 1000;

	if (sum == 1000) {
		cout << "0" << endl;
		return 0;
	}



	cout << sum << endl;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<T> vt;
//inline int in() { int x; scanf("%d",&x); return x;}
inline ll in() { ll x; cin >> x; return x; }
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
#define chmin(x,y) x = min(x,y)

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
map<ll, ll> prime_factor(ll n) {
  map<ll, ll> ret;
  for(ll i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1) ret[n] = 1;
  return ret;
}

vector<int> to[2505];
vector<int> rto[2505];
bool reachablefrom1[2505];
bool reachableToN[2505];
bool ok[2505];

void dfs(int v) {
  if (reachablefrom1[v]) return;
  reachablefrom1[v] = true;
  for (int u : to[v]) {
    dfs(u);
  }
}
void rdfs(int v) {
  if (reachableToN[v]) return;
  reachableToN[v] = true;
  for (int u : rto[v]) {
    rdfs(u);
  }
}

int main() {
  ll n = in();
  ll sn = sqrt(n);
  for (ll i = sn; i >= 1; i--) {
    ll ni = n/i;
    if (ni*i==n) {
      cout << i + ni - 2 << endl;
      return 0;
    }
  }
  cout << n - 1 << endl;
  return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int size[101],g[101][101],x[101], y[101], k, d;
void dfs(int z){
  int i;
  x[z] = d++;
  for(i=1;i<=size[z];i++) if(!x[g[z][i]]) dfs(g[z][i]);
  y[z] = d++;
}
 
main(){
  int i, j, a;
  d=1;
  scanf("%d", &k);
  for(i=1;i<=k;i++){
    x[i] = y[i] = 0;
    scanf("%d", &a);
    scanf("%d", &size[a]);
    for(j=1;j<=size[a];j++) scanf("%d", &g[a][j]);
  }
  for(i=1;i<=k;i++){
    if(!x[i]) dfs(i);
  }
  for(i=1;i<=k;i++){
    printf("%d %d %d\n", i, x[i], y[i]);
  }
  return 0;
}



Measured memory_bytes: 2768
#include<bits/stdc++.h>
using namespace std; \
int main() {
    int n;
    cin >> n;
    vector<int>v(n);
    for (auto& x : v)
        cin >> x;
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i(0); i < n; ++i) {
        for (int j(i + 1); j < n; ++j) {
            for (int k(j + 1); k < n; ++k) {
                if (v[i] + v[j] > v[k] and v[i] != v[j] and v[j] != v[k])ans++;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
#define eb(t) emplace_back(t)
typedef long long ll;
typedef long long unsigned int llu;
ll INF = 1000000009;
ll MOD = 1000000007;

void solve(){

    ll n,a,b;
    cin >> n >> a >> b;
    if(abs(a-b)%2==0){
        cout << (abs(a-b))/2 << endl;
    }
    else{
        cout << min((b+a-1)/2, (n-b+n-a+1)/2) << endl;
    }
    

}

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


Measured memory_bytes: 256
from sys import stdin

if __name__ == '__main__':

    N = int(stdin.readline())
    A = [int(x) for x in stdin.readline().rstrip().split()]

    tmp = list()
    for i in range(N):
        if i % 2 == 0:
            continue

        tmp.append(A[i])

    X = list()
    X.append(sum(A) - sum(tmp) * 2)

    for i in range(N):
        if i == 0:
            continue

        X.append(2 * A[i-1] - X[i-1])

    print(' '.join([str(x) for x in X]))


Measured memory_bytes: 19992
#include <bits/stdc++.h>
using std::priority_queue;
using std::vector;
using std::greater;
const int N=200005;
int f[N],fa[N],c[N][2],x,n;
long long ans; 
int find(int x){
	if (x==f[x]) return x;
	f[x]=find(f[x]);
	return f[x];
}
struct note{
	int x,y,id;
};
inline bool operator <(note x,note y){
		return 1ll*x.x*y.y<1ll*x.y*y.x;
}
priority_queue <note> q;
int main(){
	scanf("%d",&n);
	for (int i=2;i<=n;i++) scanf("%d",&fa[i]);
	for (int i=1;i<=n;i++) scanf("%d",&x),c[i][x]=1;
	for (int i=1;i<=n;i++) f[i]=i;
	for (int i=2;i<=n;i++) q.push({c[i][0],c[i][1],i});
	while(!q.empty()){
		note t=q.top();
		int x=t.id;
		q.pop();
		if (find(x)!=x) continue;
		int ff=find(fa[x]);
		ans=ans+1ll*c[ff][1]*c[x][0];
		c[ff][1]+=c[x][1],c[ff][0]+=c[x][0];
		f[x]=ff; 
		if (ff!=1) q.push({c[ff][0],c[ff][1],ff});
	} 
	printf("%lld\n",ans);
}

Measured memory_bytes: 8052
#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define mp make_pair 
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
inline LL read(){
	char ch=getchar(); LL w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
const int M=4e6+10,inf=1e9;
int n,m;
#define lc (x<<1)
#define rc (x<<1|1)
#define mid (l+r>>1)
int t[M],val[M],tg[M];
void pu(int x){
	val[x]=min(val[lc],val[rc]);
}
void build(int x,int l,int r){
	tg[x]=-inf;
	if (l==r){
		t[x]=-l; 
		val[x]=t[x]+l;
		return ; 
	} 
	build(lc,l,mid); build(rc,mid+1,r);
	pu(x);
}
void dw(int x,int l,int r,int d){
	t[x]=d;
	val[x]=t[x]+l;
	tg[x]=d;
}
void pd(int x,int l,int r){
	if (tg[x]!=-inf){
		dw(lc,l,mid,tg[x]);
		dw(rc,mid+1,r,tg[x]);
		tg[x]=-inf;
	}
}
void upd(int x,int l,int r,int ll,int rr,int d){
	if (l==ll && r==rr){
		dw(x,l,r,d);
		return ;
	}
	pd(x,l,r);
	if (rr<=mid) upd(lc,l,mid,ll,rr,d);
	else if (ll>mid) upd(rc,mid+1,r,ll,rr,d);
	else upd(lc,l,mid,ll,mid,d),upd(rc,mid+1,r,mid+1,rr,d);
	pu(x);
//	cout<<val[x]<<" "<<l<<" "<<r<<"   hh \n";
}
int qry(int x,int l,int r,int p){
//	if (l==r) cout<<t[x]<<"\n";
	if (l==r) return t[x];
	pd(x,l,r);
	if (p <= mid) return qry(lc, l, mid,p);
	return qry(rc, mid + 1, r,p);
}
int main(){
	n=read(); m=read();
	build(1,1,m);
//	cout<<val[1]<<"  gg\n";
	F(i,1,n){
		int x=read(),y=read();
		int tmp=1e9;
		if (x>1) tmp=qry(1,1,m,x-1);
		upd(1,1,m,x,y,tmp);
		int ret=val[1]+i;	
//		cout<<val[1]<<" "<<tmp<<"  rfuck \n";
		if (ret>=1e8) cout<<-1<<"\n";
		else cout<<ret<<"\n";
	}
	return 0;
}

Measured memory_bytes: 9740
#include <stdio.h>
#include <math.h>
#define PI M_PI
typedef struct{
  double x;
  double y;
}P;

void Kock(P f, P l, int n){
  double theta = PI/3.0;
  P s, u, t;
  if(n == 0) return ;
  s.x = (2*f.x + l.x)/3;
  s.y = (2*f.y + l.y)/3;
  t.x = (f.x + 2*l.x)/3;
  t.y = (f.y + 2*l.y)/3;
  u.x = (t.x - s.x)*cos(theta) - (t.y - s.y)*sin(theta) + s.x;
  u.y = (t.x - s.x)*sin(theta) + (t.y - s.y)*cos(theta) + s.y;

  Kock(f,s,n-1);
  printf("%f %f\n",s.x, s.y);
  Kock(s,u,n-1);
  printf("%f %f\n",u.x, u.y);
  Kock(u,t,n-1);
  printf("%f %f\n",t.x, t.y);
  Kock(t,l,n-1);
  
}

int main(){
  P f={0.0, 0.0}, l={100.0, 0.0};
  int n;
  scanf("%d",&n);
  printf("%f %f\n",f.x, f.y);
  Kock(f, l, n);
  printf("%f %f\n",l.x, l.y);
  return 0;
}

Measured memory_bytes: 636
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define deb(x) cout << #x << " is " << x << "\n";

using namespace std;
using namespace __gnu_pbds;

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	vector<vector<long long>> board(3, vector<long long>(3));
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			cin >>board[i][j];
		}
	}
	long long n, ele;
	cin >>n;	
	while(n--) {
		cin >>ele;
		for(long long i = 0; i < 3; i++) {
			for(long long j = 0; j < 3; j++) {
				if(board[i][j] == ele) {
					board[i][j] = -1;
				}
			}
		}	
	}
	bool flag = false;
	if(board[0][0] == -1 && board[1][1] == -1 && board[2][2] == -1)
		flag = true;
	if(board[0][2] == -1 && board[1][1] == -1 && board[2][0] == -1)
		flag = true;
	if(board[0][0] == -1 && board[0][1] == -1 && board[0][2] == -1)
		flag = true;
	if(board[1][0] == -1 && board[1][1] == -1 && board[1][2] == -1)
		flag = true;
	if(board[2][0] == -1 && board[2][1] == -1 && board[2][2] == -1)
		flag = true;
	if(board[0][0] == -1 && board[1][0] == -1 && board[2][0] == -1)
		flag = true;
	if(board[0][1] == -1 && board[1][1] == -1 && board[2][1] == -1)
		flag = true;
	if(board[0][2] == -1 && board[1][2] == -1 && board[2][2] == -1)
		flag = true;
	if(flag)
		cout <<"Yes";
	else 
		cout <<"No";
	return 0;
}


Measured memory_bytes: 256
use std::io::stdin;

fn main () {
    let mut tx = String::new();
    stdin().read_line(&mut tx).unwrap();
    let tx: Vec<isize> = tx.trim().split_whitespace().flat_map(str::parse).collect();
    let t = tx[0] * 10000;
    let x = tx[1];
    println!("{}.{:>04}", t / x / 10000, (t / x) % 10000);
}

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

using namespace std;

struct SuffixArray
{
  vector< int > SA;
  string s;

  void Build_SA(const string &str)
  {
    s = str;
    SA.resize(s.size());
    iota(begin(SA), end(SA), 0);
    sort(begin(SA), end(SA), [&](const int &a, const int &b)
    {
      if(s[a] == s[b]) return (a > b);
      return (s[a] < s[b]);
    });
    vector< int > classes(s.size()), c(s.size()), cnt(s.size());
    for(int i = 0; i < s.size(); i++) {
      c[i] = s[i];
    }
    for(int len = 1; len < s.size(); len <<= 1) {
      for(int i = 0; i < s.size(); i++) {
        if(i > 0 && c[SA[i - 1]] == c[SA[i]] && SA[i - 1] + len < s.size() && c[SA[i - 1] + len / 2] == c[SA[i] + len / 2]) {
          classes[SA[i]] = classes[SA[i - 1]];
        } else {
          classes[SA[i]] = i;
        }
      }
      iota(begin(cnt), end(cnt), 0);
      copy(begin(SA), end(SA), begin(c));
      for(int i = 0; i < s.size(); i++) {
        int s1 = c[i] - len;
        if(s1 >= 0) SA[cnt[classes[s1]]++] = s1;
      }
      classes.swap(c);
    }
  }

  int operator[](int k) const
  {
    return (SA[k]);
  }

  int size() const
  {
    return (s.size());
  }

  bool lt_substr(string &t, int si = 0, int ti = 0)
  {
    int sn = s.size(), tn = t.size();
    while(si < sn && ti < tn) {
      if(s[si] < t[ti]) return (true);
      if(s[si] > t[ti]) return (false);
      ++si, ++ti;
    }
    return (si >= sn && ti < tn);
  }

  int lower_bound(string &t)
  {
    int low = -1, high = SA.size();
    while(high - low > 1) {
      int mid = (low + high) >> 1;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    return (high);
  }

  pair< int, int > lower_upper_bound(string &t)
  {
    int idx = lower_bound(t);
    int low = idx - 1, high = SA.size();
    t.back()++;
    while(high - low > 1) {
      int mid = (low + high) >> 1;
      if(lt_substr(t, SA[mid])) low = mid;
      else high = mid;
    }
    t.back()--;
    return (make_pair(idx, high));
  }

  void output()
  {
    for(int i = 0; i < size(); i++) {
      cout << i << ": " << s.substr(SA[i]) << endl;
    }
  }
};

struct LongestCommonPrefixArray
{
  vector< int > LCP, rank;

  LongestCommonPrefixArray(SuffixArray &SA)
  {
    Build_LCP(SA);
  }

  void Build_LCP(SuffixArray &SA)
  {
    string &s = SA.s;
    rank.resize(s.size());
    for(int i = 0; i < s.size(); i++) {
      rank[SA[i]] = i;
    }
    LCP.resize(s.size());
    LCP[0] = 0;
    for(int i = 0, h = 0; i < s.size(); i++) {
      if(rank[i] + 1 < s.size()) {
        for(int j = SA[rank[i] + 1]; max(i, j) + h < s.length() && s[i + h] == s[j + h]; ++h);
        LCP[rank[i] + 1] = h;
        if(h > 0) --h;
      }
    }
  }

  int operator[](int k) const
  {
    return (LCP[k]);
  }

  int size() const
  {
    return (LCP.size());
  }
};

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

  SuffixArray sa;
  sa.Build_SA(T);
  LongestCommonPrefixArray lcp(sa);
  int ret = 0;
  for(int i = 0; i < lcp.size(); i++) ret = max(ret, lcp[i]);
  cout << T.size() - ret << endl;
}

Measured memory_bytes: 2048
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

//-------------------------------------------------------------------
#define P 998244353
#define N_MAX 2000000
typedef long long int ll;
ll fac[N_MAX+1];
ll inv[N_MAX+1];
ll finv[N_MAX+1];

ll comb(ll n, ll k){
    return (((fac[n]*finv[n-k])%P)*finv[k])%P;
}

void init(){
    fac[0] = finv[0] = fac[1] = finv[1] = inv[1] = 1;
    for(int i = 2; i <= N_MAX; i++){
        fac[i] = (fac[i-1]*i)%P;
        inv[i] = ((-(P/i)*inv[P%i])%P+P)%P;
        finv[i] = (finv[i-1]*inv[i])%P;
    }
}
ll pp(ll a, ll b){
  return (a * b)%P;
}
//-------------------------------------------------------------------
int main(int argc, char const *argv[]) {
  ll n, k;std::cin >> k >> n;
  init();
  std::vector<ll> rui(2001, 1);
  for(int i=1;i<2001;i++) rui[i] = (rui[i-1] * 2)%P;

  for(int i=2;i<=2*k;i++){
    ll s = 0;
    for(int j=1;j<=k;j++) if(i-j!=i&&i-j>0&&i-j<=k) s++;
    s/=2;
    ll ans = 0;
    if(i%2==1){
      for(int j=0;j<=min(n, s);j++){
        ll spi = k - 2*s + j;
        ans = (ans + pp(rui[j], pp(comb(s, j), comb(spi-1+n-j, n-j))))%P;
      }
    }else{
      for(int j=0;j<=min(n, s);j++){
        ll spi = k-2*s + j-1;
        ans = (ans + pp(rui[j], pp(comb(s, j), comb(spi-1+n-j, n-j))))%P;
      }
      for(int j=0;j<=min(n, s);j++){
        ll spi = k - 2*s + j - 1;
        ans = (ans + pp(rui[j], pp(comb(s, j), comb(spi-1+n-j-1, n-j-1))))%P;
      }
    }
    std::cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 47232
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll mod = 1000000007;

void solve()
{
	int n; cin >> n;
	vector<ll> a(n), s(n + 1, 0);
	rep(i, n) cin >> a[i];
	rep(i, n) s[i+1] = s[i] + a[i];
	ll ans = 2e16;
	rep(i, n+1)
	{
		ll x = s[i];
		ll y = s[n] - x;
		chmin(ans, abs(x - y));
	}
	cout << ans << endl;
	return;	
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 3456
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
struct scc{
    int N;
    vector<vector<int>> G, rG;
    vector<bool> used;
    vector<int> temp;
    vector<int> order;//分解後のトポロジカル順序
    vector<vector<int>> cnt;
    scc(int V){
        G.resize(V);
        rG.resize(V);
        N = V;
        order.resize(V);
    }
    void add(int s, int t){
        G[s].emplace_back(t);
        rG[t].emplace_back(s);
    }
    void dfs(int s){
        used[s] = true;
        for(int j: G[s]){
            if(!used[j]) dfs(j);
        }
        temp.emplace_back(s);
    }
    void rdfs(int s, int k){
        used[s] = true;
        order[s] = k;
        for(int j: rG[s]){
            if(!used[j]) rdfs(j, k);
        }
    }
    vector<vector<int>> solve(){//分解後の頂点数を返す
        used.resize(N, false);
        for(int i = 0; i < N; i++){
            if(!used[i]) dfs(i);
        }
        used.assign(N, false);  
        int k = 0;
        for(int i = (int)temp.size() - 1; i >= 0; i--){ //番号が大きい方から順にdfs
            if(!used[temp[i]]) {
                rdfs(temp[i], k);
                k++;
            }
        }
        cnt.resize(k);
        for(int i = 0; i < N; i++){
            cnt[order[i]].emplace_back(i);
        }
        return cnt;
    }
};
int main(){
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int N, M;
    cin >> N >> M;
    scc scc(N);
    for(int i = 0; i < M; i++){
        int a, b;
        cin >> a >> b;
        scc.add(a, b);
    }
    vector<vector<int>> k = scc.solve();
    cout << k.size() << endl;
    for(int i = 0; i < (int)k.size(); i++){
        int size = k[i].size();
        cout << size << ' ';
        for(int j = 0; j < size; j++){
            if(j != size - 1) cout << k[i][j] << ' ';
            else cout << k[i][j] << endl;
        }
    }
}

Measured memory_bytes: 106944
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    int ans=0,cnt=0;
    REP(i,s.size()){
        if(s[i]=='B') cnt++;
        else ans+=cnt;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
import java.util.Scanner;


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

			Scanner sc = new Scanner(System.in);
			
			long n = sc.nextLong();
			char[] s = sc.next().toCharArray();
			long[] alpha = new long[26];
			
			long ret = 1L;
			long x = 1000000007L;
			
			for(int i=0;i<n;i++) {
				alpha[s[i]-'a']++;
			}
			
			for(int i=0;i<26;i++) {
				if(alpha[i]==0) {
					continue;
				}else {
					ret *=alpha[i]+1;
					ret %= x;
				}
			}
			
			System.out.println(ret-1);
	    }
		
	}
	


Measured memory_bytes: 39812
#include<stdio.h>
#define N 100
int m[N+1][N+1],p[N+1],n;
void matrixChain(){
  int i,j,k,l;
  for(i=1; i<n+1; i++){
    m[i][i]=0;
  }
  for(l=2; l<=n; l++){
    for(i=1; i<=n-l+1; i++){
      j=i+l-1;
      m[i][j]=100000000;
      for(k=i; k<j; k++){
	if(m[i][j]>m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]){
	  m[i][j]=m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j];
	}
      }
    }
  }
}
  
int main(){
  int i;
  scanf("%d", &n);
  for(i=1; i<=n; i++){
    scanf("%d%d", &p[i-1], &p[i]);
  }
  matrixChain();
  printf("%d\n", m[1][n]);
    
  return 0;
}

Measured memory_bytes: 636
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

int main() 
{
	ll N;
	cin >> N;
	vector<ll> pos(5);

	ll i, min_ = INF;
	rep(i, 5) {
		cin >> pos[i];
		min_ = min(min_, pos[i]);
	}
	ll ans = ((N + (min_ - 1)) / min_) + 4;

	cout << ans << endl;
}


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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int k; cin >> k;
	string s; cin >> s;
	int l = int(s.size());
	if(l<=k){
		cout << s << endl;
		return 0;
	}else{
		for(int i=0;i<k;i++){
			cout << s[i];
		}
		cout << "..." << endl;
	}
	return 0;
}

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

int main(){
    double A, B, H, M;
    cin >> A >> B >> H >> M;
    cout << fixed << setprecision(20);
    double pi = 3.141592653589793238462643;
    double rad = -11*pi*(H/6.0 + M/360.0);
    double ans = sqrt(A*A + B*B - 2*A*B*cos(rad));
    cout << ans << endl;
}

Measured memory_bytes: 4292
#include<bits/stdc++.h>
#define ll  long long  
#define pb push_back
#define fi first
#define se second
using namespace std;
ll mo=1e9+7;
ll i,j;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
 while(tc--)
 {
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	for(i=1;i<=n;i++)
	cin>>a[i];
	ll vis[n+1]={0};
	vector<ll> path;
	ll x=1;
	vis[1]=1;
	while(vis[a[x]]==0)
	{
		vis[a[x]]=1;
		path.pb(a[x]);
		x=a[x];
	}
	ll lo=a[x];
	vector<ll> loop;
	ll z=lo;
	loop.pb(z);
	//cout<<a[z];
	while(a[z]!=lo)
	{
		loop.pb(a[z]);
		z=a[z];
	}
		/*for(auto x: path)
	cout<<x;*/
	if(k<=path.size())
	cout<<path[k-1];
	else
	{
		k-=(path.size());
		ll ss=loop.size();
		cout<<loop[(k%ss-1+ss)%ss];
	}
	cout<<"\n";
 } 
}


Measured memory_bytes: 10736
import java.util.*;
class Main /*atcoder beginner contest 42*/{
	public static void main(String[] args) {
			
			Scanner s = new Scanner(System.in);
			int[] arr = new int[19];
			int a  = s.nextInt() ; 
			arr[a]++;
			a = s.nextInt() ; 
			arr[a]++;
			a  = s.nextInt();
			arr[a]++;

			if(arr[5] == 2 && arr[7] == 1)
				System.out.println("YES");
			else
				System.out.println("NO");

	}
}

Measured memory_bytes: 21844
#include<algorithm>
#include<iostream>

using namespace std;

int main() {
  int i, j;

  int n;
  cin >> n;

  int a[3];
  for(i = 0; i < n; ++i)
    cin >> a[i];
  sort(a, a + n);

  for(i = 1; i <= a[n - 1]; ++i) {
    for(j = 0; j < n && !(a[j] % i); ++j) ;
    if(j >= n)
      cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 1176
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    for(int i=0; str[i]; i++)
    {
        if(str[i]=='B' && i==0)
        {
            str.erase(str.begin()+i);
            i=0;
        }
        else if(str[i]=='B')
        {
            str.erase(str.begin()+i);
            str.erase(str.begin()+i-1);
            i=i-2;
        }
    }
    cout<<str<<endl;
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [10**9]*N
dp[0] = 0

for i in range(1, N):
    for k in range(1, K+1):
        if i - k >= 0:
            dp[i] = min(dp[i], dp[i - k]+abs(H[i] - H[i - k]))
        else:
            break
print(dp[-1])

Measured memory_bytes: 52592
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s=1,f=0;
	cin>>n>>m;
	int a[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		f+=a[i];
		if(f<=m)
		   s++;
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 256
use proconio::input;

#[proconio::fastout]
fn main() {
    input! {
        n: u32,
    }

    let mut ans = "No";
    for i in 1..10 {
        for j in 1..10 {
            if i * j == n {
                ans = "Yes";
            }
        }
    }

    println!("{}", ans);
}

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

using namespace std;

#define eb emplace_back
#define ii pair<int, int>
#define OK (cerr << "OK" << endl)
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define all(x) x.begin(), x.end()
#define vvi vector<vector<int>>
#define vvii vector<vector<pair<int, int>>>
#define Mat(n, m, v) vector<vector<int>>(n, vector<int>(m, v))
#define endl '\n'

constexpr int INF = 2e18;
constexpr int MOD = 1e9 + 7;
constexpr int MAXN = 1e6 + 3;

/// smallest prime factor
int spf[MAXN + 5];

vector<int> primes;
bitset<MAXN + 5> isPrime;

void sieve(int n = 1e6 + 2) {
  for (int i = 0; i <= n; i++)
    spf[i] = i;

  isPrime.set();
  for (int i = 2; i <= n; i++) {
    if (!isPrime[i])
      continue;

    for (int j = i * i; j <= n; j += i) {
      isPrime[j] = false;
      spf[j] = min(i, spf[j]);
    }
    primes.emplace_back(i);
  }
}

bool pp = true;
set<int> s;
vector<int> getFactorization(int x) {
  vector<int> ret;
  int last = -1;
  while (x != 1) {
    ret.emplace_back(spf[x]);
    if (spf[x] != last) {
      pp &= !s.count(spf[x]);
      s.emplace(spf[x]);
    }
    last = spf[x];
    x = x / spf[x];
  }
  return ret;
}

// #define MULTIPLE_TEST_CASES
void solve() {
  sieve();
  int n;
  cin >> n;

  vector<int> arr(n);
  for (int &x : arr) {
    cin >> x;
    getFactorization(x);
  }

  int g = arr.front();
  for (int x : arr)
    g = gcd(g, x);

  if (pp) {
    cout << "pairwise coprime" << endl;
  } else if (g == 1) {
    cout << "setwise coprime" << endl;
  } else {
    cout << "not coprime" << endl;
  }
}

signed main() {
  // freopen(".in", "r", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);

  int t = 1;
#ifdef MULTIPLE_TEST_CASES
  cin >> t;
#endif
  while (t--)
    solve();
}

Measured memory_bytes: 23192
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < n; i++)
const int sz = 1e3 + 10, ma = 1e18;
;
int a[sz], b[sz], c[sz], dp[sz][sz][10];
void solve()
{
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        cin >> a[i] >> b[i] >> c[i];
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            for (int q = 0; q < 8; q++)
            {
                dp[i][j][q] = -ma;
            }
        }
    }
    for (int i = 0; i < 8; i++)
        dp[0][0][i] = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <= m; j++)
        {
            for (int q = 0; q < 8; q++)
            {
                dp[i + 1][j][q] = max(dp[i + 1][j][q], dp[i][j][q]);
                int here = dp[i][j][q];
                if (q & 1)
                    here += a[i + 1];
                else
                    here -= a[i + 1];
                if (q & 2)
                    here += b[i + 1];
                else
                    here -= b[i + 1];
                if (q & 4)
                    here += c[i + 1];
                else
                    here -= c[i + 1];
                dp[i + 1][j + 1][q] = max(dp[i + 1][j + 1][q], here);
            }
        }
    }
    int res = 0;
    for (int i = 0; i < 8; i++)
    {
        res = max(res, dp[n][m][i]);
    }
    cout << res << endl;
}
main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    solve();
    return 0;
}

Measured memory_bytes: 79232
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

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

struct UnionFind {
	std::vector<int> data;
	
	UnionFind(int n) {
		data.assign(n, -1);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if(x == y) return;
		if(data[x] > data[y]) std::swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}
	int find(int k) {
		if(data[k] < 0) return k;
		return data[k] = find(data[k]);
	}
	i64 size(int k) {
		return -data[find(k)];
	}
};

int main() {
	int n; scanf("%d", &n);
	std::vector<std::vector<int>> X(1e5), Y(1e5);
	std::vector<int> x(n), y(n);
	for(int i = 0; i < n; i++) {
		scanf("%d%d", &x[i], &y[i]); x[i]--; y[i]--;
		
		X[x[i]].push_back(i);
		Y[y[i]].push_back(i);
	}
	
	UnionFind A(1e5), B(1e5);
	for(int i = 0; i < X.size(); i++) {
		if(X[i].size() < 2) continue;
		
		bool f = false;
		for(auto p: X[i]) f |= (Y[y[p]].size() > 1);
		if(f) for(auto p: X[i]) B.unite(y[p], y[X[i].front()]);
	}
	for(int i = 0; i < Y.size(); i++) {
		if(Y[i].size() < 2) continue;
		
		bool f = false;
		for(auto p: Y[i]) f |= (X[x[p]].size() > 1);
		if(f) for(auto p: Y[i]) A.unite(x[p], x[Y[i].front()]);
	}
	
	i64 ans = 0;
	std::set<int> st;
	for(int i = 0; i < n; i++) {
		int latte = A.find(x[i]), malta = B.find(y[i]);
		if(st.count(latte)) ans--;
		if(A.size(latte) < 2 or B.size(malta) < 2 or st.count(latte)) continue;
		ans += A.size(latte) * B.size(malta) - 1;
		st.insert(latte);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 9600
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define USE_LLONG_AS_INT
#ifdef USE_LLONG_AS_INT
#define int long long
#define inf (1ll<<60)
#else
#define inf (1<<30)
#endif
#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 eb emplace_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 Yes(f) cout<<(f?"Yes":"No")<<endl
#define yes(f) cout<<(f?"yes":"no")<<endl
#define YES(f) cout<<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v), greater<int>())

using namespace std;

const int mod=1e9+7;
const string sp=" ";

void run();

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

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

void run(){
    string s;
    cin>>s;
    int q;
    cin>>q;
    bool r=false;
    string ss;
    while(q--){
        int t;
        cin>>t;
        if(t==1){
            r^=true;
            continue;
        }
        int f;
        string c;
        cin>>f>>c;
        if(f==1&&!r||f==2&&r)ss+=c;
        else s=s+c;
    }
    if(r){
        reverse(all(s));
        cout<<s<<ss<<endl;
    }
    else{
        reverse(all(ss));
        cout<<ss<<s<<endl;
    }
}

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

int main() {
	int n, a;
	cin >> n;
	a = n % 10;
	if (a == 3) {
		cout << "bon\n";
	}
	else if (a == 0 || a == 1 || a == 6 || a == 8) {
		cout << "pon\n";
	}
	else {
		cout << "hon\n";
	}
	return 0;
}


Measured memory_bytes: 3580
//
//  main.cpp
//  HelloWorld
//
//  Created by purple on 2020/04/13.
//  Copyright © 2020 Purple. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {


    string chk;
    
    cin >> chk;
    string chk2;

    for(int i=0; i<chk.size(); i++)
        chk2 += toupper(chk[i]);

    string s;
    
    
    int cnt=0;

    string tmp;
    while(s!="END_OF_TEXT"){
     
        cin >> s;

        for(int i=0; i<s.size();i++){
            tmp += toupper(s[i]);
        }
        
        if(tmp == chk2)
            cnt++;
        
        tmp = "";
    }
    
    cout << cnt << endl;

    return 0;
}



Measured memory_bytes: 3176
#include <stdio.h>
#include <string.h>
int main(void){
	char a[11],b[11],c[11];
	scanf("%s%s%s",a,b,c);
	if(a[strlen(a)-1]==b[0] && b[strlen(b)-1]==c[0])printf("YES");
	else printf("NO");
	return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long llint;

const int MAXN = 2e5+5;

int n, a[MAXN];
llint sum, val, sol = 1e18;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", a+i);
		sum += a[i];
	}

	for (int i = 0; i < n-1; ++i) {
		val += a[i];
		sol = min(sol, abs((sum-val)-val));
	}

	printf("%lld\n", sol);
	return 0;
}


Measured memory_bytes: 896
m = gets.chomp.to_s

i=0;
flag = 0;
if m.length < 2 then flag = 1; end
while i < m.length && flag == 0 do 
    if m[i..i+1] != "hi"  then
        flag = 1;
        break;
    end
    i += 2;
end
if flag == 0 then
    print("Yes\n")
else
    puts("No")
end


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

int main() {
  int N;
  int alice=0;
  int bob=0;
  
  cin >> N;
  vector<int> cards(N);
  for(int i=0; i<N; i++){
    cin >> cards.at(i);
  }
  
  sort(cards.begin(), cards.end(), greater<int>() );
  for(int i=0; i<N; i++){
    if(i%2 == 0){
      alice += cards.at(i);
    }else{
      bob += cards.at(i);
    }
  }
  
//  cout << "alice:" << alice << endl;
//  cout << "bob  :" << bob   << endl;
  cout << (alice - bob) << endl;
}


Measured memory_bytes: 256
// ＡＢＣのＡ過去問を解くだけだよ
// フォント    x:小文字(ｘ)    X:大文字(Ｘ)
//                  +:プラス(＋)   &:アンド(＆)

#include <bits/stdc++.h>

using namespace std;

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

    // ラーメンたべたい
    int ret = 700;
    for (int i = 0; i < 3; ++i)
    {
        if (s[i] == 'o')
            ret += 100;
    }

    cout << ret;

    return 0;
}


Measured memory_bytes: 256
// WeirdBugsButOkay

#include <bits/stdc++.h>
 
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
 
using namespace std;

ll pow3(ll a,ll b,ll m=1000000007)
{
    ll res=1;
    while(b>0)
    {
        if(b&1)
            res=(res*a)%m;
        a=(a*a)%m;
        b>>=1;
    }
    return res;
}

void solve()
{
    string s;
    cin>>s;
    if((s[2]==s[3]) && (s[4]==s[5]))
        cout<<"Yes";
    else cout<<"No";
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll q=1;
    //cin>>q;
    for(ll i=0;i<q;i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#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;

ll MOD = 1e9+7;

int main() {
    // ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N, K; cin >> N >> K;
	vll arr (N);
	F0R(i, N) cin >> arr[i];
	vll posa;
	vll nega;
	for (ll x : arr) {
		if (x > 0) posa.push_back(x);
		else       nega.push_back(x);
	}
	sort(posa.begin(), posa.end());
	sort(nega.begin(), nega.end());

	ll res = 1;
	if (((posa.size() == 0) && K % 2 == 0) || (posa.size() > 0 && (nega.size() / 2 * 2 + posa.size() >= K))) {
		// create pos
		int i = 0;
		int j = posa.size() - 1;
		while (K >= 2) {
			ll opneg = (i + 1 < nega.size()) ? nega[i] * nega[i+1] : -1;
			ll oppos = (j - 1 >= 0) ? posa[j] * posa[j-1] : -1;
			assert ((opneg != -1) || (oppos != -1));
			if (opneg >= oppos) {
				res *= nega[i] * nega[i+1] % MOD; res %= MOD;
				i += 2;
			} else {
				res *= posa[j] * posa[j-1] % MOD; res %= MOD;
				j -= 2;
			}
			K -= 2;
		}
		if (K == 1) {
			res *= posa[j]; res %= MOD;
		}
	} else {
		// make highest neg
		int i = nega.size() - 1;
		int j = 0;
		while (K) {
			ll opneg = (i >= 0) ? (-nega[i]) : INF;
			ll oppos = (j < posa.size()) ? posa[j] : INF;
			assert ((opneg != INF) || (oppos != INF));
			if (opneg < oppos) {
				res *= (MOD + nega[i]); res %= MOD;
				--i;
			} else {
				res *= posa[j]; res %= MOD;
				j++;
			}
			--K;
		}	
	}
	print((res + MOD) % MOD);
}

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

using namespace std;

int main(){
  int i, j, k;
  char Closs;
  string Red, Green, Under, Right;

  while(1){
    cin >> Red;
    if(Red == "-") break;

    cin >> Green;
    cin >> Under;

    i = -1;
    j = 0;
    k = 0;
    Closs = Green[j];

    while(i != Red.size()-1 || j != Green.size()-1){
      if(Closs == Under[k]){
        ++i;
        ++k;
        Closs = Red[i];
      }else{
        Right.push_back(Closs);
        ++j;
        Closs = Green[j];
      }
    }
    Right.push_back(Closs);

    cout << Right << endl;
    Right.clear();
  }

  return 0;
}

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

using namespace std;
typedef long long int lli;
typedef vector<int> iv;
typedef vector<bool> bv;
typedef vector<string> sv;
typedef vector<long long int> llv;
typedef vector<double> dv;
#define debug_ printf("OK\n")

#define sor_(vec) sort(vec.begin(),vec.end())
#define rev_(vec) reverse(vec.begin(),vec.end())
#define rep(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define reps(i,n,s) for(int i=static_cast<int>(s);i<static_cast<int>(n);i++)
#define isposi(num) if(num>0)
const long long mod = 1000000007;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    unsigned int n,m,buf;
    std::cin>>n>>m;
    std::cout<<((n*(n-1))/2)+((m*(m-1))/2);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define debug(x) cerr << "\n" \
                      << #x << ": " << x << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define INF 1e9
#define pii pair<int, int>
#define pt(xx) cout << "\n" \
                    << xx << "\n"
#define debugv(x)                         \
    cout << "\n"                          \
         << #x << ": ";                   \
    rep(i, x.size()) cout << x[i] << " "; \
    cout << endl
#define debug2d(x)                  \
    cout << "\n"                    \
         << #x << " is: \n";        \
    rep(i, x.size())                \
    {                               \
        rep(j, x[0].size())         \
        {                           \
            cout << x[i][j] << " "; \
        }                           \
        cout << endl;               \
    }
#define nl cout << endl

#define MOD 1000000007
using namespace std;

int N, M, K;
int Q;
int ans = 0;

int comb[2001][2001] = {};
signed main()
{
    /*
    CONB(N-K+1 , i) * CONB(K-1 , i-1)
     */
    cin >> N >> K;

    comb[0][0] = 1;

    for (int i = 1; i < 2001; ++i)
    {
        comb[i][0] = 1;
        for (int j = 1; j < 2001; ++j)
        {
            comb[i][j] = (comb[i - 1][j - 1] + comb[i - 1][j]) % MOD;
        }
    }

    for (int i = 1; i <= K; ++i)
    {
        ans = (comb[N - K + 1][i] * comb[K - 1][i - 1]) % MOD;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 31488
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c,d,i,j,k,l;
	while(~scanf("%d",&a)&&a>0)
	{
		k=0;
		if(a>81)
		{	
		printf("No\n");
		}
		else
		{
			for(i=1;i<10;i++)
			{
				d=a/i;
				if(a%i==0&&d<10&&d>=1)
				{
					k=1;
					printf("Yes\n");
					break;
				}
			}
			if(k==0)
			printf("No\n");
	}
}
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

typedef struct RMQandRAQ {
  i64 *add;
  i64 *max;
  i32 bit;
  i32 size;
} RMQandRAQ;

RMQandRAQ* new_RMQandRAQ (const i32 n) {
  i32 k = 0;
  while ((1 << k) < n) ++k;
  RMQandRAQ *s = (RMQandRAQ *) calloc (1, sizeof (RMQandRAQ));
  s->add = (i64 *) calloc (2 << k, sizeof (i64));
  s->max = (i64 *) calloc (2 << k, sizeof (i64));
  s->bit = k;
  s->size = 1 << k;
  return s;
}

static inline i64 max (i64 a, i64 b) {
  return a > b ? a : b;
}

static inline i64 eval (RMQandRAQ *s, i32 k) {
  return s->add[k] + s->max[k];
}

void propagate (RMQandRAQ *s, i32 x) {
  x += s->size;
  for (i32 bit = s->bit; bit > 0; bit--) {
    i32 k = x >> bit;
    s->add[2 * k] += s->add[k];
    s->add[2 * k + 1] += s->add[k];
    s->add[k] = 0;
    s->max[k] = max (eval (s, 2 * k), eval (s, 2 * k + 1));
  }
}

void save (RMQandRAQ *s, i32 x) {
  for (i32 k = (x + s->size) >> 1; k >= 1; k >>= 1) {
    s->max[k] = max (eval (s, 2 * k), eval (s, 2 * k + 1));
  }
}

void add (RMQandRAQ *s, i32 l, i32 r, i64 v) {
  for (i32 x = l + s->size, y = r + s->size; x < y; x >>= 1, y >>= 1) {
    if (x & 1) s->add[x++] += v;
    if (y & 1) s->add[--y] += v;
  }
  save (s, l);
  save (s, r - 1);
}

i64 find (RMQandRAQ *s, i32 l, i32 r) {
  //propagate (s, l);
  //propagate (s, r - 1);
  i64 ans = 0;
  for (l += s->size, r += s->size; l < r; l >>= 1, r >>= 1) {
    if (l & 1) ans = max (ans, eval (s, l++));
    if (r & 1) ans = max (ans, eval (s, --r));
  }
  return ans;
}

typedef struct range {
  i32 l, r, v;
} range;

int cmp (const void *a, const void *b) {
  i32 d = ((range *)a)->r - ((range *)b)->r;
  return d == 0 ? 0 : d < 0 ? -1 : 1;
}

void run (void) {
  i32 n, m;
  scanf ("%" SCNi32 "%" SCNi32, &n, &m);
  range *p = (range *) calloc (m, sizeof (range));
  for (i32 i = 0; i < m; ++i) {
    i32 l, r, v;
    scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &l, &r, &v);
    p[i] = (range) {l, r, v};
  }
  qsort (p, m, sizeof (range), cmp);
  RMQandRAQ *s = new_RMQandRAQ (n + 1);
  for (i32 i = 1, j = 0; i <= n; ++i) {
    i64 v = find (s, 0, i);
    add (s, i, i + 1, v);
    for (; j < m && p[j].r <= i; ++j) {
      add (s, p[j].l, p[j].r + 1, p[j].v);
    }
  }
  printf ("%" PRIi64 "\n", find (s, 0, n + 1));
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 9172
var input = ""
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
 
process.stdin.on('end', function() {
  input = input.split("\n");

  var n = input[0];
  var x = input[1].split(" ");
  var y = input[2].split(" ");

  for (i = 1; i <= 3; i++) {
    var sum = 0;
    for (j = 0; j < n; j++) {
      sum += Math.pow(Math.abs(x[j] - y[j]), i);
    }
    console.log(Math.pow(sum, (1/i)));
  }

  var max = 0;
  for (j = 0; j < n; j++) {
    if (Math.abs(x[j] - y[j]) > max) {
      max = Math.abs(x[j] - y[j]);
    }
  }
  console.log(max);
});

Measured memory_bytes: 16432