akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
 
class Main {
	public static void main(String[] args) {
 
		Scanner sc = new Scanner(System.in);
		int[][] a = new int[3][3];
		int[] b = new int[10];
		boolean[][] appear = new boolean[3][3];
		String ans = "No";
 
		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				a[i][j] = sc.nextInt();
				appear[i][j] = false;
			}
		}
 
		int n = sc.nextInt();
 
		for(int i = 0; i < n; i++){
			b[i] = sc.nextInt();
		}

		for(int i = 0; i < 3; i++){
			for(int j = 0; j < 3; j++){
				for(int k = 0; k < n; k++){
					if(a[i][j] == b[k]){
						appear[i][j] = true;
					}
				}
			}
		}
 
		for(int i = 0; i < 3; i++){
			if(appear[i][0] && appear[i][1] && appear[i][2])
				ans = "Yes";
		}
		for(int i = 0; i < 3; i++){
			if(appear[0][i] && appear[1][i] && appear[2][i])
				ans = "Yes";
		}
		if(appear[0][0] && appear[1][1] && appear[2][2]){
			ans = "Yes";
		}
		if(appear[0][2] && appear[1][1] && appear[2][0]){
			ans = "Yes";
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 23508
#include<stdio.h>

int main(){
	int x,y;
	for(;;){
		scanf("%d%d",&x,&y);
		if(x == 0 && y == 0){
		  break;
		}
		if(x <= y){
			printf("%d %d\n",x,y);
		}
		if(x > y){
			printf("%d %d\n",y,x);
		}
	}
	return 0;
}



Measured memory_bytes: 2560
use std::io::*;
use std::str::FromStr;

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

    println!("{}", r * r);
}


Measured memory_bytes: 4352
#include <climits>
#include <functional>
#include <iostream>
#include <queue>
#include <utility>
#include <vector>
using namespace std;

int main() {
	int V, E, r, s, t, d;
	cin >> V >> E >> r;
	vector<vector<pair<int, int>>> a(V);
	for (int i = 0; i < E; ++i) {
		cin >> s >> t >> d;
		a[s].emplace_back(t, d);
	}
	priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> b;
	b.emplace(0, r);
	vector<bool> c(V);
	vector<int> e(V, INT_MAX);
	e[r] = 0;
	while (!b.empty()) {
		pair<int, int> f = b.top();
		b.pop();
		c[f.second] = true;
		for (pair<int, int>& i : a[f.second]) {
			if (!c[i.first]) {
				if (e[i.first] > e[f.second] + i.second) {
					e[i.first] = e[f.second] + i.second;
					b.emplace(e[i.first], i.first);
				}
			}
		}
	}
	for (int& i : e) {
		if (INT_MAX == i) cout << "INF";
		else cout << i;
		cout << endl;
	}
}


Measured memory_bytes: 12968
using System;
using System.Linq;

namespace atcorder
{
    class Program
    {
        static void Main()
        {
            var nm = Console.ReadLine().Split(' ');
            var n = int.Parse(nm[0]);
            var m = int.Parse(nm[1]);

            var h = Console.ReadLine().Split(' ');
            int[] abh = Enumerable.Repeat<int>(1,n).ToArray();

            for(var i = 0; i < m; i++)
            {
                var ab = Console.ReadLine().Split(' ');
                var a = int.Parse(ab[0]);
                var b = int.Parse(ab[1]);

                if(int.Parse(h[a-1]) > int.Parse(h[b - 1]))
                {
                    abh[b - 1] = 0;
                }
                else if (int.Parse(h[a - 1]) < int.Parse(h[b - 1]))
                {
                    abh[a - 1] = 0;
                }
                else
                {
                    abh[a - 1] = 0;
                    abh[b - 1] = 0;
                }
            }

            int ans = 0;

            foreach (var answer in abh)
            {
                if(answer == 1)
                {
                    ans += 1;
                }
            }
            Console.WriteLine(ans);

        }
    }
}


Measured memory_bytes: 49312
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
using namespace std;

// ローリングハッシュ
struct RollingHash {
    static const int base1 = 1007, base2 = 2009;
    static const int mod1 = 1000000007, mod2 = 1000000009;
    vector<long long> hash1, hash2, power1, power2;

    // construct
    RollingHash(const string &S) {
        int n = (int)S.size();
        hash1.assign(n+1, 0);
        hash2.assign(n+1, 0);
        power1.assign(n+1, 1);
        power2.assign(n+1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i+1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i+1] = (hash2[i] * base2 + S[i]) % mod2;
            power1[i+1] = (power1[i] * base1) % mod1;
            power2[i+1] = (power2[i] * base2) % mod2;
        }
    }
    
    // get hash of S[left:right]
    inline pair<long long, long long> get(int l, int r) const {
        long long res1 = hash1[r] - hash1[l] * power1[r-l] % mod1;
        if (res1 < 0) res1 += mod1;
        long long res2 = hash2[r] - hash2[l] * power2[r-l] % mod2;
        if (res2 < 0) res2 += mod2;
        return {res1, res2};
    }
};

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

    // ロリハ
    RollingHash rh(S);

    // 二分探索判定
    auto check = [&](int d) -> bool {
        map<pair<long long, long long>, int> ma;
        for (int i = 0; i + d <= N; ++i) {
            auto p = rh.get(i, i+d);
            if (ma.count(p)) {
                if (i - ma[p] >= d) return true;
            }
            else ma[p] = i;
        }
        return false;
    };

    // 二分探索
    int left = 0, right = N/2 + 1;
    while (right - left > 1) {
        int mid = (left + right) >> 1;
        if (check(mid)) left = mid;
        else right = mid;
    }
        
    cout << left << endl;
}

Measured memory_bytes: 768
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            out.print(s.charAt(0));
            out.print(s.length() - 2);
            out.print(s.charAt(s.length() - 1));
        }

    }

    static class InputReader {
        private int lenbuf = 0;
        private int ptrbuf = 0;
        private InputStream in;
        private byte[] inbuf = new byte[1024];

        public InputReader(InputStream in) {
            this.in = in;
        }

        private int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = in.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        private boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        private int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b)) ;
            return b;
        }

        public String next() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

    }
}



Measured memory_bytes: 23380
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
#define N 1000005
queue<int> q;
char a[N],b[N];
int main()
{
	int n,i,j,ans=0;
	scanf("%d%s%s",&n,a+1,b+1);
	if(strcmp(a+1,b+1)==0){printf("0");return 0;}
	i=j=n;
	while(j){
		while(j&&b[j]==b[j-1])j--;
		while(i&&(i>j||a[i]!=b[j]))i--;
		if(i==0){printf("-1");return 0;}
		while(!q.empty()&&q.front()-(int)q.size()>=j)q.pop();
		if(i!=j)q.push(i);
		ans=max(ans,(int)q.size()+1);
		j--;
	}
	printf("%d",ans);
}

Measured memory_bytes: 6272
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int n = in.nextInt();
            int[] a = new int[n];

            for (int i = 0; i < n; ++i)
                a[i] = in.nextInt();

            int[] b = new int[n];

            for (int i = n - 1, j = 0; i >= 0; i -= 2, j++) {
                b[j] = a[i];
            }

            for (int i = n - 2, j = n - 1; i >= 0; i -= 2) {
                b[j--] = a[i];
            }

            for (int i = 0; i < n; ++i)
                out.print(b[i] + " ");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 56876
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n, t[100005] = {}, x[100005] = {}, y[100005] = {};
    cin >> n;
    fr1(n) cin >> t[i] >> x[i] >> y[i];
    fr1(n) {
        int u = t[i] - t[i - 1];
        int v = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
        if (v % 2 != u % 2 || v > u) {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
}


Measured memory_bytes: 1408
#include<iostream>
#define ll long long int
using namespace std;
int main(){
	ll x;
  	cin>>x;
  	ll hn,s;
    hn = x/500;
  	x = x - hn*500;
  	s = x/5;
  	cout<<(hn*1000 + s*5);
    
	return 0;
}

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

using namespace std;

int main(){
  int n; cin >> n;
  int a[n+1];
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }
  printf("node 1: key = %d, left key = %d, right key = %d, \n",a[1],a[2],a[3]);
  for(int id=2;id<=n;id++){
    printf("node %d: key = %d, ",id,a[id]);
    if(2*id+1<=n){
      printf("parent key = %d, left key = %d, right key = %d, \n",a[id/2],a[2*id],a[2*id+1]);
    }else if(2*id<=n){
      printf("parent key = %d, left key = %d, \n",a[id/2],a[2*id]);
    }else{
      printf("parent key = %d, \n",a[id/2]);
    }
  }
}

Measured memory_bytes: 3184
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;

    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());

        var ary = new int[n];
        for(int i=0; i<n; i++) {
            ary[i] = int.Parse(input.ReadLine());
        }

        Array.Sort(ary, (x, y) => y - x);

        ary[0] /= 2;
        return ary.Sum();
    }

    static int[] ToIntArray(string strs, int n) {
        var ret = new int[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 13268
#!/usr/bin/env python3
import sys
import numpy as np


def solve(N: int):
    print((N+1)//2/N)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 12452
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC115_a solver = new ABC115_a();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC115_a {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int D =
                    in.nextInt();
            if (D == 25) {
                out.println("Christmas");

            } else if (D == 24) {
                out.println("Christmas Eve");

            } else if (D == 23) {
                out.println("Christmas Eve Eve");

            } else if (D == 22) {
                out.println("Christmas Eve Eve Eve");

            }
        }

    }
}



Measured memory_bytes: 21716
package main

import (
	"bytes"
	"fmt"
	"math"
)

const th = math.Pi * 60.0 / 180.0

var buf bytes.Buffer

type point struct {
	x float64
	y float64
}

func main() {
	fmt.Print(answer())
}

func answer() string {
	var d int
	fmt.Scan(&d)

	var l, r point
	l.x, l.y = 0, 0
	r.x, r.y = 100, 0

	buf.WriteString(fmt.Sprintf("%.8f %.8f\n", l.x, l.y))
	koch(d, l, r)
	buf.WriteString(fmt.Sprintf("%.8f %.8f\n", r.x, r.y))

	return buf.String()
}

func koch(dep int, l, r point) {
	if dep == 0 {
		return
	}
	var s, t, u point

	s.x = (2.0*l.x + 1.0*r.x) / 3.0
	s.y = (2.0*l.y + 1.0*r.y) / 3.0
	t.x = (1.0*l.x + 2.0*r.x) / 3.0
	t.y = (1.0*l.y + 2.0*r.y) / 3.0
	// rotation matrix as the starting point from point "s"
	u.x = s.x + (t.x-s.x)*math.Cos(th) - (t.y-s.y)*math.Sin(th)
	u.y = s.y + (t.x-s.x)*math.Sin(th) + (t.y-s.y)*math.Cos(th)

	koch(dep-1, l, s)
	buf.WriteString(fmt.Sprintf("%.8f %.8f\n", s.x, s.y))
	koch(dep-1, s, u)
	buf.WriteString(fmt.Sprintf("%.8f %.8f\n", u.x, u.y))
	koch(dep-1, u, t)
	buf.WriteString(fmt.Sprintf("%.8f %.8f\n", t.x, t.y))
	koch(dep-1, t, r)
}



Measured memory_bytes: 1872
#include <iostream>

 

using namespace std;

 

int main()
{
    int a, b;
    cin >> a >> b;
    if (a > b)
        cout << "a > b" << endl;
    else if (a < b)
        cout << "a < b" << endl;
    else if (a==b)
        cout << "a == b" << endl;

 

}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using st=string;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
st abc="abcdefghijklmnopqrstuvwxyz";
st ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

const ll MXN=200;
ll N;
vvc S(MXN,vc(MXN));
vl c(MXN,0);

bool bipartite(ll v,ll k) {
    c[v]=k;
    rep(i,N){
        if(S[v][i]=='1'&&c[i]==k){
            return false;
        }
     	if(S[v][i]=='1'&&c[i]==0&&!bipartite(i,-k)){
       	    return false;
        }
    }
    return true;
}

ll bfs(ll i){
    vl d(N,INF);
    d[i]=1;
    queue<ll> que;
    que.push(i);
    while(que.size()){
        ll v=que.front();
        que.pop();
        rep(i,N){
            if(S[v][i]=='1'&&d[i]==INF){
                d[i]=d[v]+1;
                que.push(i);
            }
        }
    }
    ll x=0;
    rep(i,N){
        x=max(x,d[i]);
    }
    return x;
}

int main() {
    cin >> N;
    rep(i,N){
        rep(j,N){
            cin >> S[i][j];
        }
    }
    if(!bipartite(0,1)){
        cout << -1 << endl;
        return 0;
    }
    int ans=0;
    rep(i,N){
        int x=bfs(i);
        ans=max(ans,x);
    }
    cout << ans << endl;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> pii;
typedef vector< vector<int> > vvi;

typedef pair< double, int > pdi;
typedef complex<double> P;

double dot(P a, P b) {
	return real(conj(a)*b);
}

double cross(P a, P b) {
	return imag(conj(a)*b);
}

P projection(P s, P e, P p) {
	double t = dot(p-s, s-e) / norm(s-e);
	return s + t*(s-e);
}

bool intersectSP(P s, P e, P r) {
	return abs(s-r) + abs(e-r) - abs(e-s) < 1e-5;
}

// ??????s-e ??¨ ???(x,y) ????????¢
double dist(P s, P e, int x, int y) {
	P p(x,y);
	P r = projection(s, e, p);
	if( intersectSP(s, e, r) ) return abs(r-p);
	return min( abs(s-p), abs(e-p) );
}

int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool intersectSS(P s, P e, P p, P q) {
	return ccw(s,e,p) * ccw(s,e,q) <= 0 &&
		   ccw(p,q,s) * ccw(p,q,e) <= 0;
}

int main() {
	int n;
	while(cin >> n, n) {
		int sx, sy, ex, ey;
		cin >> sx >> sy >> ex >> ey;
		P s(sx,sy), e(ex,ey);
		vector<pdi> v;
		bool err = false;
		rep(i, n) {
			int ix, iy, ax, ay, h;
			cin >> ix >> iy >> ax >> ay >> h;
			P p0(ix,iy), p1(ax,iy), p2(ax,ay), p3(ix,ay);
			v.push_back(pdi(dist(s, e, ix, iy), h));
			v.push_back(pdi(dist(s, e, ax, iy), h));
			v.push_back(pdi(dist(s, e, ax, ay), h));
			v.push_back(pdi(dist(s, e, ix, ay), h));
			v.push_back(pdi(dist(p0, p1, sx, sy), h));
			v.push_back(pdi(dist(p1, p2, sx, sy), h));
			v.push_back(pdi(dist(p2, p3, sx, sy), h));
			v.push_back(pdi(dist(p3, p0, sx, sy), h));
			v.push_back(pdi(dist(p0, p1, ex, ey), h));
			v.push_back(pdi(dist(p1, p2, ex, ey), h));
			v.push_back(pdi(dist(p2, p3, ex, ey), h));
			v.push_back(pdi(dist(p3, p0, ex, ey), h));

			if(!err) {
				if( ix < sx && ix < ex && sx < ax && ex < ax &&
						iy < sy && iy < ey && sy < ay && ey < ay ) {
					err = true;
				}
				else if( intersectSS(s, e, p0, p1) ||
						intersectSS(s, e, p1, p2) ||
						intersectSS(s, e, p2, p3) ||
						intersectSS(s, e, p3, p0) ) {
					err = true;
				}

			}
		}

		if(err) {
			cout << 0 << endl;
			continue;
		}

		double l=0.0, r=1000.0;
		while(r-l > 1e-5) {
			double c = (l+r)/2.0;
			bool ok = true;
			rep(i, v.size()) {
				if( v[i].first <= c ) {
					double h = c - sqrt(c*c - v[i].first*v[i].first);
					if( h < v[i].second ) {
						ok = false;
						break;
					}
				}
			}
			if(ok) {
				l = c;
			}else {
				r = c - 1e-5;
			}
		}
		cout << fixed << setprecision(7) << l << endl;
	}

	return 0;
}

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

namespace ProgrammingContest
{
    class MainClass
    {
        Scanner sc;
        static void Main(string[] args)
        {
            new MainClass().Solve();
        }

        void Solve()
        {
#if DEBUG
            string backPath = "..";
            char dirSep = System.IO.Path.DirectorySeparatorChar;
            string inFilePath = backPath + dirSep + backPath + dirSep + "in.txt";
            sc = new Scanner(new System.IO.StreamReader(inFilePath));
#else
            sc = new Scanner();
#endif

            int x = sc.NextInt;
            int t = sc.NextInt;
            Write(Math.Max(0, x - t));
        }

        void Write(object val)
        {
            Console.WriteLine(val.ToString());
        }
        void Write(string format, params object[] vals)
        {
            Console.WriteLine(format, vals);
        }
        void fill<T>(T[] ar, T val)
        {
            for (int i = 0; i < ar.Length; i++)
            {
                ar[i] = val;
            }
        }
    }
    class Scanner
    {
        Queue<String> buffer;
        char[] sep;
        System.IO.TextReader reader;
        public Scanner(System.IO.TextReader reader = null)
        {
            this.buffer = new Queue<string>();
            this.sep = new char[] { ' ' };
            this.reader = (reader ?? Console.In);
        }
        private void CheckBuffer()
        {
            if (this.buffer.Count == 0 && this.reader.Peek() >= 0)
            {
                string[] sreArray = this.reader.ReadLine().Split(this.sep);
                foreach (String elStr in sreArray)
                {
                    this.buffer.Enqueue(elStr);
                }
            }
        }

        public String Next
        {
            get
            {
                this.CheckBuffer();
                return this.buffer.Dequeue();
            }
        }

        public int NextInt
        {
            get
            {
                return int.Parse(this.Next);
            }
        }
        public double NextDouble
        {
            get
            {
                return double.Parse(this.Next);
            }
        }

        public long NextLong
        {
            get
            {
                return long.Parse(this.Next);
            }
        }
        public bool IsEmpty
        {
            get
            {
                this.CheckBuffer();
                return this.buffer.Count == 0;
            }
        }
    }
}


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

using namespace std;

struct Node
{
	int pare = -1;
	vector<int> nowHow;
	int howChild = 0;
};

int n, b;
Node a[100010];

void check(int now, int how){
	a[now].nowHow.push_back(how);

	// cout << a[now].nowHow.size() << " - " << a[now].howChild << "=" << how << endl;
	if((a[now].nowHow.size() != a[now].howChild && a[now].howChild != 0) || a[now].pare == -1) return;

	int nextHow = 0;
	sort(a[now].nowHow.begin(), a[now].nowHow.end());

	int ret = max(a[now].howChild, 1);
	for(int i = 0;i < ret;i++){
		nextHow = max(nextHow, a[now].nowHow[i] + (ret - i));
	}

	check(a[now].pare, nextHow);
}

int main(){
	cin >> n;
	for(int i = 0;i < n - 1;i++){
		cin >> b;
		b--;
		a[i + 1].pare = b;
		a[b].howChild++;
	}

	// cout << "-----" << endl;
	vector<int> leaf;
	for(int i = 0;i < n;i++){
		if(a[i].howChild == 0){
			check(i, 0);
			// cout << i << endl;
		}
	}

	sort(a[0].nowHow.begin(), a[0].nowHow.end());
	int ans = 0, howSize = a[0].nowHow.size() - 1;
	for(int i = 0;i < a[0].nowHow.size();i++){
		ans = max(ans, a[0].nowHow[i] + (howSize - i));
	}

	cout << ans << endl;
}

Measured memory_bytes: 15104
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<iomanip>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<stack>
#include<queue>
#include<sstream>
#include<bitset>
#include<cstdio>
#include<stdio.h>
#include<cstring>
#include <stdio.h>
#include <math.h>
#include <cmath>
#include <unordered_map>
using namespace std;
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
}
void in_out_txt()
{
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
}
map<char,int>mp;
vector<long long>v;
int main() {
	fast();
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(abs(a-b)<=d && abs(b-c)<=d || abs(a-c)<=d)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    FastScanner in;
    PrintWriter out;

    public static void main(String[] args) {
        new Main().run();
    }

    void solve() {
        int N = in.nextInt();
        int M = 0;
        for (int i = 0; i < N; i++) {
            if (in.nextInt() % 2 == 0) {
                M++;
            }
        }
        long result = (long)(Math.pow(3, N) - Math.pow(2, M));
        out.println(result);
    }

    void run() {
        in = new FastScanner();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }

}

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

int main(){
	long long a, b;
	cin >> a >> b;
	string ans;
	if(a * b <= 0)ans = "Zero";
	else{
		if(0 < a)ans = "Positive";
		else{
			if(abs(b - a) % 2 == 1){
				ans = "Positive";
			}else{
				ans = "Negative";
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 768
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <bitset>
#include <utility>
#include <cstring>
#include <numeric>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pair<int,int>> vpii;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvc;
typedef vector<vector<string>> vvs;
#define rep(i,n) for(int i=0;i<n;i++)
#define repll(i,n) for(long long int i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define P 1000000007
#define STI(s) atoi(s.c_str())//string to int
#define mp(p,q) make_pair(p,q)
#define Sort(a) sort(a.begin(),a.end())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
template <typename T_char>
char ToUpper (char cX) { return toupper(cX); }
//g++ -std=c++1z temp.cpp
//./a.exe
ll digit(ll a){
    ll count = 0;
    for (ll i = 0; i < a; i++)
    {   if (a == 0)
        {
            break;
        }else
        {
            a = a/10;
            count++;
        }
    }
    return count;
}
#include <cstdint>

uintmax_t comb(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}
//桁数のカウント
//pow(x,n) == x^n
//sum = accumulate(v.begin(),v.end(),0);
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a,   b) * b;}



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

ll n,count = 0;
cin >> n;
vi d(n);
rep(i,n) cin >> d[i];

Sort(d);

cout << d[n/2]-d[n/2-1] << endl;

//////////////////////////////////////////////////////
return 0;}


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

using namespace std;

#define int long long
#define pb push_back

signed main () {
  int n;
  cin >> n;
  vector<int> a;
  int tmp = 0;
  for(int i=0;i<n;i++) {
    cin >> tmp;
    a.pb(tmp);
  }
  vector<int> b;
  for(int i=0;i<n;i++) {
    b.pb(a[i] - i - 1);
  }
  sort(b.begin(), b.end());
  int k = b[b.size() / 2];
  int sum = 0;
  for(int i=0;i<n;i++) {
    sum += abs(b[i] - k);
  }
  cout << sum << endl;
}

Measured memory_bytes: 4848
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author I.E
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <math.h>
#include <iomanip>
#include <algorithm>

using namespace std;

#define ll long long
#define ull unsigned long long
#define ld long double
#define fr(i,a,b) for(int i=a;i<b;++i)
#define frn(i,a,b) for(int i=a;i>b;i--)
#define rep(i,n) fr(i,0,n)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define sz(a) int((a).size())
#define srt(container, lambda) sort(container.begin(), container.end(), lambda)

typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> ii;

int int_pow(int x, int p)
{
    if (p == 0) return 1;
    if (p == 1) return x;

    int tmp = int_pow(x, p/2);
    if (p%2 == 0) return tmp * tmp;
    else return x * tmp * tmp;
}

void fill(istream& in, vi& a, int n) {
    int elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(istream& in, vl& a, int n) {
    ll elm;
    rep(i, n) {
        in >> elm;
        a.push_back(elm);
    }
}

void fill(vi& a, int n, int val) {
    rep(i, n) {
        a.push_back(val);
    }
}

void fill(vl& a, int n, ll val) {
    rep(i, n) {
        a.push_back(val);
    }
}

int sum(vi arr) {
    int s = 0;
    for (auto& x: arr)
        s += x;
    return s;
}

int max(vi a) {
    return *max_element(a.begin(), a.end());
}

int min(vi a) {
    return *min_element(a.begin(), a.end());
}

void print(ostream& out, vi a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

void print(ostream& out, vl a) {
    for (auto& x: a) {
        out << x << " ";
    }
    out << endl;
}

//======================================================
int dx[] = { 0,  0, 1, -1 ,  1,  -1,  1,  -1 };
int dy[] = { 1, -1, 0,  0 , -1,   1,  1,  -1 };
//======================================================
ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
ll power(ull a, ull b, ull ret = 1LL) {
    while (b--) ret = (ret * a);
    return ret;
}
//======================================================

#pragma GCC optimize("Ofast")
static auto speedup = [](){
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    return 0;
}();



class CStep {
public:
    void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        vi as;
        fill(in, as, n);
        ll ans = 0;
        int prev = as[0];
        fr(i, 1, n) {
            if (as[i] < prev) {
                ans += prev - as[i];
            }
            else {
                prev = as[i];
            }
        }
        out << ans << endl;
    }
};


int main() {
	CStep solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3892
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}

void main()
{
  string s; readV(s);
  auto n = s.length;
  auto t = new dchar[]((n+1)/2);
  foreach (i; 0..(n+1)/2) t[i] = s[i*2];
  writeln(t);
}


Measured memory_bytes: 2712
#include <iostream>
#include <string>

int n;

#define FOR(i, a, b) for(int i = (a); i <(b); ++i)

constexpr int MAXN = 100000;
unsigned long int P[5]; // M, A, R, C, H

int main() {
    std::cin >> n;
    FOR(i, 0, n) {
        std::string S;
        std::cin >> S;
        if (S[0] == 'M') {
            P[0] += 1;
        } else if (S[0] == 'A') {
            P[1] += 1;
        } else if (S[0] == 'R') {
            P[2] += 1;
        } else if (S[0] == 'C') {
            P[3] += 1;
        } else if (S[0] == 'H') {
            P[4] += 1;
        }
    }
    unsigned long int sum = 0;
    FOR(i,0,5)
    FOR(j,i+1,5)
    FOR(k,j+1,5) {
        sum += P[i] * P[j] * P[k];
    }
    std::cout << sum << std::endl;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
const int maxn=510;
int ans,n,k,sum,a[maxn],b[maxn];
inline bool pd(int x)
{
	for(register int i=1;i<=n;i++)
		b[i]=a[i]%x;
	sort(b+1,b+n+1);
	int l=1,r=n,sum=0;
	while(l<r)
	{
		int _min=min(b[l],x-b[r]);
		sum+=_min;
		if(sum>k)
			return 0;
		b[l]-=_min;
		b[r]+=_min;
		b[r]%=x;
		if(!b[l])
			l++;
		if(!b[r])
			r--;
	}
	if(l==r && b[l])
		return 0;
	return 1;
}
int main()
{
	scanf("%d%d",&n,&k);
	for(register int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		sum+=a[i];
	}
	for(register int i=1;i*i<=sum;i++)
	{
		if(sum%i)
			continue;
		if(pd(sum/i))
			ans=max(ans,sum/i);
		if(pd(i))
			ans=max(ans,i);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  double height[100];
  double high, low;
  int i=0,j;

  while(scanf("%lf",&height[i]) != EOF){
    i++;
  }

  high = height[0]; low=height[0];
  for(j=1; j<i; j++){
    if(high<height[j])
      high=height[j];
    if(low>height[j])
       low=height[j];
  }

  printf("%.1f\n", high-low);

  return 0;
}

Measured memory_bytes: 652
#include <bits/stdc++.h>
#define rep(i, s, e) for(int i = s; i < e; i++)
#define rrep(i, s, e) for(int i = s; i > (s)-(e); i--)
#define pr(s) std::cout << s << std::endl
#define prb(s) std::cout << s
using namespace std;



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


  char a[2], b[2];
  cin >> a >> b;

  if (a[0] > b[0]) pr(">");
  if (a[0] < b[0]) pr("<");
  if (a[0] == b[0]) pr("=");


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

//dijkstraをする。Gは<to, cost>の配列。dは結果。vは始点。
void dijkstra(vector<vector<llll>> &G, vector<ll> &d, int v){
    fill(ALL(d), INF);
    d[v] = 0;

    priority_queue<llll, vector<llll>, greater<llll>> q;
    q.push(make_pair(0, v));
    while(!q.empty()){
        auto p = q.top(); q.pop();
        auto pv = p.second;
        if(d[pv] < p.first) continue; //p.secondへの距離が更新済みならスルー
        for (auto next : G[pv]) {
            if(d[pv] + next.second >= d[next.first]) continue;
            d[next.first] = d[pv] + next.second;
            q.push(make_pair(d[next.first], next.first));
        }
    }

}

int main(){
    ll N, M;
    cin >> N >> M;
    vector<vector<llll>> G(N);
    ll l, r, c;
    for (int i = 0; i < M; i++) {
        cin >> l >> r >> c; l--; r--;
        G[l].push_back(make_pair(r, c));
    }

    for (int i = 1; i < N; i++) {
        G[i].push_back(make_pair(i-1, 0));
    }

    vector<ll> d(N);

    dijkstra(G, d, 0);
    if(d[N-1] == INF){
        printf("-1\n");
    }
    else{
        printf("%lld\n", d[N-1]);
    }


}

Measured memory_bytes: 12184
/* Coached by rainboy */
#include <stdio.h>
#include <string.h>

#define N 100000

int dsu[N];

int find(int i) {
	return dsu[i] < 0 ? i : (dsu[i] = find(dsu[i]));
}

void join(int i, int j) {
	i = find(i);
	j = find(j);
	if (i == j)
		return;
	if (dsu[i] > dsu[j])
		dsu[i] = j;
	else {
		if (dsu[i] == dsu[j])
			dsu[i]--;
		dsu[j] = i;
	}
}

int main() {
	static int pp[N];
	int n, m, i, j, ans;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%d", &pp[i]), pp[i]--;
	memset(dsu, -1, n * sizeof *dsu);
	while (m--) {
		scanf("%d%d", &i, &j), i--, j--;
		join(i, j);
	}
	ans = 0;
	for (i = 0; i < n; i++)
		if (find(i) == find(pp[i]))
			ans++;
	printf("%d\n", ans);
	return 0;
}


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

ll kaijo[200010];
void init() {
	kaijo[0] = 1;
	for (ll i = 1;i <= 200000;i++)kaijo[i] = (kaijo[i - 1] * i) % N;
}

ll inv(ll x,ll power) {
	ll res = 1;
	ll k = power;
	ll y = x;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N*y%N) % N;
		k /= 2;
	}
	return res;
}

ll Comb(ll n, ll k) {
	if (n < 0 || k < 0 || (n - k) < 0)return 0;
	ll b = kaijo[n];
	ll c = kaijo[n - k];
	ll d = kaijo[k];
	ll cd = (c*d) % N;
	return ((b%N)*(inv(cd,N-2)) % N) % N;
}

int main(void){
    ll n,k;
    cin>>n>>k;
    init();
    ll ans = 0;
    ll M = min(k,n);
    for(ll m=0;m<=M;m++){
        ll tmp = Comb(n,m)*Comb(n-1,n-m-1);
        tmp = tmp%N;
        ans = (ans+tmp)%N;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

typedef long long ll;
// typedef pair<ll, ll> P;
typedef pair<int, int> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int w, h;
  cin >> w >> h;
  int p[w], q[h];
  REP(i, w) cin >> p[i];
  REP(i, h) cin >> q[i];
  vector<P> vc;
  REP(i, w) vc.push_back(make_pair(p[i], 1));
  REP(i, h) vc.push_back(make_pair(q[i], 0));
  sort(ALL(vc));
  ll ans = 0;
  int a = w + 1, b = h + 1;
  REP(i, w + h) {
    int cost = vc[i].first;
    int type = vc[i].second;
    if (type) {
      ans += 1ll * cost * b;
      a--;
    } else {
      ans += 1ll * cost * a;
      b--;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3188
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if ( a > b ) cout << "a" << " > " << "b" << endl;
	if ( a < b ) cout << "a" << " < " << "b" << endl;
	if ( a == b ) cout << "a" << " == " << "b" << endl;
	return 0;
}


Measured memory_bytes: 3076
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    static int N;
    static String S;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        S = sc.next();

        solve();
    }

    static void solve() {
        List<String> list = S.chars().mapToObj(c -> String.valueOf((char)c)).collect(Collectors.toList());

        long dp[] = new long[N+10];

        Arrays.fill(dp, S.length()+100);

        // 0番目をリーダーに選んだときは、自分以外のEの数が向きを変える必要がある人数
        dp[0] = S.chars().filter(i -> i == 'E').count() - (list.get(0).equals("E") ? 1 : 0);


        for (int i = 0; i < N-1; i++) {
            String now = list.get(i);
            String next = list.get(i+1);

            if (now.equals("E") && next.equals("E")) {
                dp[i + 1] = dp[i] - 1;
            } else if (now.equals("E") && next.equals("W")) {
                dp[i + 1] = dp[i];
            } else if (now.equals("W") && next.equals("E")) {
                dp[i + 1] = dp[i] + 1 - 1;
            } else {
                dp[i + 1] = dp[i] + 1;
            }

        }

        System.out.println(Arrays.stream(dp).min().orElse(-1));
    }
}


Measured memory_bytes: 53600
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <deque>
#include <ctime>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);

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

int main(){

    int n;
    cin >> n;
    int c = n;
    int cnt;

    int discount;

    for(int i=0; i<100; i++){
        if(c < 15 ) break;
        else{
            c -= 15;
            cnt++;
        }
    }

    cout << n*800 - cnt*200 << endl;


}

Measured memory_bytes: 256
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

x,y = i2()
for i in range(x+1):
	if 2*i + 4*(x-i) == y:
		print("Yes")
		exit()
print("No")

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


#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define ll long long
#define pair < int , int > pii



const int N = 2e5 + 100;
int n, k, ans, a[N], t;
vector < int > vec;

int main(){

	cin >> n >> k;

	for(int i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a+n);

	t = 1;
	for(int i = 1; i < n; i++){
		if(a[i] == a[i-1])
			t++;
		else
			vec.pb(t), t = 1;
	}
	vec.pb(t);

	sort(vec.begin(), vec.end());
	reverse(vec.begin(), vec.end());

	int n = vec.size();
	for(int i = 0; i < n-k; i++){
		ans += vec.back();
		vec.pop_back();
	}

	cout << ans << endl;
}

Measured memory_bytes: 2168
#include <stdio.h>
int main()
{
    int i;
    char s[3][11],a[4];
    for(i=0;i<3;i++){
        scanf("%s", s[i]);
        a[i]=s[i][0]-'a'+'A';
    }
    printf("%s\n",a);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
using namespace std;

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

string fizz(int now)
{
	if (now % 15 == 0)return "FizzBuzz";
	if (now % 5 == 0)return "Buzz";
	if (now % 3 == 0)return "Fizz";
	stringstream st; st << now;
	return st.str();
}



int main()
{
	int m, n;
	while (cin >> m >> n&&n)
	{
		vector<int> a;
		re(m)a.push_back(i + 1);
		vector<int>::iterator it = a.begin();

		for (int now = 1; now<=n; now++)
		{
			string st;
			cin >> st;
			if (a.size()>=2&&st!=fizz(now))
			{
				it = a.erase(it);
				if (it == a.end())it = a.begin();
			}
			else 
			{
				if (it == a.end() - 1)it = a.begin();
				else it++;
			}
		}
		for (int i = 0; i < a.size(); i++)cout << (i == 0 ? "" : " ") << a[i];
		cout << endl;
	}
}

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

int main() {
  int H,W;
  cin >> H >> W;
  
  while (H != 0 || W != 0){ 
   for (int j = 0; j < H; j++) {
    for (int i = 0; i < W; i++) {
      
      if (j % 2 == 0){
        if (i % 2 == 0 && i == W - 1){
          cout << '#' << endl;
        }
        else if (i % 2 == 1 && i == W - 1){
          cout << '.' << endl;
        } 
        else if (i % 2 == 0){
          cout << '#';
        }
        else {
          cout << '.';
        }
      }
      
      else if (j % 2 == 1){
        if (i % 2 == 0 && i == W - 1){
          cout << '.' << endl;
        }
        else if (i % 2 == 1 && i == W - 1){
          cout << '#' << endl;
        } 
        else if (i % 2 == 0){
          cout << '.';
        }
        else {
          cout << '#';
        }
      }
      
    }
      if (j == H - 1){
       cout << endl;
      }
   }
    cin >> H >> W;
  }
}
        
  
     
     
     
     


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

int main() {
    int a, b;
    cin >> a >> b;
    if (a == 1) a = 14;
    if (b == 1) b = 14;
    cout << (a > b ? "Alice" : a < b ? "Bob" : "Draw") << endl;
}


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

int main(){
  string s;
  int N,ans;
  ans=0;
  cin>>N>>s;
  for(int i=0;i<N-2;i++){
    if(s.at(i)=='A'){
      if(s.at(i+1)=='B'){
        if(s.at(i+2)=='C'){
    ans++;
        }
      }
    }
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 256
/* 
 *     author-->@harshrajani460
 *     codeforces round-567
 *
 */
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define mp make_pair
#define p(x) cout<< x << " ";
#define pe(x) cout<< x << endl ;
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define debug(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define el endl
#define M 1000000007 
#define int long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROR(i,a,b) for(int i=a;i>=b;i--)
const int N = 1e5 + 5;

int32_t main() 
{ 
    FAST;
    int n,k;
    cin>>n>>k;
    int a[n];
    FOR(i,0,n)
    cin>>a[i];
    int ans=1,pre=0;
    FOR(i,0,n)
    {
        pre+=a[i];
        if(pre<=k)
        ans++;
        else
        break;
    }
    cout<<ans;
    
    
} 

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

const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int r; cin >> r;
	cout << 3 * r * r << endl;
} 

Measured memory_bytes: 256