akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
#define bet(x, a, b) (a) <= (x) && (x) < (b)
typedef long long ll;
typedef unsigned long long ull;

int A[100000];

int main()
{
	int N, K, S;

	cin >> N >> K >> S;

	if (K == N) {
		rep(i, N) A[i] = S;
	}
	else {
		rep(i, K) A[i] = S;
		if (S == (int)1e9) {
			repc(i, K, N - 1) A[i] = S - 1;
		}
		else {
			repc(i, K, N - 1) A[i] = S + 1;
		}
	}

	cout << A[0];
	repc(i, 1, N - 1) cout << ' ' << A[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 1664
#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 - 1; 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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e09;

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

  int n;
  cin >> n;
  cout << 48 - n << endl;
  return 0;
}


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

#define rep(i, N) for (int i = 0; i < N; i++)
const int INF = INT_MAX / 2;

int main() {
  int N;
  cin >> N;
  vector<int> t(N), v(N);
  rep(i, N) cin >> t[i];
  rep(i, N) cin >> v[i];
  int T = 0;
  rep(i, N) T += t[i];
  vector<int> ub(T * 2 + 1, INF);
  int x = 0;
  rep(i, N) rep(y, t[i]) {
    ub[x] = min(ub[x], v[i] * 2);
    ub[x + 1] = min(ub[x + 1], v[i] * 2);
    ub[x + 2] = min(ub[x + 2], v[i] * 2);
    x += 2;
  }
  ub[0] = ub[T * 2] = 0;
  rep(x, T * 2) ub[x + 1] = min(ub[x + 1], ub[x] + 1);
  for (int x = T * 2; x > 0; x--) ub[x - 1] = min(ub[x - 1], ub[x] + 1);
  double ans = 0;
  rep(x, T * 2) ans += (ub[x] + ub[x + 1]) / 2.0;
  cout << fixed << setprecision(12) << ans / 4 << endl;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	char a[10];
	scanf("%c",&a);
	if(a[0]=='a'||a[0]=='e'||a[0]=='i'||a[0]=='o'||a[0]=='u'){
		printf("vowel\n");
	}
	else{
		printf("consonant\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
 
int main(void)
{
    int A,B,C;
    scanf("%d" , &A);
    scanf("%d" , &B);
    scanf("%d" , &C);
    if(A <= C){
      if(C <= B){
        printf("Yes");
        return 0;
      }
    }
    printf("No");
    return 0;
}

Measured memory_bytes: 1704
#include <cstdio>
#include <iostream>
int main (int argc , char**argv )
{
	int x=0,a=0,b=0;
	scanf("%d%d%d",&x,&a,&b);
	int A = (x-a)*(x-a);
	int B = (x-b)*(x-b);
	if (A<B){printf("A\n");}else{printf("B\n");}

	return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abc160/tasks/abc160_d
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
const ll LINF = 0x1fffffffffffffff;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,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 (b<a) { a=b; return 1; } return 0;}
int main() {
#if LOCAL&01
  std::ifstream in("./test/sample-1.in");
  //std::ifstream in("./input.txt");
  std::cin.rdbuf(in.rdbuf());
#else
  cin.tie(0);
  ios::sync_with_stdio(false);
#endif
  ll N,X,Y; cin>>N>>X>>Y;
  vector<ll> ans(N);
  //となりを考慮  
  FOR(i,1,N+1){
    unordered_map<ll,ll> ch;
    FOR(d,1,N){
      auto&& a=ans.at(d);

      auto check_inc = [&](ll tv){
        dump(i,d,tv);
        if(tv<=i)return;
        if(tv>=1&&tv<=N){
          if(ch.count(tv)==0){
            dump(i,d,tv,"add");
            ch[tv]=1;
            ++a;
          }
        }
      };

      ll tmp0=i+d;
      check_inc(tmp0);

      ll ix=abs(i-X);
      ll nokori=d-ix-1;
      if(nokori>=0){
        ll tmpa = Y+nokori;
        check_inc(tmpa);
        ll tmpb = Y-nokori;
        check_inc(tmpb);
      }
      // ll tmp1=i+d-X;
      // if(tmp1>0) {
      //   ll tmpa=Y+tmp1-1;
      //   check_inc(tmpa);

      //   ll tmpb=Y-(tmp1-1);
      //   check_inc(tmpb);
      // }
    }
    dump(ans);
  }
  FOR(i,1,ans.size()){
    cout<<ans.at(i)<<endl;
  }
  return 0;
}

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

int main() {
  int N, K = 0;
  cin >> N >> K;

  set<int> member;

  for (int i = 0; i < N; i++) {
    member.insert(i + 1);
  }

  // cout << N << endl;
  // cout << K << endl;

  int tmp = 0;
  int d = 0;

  for (int i = 0; i < K; i++) {
    if (member.size() == 0) {
      break;
    }
    cin >> d;
    for (int j = 0; j < d; j++) {
      if (member.size() == 0) {
        break;
      }

      cin >> tmp;
      // cout << tmp << endl;
      member.erase(tmp);
    }
  }

  cout << member.size() << endl;

  return 0;
}


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

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

using namespace std;

int n,m,q,a[50],b[50],c[50],d[50];

int v[10];

int dfs(int i,int pre){
	if(i==n){
		int res=0;
		rep(j,q) if(v[b[j]]-v[a[j]]==c[j]) res+=d[j];
		return res;
	}

	int res=0;
	for(int x=pre;x<=m;x++){
		v[i]=x;
		res=max(res,dfs(i+1,x));
	}
	return res;
}

int main(){
	scanf("%d%d%d",&n,&m,&q);
	rep(i,q) scanf("%d%d%d%d",&a[i],&b[i],&c[i],&d[i]), a[i]--, b[i]--;

	printf("%d\n",dfs(0,1));

	return 0;
}


Measured memory_bytes: 3824
// practice with Dukkha
#include <algorithm>
#include <iostream>

using namespace std;

const int K = 100000, K_ = K * 9;

struct V {
	int i, j;
} vv[K_];

int kk[10];

int main() {
	int n, m, k; cin >> n >> m >> k;
	int k_ = 0;
	while (k--) {
		int a, b; cin >> a >> b;
		for (int i = a - 2; i <= a; i++)
			for (int j = b - 2; j <= b; j++)
				if (i >= 1 && j >= 1 && i + 2 <= n && j + 2 <= m) {
					auto &v = vv[k_++];
					v.i = i;
					v.j = j;
				}
	}
	sort(vv, vv + k_, [] (auto &u, auto &v) { return u.i < v.i || u.i == v.i && u.j < v.j; });
	for (int u = 0, v; u < k_; u = v) {
		int i = vv[u].i, j = vv[u].j;
		v = u + 1;
		while (v < k_ && vv[v].i == i && vv[v].j == j)
			v++;
		kk[v - u]++;
	}
	long long z = (long long) (n - 2) * (m - 2);
	for (int h = 1; h < 10; h++)
		z -= kk[h];
	cout << z << '\n';
	for (int h = 1; h < 10; h++)
		cout << kk[h] << '\n';
	return 0;
}


Measured memory_bytes: 10656
N=int(input())
g=[[] for _ in range(N)]
length={}
for _ in range(N-1):
    a,b,c=map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
    length[(a-1,b-1)]=c
    length[(b-1,a-1)]=c
#print(g)
Q,K=map(int,input().split())
K-=1
from collections import deque
que=deque()
que.append(K)
unvisited=[1]*N
unvisited[K]=0
l=[0]*N
while que:
    v=que.pop()
    for u in g[v]:
        if unvisited[u]:
            l[u]=l[v]+length[(u,v)]
            que.appendleft(u)
            unvisited[u]=0
#print(l)
for i in range(Q):
    x,y=map(int,input().split())
    print(l[y-1]+l[x-1])


Measured memory_bytes: 107168
// Copyright 2020 Tsutomu ISHIKAWA
// Author: Tsutomu ISHIKAWA

#include <iostream>
using namespace std;
int main() {
    int n;
    int a, b, sum;
    std::cin >> n;
    sum = 0;
    for (int i = 0; i < n; i++) {
        cin >> a >> b;
        if (a == b) {
            sum += 1;
            if (sum == 3) break;
        } else {
            sum = 0;
        }
    }
    if (sum == 3) {
        cout <<" Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3136
n = int(input())
s = [input()[0] for _ in range(n)]

from collections import Counter

cnt = Counter(s)

from itertools import combinations

ls = [0,1,2,3,4]

lss = [cnt["M"],cnt["A"],cnt["R"],cnt["C"],cnt["H"]]

ans = 0
for i in list(combinations(ls,3)):
    ans += lss[i[0]]*lss[i[1]]*lss[i[2]]
print(ans)

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

#define error(args...) { vector<string> _debug = split(#args, ',');err(begin(_debug), args);}

vector<string> split(const string& s, char c){
	vector<string> v;stringstream ss(s);string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}

void err(vector<string>::iterator it) {cerr << endl;}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a,Args... args){
	cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << " ",err(++it, args...);
}

const ll limit=200010;
ll x[limit],y[limit];

int main(void){
	ll n;
	cin >> n;
	rep(i,n) cin >> x[i] >> y[i];

	ll cmin=1LL<<60,cmax=-1,tmin,tmax;

	rep(i,n){
		if(chmin(cmin,min(x[i],y[i]))){
			tmin = x[i]^y[i]^cmin;
		}
		
		if(chmax(cmax,max(x[i],y[i]))){
			tmax = x[i]^y[i]^cmax;
		}
	}

	
	ll ans=1LL<<60;

	{
		ll rmin=cmin,rmax=tmax,bmin=tmin,bmax=cmax;
		
		// diff
		rep(i,n){
			ll r=x[i],b=y[i];
			if(r>b) swap(r,b);
			chmax(rmax,r);
			chmin(bmin,b);
		}

		//error("diff",rmin,rmax,bmin,bmax);

		chmin(ans,1LL*(rmax-rmin)*(bmax-bmin));
	}

	{
		ll rmin=cmin,rmax=cmax,bmin=min(tmin,tmax),bmax=max(tmin,tmax);
		// same
		
		using pii=pair<ll,ll>;
		vector<pii> ary;

		rep(i,n){
			ll r=x[i],b=y[i];
			if(bmin <= r and r <= bmax) continue;
			if(bmin <= b and b <= bmax) continue;

			if(bmax < r and bmax < b) chmax(bmax,min(r,b));			
			if(r < bmin and b < bmin) chmin(bmin,max(r,b));
		}

		rep(i,n){
			ll r=x[i],b=y[i];
			if(bmin <= r and r <= bmax) continue;
			if(bmin <= b and b <= bmax) continue;
			if(r>b) swap(r,b);
			ary.push_back(pii(bmin-r,b-bmax));
		}
		
		sort(begin(ary),end(ary));
		const ll m=ary.size();

		if(m>0){
			ll len=ary[m-1].second,add=ary[m-1].first;
			
			rrep(i,m-2){
				if(ary[i].first != ary[i+1].first) chmin(add,ary[i].first+len);
				chmax(len,ary[i].second);
			}

			chmin(add,len);
			bmax += add;
		}

		//error("same",rmin,rmax,bmin,bmax);

		chmin(ans,1LL*(rmax-rmin)*(bmax-bmin));
	}

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

Measured memory_bytes: 3328
memnum = gets.chomp.to_i
restnum = []
sum = 0
5.times do
  restnum << gets.chomp.to_i
end
minnum = restnum.min
if memnum > minnum && (memnum % minnum) != 0
  puts (5 + memnum / minnum)
elsif memnum > minnum && (memnum % minnum) == 0
  puts (4 + memnum / minnum)
else
  puts 5
end


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

#define REP(i,num) for(ll i=0;i<(num);++i)
#define FOR(i,c,num) for(ll (i)=(c);(i)<(num);++(i))
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=ll>
T in(){T x; cin >> x; return (x);}
template<typename T=ll,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return x;}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	auto N=in();
	auto A=vecin(N+1);
	
	ll S=1,SA=accumulate(ALL(A),0ll)-A[0];
	ll B=1-A[0];
	if(B<0){
		out(-1);
		return 0;
	}

	REP(i,N){
		SA -= A[i+1];
		
		B = min(2ll*B-A[i+1],SA);
		if(B<0){
			out(-1);
			return 0;
		}
		S += B+A[i+1];
	}
	
	out(S);
	return 0;
}


Measured memory_bytes: 3988
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

def mulinputs():
    return map(int,input().split())

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    X, Y, Z = mulinputs()

    tmp = X
    X = Y
    Y = tmp

    tmp = X
    X = Z
    Z = tmp

    print(X, Y, Z)


Measured memory_bytes: 5288
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,d = readInts()
cnt = 0
for i in range(n):
    x,y = readInts()
    if d**2 >= x**2 + y**2:
        cnt += 1
print(cnt)


Measured memory_bytes: 10408
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e18
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int n,U[maxn],V[maxn],vis[maxn],cnt[maxn],dep[maxn],mx[maxn];
ll a1,a2;
vector <int> mp[maxn];

inline void wk(int x,int y)
{
	rep(i,1,n) dep[i]=0,vis[i]=0,mx[i]=0;
	queue <int> q; q.push(x); q.push(y); vis[x]=1; vis[y]=1;
	while(!q.empty())
	{
		int u=q.front(); q.pop();
		for(int i=0;i<mp[u].size();i++)
		{
			int v=mp[u][i]; if(vis[v]) continue;
			dep[v]=dep[u]+1; vis[v]=1; q.push(v);
		}
	}
	rep(i,1,n) mx[dep[i]]=max(mx[dep[i]],(int)mp[i].size()-1);
	ll tmp=1,p2=0;
	if(y!=0) mx[dep[0]]=max(mp[x].size(),mp[y].size())-1;
	else mx[dep[0]]=mp[x].size();
	rep(i,0,n) if(mx[i]) tmp*=mx[i]; else break; if(y!=0) tmp*=2;
	rep(i,1,n) p2=max(p2,(ll)dep[i]); //cout<<x<<" "<<y<<" "<<p2<<" "<<tmp<<endl;
	if(a1==p2) a2=min(a2,tmp); else if(a1>p2) a1=p2,a2=tmp;
}

int main()
{
	n=read(); a2=inf; a1=inf;
	rep(i,1,n-1){int u=read(),v=read(); U[i]=u; V[i]=v; mp[u].pb(v); mp[v].pb(u);}
	rep(i,1,n) wk(i,0); rep(i,1,n-1) wk(U[i],V[i]);
	cout<<a1+1<<" "<<a2<<endl;
	return 0;
}

Measured memory_bytes: 27064
import numpy
N = int(input())
p = [i for i in map(float, input().split())]
memo = numpy.zeros([N+1, N+1], dtype = float)
memo[0][0] = 1
for n in range(N):
    memo[n+1] = memo[n]*(1-p[n])
    memo[n+1][1:N+1] += memo[n][0:N] * (p[n])
print(numpy.sum(memo[N][N//2+1:N+1]))

Measured memory_bytes: 82748
package main

import (
	"fmt"
)

type point struct {
	v int
	c int
}

func main() {
	var n int
	fmt.Scan(&n)
	ar := make([]int, n)
	for i := range ar {
		fmt.Scan(&ar[i])
	}
	gm := map[int]int{}
	km := map[int]int{}
	gt := point{}
	gs := point{}
	kt := point{}
	ks := point{}
	for i, v := range ar {
		if i%2 == 0 {
			gm[v]++
		} else {
			km[v]++
		}
	}
	for k, v := range gm {
		if gt.c < v {
			gs = gt
			gt = point{v: k, c: v}
		} else if gs.c < v {
			gs = point{v: k, c: v}
		}
	}
	for k, v := range km {
		if kt.c < v {
			ks = kt
			kt = point{v: k, c: v}
		} else if ks.c < v {
			ks = point{v: k, c: v}
		}
	}
	k1 := 999999999
	k2 := 999999999
	k3 := 999999999
	k4 := 999999999
	if gt.c > 0 {
		if kt.c > 0 {
			k1 = f(gt, kt, n)
		}
		if ks.c > 0 {
			k2 = f(gt, ks, n)
		}
	}
	if gs.c > 0 {
		if kt.c > 0 {
			k3 = f(gs, kt, n)
		}
		if ks.c > 0 {
			k4 = f(gs, ks, n)
		}
	}
	m := min(k1, k2)
	m = min(m, k3)
	m = min(m, k4)
	fmt.Println(m)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func f(p1, p2 point, n int) int {
	if p1.v == p2.v {
		return n/2 - p1.c + n/2
	}
	return n/2 - p1.c + n/2 - p2.c
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define ll long long
#define ll_MAX LONG_LONG_MAX
#define ll_MIN LONG_LONG_MIN
#define pi pair<ll, ll>
#define endl "\n"
#define MAXN 100005
using namespace std;

ll n, x;
vector<ll> v;

void solve()
{
    cin >> n;
    for (ll i = 0; i < n; i++)
    {
        cin >> x;
        v.pb(x);
    }
    ll sum = 0;
    for (ll i = 1; i < n; i++)
    {
        if (v[i] < v[i - 1])
        {
            sum += (v[i - 1] - v[i]);
            v[i] += (v[i - 1] - v[i]);
        }
    }
    cout << sum << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
}

Measured memory_bytes: 5344
#include<bits/stdc++.h>
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define V vector<int>
#define S set<int>
#define pb(v) push_back(v)

int main(){
    string s;cin >> s;
    REP(a,s.size()){
        if(a%2==0)cout<<s.at(a);
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<int> work1(k);
    vector<int> work2(k);

    int i = 0;
    int now = 0;
    while (i<n && now<k) {
        if (s[i]=='o') {
            work1[now] = i;
            now++;
            i += (c+1);
        }
        else {
            i++;
        }
    }
    i = n-1;
    now = k-1;
    while (i>=0 && now>=0) {
        if (s[i]=='o') {
            work2[now] = i;
            now--;
            i -= (c+1);
        }
        else {
            i--;
        }
    }

    
    rep(j, k) {
        if (work1[j] == work2[j]) {
            cout << work1[j]+1 << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3460
#!/usr/bin/env python3
count=0
import itertools
N=int(input())
S=[input() for i in range(N)]
a = ['M', 'A','R', 'C', 'H']
b=[0]*5
for s in S:
    try:    
        b[a.index(s[0])]+=1
    except ValueError:pass
l=list(itertools.combinations(b,3))
for c in l:
    tmp=1
    for i in range(3):
        tmp*=c[i]
    count+=tmp
print(count)

Measured memory_bytes: 9776
#include <iostream>

using namespace std;

int main()
{
   int A,B,C,D;
   
   cin >> A >> B >> C >> D;
   
   if (C >= B || A >= D) 
      cout << "0\n";
   else
      cout << min(B - A, min(B - C, min(D - C, D - A))) << "\n";

}

Measured memory_bytes: 256
//FIRST THINK THEN CODE.

#include <bits/stdc++.h>
 
 
using namespace std;
 
typedef long long ll;
 
//#define MOD 998244353
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define rrep(i,a,b) for(ll i=a;i>b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define vi vector<int>
#define vl vector<ll>
#define ld long double
#define vvi vector<vector<int>>
#define vvl vector<vector<long long>>
#define pii pair<int,int>
#define pll pair<long,long>
#define vpii vector<pii>
#define vpll vector<pll>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define d1(x) cout<<(x)<<endl
#define d2(x,y) cout<<(x)<<" "<<(y)<<endl
#define d3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define d4(a,b,c,d) cout<<(a)<<" "<<(b)<<" "<<(c)<<" "<<(d)<<endl
#define PI 3.1415926535897932384626433832795
#define fix(f,n) fixed<<setprecision(n)<<f
#define all(x) x.begin(),x.end()
#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define popcount(x) __builtin_popcountll(x)

const int M=1000000007;
const int MM=998244353;


 
ll newmod(ll a,ll b)
 {
  return ((a%b)+b)%b;
}
 
 
ll powM(ll a,ll b,ll m )
{ 
  if(m<=1)return 0;
  a%=m;
  ll ans=1LL;
  while(b)
  {
    if(b&1)ans=ans*a%m;
    a=a*a%m;
    b>>=1;
  }
 
return ans;
}


 
ll poww(ll a,ll b)
{ 
  
  ll ans=1;
  while(b)
  {
    if(b&1)ans=ans*a;
    a=a*a;
    b>>=1;
  }
 
return ans;

}

template<typename T,typename F>
void chmax( T &a,F b){
  if(b>a)a=b;
}

template<typename T,typename F>
void chmin( T &a,F b){
  if(b<a)a=b;
}

const ll N=1e5+5;




int main()
{ 

IOS;

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

ll cnt1=0;

for(int i=1;i<=n;i++){
  if(i%k==0)cnt1++;
}

if(k&1){
  cout<<poww(cnt1,3)<<endl;
  return 0;
}

ll cnt2=0;

for(int i=k/2;i<=n;i++){
  if(i%k==k/2)cnt2++;
}

cout<<poww(cnt1,3)+poww(cnt2,3)<<endl;




return 0;
 
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
 
using namespace std;
const int MAX = 100000;

int main(){
    int N;
    int A[MAX];

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

    sort(A,A+N);

    vector<int> v1,v2;
    long long ans1 = 0;
    long long ans2 = 0;


    v1.push_back(-1);
    v1.push_back(N & 1 ? -1 : 1);
    v2.push_back(1);
    v2.push_back(N & 1 ? 1 : -1);

    for(int i = 0;i < N - 2;i++){
        v1.push_back(i & 1 ? -2 : 2);
        v2.push_back(i & 1 ? 2 : -2);
    }

    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());


    for(int i = 0;i < N;i++){
        ans1 += A[i] * v1[i];
        ans2 += A[i] * v2[i];
    }

    cout << max(ans1,ans2) << endl;

    return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;

int main() {
    ll a;
    string bs;
    cin >> a >> bs;
    int b =
        (int)(bs[0] - '0') * 100 + (int)(bs[2] - '0') * 10 + (int)(bs[3] - '0');
    cout << a * b / 100 << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <stdio.h>

int main(void)
{
	int i[10000]={},j=0,x,d;
	
	while(1){
		scanf("%d\n",&x);
		if(x==0){
			break;
		}
		i[j]=x;
		j++;
	}
	
	for(d=0;d<=j-1;d++){
		printf("Case %d: %d\n",d+1,i[d]);
	}
		
	return 0;
}


Measured memory_bytes: 2032
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
    int n;
    cin>>n;
    map<string, int> mp;
    for(int i=0; i<n; i++){
        string s; cin>>s; mp[s]++;
    }
    int mx=-1;
    for(auto p:mp) mx=max(mx, p.second);
    for(auto p:mp){
        if(mx==p.second){
            cout<<p.first<<endl;
        }
    }
	return 0;
}


Measured memory_bytes: 25216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18,MOD = 1e9 + 7;
const int INT_INF = 1e9,INT_MOD=1e9+7;
#define rep(i, N) for(int i = 0; i < N; i++)
typedef pair<int, int> Pi;
typedef pair<double, double> P;
signed main(){
    int n;cin>>n;
    cout<<n*n*n<<endl;
    
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static long Gcd(long a, long b)
        {
            return (a < b) ? Gcd(b, a)
                 : (b > 0) ? Gcd(b, a % b)
                           : a;
        }
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
        static long Solve(int N, int M, string S, string T)
        {
            long L = Lcm(N, M);
            var dict = new Dictionary<long, char>();
            for (int i = 0; i < N; ++i)
            {
                long j = L * i / N;
                dict[j] = S[i];
            }
            for (int i = 0; i < M; ++i)
            {
                long j = L * i / M;
                if (dict.ContainsKey(j) && dict[j] != T[i]) { return -1; }
            }
            return L;
        }
        static void Main(string[] args)
        {
            int[] V = ReadInts();
            var S = Read();
            var T = Read();
            Console.WriteLine(Solve(V[0], V[1], S, T));
        }
    }
}


Measured memory_bytes: 20832
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <functional>
#include <numeric>
#include <vector>
using namespace std;

const double PI=acos(-1);

int main(){
    int n, max = 0;
    cin >> n;
    for(int i = 1; i < 8; i++){
        if(pow(2, i) > n){
            cout << pow(2, i-1) << endl;
            break;
        }
    }
    return 0;
}

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

using namespace std;

int main() {
    
    string s;
    cin>>s;
    int r,b;
    r=0;
    b=0;
    int i;
    int n;
    n=s.size();
    for(i=0;i<=n-1;i++){
        if(s[i]=='0'){
            r=r+1;
        }else{
            b=b+1;
        }
    }
    if(r<=b){
        cout<<2*r<<endl;
    }else{
        cout<<2*b<<endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

signed main(){

	lli n;
	cin>>n;
	vector<lli> v(n);
	REP(i,0,n)cin>>v[i];

	sort(v.begin(),v.end());

	double sum=0;
	sum = v[0];

	REP(i,0,n-1){
		sum += v[i+1];
		sum /= 2.0;
	}
	cout<<sum<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	//<<<ここにプログラムを書く>>>
	int x,y;
	cin >> x >> y;
	if (x < y)
	{
		cout <<"a < b" << endl;
	}
	else if (x > y)
	{
		cout << "a > b" << endl;
	}
    else if (x == y)
	{
		cout << "a == b" << endl;
	}
	return 0;
}


Measured memory_bytes: 3072
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
    div = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            div.append(i)
            if i != n // i:
                div.append(n//i)
    if sortedresult:
        div.sort()
    return div
# endregion
A, B = ri_()
print(A + B if A + B < 10 else 'error')

Measured memory_bytes: 63724
/**
 *   author: malviyanshiv
 *   created: 18 August 2019  17:23:27
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define FORE(a) for(auto ele : a )
#define ALL(a) begin(a), end(a)
#define RPB(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define SET(a,b) memset(a,b,sizeof(a))

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

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


void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

int main(){
    optimizeIO();

    
    int n;
    string s;
    cin >> n >> s;
    if( n >= 3200)
        cout << s << endl;
    else
        cout << "red" << endl;
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = std::numeric_limits<long long>::max();
const double PI = acos(-1);
#define fir first
#define sec second
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Mfor(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, s, t, q, sum, last, ans = INF, a[1000000], b[10000];
struct Edge { LL to, cost; };
string str;
bool f[1600];
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
vector<Edge>vec[100000];
int main() {
	cin >> n;
	a[0] = 0;
	rep(i, n) {
		cin >> a[i + 1];
		sum += abs(a[i] - a[i + 1]);
	}
	a[n + 1] = 0;
	sum += abs(a[n + 1] - a[n]);
	rep(i, n) {
		cout << sum - abs(a[i + 1] - a[i]) - abs(a[i + 1] - a[i + 2]) + abs(a[i] - a[i + 2]) << endl;
	}
	return 0;
}

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

int main() {
  int N,M;
  cin >> N >> M;
  
  vector<int> height(N);
  for (int i = 0;i < N;i++){
    cin >> height.at(i);
  }
  //展望台の高さをとった

  
  vector<bool> good(N);
  for (int i = 0;i < N;i++){
    good.at(i) = true;
  }
  //全部いい展望台
  
  
  for (int i = 0;i < M;i++){
  int a,b;
  cin >> a >> b;
  //道取得
  if (height.at(a-1) >= height.at(b-1)){
    good.at(b-1) = false;
  }
  if (height.at(a-1) <= height.at(b-1)){
    good.at(a-1) = false;
  }
  }
  
  
  int count = 0;
  for (int i = 0;i < N;i++){
    if(good.at(i) == true){
      count++;
    }
  }
  
  cout << count << endl;
  
  
}


Measured memory_bytes: 3788
#include "bits/stdc++.h"
#define ll long long
#define inf 1000000007 //10^9+7
#define sort(vec) sort(vec.begin(),vec.end());
#define rever(vec) reverse(vec.begin(),vec.end());
#define unsort(vec) sort(vec); rever(vec);
#define gcd __gcd
using namespace std;

int main() {
  ll n,p;
  cin>>n>>p;
  bool odd=false;
  for(ll i=0;i<n;i++) {
    ll a;
    cin>>a;
    if(a%2==1) {
      odd=true;
      break;
    }
  }
  if(odd) {
    cout<<(ll)pow(2,n-1)<<endl;
  }
  else {
    if(p==0) {
      cout<<(ll)pow(2,n)<<endl;
    }
    else {
      cout<<"0"<<endl;
    }
  }
}

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

using namespace std;
using ll = long long;

/***********debug tools***********/
template<class T> ostream& operator<<(ostream& os, const pair<T,T>& p){os << "{" << p.first << "," << p.second << "}";return os; }
template<class T> inline void print(pair<T,T> p){cerr << p << endl;}
template<class T> inline void print(vector<T> arr) {cerr << "["; for(int i = 0; i < (int)arr.size(); i++)cerr << arr[i] << (i == (int)arr.size() - 1 ? "]" : ",");cerr << endl;}
template<class T> inline void print(vector<vector<T>> arr) {cerr << "[-------------------" << endl; for(int i = 0; i < (int)arr.size(); i++) { print(arr[i]);} cerr << "-------------------]" << endl;}
/*********************************/


int main()
{
    int n; cin >> n;
    vector<ll> sum(n + 1);
    vector<ll> a(n + 2);
    for(int i = 0; i <= n; i++) {
        cin >> a[i];
    }
    for(int i = n ; i >= 1; i--)sum[i - 1] = sum[i] + a[i];

    //許容限界値を決めていく
    vector<ll> lim(n + 1);
    lim[0] = 1;

    for(int i = 1; i <= n; i++) {
        lim[i] = min(lim[i - 1] * 2 - a[i], sum[i]);
        if(lim[i] < 0) {
            cout << -1 << endl;
            return 0;
        }
    }


    for(int i = 1;i <= n; i++) {
        if(lim[i] > lim[i - 1] * 2) {
            cout << -1 << endl;
            return 0;
        }
    }

    if((n != 0 && a[0] != 0) || (n == 0 && a[0] != 1)) {
        cout << -1 << endl;
        return 0;
    }

    if(n == 0) {
        cout << 1 << endl;  
        return 0;
    }

    cout << accumulate(lim.begin(), lim.end(), 0LL) + accumulate(a.begin(), a.end(), 0LL) << endl;
}

Measured memory_bytes: 5636
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int val;
    for(int x=1; x<=n; x++){
        val = x*1.08;
        if(val==n){
            cout << x << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

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

	if (A == B)
	{
		cout << "Draw" << endl;
	}
	else if (A == 1 || ((A > B) && (B != 1)))
	{
		cout << "Alice" << endl;
	}
	else
	{
		cout << "Bob" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
	string s,t;
	cin>>s>>t;
	int m = s.size();
	int n = t.size();
	int** dp = new int*[m+1];
	for(int i=0;i<=m;i++){
	    dp[i] = new int[n+1];
	}
	for(int i=0;i<=m;i++){
	    dp[i][0]=0;
	}
	for(int i=0;i<=n;i++){
	    dp[0][i]=0;
	}
	for(int i=1;i<=m;i++){
	    for(int j=1;j<=n;j++){
	        if(s[i-1]==t[j-1]){
	            dp[i][j] = 1 + dp[i-1][j-1];
	        }
	        else{
	            dp[i][j] = max(dp[i][j-1],dp[i-1][j]);
	        }
	    }
	}
	int len = dp[m][n];
	int i=m,j=n;
	string ans = "";
	while(len>0){
	    if(s[i-1]==t[j-1]){
	        ans  =  s[i-1]+ans ;
	        i--;
	        j--;
	        len--;
	    }
	    else{
	       if(dp[i-1][j]>dp[i][j-1]){
	           i--;
	       } 
	       else{
	           j--;
	       }
	    }
	}
	
	cout<<ans<<'\n';
 
}

Measured memory_bytes: 35456
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <sstream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
#include <bitset>
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define EPS 1e-8
#define LL_INF 0x3fffffffffffffff
#define INF 0x3f3f3f3f3f3f3f3f
#define MEM(a, b) memset(a, b, sizeof(a))
#define PPER(i, n, m) for (int i = n; i >= m; i--)
#define REPP(i, n, m) for (int i = n; i <= m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define PER(i, n, m) for (int i = n; i > m; i--)
#define SA(n) scanf("%d", &(n))
#define SLLA(n) scanf("%lld", &(n))
#define MP make_pair
#define FF first
#define SS second
#define PB push_back
#define DE(val) cout << #val << ": " << val << endl;

const int dx44[6] = {0, -1, -1, 1, 1};
const int dy44[6] = {0, -1, 1, -1, 1};
const int dx4[6] = {0, 1, 0,-1};
const int dy4[6] = {-1, 0, 1,0};
const int dx8[9] = {0, -1, 0, 1, 0, 1, 1, -1, -1};
const int dy8[9] = {0, 0, 1, 0, -1, 1, -1, 1, -1};
const int dx82[9] = {0, -1, -1, 1, 1, 2, 2, -2, -2};
const int dy82[9] = {0, 2, -2, 2, -2, 1, -1, 1, -1};
void update(ll& x,ll v){
    if(x==-1)x=v;
    else if(x>v)x=v;
}

ll po(ll a, ll b, ll mod)
{
    ll res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}
ll gcd(ll a, ll b)
{
    if (a == 0)
    {
        return b;
    }
    else
    {
        return gcd(b % a, a);
    }
}
void extgcd(ll a, ll b, ll &d, ll &x, ll &y)
{
    if (!b)
    {
        d = a;
        x = 1;
    }
    else
    {
        extgcd(b, a % b, d, y, x);
        y -= x * (a / b);
    }
}
ll inverse(ll a, ll n)
{
    ll d, x, y;
    extgcd(a, n, d, x, y);
    return d == 1 ? (x + n) % n : -1;
}
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const int maxn = 1e5 + 5;
const double PI = acos(-1.0);
const ll mod = 998244353;
/*************************************************************************/

char val[maxn];
void solve() {
    scanf("%s", val + 1);
    if(val[3] == val[4] && val[5] == val[6]) {
        puts("Yes");
    }  else {
        puts("No");
    }
}

int main()
{
#ifndef ONLINE_JUDGE
  //freopen("/Users/chong_wang/Desktop/ev/Code/i.txt", "r", stdin);
  //freopen("o.txt", "w", stdout);
#endif
     solve();
  return 0;
}





Measured memory_bytes: 256
#include<queue>
#include<cstdio>
#include<vector>
#include<functional>

#define	mp	make_pair
#define	pb	push_back

using namespace std;

typedef	vector<bool>	vb;
typedef	pair<int,int>	pii;
typedef	vector<pii>		vpii;

struct Edge{
	int cost,u,v;
	Edge(int _cost,int _u,int _v):cost(_cost),u(_u),v(_v){}
	bool operator>(const Edge &e)const{return cost>e.cost;}
};

int main(){
	for(int m,n;scanf("%d%d",&m,&n),m||n;){
		vector<vpii> adj(m+n+1);	// <cost,destination>
		for(int i=0;i<m;i++)for(int j=m;j<m+n;j++){
			int a;	scanf("%d",&a);
			if(a!=0){
				adj[i].pb(mp(a,j));
				adj[j].pb(mp(a,j));
			}
		}
		for(int i=m;i<m+n;i++)for(int j=i+1;j<m+n;j++){
			int a;	scanf("%d",&a);
			if(a!=0){
				adj[i].pb(mp(a,j));
				adj[j].pb(mp(a,i));
			}
		}
		int super=m+n;
		for(int i=0;i<m;i++){
			adj[super].pb(mp(0,i));
			adj[i].pb(mp(0,super));
		}

		vb visited(m+n+1);
		priority_queue< Edge,vector<Edge>,greater<Edge> > pq;
		pq.push(Edge(0,-1,super));	// vertual edge
		int total=0;
		while(!pq.empty()){
			Edge a=pq.top();	pq.pop();
			int cost=a.cost,v=a.v;
			if(visited[v])	continue;
			visited[v]=true;
			total+=cost;
			for(int i=0;i<adj[v].size();i++){
				int nextcost=adj[v][i].first;
				int nextnode=adj[v][i].second;
				if(!visited[nextnode])	pq.push(Edge(nextcost,v,nextnode));
			}
		}

		printf("%d\n",total);
	}

	return 0;
}

Measured memory_bytes: 0
def main():

    a,b,c,x,y = map(int, input().split())
    if x>y:
        if a+b>c*2:
            if a>c*2:
                print(c*2*x)
            else:
                print(c*2*y+a*(x-y))
        else:
            if a>c*2:
                print((a+b)*y+c*2*(x-y))
            else:
                print((a+b)*y+a*(x-y))
    elif x<y:
        if a+b>c*2:
            if b>c*2:
                print(c*2*y)
            else:
                print(c*2*x+b*(y-x))
        else:
            if b>c*2:
                print((a+b)*x+c*2*(y-x))
            else:
                print((a+b)*x+b*(y-x))
    else:
        if a+b>c*2:
            print(c*2*x)
        else:
            print((a+b)*x)


    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N=1e5+10;
const int mod=1e9+7;

int main()
{
    ll x;
    cin>>x;
    ll ans=0;
    if(x%2==1)
    {
        cout<<0<<endl;
    }
    else
    {
        x=x/2;
        while(x>=5)
        {
            x=x/5;
            ans+=x;
        }
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 3524
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] h = new int[100000001];
		boolean flag=false;
		for(int i=0;i<n;i++) {
			h[i]=sc.nextInt();
			if( i!=0 && h[i]>h[i-1] ) { //単調減少列が作れるかになっていた
					h[i]--;
			}
		}
		for(int i=0;i<n;i++) {
			if(i!=0 && h[i]<h[i-1]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}


Measured memory_bytes: 464976
//
// 正の整数 n の約数を列挙する, O(√n)
//
// verified
//   ABC 112 D - Partition
//     http://codeforces.com/contest/1034/problem/A
//


/*
	n の約数を返す
*/


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


vector<long long> calc_divisor(long long n) {
	vector<long long> res;
	for (long long i = 1LL; i*i <= n; ++i) {
		if (n % i == 0) {
			res.push_back(i);
			long long j = n / i;
			if (j != i) res.push_back(j);
		}
	}
	sort(res.begin(), res.end());
	return res;
}


int main() {
	long long N, M;
	cin >> N >> M;
	vector<long long> div = calc_divisor(M);
	
	// M の約数 d であって、d * N <= M となる最大の d を求める
	long long res = 1;
	for (auto d : div) {
		if (d * N <= M) res = max(res, d);
	}

	cout << res << endl;
}

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


int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;
    cin>>n;
    map<string,int> mp;
    ll cnt = 0;
    for(int i =0; i< n; i++){
        string t;
        cin>>t;
        sort(t.begin(),t.end());
        
        if(mp.find(t) == mp.end()){
            mp.insert(make_pair(t,1));
         }else{
            cnt += mp[t]++;
        }
    }

    cout<< cnt <<endl;
    return 0;
}


Measured memory_bytes: 11264