akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <math.h>
#include <iomanip>
#include <queue>
#include <stack>
#include <utility>

using namespace std;
typedef vector<vector<int>> mat;
typedef pair<int,int> pii;
typedef vector<int> vi;

vector<pii> d(4);

int solve();
int getCols( const int target, const mat & m );
void setColor( const int col, mat &m );
void search( int &ans, int target, mat &orig );

int main(void) {
	
	while(solve()){}

	return 0;
}

void setColor( const int col, mat &m ) {

	//?????¨?????¨??????
	const int orig = m[0][0];

	queue<pii> q;
	q.push(pii(0,0));
	mat visited( m.size(), vi( m[0].size(), 0 ) );
	visited[0][0] = 1;

	while(!q.empty()) {

		pii p = q.front();
		q.pop();
		m[p.first][p.second] = col;	

		for( int i = 0; i < d.size(); i++ ) {
			pii n;
				n.first = p.first + d[i].first;
				n.second = p.second + d[i].second;
			if( n.first >= 0 && n.first < m.size() 
				&& n.second >= 0 && n.second < m[0].size()
				&& visited[n.first][n.second] == 0
				&& m[n.first][n.second] == orig ) {
					visited[n.first][n.second] = 1;
					q.push(n);
			}
		}
	}

	
	

}

int getCols( const int target, const mat& m) {

	int ret = 0;
	queue<pii> q;
	q.push(pii(0,0));
	mat visited( m.size(), vi( m[0].size(), 0 ) );
	visited[0][0] = 1;

	while(!q.empty()){

		pii p = q.front();
		q.pop();
		ret ++;
		for( int i = 0; i < d.size(); i++ ) {

			pii n;
				n.first = p.first + d[i].first;
				n.second = p.second + d[i].second;

			if( n.first >= 0 && n.first < m.size() 
				&& n.second >= 0 && n.second < m[0].size()
				&& visited[n.first][n.second] == 0
				&& m[n.first][n.second] == target ) {
					visited[n.first][n.second] = 1;
					q.push(n);
			}
		
		}
	}

	return ret;
}

void search( int &ans, int target, mat &orig ) {

	for( int i = 0; i < 1296; i++ ) {

		bool b = false;
		int t[5];
		int k = i;

		for( int j = 0; j < 4; j++ ) {
			t[j] = k % 6 + 1;
			k /= 6;
			if( t[0] == orig[0][0] ) { b = true; break; }
			if( j > 0 && t[j] == t[j-1] ){ b = true; break; }
		}
		t[4] = target;
		if( t[3]  == target ) { b = true; }
		if( t[4] != target ) { b = true; }

		if(b){ continue; }

		mat m = orig;

		for( int j = 0; j < 5; j++ ) {

			setColor( t[j],m);
			
		}


		ans = max( ans, getCols( target, m ) );
	}

}

int solve() {

	int h, w, c;

	cin >> h >> w >> c;

	if(!(h|w|c)){ return 0; }

	mat p(h,vector<int>(w,0));

	d[0] = pii(0,1);
	d[1] = pii(0,-1);
	d[2] = pii(1,0);
	d[3] = pii(-1,0);

	for( int i = 0; i < h; i++ ) {
		for( int j = 0; j < w; j++ ) {
			cin >> p[i][j];
		}
	}
	
	int ans = 0;
	search( ans, c, p );
	cout << ans << endl;

	return 1;

}

Measured memory_bytes: 3124
import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

N = int(input())
A = list(map(int, input().split()))

D = getD(max(A))

flag = True

d_set = set()
for a in A:
    while a != 1:
        d = D[a]
        if d in d_set:
            flag = False
            break
        else:
            d_set.add(d)
        while a > 1 and a % d == 0:
            a = a // d



if flag:
    print('pairwise coprime')
    exit()

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


Measured memory_bytes: 127728
#include <iostream>
#define MAX 10000

using namespace std;

bool prime[MAX];

void isPrime(void){

  for( int i = 0 ; i < MAX ; i++ ) prime[i] = true;
  prime[0] = prime[1] = false;

  for( int i = 0 ; i*i < MAX ; i++ ){
    if(prime[i]){
      for( int j = 2*i ; j < MAX ; j += i ){
	prime[j] = false;	
      }
    }
  }

}

int main(void){

  isPrime();

  int n;
  while( cin >> n , n ){

    for( int i = n ; i >= 0 ; i-- ){

      if( prime[i] && prime[i - 2] ){
	cout << i - 2 << " " << i << endl;
	break;
      }
    }

  }
  return 0;
}

Measured memory_bytes: 1172
#include <iostream>
#define int long long
using namespace std;

const int DEPTH = 17;

struct SegTree {
	int lazyT[1 << DEPTH + 1];
	int lazyV[1 << DEPTH + 1];
	int segSum[1 << DEPTH + 1];
	
	SegTree() {
		for (int i = 0; i < (1 << DEPTH + 1); i++) {
			lazyT[i] = -1;
			lazyV[i] = 0;
			segSum[i] = 0;
		}
	}
	
	void lazy_evaluate(int id, int len) {
		if (lazyT[id] == -1) return;
		
		segSum[id] = lazyV[id] * len;
		if (id < (1 << DEPTH) - 1) {
			if (lazyT[id * 2 + 1] < lazyT[id]) {
				lazyT[id * 2 + 1] = lazyT[id];
				lazyV[id * 2 + 1] = lazyV[id];
			}
			if (lazyT[id * 2 + 2] < lazyT[id]) {
				lazyT[id * 2 + 2] = lazyT[id];
				lazyV[id * 2 + 2] = lazyV[id];
			}
		}
		lazyT[id] = -1;
	}
	
	void update(int l, int r, int x, int Time, int a = 0, int b = 1 << DEPTH, int id = 0) {
		lazy_evaluate(id, b - a);
		
		if (a >= r || b <= l) return;
		if (l <= a && b <= r) {
			lazyT[id] = Time;
			lazyV[id] = x;
			lazy_evaluate(id, b - a);
			return;
		}
		
		update(l, r, x, Time, a, (a + b) / 2, id * 2 + 1);
		update(l, r, x, Time, (a + b) / 2, b, id * 2 + 2);
		segSum[id] = segSum[id * 2 + 1] + segSum[id * 2 + 2];
	}
	
	int getSum(int l, int r, int a = 0, int b = 1 << DEPTH, int id = 0) {
		if (a >= r || b <= l) return 0;
		
		lazy_evaluate(id, b - a);
		if (l <= a && b <= r) {
			return segSum[id];
		}
		
		int res1 = getSum(l, r, a, (a + b) / 2, id * 2 + 1);
		int res2 = getSum(l, r, (a + b) / 2, b, id * 2 + 2);
		return res1 + res2;
	}
};

SegTree seg;

signed main() {
	int n, q;
	cin >> n >> q;
	
	for (int i = 0; i < q; i++) {
		int type;
		cin >> type;
		if (type == 0) {
			int s, t, x;
			cin >> s >> t >> x;
			seg.update(s, t + 1, x, i);
		}
		else {
			int s, t;
			cin >> s >> t;
			cout << seg.getSum(s, t + 1) << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 9264
#include<bits/stdc++.h>
int main()
{
	int a,b,i;
	scanf("%d %d",&a,&b);
	if(a>b)
	for(i=0;i<a;i++)
	printf("%d",b);
	else
	for(i=0;i<b;i++)
	printf("%d",a);
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n;
	char a[11];

	scanf("%s",a);

	for(n=0; a[n]!='\0'; n++){
		;
	}
	if((n+1)%2 == 0){
		puts("No");
		return 0;
	}

	for(n=0; a[n]!='\0'; n=n+2){
		if( a[n]=='h' && a[n+1]=='i'){
			;
		}else{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

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

int main(void) {
	int N;
	cin >> N;
	if (N == 1) {
		cout << "Hello World" << endl;
		return 0;
	}
	else if (N == 2) {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
	return 0;
}

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

#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;

int main(int argc, char *argv[]) {
    string s;
    cin >> s;

    ll length = s.size();
    while (true) {
        length -= 2;
        string before = s.substr(0, length/2);
        string after = s.substr(length/2, length/2);

        if (before == after) break;
    }

    MSG(length)
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <iterator>
#pragma warning(disable:4996)

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define MOD 1000000007
using namespace std;

int main(int argc, char* argv[])
{
    long a,b;
    scanf("%ld %ld", &a, &b);

    long na=(a-2+50)/50;
    if(a==1) na=1;
    long nb=(b-2+50)/50;
    if(b==1) nb=1;

    printf("%ld %ld\n", (na+nb)*2, 100);

    long i,j;
    if(a==1) {
        for(i=0; i<2; i++) {
            for(j=0; j<100; j++) {
                printf("#");
            }
            printf("\n");
        }
    }
    else {
        for(i=0; i<na; i++) {
            long k = (i==na-1? (a-2)%50+1: 50); 
            for(j=0; j<k; j++) {
                printf(".#");
            }
            for(j=0; j<50-k; j++) {
                printf("##");
            }
            printf("\n");

            for(j=0; j<100; j++) {
                printf("#");
            }
            printf("\n");
        }
    }

    if(b==1) {
        for(i=0; i<2; i++) {
            for(j=0; j<100; j++) {
                printf(".");
            }
            printf("\n");
        }
    }
    else {
        for(i=0; i<nb; i++) {
            for(j=0; j<100; j++) {
                printf(".");
            }
            printf("\n");

            long k = (i==nb-1? (b-2)%50+1: 50); 
            for(j=0; j<k; j++) {
                printf("#.");
            }
            for(j=0; j<50-k; j++) {
                printf("..");
            }
            printf("\n");
        }
    }

    return 0;
}


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

const int maxn=3e5+10;
const int maxnd=6e6;
int W,H,n,Ans,t[maxn];

struct Point{
	int x,y;
	Point() {}
	Point(int x,int y):x(x),y(y) {}
	bool operator < (Point const &p) const {return x==p.x?y<p.y:x<p.x;}
}P[maxn],T[maxn];

int totnd,root[maxn],lc[maxnd],rc[maxnd],sz[maxnd];

inline int newnode(int nd)
{
	int x=++totnd;
	lc[x]=lc[nd];
	rc[x]=rc[nd];
	sz[x]=sz[nd];
	return x;
}

int build(int nd,int s,int t,int pos)
{
	int x=newnode(nd);
	if (s==t) {sz[x]++; return x;}
	int mid=(s+t)>>1;
	if (pos<=mid) lc[x]=build(lc[nd],s,mid,pos);
	else rc[x]=build(rc[nd],mid+1,t,pos);
	sz[x]=sz[lc[x]]+sz[rc[x]];
	return x;
}

int query(int R,int L,int s,int t,int r)
{
	if (s>r) return 0;
	if (sz[R]==sz[L]) return 0;
	if (s==t) return s;
	int mid=(s+t)>>1;
	if (t<=r)
	{
		if (sz[rc[R]]==sz[rc[L]])
			return query(lc[R],lc[L],s,mid,r);
		else
			return query(rc[R],rc[L],mid+1,t,r);
	}
	else
	{
		int tmp=query(rc[R],rc[L],mid+1,t,r);
		if (tmp) return tmp;
		return query(lc[R],lc[L],s,mid,r);
	}
}

void solve(int W,int H)
{
	int i,j,p=0;
	sort(P+1,P+n+1);
	for (i=1;i<=n;i++)
		T[i]=Point(P[i].y,i);
	sort(T+1,T+n+1);
	for (i=1;i<=n;i++) t[i]=T[i].x;
	totnd=root[0]=0;
	for (i=1;i<=n;i++)
		root[i]=build(root[i-1],1,n,T[i].y);
	for (i=1;i<=n;i++)
	{
		while (P[p+1].x<P[i].x) p++;
		int L=0,R=H;
		bool flag=1;
		for (j=p;j;)
		{
			Ans=max(Ans,R-L+P[i].x-P[j].x);
			if (P[j].y<=P[i].y) L=max(L,P[j].y);
			if (P[j].y>=P[i].y) R=min(R,P[j].y);
			if (Ans>=R-L+P[i].x) {flag=0; break;}
			int A=upper_bound(t+1,t+n+1,R-1)-t-1;
			int B=lower_bound(t+1,t+n+1,L+1)-t-1;
			if (j-1) j=query(root[A],root[B],1,n,j-1);
			else j=0;
		}
		if (flag) Ans=max(Ans,R-L+P[i].x);
	}
}

int main()
{
#ifdef h10
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
	int i;
	scanf("%d%d%d",&W,&H,&n);
	for (i=1;i<=n;i++)
		scanf("%d%d",&P[i].x,&P[i].y);
	Ans=max(W,H);
	solve(W,H);
	for (i=1;i<=n;i++)
		P[i].x=W-P[i].x;
	solve(W,H);
	for (i=1;i<=n;i++)
		swap(P[i].x,P[i].y);
	solve(H,W);
	for (i=1;i<=n;i++)
		P[i].x=H-P[i].x;
	solve(H,W);
	printf("%d\n",Ans<<1);
}


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

using namespace std;

const int MOD = 1000000007;

int add(int x, int y) {
   x += y;
   if (x >= MOD) x -= MOD;
   return x;
}

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

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
  int N; cin >> N;
   vector<int> P(N);
   for (int i = 0; i < N; ++i) cin >> P[i], --P[i];
   vector<int> root(N);
   iota(root.begin(), root.end(), 0);
   vector<bool> dead(N);
   function<int(int)> getRoot = [&](int v) {
      if (root[v] != v) {
         root[v] = getRoot(root[v]);
      }
      return root[v];
   };
   int cnt = 0;
   int K = 0;
   for (int i = 0; i < N; ++i) {
      if (P[i] != -2) {
         int v = getRoot(i);
         int u = getRoot(P[i]);
         if (v == u) {
            ++cnt;
            dead[v] = true;
         } else {
            root[u] = v;
            if (dead[u]) dead[v] = true; // |= dead[u];
         }
      } else ++K;
   }
   vector<int> pw(N + 1);
   pw[0] = 1;
   for (int i = 1; i <= N; ++i) pw[i] = mult(pw[i - 1], N - 1);
   int ans = mult(cnt, pw[K]);
   vector<int> deg(N);
   for (int i = 0; i < N; ++i) {
      if (dead[getRoot(i)]) continue;
      int v = i;
      while (P[v] != -2) v = P[v];
      ++deg[v];
   }
   vector<int> dp(N + 1);
   dp[0] = 1;
   for (int z = 0; z < N; ++z) if (P[z] == -2) {
      int d = deg[z];
      ans = add(ans, mult(deg[z] - 1, pw[K - 1]));
      for (int i = N; i > 0; --i) {
         dp[i] = add(dp[i], mult(dp[i - 1], d));
      }
   }
   int fact = 1;
   for (int i = 2; i <= K; ++i) {
      // cerr << i << " " << dp[i] << "\n";
      // cerr << dp[i] << " " << pw[K - i] << " " << fact << "\n";
      int cur = mult(dp[i], pw[K - i]);
      cur = mult(cur, fact);
      // cerr << cur << "\n";
      ans = add(ans,cur);
      // ans = add(ans, mult(pw[K - i], mult(fact, dp[i])));
      fact = mult(fact, i);
   }
   int tot = mult(N, pw[K]);
   tot -= ans;
   if (tot < 0) tot += MOD;
   cout << tot << "\n";
   return 0;
}


Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF ll(1e18)

int main(void){
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll res;
    if(k&1){
        res = b-a;
    }else{
        res = a-b;
    }
    if(abs(res)>INF){
        cout<<"Unfair"<<endl;
    }else{
        cout<<res<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int intA = scan.nextInt();
		int intB = scan.nextInt();
		int intC = scan.nextInt();
		if(intA < intB && intB < intC){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 17176
#include<stdio.h>
int main()
{
int A,B,C,D,Z;
scanf("%d %d %d %d",&A,&B,&C,&D);
   if(A<C)
   {
   		if(B>D)
    	{
    	Z=D-C;
    			printf("%d\n",Z);
    		}
   		else
		   {
		   		Z=B-C;
		   		if(Z>0)
				   {
				   		printf("%d\n",Z);
				   }
				else
				{
					printf("0\n");
				}
		   }
		   }
   else
   {
   		if(D>B)
   		{
   			Z=B-A;
   				printf("%d\n",Z);
		}
		else
		{
			Z=D-A;
			if(Z>0)
			{
				printf("%d\n",Z);
			}
			else
			{
				printf("0\n");
			}
		}
	}
	return 0;
}


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

ll gcd(ll a, ll b){return b!=0 ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b){return a / gcd(a, b) * b;}

int main(){
	int n, m, x;
	cin >> n >> m >> x;
	vector<int> mp(n+1);
	rep(i, m){
		int a;
		cin >> a;
		mp[a] = 1;
	}
	
	int ans = 0;
	for(int i = 1; i <= x; ++i){
		ans += mp[i];
	}
	int cost = 0;
	for(int i = x; i <= n; ++i){
		cost += mp[i];
	}
	ans = min(cost, ans);
	cout << ans << endl;
	return 0;
}



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

using namespace std;


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

	vector<int> b(N + 1);
	for (int i = 1; i <= N; i++) {
		cin >> b[i];
	}

	//後ろから見ていって、最初に一致するところを除く。繰り返していって０になったらできる.そうでなければできない
	int i = N;
	vector<int> ans;
	while (b.size() > 1 && i > 0) {
		for (i = b.size() - 1; i >= 1; i--) {
			if (b[i] == i) {
				ans.push_back(i);
				b.erase(b.begin() + i);
				break;
			}
		}
	}
	if (b.size() == 1) {
		for (int i = N - 1; i >= 0; i--) {
			cout << ans[i] << endl;
		}
	}
	else {
		cout << -1 << endl;
	}

	return 0;
}

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

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

using namespace std;
using ll = long long;

int main(void)
{
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n <= k)
    {
        cout << n * x << endl;
    }
    else
    {
        cout << k * x + (n - k) * y << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return (-a)
}
func main() {
	var N, M int
	fmt.Scan(&N, &M)
	a := make([]int, N)
	b := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i], &b[i])
	}
	c := make([]int, M)
	d := make([]int, M)
	for i := 0; i < M; i++ {
		fmt.Scan(&c[i], &d[i])
	}
	for i := 0; i < N; i++ {
		mind := math.MaxInt32
		minl := math.MaxInt32
		for j := 0; j < M; j++ {
			md := abs(c[j]-a[i]) + abs(d[j]-b[i])
			// log.Printf("i %d, j %d, md %d\n", i, j, md)
			if mind > md {
				mind = md
				minl = j
			}
		}
		fmt.Println(minl + 1)
	}
}


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

int main(){
    int a, b, c;
    int d=0;
    int n=0;
    cin >> a >> b >> c;
    while(true){
        if(d<=c && c<=d+a){
            cout << n*60 + c << endl;
            break;
        }
        d+=a+b;
        if(d>=60){
            n+=d/60;
            d%=60;
        }
        if(d==0){
            cout << -1 << endl;
            break;
        }
    }
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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

void solve(long long N, std::vector<long long> H){
    int count = 0;
    long long maxi = H[0];
    REP(i, N) {
        if (maxi <= H[i]) count++;
        chmax(maxi, H[i]);
    }
    cout << count << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    long long N;
    scanf("%lld",&N);
    std::vector<long long> H(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&H[i]);
    }
    solve(N, std::move(H));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;


vector<vector<ll>> a(3, vector<ll>(mx,-1));
vector<vector<ll>> dp(3, vector<ll>(mx,0));


int main(){  
  int n;
  cin >> n;
  rep(i,n){
    cin >> a[0][i] >> a[1][i] >> a[2][i];
  }  
  rep(i,n){
    dp[0][i+1] = a[0][i] + max(dp[1][i],dp[2][i]);
    dp[1][i+1] = a[1][i] + max(dp[0][i],dp[2][i]);
    dp[2][i+1] = a[2][i] + max(dp[0][i],dp[1][i]);
  }
  ll ans = max(max(dp[0][n],dp[1][n]),dp[2][n]);
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11236
def hex(C):
	X = int(C[0].lower(), 16)
	Y = int(C[1].lower(), 16)
	#print(X,Y)
	if X < Y:
		print("<")
	elif X > Y:
		print(">")
	else:
		print("=")

C = input().split()
hex(C)

Measured memory_bytes: 2940
fn main() {
    let n: usize = read();
    let mut xs: Vec<i32> = vec![0; n];
    for i in 0..n {
        xs[i] = read();
    }
    let mut ans = 0;
    for p in 0..101 {
        let mut d: i64 = 0;
        for i in 0..n {
            d += ((xs[i] - p) * (xs[i] - p)) as i64;
        }
        if p == 0 {
            ans = d;
        } else {
            if ans > d {
                ans = d;
            }
        }
    }
    println!("{}", ans);
}

use std::io::stdin;
use std::io::Read;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let token: String = cin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

// Segment Tree
template <class M> class ST {
    void init(int n_) {
        for (n = 1, lev = 0; n < n_; n <<= 1, ++lev);
        d.assign(n << 1, e1);
    }

public:
    int n, lev;
    vector<M> d;
    virtual void assign(int, M) = 0;
    virtual M f(M, M) = 0;
    const M e1;

    ST(M e1) : e1(e1) {}

    void build(const vector<M>& v) {
        int n_ = v.size();
        init(n_);
        for (int i = 0; i < n_; ++i) d[n + i] = v[i];
        for (int i = n - 1; i > 0; --i) d[i] = f(d[(i << 1) | 0], d[(i << 1) | 1]);
    }
    void build(int n_) { init(n_); }

    void update(int k, M x) {
        assign(k += n, x);
        while (k >>= 1) d[k] = f(d[(k << 1) | 0], d[(k << 1) | 1]);
    }

    M query(int a, int b) {
        M L = e1, R = e1;
		for (int l = a + n, r = b + n; l < r; l >>= 1, r >>= 1) {
            if (l & 1) L = f(L, d[l++]);
            if (r & 1) R = f(d[--r], R);
		}
        return f(L, R);
    }
    M query(int a) { return query(a, a + 1); }
};

// Range Maximum Query (RMQ)
template <class M> struct RMQ : public ST<M> {
    RMQ(M e1 = numeric_limits<M>::min()) : ST<M>(e1) {}
    M f(M a, M b) override { return max(a, b); }
    void assign(int k, M x) override { this->d[k] = x; }
};

// Range Minimum Query (RmQ)
template <class M> struct RmQ : public ST<M> {
    RmQ(M e1 = numeric_limits<M>::max()) : ST<M>(e1) {}
    M f(M a, M b) override { return min(a, b); }
    void assign(int k, M x) override { this->d[k] = x; }
};

// Range Sum Query (RSQ)
template <class M> struct RSQ : public ST<M> {
    RSQ(M e1 = 0) : ST<M>(e1) {}
    M f(M a, M b) override { return a + b; }
    void assign(int k, M x) override { this->d[k] += x; }
};

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

    int n, q;
    cin >> n >> q;
    RmQ<int> rmq((1LL << 31) - 1);
    rmq.build(n);
    REP (i, q) {
        int com, x, y;
        cin >> com >> x >> y;
        if (com == 0) {
            rmq.update(x, y);
        } else {
            cout << rmq.query(x, y + 1) << endl;
        }
    }
}


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

int main(void) {
    int N;
    cin >> N;
    vector< int > P(N);
    for (int i = 0; i < N; i++) {
        cin >> P[i];
    }
    int m = P[0];
    int count = 0;
    for (int i = 0; i < N; i++) {
        if (P[i] <= m) {
            ++count;
        }
        m = min(m, P[i]);
    }
    printf("%d\n", count);
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
dp = [[0 for _ in range(3)] for _ in range(n+1)]
abc = []

for i in range(1, n+1):
    abc.append([int(x) for x in input().split()])

for i in range(n):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i+1][k] = max(dp[i+1][k], dp[i][j] + abc[i][k])

ans = 0
for i in range(3):
    ans = max(ans, dp[n][i])
    
print(ans)

Measured memory_bytes: 75100
n = int(input())
csf = [list(map(int, input().split())) for _ in range(n - 1)]

f = 0
station = 0
for i, (c, s, f) in enumerate(csf):
    t = s + c
    for j in range(i + 1, n - 1):
        C, S, F = csf[j][0], csf[j][1], csf[j][2]
        if t < S:
            t = S + C
        else:
            if (t - S) % F == 0:
                t += C
            else:
                t += F - (t-S) % F + C
    print(t)
print(0)

Measured memory_bytes: 3188
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

// main function
int main()
{
	vector<string> ans;
	ll H = 0;
	ll W = 0;

	cin >> H >> W;
	vector<string> a;

	Rep(h, H) {
		string tmp = "";
		cin >> tmp;

		bool isAdd = false;
		Rep(i, tmp.length()) {
			if (tmp[i] != '.') {
				isAdd = true;
			}
		}
		if(isAdd) a.push_back(tmp);
	}
	H = a.size();
	W = a[0].size();

	Rep(w, W) {
		bool isAdd = false;
		string tmp = "";
		Rep(h, H) {
			if (a[h][w] != '.') {
				isAdd = true;
			}
		}
		if (isAdd) {
			Rep(h, H) tmp.push_back(a[h][w]);
			ans.push_back(tmp);
		}
	}
	H = ans.size();
	W = ans[0].size();

	Rep(w, W) {
		Rep(h, H) {
			cout << ans[h][w];
		}
		if(w != W - 1) cout << endl;
	}

	return 0;
}

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

int main(int argc, char const *argv[])
{
	char s[9];
	for (int i = 0; i < 9; ++i)
	{
		cin>>s[i];
	}
	cout<<s[0]<<s[4]<<s[8]<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>

#define INF 300000000

using namespace std;

int n, m;
int *used;
int tpow[16] = {1, 3, 9, 27, 81, 243, 729, 2187, 6561, 19683, 59049, 177147, 531441, 1594323, 4782969, 14348907};

int main(int argc, char const* argv[])
{
	cin >> n >> m;
	while(n != 0 || m != 0){
			int N = tpow[n];
			used = new int[N];
			fill(used, used + N, INF);
			int ini = 0;
			for(int i = 0; i < 3; i++){
					int a;
					cin >> a;
					for(int j = 0; j < a; j++){
							int b;
							cin >> b;
							ini += i * tpow[b-1];
					}
			}
			queue<int> q;
			q.push(ini);
			used[ini] = 0;
			while(!q.empty()){
					int p = q.front(); q.pop();
					if(p == 0 || p == N - 1){
							cout << used[p] << endl;
							break;
					}
					if(used[p] > m){
							cout << -1 << endl;
							break;
					}
					int a[3];
					a[0] = -1;
					a[1] = -1;
					a[2] = -1;
					for(int i = 0; i < n; i++){
							a[(p % tpow[i+1] - p % tpow[i]) / tpow[i]] = i;
					}
					if(a[0] != -1){
							if(a[1] == -1 || a[0] > a[1]){
									int pp = p;
									pp += tpow[a[0]];
									if(used[pp] == INF){
											q.push(pp);
											used[pp] = used[p] + 1;
									}
							}
					}
					if(a[2] != -1){
							if(a[1] == -1 || a[2] > a[1]){
									int pp = p;
									pp -= tpow[a[2]];
									if(used[pp] == INF){
											q.push(pp);
											used[pp] = used[p] + 1;
									}
							}
					}
					if(a[1] != -1){
							if(a[0] == -1 || a[1] > a[0]){
									int pp = p;
									pp -= tpow[a[1]];
									if(used[pp] == INF){
											q.push(pp);
											used[pp] = used[p] + 1;
									}
							}
							if(a[2] == -1 || a[1] > a[2]){
									int pp = p;
									pp += tpow[a[1]];
									if(used[pp] == INF){
											q.push(pp);
											used[pp] = used[p] + 1;
									}
							}
					}
			}
			delete used;
			cin >> n >> m;
	}
	return 0;
}



Measured memory_bytes: 58916
N = int(input())

def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	
	divisors.sort()
	return divisors

div = make_divisors(N)
if len(div) % 2 == 0:
	ind_2 = len(div) // 2
	ind_1 = ind_2 - 1
	print(div[ind_1] + div[ind_2] -2)
else:
	ind = len(div) // 2
	print(div[ind] * 2 -2)

Measured memory_bytes: 3264
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

double calc(int x,int p){
    return x*100.0/p;
}

int main(){
  int x,p;
  cin>>x>>p;

  double ans=0.0;
  if(x%2==0) ans=calc(x/2,p);
  else{
      ans=calc((x-1)/2,p)*p/100+calc((x+1)/2,p)*(100-p)/100+1;
  }
  cout<<fixed<<setprecision(10)<<ans<<endl;


  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    
    char s[3];
    int x = 700;
    if( scanf("%s", s)) {
     
        for(int i = 0; i < 3; ++i) {
            if (s[i] == 'o') {
                x += 100;
            }
        }
   
    }
    printf("%d\n", x);
    return 0;
}


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

typedef long long ll;
typedef long long int lli;
const int MOD = 1000000007;
#define rep(i,n) for (int i = 0; i < (n); i++)

using namespace std;

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

	int A, B, C,res; cin >> A >> B >> C;

	res = B / A;
	res = res > C ? C : res;
	cout << res << endl;
}


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

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

    int count = 0;
    for(int i=2;i<n;i++){
        int maxn = max(vec[i], max(vec[i-1],vec[i-2]));
        int minn = min(vec[i], min(vec[i-1],vec[i-2]));
        int middle = vec[i] + vec[i-1] + vec[i-2] - maxn - minn;
        if(middle == vec[i-1]) count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define ll long long
#define mod 1000000007
#define M 1000000
using namespace std;


void answer(){
    ll n,ans=0,f=0;
    char c;
    cin>>c;
    cout<<++c;
    
    //cout<<ans<<"\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int q;
    //cin>>q ;while(q--)
        answer();
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
int a[200010];
int ans[200010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    
    rep(i, N) cin >> a[i + 1];

    for (int i = N; i > 0; i--) {
        int cnt = 0;
        for (int j = i * 2; j <= N; j += i) {
            cnt += ans[j];
        }
        if (cnt % 2 != a[i] % 2) {
            ans[i] = 1;
        }
    }
    vector<int> v;
    rep(i, N) {
        if (ans[i + 1] == 1) v.push_back(i + 1);
    }
    cout << v.size() << endl;
    if (v.size() == 0) return 0;
    rep(i, v.size()) {
        if (i != 0) cout << " ";
        cout << v[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 2936
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[][] a = new int[3][3];
		for(int i=0;i<3;i++) {
			for(int j=0;j<3;j++) {
				a[i][j] = sc.nextInt();
			}
		}
		
		int n = sc.nextInt();
		int b=0;
		for(int k=0;k<n;k++) {
			b = sc.nextInt();

			f: for(int i=0;i<3;i++) {
				for(int j=0;j<3;j++) {
					if(a[i][j] == b) {
						a[i][j] = 0;
						break f;
					}
				}
			}
		}

		for(int i=0;i<3;i++) {
			if(a[i][0]== 0 && a[i][1]==0 && a[i][2]==0) {
				System.out.println("Yes");
				return;
			}
		}
		for(int j=0;j<3;j++) {
			if(a[0][j]== 0 && a[1][j]==0 && a[2][j]==0) {
				System.out.println("Yes");
				return;
			}
		}
		if(a[0][0]==0 && a[1][1]==0 && a[2][2]==0) {
			System.out.println("Yes");
			return;
		}
		if(a[0][2]==0 && a[1][1]==0 && a[0][2]==0) {
			System.out.println("Yes");
			return;
		}

		System.out.println("No");

	}

}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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

    int ans = 0;
    int f[3] = {};

    rep(i,n){
        string s;
        cin >> s;
        int m = s.size();
        if(s[0] == 'B' && s[m-1] == 'A')f[0]++;
        else if(s[0] == 'B')f[1]++;
        else if(s[m-1] == 'A')f[2]++;
        rep(j,m-1){
            if(s[j] == 'A' && s[j+1] == 'B')ans++;
        }
    }

    if(f[0] > 1){
        ans += f[0] - 1;
        f[0] = 1;
    }
    if(f[0] == 1){
        if(f[1] > 0){
            ans++;
            f[1]--;
        }
        if(f[2] > 0){
            ans++;
            f[2]--;
        }
    }
        

    ans += min(f[1], f[2]);

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


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

int main() {
 int A,B,C;
 cin >> A;
 cin >> B;
 cin >> C;
 if (A<C && C<B) {
  cout << "Yes" << endl;
 } else if (B<C && C<A) {
  cout << "Yes" << endl;
 } else {
  cout << "No" << endl;
 }
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

long long count(long long n, vector<long long>& vct, long long s) {
    long long cnt = 0;
    for (long long i = 0; i < n; i++) {
        if (vct[i] * 2 >= s) {
            long long l = i;
            long long r = n - 1;
            while (l < r) {
                long long mid = (l + r) / 2 + 1;
                if (vct[i] + vct[mid] >= s) {
                    l = mid;
                } else {
                    r = mid - 1;
                }
            }
            cnt += 1 + 2 * (l - i);
        }
    }
    return cnt;
}

long long calculate(long long n, long long m, vector<long long>& vct, vector<long long>& svct, long long s) {
    long long cnt = 0;
    long long val = 0;
    for (long long i = 0; i < n; i++) {
        if (vct[i] * 2 >= s) {
            long long l = i;
            long long r = n - 1;
            while (l < r) {
                long long mid = (l + r) / 2 + 1;
                if (vct[i] + vct[mid] >= s) {
                    l = mid;
                } else {
                    r = mid - 1;
                }
            }
            val += vct[i] * 2 + 2 * (svct[l + 1] - svct[i + 1] + vct[i] * (l - i));
            cnt += 1 + 2 * (l - i);
        }
    }
    val -= s * (cnt - m);
    return val;
}

int main() {
    long long n, m;
    scanf("%lld %lld", &n, &m);

    vector<long long> vct = vector<long long>(n);
    for (long long i = 0; i < n; i++) {
        scanf("%lld", &vct[i]);
    }
    sort(vct.rbegin(), vct.rend());

    vector<long long> svct = vector<long long>(n + 1);
    for (long long i = 0; i < n; i++) {
        svct[i + 1] = svct[i] + vct[i];
    }

    long long l = 1;
    long long r = 2000000;
    while (l < r) {
        long long mid = (l + r) / 2 + 1;
        long long cnt = count(n, vct, mid);
        if (cnt >= m) {
            l = mid;
        } else {
            r = mid - 1;
        }
    }

    long long res = calculate(n, m, vct, svct, l);
    printf("%lld\n", res);
}

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

const int64_t INF = 1e11;
 
int main(){ 
  int X, Y, Z, K;
  vector<int64_t> A(1010, -INF), B(1010, -INF), C(1010, -INF);

  cin >> X >> Y >> Z >> K;
  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.begin(), A.begin()+X+1, greater<int64_t>());
  sort(B.begin(), B.begin()+Y+1, greater<int64_t>());
  sort(C.begin(), C.begin()+Z+1, greater<int64_t>());

  priority_queue<tuple<int64_t,int,int,int>> cand;
  vector<vector<vector<bool>>> flag(1010, vector<vector<bool>>(1010, vector<bool>(1010, false)));
  cand.push(make_tuple(A[0]+B[0]+C[0], 0, 0, 0));
  flag[0][0][0] = true;

  for(int i=0; i<K; i++){
    tuple<int64_t,int,int,int> c = cand.top(); cand.pop();
    cout << get<0>(c) << endl; 

    int x = get<1>(c), y = get<2>(c), z = get<3>(c);
    if(!flag[x+1][y][z]){
      cand.push(make_tuple(A[x+1]+B[y]+C[z],x+1,y,z));
      flag[x+1][y][z] = true;
    }
    if(!flag[x][y+1][z]){
      cand.push(make_tuple(A[x]+B[y+1]+C[z],x,y+1,z));
      flag[x][y+1][z] = true;
    }
    if(!flag[x][y][z+1]){
      cand.push(make_tuple(A[x]+B[y]+C[z+1],x,y,z+1));
      flag[x][y][z+1] = true;
    }
  }
}

Measured memory_bytes: 184064
/*
  Author: @yash_31
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
#define ll long long int
#define eb emplace_back
#define fatafat ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define ft first
#define sd second
#define vpi vector<pair<int,int> >
#define vpl vector<pair<ll,ll> >
#define mkpr make_pair
#define deb(x) std::cout<<#x<<":"<<x<<endl;
#define whole(x) (x).begin(),(x).end()
#define revwhole(x) (x).rbegin(),(x).rend()
#define endl "\n"
#define fbo find_by_order
#define ook order_of_key

using namespace std; 
using namespace __gnu_pbds;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update> gharKaSet;
 
const int maxlimit=1e5+2;
const ll inf=1e18;

int main()
{
  fatafat
  int n;
  cin>>n;
  string str;
  map<string,bool> mp;
  for(int i=0;i<n;i++){
    cin>>str;
    mp[str]=true;
  }
  cout<<mp.size();
  return 0;
}

Measured memory_bytes: 19284
package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	solve(os.Stdin, os.Stdout)
}

func solve(in io.Reader, out io.Writer) {
	var x1, y1, x2, y2 int
	fmt.Fscanf(in, "%d%d%d%d", &x1, &y1, &x2, &y2)

	dx := x2 - x1
	dy := y2 - y1

	x3 := x2 - dy
	y3 := y2 + dx

	x4 := x3 - dx
	y4 := y3 - dy

	fmt.Fprintf(out, "%d %d %d %d", x3, y3, x4, y4)
	fmt.Fprintln(out)
}


Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <random>

using ll = long long int;
using P = std::pair<ll, int>;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int l[30];
ll c[30],s[400][30];
std::vector<P> v;

int main(void){
	int d,i,j,n=26;
	ll ansm = -INFLL;
	std::cin >> d;
	for(i=0; i<n; ++i){
		l[i] = -1;
		std::cin >> c[i];
	}
	for(i=0; i<d; ++i){
		for(j=0; j<n; ++j){
			std::cin >> s[i][j];
		}
	}
	for(i=0; i<d; ++i){
		for(j=0; j<n; ++j){
			v.push_back(P(s[i][j]+c[j]*(i-l[j]),j+1));
		}
		std::sort(v.begin(),v.end(),std::greater<P>());
		std::cout << v[0].second << std::endl;
		l[v[0].second-1] = i;
	}
	return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
using lll = uint64_t;
using namespace std;

// TLE?
// overflow ?
int main() {
    fastIO;
    lll a, b, c;
    cin >> a >> b >> c;

    lll total = a * b * c;

    vector<lll> partial;
    partial.push_back((a / 2) * b * c);
    partial.push_back((a / 2 + 1) * b * c);

    partial.push_back((b / 2) * c * a);
    partial.push_back((b / 2 + 1) * c * a);

    partial.push_back((c / 2) * a * b);
    partial.push_back((c / 2 + 1) * a * b);

    lll min_diff = total;
    for (auto red : partial) {
        lll blue = total - red;
        lll diff = max(red, blue) - min(red, blue);
        // cout << "red = " << red << endl;
        // cout << "blue = " << blue << endl;
        // cout << "abs(red - blue) = " << diff << endl;

        min_diff = min(min_diff, diff);
    }
    cout << min_diff << endl;
}


Measured memory_bytes: 3588
h,w,a,b=map(int,input().split())
x=''
y=''
for i in range(a):
  x+='1'
  y+='0'
for i in range(w-a):
  x+='0'
  y+='1'
for i in range(b):
  print(x)
for i in range(h-b):
  print(y)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)//iをaからn
#define per(i,a,n) for (int i=a-1;i>=n;i--)//iをnからa
#define db(x) cout << #x << " = " << x << endl
#define db2(x, y) cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"; //デバッグ用
#define all(x) (x).begin(), (x).end()
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007 //10^9+7:合同式の法
 
 
//sort(all(a)); ソート
//sort(all(a),greater<int>()); 逆順ソート
 
int main() {
  string s;
  cin >>s;
  
  cout<<s;
  if(s.at(s.size()-1) =='s'){
      cout<<"es";
  }else{
      cout<<"s";
  }
 return 0;
}

Measured memory_bytes: 3628
#pragma GCC target ("avx2")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("O3")
#include "bits/stdc++.h"
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
typedef long long ll;
const ll MOD = 1'000'000'007LL; /*998'244'353LL;*/
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
const int dx[4]={ 1,0,-1,0 };
const int dy[4]={ 0,1,0,-1 };

int X;

signed main(){
    cin >> X;
    cout << 10 - X/200 << endl;
}

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

using namespace std;
#define ll long long
ll dp[100000+50];
ll arr[100000+5];
int n;
ll minSum(ll i){
    if(i>=n) return 0;
    if(dp[i]!=-1) return dp[i];
    ll mn=1e18;
    if(i+1<n) mn=min(mn,minSum(i+1)+abs(arr[i]-arr[i+1]));
    if(i+2<n) mn=min(mn,minSum(i+2)+abs(arr[i]-arr[i+2]));
    if(mn==1e18) return 0;
    return dp[i]=mn;
}
int main()
{
    cin>>n;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    cout<<minSum(0);
    return 0;
}


Measured memory_bytes: 4864
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<class T>
istream &operator>>(istream &is, vector<T> &v) {
  for (T &x : v)
    is >> x;
  return is;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

const int P = 1000000007;

int norm(int x) { return x >= P ? (x - P) : x; }

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

void sub(int &x, int y) { if ((x -= y) < 0) x += P; }

void exGcd(int a, int b, int &x, int &y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exGcd(b, a % b, y, x);
  y -= a / b * x;
}

int inv(int a) {
  int x, y;
  exGcd(a, P, x, y);
  return norm(x + P);
}

struct Node {
  int tag, sum;
  int ls, rs;
};

const int L = 20;

Node Q[L << L];
int top, ans, totans, h;

void apply(int o, int x) {
  Q[o].tag = Q[o].tag * (ll) x % P;
  Q[o].sum = Q[o].sum * (ll) x % P;
}

void pd(int o) {
  if (Q[o].tag != 1) {
    apply(Q[o].ls, Q[o].tag);
    apply(Q[o].rs, Q[o].tag);
    Q[o].tag = 1;
  }
}

int cr(int o, int l, int r, int k) {
  int p = ++top;
  Q[p].tag = 1;
  if (l == r) {
    Q[p].sum = o;
    return p;
  }
  int mid = (l + r) >> 1;
  if (k <= mid) {
    Q[p].ls = cr(o << 1, l, mid, k);
    Q[p].sum = Q[Q[p].ls].sum * (ll) o % P;
  } else {
    Q[p].rs = cr(o << 1 | 1, mid + 1, r, k);
    Q[p].sum = Q[Q[p].rs].sum * (ll) o % P;
  }
  return p;
}

int mer(int x, int y, int o, int l, int r) {
  if (!x || !y) return x | y;
  pd(x);
  pd(y);
  ans = (ans + (Q[Q[x].ls].sum * (ll) Q[Q[y].rs].sum + Q[Q[x].rs].sum * (ll) Q[Q[y].ls].sum) % P * o) % P;
  add(Q[x].sum, Q[y].sum);
  int mid = (l + r) >> 1;
  Q[x].ls = mer(Q[x].ls, Q[y].ls, o << 1, l, mid);
  Q[x].rs = mer(Q[x].rs, Q[y].rs, o << 1 | 1, mid + 1, r);
  return x;
}

int solve(int o, int l, int r) {
  if (l == r) {
    int x;
    cin >> x;
    int ret = cr(1, 1, 1 << h, x);
    apply(ret, o);
    return ret;
  }
  int mid = (l + r) >> 1;
  int ls = solve(o << 1, l, mid);
  int rs = solve(o << 1 | 1, mid + 1, r);
  int p = mer(ls, rs, 1, 1, 1 << h);
  totans = (totans + ans * (ll) o) % P;
  ans = 0;
  apply(p, o);
  return p;
}

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> h;
  --h;
  solve(1, 1, 1 << h);
  cout << totans << '\n';

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


Measured memory_bytes: 40068
/*
 *
 *
 */

#include <bits/stdc++.h>

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i = (int)(a); i < (int)(b); ++i)
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;



int main() {
  int n;
  int h1, h2, m1, m2, s1, s2;
  while(cin >> n, n){
    vi cnt(24 * 60 * 60, 0);
    REP(i, n){
      scanf("%2d:%2d:%2d %2d:%2d:%2d", &h1, &m1, &s1, &h2, &m2, &s2);
      int first = h1 * 60 * 60 + m1 * 60 + s1;
      int second = h2 * 60 * 60 + m2 * 60 + s2;
      FOR(t, first, second){
        cnt[t]++;
      }
    }

    cout << *max_element(ALL(cnt)) << endl;
  }
}

Measured memory_bytes: 3484
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

void solve()
{

}

int main()
{ios_base::sync_with_stdio(false);
cin.tie(0);
int a,b,c,k;
cin>>a>>b>>c>>k;

while(k--)
{
	if(b<=a)b*=2;
	else c*=2;
}

if(a<b&&b<c)
{
	ol("Yes");
}
else
{
	ol("No");
}

return 0;
}



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

using namespace std;

const long long INF = 1LL << 60;

int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ans = max(a*b,c*d);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256