akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

struct edge {
    int to, cost;
};

int V;
vector<edge> G[1000000];

plglg visit(int pre, int v) {
    plglg ans(0, v);
    queue<tlglglg> que;
    tlglglg start(-1, v, 0);
    que.push(start);
    while (que.size() > 0) {
        tlglglg p;
        p = que.front();
        que.pop();
        ll back = get<0>(p);
        ll now = get<1>(p);
        ll weight = get<2>(p);
        int n = G[now].size();
        for (int i = 0; i < n; i++) {
            edge e = G[now][i];
            if (e.to != back) {
                tlglglg pp(now, e.to, weight + e.cost);
                que.push(pp);
                if (weight + e.cost > ans.first) {
                    ans.first = weight + e.cost;
                    ans.second = e.to;
                }
            }
        }
    }
    return ans;
}

pii farthest;

ll diameter() {
    plglg r = visit(-1, 0);
    plglg t = visit(-1, r.second);
    farthest.first = r.second;
    farthest.second = t.second;
    return t.first;
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int s, t, w;
        cin >> s >> t >> w;
        edge e1;
        e1.to = t;
        e1.cost = w;
        G[s].push_back(e1);
        edge e2;
        e2.to = s;
        e2.cost = w;
        G[t].push_back(e2);
    }
    ll ans = diameter();
    cout << ans << endl;
}



Measured memory_bytes: 31296
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,k,ans;
int x,y;
signed main(){
	cin>>n;
	for(int i=1;i*i<=n-1;i++){
		if((n-1)%i==0){
			if(i*i!=n-1)ans+=2;
			else ans++;
		}
	}
	ans--;
	for(int i=2;i*i<=n;i++){
		if(n%i==0){
			int n2=n;
			while(n2%i==0){
				n2/=i;
			}
			if(n2%i==1)ans++;
		}
	}
	ans++;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
import heapq
from collections import defaultdict as dd

X, Y, Z, K = [int(i) for i in input().split()]
ABCList = [sorted([int(i) for i in input().split()], reverse=True) for _ in range(3)]

pQ = []
heapq.heappush(pQ, [sum(ABC[0] for ABC in ABCList) * (-1), [0, 0, 0]])
QDict = dd(int)
QDict[(0, 0, 0)] = 1
for _ in range(K):
    item = heapq.heappop(pQ)
    print(item[0] * (-1))
    abc = item.copy()[1]
    for i, element in enumerate(abc):
        abcTemp = abc.copy()
        abcTemp[i] += 1
        if abcTemp[i] < len(ABCList[i]) and QDict[tuple(abcTemp)] == 0:
            newItem = [sum([ABCList[i][abcTemp[i]] for i in range(3)]) * (-1), abcTemp]
            heapq.heappush(pQ, newItem)
            QDict[(tuple(abcTemp))] = 1


Measured memory_bytes: 5464
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef double db; 
typedef string str;
 
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
 
typedef vector<int> vi; 
typedef vector<bool> vb; 
typedef vector<ll> vl; 
typedef vector<db> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
 
#define sz(x) (int)(x).size()
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define sor(x) sort(all(x))
#define ins insert 
#define ft front() 
#define bk back()
#define pf push_front 
#define pb push_back
#define endl '\n'
 
const ll MOD = 998244353;
const ll INF = 1e18;

int main() {
   ios_base::sync_with_stdio(false); cin.tie(nullptr);
   ll n, x; int m; cin >> n >> x >> m;
   vi a;
   unordered_set<int> used;
   while (used.count(x) == 0) {
      a.pb(x);
      used.insert(x);
      x = x * x % m;
   }
   int s = 0;
   while (a[s] != x)
      s++;
   ll ans = 0;
   for (int i = 0; i < s; i++)
      ans += a[i];
   ll q = (n - s) / (sz(a) - s);
   int r = (n - s) % (sz(a) - s);
   for (int i = 0; i < r; i++)
      ans += a[s + i];
   ll cur = 0;
   for (int i = s; i < sz(a); i++)
      cur += a[i];
   ans += q * cur;
   cout << ans;
   return 0;
}

Measured memory_bytes: 5456
loop  do
    n, m = gets.split.map(&:to_i)
    break if n == 0
    h = Hash.new(0)
    n.times do
        d, v = gets.split.map(&:to_i)
        h[d] = v if v > h[d]
    end
    p (1..m).map {|d| h[d]}.inject(:+)
end


Measured memory_bytes: 6872
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;



int main(void){
    int ans=0;
    int n,x;
    cin>>n>>x;
    vector<int>a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end());
    for(int i=0;i<n;i++){
        if(x<a[i]){
            cout<<ans<<endl;
            return 0;
        }
        else {
            x-=a[i];
            ans++;
        }
    }
    if(x>0)cout<<ans-1<<endl;
    else cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
const int N = 2e5 + 87;
int n, c[N], lt[N], rt[N], tp, sz[N];
vector<int> g[N], g2[N];
vector<int> t[N];
void dfs(int u, int p)
{
    t[c[u]].push_back(u);
    auto it = find(g[u].begin(), g[u].end(), p);
    if (it != end(g[u]))
        g[u].erase(it);
    lt[u] = tp++;
    sz[u] = 1;
    for (int v : g[u])  {
        dfs(v, u);
        sz[u] += sz[v];
    }
    rt[u] = tp;
}
bool in (int u, int v)
{
    return lt[v] <= lt[u] && rt[u] <= rt[v];
}
void build_g2(vector<int> & a)
{
    // sort(a.begin(), a.end(), [&] (int i, int j) {return lt[i] < lt[j];});
    // already sorted!
    vector<int> st = {0};
    g2[0].clear();
    for (int u : a) {
        while (!in(u, st.back()))
            st.pop_back();
        g2[st.back()].push_back(u);
        st.push_back(u);
    }
}
ll gao(int u)
{
    ll ret = 0;
    int i = 0;
    ll s = g[u].size() ? sz[g[u][0]] : 0;
    for (int v : g2[u]) {
        while (i < g[u].size() && !in(v, g[u][i])) {
            ret += s * (s + 1) / 2;
            ++i;
            if (i < g[u].size())
                s = sz[g[u][i]];
        }
        s -= sz[v];
        ret += gao(v);
    }
    while (i < g[u].size()) {
        ret += s * (s + 1) / 2;
        ++i;
        if (i < g[u].size())
            s = sz[g[u][i]];
    }
    return ret;
}
ll solve(vector<int> & a)
{
    build_g2(a);
    return n * (n + 1ll) / 2 - gao(0);
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> c[i];
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    g[0].push_back(1);
    dfs(0, 0);
    for (int i = 1; i <= n; ++i)
        cout << solve(t[i]) << '\n';
}

Measured memory_bytes: 46576
#include<stdio.h>
int main(void)
{
    int i , h , m , s;
    scanf("%d",&i);
    h = i / 3600;
    m = (i % 3600) / 60;
    s  = i % 60;
    printf("%d:%d:%d\n",h,m,s);
    return 0 ;
}

Measured memory_bytes: 592
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline
from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1


N = int(input())
D = list(map(int, input().split()))
D = sorted(D)
#
# counter = 0
# for i in range(D[N // 2], D[N // 2 - 1], -1):
#     counter += 1

print(D[N // 2] - D[N // 2 - 1])


Measured memory_bytes: 14368
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int n;
	cin >> n;

	vector<Int> a(n);
	for (Int i = 0; i < n; i++) {
		cin >> a[i];
	}

	vector<Int> ans(n);
	Int count;
	if (n % 2) {
		count = 0;
		for (Int i = n/2; i >=0; i--) {
			ans[i] = a[count];
			count += 2;
		}
		count = 1;
		for (Int i = n/2+1; i < n; i++) {
			ans[i] = a[count];
			count += 2;
		}
	}
	else {
		count = 0;
		for (Int i = n/2; i < n; i++) {
			ans[i] = a[count];
			count += 2;
		}
		count = 1;
		for (Int i = n / 2-1; i >= 0; i--) {
			ans[i] = a[count];
			count += 2;
		}
	}

	for (Int i = 0; i < n; i++) {
		printf("%lld ", ans[i]);
	}

}

Measured memory_bytes: 5376
#include<cstdio>
static const int kMaxVertices = 100;
static const int kInfinity = 100010;
static int Adjacency_matrix[kMaxVertices][kMaxVertices];

void InitializeCostMatrix(int nmbr_of_rows, int nmbr_of_columns){
	for (int row = 0; row < nmbr_of_rows; ++row) {
		for (int column = 0; column < nmbr_of_columns; ++column)
			Adjacency_matrix[row][column] = kInfinity;
	}
}

void Dijkstra(int n){
	bool has_not_been_discovered[kMaxVertices];
	int lowest_cost_route[kMaxVertices];
	int parent[kMaxVertices];
	for (int i = 0; i < n; ++i)	{
		has_not_been_discovered[i] = true;
		lowest_cost_route[i] = kInfinity;
	}
	lowest_cost_route[0] = 0;
	parent[0] = -1;

	while(true) {
		int mincost = kInfinity;
		int vertex_to_add;
		for (int i = 0; i < n; ++i)	{
			if(has_not_been_discovered[i] && lowest_cost_route[i] < mincost){
				mincost = lowest_cost_route[i];
				vertex_to_add = i;
			}
		}

		if(mincost == kInfinity)
			break;

		has_not_been_discovered[vertex_to_add] = false;
		int vertex_added = vertex_to_add;

		for (int i = 0; i < n; ++i)	{
			if(has_not_been_discovered[i] && lowest_cost_route[vertex_added] + Adjacency_matrix[vertex_added][i] < lowest_cost_route[i]) {
				lowest_cost_route[i] = lowest_cost_route[vertex_added] + Adjacency_matrix[vertex_added][i];
				parent[i] = vertex_added;
			}
		}
	}
	for (int i = 0; i < n; ++i)
		printf("%d %d\n", i, lowest_cost_route[i]);
}

int main() {
	int nmbr_of_vertices;
	scanf("%d", &nmbr_of_vertices);
	InitializeCostMatrix(nmbr_of_vertices, nmbr_of_vertices);
	for (int vertex_from_i = 0; vertex_from_i < nmbr_of_vertices; ++vertex_from_i) {
		int vertex_from_id, degree_out;
		scanf("%d %d", &vertex_from_id, &degree_out);
		for (int vertex_to_i = 0; vertex_to_i < degree_out; ++vertex_to_i) {
			int vertex_to_id, cost;
			scanf("%d %d", &vertex_to_id, &cost);
			Adjacency_matrix[vertex_from_id][vertex_to_id] = cost;
		}
	}
	Dijkstra(nmbr_of_vertices);
	return 0;
}

Measured memory_bytes: 2744
use proconio::input;

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

    let mut ans10: i64 = 1;
    let mut ans9: i64 = 1;
    let mut ans8: i64 = 1;
    let m: i64 = 1000000007;

    for _ in 0..n {
        ans10 = ans10 * 10 % m;
        ans9 = ans9 * 9 % m;
        ans8 = ans8 * 8 % m
    }

    let ans = (ans10 - ans9 + m - ans9 + m + ans8) % m;
    println!("{}", ans);
}


Measured memory_bytes: 2172
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF    	((ll)1ll<<60)
#define INF     	((int)1<<30)
#define EPS     	(1e-9)
#define MOD     	(1000000007ll)
#define fcout(a)	cout<<setprecision(a)<<fixed
#define fs 			first
#define sc			second
#define PI			3.1415926535897932384

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s; a=0;} return os;}
void OUT(bool b){cout<<(b?"YES":"NO")<<endl;}
void Out(bool b){cout<<(b?"Yes":"No")<<endl;}
void out(bool b){cout<<(b?"yes":"no")<<endl;}
int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int clz(int x) { return 31 - __builtin_clz(x); }
int clz(ll x) { return 63 - __builtin_clzll(x); }
int ctz(int x) { return __builtin_ctz(x); }
int ctz(ll x) { return __builtin_ctzll(x); }

class compare {
public:
	bool operator()(tuple<ll, ll> a, tuple<ll, ll> b) {
		return (get<1>(a) > get<1>(b));
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	vl x(n),y(n);
	rep(i,n){
		char c;
		cin>>x[i]>>y[i]>>c;
		if(c=='W')y[i]+=k;
		x[i]%=2*k;
		y[i]%=2*k;
	}
	vvl tb(3*k+1,vl(3*k+1,0));
	rep(i,n){
		tb[x[i]][y[i]]++;
		tb[x[i]+k][y[i]]--;
		tb[x[i]][y[i]+k]--;
		tb[x[i]+k][y[i]+k]++;
	}
	rep(i,3*k+1){
		range(j,1,3*k+1){
			tb[i][j]+=tb[i][j-1];
		}
	}
	range(i,1,3*k+1){
		rep(j,3*k+1){
			tb[i][j]+=tb[i-1][j];
		}
	}
	ll ans=0;
	ll mx=0;
	rep(i,3*k){
		rep(j,3*k){
			if(i>=2*k||j>=2*k)tb[i%(2*k)][j%(2*k)]+=tb[i][j];
		}
	}
	rep(i,2*k){
		rep(j,2*k){
			//ll tmp=0;
			//cout<<i+k-1<<" "<<j+k-1<<" "<<((i+k)%(2*k)+k-1)<<" "<<((j+k)%(2*k)+k-1)<<endl;
			//tmp=tb[i+k-1][j+k-1]+tb[(i+k)%(2*k)+k-1][(j+k)%(2*k)+k-1];
			ans=max(ans,tb[i][j]+tb[(i+k)%(2*k)][(j+k)%(2*k)]);
		}
	}
	cout<<ans<<endl;
	rep(i,3*k+1){
		rep(j,3*k+1){
			//cout<<tb[i][j]<<" ";
		}
		//cout<<endl;
	}
}


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

int main() {
  int N,K,Z=1;
  cin >> N >> K;
  for(int i=0;i<N;i++){
    if(2*Z <= Z+K){
      Z *= 2;
    }
    else{
      Z += K;
    }
  }
  cout << Z << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] a) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String line;
		try {
			while ((line = br.readLine()) != null) {
				String[] vals = line.split(" ");
				double[] nums = new double[vals.length];
				for (int i = 0; i < vals.length; i++) {
					nums[i] = Double.parseDouble(vals[i]);
				}

				double x = (nums[2] * nums[4] - nums[1] * nums[5]) / (nums[0] * nums[4] - nums[1] * nums[3]) + 0;
				double y = (nums[2] * nums[3] - nums[0] * nums[5]) / (nums[1] * nums[3] - nums[0] * nums[4]) + 0;

				System.out.println(String.format("%.3f %.3f", x, y));
			}
		} catch (Exception e) {
		}
	}
}

Measured memory_bytes: 24748
using System;

namespace B___Golden_Coins
{
    class Program
    {
        static void Main(string[] args)
        {
            var X = int.Parse(Console.ReadLine());
            var i = X / 500;
            var j = X % 500 / 5;

            Console.WriteLine(i * 1000 + j * 5);
        }
    }
}


Measured memory_bytes: 27232
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string a,b;
    cin>>a>>b;
    int l1=a.length();
    int l2=b.length();
    vector<vector<int>> dp(l1+1,vector<int>(l2+1));
    for(int i=1;i<=l1;i++)
    {
        for(int j=1;j<=l2;j++)
        {
            if(a[i-1]==b[j-1])
            {
                dp[i][j]=1+dp[i-1][j-1];
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
    int i=l1;
    int j=l2;
    string ans;
    while(i>=1&&j>=1)
    {
        if(a[i-1]==b[j-1])
        {
            ans.push_back(a[i-1]);
            i--;
            j--;
        }
        else if(dp[i-1][j]==dp[i][j])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    reverse(ans.begin(),ans.end());
    cout<<ans;
}

Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e3 + 5;
int dp[MAXN][MAXN];
int par[MAXN][MAXN];
string s, t;
int lcs(int i, int j){
    if(i < 0 || j < 0) return 0;
    if(dp[i][j] != -1) return dp[i][j];
    int k = lcs(i, j - 1);
    int p = lcs(i - 1, j);
    int res = max(k, p);
    par[i][j] = 1;
    if(k > p) par[i][j] = 0;
    if(s[i] == t[j]){
        res = lcs(i - 1, j - 1) + 1;
        par[i][j] = 2;
    }
    return dp[i][j] = res;
}
int main(){
    cin >> s >> t;
    memset(dp, -1, sizeof(dp));
    int n = s.size();
    int m = t.size();
    lcs(n - 1, m - 1);
    string ans = "";
    int i = n - 1, j = m - 1;
    while(i >= 0 && j >= 0){
        if(par[i][j] == 2){ ans += s[i]; i--, j--;}
        else{
            if(par[i][j] == 1) i--;
            else j--;
        }
    }
    reverse(ans.begin(), ans.end());
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 71296
//????????????????????°????°?. ????§??????????????????????. ????????°??????????????§, ?????????????????????????????°??????????????????.
#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>
#include <vector>
#define int long long
using namespace std;

int n, m, r, q;
vector<int> et[100001];
vector<int> ec[100001];
int minDist[10][100001];
int x, y, z;

signed main() {
	cin >> n >> m >> r >> q;
	for (int i = 0; i < m; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		et[b].push_back(a);
		ec[b].push_back(c);
	}
	
	for (int i = 0; i < r; i++) {
		for (int j = 0; j <= n; j++) {
			minDist[i][j] = 1145141919893810;
		}
	}
	
	typedef pair<int, int> P;
	priority_queue<P, vector<P>, greater<P> > que;
	
	for (int i = 0; i < r; i++) {
		for (int j = i; j <= n; j += r) {
			que.push(P(0, j));
		}
		while (!que.empty()) {
			P now = que.top(); que.pop();
			int cst = now.first;
			int v = now.second;
			if (minDist[i][v] <= cst) continue;
			minDist[i][v] = cst;
			
			for (int j = 0; j < et[v].size(); j++) {
				que.push(P(cst + ec[v][j], et[v][j]));
			}
		}
	}
	
	int ans = 0;
	for (int i = 0; i < q; i++) {
		cin >> x >> y >> z;
		
		int cst = z;
		for (int j = 0; j < r; j++) {
			cst = min(cst, minDist[j][x] + minDist[j][y]);
		}
		ans += z - cst;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 21904
#include <stdio.h>

int main() {
    int n;
    int a, b, c, d;
    while (~scanf("%d", &n)) {
        int cnt = 0;
        for (int a = 0; a <= 9; a++) {
            for (int b = 0; b <= 9; b++) {
                for (int c = 0; c <= 9; c++) {
                    d = n - (a + b + c);
                    if (d >= 0 && d <= 9) {
                        cnt++;
                    }
                }
            }
        }
        printf("%d\n", cnt);
    }
    return 0;
}



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

int main(){
	while(true){
		int n;
		cin>>n;
		if(n==0) return 0;
		int a[105] = {0};
		for(int i = 0; i < n; i++){
			string s;
		 	cin >>s;
		 	if(s=="lu") a[i]=0;
		 	if(s=="ru") a[i]=1;
		 	if(s=="ld") a[i]=2;
		 	if(s=="rd") a[i]=3;
  		}
  		int ans = 0;
  		if(n==1){
  			cout<<"0"<<endl;
  			goto e;
  		}
  		for(int i = 0; i < n-1;i++){
  			if(a[i] < 2){
  				if(a[i+1]!=a[i]&&a[i+1]<2) ans++;
  			}
  			else{
  				if(a[i+1]!=a[i]&&a[i+1]>=2) ans++;
  			}
  		}
  		cout<<ans<<endl;
  		e:;
	}
	return 0;
}


Measured memory_bytes: 3164
h, w = map(int, input().split())
s = [list(str(input())) for i in range(h)]
for i in range(0, h) :
        for j in range(0, w) :
                a = 0
                if s[i][j] == '.' :
                        if i > 0 :
                                if j > 0 and s[i-1][j-1] == '#' :
                                        a += 1 
                                if s[i-1][j] == '#' :
                                        a += 1 
                                if j < w-1 and s[i-1][j+1] == '#' :
                                        a += 1 
                        if j > 0 and s[i][j-1] == '#' :
                                a += 1 
                        if j < w-1 and s[i][j+1] == '#' :
                                a += 1 
                        if i < h-1 :
                                if j > 0 and s[i+1][j-1] == '#' :
                                        a += 1 
                                if s[i+1][j] == '#' :
                                        a += 1 
                                if j < w-1 and s[i+1][j+1] == '#' :
                                        a += 1 
                        s[i][j] = str(a)
for i in range(h) :
        print(''.join(s[i]))

Measured memory_bytes: 3188
N = int(input())
a = list(map(int,input().split()))
a.sort()
x = [10**9+1,0]
y = [10**9+1,0]
z = [10**9+1,0]
for i in range(N):
    if x[0] == a[i]:
        x[1] += 1
    else:
        if x[1] == 0:
            x[0] = a[i]
            x[1] += 1
        elif y[0] == a[i]:
            y[1] += 1
        else:
            if y[1] == 0:
                y[0] = a[i]
                y[1] += 1
            elif z[0] == a[i]:
                z[1] += 1
            else:
                if z[1] == 0:
                    z[0] = a[i]
                    z[1] += 1

ans = 'No'
if x[0] == 0:
    if x[1] == N:
        ans = 'Yes'
    elif x[1]*2 == y[1] and x[1] + y[1] == N:
        ans = 'Yes'
if x[1] == y[1] == z[1] and x[1] + y[1] + z[1] == N and x[0]^y[0]^z[0] == 0:
    ans = 'Yes'

print(ans)

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

int three(int n){
    n = n*n*n;
    return n;
}

int four(int n){
    n = n*n*n*n;
    return n;
}

int ans(int x,int y){
    int z = (four(x)+three(x)*y+x*x*y*y+x*three(y)+four(y))*(x-y);
    return z;
}


int main(){
    int x;
    cin >> x;
    /* vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) {
                ret.push_back(n / i);
                ++c;
            }
        }
    }

    sort(ret.begin(), ret.end()); */
    if(x==1){
        cout << 0 << " " << -1 << "\n";
        return 0;
    }
    for(int i=-1000; i<1000; ++i){
        for(int j=-1000; j<1000; ++j){
            if(ans(i,j)==x){
                cout << i << " " << j << "\n";
                return 0;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#define MOD 1000000007
typedef long long ll;

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<int> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    
    int ans = 0;
    for(int i = 0; i < n; i++) {
        if(v[i] >= k) {
            ans++;
        }
    }
    
    cout << ans << endl;
    
    return 0;
}



Measured memory_bytes: 640
d = int(input()) #日にちは-1indexで
c = list(map(int, input().split()))
csum = 0
for i in range(26):
    csum += c[i]
s = [ [] for _ in range(d)]
for i in range(d):
    s[i] = list(map(int, input().split()))
t = [0 for _ in range(d)]
lastDI = [-1 for _ in range(26)]
for i in range(d):
    maxp = -1001002003
    for j in range(26):
        tmp = s[i][j]
        for k in range(26):
            if (j != k):
                tmp -= c[k]*(i-lastDI[k])
        if (tmp > maxp):
            maxp = tmp
            t[i] = j
    lastDI[t[i]] = i
    print(t[i]+1)

Measured memory_bytes: 9372
while True:
	s = input().rstrip().split(' ')
	a = int(s[0])
	b = int(s[2])
	op = s[1]
	if op == "?":
		break
	elif op == "+":
		print(str(a + b))
	elif op == "-":
		print(str(a - b))
	elif op == "*":
		print(str(a * b))
	elif op == "/":
		print(str(int(a / b)))

Measured memory_bytes: 7628
#include <cassert>
#include <iostream>
#include <algorithm>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <complex>
#include <iomanip>
#include <bitset>
#include <random>
using namespace std;
using i64 = int_fast64_t;

int n;
i64 p,q;
i64 c[1<<20];
i64 shosum[1<<20];

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

    cin>>n>>p>>q;
    i64 corr=p*n*(n-1)/2;

    for(int i=0; i<n; ++i) {
        cin>>c[i];
        c[i]+=p*i;
    }
    
    i64 ans=-2e18;
    vector<i64> sho(c,c+n);
    sort(rbegin(sho),rend(sho));
    for(int i=0; i<n; ++i) shosum[i+1]=shosum[i]+sho[i];

    for(i64 jis=0,k=0; k<=n; jis+=p*(q+k*2),++k) {
        i64 tei=shosum[n-k];
        ans=max(ans,jis+tei);
    }
    
    ans-=corr;
    cout<<ans<<endl;
}


Measured memory_bytes: 14492
#include <iostream>

int main(){
  int N,Y;
  int x=0,y=0,z=0;
  std::cin >> N >> Y;

for( int i = 0; i <= N  ; i++ )
{
  for( int j = 0; j <= N -i; j++ )
  {
    if(i*10000 + j*5000 + (N - i - j) * 1000 == Y)
    {
    std::cout << i <<" " << j << " "<<(N - i - j) << std::endl;
    return 0;
  }
  }
}

std::cout << -1 <<" " << -1 << " "<< -1<< std::endl;
return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio (false) ;cin.tie(NULL);
#define tc  int t;cin>>t;for(int i=0;i<t;i++)
#define ll long long int
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define um(a,b) unordered_map<a,b>
#define vv(a) vector<a>
#define pp(a,b) pair<a,b>
ll power(ll a,ll b,ll mod){  ll ans=1;  while(b>0){
  if(b&1){ ans=(ans*a)%mod;} a=(a*a)%mod;  b=b/2; } return ans;}
#define imax 10000005
ll arr[imax];
void pre(){
  for(ll i=1;i<imax;i++){
    arr[i]=i;
  }
  for(ll i=2;i<imax;i+=2){
    arr[i]=2;
  }
  for(ll i=3;i*i<imax;i++){
    if(arr[i]==i){
        for(int j=i*2;j<imax;j+=i){
            arr[j]=i;
        }
    }
  }
  return ;
}
ll find(ll num){
  map<ll,ll>mymap;
  while(num>1){
    mymap[arr[num]]++;
    num=num/arr[num];
  }
  ll ans=1;
  for(auto k:mymap){
    ans=ans*(k.second+1);
  }
  return ans;

}
int main(){
FIO
 pre();
 ll n;
 cin>>n;
 ll ans=0;
 for(ll i=1;i<=n;i++){
    ll s=find(i);
    ans+=(i*s);
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 81764
#include <stdio.h>
int main() {
    char c;
    scanf("%c", &c);

    if(c >= 65 && c <= 90){
        printf("A\n");
    }
    else if(c >= 97 && c <= 122){
        printf("a\n");
    }
    else{
	}

    return 0;
}

Measured memory_bytes: 3120
#include<bits/stdc++.h>
using namespace std;
    int sum(int x)
    {
        int suma = 0;
        while(x)
        {
            suma += x % 10;
            x /= 10;

        }
        return suma;
    }
    main()
    {
        int n;
        cin >> n;
        int a, b;
        int ans = 1e9;
        int javob = 1e9;
        for(int i = 1; i <=n/2;i++){
             a = n - i;
             b = i;
             ans  = sum(a) + sum(b);

             javob = min(ans,javob);
        }
        cout << javob;



    }


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

if N % 2 == 1:
    ans = 0
else:
    div2 = N // 2
    n = N // 2
    k = 1
    while n // 2**k > 0:
        div2 += n // 2**k
        k += 1

    div5 = 0
    n = N // 2
    k = 1
    while n // 5**k > 0:
        div5 += n // 5**k
        k += 1
    
    ans = min(div2, div5)

print(ans)

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

int main(){
  int N;
  cin >> N;
  
  vector<int> data(N);
  
  for(int i = 0 ; i < N ; i++){
    cin >> data.at(i);
  }
  
  sort(data.begin(),data.end());
  
  int sum = 0;
  for(int i = 0; i < N - 1; i++){
    sum += data.at(i);
  }
  
  if(sum > data.at(N - 1)){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int x, A, B, AB, O;
	string s;
	char c;
	A = B = AB = O = 0;
	while (cin >> x >> c >> s) {
		if (s == "A")A++;
		else if (s == "B")B++;
		else if (s == "AB")AB++;
		else O++;
	}
	cout << A << endl << B << endl << AB << endl << O << endl;
	return 0;
}

Measured memory_bytes: 1204
#include<stdio.h>
#include<stdlib.h>

void Countingsort(int *,int *,int);

int n;

int main(){
  int i,k=0;
  int *pa,*pb;

  scanf("%d",&n);

  pa=(int*)malloc((n+1)*sizeof(int));
  pb=(int*)malloc((n+1)*sizeof(int));

  for(i=1;i<=n;i++){
    scanf("%d",&pa[i]);
    if(k<pa[i]){
      k=pa[i];
    }
  }

    Countingsort(pa,pb,k);

    return 0;
  }

void Countingsort(int *a,int *b,int k){
  int i,j,c[10001];

  for(i=0;i<=k;i++){
    c[i]=0;
  }

    for(j=1;j<=n;j++){
      c[a[j]]++;
    }

    for(i=1;i<=k;i++){
      c[i]=c[i]+c[i-1];
    }

    for(j=n;j>=1;j--){
      b[c[a[j]]]=a[j];
      c[a[j]]--;
    }

    for(i=1;i<=n;i++){
      if(i==n){
	printf("%d\n",b[i]);
      }
	else{
	  printf("%d ",b[i]);
	}
      }

}



Measured memory_bytes: 17376
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<pair<long long,long long>> p;
bool flag[100010];
int par[100010];
int find(int a){
	if(par[a]==a) return a;
	return par[a] = find(par[a]);
}
int main(){
	int i,n,m;
	cin >> n >> m;
	for(i=0;i<n;i++){
		long long a,b; cin >> a >> b;
		p.push_back({b,m - a});
	}
	sort(p.rbegin(),p.rend());
	for(i=0;i<m;i++){
		flag[i] = false;
		par[i] = i;
	}
	long long ans = 0;
	for(i=0;i<n;i++){
		if(p[i].second<0) continue;
		int x = find(p[i].second);
		if(!flag[x]){
			flag[x] = true;
			ans += p[i].first;
			if(x!=0){
				par[x] = find(x - 1);
			}
		}
	}
	cout << ans << endl;
}

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


int main(void){
  int H, W;
  cin >> H >> W;
  vector<vector<char>>coordinate(H,vector<char>(W));
  for (int i = 0; i<H;i++){
    for (int j = 0; j<W;j++){
      cin >> coordinate.at(i).at(j);
    }
  }
  const int dx[4] = {1,0,-1,0};
  const int dy[4]= {0,1,0,-1};
  int m = 0;
  for (int i = 0; i<H;i++){ // 1回目のfor
    for (int j = 0; j<W;j++){// 2回目のfor
      if(coordinate[i][j] == '#'){//一回目のif
        int num = 0;
        for (int k = 0;k<4;k++){ //3回目のfor
        const int ni = i + dy[k];
        const int nj = j + dx[k];
        if (ni <0 ||ni>=H)
          continue;
        if (nj <0 ||nj>=W)
          continue;
        if(coordinate[ni][nj] == '#'){
          num ++;
          }
        }// 3回目終わり
        if (num ==0){
          m++;
          break;
        }
        else if (i == H-1 && j == W-1){
          cout << "Yes" << endl;
          break;
        }
        
        else
          continue;
      }//1回目if 終わり
      else if (i==H-1&& j == W-1){
        cout << "Yes"<<endl;
        break;
      }
      else
        continue;
    }//二回目終わり
   if (m == 0){
     continue;
   }
    else{
      cout << "No" << endl;
      break;
    }
    
  
    
  }//1回目終わり
}
  
      
        

        

          



        


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using pii = pair<ll, ll>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vs = vector<string>;
using vp = vector<pii>;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (ll)((x).size())
#define all(x) (x).begin(), (x).end()
#define each(a, x) for (auto&& a : (x))
#define _overload3(_1, _2, _3, name, ...) name
#define rep1(n) rep2(_, n)
#define rep2(i, n) rep3(i, 0, n)
#define rep3(i, a, n) for (ll i = (a); i < (n); ++i)
#define rep(...) _overload3(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
const int INF = 1e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
template<typename T> inline void print(const T& x) {cout << x << "\n";}
template<typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template<typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
struct Init {Init() {cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(10);}} init;

int main() {
    ll t;
    cin >> t;
    rep(t) {
        ll n, m, a, b;
        cin >> n >> m >> a >> b;
        print(floor_sum(n, m, a, b));
    }
}

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

int main()
{
    int N, flag=0;
    cin >> N;
    vector<char> S(N / 2);
    vector<char> S2(N / 2);
    for (int i = 0; i < N / 2;i++){
        cin >> S.at(i);
    }
    for (int i = 0; i < N/2;i++){
        cin >> S2.at(i);
    }
    for (int i = 0; i < N / 2;i++){
        if(S.at(i)!=S2.at(i)){
            flag = 1;
        }
    }
    if(N%2==1){
        cout << "No" << endl;
        return 0;
    }
    if(flag==0){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int n, q;
    string s;
    cin >> n >> s >> q;

    vector<int> k(q);
    rep(i, q) cin >> k[i];

    string d = "DMC";
    vector<vector<int>> dp(4, vector<int>(n+1));
    vector<int> m(n+1);
    dp[0][0] = 1;

    rep(i, n){
        rep(j, 4){
            dp[j][i+1] += dp[j][i];
            if(j < 3 && s[i] == d[j]){
                dp[j+1][i+1] += dp[j][i+1];
            }
        }
        m[i+1] = m[i] + (s[i] == d[1]);
    }

    rep(i, q){
        int ans = 0;

        rep(j, n){
            if(s[j] != 'C'){
                continue;
            }
            int l = max(0LL, j - k[i] + 1);
            int cnt = m[j] - m[l];
            int tmp = dp[2][j] - dp[2][l];
            tmp -= dp[1][l] * cnt;
            ans += tmp;
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 40436
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  string s,t;
  cin >> s;
  cin >> t;
  int ans = 0;
  rep(i,3) {
    if(s[i] == t[i]) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int M,D,ans=0;
  cin >> M >> D;
  for(int j=1;j<M+1;j++){
  for(int i=11;i<D+1;i++){
    if((i/10)*(i%10)==j){
      if(i/10>1&&i%10>1) ans++;
    }
  }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
s = input().split()
s = [c for c in s[0]]

if s[0] == s[1] and s[1] == s[2]:
        print('No')

else:
    for i in range(1, len(s)):
        if s[0] == s[i]:
            buf = i
            break
        else:
            buf = 0
    if buf == 0:
        print('No')
    else:
        nokori = []
        for i in range(1, len(s)):
            if i == buf:
                continue
            else:
                nokori.append(s[i]) 
        if nokori[0] == nokori[1]:
            print('Yes')
        else:
            print('No')

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var a = int.Parse(Console.ReadLine());
        var s = Console.ReadLine();

        if (3200 <= a)
        {
            Console.WriteLine(s);
        }
        else
        {
            Console.WriteLine("red");
        }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
     
    #define fr first
    #define sc second
    #define mk make_pair
    #define pb push_back
    #define ll long long
    #define ld long double
    #define OK puts("OK");
    #define sz(s) (int)s.size()
    #define all(s) s.begin(), s.end()
     
    using namespace std;
     
    const int N = 2e5 + 10;
    const int inf = 1e9 + 7;
     
    ll n, cnt;
    deque <int> dq;
     
    void go(ll a)
    {
        if(a == 1)
            return;
        if(a & 1)
        {
            go(a - 1);
            dq.push_front(++ cnt);
            return;
        }
        go(a / 2);
        dq.pb(++ cnt);
    }
     
    main()
    {
        cin >> n;
        go(n + 1);
        cout << 2 * cnt << endl;
        while(!dq.empty())
            cout << dq.front() << " ", dq.pop_front();
        for(int i = 1 ; i <= cnt ; i ++)
            cout << i << " ";
    }

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

def Base_10_to_n(X, n):
	if (int(X/n)):
		return Base_10_to_n(int(X/n), n)+str(X%n)
	return str(X%n)

ans = 0

for i in range(0, 10**9):
	i_3 = Base_10_to_n(i, 4)
	i_3 = i_3.replace('1', '#')
	i_3 = i_3.replace('2', '5')
	i_3 = i_3.replace('3', '7')
	i_3 = i_3.replace('#', '3')
	i_753 = int(i_3)
	# print(i_753)
	if i_753 <= n and i_3.count('0') == 0 and i_3.count('3')>0 and i_3.count('5')>0 and i_3.count('7')>0:
		ans += 1
	elif i_753 > n:
		break
	else:
		continue

print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
	int N, Y;
	cin >> N >> Y;
	bool ok = false;

	int x, y, z;

	for (x = 0; x <= N; x++) {
		for (y = 0; y <= N - x; y++) {
			z = N - x - y;
			if (10000 * x + 5000 * y + 1000 * z == Y) {
				ok = true;
				break;
			}
		}
		if (ok) break;
	}

	if (ok) cout << x << " " << y << " " << z << endl;
	else cout << "-1 -1 -1" << endl;

	return 0;
}


Measured memory_bytes: 3680
'use strict'
const main = arg => {
	const input = arg.trim().split("\n");
	let W = input[0].split(' ').map(num => Number(num))[0]
	let H = input[0].split(' ').map(num => Number(num))[1]
	let Xs = input.slice(1, input.length).map(el => Number(el.split(' ')[0]))
	let Ys = input.slice(1, input.length).map(el => Number(el.split(' ')[1]))
	let As = input.slice(1, input.length).map(el => Number(el.split(' ')[2]))
	let base = {x: 0, y: 0}
	let topRight = {x: W, y: H}
 
	for(let i = 0 ; i < As.length ; i++) {
		let a = As[i]
		switch (a) {
			case 1:
				base.x = Xs[i] > base.x ? Xs[i] : base.x
				break
			case 2:
				topRight.x = Xs[i] < topRight.x ? Xs[i] : topRight.x
				break
			case 3:
				base.y = Ys[i] > base.y ? Ys[i] : base.y
				break
			case 4:
				topRight.y = Ys[i] < topRight.y ? Ys[i] : topRight.y
				break
		}
	}
	const width = topRight.x - base.x
	const height = topRight.y - base.y
	const square = width * height
	if(square < 0 || width < 0 || height < 0) {
		console.log(0)
	} else {
		console.log(square)
	}
}   
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define MAX_N 200'000
i64 N;
i64 A[MAX_N];

i64 comb2(i64 n) {
    if (n <= 1) return 0;
    return (n * (n - 1)) / 2;
}

int main() {
    cin >> N;
    REP(i, N) cin >> A[i];

    map<i64, i64> dist;
    REP(i, N) {
        dist[A[i]]++;
    }

    i64 s = 0;
    for (auto p = dist.begin(); p != dist.end(); p++) {
        s += comb2(p->second);
    }

    i64 s_;
    REP(k, N) {
        i64 n = dist[A[k]];
        s_ = s;
        s_ -= comb2(n);
        s_ += comb2(n - 1);
        cout << s_ << endl;
    }

    return 0;
}

Measured memory_bytes: 11136
use std::collections::HashSet;
use std::iter::FromIterator;
 
#[allow(unused_macros)]
macro_rules! parse_line {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            iter.next().unwrap().parse::<$t>().unwrap()
        }
    );
 
    ( $( $t:ty), +) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ( $(iter.next().unwrap().parse::<$t>().unwrap()),* )
        }
    );
}
 
#[allow(unused_macros)]
macro_rules! read_line {
    () => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            line.pop();
            line
        }
    )
}
 
#[allow(unused_macros)]
macro_rules! parse_vec {
    ( $t:ty ) => (
        {
            let mut line = String::new();
            ::std::io::stdin().read_line(&mut line).unwrap();
            let iter = line.split_whitespace();
            iter.map(|v| v.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    )
}
 
fn solve(s: String) -> String {
    let mut s: Vec<char> = s.chars().collect();
 
    if s.len() < 26 {
        let hash: HashSet<char> = HashSet::from_iter(s.iter().cloned());
        for c in b'a'..(b'z'+1) {
            let c = c as char;
            if !hash.contains(&c) {
                s.push(c);
                return s.into_iter().collect::<String>();
            }
        }
    } else {
        let mut lastc = s[s.len()-1];
        let mut v = Vec::new();
        v.push(lastc);
        for i in (0..s.len()-1).rev() {
            let c = s[i];
            if c < lastc {
                v.sort();
                match v.binary_search(&c) {
                    Err(n) => {
                        s[i] = v[n];
                        return s.into_iter().take(i+1).collect::<String>();
                    },
                    Ok(_) => unreachable!()
                }
            }
            lastc = c;
            v.push(lastc);
        }
    }
 
    "-1".to_string()
}
 
fn main() {
    let s = parse_line!(String);
    println!("{}", solve(s));
}
 
#[test]
fn solve_test() {
    assert_eq!(solve("zyxwvutsrqponmlkjihgfedcba".to_string()), "-1");
    assert_eq!(solve("abcdefghijklmnopqrstuvwzyx".to_string()), "abcdefghijklmnopqrstuvx");
    assert_eq!(solve("atcoder".to_string()), "atcoderb");
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

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

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vvi = vector<vector<int>>;
using vii = vector<pair<int, int>>;

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; }

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


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

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int a, b, c; cin >> a >> b >> c;
	cout << min({ a + b, b + c,a + c }) << endl;
}

Measured memory_bytes: 256