akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
const int INF = 0x3f3f3f3f;
const int NIL = -1;
const int MAXN = 100005;

struct Node{ int p, l, r;}T[MAXN];

int n, D[MAXN], H[MAXN];

int getDegree(int u){
	int degree = 0;
	if(T[u].l != NIL)	degree++;
	if(T[u].r != NIL)	degree++;
	return degree;
}

int getSibling(int u){
	if(T[u].p == NIL)	return NIL;
	if(T[T[u].p].l != u)	return T[T[u].p].l;
	else	return T[T[u].p].r;
}

void print(int u){
	cout << "node " << u << ": parent = " << T[u].p;
	cout << ", sibling = " << getSibling(u);
	cout << ", degree = " << getDegree(u);
	cout << ", depth = " << D[u];
	cout << ", height = " << H[u] <<", ";
	if(T[u].p == NIL)	cout <<"root";
	else if(!getDegree(u))	cout << "leaf";
	else	cout << "internal node";
	cout << endl;
}

void setDepth(int u, int p){
	if(u == NIL)	return;
	D[u] = p;
	setDepth(T[u].r, p + 1);
	setDepth(T[u].l, p + 1);
}

int setHeight(int u){
	int h1 = 0, h2 = 0;
	if(T[u].l != NIL)
		h1 = setHeight(T[u].l) + 1;
	if(T[u].r != NIL)
		h2 = setHeight(T[u].r) + 1;
	return H[u] = max(h1, h2);
}

int main(){
	cin >> n;
	int p, l, r, loc;
	for(int i = 0; i < n; i++)	T[i].p = NIL;	
	for(int i = 0; i < n; i++){
		cin >> p >> l >> r;
		T[p].l = l;
		T[p].r = r;
		if(l != NIL)	T[l].p = p;
		if(r != NIL)	T[r].p = p;
	}
	for(int i = 0; i < n; i++)
		if(T[i].p == NIL)
			loc = i;
	setDepth(loc, 0);
	setHeight(loc);
	for(int i = 0; i < n; i++)	print(i);
	return 0;
}

Measured memory_bytes: 3088
def do():
    if s.find("W") == -1:
        print(0)
        return
    c1 = s.count("W")
    c2 = s.count("R")
    c3 = 0
    l = 0
    r = len(s) - 1
    ll = len(s)
    while l < r and r >= 0 and l <= (ll-1):
        #print(l, r)
        if s[l] == "R":
            l += 1
            continue
        if s[r] == "W":
            r -= 1
            continue
        #print("c3+", l, r)
        c3 += 1
        l += 1
        r -= 1
    #print(c1,c2,c3)
    print(min(c1,c2,c3))


n = int(input())
s = input()
do()


Measured memory_bytes: 67572
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////
int N, A, B, C;
int l[10];
int d[10];
int def(int n) {
	if (n == N) {
		int p = 0, q = 0, r = 0;
		int cost = 0;
		for (int i = 0; i < N; ++i) {
			if (d[i] == 1) {
				if (p > 0)cost += 10;
				p+=l[i];
			}
			else if (d[i] == 2) {
				if (q > 0)cost += 10;
				q+=l[i];
			}
			else if (d[i] == 3) {
				if (r > 0)cost += 10;
				r+=l[i];
			}
		}
		if (p*q*r == 0)return INF;
		else return cost + abs(A - p) + abs(B - q) + abs(C - r);
	}
	int r = INF;
	for (int i = 0; i <= 3; ++i) {
		d[n] = i;
		r = min(r, def(n + 1));
	}
	return r;
}
int main() {
	cin >> N >> A >> B >> C;
	REP(i, N)cin >> l[i];
	cout << def(0)<< endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int board[8] = { -20, -20, -20, -20, -20, -20, -20, -20 };
int check[8];
int flag;
int count;

void output(int box[]) {
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (j == box[i])
	printf("Q");
      else
	printf(".");
    }
    printf("\n");
  }
}

void eight_queens(int c, int box[]) {
  if (c == 8) {
    output(box);
  }
  else if (check[c] == 1){
    eight_queens(c + 1, box);
    if (check[c + 1] == 0)
      box[c + 1] = -20;
  }
  else {
    int flag;
    for (int i = 0; i < 8; i++) {
      flag = 0;
      for (int j = 0; j < 8; j++) {
	if (i == box[j] || i == box[j] - c + j || i == box[j] + c - j)
	  flag = 1;
      }
      if (flag == 0) {
	box[c] = i;
	eight_queens(c + 1, box);
      }
      if (check[c + 1] == 0)
	box[c + 1] = -20;
    }
  }
}


int main(void) {
  int n, r, c;

  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    if(i < n)break;
  }
  
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &r, &c);
    board[r] = c;
    check[r] = 1;
  }

  eight_queens(0, board);
		
  //printf("Fin\n");
  //while(1) {}

  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

signed main(){
    string S, T, U;
    int A, B;
    cin >> S >> T >> A >> B >> U;
    if(S == U){
        cout << A - 1 << " " << B << endl;
    }else{
        cout << A << " " << B - 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;

int n, m;

int main() {
	cin >> n >> m;
	vector<pair<int, int>>v;
	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		pair<int, int>p = make_pair(y, x);
		v.push_back(p);
	}
	sort(v.begin(), v.end());
	vector<int>count;
	count.push_back(v[0].first - 1);
	for (int i = 1; i < m; i++) {
		int y = v[i].first, x = v[i].second;
		int b = count.back();
		if (!(x <= b && b < y))count.push_back(y - 1);
	}
	cout << count.size() << endl;
}

Measured memory_bytes: 1400
#include <iostream>
    #include <utility>
    #include <cstdio>
    #include <algorithm>
    #include <vector>
    #include <string>
    #include <set>
    #include <cmath>
             
    typedef long long ll;
    using namespace std;
    const ll INF = 1000000000000000000ll;
    const ll MOD = 1000000007ll;
       
    #define PI 3.14159265358979323846
             
    const double EPS = 1e-8;
            
    int main()
    {
       	ll N,M,a,b;
     
    	cin >> N >> M;
     
    	vector<ll> rN(N,0);
    	
    	for(int i=0;i<M;i++){
    		cin >> a >> b;
    		rN[a-1]++;
    		rN[b-1]++;
    	}
     
    	for(int i=0;i<N;i++){
    		cout << rN[i] << endl;
    	}
     
       	return 0;
    }

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

using namespace std;

#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 1; i <= n; ++i)

vector<string> v;

int main() {
    string s;
    cin >> s;

    int K;
    scanf("%d", &K);

    // printf("%lu\n", strlen(s));
    REP1(j, 5) {
        REP(i, s.size()) {
            if (s.size() < i + j) break;
            // REP(k, j) {
            //     printf("%c", s[i + k]);
            // }
            // printf("\n");

            v.push_back(s.substr(i, j));
        }
    }

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

    printf("%s\n", v[K - 1].c_str());

    return 0;
}


Measured memory_bytes: 1660
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;

int SumDigits(int x){
  int sum =0;
  while(x>0){
    sum+=x%10;
    x/=10;
  }
  return sum;
}

int main() {
  int n,a,b;
  cin>>n>>a>>b;
  int res=0;
  for(int i=1;i<=n;i++){
    if(SumDigits(i)>=a && SumDigits(i)<=b){
      res+=i;
    }
  }
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAXN 10
bool hxh[10],hxs[10],hxx1[16],hxx2[16];
int n;
int q=0;
char map1[MAXN][MAXN];
void input(){
	cin>>n;
	int xx,yy;
	for(int i=0;i<n;++i){
	    cin>>xx>>yy;
	    map1[xx][yy]='Q';
	    hxh[xx]=1;
	    hxs[yy]=1;
	    hxx1[xx+yy]=1;
	    hxx2[7-xx+yy]=1;
	}
}
void syf(int x){
	if(hxh[x]==1) syf(x+1);
	if(x==8){
		for(int i=0;i<8;++i){
			for(int j=0;j<8;++j){
				if(map1[i][j]==0) cout<<".";
				else cout<<map1[i][j];
			}
			cout<<endl;
		}
		q=1;
		return;
	}
	if(q==1) return;
	for(int i=0;i<8;++i){
		if(!hxs[i]&&!hxx1[x+i]&&!hxx2[7-x+i]){
			hxs[i]=1;
			hxx1[x+i]=1;
			hxx2[7-x+i]=1;
			map1[x][i]='Q';
			syf(x+1);
			hxs[i]=0;
			hxx1[x+i]=0;
			hxx2[7-x+i]=0;
			map1[x][i]=0;
		}
	}
}
int main(){
	input();
	syf(0);
	return 0;
}

Measured memory_bytes: 3096
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(int i=0;i<N;++i)
typedef long long int LL;
typedef std::pair<LL, LL> P;
struct edge { LL to, cost; };

LL n, k;
LL d[112];
std::vector<edge>G[112];

void dijkstra(LL s)
{
	std::priority_queue<P, std::vector<P>, std::greater<P>>que;
	std::fill(d, d + n + 1, INF);
	d[s] = 0;
	que.push(P(0, s));
	while (!que.empty())
	{
		P p = que.top(); que.pop();
		LL v = p.second;
		if (d[v] < p.first) { continue; }
		rep(i, G[v].size())
		{
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost)
			{
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		}
	}
}

int main()
{
	while (true)
	{
		n = k = 0;
		memset(d, 0, sizeof(d));
		rep(i, 112) { G[i].clear(); }

		in >> n >> k;
		if (n == 0 && k == 0) { break; }
		rep(loop, k)
		{
			LL flag;
			in >> flag;
			if (flag == 0)
			{
				LL a, b;
				in >> a >> b;
				dijkstra(a);
				out << (d[b] == INF ? -1 : d[b]) << std::endl;
			}
			else
			{
				LL c, d, e;
				in >> c >> d >> e;
				G[c].push_back({ d,e });
				G[d].push_back({ c,e });
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3144
//
// Created by 童正阳 on 2018/9/14.
//
#include <iostream>
using namespace std;
int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    int v[10];
    for (int i = 0; i < 10; i++)
        v[i] = 0;
    v[A] ++, v[B] ++, v[C] ++;
    if (v[5] == 2 && v[7] == 1) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
 
    using namespace std;
    using namespace __gnu_pbds;
 
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define int long long 
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
 
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
 
    #define what(x) cerr << #x << " is " << x << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
 
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1;
 
/*.....................................................................................................................*/
 
    const ll mod=(ll)1e9+ 7;
 
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
 
    long long binpow(long long x, long long p) 
    {
        if (p == 0) {return 1;} 
    	if (p == 2 || (p & 1)) {return mult(x, binpow(x, p - 1));}
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
 
    //A.erase(unique(A.begin(),A.end()),A.end());
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll  man  =   (int)200005   ,  inf   =   1e18;
 
 
/*......................................................................................................................*/


signed main()
{
    fast;
    string s,t;
    cin>>s>>t;
    int n=s.length(),m=t.length();
    vector<vector<int>>lcs(n+1,vector<int>(m+1));
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                lcs[i][j]=0;
            }
            else 
            {
                if(s[i-1]==t[j-1])
                {
                    lcs[i][j]=lcs[i-1][j-1]+1;
                }
                else 
                {
                    lcs[i][j]=max(lcs[i-1][j],lcs[i][j-1]);
                }
            }
        }
    }
    string ans;
    int i=n,j=m;
    while(i>0&&j>0)
    {
        if(s[i-1]==t[j-1])
        {
            ans+=s[i-1];
            i--;
            j--;
        }
        else if(lcs[i-1][j]>lcs[i][j-1])i--;
        else j--;
    }
    reverse(ans.begin(),ans.end());
    cout<<ans<<endl;
}   

Measured memory_bytes: 73648
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define MOD7 1000000007
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    int N;
    string S;
    cin >> N >> S;
    int count = 1;
    for(int i = 0; i < N - 1; i++){
        if(S[i] != S[i + 1]) count++;
    }
    cout << count << endl;
}

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

int main() {
  int N, X, P=0, Sum=1;
  cin >> N >> X;
  vector<int> L(N);
  rep(i, N) cin >> L.at(i);
  rep(i, N){
    P=P+L.at(i);
    if(P<=X) Sum++;
  }
  cout << Sum << endl;
}

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

int main(void){
  double w,h,x,y,ans,ans_times;
  cin>>w>>h>>x>>y;
  double square=w*h/2;
  if(2*x==w&&2*y==h){
  	ans_times=1;
  }else{
  	ans_times=0;
  }
  cout<<square<<" "<<ans_times<<endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define long int64_t

struct Solver {
	void solve() {
		int N;
		cin >> N;

		long ans = 0;
		for( int i = 1; i <= N; ++i ) {
			long y = N/i;
			ans += y * (y+1) * i / 2;
		}

		cout << ans << endl;
	}
};

int main() {
	ios::sync_with_stdio( false );
	cout << fixed << setprecision( 10 );
	Solver().solve();
	return 0;
}


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

using namespace std;

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

    int a,b,c;
    cin >> a >> b >> c;
    int k;
    cin >> k;
    while(b<=a) {
        b*=2;
        k--;
    }
    while(c<=b) {
        c*=2;
        k--;
    }
    if(k>=0)
        cout << "Yes\n";
    else
        cout << "No\n";

    return 0;
}


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

int main() {

  long long int a, b, c;
  cin >> a >> b >> c;

  long long int ans = 0;

  for ( long long int i = a; i <= b; i++ ) {

    if ( ( c % i ) == 0 ) ans++;

  }

  cout << ans << endl;

  return 0;

}

Measured memory_bytes: 1156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC138
{
    class Program
    {
        static void Main(string[] args)
        {
            B();

            Console.Read();
        }

        static void B()
        {
            int N = int.Parse(Read());
            string[] s = Read().Split(' ');
            int[] A = new int[N];
            for (int i = 0; i < N; i++) A[i] = int.Parse(s[i]);

            double sum = 0;
            foreach (int itemp in A) sum += 1 / (double)itemp;
            double answer = 1 / sum;
            Show(answer.ToString());

        }

        static void A()
        {
            int a = int.Parse(Read());
            string s = Read();
            if (a >= 3200) Show(s);
            else Show("red");
        }

        




        static string Read() { return Console.ReadLine(); }
        static void Show(string s) { Console.WriteLine(s); }
    }
}


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

#define swap(x,y) {int tmp; tmp=x; x=y; y=tmp;}

void sort(int *card,int n){
  int i,j,tmp,pnt;
  for(i=0; i<n; i++){
    tmp = 0;
    for(j=i; j<n; j++){
      if(tmp<card[j]){
        tmp = card[j];
        pnt = j;
      }
    }
   swap(card[i],card[pnt]);
  }
}

int main(){
  int N,Alice=0,Bob=0,i;

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

  sort(a,N);
  for(i=0; i<N; i++){
    (i%2==0)? Alice += a[i] : Bob += a[i];
  }
  cout << Alice-Bob << endl;
}

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

// 3つの数のうち真ん中が2番目に小さいときに1、そうでないとき0
int func1(int p1, int p2, int p3) {
  return (p1<p2)?(p2<p3)?1:0:(p3<p2)?1:0;
}

int main() {
  int i, n;
  int *p;
  scanf("%d", &n);
  p = malloc(sizeof(int)*n);
  for (i=0; i<n; i++) {
    scanf("%d", p+i);
  }
  int rslt = 0;
  for (i=1;i<n-1;i++) {
    rslt += func1(p[i-1], p[i], p[i+1]);
  }
  printf("%d\n", rslt);
  return 0;
}


Measured memory_bytes: 128
import os
import sys
from io import BytesIO, IOBase
# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------------------

from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def RL(): return map(int, sys.stdin.readline().rstrip().split())
def RLL(): return list(map(int, sys.stdin.readline().rstrip().split()))
def N(): return int(input())
def comb(n, m): return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0
def perm(n, m): return factorial(n) // (factorial(n - m)) if n >= m else 0
def mdis(x1, y1, x2, y2): return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')

# ------------------------------
# f = open('../input.txt')
# sys.stdin = f

def main():
    n = N()
    arr = RLL()

    sm = 0
    for i in arr:
        sm^=i
    res = []

    for i in arr:
        res.append(i^sm)

    print(*res)


if __name__ == "__main__":
    main()



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

int main()
{

  int a, b;
  cin >> a >> b;

  if( (a * b) % 2 == 0){
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()

const string NO = "Impossible";

int main(){
    ll n, m;
    cin >> n >> m;

    vector<ll> a(n);
    REP(i, n){ cin >> a.at(i); }

    vector<vector<ll>> to(n);
    REP(i, m){
        ll xi, yi;
        cin >> xi >> yi;
        to.at(xi).push_back(yi);
        to.at(yi).push_back(xi);
    }

    vector<bool> vis(n, false);
    vector<ll> rest;
    ll ans = 0;
    ll num_conn = 0;
    REP(i, n){
        if(vis.at(i)){ continue; }
        vis.at(i) = true;
        num_conn++;
        vector<ll> comp({i});
        const auto dfs = [&](const auto& self, ll cur) -> void{
            for(ll nxt : to.at(cur)){
                if(vis.at(nxt)){ continue; }
                vis.at(nxt) = true;
                comp.push_back(nxt);
                self(self, nxt);
            }
        };
        dfs(dfs, i);
        vector<ll> tmp;
        for(ll j : comp){
            tmp.push_back(a.at(j));
        }
        sort(ALL(tmp));
        ans += tmp.front();
        for(ll j = 1; j < tmp.size(); ++j){
            rest.push_back(tmp.at(j));
        }
    }

    if(num_conn == 1){
        cout << 0 << endl;
    }else if(num_conn > 2 && rest.size() < num_conn - 2){
        cout << NO << endl;
    }else{
        sort(ALL(rest));
        REP(i, num_conn - 2){
            ans += rest.at(i);
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 13212
#include <iostream>
#include <map>

using namespace std;

int main() {
    while(true) {
        int N;
        cin >> N;
        if(!N) break;

        map<int, int> cnt;
        for(int i = 0; i < N; ++i) {
            int num;
            cin >> num;
            cnt[num]++;
        }
        int ans = -1;
        for(map<int,int>::iterator it = cnt.begin(); it != cnt.end(); ++it) {
            if(it->second > N/2) {
                ans = it->first;
                break;
            }
        }
        if(ans == -1) cout << "NO COLOR" << endl;
        else cout  << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 1936
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <deque>
using namespace std;
int main(){
    int r,g,b;
    string ans = "NO";
    cin >> r >> g >> b;
    int num = 100*r+10*g+b;
    if(num%4==0){
        ans = "YES";
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
 
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp;

fn main() {
    input! {
        n: usize,
        activity: [(usize, usize, usize); n],
    }

    let mut dp = vec![vec![0; 3]; n];
    dp[0][0] = activity[0].0;
    dp[0][1] = activity[0].1;
    dp[0][2] = activity[0].2;
    for i in 1..n {
       dp[i][0] = cmp::max(dp[i-1][1], dp[i-1][2]) + activity[i].0;
       dp[i][1] = cmp::max(dp[i-1][0], dp[i-1][2]) + activity[i].1;
       dp[i][2] = cmp::max(dp[i-1][0], dp[i-1][1]) + activity[i].2;
    }

    let ans = cmp::max(cmp::max(dp[n-1][0], dp[n-1][1]), dp[n-1][2]);

    println!("{}", ans);
}




Measured memory_bytes: 14588
def main():
    values = list(map(int, input().split()))
    query = input()

    dice = Dice(values)
    for d in query:
        dice.roll(d)

    print(dice.top_value)


class Dice:

    def __init__(self, values):
        self.values = values
        # top, bottom, direction 4
        self.t = 1
        self.b = 6
        self.w = 4
        self.e = 3
        self.n = 5
        self.s = 2

    def __repr__(self):
        labels = {
            "t": self.t,
            "b": self.b,
            "w": self.w,
            "e": self.e,
            "n": self.n,
            "s": self.s,
        }
        return "<%s (%s, %s)>" % (self.__class__, self.values, labels)

    def roll(self, direction):
        if direction == "E":
            after_lables = self.t, self.b, self.e, self.w
            self.e, self.w, self.b, self.t = after_lables
        elif direction == "W":
            after_lables = self.t, self.b, self.e, self.w
            self.w, self.e, self.t, self.b = after_lables
        elif direction == "S":
            after_lables = self.t, self.b, self.n, self.s
            self.s, self.n, self.t, self.b = after_lables
        elif direction == "N":
            after_lables = self.t, self.b, self.n, self.s
            self.n, self.s, self.b, self.t = after_lables

    @property
    def top_value(self):
        return self.values[self.t - 1]

if __name__ == "__main__":
    main()

Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define 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 llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int main(){	
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	string s;
	cin >> s;
	int cnt = 0;
	int a=0, b=0;
	for(char& c : s) {
		if(c=='0'){
			if(cnt%2 == 0) a++;
			else b++;
		} else {
			if(cnt%2 == 0) b++;
			else a++;
		}
		cnt++;
	}
	int res = min(a, b);
	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 512
N = int(input())
B = [int(_) for _ in input().split()]

A = 0
ans = 0

ans = B[0]

for i in range(N - 2):
    if B[i] <= B[i+1]:
        ans += B[i]
    else:
        ans += B[i+1]

ans += B[N-2]

print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;
  int amari;
  int count = 0;
  amari = K - A;
  if (amari >= 0) {
  	count += A * 1;
    amari -= B;
    if (amari >= 0) {
	    amari -= C;
    	if (amari >= 0) {
        	count += C * -1;
        } else {
        	count += (C + amari ) * -1;
        }
    }
  } else {
    count += (A + amari) * 1;
  }
  cout << count << endl;
}

Measured memory_bytes: 3624
def erase(line)
  (1..9).each do |i|
    5.downto(3).each do |j|
      line.gsub!(/#{i.to_s}{#{j}}/, '0'*j)
    end
  end
  line
end

def sum(board)
  board.flat_map{ |l| l.split('') }.map(&:to_i).reduce(:+)
end

def fall(board)
  5.times.each do |i|
    loop do
      f = true
      (@h - 1).downto(1) do |j|
        if board[j][i] == '0' && board[j - 1][i] != '0'
          board[j][i], board[j - 1][i] = board[j - 1][i], board[j][i]
          f = false
        end
      end
      break if f
    end
  end
end

def solve(board)
  loop do
    score = sum(board)
    board.map!{ |l| erase(l) }
    fall(board)
    break if score == sum(board)
  end
  sum(board)
end

while (@h = gets.to_i) != 0
  board = @h.times.map{ gets.chomp.delete(' ') }
  score = sum(board)
  puts score - solve(board)
end

Measured memory_bytes: 10632
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long A = sc.nextLong();
		long B = sc.nextLong();
		long[] X = new long[N];
		for (int i = 0; i < N; ++i) {
			X[i] = sc.nextLong();
		}
		long ans = 0;
		for (int i = 1; i < N; ++i) {
			if (A * (X[i] - X[i - 1]) > B) {
				ans += B;
			} else {
				ans += A * (X[i] - X[i - 1]);
			}
		}
		System.out.println(ans);
	}
}


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

using namespace std;
#define sqr(x) ((x)*(x))
#define cube(x) ((x)*(x)*(x))
#define GCD(a, b) __gcd(a, b)
#define LCM(a, b) ((a)*(b)/GCD(a,b))
#define MP make_pair
#define n1 first
#define n2 second
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define SI set<int>
#define SL set<ll>
#define MS multiset
#define MSI multiset<int>
#define MSLL multiset<ll>
#define PB push_back
#define PF push_front
#define VI vector<int>
#define VPI vector<pair<int,int>>
#define VLL vector<ll>
#define SZ(x) ((int)x.size())

typedef long long ll;

typedef unsigned long long ull;
typedef long double ld;
typedef double db;
const int INF = 1e9;
const int MOD = 1000000007;
const int N = 202055;
const int M = 1211;

void solve() {
    string s;
    cin >> s;

    int n = SZ(s);

    for (int i = 0; i < n; i++){
        for (int j = i+1; j <= i+2; j++){
            if (s[i] == s[j]){
                cout << i+1 << ' ' << j+1;
                return;
            }
        }
    }

    cout << -1 << ' ' << -1;

}

int main() {
    ios_base::sync_with_stdio(false);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int T = 1;
    //cin >> T;

    while (T--) {
        solve();
    }

    return 0;
}

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

int l[100];
main()
{
    int n,x,sum=0;
  	cin>>n; 	
    for(int i=0;i<n;i++)
    {
        cin>>l[i];
        sum+=l[i];
    }
    sort(l,l+n);
    x=l[n-1];
  	sum-=x;
    if(x<sum)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <math.h>
#include <string.h>
#include <map>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#define INF 1000000
#define MAX 500000
#define pb push_back
#define mp make_pair
#define UNVISITED 0
using namespace std;
typedef long long int ll;
typedef vector <ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
int main()
{
//  freopen("input.txt","r",stdin);
 //freopen("output.txt","w",stdout);
 ll n,m;
 cin>>n>>m;
 cout<<(n+m)%24<<endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int q, n, m, f, v[111]; double p[111], r[12], sum;
int main() {
	cin >> q;
	for (int i = 0; i <= q; i++) {
		cin >> n >> m; sum = 0.0;
		for (int j = 0; j < m; j++) cin >> v[j] >> p[j], sum += p[j];
		for (int j = 0; j < m; j++) r[i] += v[j] * p[j] / sum;
	}
	for (int i = 0; i < q; i++) f = f | ((r[i] > r[q] + 1e-7) ? 1 : 0);
	cout << (f ? "YES" : "NO") << endl;
	return 0;
}

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

using namespace std;
#define ll long long int

string solution(ll n){
ll a[10000];
ll k=0;
while(n){
    a[k] = n%26;
    n = n/26;
    k++;
}
for(ll i = 0;i<k-1;i++){
    if(a[i]<=0){
        a[i]+=26;
        a[i+1] = a[i+1]-1;
    }
}
string str = "";
for(ll i = k;i>=0;i--){
    if(a[i]>0)
        str+=char('a'+a[i]-1);
}
return str;
}
int main()
{
    ll n;
    cin>>n;
    cout<<solution(n)<<endl;
}


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

struct ST {
	int n;
	vector<int> A;
	ST(const vector<int> &v) {
		int sz = v.size();
		n = 1; while (n < sz) n *= 2;
		A.resize(2 * n - 1);
		for (int i = 0; i < sz; i++) A[i + n - 1] = v[i];
		for (int i = n - 2; i >= 0; i--) A[i] = max(A[2 * i + 1], A[2 * i + 2]);
	}
	void update() {
		int x = getidx();
		A[x] >>= 1;
		while (x > 0) {
			x = (x - 1) / 2;
			A[x] = max(A[2 * x + 1], A[2 * x + 2]);
		}
	}
	int getidx(int i = 0) {
		if (i >= n - 1) return i;
		int l = A[2 * i + 1];
		int r = A[2 * i + 2];
		if (l > r) getidx(2 * i + 1);
		else getidx(2 * i + 2);
	}
	void set(int x) {
		x += (n - 1);
		A[x] >>= 1;
		while (x > 0) {
			x = (x - 1) / 2;
			A[x] = max(A[2 * x + 1], A[2 * x + 2]);
		}
	}
	uint64_t ans() {
		uint64_t tmp = 0;
		for (int i = n - 1; i < 2 * n - 1; i++) {
			tmp += A[i];
		}
		return tmp;
	}
};

int main() {
	int N, M; cin >> N >> M;
	vector<int> A(N);
	rep(i, N) cin >> A[i];

	ST st(A);
	rep(i, M) {
		st.update();
	}
	cout << st.ans() << endl;
}

Measured memory_bytes: 1664
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<climits>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<stack>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int main()
{
	int A,B;
	scanf("%d%d",&A,&B);
	if(A==1)A=14;
	if(B==1)B=14;
	if(A==B)puts("Draw");
	else if(A<B)puts("Bob");
	else puts("Alice");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll        = long long;
using ld        = long double;
using vl        = vector<ll>;
using vd        = vector<ld>;
using vs        = vector<string>;
using vb        = vector<bool>;
using vvl       = vector<vector<ll>>;
using vvd       = vector<vector<ld>>;
using vvs       = vector<vector<string>>;
using vvb       = vector<vector<bool>>;
using pll       = pair<ll, ll>;
constexpr ll mod= 1e9 + 7;
#define ALL(x) (x).begin(), (x).end()
#define REP(i, n) for(ll(i)= 0; (i) < (n); (i)++)
#define REPS(i, n) for(ll(i)= 1; (i) <= (n); (i)++)
#define RREP(i, n) for(ll(i)= (n - 1); (i) >= 0; (i)--)
#define RREPS(i, n) for(ll(i)= (n); (i) > 0; (i)--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())
#define YES(n) ((n) ? "YES" : "NO")
#define Yes(n) ((n) ? "Yes" : "No")
#define yes(n) ((n) ? "yes" : "no")

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

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans = max({a*d,a*c,b*c,b*d});
    cout << ans << "\n";
}

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

#define ull unsigned long long
#define endl '\n'
#define ll long long
const int N = 1e3 + 5;
ll a[N], dp[1 << 12];
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        cout.tie(0);
        if (fopen(".INP", "r")){
                freopen(".INP", "r", stdin);
                freopen(".OUT", "w", stdout);
        }
        ll n;
        cin >> n;
        ll m;
        cin >> m;
        dp[0] = 0;
        for (int i = 0; i < (1ll << n); i++) dp[i] = 1e18;
        for (int i = 1; i <= m; i++){
                ll k;
                cin >> a[i] >> k;
                ll sum = 0;
                for (int j = 0; j < k; j++){
                        ll x;
                        cin >> x;
                        sum |= (1ll << (x - 1));
                }
                for (int j = 1; j < (1ll << n); j++){
                        if ((sum & j) == j) {
                                dp[j] = min(dp[j], a[i]);
                        }
                }
        }
        for (int i = 1; i < (1ll << n); i++){
                for (int j = 1; j <= i; j++){
                        if ((i & j) == j){
                                ll x = i;
                                x ^= j;
                                dp[i] = min(dp[i], dp[j] + dp[x]);
                        }
                }
        }
        if (dp[(1ll << n) - 1] != 1e18) cout << dp[(1ll << n) - 1];
        else cout << -1;
}


Measured memory_bytes: 384
///-----Bismillahir Rahmanir Rahim-----///

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

///---FAST I/O---///
#define Boost() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

///---DATA TYPE---///
typedef long long ll;
typedef long long int lli;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int>::iterator vit;
typedef set<int>::iterator sit;

///---LOOP---///
#define rep0(i,n) for(i=0;i<n;i++)
#define rep1(i,n) for(i=1;i<=n;i++)

///---I/O---///
#define sf scanf
#define pf printf

///---OTHERS---///
#define pb push_back
#define all(c)		c.begin(),c.end()
#define MK make_pair
#define F first
#define S second
#define endl '\n'


///---INITIALIZATION---//
#define mem(a,b) memset(a, b, sizeof(a) )

///---CALCULATE---///
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define sqr(a) ((a) * (a))

///---BIT OPERATION---///
inline bool checkBit(ll n, int i)
{
    return n&(1LL<<i);
}
inline ll setBit(ll n, int i)
{
    return n|(1LL<<i);;
}
inline ll resetBit(ll n, int i)
{
    return n&(~(1LL<<i));
}

///------String/Char Related Functions-----///
string makeintString(int x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
string makellString(ll x)
{
    stringstream ss;
    ss << x;
    string str = ss.str();
    ///cout<<str<<endl;
    return str;
}
char cpp(char c)
{
    return static_cast<char>(c + 1);
}

///------------Sorting STL----------///
struct func
{
	//this is a sample overloading function for sorting stl
	bool operator()(pii const &a, pii const &b)
	{
		if(a.F==b.F)
			return (a.S<b.S);
		return (a.F<b.F);
	}
};

///---CONSTANT---///
const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

int cnt[100];
int main()
{
    Boost();

    int t;
    t=1;
    //cin>>t;
    while(t--)
    {
        string s;
        cin>>s;
        int n=s.size();
        for(int i=0;i<n;i++)
        {
           int tmp=s[i]-'0';
           cnt[tmp]++;
        }
        for(int i=49;i<=74;i++)
        {
            if(cnt[i]%2==1)
            {
                cout<<"No"<<endl;
                return 0;
            }
        }
        cout<<"Yes"<<endl;

    }
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>/*{{{*/
#include <bits/stdc++.h>
#define rep(i, x) for(int i = 0; i < (int)(x); i++)
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define debug(x)                 cerr << __LINE__ << ": " << #x << " -> " << x << '\n'
#define debug2(x, y)             cerr << __LINE__ << #x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define debug3(x, y, z)          cerr << __LINE__ << #x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define debug4(a, b, c, d)       cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define debug5(a, b, c, d, e)    cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define debug6(a, b, c, d, e, f) cerr << __LINE__ << #a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define INF 999999999
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};/*}}}*/

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin >> n;
  vi a(n); rep(i,n)cin >> a[i];
  sort(all(a));

  cout << a[n-1]-a[0] << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
   	ll x,i;
   	ll dp[1000002];
   	for(i=0;i<99;i++) dp[i]=0;
   	dp[100]=1; dp[101]=1; dp[102]=1; dp[103]=1; dp[104]=1; dp[105]=1;
   	for(i=106;i<1000002;i++) {
   		if(dp[i-100]||dp[i-101]||dp[i-102]||dp[i-103]||dp[i-104]||dp[i-105]) dp[i]=1;
   		else dp[i]=0;
   	}
   	cin >> x;
   	cout << dp[x] << "\n";
    return 0;
}



Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b)  for(int i=(a),i##formax=(b);i< i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formin=(b);i>=i##formin;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max((x),(y))
#define mins(x,y) x=min((x),(y))
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define all(a) ((a).begin()),((a).end())
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define bit(n) (1LL<<(n))
typedef long long ll;
typedef __int128_t lll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>using P=pair<T,Y>;
template<class T,class Y>ostream& operator<<(ostream&o,P<T,Y>&p){return o<<"("<<p.fi<<","<<p.se<<")";}
template<class T>ostream& operator<<(ostream&o,V<T>&v){for(T&t:v)o<<t<<",";return o;}
template<class T>void uniq(V<T>&v){sort(all(v));v.erase(unique(all(v)), v.end());}
template<class A,size_t N,class T>void Fill(A(&a)[N],const T&v){fill((T*)a,(T*)(a+N),v);}

const int MOD = 1e9+7; //998244353;

lll gcd(lll a,lll b,lll&x,lll&y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll modInv(ll a,ll m=MOD){lll x,y;gcd(a,m,x,y);return(x%m+m)%m;}
ll modPow(lll a,lll n,ll m=MOD){lll p=1;for(;n;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return p;}
//V<ll>Fac,Rac;void setF(int n,int m=MOD){Fac=Rac=V<ll>(++n);Fac[0]=1;FOR(i,1,n)Fac[i]=Fac[i-1]*i%m;Rac[n-1]=modInv(Fac[n-1],m);FORR(i,n-1,1)Rac[i-1]=Rac[i]*i%m;}
//ll comb(int a,int b,int m=MOD){return a<b||b<0?0:Fac[a]*Rac[b]%m*Rac[a-b]%m;}

const int IINF = 1e9+6;
const ll LINF = 1e18;
const int N = 2e5;
int n, a[N];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int x = 0;
  cin >> n;
  FOR(i, 0, n){
    cin >> a[i];
    x ^= a[i];
  }
   FOR(i, 0, n) cout << (x^a[i]) << ' ';
  cout << endl;
}

Measured memory_bytes: 4408
H, W = map(int, input().split())
a = [list(input()) for i in range(H)]
memo = []
b = []
for i in range(H):
  if "#" in a[i]:
    memo.append(i)
for x in memo:
  b.append(a[x])
memo = []
d = []
for c in zip(*b):
  d.append(c)
for i in range(W):
  if "#" in d[i]:
    memo.append(i)
e = []
for x in memo:
  e.append(d[x])
for r in zip(*e):
  print("".join(r))

Measured memory_bytes: 3188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC070A
{
    class Program
    {
        static void Main(string[] args)
        {
            string a;
            a = Console.ReadLine();
            if (a[0] == a[2])
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(o,0,n)cout<<v[o]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 100010

int main(){
	IOS;
	tihs;

	ll k;cin>>k;
	string s;cin>>s;
	ll n=sz(s);
	if(n>k){
		rep(i,0,k)cout<<s[i];
		cout<<"...";
	}
	else cout<<s;

	return 0;
}

Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

#define TMAX 50
#define PMAX 10
int main(){

	int T;
	int P;
	int R;
	int tID;
	int pID;
	int time;
	string mes;
	int ans[TMAX+1],wro[TMAX+1][PMAX+1],tim[TMAX+1];
	int rank[TMAX];

	while(1){

		cin>>T>>P>>R;
		if(T==0&&P==0&&R==0) break;

		for(int i=0;i<TMAX+1;i++){
			ans[i]=0;
			tim[i]=0;
			for(int j=0;j<PMAX+1;j++){
				wro[i][j]=0;
			}
		}
		for(int i=0;i<R;i++){
			cin>>tID>>pID>>time>>mes;
			if(mes=="WRONG"){
				wro[tID][pID]++;
			}
			else{
				tim[tID]+=time+wro[tID][pID]*1200;
				ans[tID]++;
			}
		}

		for(int i=0;i<TMAX;i++) rank[i]=i+1;

		/*ans sort*/
		for(int i=0;i<T;i++){
			for(int j=0;j<T-1-i;j++){
				if(ans[rank[j]]<ans[rank[j+1]]) swap(rank[j],rank[j+1]);
			}
		}
		/*time sort*/
		for(int i=0;i<T;i++){
			for(int j=0;j<T-1-i;j++){
				if(tim[rank[j]]>tim[rank[j+1]]&&ans[rank[j]]==ans[rank[j+1]]) swap(rank[j],rank[j+1]);
			}
		}
		/*ID sort*/
		for(int i=0;i<T;i++){
			for(int j=0;j<T-1-i;j++){
				if(rank[j]>rank[j+1]&&tim[rank[j]]==tim[rank[j+1]]&&ans[rank[j]]==ans[rank[j+1]]) swap(rank[j],rank[j+1]);
			}
		}

		for(int i=0;i<T;i++){
			cout<<rank[i]<<" "<<ans[rank[i]]<<" "<<tim[rank[i]]<<endl;
		}

	}

}

Measured memory_bytes: 1212