akhauriyash/Code-Regression huggingface dataset:
//by Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<s32>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cout << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

int main()
{
	FASTIO;
	int n;
	cin >> n;
	v64 arr(n,0);
	ll temp = 0,sum = 0;
	for(int i = 0;i < n;i++)
		cin >> arr[i],sum += arr[i];
	ll ans = 0;
	for(int i = 0;i < n;i++){
		temp += arr[i];
		ans += (arr[i] * (sum - temp));
	}
	cout << ans << ln;
	return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,A,B,P,PB;
  string S;
  cin >> N >> A >> B >> S;
  P = 0;
  PB = 0;
  for(int i = 0; i < N; i++){
    if (S[i] == 'a') {
      if (P < A+B){
      cout << "Yes" << endl;
      P += 1;
      }
      else{
        cout << "No" << endl;
      }
    }
    else if (S[i] == 'b') {
      if (P < A+B && PB < B){
      cout << "Yes" << endl;
      P += 1;
      PB += 1;
      }
      else{
        cout << "No" << endl;
      }
    }
    else{
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 896
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    S = input().rstrip()
    N = len(S)
    red_cnt = 0
    blue_cnt = 0
    ans = 0
    for i in range(N):
        if S[i] == '0':
            red_cnt += 1
            if blue_cnt > 0:
                red_cnt -= 1
                blue_cnt -= 1
                ans += 2
        else:
            blue_cnt += 1
            if red_cnt > 0:
                red_cnt -= 1
                blue_cnt -= 1
                ans += 2
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 4080
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

vector<int>E[200000];
int in[200000];
int ans[200000];

int main(){
	int n,m;scanf("%d%d",&n,&m);
	rep(i,n+m-1){
		int a,b;scanf("%d%d",&a,&b);a--;b--;
		E[a].push_back(b);
		in[b]++;
	}
	queue<int>que;
	rep(i,n){
		if(in[i]==0){
			ans[i]=0;
			que.push(i);
		}
	}
	while(!que.empty()){
		int p=que.front();que.pop();
		for(int u:E[p]){
			in[u]--;
			if(!in[u]){
				ans[u]=p+1;
				que.push(u);
			}
		}
	}
	rep(i,n){
		printf("%d\n",ans[i]);
	}
}

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

using namespace std;

const int MAXN = 301;

double N, dp[MAXN][MAXN][MAXN];

double E(int i, int j, int k) {
    if (i == 0 && j == 0 && k == 0)
        return 0;
    if (dp[i][j][k] != 0)
        return dp[i][j][k];
    double result = (N - i - j - k) / N;
    if (i > 0)
        result += (1 + E(i - 1, j, k)) * i / N;
    if (j > 0)
        result += (1 + E(i + 1, j - 1, k)) * j / N;
    if (k > 0)
        result += (1 + E(i, j + 1, k - 1)) * k / N;
    result *= N / (i + j + k);
    return dp[i][j][k] = result;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> N;
    int s[3] = {0, 0, 0};
    for (int i = 0; i < N; i++) {
        int a;
        cin >> a;
        s[a - 1]++;
    }
    cout << setprecision(12);
    cout << E(s[0], s[1], s[2]) << endl;
}


Measured memory_bytes: 213248
#include <stdio.h>
#include <string.h>

int main(){
	int n;
	scanf("%d", &n);
	char c[n+1];
	int flag=1;
	scanf("%s", c);
	if(n%2==1){
		puts("No");
		return 0;
	}else{
		for(int i=0; i<n/2;i++){
			if(c[i] != c[i+n/2]){
				flag=0;
			}
		}
	}
	if(flag){
		puts("Yes");
	}else{
		puts("No");
	}
	return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

#define INF LONG_LONG_MAX

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    ll k; cin>>k;
    vll a(n);
    rep(i,n) cin>>a[i];
    vll minus, plus, zero;
    rep(i,n){
        if (a[i]>0){
            plus.pb(a[i]);
        }else if(a[i]<0){
            minus.pb(-a[i]);
        }else{
            zero.pb(a[i]);
        }
    }
    sort(all(plus));
    sort(all(minus));
    ll mcnt = minus.size();
    ll pcnt = plus.size();
    ll zcnt = zero.size();
    if (mcnt*pcnt>=k){
        ll l = 0, r = INF;
        while(r-l>1){
            ll c = (l+r)/2;
            ll sum=0;
            rep(i,pcnt){
                sum += minus.end()-lower_bound(all(minus), (c+plus[i]-1)/plus[i]);
            }
            if (sum>=k){
                l = c;
            }else{
                r = c;
            }
        }
        cout<<-l<<endl;
        return 0;
    }
    k-=mcnt*pcnt;
    if ((mcnt+pcnt)*zcnt+zcnt*(zcnt-1)/2>=k){
        cout<<"0\n";
        return 0;
    }
    k-=(mcnt+pcnt)*zcnt+zcnt*(zcnt-1)/2;
    ll l = 0, r = INF;
    while(r-l>1){
        ll c = (l+r)/2;
        ll sum=0;
        rep(i,pcnt-1){
            auto itr = lower_bound(plus.begin()+(i+1), plus.end(), (c+plus[i]-1)/plus[i]); itr--;
            sum+=itr-plus.begin() - i;
            // cout<<c<<", "<<sum<<endl;
        }
        rep(i,mcnt-1){
            auto itr = lower_bound(minus.begin()+(i+1), minus.end(), (c+minus[i]-1)/minus[i]); itr--;
            sum+=itr-minus.begin() - i;
        }
        if (sum>=k){
            r = c;
        }else{
            l = c;
        }
    }
    cout<<l<<endl;
    return 0;
}


Measured memory_bytes: 4084
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll INTF = 1e9 + 7;

int n;
vector<vector<int>> M;

vector<vector<int>> matrix_mul(vector<vector<int>> &a, vector<vector<int>> &b)
{
  vector<vector<int>> c(n, vector<int>(n, 0));
  for(int i=0; i<n; i++)
  {
    for(int j=0; j<n; j++)
    {
      for(int k=0; k<n; k++)
      {
        c[i][j] = (c[i][j] + (1ll*a[i][k] * b[k][j])%INTF)%INTF;
      }
    }
  }
  return c;
}

int main()
{

   ll k;
   cin >> n ;
   cin >> k;

   M = vector<vector<int>>(n, vector<int>(n));

   vector<vector<int>> v(n, vector<int>(n));
   for(int i=0; i<n; i++)
   {
    for(int j=0; j<n; j++)
    {
      cin >> v[i][j];
    }
   }

   for(int i=0; i<n; i++)
    M[i][i] = 1;

    while(k)
    {
      if(k%2)
        M = matrix_mul(v, M);
      v = matrix_mul(v,v);
      k /= 2;
    }

  int ans =0 ;
  for(int i=0; i<n; i++)
  {
    for(int j=0; j<n; j++)
    {
      ans = (ans + M[i][j])%INTF;
    }
  }
    

    cout<<ans;

  return 0;
}


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

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let mut a: Vec<usize> = (0..n)
        .map(|_| itr.next().unwrap().parse().unwrap())
        .collect();
    a.sort();
    a.reverse();

    let mut cnt = 0;
    let mut ans: Vec<usize> = Vec::new();

    let mut i = 0;
    while i < n - 1 {
        if a[i] == a[i + 1] {
            cnt += 1;
            ans.push(a[i]);
            i += 1;
        }
        i += 1;
    }
    if cnt >= 2 {
        println!("{}", ans[0] * ans[1]);
    } else {
        println!("0");
    }
}


Measured memory_bytes: 6396
import java.io.InputStream;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    String s = sc.next();

    boolean[] sbool = new boolean[s.length()];

    for (int i = 0; i < s.length(); i++) {
      sbool[i] = s.charAt(i) == '1';
    }

    /* logic */
    boolean[] candidate0 = generateCandidate(false, s.length());
    boolean[] candidate1 = generateCandidate(true, s.length());

    int diffOfCandidate0 = calcDiff(sbool, candidate0);
    int diffOfCandidate1 = calcDiff(sbool, candidate1);

    os.println(Math.min(diffOfCandidate0, diffOfCandidate1));
  }

  private static boolean[] generateCandidate(boolean initialZero, int length) {
    boolean[] candidate = new boolean[length];
    boolean isZero = initialZero;
    for (int i = 0; i < length; i++) {
      candidate[i] = isZero;
      isZero = !isZero;
    }
    return candidate;
  }

  private static int calcDiff(boolean[] s1, boolean[] s2) {

    int diff = 0;
    for (int i = 0; i < s1.length; i++) {
      if (s1[i] != s2[i]) {
        diff++;
      }
    }

    return diff;

  }

}

Measured memory_bytes: 27968
<?php
  list($n, $m) = explode(" ", trim(fgets(STDIN)));
  $a = [];
  $b = [];
  for($i=0; $i<$n; $i++){
    list($a[], $b[]) = explode(" ", trim(fgets(STDIN)));
  }
  asort($a);

  $ans = 0;
  foreach($a as $k => $x){
//    echo $k." ".$x;
    $y = $b[$k];
    if($y >= $m){
      $ans+=$x*$m;
//      echo $ans.PHP_EOL;
      break;
    }else{
      $ans+=$x*$y;
//      echo $ans.PHP_EOL;
      $m -= $y;
    }
  }
  echo $ans;

Measured memory_bytes: 32560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <map>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for(int i = (a); i > (b); --i)
#define SZ(a) a.size()
#define ll long long
#define ull unsigned long long
using namespace std;

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

	int N;
	cin >> N;
	
	static ll A[200010];
	map<ll, int> mp;
	ull count = 0;

	FOR(i, 0, N)
		cin >> A[i];

	ll sum = 0;
	mp[0] += 1;
	FOR(i, 0, N) {
		sum += A[i];
		mp[sum] += 1;
	}

	for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
		if (itr->second > 1) {
			ull x = itr->second;
			count += x * (x - 1) / 2;
		}
	}

	cout << count << endl;

	system("pause");
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int n, q;
  string s;
  cin >> n >> s >> q;
  vector<set<int>> idxs(26);
  rep(i, n) idxs[s[i] - 'a'].emplace(i);
  rep(qi, q) {
    int qcode;
    cin >> qcode;
    if(qcode == 1) {
      int i;
      char c;
      cin >> i >> c;
      i--;
      idxs[s[i] - 'a'].erase(i);
      s[i] = c;
      idxs[s[i] - 'a'].emplace(i);
    } else {
      int l, r;
      cin >> l >> r;
      int begin = l - 1, end = r;
      int cnt = 0;
      rep(ci, 26) {
        auto x = idxs[ci].lower_bound(begin);
        if(x != idxs[ci].end() && *x < end) cnt++;
      }
      cout << cnt << endl;
    }
  }
  return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    for(int i=1;i<=N;i++){
    	if((int)(i*1.08) == N){
    		cout << i << endl;
    		return 0;
    	}
    }
    cout << ":(" << endl;
    return 0;
}

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

int main(){
    int r,c,i,j,sum=0,sumall=0;
    int result[101][101]={{}};
    cin >> r >> c;
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            cin >> result[i][j];
            sum += result[i][j];
        }
        result[i][j] = sum;
        sumall += sum;
        sum = 0;
    }
    sum = 0;
    sumall = 0;
    for(j=0;j<c;j++){
        for(i=0;i<r;i++) sum += result[i][j];
        result[r][j] = sum;
        sum = 0;
    }
    for(j=0;j<c;j++) sumall += result[r][j];
    result[r][j] = sumall;
    for(i=0;i<r+1;i++){
        for(j=0;j<c+1;j++){
            if(j!=c){
                cout << result[i][j] << " ";
            }else{
                cout << result[i][j];
            }
        }
        cout << endl;
    }
    return 0;
}



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

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

    int m, d;
    cin >> m >> d;
    int ans = 0;
    rep(i, 4, m + 1) rep(j, 22, d + 1) {
        int d1 = j % 10;
        int d10 = j / 10;
        if (d1 >= 2 && d10 >= 2 && d1 * d10 == i)
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string

N = int(input())
ans = 0
while N > 0:
    if N >= 6:
        ans += 1
        N -= 3
    elif N >= 3:
        ans += 1
        N = 0
    else:
        N = 0
print(ans)

 


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define FOR(i,m,n) for(int i=(m) ; i<(n) ; i++)
#define FORR(i,m,n) for(int i=(m) ; i>=(n) ; i--)

#define All(x) (x).begin(),(x).end()

typedef long long ll;
typedef unsigned long long ull;

const int INF = 1e9;

int main(){
   int x,y,z,k;cin >> x >> y >> z >> k;
   vector<ll> a(x);rep(i,x)cin >> a[i];
   vector<ll> b(y);rep(i,y)cin >> b[i];
   vector<ll> c(z);rep(i,z)cin >> c[i];

   sort(All(a));reverse(All(a));
   sort(All(b));reverse(All(b));

   vector<ll> ab(x*y); 
   rep(i,x){
      rep(j,y){
         ab.push_back(a[i]+b[j]);
      }
   }
   sort(All(ab));reverse(All(ab));
   vector<ll> abc(k);
   rep(i,min(k,x*y)){
      rep(j,z){
         abc.push_back(ab[i]+c[j]);
      }
   }
   sort(All(abc));reverse(All(abc));
   rep(i,k){
      cout << abc[i] << endl;
   }
   return 0;
}

Measured memory_bytes: 53880
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    cout << (C <= A + B ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <cstdio>
#include <cmath>
#include <iostream>
#include <ctime>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
set<int>v1;
set<int>v2;
int main(int argc, char* argv[])
{
	int n, m,i=0;
	std::cin >> n >>m;
	int a, b;
	for (int i = 0; i < m; ++i)
	{
		scanf("%d %d", &a, &b);
		if(a==1)
		{
			v1.insert(b);
		}
		if(b==n)
		{
			v2.insert(a);
		}
	}
	for (int v11 : v1)
	{
		if(v2.find(v11)!=v2.end())
		{
			std::cout << "POSSIBLE";
			return 0;
		}
	}
	std::cout << "IMPOSSIBLE";
	return 0;







}



Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
#define forout(out) for(int i=0; i<(int)out.size(); i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    ll n, k, q; cin>> n >> k >> q;
    vector<ll> isok(n, k-q);
    ll a;
    rep(i, q){
        cin>> a;
        isok[a-1]++;
    }
    rep(i, n){
        if(isok[i]>0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}

Measured memory_bytes: 4060
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    a = input()
    if a.isupper():
        print('A')
    else:
        print('a')
    return


if __name__ == "__main__":
    solve()


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

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

  int count = 1;
  bool a=false;
    for (int i = 0; i <N-1; ++i) {
      if(A.at(i)==A.at(i+1)){
        while (A.at(i)==A.at(i+1)){
          i++;
          if(i==N-1){
            a=true;
            break;
          }
        }
      }
      if (A.at(i)<A.at(i+1)) {
        while (A.at(i)<=A.at(i+1)){
          i++;
          if(i==N-1){
            a=true;
            break;
          }
        }
      }
      else if (A.at(i)>A.at(i+1)) {
        while (A.at(i)>=A.at(i+1)){
          i++;
          if(i==N-1){
            a=true;
            break;
          }
        }
      }
      if(a){
        break;
      }
      count++;
    }
  cout << count << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define Speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

#define st              first
#define nd              second
#define pb              push_back
#define pf              push_front
#define all(a)          (a).begin(), (a).end()
#define lwb             lower_bound
#define upb             upper_bound
#define vvll            vector<vector<ll> >
#define Mset(s, n)      memset(s, n, sizeof(s))
#define Sz(a)           int((a).size())
#define Max(a, b, c)    max(max((ll)(a), (ll)(b)), (ll)(c))
#define Min(a, b, c)    min(min((ll)(a), (ll)(b)), (ll)(c))
#define Unique(a)       sort(all(a)); (a).resize(unique(all(a)) - (a).begin())

typedef long double ld;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1e9 + 7;
const int oo = 2e9;
const ld PI = acos((ld) -1);
int Getbit(ll x, int k){return (x >> (k - 1)) & 1;}
ll Lcm(ll a, ll b) {return a / __gcd(a, b) * b;}
bool isPrime(ll n){for(ll i = 2; i * i <= n; i++){if(n % i == 0) return 0;} return (n > 1) ? 1 : 0;}
ll Powmod(ll n, ll k, ll p = MOD) {ll r = 1; for(; k; k /= 2, n = n * n % p){if(k & 1) r = r * n % p;} return r;}

const int N = 6e3 + 5;


ll n, m, query;

int a[N];
int ans = 0;
bool cmp(string s, string t, int n){
    for(int i = 0; i < n; i++){
        if(s[i] < t[i]) return false;
        if(s[i] > t[i]) return true;
    }
    return true;
}
void Solve(){
    int n;
    cin >> n >> m;
    vector<string> v;
    for(int i = 1; i <= n; i++){
        string s;
        cin >> s;
        v.pb(s);
    }
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            if(cmp(v[i], v[j], m)) swap(v[i], v[j]);
        }
    }
    for(string s: v) cout << s;
}

int main(){
//    Speed;
    int query = 1;
//    cin >> query;
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout)
    while(query--){
        Solve();
    }
}






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

using namespace std;

int main(){
	string s;
  	cin>>s;
  	sort(s.begin(), s.end());	
  
  	if(s[0] == 'a' && s[1] == 'b' && s[2] == 'c')
      cout << "Yes"<<endl;
 	else
      cout << "No\n";

}

Measured memory_bytes: 256
// 20
/****************************************************
https://searleser97.gitlab.io/algorithms/template.cpp
****************************************************/

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define forr(_, x, n) for (int _ = x; _ > n; _--)
#define fos(_, x, n, s) for (int _ = x; _ < n; _ += s)
#define forn(_, x, n) fos(_, x, n, 1)
#define rep(_, n) forn(_, 0, n)
#define fi first
#define se second
#define pb push_back
#define pairii pair<int, int>
#define all(x) x.begin(), x.end()
#define cerr(s) cerr << "\033[48;5;196m\033[38;5;15m" << s << "\033[0m"
// typedef __int128_t lli;
typedef long long int li;
typedef long double ld;
// 12
void _main(int tc) {
  li n, k, x, y;
  cin >> n >> k >> x >> y;
  li ans = min(n, k) * x;
  ans += max((n - k), 0ll) * y;
  cout << ans << endl;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  _main(0); return 0;
  int tc;
  cin >> tc;
  rep(i, tc) _main(i + 1);
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int i,H,A[251];

  scanf("%d",&H);
  for(i=1;i<=H;i++) scanf("%d",&A[i]);

  for(i=1;i<=H;i++){
    printf("node %d: key = %d, ",i,A[i]);
    if(i/2>=1) printf("parent key = %d, ",A[i/2]);
    if(i*2<=H) printf("left key = %d, ",A[i*2]);
    if(i*2+1<=H) printf("right key = %d, ",A[i*2+1]);
  printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2048
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N, Q;

        public void Run()
        {
            {
                var line = Input.ReadIntArray();
                N = line[0];
                Q = line[1];
            }

            var U = new UnionFind(N);

            for (int i = 0; i < Q; i++)
            {
                var line = Input.ReadIntArray();
                int com = line[0];
                int x = line[1];
                int y = line[2];

                if (com == 0)
                {
                    U.Unite(x, y);
                }
                else
                {
                    Console.WriteLine(U.Same(x, y) ? 1 : 0);
                }
            }
        }
    }

    // libs ----------

    class UnionFind
    {
        public List<int> Par;
        public List<int> Sizes;

        public UnionFind(int n)
        {
            Par = new List<int>();
            Sizes = new List<int>();
            for (int i = 0; i < n; i++)
            {
                Par.Add(i);
                Sizes.Add(1);
            }
        }

        public int Find(int x)
        {
            if (x == Par[x]) return x;
            Par[x] = Find(Par[x]);
            return Par[x];
        }

        public void Unite(int x, int y)
        {
            x = Find(x);
            y = Find(y);
            if (x == y) return;

            if (Sizes[x] < Sizes[y])
            {
                // swap
                int temp = x;
                x = y;
                y = temp;
            }

            Par[y] = x;
            Sizes[x] += Sizes[y];
            Sizes[y] = 0;
        }

        public bool Same(int x, int y)
        {
            return Find(x) == Find(y);
        }

        public int Size(int x)
        {
            return Sizes[Find(x)];
        }
    }


    // common ----------

    internal static class Input
    {
        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}


Measured memory_bytes: 9984
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

int main()
{
    int n;
    cin >> n;
    vector<int> x(n), y(n);
    rep(i,n) cin >> x[i] >> y[i];
    double ans = 0.0;
    rep(i,n) repSE(j,i+1,n) {
        ans += sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
    }
    ans = ans / (n/2.0);
    printf("%5.10f\n", ans);
    return 0;
}


Measured memory_bytes: 3852
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {

		int N = nextInt();
		int M = nextInt();
		Pair[] p = new Pair[M];
		ArrayList<Pair> list = new ArrayList<>();
		for(int i =0;i<M;i++){

			p[i]=new Pair(nextInt(),nextInt(),i);
			list.add(p[i]);
		}
		Collections.sort(list,Pair.getComparator());

		int cnt=0;
		int bef=-1;
		for(Pair x:list){
			if(bef!=x.N){
				cnt=0;
				bef=x.N;
			}
			cnt++;
			x.cnt=cnt;
		}
		PrintWriter pw = new PrintWriter(System.out);
		for(Pair x:p){
			pw.printf("%06d%06d\n",x.N,x.cnt);
		}
		pw.flush();
	}

	public static class Pair {
		int N;
		int V;
		int idx;
		int cnt;

		Pair(int N, int V,int idx) {
			this.N = N;
			this.V = V;
			this.idx=idx;
		}

		public int getN() {
			return N;
		}

		public int getV() {
			return V;
		}


		public int getIdx() {
			return idx;
		}

		public void setIdx(int idx) {
			this.idx = idx;
		}

		public static Comparator<Pair> getComparator() {
			return Comparator.comparing(Pair::getN).thenComparing(Pair::getV);
		}
		public static Comparator<Pair> getComparator2() {
			return Comparator.comparing(Pair::getIdx);
		}
	}


	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 136768
import sys
import heapq
import bisect
import itertools

mod = 10**9+7
dd = ((-1,0),(1,0),(0,-1),(0,1))

def I(): return(int(sys.stdin.readline()))
def LI(): return([int(x) for x in sys.stdin.readline().split()])
def LI_(): return([int(x)-1 for x in sys.stdin.readline().split()])
def S(): return(sys.stdin.readline()[:-1])
def IR(n): return([I() for _ in range(n)])

def GCD(a,b):
    while b!=0:
        a,b = b,a%b
    return a

def LCM(a,b):
    return a * b // GCD(a,b)

def Eratosthenes(N):
    r = [True]*(N+1)
    r[0] = False
    r[1] = False
    i = 2
    while i*i<=N:
        if r[i]: 
            j = i
            while i*j<=N:
                prime[i*j]=False
                j+=1
        i+=1
    return(r)

def main():
    N,W = LI()
    dic = {}
    dic[0] = 0

    for i in range(N):
        w,v = LI()
        dic_nxt = {k:dic[k] for k in dic}
        for k in dic:
            if k+w<=W:
                dic_nxt[k+w] = max(dic_nxt.get(k+w,0),dic.get(k,0)+v)
        dic = {k:dic_nxt[k] for k in dic_nxt}
    return(max(dic.values()))

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 54512
#include <iostream>

using namespace std;

struct Dice{
    int number[6];

    void roll(char ch){
        int nb;
        if(ch == 'E'){
            nb = number[0];
            number[0] = number[3];
            number[3] = number[5];
            number[5] = number[2];
            number[2] = nb;
        }
        if(ch == 'W'){
            nb = number[0];
            number[0] = number[2];
            number[2] = number[5];
            number[5] = number[3];
            number[3] = nb;
        }
        if(ch == 'N'){
            nb = number[0];
            number[0] = number[1];
            number[1] = number[5];
            number[5] = number[4];
            number[4] = nb;
        }
        if(ch == 'S'){
            nb = number[0];
            number[0] = number[4];
            number[4] = number[5];
            number[5] = number[1];
            number[1] = nb; 
        }
        if(ch == 'F'){
            nb = number[1];
            number[1] = number[2];
            number[2] = number[4];
            number[4] = number[3];
            number[3] = nb;
        }
    }

    int top(){
        return number[0];
    } 

    int right(){
        return number[2];
    }

    int left(){
        return number[3];
    }

    int front(){
        return number[1];
    }
};

bool isEqual(Dice a, Dice b){
        for(int i = 0; i < 6; i++){
            if(a.number[i] != b.number[i])
                return false;
        }
        return true;
    }

int main(){
    Dice dice[2];
    
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 6; j++){
            cin >> dice[i].number[j];
        }
    }

    bool flag = false;

    for(int i = 0; i < 4; i++){
        dice[1].roll('F');
        for(int j = 0; j < 4; j++){
            dice[1].roll('N');
            if(isEqual(dice[0], dice[1]))
                flag = true;
        }
    }

    dice[1].roll('E');
    for(int i = 0; i < 4; i++){
        dice[1].roll('N');
        if(isEqual(dice[0], dice[1]))
            flag = true;
    }

    dice[1].roll('W');
    dice[1].roll('W');
    for(int i = 0; i < 4; i++){
        dice[1].roll('N');
        if(isEqual(dice[0], dice[1]))
            flag = true;
    }

    cout << (flag ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3092
S = input()
for i in range(2 ** (len(S) - 1)):
    ope = ['-'] * (len(S) - 1)
    for j in range(len(S) - 1):
        if ((i >> j) & 1):
            ope[2 - j] = '+' # j=0->ope[2], j=1->ope[1], j=2->ope[0]
    ans = ''
    ans += S[0]+ope[0]+S[1]+ope[1]+S[2]+ope[2]+S[3]
    if eval(ans) == 7:
        ans += '=7'
        break

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
int jumps(std::vector<int> arr, int n, int k)
{
	vector<int> dp(n + 1);
	dp[1] = 0;
	for (int i = 2 ; i <= n; i++) {
		dp[i] = inf;
		for (int j = i - 1; j >= 1 && (i - j) <= k; j--) {
			dp[i] = min(dp[i], abs(arr[i] - arr[j]) + dp[j]);
		}
	}
	return dp[n];
}
int main() {
	int n, k; cin >> n >> k;
	vector<int> arr(n + 1);
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	cout << jumps(arr, n , k);
	return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <map>
#include <tuple>
#include <queue>
using namespace std;

const int MYINTMAX=2147483647;

int main(){

    // 常にYes?
    cout << "Yes" << endl;

    int N,M;
    cin >> N >> M;
    
    vector< map<int,int> > edges(N+1, map<int,int>{});
    
    for(int i=0;i<M;i++){
        int Ai,Bi;
        cin >> Ai >> Bi;
        edges[Ai][Bi] = 1;
        edges[Bi][Ai] = 1;
    }

    vector<int> mindist(N+1,MYINTMAX);
    mindist[1] = 0;
    vector<int> root(N+1,MYINTMAX);

    vector<int> visited(N+1,0);
    queue<int> que;
    que.push(1);
    visited[1]++;

    //for(int i=1;i<=N;i++){
    while(!que.empty()){
        int i = que.front();
        que.pop();
        //cout << i << endl;
        for(auto itr=edges[i].begin(); itr!=edges[i].end(); ++itr){
            //cout << "    " << itr->first << endl;
            int key = itr->first;
            if(!visited[key]){
                que.push(key);
                mindist[key] = mindist[i]+1;
                root[key] = i;
                visited[key]++;
            }
        }
    }

    for(int i=2;i<=N;i++){
        //cout << mindist[i] << endl;
        cout << root[i] << endl;
    }




    return 0;
}


Measured memory_bytes: 28196
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var nabc = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var (n, a, b, c) = (nabc[0], nabc[1], nabc[2], nabc[3]);
        ImmutableStack<char>[] dp = new ImmutableStack<char>[5 * 5 * 5];
        static int Encode(int a, int b, int c) => (Min(a, 4) * 5 + Min(b, 4)) * 5 + Min(c, 4);
        dp[Encode(a, b, c)] = ImmutableStack<char>.Empty;
        for (int _ = 0; _ < n; _++)
        {
            var s = Console.ReadLine();
            ImmutableStack<char>[] newdp = new ImmutableStack<char>[5 * 5 * 5];
            int da = 0, db = 0, dc = 0;
            switch (s)
            {
                case "AB":
                    da = 1; db = -1;
                    break;
                case "BC":
                    db = 1; dc = -1;
                    break;
                case "AC":
                    da = 1; dc = -1;
                    break;
            }
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    for (int k = 0; k < 5; k++)
                    {
                        var obj = dp[Encode(i, j, k)];
                        if (obj is null) continue;
                        if (i + da >= 0 && j + db >= 0 && k + dc >= 0) 
                            newdp[Encode(i + da, j + db, k + dc)] = obj.Push(s[0]);
                        if (i - da >= 0 && j - db >= 0 && k - dc >= 0) 
                            newdp[Encode(i - da, j - db, k - dc)] = obj.Push(s[1]);
                    }
                }
            }
            dp = newdp;
        }
        var res = dp.FirstOrDefault(x => x != null);
        if (res == null)
        {
            Console.WriteLine("No");
            return;
        }
        Console.WriteLine("Yes");
        foreach (var item in res.Reverse())
        {
            Console.WriteLine(item);
        }
    }
}



Measured memory_bytes: 55400
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll K;
  cin >> K;

  if(K % 2 == 0)
    cout << (K / 2) * (K / 2) << "\n";
  else
    cout << (K / 2) * (K / 2 + 1) << "\n";
  
  return 0;
}


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

using namespace std;

const long long mod = 1000000007;
string a, b;
int n;

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

  cin >> n >> a >> b;
  bool ud = false;
  long long ans = 1;
  int pos = 0;
  if (a[0] == b[0]) {
    ud = true;
    ans = (ans * 3) % mod;
    pos++;
  }
  else {
    ud = false;
    ans = (ans * 6) % mod;
    pos += 2;
  }
  while (pos < n) {
    if (ud) {
      if (a[pos] == b[pos]) {
        ud = true;
        ans = (ans * 2) % mod;
        pos++;
      }
      else {
        ud = false;
        ans = (ans * 2) % mod;
        pos += 2;
      }
    }
    else {
      if (a[pos] == b[pos]) {
        ud = true;
        ans = (ans * 1) % mod;
        pos++;
      }
      else {
        ud = false;
        ans = (ans * 3) % mod;
        pos += 2;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int n,x,t;
    int ans;
    scanf("%d %d %d", &n,&x,&t);
    if(n%x==0){
        ans = n * t / x;
    }else{
        ans = (n / x + 1 ) * t;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1708
n = int(input())
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
p = [0]*n
q = [0]*n
k = 0
for i in range(n):
  while k<n:
    if a[k]<b[i]:
      k += 1
    else:
      break
  p[i] = k
k = 0
s = 0
ans = 0
for i in range(n):
  while k<n:
    if b[k]<c[i]:
      s += p[k]
      k += 1
    else:
      break
  ans += s
print(ans)


Measured memory_bytes: 24180
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void) {
	int i, w=0;
	char s[1000],b[10];
	scanf("%s",b);
	for(i=0;i<10;i++){
		b[i]=tolower(b[i]);
	}
	while(1){
		scanf("%s",s);
		if(strcmp(s,"END_OF_TEXT") == 0){
			break;
		}
		for(i=0; i< 1000; i++){
			s[i] =tolower(s[i]);
		}
		if(strcmp(s,b) == 0){
			w++;
		}
	}
	printf("%d\n",w);
	
		
	return 0;
}

Measured memory_bytes: 552
// 参考
// https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// Input macro
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// Test Code
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r"25
" => r"Christmas",

r"22
" => r"Christmas Eve Eve Eve"
}

fn main() {
    println!("{}", solve(&stdin!()));
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        d: i32
    }

    let ans = match d {
        25 => "Christmas",
        24 => "Christmas Eve",
        23 => "Christmas Eve Eve",
        _ => "Christmas Eve Eve Eve",
    };

    ans.to_string()
}


Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL N;
    cin >> N;

    vector<LL> a(3*N+1);

    for(int i = 1; i <= 3*N; i++){
        cin >> a[i];
    }

    priority_queue<LL,vector<LL>,greater<LL>> left;
    priority_queue<LL> right;

    LL leftsum = 0;
    LL rightsum = 0;

    for(int i = 1; i <= N; i++){
        leftsum += a[i];
        left.push(a[i]);
        rightsum += a[3*N+1-i];
        right.push(a[3*N+1-i]);
    }
    cerr << leftsum << endl;
    cerr << rightsum << endl;

    vector<LL> lefttotal(N+1);
    vector<LL> righttotal(N+1);

    lefttotal[0] = leftsum;

    for(int i = N+1; i <= 2*N; i++){
        LL tmpleft = leftsum - left.top() + a[i];
        if(tmpleft > leftsum){
            leftsum = tmpleft;
            left.pop();
            left.push(a[i]);
        }
        lefttotal[i-N] = leftsum;
    }

    righttotal[N] = rightsum;

    for(int i = 2*N; i > N; i--){
        LL tmpright = rightsum - right.top() + a[i];
        if(tmpright < rightsum){
            rightsum = tmpright;
            right.pop();
            right.push(a[i]);
        }
        righttotal[i-N-1] = rightsum;
    }

    LL ans = lefttotal[0] - righttotal[0];

    for(int i = 1; i <= N; i++){
        ans = max(ans,(lefttotal[i]-righttotal[i]));
    }

    cerr << leftsum << endl;
    cerr << rightsum << endl;

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 5996
#include <iostream>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    string s;
    cin >> s;
    if(s.size() % 2 != 0){
        cout << "No" << endl;
        return 0;
    }
    else{
        for(int i = 0; i < s.size()/2; i += 2){
            if(s[i] != 'h' || s[i+1] != 'i'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 504
#include <iostream>
using namespace std;
int main()
{
    long long int a,b,k;
    cin >>a>>b>>k;
    if(a+b<=k)cout <<0<<" "<<0;
    else
    {
        if(a<=k)cout <<0<<" "<<b-(k-a);
        else cout <<a-k<<" "<<b;
    }
}


Measured memory_bytes: 256
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n,m;
    cin>>n>>m;
    vector<int>v(n);
    int tot=0;
    rep(i,0,n-1) cin>>v[i],tot+=v[i];
    sort(all(v),greater<int>());
    rep(i,0,m-1){
        if(v[i]<(tot+4*m-1)/(4*m)){
            return cout<<"No",0;
        }
    }
    cout<<"Yes";
    return 0;
}


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

int main() {
    int n,m;
  	cin >> n >> m;
    n--;
    m--;
    cout << n*m << endl;
}


Measured memory_bytes: 256