akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
//int MOD = 1000000007;
int N, M;
vector<vector<int> > g;
vector<vector<int> > dp;
vector<vector<int> > sum1;
vector<vector<int> > sum2;
vector<int> X;
map <pair<int, int>, int>  mp;

int solve(int a, int x) {

	//cerr << a << " " << x << endl;
	if (dp[a][x] == -1) {
		int ne = g[a][x];

		if (X[ne] == -1) {
			X[ne] = a;
			dp[a][x] = 1;
			for (int i = 0; i < g[ne].size(); i++) {
				if (g[ne][i] != a) {
					dp[a][x] = (dp[a][x] * solve(ne, i)) % M;
				}
			}
			dp[a][x]++;
		}
		else if (X[ne] != -2) {
			solve(ne, mp[make_pair(ne, X[ne])]);

			for (int i = 0; i < g[ne].size(); i++) {
				sum1[ne][i + 1] = (sum1[ne][i] * dp[ne][i]) % M;
			}
			for (int i = (int)g[ne].size() - 1; i >= 0; i--) {
				sum2[ne][i] = (sum2[ne][i + 1] * dp[ne][i]) % M;
			}

			X[ne] = -2;
		}
		if (X[ne] == -2) {
			int idx = mp[make_pair(ne, a)];
			dp[a][x] = (sum1[ne][idx] * sum2[ne][idx + 1]) % M;
			dp[a][x]++;
		}
	}
	return dp[a][x];
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> N >> M;
	g.resize(N);
	dp.resize(N);
	sum1.resize(N);
	sum2.resize(N);
	X.resize(N, -1);
	int res = 1;
	int a, b;
	for (int i = 0; i < N - 1; i++) {
		cin >> a >> b; a--; b--;
		g[a].push_back(b);
		g[b].push_back(a);
		dp[a].push_back(-1);
		dp[b].push_back(-1);
		sum1[a].push_back(1);
		sum1[b].push_back(1);
		sum2[a].push_back(1);
		sum2[b].push_back(1);
	}
	for (int i = 0; i < N; i++) {
		sum1[i].push_back(1);
		sum2[i].push_back(1);
	}
	for (int i = 0; i < N; i++) {
		res = 1;
		for (int j = 0; j < g[i].size(); j++) {
			mp[make_pair(i, g[i][j])] = j;
		}
	}
	for (int i = 0; i < N; i++) {
		res = 1;
		for (int j = 0; j < g[i].size(); j++) {
			res = (res * solve(i, j)) % M;
		}
		cout << res << endl;
	}

}

Measured memory_bytes: 52224
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}

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 all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9+7;

int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,l;
	cin >> n >> l;
	int sum = 0,minv = INF,tmp;
	rep(i,n){
		sum += l + i;
		if(minv > abs(l + i)){
			tmp = l + i;
			minv = abs(l + i);
		}
	}
	cout << sum - tmp << '\n';
	return 0;	
}


Measured memory_bytes: 256
N, M = map(int, input().split(' '))

one_to_routes = set()
other_routes_contains_N = set()

for _ in range(M):
    a, b = map(int, input().split(' '))

    if a == 1:
        one_to_routes.add(b)
    elif b == N:
        other_routes_contains_N.add(a)

if one_to_routes.isdisjoint(other_routes_contains_N):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


Measured memory_bytes: 19024
#include <iostream>
#include <regex>
using namespace std;
int main(){
    string s;
    cin >> s;
    int len = s.length();
    for(int i = 0; i < len; i++) {
        if(s[i] == ',')
            s[i] = ' ';
    }
    cout << s;
    return 0;
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define FOR(i,a,b) for(lint i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define yes "Yes"
#define no "No"
#define divs 1000000007
#define dive 1000000009

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    lint n, m; cin>>n>>m;
    if(n==m) print(yes);
    else print(no);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;


//組み合わせの数
//1 <= x の値を3つ使ってnを作成

//1,6,2
//1,5,3

int main(){
    //std::ifstream in("resource/input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int m,d;
    cin >> m >> d;
    int res;

    for(int i = 1; i <= m; ++i)
    {
        for(int j = 11; j <= d; ++j)
        {
            int d1, d10;
            d10 = j /10;
            d1 = j % 10;
            if(d1 < 2 || d10 < 2)continue;
            if(i == d1 * d10)++res;
        }
    }
    cout << res << endl;

    return 0;    
}



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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    FOR (i, 1, 10) {
        FOR (j, 1, 10) {
            if (i * j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    
    return 0;
}



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

const int N=200005;
const int mod=1000000007;
typedef long long ll;

int n,a,b,c,d;
char s[N];
bool fa,fb;

int main()
{
    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    scanf("%s",s+1);
    for(int i=a;i<c;i++)
    {
        if(s[i]=='#' && s[i+1]=='#')
        {
            fa=true;
            break;
        }
    }
    if(fa) printf("No\n");
    else
    {
        for(int i=b;i<d;i++)
        {
            if(s[i]=='#' && s[i+1]=='#')
            {
                fb=true;
                break;
            }
        }
        if(fb)  printf("No\n");
        else
        {
            if(c<d) printf("Yes\n");
            else
            {
                bool flag=false;
                for(int i=b;i<=d;i++)
                {
                    if(s[i-1]=='.' && s[i+1]=='.' && s[i]=='.' && i+1<=n && i-1>0)
                    {
                        flag=true;
                        break;
                    }
                }
                if(flag) printf("Yes\n");
                else printf("No\n");
            }
        }
    }
    return 0;
}



Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath> 

using namespace std;

int a[100100],ans;
long long sum[100100];

int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 1;i <= n;i++)scanf("%d",&a[i]);
	sort(a + 1, a + 1 + n);
	for(int i = 1;i <= n;i++)sum[i] = sum[i - 1] + a[i];
	ans = 1;
	for(int i = n - 1;i >= 1;i--)
	{
		if(sum[i] * 2 >= a[i + 1])
			ans++;
		else
			break;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 1280
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

	private static final byte WHITE = 1;
	private static final byte BLACK = 2;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int q = sc.nextInt();
		
		int[] minx = new int[n];
		int[] miny = new int[n];
		
		for( int i=0 ; i<n ; i++ ) {
			minx[i] = n-2; 
			miny[i] = n-2; 
		}
		int minyy = n-2;
		int minxx = n-2;
		long blackCnt = ((long)n-2)*(n-2);
		
//		byte[][] grid = new byte[n][n];
//		for( int i=0 ; i<n ; i++ ) {
//			grid[i][n-1] = WHITE;
//			grid[n-1][i] = WHITE;
//		}
//		for( int i=1 ; i<n-1 ; i++ ) {
//			Arrays.fill(grid[i], 1, n-1, BLACK);
//		}
		
//		long whiteCnt = 0;
		for( int i=0 ; i<q ; i++ ) {
			int q1 = sc.nextInt();
			int q2 = sc.nextInt()-2;
			
			if( q1==1 ) {
				// vertical
				if( q2 < minxx ) {
					for( int j=q2 ; j<minxx ; j++ ) {
						miny[j]=minyy;
					}
					minxx = q2;
				}
				blackCnt -= miny[q2];
			}else {
				// horizontal
				if( q2 < minyy ) {
					for( int j=q2 ; j<minyy ; j++ ) {
						minx[j]=minxx;
					}
					minyy = q2;
				}
				blackCnt -= minx[q2];
			}

		}
		System.out.println(blackCnt);

	}

}


Measured memory_bytes: 64148
#include<cstdio>
#include<vector>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<iostream>

int main(){
    int n;
    std::cin >> n;

    std::vector<int> a(n);
    for(int i = 0; i < n; i++) std::cin >> a[i];

    long long x = a[0];
    long long y = std::accumulate(a.begin(), a.end(),0LL) - a[0];

    long long ans = std::abs(y - x);

    for(int i = 1; i < n-1; i++){
        x += a[i];
        y -= a[i];
        ans = std::min(ans, std::abs(y-x));
    }
  
  std::cout << ans << std::endl;

}

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

using  namespace std;

const long long maxn = 1e18;
int main(){
    long long n;
    scanf("%lld",&n);
    if(n & 1LL || n < 10) return !printf("0");
    long  long cnt = n/10LL,mul = 5LL,x = 1LL;
    n/= 10LL;
    for(;mul <= n;mul *= 5LL){
        cnt += n/mul;
        if(mul >= maxn) break;
    }
    printf("%lld",cnt);



}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
typedef long long ll;

vector<ll> a, b, c;
struct Idx { int ia, ib, ic; };
bool operator<(const Idx &l, const Idx &r) {
	return a[l.ia] + b[l.ib] + c[l.ic] < a[r.ia] + b[r.ib] + c[r.ic];
}

bool used[1003][1003][1003];

int main() {
	int X, Y, Z, K; cin >> X >> Y >> Z >> K;
	a = decltype(a)(X);
	b = decltype(b)(Y);
	c = decltype(c)(Z);
	for (int i = 0; i < X; i++) cin >> a[i];
	for (int i = 0; i < Y; i++) cin >> b[i];
	for (int i = 0; i < Z; i++) cin >> c[i];
	sort(a.rbegin(), a.rend());
	sort(b.rbegin(), b.rend());
	sort(c.rbegin(), c.rend());
	priority_queue<Idx> que;
	vector<ll> ans;
	que.push({ 0,0,0 });
	while (!que.empty()) {
		auto idx = que.top(); que.pop();
		int ia = idx.ia, ib = idx.ib, ic = idx.ic;
		ans.push_back(a[ia] + b[ib] + c[ic]);
		if (ans.size() > K) break;
		if (ia + 1 < X && !used[ia + 1][ib][ic]) {
			que.push({ ia + 1, ib, ic });
			used[ia + 1][ib][ic] = true;
		}
		if (ib + 1 < Y && !used[ia][ib + 1][ic]) {
			que.push({ ia, ib + 1, ic });
			used[ia][ib + 1][ic] = true;
		}
		if (ic + 1 < Z && !used[ia][ib][ic + 1]) {
			que.push({ ia, ib, ic + 1 });
			used[ia][ib][ic + 1] = true;
		}
	}
	sort(ans.rbegin(), ans.rend());
	for (int i = 0; i < K; i++) cout << ans[i] << endl;
	return 0;
}



Measured memory_bytes: 981376
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atcorder_BeginnerContest_118
{
    class Program
    {
        static void Main(string[] args)
        {

            long cnt = int.Parse(Console.ReadLine());
            long[] dataArr = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
            Array.Sort(dataArr);
            long modVal = dataArr[0];

            long idx = 1;
            while (true)
            {
                long tmp = dataArr[idx] % modVal;
                if ((0 < tmp) && (tmp < modVal))
                {
                    dataArr[idx - 1] = tmp;
                    dataArr[idx] = modVal;
                    modVal = tmp;
                }
                else
                {
                    idx++;
                }

                if((modVal <= 1)||(cnt <= idx))
                {
                    break;
                }
            }

            Console.WriteLine(modVal);
        }
    }
}


Measured memory_bytes: 21088
#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 = 100010;
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,m;

struct Mat{
	int a[3][3];
	void clear(){memset(a,0,sizeof(a));REP(i,0,2)a[i][i]=1;}
}x,y,ans,z;

Mat mul(Mat x,Mat y){
	Mat ans;
	memset(ans.a,0,sizeof(ans.a));
	REP(i,0,2)REP(j,0,2)REP(k,0,2)ans.a[i][j]=(1ll*x.a[i][k]*y.a[k][j]+ans.a[i][j])%mod;
	return ans;
}

Mat Exp(int p){
	Mat ans;ans.clear();
	Mat t=x;
	for(;p;p>>=1,t=mul(t,t))if(p&1)ans=mul(ans,t);
	return ans;
}

void Work(){
	ans.clear();
	int lst=0;
	REP(i,1,m){
		int p;read(p);
		y=Exp(p-lst-1);
		lst=p;
		ans=mul(ans,y);
		ans=mul(ans,z);
	}
	y=Exp(n-lst);
	ans=mul(ans,y);
	iout(ans.a[0][2]);
}

void Init(){
	read(n,m);
	x.a[0][0]=2;x.a[0][1]=2;x.a[0][2]=1;
	x.a[1][0]=1;x.a[1][1]=1;x.a[1][2]=1;
	x.a[2][0]=1;x.a[2][2]=1;
	z.a[0][0]=1;z.a[0][1]=2;z.a[0][2]=1;
	z.a[1][1]=1;z.a[1][2]=1;
	z.a[2][2]=1;
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    int N, K;
    scanf("%d %d", &N, &K);
    int A[N];
    for (int i = 0; i < N; i++)
        A[i] = 0;
    for (int i = 0; i < K; i++)
    {
        int d;
        scanf("%d", &d);
        for (int j = 0; j < d; j++)
        {
            int x;
            scanf("%d", &x);
            A[x - 1] += 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        if (A[i] == 0)
            ans++;
    }

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

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

int n,e,inDeg[100005];
vector<int>graph[5*100005];
vector<int>out;

void init(int n, int e){
    for(int i=0; i<e; i++){
        int u,v;
        cin>>u>>v;
        graph[u].push_back(v);
        inDeg[v]++;
    }
}

void topo(){
    queue<int>q;
    for(int i=0; i<n; i++)if(inDeg[i]==0)q.push(i);

    while(!q.empty()){
        int u=q.front();
        q.pop(); out.push_back(u);

        int len=graph[u].size();

        for(int i=0; i<len; i++){
            int v=graph[u][i];
            if(inDeg[v]>0){
                inDeg[v]--;
                if(inDeg[v]==0)q.push(v);
            }
        }
    }
}

int main(){
    cin>>n>>e;
    init(n,e);
    topo();
    vector<int>::iterator it=out.begin();
    for(it; it!=out.end(); it++)cout<<*it<<endl;
return 0;
}



Measured memory_bytes: 15400
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;

const int MAX_N=1e5;

typedef long long ll;
int X,Y,Z;
typedef tuple<ll,ll,ll> T;
T C[MAX_N];

ll BC[MAX_N],AC[MAX_N];
int main(){
	cin>>X>>Y>>Z;
	int N=X+Y+Z;
	REP(i,N){
		ll a,b,c;
		cin>>a>>b>>c;
		C[i]=T(a,b,c);
	}
	ll ans=0,sm=0;
	sort(C,C+N,[](const T &a,const T &b){
		return (get<0>(a)-get<1>(a))<(get<0>(b)-get<1>(b));
	});
	priority_queue<ll,vector<ll>,greater<ll> > pque;
	REP(i,Y){
		sm+=get<1>(C[i]);
		pque.push(get<1>(C[i])-get<2>(C[i]));
	}
	BC[Y-1]=sm;
	FOR(i,Y,N){
		pque.push(get<1>(C[i])-get<2>(C[i]));
		sm+=get<1>(C[i]);
		ll v=pque.top();
		pque.pop();
		sm-=v;
		BC[i]=sm;
	}
	while(!pque.empty())pque.pop();
	reverse(C,C+N);
	sm=0;
	REP(i,X){
		sm+=get<0>(C[i]);
		pque.push(get<0>(C[i])-get<2>(C[i]));
	}
	AC[X-1]=sm;
	FOR(i,X,N){
		pque.push(get<0>(C[i])-get<2>(C[i]));
		sm+=get<0>(C[i]);
		ll v=pque.top();
		pque.pop();
		sm-=v;
		AC[i]=sm;
	}
	FOR(i,Y-1,N-X){
		ans=max(ans,BC[i]+AC[N-i-2]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4472
a,b,c,d,e,f=map(int,input().split())

water_g=[]
for i in range(f//100+1):
  for j in range(f//100+1):
#    print(i,j)
    w=100*a*i + 100*b*j
    if w<=f:
      water_g.append(w)
water_g=sorted(list(set(water_g)),reverse=True)

sugar_g=[]
for i in range(f*e//100):
  for j in range(f*e//100):
    s=c*i + d*j
    if s<=f:
      sugar_g.append(s)
sugar_g=sorted(list(set(sugar_g)),reverse=True)

#print(water_g, sugar_g)

ans_water=100*a
ans_sugar=0
for water in water_g:
  if water==0:
    break
  for sugar in sugar_g:
    if water+sugar<=f and sugar/water<=e/100:
      if sugar/(sugar+water)>ans_sugar/(ans_sugar+ans_water):
        ans_water=water
        ans_sugar=sugar
print(ans_water+ans_sugar,ans_sugar)

Measured memory_bytes: 12456
#include<stdio.h>
int main()
{
  int i,j,n,sum,result;
  while(1)
    {
      scanf("%d",&n);
      if(n==0) break;
      result=0;
      for(i=1;i<n;i++)
	{
	  sum=i;
	  j=1;
	  while(1)
	    {
	      if(sum==n)
		{
		  result++;
		  break;
		}
	      if(sum>n) break;
	      sum+=i+j;
	      j++;
	    }
	}
      printf("%d\n",result);
    }
  return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A=0,B=0;
  cin>>A>>B;
  int sum=A+B;
  int sub=A-B;
  int mul=A*B;
  if(sum>sub){
     if(sum>mul){
        cout<<sum;
     }else{ 
        cout<<mul;
      }
  }else{
    if(sub>mul){
      cout<<sub;
    }else{
      cout<<mul;
  }
   }
  return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

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

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

int main(){
	int n, s;
	cin >> n;
	rep(t, n){
		cin >> s;
		cout << "Case " << t + 1 << ":" << endl;
		rep(i, 10){
			s *= s;
			s = (s % 1000000) / 100;
			cout << s << endl;
		}
	}
	return 0;
}

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

int main(){
  int n,d;
  cin >> n >> d;
  int x[n][d];
  for(int i=0;i<n;i++){
    for(int j=0;j<d;j++){
      cin >> x[i][j];
    }
  }
  int count=0;
  for(int i=0;i<n;i++){
    for(int j=i+1;j<n;j++){
      int dis=0;
      for(int k=0;k<d;k++){
        dis+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      int t=sqrt(dis);
      if(t*t==dis) count++;
    }
  }
  cout << count << endl;
}

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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<mp::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0, sizeof(x))
#define mm(x) memset((x), -1, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#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 UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define bit(n) (1LL << (n))
#define bitset(a, b) (a) |= (1 << (b))
#define bitunset(a, b) (a) &= ~(1 << (b))
#define bitcheck(a, b) ((((a) >> (b)) & 1) == 1)
#define bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
const int INF = (int)1e18;
const int MOD = (int)1e9 + 7;
const double PI = (double)acos(-1);
const double EPS = (double)1e-10;
const int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
template <typename T>
void chmax(T &a, T b) { a = max(a, b); }
template <typename T>
void chmin(T &a, T b) { a = min(a, b); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
};

signed main() {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;
  vec A(X), B(Y), C(Z);
  for (int i = 0; i < X; i++) cin >> A[i];
  for (int i = 0; i < Y; i++) cin >> B[i];
  for (int i = 0; i < Z; i++) cin >> C[i];

  vec sum;
  for (int i = 0; i < X; i++) {
    for (int j = 0; j < Y; j++) {
      int tmp = A[i] + B[j];
      sum.pb(tmp);
    }
  }

  sort(ALL(sum));
  reverse(ALL(sum));

  vec ans;
  for (int i = 0; i < min(K, X * Y); i++) {
    for (int j = 0; j < Z; j++) {
      int tmp = sum[i] + C[j];
      ans.pb(tmp);
    }
  }

  sort(ALL(ans));
  reverse(ALL(ans));

  for (int i = 0; i < K; i++) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 43368
#include<stdio.h>

int main(void){
  int students[30]={};
  int submit=0;
  for(int i=0;i<28;i++){
    scanf("%d",&submit);
    students[submit-1]++;
  }
  for(int i=0;i<30;i++){
    if(students[i]==0){printf("%d\n",i+1);}
  }
  return 0;
}



Measured memory_bytes: 2144
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring> //memset
using namespace std;


int main()
{
	long N;

	cin >> N;

	vector<string> s;

	for (long i = 0; i<N; i++) {
		string str;

		cin >> str;

		//vector<char> str_char;
		//for (int j = 0; j < 10; j++) {
		//	str_char.push_back(str[j]);
		//}

		std::sort(str.begin(), str.end());

		s.push_back(str);
	}

	std::sort(s.begin(), s.end());

	static long long lut[3628810];
	long long sum = 0;
	lut[0] = 0;
	lut[1] = 0;
	for (long i = 2; i < 3628810; i++) {
		sum += (i - 1);
		lut[i] = sum;
	}

	long result = 0;

	long count = 1;
	string hold = s[0];
	for (long i = 1; i < N; i++) {
		if (hold == s[i]) {
			count++;
		}
		else {
			result += lut[count];
			hold = s[i];
			count = 1;
		}
	}
	result += lut[count];

	cout << result << endl;
}


//int main()
//{
//	long K, X;
//
//	cin >> K >> X;
//
//	for (long i = -(K - 1); i <= K - 1; i++) {
//		long result = X + i;
//
//		if (result >= -1000000 && result <= 1000000) {
//			cout << result << " ";
//		}
//	}
//
//	cout << endl;
//}

//int main()
//{
//	long A, B;
//
//	cin >> A >> B;
//
//	cout << std::max(A + B, std::max(A - B, A * B)) << endl;
//}


Measured memory_bytes: 34036
"use strict";

const main = arg => {
    let N = arg.split("\n")[0].split("");  
    const red = N.filter(n=>n=="0").length;
    const blue = N.length - red;
 
    console.log(Math.min(red, blue) * 2);
    
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 14924
#include <iostream>

using namespace std;

int main(){
  int N, M;

  cin >> N >> M;
  bool arr[N][M+2];
  for(int i = 0 ; i < N ; i++){
    arr[i][0] = arr[i][M+1] = false;
    for(int j = 1 ; j <= M ; j++){
      cin >> arr[i][j];
      if(i) arr[i][j] = !arr[i][j];
    }
  }

  int res = 0;
  for(int i = 0 ; i < N ; i++){
    int l = 1, r = M;
    while(l <= r){
      if(arr[i][l] && l <= M){
        res++; l++;
        arr[i][l] = !arr[i][l];
      }else if(arr[i][r] && r > 0){
        res++; r--;
        arr[i][r] = !arr[i][r];
      }else{
        l++;
        arr[i][l] = !arr[i][l];
      }
    }
  }
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 1168
s=list(input())
n=len(s)
kotae=[]
#配列のi番目の後に+を入れるかどうか,考える前までにできている文字列をchar
def dfs(i,char):
  if i==n-1:
    kotae.append(sum(list(map(int,char.split("+")))))
  else:
    dfs(i+1,char+"+"+s[i+1])
    dfs(i+1,char+s[i+1])
dfs(0,s[0])
print(sum(kotae))

    
    

Measured memory_bytes: 3060
while True:
    try:
        a, b, c, d, e, f = map(int, input().split())
    except:
        break
    y = (c * d - f * a) / (b * d - e * a)
    x = (c - (b * y)) / a
    print("{:.3f} {:.3f}".format(x, y))


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

using namespace std;

string a,b;
int x,y,c,k=0;

int main(){
  cin >> a >> b;
  x=a.size();
  y=b.size();
  int map[x+1][y+1]={};
  for(int i=0;i<x+1;i++){
    map[i][0]=i;
  }
  for(int i=0;i<y+1;i++){
    map[0][i]=i;
  }

  /*for(int j=1;j<y+1;j++){
  for(int i=1;i<x+1;i++){
  if(i==j){
  if(a[i-1]==b[i-1]){
  map[i][j]=map[i-1][i-1];
}
else{
map[i][j] = map[i-1][i-1]+1;
//k++;
}
}
else{
map[i][j]=min((map[i-1][j]+1),(map[i][j-1]+1));
//k++;
}
}
}*/

for(int j=1;j<y+1;j++){
  for(int i=1;i<x+1;i++){
    if(a[i-1]==b[j-1]){
      c=0;
    }
    else{
      c=1;
    }
    map[i][j]=min(map[i-1][j]+1,map[i][j-1]+1);
    map[i][j]=min(map[i][j],map[i-1][j-1]+c);
    //k++;
  }
}

/*for(int i=0;i<y+1;i++){
for(int j=0;j<x+1;j++){
cout << map[j][i];
}
cout << endl;
}*/

//cout << k << endl;
cout << map[x][y] << endl;

}



Measured memory_bytes: 7148
#include <bits/stdc++.h>
using namespace std;
using namespace std::literals;
using Int = long long;
using Double = long double;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define LEN(x) ((int)(x).length())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define PUTS(x) cout << (x) << endl;
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define F first
#define S second
#define perm(c)   \
    sort(ALL(c)); \
    for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))
#define IntsIn(v, n)                                 \
    auto v = vector<Int>(0);                         \
    for (int v##_i = 0; v##_i < (int)(n); v##_i++) { \
        Int v##_a;                                   \
        cin >> v##_a;                                \
        v.push_back(v##_a);                          \
    }
void setPrecision(int num = 20) {
    std::cout << std::fixed << std::setprecision(num);
}
template <typename T>
T Max(T a) {
    return a;
}
template <typename T, typename... Args>
T Max(T a, Args... args) {
    return std::max(Max(args...), a);
}
template <typename T>
T Min(T a) {
    return a;
}
template <typename T, typename... Args>
T Min(T a, Args... args) {
    return std::min(Min(args...), a);
}
template <typename T>
bool vector_contains(std::vector<T> vec, T value) {
    return (std::distance(vec.begin(), std::find(vec.begin(), vec.end(), value)) != vec.size());
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
int main() {
    int n, q;
    cin >> n >> q;
    auto nodes = vector<int>(n);
    rep(i, n) {
        nodes[i] = i;
    }
    function<int(int)> parent = [&](int index) {
        auto &node = nodes[index];
        if (node == index) {
            return index;
        }
        auto result = parent(node);
        nodes[index] = result;
        return result;
    };
    rep(j, q) {
        int c, x, y;
        cin >> c >> x >> y;
        if (c == 0) { // unite
            nodes[parent(x)] = parent(y);
        } else { // same
            PUTS(parent(x) == parent(y) ? 1 : 0);
        }
    }
}



Measured memory_bytes: 3508
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
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;
}
long long dp[200010][5] = {0};
  
int main()
{
  string s;
  cin >> s;
  int N = s.size();
  s = "####" + s + "####";
  dp[5][1] = 1;

  FOR(i,4,N+5){
    FOR(j,1,5){
      FOR(k,1,5){
        if(k==j){
          int flag = 0;
          REP(l,j){
            if(s.at(i+j-l-1)!=s.at(i-l-1)){
              flag = 1;
            }
          }
          if(flag == 1){
            chmax(dp[i+j][j],dp[i][k]+1);
          }
        }else{
          chmax(dp[i+j][j],dp[i][k]+1);
        }
      }
    }
  }

  ll MAX = 0;
  FOR(i,1,5){
    chmax(MAX,dp[N+4][i]);
  }
  cout << MAX << endl;
}

Measured memory_bytes: 8384
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
const ll MAXN=2e5+51;
struct Edge{
	ll to,prev;
};
Edge ed[MAXN];
ll n,tot,from,to;
ll last[MAXN],x[MAXN],dp[MAXN];
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
}
inline void addEdge(ll from,ll to)
{
	ed[++tot].prev=last[from];
	ed[tot].to=to;
	last[from]=tot;
}
inline void dfs(ll node,ll fa)
{
	dp[node]=0;
	for(register int i=last[node];i;i=ed[i].prev)
	{
		if(ed[i].to!=fa)
		{
			dfs(ed[i].to,node);
			if(!dp[ed[i].to]&&x[node]>x[ed[i].to])
			{
				dp[node]=1;
			}
		}
	}
}
int main()
{
	n=read();
	for(register int i=1;i<=n;i++)
	{
		x[i]=read();
	}
	for(register int i=1;i<n;i++)
	{
		from=read(),to=read();
		addEdge(from,to),addEdge(to,from);
	}
	for(register int i=1;i<=n;i++)
	{
		memset(dp,0,sizeof(dp)),dfs(i,0);
		if(dp[i])
		{
			printf("%d ",i);
		}
	}
}

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

using namespace std;

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

    int h[n];
    for (int i = 0; i < n; i++)
        cin >> h[i];

    int dp[n];
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for (int i = 2; i < n; ++i)
    {
        dp[i] = min(abs(h[i] - h[i - 1]) + dp[i - 1], abs(h[i] - h[i - 2]) + dp[i - 2]);
    }

    cout << dp[n - 1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define For1(i, n) for(int i = 1; i <= (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)
#define Return(x) { Cout(x); return 0; }

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, h, w);
    Cinm(char, h*w, m);
    int k1 = h*w % 2;
    int k4 = (h/2*2) * (w/2*2);
    int k2 = h*w - k1 - k4;
    // Cout(k1, " ", k2, " ", k4);
    
    for(auto &e : m){
        if(e.second % 2 == 1){
            if(k1 == 0) Return("No");
            e.second --;
            k1 --;
        }
        if(e.second % 4 == 2){
            if(k2 == 0) Return("No");
            e.second -= 2;
            k2 -= 2;
        }
    }
    Cout("Yes");
}


Measured memory_bytes: 256
a[9][1010],i,j,z,t,c;main(p){for(;*a[2]=read(i=0,&c,1);)for(t*=c<60||!++z;++j&7||++i&7;)i&j&&i>>~-c%4&c>60?a[i][z]+=p=a[j&7][z-1]%10007,t+=p:0;t=!printf("%d\n",t%10007);}

Measured memory_bytes: 532
n,m = gets.split.map(&:to_i)
s = gets.chomp
t = gets.chomp
g = n.gcd(m)
ans = true
for i in 0..g-1
  ans = false if s[(n/g)*i] != t[(m/g)*i]
end

if ans
  puts n*m/g
else
  puts -1
end

Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 2*1e5;

ll a;
string k;

int main(){
    AC
    cin>>a;
    cin>>k;
    int tt = 1;
    ll tmp = 0;
    for(int i=k.size()-1; i>=0; i--){
        if(k[i]=='.') continue;
        tmp+=(k[i]-'0')*tt;
        tt*=10;
    }
    cout<<(a*tmp)/100<<endl;
}

Measured memory_bytes: 3568
use v5.18; # strict say state
use warnings;
use List::Util qw(reduce first max min sum0);

chomp (my ($q, $h, $s, $d) = split / /, <STDIN>);
chomp (my $n = <STDIN>);
my $ans = 0;
if ($d < 2 * $s && $d < 4 * $h && $d < 8 * $q) {
  $ans += $d * int($n/2);
  $n -= 2 * int($n/2);
}
if ($s < 2 * $h && $s < 4 * $q) {
  $ans += $s * int($n/1);
  $n -= 1 * int($n/1);
}
if ($h < 2 * $q) {
  $ans += $h * int($n/0.5);
  $n -= int(0.5 * int($n/0.5));
}
$ans += $q * int($n/0.25);
$n -= int(0.25 * int($n/0.25));
say $ans;

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  int A, B;
  cin >> A >> B;
  if(A == 1) A = 14;
  if(B == 1) B = 14;
  if(A == B) cout << "Draw" << endl;
  else if(A < B) cout << "Bob" << endl;
  else cout << "Alice" << endl;
}

Measured memory_bytes: 256
N = int(input())
c = input()

r = c.count("R")
w = c.count("W")
a = "R"*r+"W"*w

ans = 0
for i in range(N):
    if(c[i] != a[i]):
        if(c[i] == "W" and a[i] == "R"):
            ans += 1
print(ans)

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

struct s {
  int i, j, ni, nj;

  string print() {
    string s = to_string(i + 1) + " " + to_string(j + 1);
    s += " " + to_string(ni + 1) + " " + to_string(nj + 1);
    return s;
  }
};

int main() {
  int H, W;
  cin >> H >> W;

  vector<vector<int>> a(H, vector<int>(W));
  rep(i, H) rep(j, W) cin >> a[i][j];

  vector
 history;

  rep(i, H - 1) rep(j, W) {
    if (a[i][j] % 2 == 0)
      continue;
    int ni = i + 1;
    int nj = j;
    a[ni][nj]++;
    history.push_back(s{i, j, ni, nj});
  }
  rep(j, W - 1) {
    int i = H - 1;
    if (a[H - 1][j] % 2 == 0)
      continue;
    int ni = i;
    int nj = j + 1;
    a[ni][nj]++;
    history.push_back(s{i, j, ni, nj});
  }

  cout << history.size() << endl;
  rep(i, history.size()) cout << history[i].print() << endl;
}

Measured memory_bytes: 5232
#include <stdio.h>

int main() {
    int w = 0, h = 0;
    int x = 0, y = 0, r = 0;

    scanf("%d %d %d %d %d", &w, &h, &x, &y, &r);

    if(x-r < 0 || y-r < 0) {
       printf("No\n"); 
    } else if(x+r > w || y+r > h) {
        printf("No\n"); 
    } else {
       printf("Yes\n");
    }
    return 0;
}


Measured memory_bytes: 2084
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

template<typename T = int64_t> T toInteger(const string&);

template<> int toInteger<int>(const string& s) {
  return stoi(s);
}

template<> int64_t toInteger<int64_t>(const string& s) {
  return stoll(s);
}

template<typename T = int64_t> T toInteger(const string& s, int n) {
  T res = 0;
  for (char c : s) {
    if (isdigit(c)) res = res * n + c - '0';
    else if (isalpha(c)) res = res * n + tolower(c) - 'a' + 10;
  }
  return s[0] == '-' ? -res : res;
}

int main() {
  string s;
  cin >> s;
  int best = numeric_limits<int>::max();
  for (int i = 0; i + 3 <= int(s.size()); ++i) {
    int k = toInteger(s.substr(i, 3));
    if (abs(k - 753) < best) best = abs(k - 753);
  }
  cout << best << endl;
}



Measured memory_bytes: 256
/////////// <----------------------  Quicksilver_ ---------------------> ///////////
#include <bits/stdc++.h>
#include <sstream>
#include <algorithm>
#include <map>
#include <iterator>
#include <queue>
#include <utility>
#include <set>

using namespace std;
#define endl '\n'
#define ll long long int
#define c(x) ll x;cin>>x
#define cc(x,y) ll x,y;cin>>x>>y
#define ccc(x,y,z) ll x,y,z; cin>>x>>y>>z
#define db long double
#define fast cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
#define inf 200000000000000
#define mod 1000000007
#define eps 1e-7
#define PI 3.1415926535897932385
#define pb push_back
#define bitc  __builtin_popcountll
#define mp make_pair
#define ff first
#define ss second
#define all(ar) ar.begin(), ar.end()
#define len(x) (ll)(x).size()
#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define foreach(it,ar) for (auto it = ar.begin(); it != ar.end(); it++)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define print(arr,n) cout<<" :: "<<#arr<<" :: "<<endl; rep(i,n) cout<<arr[i]<<" "; cout<<endl
#define print2(arr,n,m) cout<<" :: "<<#arr<<" :: "<<endl; rep(i,n){ rep(j,m) cout<<arr[i][j]<<" "; cout<<endl; }
#define dyn1(arr,n) ll* arr=new ll[n]; rep(i,n) arr[i]=0;
#define dyn2(arr,n,m) ll** arr=new ll*[(n)]; rep(i,n) arr[i]=new ll[m]; rep(i,n) rep(j,m) arr[i][j]=0
#define carr(arr,n) rep(i,n) cin>>arr[i]
#define carr2(arr,n,m) rep(i,n) rep(j,m) cin>>arr[i][j]
#define debug(a) cout<<" :: "<<#a<<" == "<<a<<endl
#define debug2(a,b) cout<<" :: "<<#a<<" == "<<a<<" :: "<<#b<<" == "<<b<<endl
typedef pair<ll,ll> pii;
typedef vector<pii> vii;

inline ll maxim(ll a,ll b) {if(a>b) return a; else return b;}
inline ll minim(ll a,ll b) {if(a<b) return a; else return b;}
inline bool equals(double a, double b){ return fabs(a - b) < 1e-9; }
ll gcd(ll a, ll b){ return b==0 ? a : gcd(b, a%b); }


bool prime[3001];
void SieveOfEratosthenes()
{
    memset(prime, true, sizeof(prime));
    prime[1]=false;
    for (int p=2; p*p<=3000; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=3000; i += p)
                prime[i] = false;
        }
    }
}

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

// ll gcd(ll a,ll b,ll& x,ll& y)
// {
//   if(a==0)
//   {
//     x=0;
//     y=1;
//     return b;
//   }
//   else
//   {
//     ll x1,y1;
//     ll g=gcd(b%a,a,x1,y1);
//     x=y1-(b/a)*x1;
//     y=x1;
//     return g;
//   }
// }

ll arr[1000010];
ll freq[1000010];
ll counter[1000010];
ll mul[1000010];
vector<pii> temp;
vector<pii> queries;
map<ll,ll> m;


int main()
{
  fast;
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  cout<<setprecision(10)<<fixed;
  cc(s,w);
  if(w>=s) cout<<"unsafe"<<endl;
  else cout<<"safe"<<endl;

  return 0;
}


Measured memory_bytes: 3652
N = gets.to_i
A = gets.split.map(&:to_i)
A.sort!
plus, minus = A.partition { |i| i >= 0 }
if minus.size == 0
  puts plus.inject(:+) - plus[0] * 2
  temp = plus.shift
  while plus.size > 1
    a = plus.shift
    puts "#{temp} #{a}"
    temp -= a
  end
  a = plus.pop
  puts "#{a} #{temp}"
  temp = a - temp
elsif plus.size == 0
  puts -minus.inject(:+) + minus[-1] * 2
  temp = minus.pop
  while minus.size > 0
    a = minus.shift
    puts "#{temp} #{a}"
    temp -= a
  end
else
  puts plus.inject(:+) - minus.inject(:+)
  temp = minus.pop
  while plus.size > 1
    a = plus.pop
    puts "#{temp} #{a}"
    temp -= a
  end
  a = plus.pop
  puts "#{a} #{temp}"
  temp = a - temp
  while minus.size > 0
    a = minus.shift
    puts "#{temp} #{a}"
    temp -= a
  end
end


Measured memory_bytes: 13440
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int main()
{
	int a, b, c, x;
	cin >> a >> b >> c >> x;

	int res = 0;
	for (int i = 0; i <= a; i++)
	{
		for (int j = 0; j <= b; j++)
		{
			int y = x - (500 * i + 100 * j);
			if (0 <= y && y <= c * 50)
			{
				res++;
			}
		}
	}

	cout << res << endl;
}


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

int main(){
    string s,t;
    cin>>s>>t;
    bool flag=1;
    for(int i=0;i<s.length();i++){
        if(s[i]!=t[i]) flag=0;
    }
    if(flag) cout<<"Yes";
    else cout<<"No";
}


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

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main(){
	LL N, A, B;
	cin >> N >> A >> B;
	LL m=B+A*(N-1), M=A+B*(N-1);
	cout << max(0LL,M-m+1) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<cstdio>

using namespace std;

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

vector<P> prime;

int main(){
    const int INF = 1000000000;
    int n, m;
    cin >> n >> m;
    int a[m], b[m];
    int c[m];
    fill(c, c + m, 0);
    rep(i, m){
        cin >> a[i] >> b[i];
        rep(j, b[i]){
            int c_;
            cin >> c_;
            c_--;
            c[i] += (1 << c_);
        }
    }
    // rep(i, m) cout << c[i] << endl;
    int dp[m+1][(1<<n)];
    rep(i, m + 1)rep(j, (1 << n)) dp[i][j] = INF;
    rep(i, m+1) dp[i][0] = 0;
    for (int i = 1; i <= m; i++){
        for (int j = 0; j < (1 << n); j++){
            dp[i][j|c[i-1]] = min(dp[i][j|c[i-1]], min(dp[i-1][j|c[i-1]], dp[i-1][j] + a[i-1]));
        }
        for (int j = 0; j < (1 << n); j++){
            dp[i][j] = min(dp[i][j], dp[i-1][j]);
        }
    }
    if (dp[m][(1<<n)-1] == INF){
        cout << -1 << endl;
    }else{
        cout << dp[m][(1<<n)-1] << endl;
    }
    
    // rep(i, m + 1){
    //     rep(j, (1<<n)){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }
}


Measured memory_bytes: 16256
import math

N,M=map(int,input().split())

if (N==0 or N==1) and (M==0 or M==1):
  print(0)
elif (N==0 or N==1) and (M!=0 and M!=1):
  print(int(math.factorial(M)/math.factorial(M-2)/math.factorial(2)))
elif (M==0 or M==1) and (N!=0 and N!=1):
  print(int(math.factorial(N)/math.factorial(N-2)/math.factorial(2)))
else:
  print(int(math.factorial(N)/math.factorial(N-2)/math.factorial(2)+math.factorial(M)/math.factorial(M-2)/math.factorial(2)))


Measured memory_bytes: 3064
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> h;
  h.resize(n);
  int ii,jj,num =1,height;
  for(ii=0;ii<n;ii++){
    cin  >> h[ii];
  }
  
  for(ii=1;ii<n;ii++){
    height = h[ii];

    for(jj=ii-1;jj>=0;jj--){
      //cout << "height" << height << "h[jj]" << h[jj] << endl;
      if(height < h[jj]){
	break;
      }
      
      if(jj == 0){
	num += 1;
      }
    }
  }
  
  cout << num << endl;
  
  return 0;
}


Measured memory_bytes: 256