akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

inline int read(){
	char ch=getchar();int x=0,op=0;
	while(!isdigit(ch))op|=(ch=='-'),ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return op?-x:x;
}

const int N=100005,M=N*15;
const ll inf=1e18;
namespace G{
	struct edge{
		int u,v,f,c;ll w;int id;
	}e[M];
	ll f[N],d[N];
	int n,m,s,t,flag;
	vi g[N];
	inline void init(int _n,int _s,int _t,int _flag=1){
		n=_n,m=0,s=_s,t=_t,flag=_flag;
		rep(i,1,n)f[i]=0;
	}
	inline void add(int u,int v,int c,ll w){
		g[u].pb(m),w*=flag;
		e[m++]=(edge){u,v,0,c,w,(int)g[v].size()};
		g[v].pb(m);
		e[m++]=(edge){v,u,0,0,-w,(int)g[u].size()-1};
	}
	struct node{
		int u;ll d;
		inline friend bool operator < (node a,node b){
			return a.d>b.d;
		}
	};
	priority_queue<node> Q;
	int dij(){
		rep(i,1,n)d[i]=inf;
		d[s]=0,Q.push((node){s,0});
		while(!Q.empty()){
			node t=Q.top();Q.pop();
			if(d[t.u]<t.d)continue;
			int u=t.u;
			for(auto k:g[u]){
				int v=e[k].v;
				if(e[k].f<e[k].c&&d[u]+e[k].w+f[u]-f[v]<d[v]){
					d[v]=d[u]+e[k].w+f[u]-f[v];
					Q.push((node){v,d[v]});
				}
			}
		}
		return d[t]<inf;
	}
	int in[N],r[N];
	int dfs(int u,int a){
		if(u==t)return a;
		ll res=0;in[u]=1;
		for(int &p=r[u];p<g[u].size();p++){
			int k=g[u][p],v=e[k].v;
			if(e[k].f<e[k].c&&d[u]+e[k].w+f[u]-f[v]==d[v]&&!in[v]){
				int tmp=dfs(v,min(a,e[k].c-e[k].f));
				res+=tmp,a-=tmp;
				e[k].f+=tmp,
				e[g[e[k].v][e[k].id]].f-=tmp;
			}
			if(!a)break;
		}
		return in[u]=0,res;
	}
	void mcmf(ll &flow,ll &cost){
		while(dij()){
			rep(i,1,n)r[i]=0;
			ll owo=dfs(s,2e9);
			flow+=owo,cost+=owo*(d[t]+f[t]);
			rep(i,1,n)f[i]=min(f[i]+d[i],inf);
		}
	}
}

int n,x,y,c,p0,p1,p2,p3,s,t,bas;

int main(){
	scanf("%d",&n);
	G::init(n*2+6,s=1,t=2,-1);
	p0=3,p1=4,p2=5,p3=6,bas=6;
	rep(i,1,n){
		scanf("%d%d%d",&x,&y,&c);
		G::add(s,bas+i,c,0);
		G::add(bas+i,p0,c,+x+y);
		G::add(bas+i,p1,c,+x-y);
		G::add(bas+i,p2,c,-x+y);
		G::add(bas+i,p3,c,-x-y);
	}
	bas+=n;
	rep(i,1,n){
		scanf("%d%d%d",&x,&y,&c);
		G::add(bas+i,t,c,0);
		G::add(p3,bas+i,c,+x+y);
		G::add(p2,bas+i,c,+x-y);
		G::add(p1,bas+i,c,-x+y);
		G::add(p0,bas+i,c,-x-y);
	}
	ll flow=0,cost=0;
	G::mcmf(flow,cost);
	cout<<-cost<<endl;

	return 0;
}


Measured memory_bytes: 6144
#include"bits/stdc++.h"


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(int x = (l);x<=(u);x++)
#define RREP(x,l,u) for(int x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 200010;
const int mod = 1e9+7;
const int MAX = 1000000010;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n;

int A[maxn];

int main(){
	read(n);
	REP(i,1,n)read(A[i]);
	if(A[1]){
		puts("-1");
		return 0;
	}
	REP(i,2,n)if(A[i]>A[i-1]+1){
		puts("-1");
		return 0;
	}
	ll ans=0;
	RREP(i,n,1)if(A[i]){
		ans++;
		if(A[i]!=A[i-1]+1)ans+=A[i]-1;
	}
	cout<<ans<<endl;
	return 0;
}


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

namespace ConsoleApp7 {
    class Program {
        static void Main(string[] args) {
            int N = int.Parse(Console.ReadLine());
            string S = Console.ReadLine();

            string ans = "Yes";
            if (N % 2 == 0) {
                for (int i = 0; i < N / 2; i++) {
                    if (S[i] != S[i + (N / 2)]) {
                        ans = "No";
                        break;
                    }
                }
            } else {
                ans = "No";
            }
            

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forn(i,n) for(ll i=0;i<n;i++)
#define nforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define all(v) v.begin(),v.end()
#define MOD 1000000007
#define d1(x) cerr <<"> "<<#x<<" = "<<x<<'\n'
#define d2(x, y) cerr <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<'\n'
#define d3(x, y, z) cerr <<"> "<<#x<<" = "<<x<<' '<<#y<<" = "<<y<<' '<<#z<<" = "<<z<<'\n'
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t = 1;
	// cin>>t;
	while(t--){
		ll h,n;
		cin>>h>>n;
		ll sum = 0;
		forn(i,n){
			ll x;cin>>x;
			sum += x;
		}
		if(sum>=h)cout<<"Yes\n";
		else cout<<"No\n";
	}
}

Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    private static int n, m;
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);
        while ((n = scanner.nextInt()) != 0) {
            m = scanner.nextInt();
            Map<Integer, Integer> map = new HashMap<>();
            IntStream.range(0, n)
                .map(d -> scanner.nextInt())
                .forEach(d -> map.put(d, Math.max(map.getOrDefault(d, 0), scanner.nextInt())));
            System.out.println(map.values().stream().mapToInt(i -> i).sum());
        }
    }
}



Measured memory_bytes: 37644
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
   ll x,k,d; cin >>x >>k >>d;
   if(x<0) x*=-1;
   ll m=min(x/d,k);
   k-=m; x-=m*d;
   k%=2;
   if(k) x=d-x;
   cout <<x;
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   solve();
return 0;}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, M;
int dp[1000010];
string S;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> M >> S;
    vector<int> vs;
    for(int i = 0; i < S.length(); ++i){
        if(S[i] == '0') vs.emplace_back(i);
    }
    vector<int> ans;
    int last = N;
    bool flag = true;
    while(flag){
        auto it = lower_bound(vs.begin(), vs.end(), last - M);
        if(last == *it){
            flag = false;
        }else{
            ans.push_back(last - *it);
            last = *it;
            if(*it == 0) break;
        }
    }
    if(!flag){
        cout << -1 << endl;
    }else{
        for(int i = ans.size() - 1; i >= 0; --i){
            cout << ans[i] << " ";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1480
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


map<int,int> m;
int maxsum;

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

  for (int i = 0; i <= 100000-2; ++i){
    int sum = m[i]+m[i+1]+m[i+2];
    chmax(maxsum,sum);
  }

  cout << maxsum << endl;

  

}



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

adj_mat = [[0] * (n + 1) for j in range(n)]

for i in range(n):
    adj_list_i = list(map(int, input().split()[2:]))
    for j in adj_list_i:
        adj_mat[i][j] = 1

for r in adj_mat:
    print(*r[1:])

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll n;cin>>n;
    ll sum = 0;
    vector<vector<int>> data(10, vector<int>(10));
    for(ll i = 0;i<=n;i++){
        string s =to_string(i);
        int len = s.size();
        int math =(i/pow(10,len-1));
        int head =math%10;
        int tail = i%10;
        data[head][tail]++;


    }
    for(int i=1;i<=9;++i){
        for(int j=1;j<=9;++j){
           sum+=data[i][j]*data[j][i];

        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 4168
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>	
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>
	
signed main(){
	int n; cin>>n;
	double t,a; cin>>t>>a;
	pair<double,int> ans; ans.first=2000000000.0;
	for(int i=0; i<n; i++){
		double h; cin>>h;
		if(ans.first>abs(a-(t-0.006*h))){
			ans.first=abs(a-(t-0.006*h));
			ans.second=i+1;
		}
	}
	cout<<ans.second<<en;
}
	
	

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

void solve(int n, string s, char mx, vector<string>& result) {
  if(n == 1) {
    result.push_back(s);
    return;
  }
  for(int i = 0; i <= mx - 'a' + 1; ++i) {
    char add = 'a' + i;
    string next = s + add;
    solve(n - 1, next, max(mx, add), result);
  }
}

int main() {
  int n;
  cin >> n;
  vector<string> result;
  solve(n, "a", 'a', result);
  for(auto r : result) {
    cout << r << endl;
  }

  return 0;
}

Measured memory_bytes: 7796
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <iomanip>
#include <climits>
#include <string>
#include <sstream>
#include <numeric>
#include <stack>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
#define EPS 1e-9
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1LL << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
signed main() {
	int ans[] = {1,
				 1,
				 1,
				 2,
				 1,
				 2,
				 1,
				 5,
				 2,
				 2,
				 1,
				 5,
				 1,
				 2,
				 1,
				 14,
				 1,
				 5,
				 1,
				 5,
				 2,
				 2,
				 1,
				 15,
				 2,
				 2,
				 5,
				 4,
				 1,
				 4,
				 1,
				 51};
	cin >> K;
	cout << ans[K - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

void FindPQ(set<int> &st, int x, int &p, int &q) {
  auto it = st.find(x);
  if (it == st.begin()) return;
  --it;
  q = *it;
  if (it == st.begin()) return;
  --it;
  p = *it;
}

void FindRS(set<int> &st, int x, int &r, int &s) {
  auto it = st.find(x);
  ++it;
  if (it == st.end()) return;
  r = *it;
  ++it;
  if (it == st.end()) return;
  s = *it;
}

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

  vector<pair<int, int> > vp;
  for (int i = 0; i < N; ++i) {
    vp.push_back(make_pair(P[i], i));
  }
  sort(vp.begin(), vp.end());
  reverse(vp.begin(), vp.end());

  ll ans = 0;
  set<int> st;
  for (int i = 0; i < N; ++i) {
    int x = vp[i].second;
    st.insert(x);
    
    int p = -1;
    int q = -1;
    int r = N;
    int s = N;
    FindPQ(st, x, p, q);
    FindRS(st, x, r, s);
    
    if (q != -1) {
      ans += (ll)(q - p) * (r - x) * P[x];
    }
    if (r != N) {
      ans += (ll)(x - q) * (s - r) * P[x];
    }
  }

  cout << ans << endl;
  
  return 0;
}


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

int main() {
	int a, b;
	cin >> a >> b;
	int d = b - a;
	int ans = 0;

	for (int i = 1; i < d; i++) {
		ans += i;
	}
	ans -= a;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <float.h>

#define N 8
#define M 3
#define DBL(X) \
  ( *( (const double *)(X) ) )

static
int comparatorLF (
  const void  * a,
  const void  * b
  )
{
  const double D = DBL( a ) - DBL( b );
  if ( D < 0 ) return ( -1 );
  if ( D > 0 ) return ( 1 );
  return ( 0 );
}

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  struct tagD
  {
    double time;
    int    no;
  } d[ N * M ];
  int i, j;

  for ( j = 0; j < M; ++j )
  {
    for ( i = 0; i < N; ++i )
    {
      scanf ( "%d%lf"
            , &( d[ j * N + i ].no )
            , &( d[ j * N + i ].time ) );
    }

    qsort ( d + N * j, N, sizeof ( struct tagD ), comparatorLF );
    printf ( "%d %.2f\n", d[ j * N ].no
                        , d[ j * N ].time );
    printf ( "%d %.2f\n", d[ j * N + 1 ].no
                        , d[ j * N + 1 ].time );
    d[ j * N ].time = d[ j * N + 1 ].time
                    = DBL_MAX;
  }

  qsort ( d, M * N, sizeof ( struct tagD ), comparatorLF );
  printf ( "%d %.2f\n", d[ 0 ].no
                      , d[ 0 ].time );
  printf ( "%d %.2f\n", d[ 1 ].no
                      , d[ 1 ].time );

  return ( 0 );
}

Measured memory_bytes: 0
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int mod = (int) 1e9 + 7;

void add(int &x, int y) {
  if ((x += y) >= mod) {
    x -= mod;
  }
}

int mult(int x, int y) {
  return (long long) x * y % mod;
}

int power(int x, long long pw) {
  int res = 1;
  for (; pw; pw >>= 1) {
    if (pw & 1) {
      res = mult(res, x);
    }
    x = mult(x, x);
  }
  return res;
}

void precalc() {
}


const int maxn = (int) 1e3 + 10;
char q[maxn][maxn];

int n, m;
long long k;

int read() {
  if (scanf("%d%d%lld", &n, &m, &k) < 3) {
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    scanf("%s", q[i]);
  }
  return 1;
}

void myrot() {
  int k = max(n, m);
  for (int i = 0; i <= k; ++i) {
    for (int j = 0; j < i; ++j) {
      swap(q[i][j], q[j][i]);
    }
  }
  swap(n, m);
}

void solve() {
  int h = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      h += (q[i][j] == '#');
    }
  }
  int ss[2];
  for (int it = 0; it < 2; ++it) {
    int &s = ss[it];
    s = 0;
    for (int i = 0; i < n; ++i) {
      if (q[i][0] == '#' && q[i][m - 1] == '#') {
        ++s;
      }
    }
    myrot();
  }

  if (k <= 1) {
    printf("1\n");
    return;
  }
  --k;

  if (!ss[0] && !ss[1]) {
    printf("%d\n", power(h, k));
    return;
  }
  if (ss[0] && ss[1]) {
    printf("1\n");
    return;
  }
  int s = ss[0];
  if (ss[1]) {
    myrot();
    s = ss[1];
  }

  int b = -s;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (q[i][j] == '#') {
        while (q[i][j] == '#') {
          ++j;
        }
        ++b;
      }
    }
  }
  int c = mult(b, power(s - h + mod, mod - 2));
  if (c < 0) {
    c += mod;
  }
  //eprintf("h = %d, s = %d, b = %d, c = %d\n", h, s, b, c);

  int val = mult(c + 1, power(s, k));
  add(val, mod - mult(c, power(h, k)));
  printf("%d\n", val);
}

int main() {
  precalc();
#ifdef LOCAL
  freopen(TASK ".out", "w", stdout);
  assert(freopen(TASK ".in", "r", stdin));
#endif

  while (1) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 1280
#include <iostream>

typedef long long ll;

const int MAX_N = 2e5;
const ll MOD = 1e9 + 7;

ll S(ll n, ll a, ll l){
   return n * (a + l) / 2;
}

int main(){
   int N, K;
   std::cin >> N >> K;

   ll ans = 0;
   for(int k=K; k<=N+1; ++k){
      ans +=  S(k, N-k, N+1) - S(k, 0, k-1) + 1;
      ans %= MOD;
   }
   std::cout << ans << std::endl;

   return 0;
}


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

const int N = 100005;

using ll = long long;
int n;
ll a[N], s, e;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n;
	for(int i = 0; i < n; i++) cin >> a[i];
	reverse(a, a + n);
	s = e = 2;
	for(int i = 0; i < n; i++){
		ll ts = (s + a[i] - 1) / a[i] * a[i];
		ll te = e / a[i] * a[i];
		if(ts > te){ cout << "-1\n"; return 0; }
		s = ts;
		e = te + a[i] - 1;
	}
	cout << s << ' ' << e << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>

#define EPS	1.0e-10
#define MAX_CRYSTAL	32
#define rep(idx, max)	for(int idx = 0, idx##Max = max; idx < idx##Max; idx ++)

typedef std::vector<int>	VEC;

void	GetPrime(VEC &bIsPrime, int n)
{
	bIsPrime.resize(n);
	
	for(int i = 0; i < n; i ++)	{	bIsPrime[i]	= (i & 0x01);	}
	bIsPrime[1]	= false;
	bIsPrime[2]	= true;
	for(int i = 2; i * i < n; i ++)
	{
		if(!bIsPrime[i])	{	continue;	}
		for(int j = i * i; j < n; j += i)	{	bIsPrime[j] = false;	}
	}

//	dst.clear();
//	dst.reserve(n >> 1);
//	for(int i = 0; i < n; i ++)
//	{	if(bIsPrime[i])	{	dst.push_back(i);	}	}
}

int main(int nArgs, char **lplpszArgs)
{
	int a, d;
	int n;
	VEC	bIsPrime;
	VEC	seq;
	
	::GetPrime(bIsPrime, 1e+6);
	
	while (std::cin >>a >> d >> n, n)
	{
		int prime, count = 0;
		for(int i = 0; ; i ++)
		{
			if(bIsPrime[a + d * i])
			{
				prime = a + d * i;
				if(++ count == n)	{	break;	}
			}
		}
		
		std::cout << prime << std::endl;
	}
}

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

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

int n;
int a[50];

int main(){
    cin >> n;
    rep(i,n) cin >> a[i];
    int ma = -INF, mi = INF;
    int mai, mii;
    rep(i,n) {
        if (ma < a[i]) {
            ma = a[i];
            mai = i;
        }
        if (mi > a[i]) {
            mi = a[i];
            mii = i;
        }
    }
    cout << 2*n-1 << endl;
    if (abs(ma) < abs(mi)) {
        rep(i,n) {
            cout << mii+1 << " " << i+1 << endl;
        }
        for (int i = n-1; i > 0; i--) {
            cout << i+1 << " " << i << endl;
        }
    } else {
        rep(i,n) {
            cout << mai+1 << " " << i+1 << endl;
        }
        for (int i = 1; i < n; i++) {
            cout << i << " " << i+1 << endl;
        }
    }
}
































Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#define repu(i,x,y) for (int i=x; i<=y; ++i)
#define repe(i,x) for (edge *i=fst[x]; i; i=i->nxt)
using namespace std;

typedef long long LL;
const int p=1000000007;
int n,m,k,c[210][210],ans,dfn[110],low[110],clk,stk[110],top;
bool flag[110];
struct edge
{
    int v;
    edge *nxt;
} pool[210],*tp=pool,*fst[110];

int power(int x,int k)
{
    int ret=1;
    for (; k; k>>=1,x=LL(x)*x%p)
        if (k&1)
            ret=LL(ret)*x%p;
    return ret;
}

int gcd(int x,int y)
{
    for (int t; t=x%y; x=y,y=t);
    return y;
}

void calc(int x,int y)
{
    int cntv=0,cnte=0;
    memset(flag,0,sizeof(flag)),cntv=flag[y]=1;
    for (; stk[top+1]!=x; flag[stk[top--]]=1,++cntv);
    repu(i,1,n)
        if (flag[i])
            repe(j,i)
                cnte+=flag[j->v] && i<j->v;
    if (cnte<cntv)
    {
        ans=LL(ans)*k%p;
        return;
    }
    if (cnte>cntv)
        ans=LL(ans)*c[cnte+k-1][k-1]%p;
    else
    {
        int sum=0;
        repu(i,1,cntv)
            sum=(sum+power(k,gcd(i,cntv)))%p;
        ans=LL(ans)*sum%p*power(cntv,p-2)%p;
    }
}

void dfs(int x)
{
    stk[++top]=x,dfn[x]=low[x]=++clk;
    repe(i,x)
        if (dfn[i->v])
            low[x]=min(low[x],dfn[i->v]);
        else
        {
            dfs(i->v),low[x]=min(low[x],low[i->v]);
            if (low[i->v]>=dfn[x])
                calc(i->v,x);
        }
}

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    repu(i,1,m)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        *tp=(edge){v,fst[u]},fst[u]=tp++;
        *tp=(edge){u,fst[v]},fst[v]=tp++;
    }
    repu(i,0,m+k)
    {
        c[i][0]=1;
        repu(j,1,i)
            c[i][j]=(c[i-1][j]+c[i-1][j-1])%p;
    }
    ans=1;
    repu(i,1,n)
        if (!dfn[i])
            dfs(i);
    printf("%d\n",ans);
    return 0;
}

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

int main(){
    int n;
    cin>>n;
    vector<int>a(n);
    rep(i,n)cin>>a[i];
    ll ans=0;
    rep(i,n-1){
        ans+=a[i]/2;
        if(a[i]%2==1&&a[i+1]!=0){
            ans++;
            a[i]--;
            a[i+1]--;
        }
    }
    ans+=a[n-1]/2;
    cout<<ans<<endl;
    return 0;
}

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

int* mallocint(int si)
{
    return (int*) malloc(si * sizeof(int));
}

int* inputint(int n)
{
    int *ans = mallocint(n);
    for( int i = 0; i < n; i++ ) cin >> ans[i];
    return ans;
}

int main()
{
//    int ti = clock();
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while( a > 0 && c > 0 )
    {
        c -= b;
        if( c <= 0 ) break;
        a -= d;
    }
    
    if( a <= 0 )
    {
        cout << "No";
    }
    else
    {
        cout << "Yes";
    }
    

    //printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
    return 0;    
}

Measured memory_bytes: 3564
package main

import "fmt"

func main() {
        var n int
        fmt.Scan(&n)
        nums := make(map[int]int)
        var num int
        for i := 0; i < n; i++ {
                fmt.Scan(&num)
                nums[num] += 1
        }
        var shoudBeRemoved int
        for num, count := range nums {
                if count < num {
                        shoudBeRemoved += count
                } else if count > num {
                        shoudBeRemoved += count - num
                }
        }
        fmt.Printf("%d\n", shoudBeRemoved)
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define repc(i, s, t) for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

int dn[int(1e7) + 5];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.setf(ios_base::fixed);
    cout.precision(12);

    var(int, N);

    i64 ans = 0;
    repc(i, 1, N) {
        for (int k = i; k <= N; k += i) ++dn[k];
        ans += i * dn[i];
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 42700
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
#include <climits>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

string s;
ll k;

int main() {
    cin >> s >> k;
    int res=0;
    int cnt=0;
    REP(i,s.size()){
        if(s[i]=='1'){
            cnt++;
        }else{
            break;
        }
    }
    if(k<=cnt){
        put('1');
    }else{
        put(s[cnt]);
    }
    return 0;
}


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

int main() {
    int n, a, k=1;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a;
        if(a==k){
            k++;
        }
    }
    if(k==1){
        cout << -1 << endl;
    }
    else{
        cout << n-k+1 << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;

struct edge
{
    int to;
    ll cost;
};

vector<edge> G[MAX_N];

ll dfs(int u, int p, const ll w, vector<ll>& path)
{
    vector<ll> kp;
    each(e, G[u]){
        if(e.to != p){
            kp.pb(e.cost + dfs(e.to, u, w, path));
        }
    }
    if(len(kp) == 0) return 0;
    sort(all(kp),greater<ll>());
    srep(i,1,len(kp)){
        path.pb(w*kp[i]);
    }
    return kp[0];
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    rep(i,n-1){
        int a,b,c;
        cin >> a >> b >> c;
        --a, --b;
        G[a].pb((edge){b,c}), G[b].pb((edge){a,c});
    }
    vl s(n);
    rep(i,n){
        cin >> s[i];
    }
    vector<ll> path;
    rep(i,n){
        path.pb(s[i] * dfs(i, -1, s[i], path));
    }
    sort(all(path),greater<ll>());
    cout << accumulate(path.begin(),path.begin()+min(m,len(path)),0LL) << "\n";
    return 0;
}


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

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

  int cnt=0;
  if(A==B) cnt++;
  if(A==C) cnt++;
  if(B==C) cnt++;

  if(cnt==1){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#pragma region head
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
#define double long double
typedef double ld;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;
const double PI = acos(-1.0);

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}
#pragma endregion

signed main() {
  int N, X;
  cin >> N >> X;
  int ans = N;

  int num = N - X, den = X;
  while (true) {
    if (num % den == 0) {
      ans += (2 * (num / den) - 1) * den;
      break;
    } else {
      ans += 2 * (num / den) * den;
      int nnum = den, nden = num % den;
      num = nnum, den = nden;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
#include <stdlib.h>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
#include <math.h>
#include <bits/stdc++.h>
using namespace std;
int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}

using namespace std;
int main(){
    std::vector<int> a(3);
    std::cin >> a[0]>>a[1]>>a[2];
    sort(a.begin(),a.end());
    std::cout << a[0]+a[1]+a[2]*10 << std::endl;
    
    
}



Measured memory_bytes: 256
from collections import defaultdict as dd
d = dd(list)

n, m = map(int, input().split())
h = list(map(int, input().split()))
for i in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)

ans = []
for i in range(n):
    flg = True
    for nb in d[i+1]:
        if h[i] <= h[nb-1]:
            flg = False
    if flg or len(d[i+1]) == 0:
        ans.append(i+1)

print(len(ans))


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

/**
|||||||||||||       |||||     |||||    ||||||||||
||||||||||||||      |||||     |||||  |||||
|||||     |||||     |||||     |||||  |||||
||||||||||||||||    |||||||||||||||    ||||||||||
|||||||||||||||||   |||||||||||||||           |||||
|||||        |||||  |||||     |||||           |||||
|||||         ||||| |||||     |||||    ||||||||||
AHMED;HASSAN;SAEED;
*/

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    long long n;
    long long xi,xj;
    cin>>n;
    for(long long i=sqrt(n);i>=1;i--){
        if(n%i==0){
            xi=i;
            xj=n/i;
            break;
        }
    }
    cout << xi+xj-2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)

using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

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

    int i,j,h;
    int Q,K,P,C,N,X;

    long double kh,km,A,B;

    string S;
    map<long double, ll> m;

    cin >> A>>B;
    

    cout<<setprecision(17)<< floor(A*B)<<endl;
    
    return 0;
}

Measured memory_bytes: 3848
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>

#define PB push_back
#define ALL(a)  (a).begin(),(a).end()
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)

#define mod 1000000007

using namespace std;

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

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int INF = (int)1e9;

int main() { 
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<ll> x(n), a(n);
	rep(i, n) {
		cin >> x[i];
		a[i] = x[i];
	}
	sort(a.begin(), a.end(), greater<ll>());
	rep(i, n) {
		if (a[n / 2 - 1] <= x[i]) {
			cout << a[n / 2] << "\n";
		}
		else {
			cout << a[n / 2 - 1] << "\n";
		}
	}
	return 0;
}

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

class Program
{
    static void Main()
    {
        var N = Console.ReadLine();
        var A = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var AA = A.Select(x => Math.Abs(x));

        Console.WriteLine(A.Any(x => x == 0) || A.Count(x => x < 0) % 2 == 0 ? AA.Sum() : AA.Sum() - 2 * AA.Min());
    }
}


Measured memory_bytes: 39504
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long a = in.nextLong();
        long b = in.nextLong();
        long c = in.nextLong();
        long k = in.nextLong();

        if (k <= a + b) {
            System.out.println(Math.min(k, a));
        } else {
            System.out.println(a - Math.min(k - (a + b), c));
        }
    }
}

Measured memory_bytes: 27092
n = int(input())
l = []
for i in range(n):
  l.append(list(map(int, input().split())))

s = 0
t = 0
d = 0
p = [0, 0]
ans = ''
for e in l:
  if ans == '':
    s = e[0] - t
    t = e[0]
    d = abs(p[0] - e[1]) + abs(p[1] - e[2])
    p = [e[1], e[2]]
    if s < d:
      ans = 'No'
    else:
      if (s - d) % 2 == 1:
        ans = 'No'
      else:
        next
if ans == '':
  ans = 'Yes'
print(ans)

Measured memory_bytes: 27300
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long double lb;

const int INF=1<<27;
const int MOD=(int)1e9+7;

int n, h;
pi katana[100010];

void read()
{
    cin >> n >> h;
    // set a as second so i can sort by b
    rep(i,n) cin >> katana[i].second >> katana[i].first;
    return;
}

int main(void)
{
    read();
    int H = h;

    int maxa = -1, maxi, zako;

    // sort by b
    sort(katana, katana+n, greater<pi >());

    // set max
    rep(i,n) {
        if(maxa < katana[i].second){
            maxi = i;
            maxa = katana[i].second;
        }
    }

    // detect zako katana
    zako = n;
    rep(i,n) {
        if(katana[i].first <= maxa){
            zako = i;
            break;
        }
    }

    int cnt = 0;
    int cnt1 = INT_MAX;
    // throw katana until zako katana
    rep(i,zako){
        if(i == maxi) continue;
        h -= katana[i].first;
        cnt++;
        if(h <= 0){
            cnt1 = cnt;
            break;
        }
    }

    h -= katana[maxi].first;
    cnt++;

    if(h > 0){
        if(h % katana[maxi].second == 0)
            cnt += (h / katana[maxi].second);
        else
            cnt += (h / katana[maxi].second + 1);
    }
    
    int cnt2 = INT_MAX;
    // throw katana until zako katana
    int po = 0;
    rep(i,zako){
        H -= katana[i].first;
        po++;
        if(H <= 0){cnt2 = po; break; }
    }

    int mincnt = INT_MAX;
    mincnt = min(cnt1, cnt2);
    mincnt = min(cnt, mincnt);

    cout << mincnt << endl;

    return 0;
}



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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    ll n; cin >> n;
    V<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];

    // O(MlogN)
    V<ll> memo(1000005, 0);
    for(int i = 0; i < n; i++){
        if(memo[a[i]] != 0){
            memo[a[i]] = 2;
            continue;
        }
        for(int j = a[i]; j < 1000001; j+=a[i]){
            memo[j]++;
        }
    }
    ll ans = 0;
    for(int i = 0; i < n; i++){
        if(memo[a[i]] == 1) ans++;
    }
    cout << ans << endl;

    return 0;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using namespace std;

int main()
{
    string s;
    cin >> s;
    ll ans = 0;

    rep(i, 1<<(s.size()-1)) {
        vector<int> d(s.size());
        rep(j, s.size()) {
            if (i>>j&1) {
                d[j] = 1;
            }
        }
        vector<string> st;
        int count = 0;
        st.push_back(s.substr(0,1));
        rep(j, s.size()-1) {
            if (d[j] == 1) {
                count++;
                st.push_back(s.substr(j+1, 1));
            }
            else {
                st[count] += s.substr(j+1, 1);
            }
        }
        ll a = 0;
        rep(j, st.size()) {
            a += stoll(st[j]);
        }
        ans += a;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String...args) {
        Scanner stdin = new Scanner(System.in);
        int time = stdin.nextInt();
        int h = time / 3600;
        int m = time % 3600 / 60;
        int s = time % 60;

        System.out.println(h + ":" + m + ":" + s);
    }
}

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

using namespace std;

int main(){

int a, b, c;

cin>>a>>b>>c;

if(a > b) swap(a, b);
if(b > c) swap(b, c);
if(a > b) swap(a, b);

cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}


Measured memory_bytes: 3116
//C - Dubious Document: 
//Assunto: 
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define loop(i, a, b) for(int i = a; i < b; i++)
#define loopBack(i, a, b) for(int i = a; i >= b; i--)
#define INF INT_MAX
#define LINF LLONG_MAX
#define DINF DBL_MAX
#define MAX 100050
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    map<char, int> show;
    string ans = "";
    int n;
    cin >> n;
    vector<string> strings(n);
    loop(i, 0, n) cin >> strings[i];
    loop(i, 0, strings[0].size()) show[strings[0][i]]++;
    loop(i, 1, n) {
        map<char, int> aux;
        loop(j, 0, strings[i].size()) aux[strings[i][j]]++;
        for(auto x : show) {
            //cout << x.fi << " " << x.se << "\n";
            show[x.fi] = min(aux[x.fi], x.se);
        }
    }
    for(auto x : show) {
        while(x.se--) ans += x.fi;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<ll(n); i++)
#define REPR(i, n) for(ll i=n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=m; i<ll(n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(x) ll(x.size()) 
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF = 2e9;
const ll LINF = (1LL<<60);

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  vector<P> a(n);
  REP(i,n){ 
    cin >> a[i].first; 
    a[i].second = i+1;
  }
  sort(ALL(a));
  REP(i,n) cout << a[i].second << " ";
  
  return 0;
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)  for(int i = 0; i < n; i++)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.rbegin(), cont.rend()
#define unique(a)  (a).erase(unique((a).begin(), (a).end()),(a).end())
#define fastio          ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define PB push_back
#define endl "\n"
#define mod 1000000007

double tick() {
	static clock_t oldt; clock_t newt = clock(); double diff =

		1.0*(newt - oldt) / CLOCKS_PER_SEC; oldt = newt; return diff;
}
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
inline LL add(LL x, LL y) { x += y; if (x >= mod) x -= mod; return x; }
inline LL moduloMultiplication(LL x, LL y) {
	return (x%mod * 1LL * y%mod) %

		mod;
}
inline LL power(LL a, LL b) {
	LL x = 1 % mod;
	while (b) {
		if (b & 1) x = moduloMultiplication(x, a);
		a = moduloMultiplication(a, a);
		b >>= 1;
	}
	return x % mod;
}
inline LL inv(LL a) { return power(a, mod - 2) % mod; }
LL gcd(LL a, LL b)
{
	if (!a)
		return b % mod;
	return gcd(b%a, a) % mod;
}


int main()
{
	int n,k;
	cin >> n>>k;
	VI v(n);
	rep(i, n)cin >> v[i];
	//int maxe = INT_MIN;
	int res = 0;
	for (int i = 0; i < k; i++)
		res += v[i];

	// Compute sums of remaining windows by 
	// removing first element of previous 
	// window and adding last element of  
	// current window. 
	int curr_sum = res;
	for (int i = k; i < n; i++)
	{
		curr_sum += v[i] - v[i - k];
		res = max(res, curr_sum);
	}

	cout << fixed << setprecision(10) << (double)(res +k)/ (double)2<< endl;
	
}

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

// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

int main() {
  int n, q;
  cin >> n >> q;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  vector<int> pi(n+1,-1);
  vector<vector<int>> ps(n);
  rep(i,n) {
    int l = pi[a[i]];
    if (l != -1) ps[l].push_back(i);
    pi[a[i]] = i;
  }

  vector<vector<P>> qs(n);
  rep(qi,q) {
    int l, r;
    cin >> l >> r;
    --l; --r;
    qs[l].emplace_back(r,qi);
  }

  vector<int> ans(q);
  BIT<int> d(n);
  for (int x = n-1; x >= 0; --x) {
    for (int y : ps[x]) d.add(y,1);
    for (P query : qs[x]) {
      int r = query.first, i = query.second;
      ans[i] = (r-x+1) - d.sum(r);
    }
  }

  rep(i,q) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 59868
# C - Lower

n = int(input())
h = list(map(int, input().split()))

mMax = 0
cnt = 0
for i in range(1, len(h)):
    if h[-(i + 1)] >= h[-i]:
        cnt += 1
    else:
        mMax = max(cnt, mMax)
        cnt = 0
mMax = max(cnt, mMax)

print(mMax)

Measured memory_bytes: 14252