akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
using namespace std;

int main(void){
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(),a.end());
    cout << (a[2]==a[0]?"Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>

int N;
char s[100010];
char t[100010];

int suc()
{
	int i;
	for(i=2; i<N; i++){
		if(t[i-1] == 'S'){
			if(s[i-1] == 'o')
				t[i] = t[i-2];
			else{
				if(t[i-2] == 'S')
					t[i] = 'W';
				else
					t[i] = 'S';
			}
		}
		else{
			if(s[i-1] == 'x')
				t[i] = t[i-2];
			else{
				if(t[i-2] == 'S')
					t[i] = 'W';
				else
					t[i] = 'S';
			}
		}
	}
	if(t[N-1] == 'S'){
		if(s[N-1] == 'o'){
			if(t[N-2] != t[0])
				return 0;
		}
		else{
			if(t[N-2] == t[0])
				return 0;
		}
	}
	else{
		if(s[N-1] == 'o'){
			if(t[N-2] == t[0])
				return 0;
		}
		else{
			if(t[N-2] != t[0])
				return 0;
		}
	}
	if(t[0] == 'S'){
		if(s[0] == 'o'){
			if(t[N-1] != t[1])
				return 0;
		}
		else{
			if(t[N-1] == t[1])
				return 0;
		}
	}
	else{
		if(s[0] == 'o'){
			if(t[N-1] == t[1])
				return 0;
		}
		else{
			if(t[N-1] != t[1])
				return 0;
		}
	}
	return 1;
}

void solve()
{
	int i;
	t[0] = 'S';
	t[1] = 'S';
	if(suc() ){
		t[N] = 0;
		printf("%s\n", t);
		return ;
	}
	t[0] = 'S';
	t[1] = 'W';
	if(suc() ){
		t[N] = 0;
		printf("%s\n", t);
		return ;
	}
	t[0] = 'W';
	t[1] = 'S';
	if(suc() ){
		t[N] = 0;
		printf("%s\n", t);
		return ;
	}
	t[0] = 'W';
	t[1] = 'W';
	if(suc() ){
		t[N] = 0;
		printf("%s\n", t);
		return ;
	}
	printf("-1\n");
}

int main()
{
	scanf("%d", &N);
	scanf("%s", s);
	solve();
	return 0;
}

Measured memory_bytes: 512
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		        Scanner sc = new Scanner(System.in);
		        long n = sc.nextLong();
		        long k = sc.nextLong();
		        long i = n%k;
		        //余り
		        if (i<=k-i){
		            System.out.println(i);
		        }else{
		            System.out.println(k-i);
		        }
	}
}


Measured memory_bytes: 35556
//package test;
import java.io.*;
import java.util.*;
public class Main {
	private static int n;
	private static final int  maxn=100000+10;
	private static int[] a=new int[maxn];
	private static int[] b=new int[maxn];
	public static void main(String[] args)throws IOException
	{
		Input scan=new Input(new BufferedReader(new InputStreamReader(System.in)));
		//Scanner scan=new Scanner(System.in);
		n=scan.nextInt();
		for(int i=1;i<=n;i++)
			a[i]=scan.nextInt();
		quickSort(a,1,n);
		long ans=works();
		for(int i=1,t;i*2<=n;i++) {
			t=a[i];a[i]=a[n-i+1];a[n-i+1]=t;
		}
		System.out.println(Math.max(ans, works()));
		return;
	}
	static class Input
    {
        BufferedReader in;
        StringBuilder sb = new StringBuilder();
        public Input(BufferedReader in){this.in = in;}
        public Input(String s){this.in = new BufferedReader(new StringReader(s));}
        public String next()throws IOException
        {sb.setLength(0);while (true){int c=in.read();if(" \n\r\t".indexOf(c)==-1){sb.append((char)c);break;}}
        while (true){int c=in.read();if(c==-1||" \n\r\t".indexOf(c)!=-1)break;sb.append((char)c);}return sb.toString();}
        public int nextInt()throws IOException{return Integer.parseInt(next());}
    }
	static void quickSort(int array[], int low, int high) {// 传入low=0，high=array.length-1;
		int pivot, p_pos, i, t;// pivot->位索引;p_pos->轴值。
		if (low < high) {
			p_pos = low;
			pivot = array[p_pos];
			for (i = low + 1; i <= high; i++)
				if (array[i] > pivot) {
					p_pos++;
					t = array[p_pos];
					array[p_pos] = array[i];
					array[i] = t;
				}
			t = array[low];
			array[low] = array[p_pos];
			array[p_pos] = t;
			// 分而治之
			quickSort(array, low, p_pos - 1);// 排序左半部分
			quickSort(array, p_pos + 1, high);// 排序右半部分
		}
	}
	static long works() {
		int i,j;initb();
		i=1;j=(n+1)/2;
		b[1]=a[j--];
		if(n%2>0) b[n]=a[j--];
		for(;i<=n;i+=2)
			if(b[i]==0) b[i]=a[j--];
		for(i=n%2>0?n-1:n,j=(n+1)/2+1;i>0;i-=2)
			if(b[i]==0) b[i]=a[j++];
		return count();
	}
	static long count() {
		long val=0;
		for(int i=2;i<=n;i++)
			val+=Math.abs(b[i]-b[i-1]);
		return val;
	}
	static void initb() {
		for(int i=1;i<=n;i++)
			b[i]=0;
		return;
	}
}

Measured memory_bytes: 36748
#include<stdio.h>
#define WHITE 1
#define BLACK 0
#define GLAY 3
#define MAX 120
#define INF -1
int n,tail,head,que[MAX],stack,g[MAX][MAX],y[MAX],z[MAX],d[MAX],color[MAX];

void Enqueue(int x){
  if(tail == MAX)
    tail = 0;
  que[tail++] = x;
} 
int Dequeue(){
  if(head == MAX)
    head = 0;
  return que[head++];
}

void BFS(int s){
  int i,u,v,t,stack,empty = 0;
  for(i = 1;i <= n; i++){
    color[i] = WHITE;
    d[i] = INF;
  }
  color[s] = GLAY;
  d[s] = 0;
  stack = empty;
  Enqueue(s);
  stack++;
  while(stack != empty){
    u = Dequeue();
    stack--;
    for(i = 1;i <= z[u];i++){
      t = g[u][i];
      if(color[t] == WHITE){
	color[t] = GLAY;
	d[t] = d[u] + 1;
	Enqueue(t);
	stack++;
      }
    }
    color[u] = BLACK;
  }
}


main(){
  int i,j;
  scanf("%d",&n);
  for(i = 1;i <= n;i++){
    scanf("%d%d",&y[i],&z[i]);
    for(j = 1; j <= z[i]; j++){
      scanf("%d",&g[y[i]][j]);
    }
  }

  BFS(y[1]);

  for(i = 1;i <= n;i++){
    printf("%d %d\n",y[i],d[y[i]]);
  }
  return 0;
}

Measured memory_bytes: 648
# ある学校にN人の生徒がいます。
# 生徒たちをいくつかのグループに分け、グループごとにあるテーマについて話し合ってもらうこととなりました。
# あなたは、2人以下のグループだと効率的な話し合いが出来ないと考えており、なるだけおおくのグループを3人以上にしたいです。
# 生徒たちを上手く分けて、3人以上のグループの数を最大化してください。
# 1< N <1000
# 入力はすべて整数

N = int(input())
# 3人以上のグループを最大でx個作れるとき、xを出力せよ。

x = int(N // 3)

print(x)

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

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

Measured memory_bytes: 25216
N = int(input())
P = list(input())
X = P[1:].count("E")
a = [X]
for i in range(N-1):
    if P[i] == "W":
        X += 1
    if P[i+1] == "E":
        X -= 1
    a.append(X)

print(min(a))

Measured memory_bytes: 21200
N = gets.to_i
A = gets.split(" ").map(&:to_i)
change_count = 0
def selectionSort(a, n, change_count)
  for i	in (0..(n-1)).to_a
    minj = i
    for j in (i..(n-1)).to_a
      if a[j] <	a[minj]
   	minj = j
      end
    end
    if a[i] != a[minj]
      karinobasyo = a[i]
      a[i] = a[minj]
      a[minj] = karinobasyo
      change_count += 1
    end
  end
  return change_count
end

change_count = selectionSort(A, N, change_count)

puts A.join(" ")
puts change_count


Measured memory_bytes: 8888
#include <iostream>
#include <string.h>
using namespace std;

int main() {
  int n;
  int a[100] = {0};
  cin >> n;
  int sum = 0; 
  for (int i=0; i < n; i++){
      cin >> a[i];
  }
  int max;
  for(int i = 0; i < n; i++){
      max = 0;
      for(int j = 0; j < n; j++){
          if(a[max]<a[j]) max = j;
      }
      if(i%2==0) sum += a[max];
      else sum -= a[max];
      a[max] = 0;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {

	LL n; cin >> n;
	vector<LL> a(5);

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

	LL mi = INF2;
	LL idx = 0;
	for (int i = 0; i < 5; i++) {
		if (a[i] < mi) {
			mi = a[i];
			idx = i;
		}
	}

	if (mi >= n) {
		cout << 5 << endl;
		return 0;
	}

	LL cnt = (n + mi - 1) / mi;
	LL ans = 4 + cnt;

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
<?php
// Union-Find：同じグループに属するかどうかを判定する
class UnionFind {
    private $par; // par[$i]:$iの親

    function __construct($n) {
        for ($i = 0; $i <= $n; $i++) {
            $this->par[$i] = $i; // 最初は全てが根
        }
    }

    function root($x) {
        if ($this->par[$x] === $x) return $x; // 根の場合
        return $this->par[$x] = $this->root($this->par[$x]); // 全ての枝の親を根にしながら再帰処理
    }

    function unite($x, $y) { // $xと$yの木を併合
        $ix = $this->root($x);
        $iy = $this->root($y);
        if ($ix === $iy) return;
        $this->par[$ix] = $iy; // $xの根を$yの根に付ける
    }

    function is_same($x, $y) { // $xと$yの根が同じか
        return $this->root($x) === $this->root($y);
    }
}

// 総数のあと改行してスペース区切りの数字の集合
fscanf(STDIN, '%d %d', $n, $m);
$p = array_merge([0], array_map('intval', explode(' ', trim(fgets(STDIN)))));

$tree = new UnionFind($n);

$x[0] = $y[0] = 0; // 1 ~ $mにするため
for ($i  = 1; $i <= $m; $i++) {
    fscanf(STDIN, '%d %d', $x[], $y[]);
    $tree->unite($x[$i], $y[$i]);
}

$cnt = 0;
for ($i = 1; $i <= $n; $i++) {
    if ($tree->is_same($i, $p[$i])) $cnt++;
}

echo $cnt.PHP_EOL;

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

using namespace std;

int main() {
	
	string str;
	cin >> str;
	if(str.size()==1){
		cout << 0 << endl;
		return 0;
	}
	if(str.size()==2){
		if(str[0]!=str[1]) cout << 0 << endl;
		else cout << 1 << endl;
		return 0;
	}
	int res1 = 0, res2 = 0, res = INT_MAX;
	string aux;
	aux = str;
	for(int i=1; i<str.size()-1; i++){
		if(aux[i]!=aux[i-1] and aux[i]==aux[i+1]){
			aux[i+1] = aux[i-1];
			res1++;
		}else if(aux[i]==aux[i-1] and aux[i]!=aux[i+1]){
			aux[i-1] = aux[i+1];
			res1++;
		}else if(aux[i]==aux[i-1] and aux[i]==aux[i-1]){
			int k = aux[i-1]-'0';
			aux[i] = !k + '0';
			res1++;
		}
	}
	res = min(res1, res);
	aux = str;
	for(int i=str.size()-2; i>0; i--){
		if(aux[i]!=aux[i-1] and aux[i]==aux[i+1]){
			aux[i+1] = aux[i-1];
			res2++;
		}else if(aux[i]==aux[i-1] and aux[i]!=aux[i+1]){
			aux[i-1] = aux[i+1];
			res2++;
		}else if(aux[i]==aux[i-1] and aux[i]==aux[i-1]){
			int k = aux[i-1]-'0';
			aux[i] = !k + '0';
			res2++;
		}
	}
	res = min(res2, res);
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 512
{-# OPTIONS_GHC -O2 #-}
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import Data.Array.Unboxed
import Data.Array.ST
import Data.STRef 
import qualified Data.ByteString.Char8 as BS
import Control.Monad
import Control.Monad.ST
import Data.List
import Data.Char
import qualified Data.Map.Strict as M

convert :: Int -> Int -> VU.Vector (Int,Int) -> V.Vector [Int]
convert n e graph = V.create $ do
    v <- VM.replicate n []
    forM_ [0..e-1] $ \i -> do
        let (x,y) = graph VU.! i
        VM.modify v (y-1:) (x-1)
        VM.modify v (x-1:) (y-1)
    return v

bipartite :: Int -> V.Vector [Int] -> Maybe (VU.Vector Int)
bipartite n graph = runST $ do
    vec <- VUM.replicate n (-1)
    VUM.write vec 0 0
    go [0] vec
    where go :: [Int] -> VUM.MVector s Int -> ST s (Maybe (VU.Vector Int))
          go [] vec = do
              vv <- VU.freeze vec
              return $ Just vv
          go (n:ns) vec = do
              now <- VUM.read vec n
              ls <- newSTRef ns
              flag <- newSTRef False
              forM_ (graph V.! n) $ \i -> do
                  b <- VUM.read vec i
                  when (b == -1) $ VUM.write vec i (1-now) >> modifySTRef ls (i:)
                  when (b == now) $ writeSTRef flag True
              ln <- readSTRef ls
              ff <- readSTRef flag
              if ff then return Nothing else go ln vec


main :: IO ()
main = do
    [n,m] <- unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine
    graph <- convert n m <$> (VU.replicateM m $ (\vec -> (vec VU.! 0, vec VU.! 1)) . VU.unfoldrN 2 (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine)
    print $ case bipartite n graph of
        Nothing -> (n*(n-1))`div`2-m
        Just vec -> let len = VU.length $ VU.filter (==1) vec in len*(n-len) - m

Measured memory_bytes: 18300
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table




n = int(input())
a = num_divisors_table(n)
ans = 0

for i in range(1, n + 1):
    ans += a[i] * i
print(ans)


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

#define ll long long int
#define tinput int t; cin>>t; while(t--)
#define rep(i,n,s) for((i)=(s); (i)<(n); (i)++)

template <typename T>
T mini(T x, T y) { return (x<y)?x:y; }
template <typename T>
T maxi(T x, T y) { return (x>y)?x:y; }
ll M = 1e9+7;

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

    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	// a*b + c = n
	int n;
	cin>>n;
	ll ans = 0;

	for(ll i = 1; i<=n-1; i++) {
		ll l = 1;
		ll r = n-1;
		ll x = i;
		while(l<=r) {
			ll mid = l+(r-l)/2;
			ll ab = mid*i;
			if(ab==n) {
				x=mid-1ll;
				break;
			} 
			else if(ab<n) { l=mid+1; x=mid; }
			else r = mid-1;
		}
		ans+=x;
	}
	cout<<ans;
	return 0;
}

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

bool within(int a, int b, int d){
  if(a>b){
    return (a-b) <= d;
  }else{
    return (b-a) <= d;
  }
}

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if( (within(a,b,d) && within(b,c,d)) || within(a,c,d) ){ cout << "Yes" << endl; } 
  else { cout << "No" << endl; }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
	int ans = 0;
	for (int i = 0; i < 4; ++i) {
		ans = 0;
		int a, b; cin >> a >> b;
		if (a == 1) ans += b * 6000;
		else if (a == 2) ans += b * 4000;
		else if (a == 3) ans += b * 3000;
		else if (a == 4) ans += b * 2000;
		cout << ans << endl;
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, a, b; cin >> n >> a >> b;
  cout << min(a, b) << ' ' << max(0, a+b-n) << endk;
  return 0;
}


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

int main(){
    using namespace std;
    using real = double;
    using point = complex<real>;
    using circle = pair<point, real>;
    unsigned long N;
    cin >> N;
    vector<point> p(N);
    for(auto& i : p){
        unsigned long im, re;
        cin >> im >> re;
        i.imag(real(im));
        i.real(real(re));
    }
    {
        mt19937_64 mt{random_device{}()};
        shuffle(p.begin(), p.end(), mt);
    }
    const auto& circle_from_diameter = [](const point& a, const point& b) -> circle {
        auto center = (a + b) / real(2);
        return {center, norm(a - center)};
    };
    const auto& circle_from_triangle = [](const point& a, const point& b, const point& c) -> circle {
        if(((a - b) / (a - c)).imag() == 0)return circle{};
        auto center = ((a - b) * norm(c) + (b - c) * norm(a) + (c - a) * norm(b)) / ((a - b) * conj(c) + (b - c) * conj(a) + (c - a) * conj(b));
        return {center, norm(a - center)};
    };
    const auto& is_included = [](const circle& c, const point& a) -> bool {
        return norm(a - c.first) <= c.second;
    };
    const auto& is_all_include = [&p, &is_included](const circle& c) -> bool {
        return all_of(p.begin(), p.end(), [&c, &is_included](const point& a){return is_included(c, a);});
    };
    auto c = circle_from_diameter(p[0], p[1]);
    for(unsigned long i{2}; i < N; ++i)if(!is_included(c, p[i])){
        c = circle_from_diameter(p[0], p[i]);
        for(unsigned long j{1}; j < i; ++j)if(!is_included(c, p[j])){
            c = circle_from_diameter(p[i], p[j]);
            for(unsigned long k{0}; k < j; ++k)if(!is_included(c, p[k]))c = circle_from_triangle(p[i], p[j], p[k]);
        }
    }
    cout << setprecision(15) << sqrt(c.second) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}

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

    cout << ceil((B - 1) / (A - 1)) << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int K = sc.nextInt();
    int ans = 0;
    if (A >= K) {
      ans = K;
    } else if (A+B >= K){
      ans = A;
    } else {
      ans = A - (K-(A+B));
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 27004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;



int main()
{
	ll a,b,x;
	cin>>a>>b>>x;
	if(b==0)cout<<1<<endl;
	else if(a==0)cout<<b/x+1<<endl;
	else cout<<b/x-(a-1)/x<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (a)-1; i >= b; --i)
#define range(i, a, b, c) for (int i = a;             \
                               c > 0 ? i < b : i > b; \
                               i += c)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define all(a) begin(a), end(a)
#define ifnot(a) if (not(a))
#define dump(x) cerr << #x << " = " << (x) << endl
#define int long long
#ifdef _MSC_VER
const bool test = true;
#else
const bool test = false;
#endif

int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int INF = (int)1 << 60;
const ll INFL = (ll)1 << 60;
ll mod_n = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real &r) { return (r > eps) - (r < -eps); }
int sgn(const Real &a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

vector<string> split(const string &str, char sep)
{
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while (getline(ss, buffer, sep))
    {
        v.push_back(buffer);
    }
    return v;
}

template <class InputIterator>
int sum(InputIterator begin, InputIterator end)
{
    return accumulate(begin, end, 0ll);
}

void solve();

signed main()
{
    cout << fixed << setprecision(20);
    solve();
    while (true)
    {
        char s[MAX];
        if (scanf("%s", s) == EOF)
            break;
        int n = strlen(s);
        for (int i = n - 1; i > -1; i--)
        {
            ungetc(s[i], stdin);
        }
        solve();
    }
    return 0;
}

int A, B, C;

void solve()
{
    cin >> A >> B >> C;
    if (A <= C && C <= B) cout << "Yes" << endl;
    else cout << "No" << endl;
}


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

using namespace std;

int main(){

    int num = 0;
    cin >> num;
    int moti[num];
    int count = 0;

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

    sort(moti, moti + num, greater<int>());

    int prev = moti[0];
    count++;



    for (int i = 0; i < num; i++) {
        if (moti[i] != prev) {
            count++;
            prev = moti[i];
        }
    }
    
    cout << count;
    



    return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  CoderProj
//
//  Created by Minoru Hayashi on 2020/03/12.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//
//
//
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;

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

// const ll INF = 1LL<<60;
// const int INF = 1<<29;
// const ll MOD = 1000000007;
//#define __DBG__


void solve(void){
  
  string S;
  cin >> S;
  
  int ans=0;
  
  if(S[2]==S[3]){ans++;}
  if(S[4]==S[5]){ans++;}
  
  if(ans==2){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return;
   
}

#define TESTCASES 1

int main(int argc, const char * argv[]) {

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

    REP(i,TESTCASES){
      solve();
    }
 
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;

public class Main {

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

		String str[] = br.readLine().split(" ");

		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);
		int l = Integer.parseInt(str[2]);

		UnionFindTree uf1 = new UnionFindTree(n);
		UnionFindTree uf2 = new UnionFindTree(n);

		for (int i = 0; i < k; i++) {
			str = br.readLine().split(" ");

			int p = Integer.parseInt(str[0]) - 1;
			int q = Integer.parseInt(str[1]) - 1;

			uf1.union(p, q);
		}

		for (int i = 0; i < l; i++) {
			str = br.readLine().split(" ");

			int r = Integer.parseInt(str[0]) - 1;
			int s = Integer.parseInt(str[1]) - 1;

			uf2.union(r, s);
		}

		HashMap<Long, Integer> map = new HashMap<>();
		for (int i = 0; i < n; i++) {
			long key = uf1.find(i) * (long) n + uf2.find(i);
			if (map.containsKey(key)) {
				map.put(key, map.get(key) + 1);
			} else {
				map.put(key, 1);
			}
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			if (i != 0) {
				sb.append(" ");
			}
			long key = uf1.find(i) * (long) n + uf2.find(i);
			sb.append(map.get(key));
		}
		System.out.print(sb);
	}
}

class UnionFindTree {

	int[] parent;
	int[] rank;

	public UnionFindTree(int size) {
		this.parent = new int[size];
		this.rank = new int[size];

		for (int i = 0; i < size; i++) {
			makeSet(i);
		}
	}

	public void makeSet(int i) {
		parent[i] = i;
		rank[i] = 0; // 集合の高さ
	}

	public void union(int x, int y) {
		int xRoot = find(x);
		int yRoot = find(y);

		// xが属する木の方が大きい場合
		if (rank[xRoot] > rank[yRoot]) {
			parent[yRoot] = xRoot; // yの親をxに更新

		} else if (rank[xRoot] < rank[yRoot]) {
			parent[xRoot] = yRoot;

		} else if (xRoot != yRoot) {
			parent[yRoot] = xRoot;
			rank[xRoot]++; // 同じ高さの木がルートの子として着くから大きさ++;
		}
	}

	// 引数の属する木のルートのidを返す
	public int find(int i) {
		if (i != parent[i]) {
			parent[i] = find(parent[i]);
		}
		return parent[i];
	}

	// 同じ木に属しているか
	public boolean same(int x, int y) {
		return find(x) == find(y);
	}
}

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

vector<int> ans;
int n, k;
int sub() {
  cin >> n >> k;
  if (k >= (1 << n)) return false;
  if (n == 1) {
    if (k == 0) {
      ans = { 0, 0, 1, 1 };
      return true;
    } else {
      return false;
    }
  }
  
  for (int i = 0; i < (1 << n); ++i) {
    if (i == k) continue;
    ans.push_back(i);
  }
  ans.push_back(k);
  for (int i = (1 << n) - 1; i >= 0; --i) {
    if (i == k) continue;
    ans.push_back(i);
  }
  ans.push_back(k);
  
  return true;
}

int main() {
  if (sub()) {
    for (int i : ans) cout << i << ' ';
    cout << endl;
  } else {
    cout << -1 << endl;
  }
}



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

struct Cube {
  public:
  int f[6];
  void roll(int i, int j, int k, int l){
    int t = f[i]; f[i] = f[j]; f[j] = f[k]; f[k] = f[l]; f[l] = t; 
  }
  void roll_z() { roll(1,2,4,3); } //z一番使うから上
  void roll_x() { roll(0,2,5,3); } 
  void roll_y() { roll(0,1,5,4); }
    
};

int getRight(Cube c, int top, int front); //Cube入れんと事故る main内で入れてる

int main() {
  Cube c;
  for ( int i = 0; i < 6; i++ ) cin >> c.f[i];
  int n;
  cin >> n;
  int top, front;
  for ( int i = 0; i < n; i++ ) {
      cin >> top >> front; 
      cout << getRight(c, top, front) << endl;
  }
  return 0;
}

int getRight(Cube c, int top, int front) { 
    for ( int j = 1; j <= 8; j++ ) { //8だよ
      for ( int i = 1; i <= 4; i++ ) { //3だと毎回元に戻らない
          if ( top == c.f[0] && front == c.f[1] ) return c.f[2]; 
          c.roll_z(); 
      }
      if ( j == 1 || j == 2 || j == 3 || j == 4 ) c.roll_x();
      else c.roll_y();
    }
}



Measured memory_bytes: 3108
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001


int main(){
    int N; cin >> N;
    vector<int> H(N);
    for(int &h:H){
        cin >> h;
    }
    
    vector<int> dp(N, INF);
    dp[0] = 0;
    for(int i=0; i<N; i++){
        if(i+1<N) dp[i+1] = min(dp[i+1], dp[i] + abs(H[i+1] - H[i]));
        if(i+2<N) dp[i+2] = min(dp[i+2], dp[i] + abs(H[i+2] - H[i]));
    }
    
    cout << dp[N-1] << endl;
    return 0;
}





Measured memory_bytes: 1024
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>*/
 
#define pll              pair <long long,long long>
#define pb               push_back
#define ll               long long
#define ff               first
#define ss               second
#define D(x)             cerr<<#x " = "<<(x)<<endl
#define vll              vector <ll>
#define IOS              ios_base::sync_with_stdio(0); cin.tie(NULL);
#define endl             '\n'   
using namespace std;
int main()
{
    IOS
 	// freopen("input.txt","r",stdin);
 	// freopen("output.txt","w",stdout);
 	// freopen("error.txt","w",stderr);
 	ll d,t,s;
 	cin>>d>>t>>s;
 	if(s*t>=d)
 		cout<<"Yes"<<endl;
 	else
 		cout<<"No"<<endl;
    return 0;
}

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


int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(auto& a : A){
    cin >> a;
  }
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  int ans = 0;
  for(int ii=0; ii<N; ii++){
    if(ii%2==0){
      ans += A[ii];
    }else{
      ans -= A[ii];
    }
  }
  cout << ans << endl;
  return 0;
}

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

long long a, b, c, d, mx;

int main() {
    cin >> a >> b >> c >> d;
    mx = -1e18;
    mx = max(mx, a*c);
    mx = max(mx, a*d);
    mx = max(mx, b*c);
    mx = max(mx, b*d);
    cout << mx << "\n";
}


Measured memory_bytes: 3632
#include<stdio.h>
int dat[100];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		int max=1500000;
		int min=1;
		for(int i=0;i<b;i++)scanf("%d",dat+i);
		for(int i=0;i<b;i++)if(min<dat[i])min=dat[i];
		int res=0;
		int at=1;
		while(max-min>1){
			int M=(max+min)/2;
			res=0;
			at=1;
			for(int i=0;i<b;i++){
				if(res+dat[i]<=M)res+=dat[i];
				else{
					at++;
					res=dat[i];
				}
			}
			if(at<=a)max=M;
			else min=M;
		}
		int M=min;
		res=0;
		at=1;
		for(int i=0;i<b;i++){
			if(res+dat[i]<=M)res+=dat[i];
			else{
				at++;
				res=dat[i];
			}
		}
		if(at<=a)printf("%d\n",M);
		else printf("%d\n",max);
	}
}

Measured memory_bytes: 0
#include <stdio.h>
int main(void)
{
  int S;
  int h,m,s;

  scanf("%d",&S);

  h = S / 3600;
  m = (S % 3600) / 60;
  s = (S % 3600) % 60;
  
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}

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

int main() {
    long long x;
    cin >> x;

    for(long long a=-200; a<=200; a++){
        for(long long b=-200; b<=200; b++){
            if(((a*a*a*a*a) - (b*b*b*b*b))== x){
                cout << a << " " << b << endl;
                return 0; //インデントはこれ、これ追加したらまさかのOKでした、なんでできへんねん、大文字スペースか？それでした
            }
        }
    }
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
template<class T> bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int N;
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() {
  cin >> N;
  vi A(N);
  rep(i,N) cin >> A[i];

  rep(i,N-1) {
    A[i+1] = gcd(A[i], A[i+1]);
  }
  cout << A[N-1] << endl;
  return 0;
}

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

typedef long long                   ll;
typedef pair<int,int>               pii;
typedef pair<ll,ll>                 pll;
typedef pair<string , string>       pss;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define F                           first
#define S                           second
#define sep                         ' '
#define file_io                     freopen("input.txt" , "r+" , stdin) ; freopen("output.txt" , "w+" , stdout);
#define fast_io                     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define error(x)                    cerr << "$$$ " << x << '\n';
#define error2(x,y)                 cerr << "#F : " << x << "      #S : " << y << '\n';
#define pb                          push_back

const ll MX5 = 2*1e5+3;
const ll MX6 = 2*1e6+3;
const ll INF = 8e18;
const ll MOD = 1e9 + 7;
const ll MOD2= 998244353;

ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
ll bmm(ll a,ll b){
    return (a%b==0 ? b : bmm(b,a%b));
}

ll A[MX5];

int main(){
    fast_io
    //file_io
    ll m,d,ans=0;
    cin >> m >> d;
    for(int i=1;i<=m;i++){
        for(int j=11;j<=min(d,99ll);j++){
            if((j%10)*(j/10)==i && j%10>=2 && j/10>=2){
                ans++;
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>                                                                                                                                                                                         
#include <algorithm>
using namespace std;
const int MAX_N = 2000;
int main(){
    int N;
    long long int Y;
    cin >> N >> Y;

    int n_5000 = Y / 5000;
    int n_10000 =  Y / 10000;
    for(int i = 0; i <= n_10000; i++){
        for(int j = 0; j <= n_5000; j++){
            int temp = 10000 * i + 5000 * j + 1000 * (N - i - j); 
            if(temp == Y && N-i-j >= 0){ 
                cout << i << " " << j << " " << N-i-j << endl;
                return 0;
            }   
        }   
    }   
    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int n;
    cin >> n;
    int s = 0;
    for(int i = 0; i < n; ++i) {
        int l, r;
        cin >> l >> r;
        s += r - l + 1;

    }
    cout << s << endl;
    return 0;
}



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

#define mod 1000000007

using namespace std;
typedef long long ll; 
 
int main(void){
	
	string A, B, C;
	
	cin >> A >> B >> C;
	
	if(A[A.length()-1] == B[0] && B[B.length()-1] == C[0])
		cout << "YES";
	else
		cout << "NO";
	
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]

count = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for i in S:
    count[i] += 1

ans = 'AC x ' + str(count['AC']) + '\n' + 'WA x ' + str(count['WA']) + '\n' + 'TLE x ' + str(count['TLE']) + '\n' + 'RE x ' + str(count['RE'])

print(ans)


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

int main(){
    int n,p1=0,p2=0;
    string s1,s2;

    cin >> n;

    for(int i=0;i<n;i++){
        cin >> s1 >> s2;

        if(s1>s2) p1+=3;
        else if (s2>s1) p2+=3;
        else {p1++; p2++;}
    }

    cout << p1 << " " << p2 << endl;

    return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,x) for(ll i = 0;i<x;i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll,ll> P;
using graph = vector<vector<ll>>;
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b; return true;}return false;}
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b; return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
//printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
    */
int main(){
    ll N,K;
    cin >>N >> K;
    ll cnt1 = 0;//one
    ll cnt2 = 0;//two
    vector<ll> num(N);
    rep(i,N)cin >> num[i];
    rep(i,N){
        rep(j,N){
            if(num[i] > num[j]){
                cnt2++;
                if(i < j)cnt1++;
            }
        }
    }
//    rep(i,N)cout << one[i] << endl;
//    rep(i,N)cout << two[i] <<endl;
    ll ans = 0;
    ll tri = ((K - 1) % mod * K / 2 % mod) % mod;
    cout << (tri * cnt2 % mod + K * cnt1 % mod) % mod << endl;
//    cout << tri << endl;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self,size):
        self.table=[-1for _ in range(size)]
    def root(self,x):
        while self.table[x]>=0:
            x=self.table[x]
        return x
    def unite(self,x,y):
        s1=self.root(x)
        s2=self.root(y)
        if s1!=s2:
            if self.table[s1]!=self.table[s2]:
                if self.table[s1]<self.table[s2]:
                    self.table[s2]=s1
                else:
                    self.table[s1]=s2
            else:
                self.table[s1]+=-1
                self.table[s2]=s1
        return
    def same(self,x,y):
      return self.root(x)==self.root(y)
n,m=map(int,input().split())
UF=UnionFind(n+m)
for i in range(n):
    for t in map(int,input().split()[1:]):
        UF.unite(i,n+t-1)
print('YNEOS'[len(set(UF.root(i)for i in range(n)))>1::2])

Measured memory_bytes: 7956
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using ll=long long;
using P=pair<int,int>;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl '\n'
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}

int n;
int main(){
    cin >> n;
    vector<int> p(n), q(n);
    rep(i, 0, n) cin >> p[i];
    rep(i, 0, n) cin >> q[i];

    vector<int> tp = p, tq = q;
    sort(ALL(tp)); sort(ALL(tq));
    int cp = 0, cq = 0;

    do{
        cp++;
        int same = 0;
        rep(i, 0, n) if(tp[i] == p[i]) same++;
        if(same == n) break;
    }while(next_permutation(ALL(tp)));

    do{
        cq++;
        int same = 0;
        rep(i, 0, n) if(tq[i] == q[i]) same++;
        if(same == n) break;
    }while(next_permutation(ALL(tq)));

    int ans = abs(cp - cq);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3048
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
  
  int n,m,l;

  cin >> n >> m >> l;

  int **A = new int* [n];
  for(int i=0; i<n; i++){
    A[i] = new int [m];
  }

  int **B = new int* [m];
  for(int i=0; i<m; i++){
    B[i] = new int [l];
  }
  

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

  for(int i=0; i<m; i++){
    for(int j=0; j<l; j++){
      cin >> B[i][j];
    }
  }
  
  long **C = new long* [n];
  for(int i=0; i<n; i++){
    C[i] = new long [l];
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<l; j++){
      C[i][j] = 0;
      for(int k=0; k<m; k++){
        C[i][j] += A[i][k]*B[k][j];
      }
    }
  }

  for(int i=0; i<n; i++){
    for(int j=0; j<l; j++){
      cout << C[i][j];
      if(j==l-1){
        cout << endl;
      }else{
        cout << " ";
      }
    }
  }

  return(0);
}

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

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

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

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

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

    ll N, K;
    cin >> N >> K;
    ll res = 0;
    REP(i, N){
    	ll h;
    	cin >> h;
    	if(h>=K) res++;
    }
    cout << res << endl;
    return 0;

}

Measured memory_bytes: 764
#include <stdio.h>

int main(){
  int n,i,j,k,l,o,p,b,r,c[200005][5],nn=0,f,m=1,d[200005][2];
  long h[200005];
  char s[200005][12];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",&s[nn]);
    h[nn]=0;
    for(j=0;j<10;j++){
      if(s[nn][j]==0) break;
      h[nn]|=((long)s[nn][j]-'a'+1)<<(9-j)*5;
    }
    if(nn==0){
      c[0][0]=-1;
      c[0][1]=-1;
      c[0][2]=1;
      c[0][3]=0;
      c[0][4]=-1;
      r=0;
      nn=1;
    }else{
      j=r;
      f=0;
      while(j!=-1){
        k=j;
        if(h[j]==h[nn]){
          c[j][2]++;
          if(m<c[j][2]) m=c[j][2];
          f=1;
          break;
        }
        j=c[j][h[j]<h[nn]];
      }
      if(f==0){
        c[nn][0]=-1;
        c[nn][1]=-1;
        c[nn][2]=1;
        c[nn][3]=1;
        c[nn][4]=k;
        c[k][h[k]<h[nn]]=nn;
        j=nn;
        while(c[j][3]){
          k=c[j][4];
          if(c[k][3]){
            l=c[k][4];
            p=c[l][c[l][0]==k];
            if(p!=-1){
              if(c[p][3]){
                c[k][3]=0;
                c[p][3]=0;
                c[l][3]=1;
                c[r][3]=0;
                j=l;
                continue;
              }
            }
            if((c[k][0]==j)^(c[l][0]==k)){
              c[l][c[l][0]!=k]=j;
              c[j][4]=l;
              o=(c[k][0]==j);
              c[k][o^1]=c[j][o];
              c[c[j][o]][4]=k;
              c[j][o]=k;
              c[k][4]=j;
              o=j;
              j=k;
              k=o;
            }
            o=c[l][4];
            if(o!=-1){
              c[o][c[o][0]!=l]=k;
            }else{
              r=k;
            }
            c[k][4]=o;
            o=(c[l][0]==k);
            c[l][o^1]=c[k][o];
            c[c[k][o]][4]=l;
            c[k][o]=l;
            c[l][4]=k;
            c[k][3]=0;
            c[l][3]=1;
          }
          break;
        }
        c[r][3]=0;
        nn++;
      }
    }
  }
  i=0;
  d[0][0]=r;
  d[0][1]=0;
  while(i!=-1){
    f=0;
    switch(d[i][1]){
      case 0:
        d[i+1][0]=c[d[i][0]][0];
        if(d[i+1][0]!=-1) f=1;
        break;
      case 1:
        if(c[d[i][0]][2]==m){
          printf("%s\n",&s[d[i][0]]);
        }
        break;
      case 2:
        d[i+1][0]=c[d[i][0]][1];
        if(d[i+1][0]!=-1) f=1;
        break;
      case 3:
        i--;
        break;
    }
    if(f){
      i++;
      d[i][1]=0;
    }else if(i>=0){
      d[i][1]++;
    }
  }
  return(0);
}

Measured memory_bytes: 10624
N = int(input())
R = []
for i in range(N):
    s = int(input())
    values = []
    for j in range(s):
        values.append(list(map(int,input().split())))
    R.append(values)
def check(status):
    for i in range(N):
        s = status[i]
        for e1,e2 in R[i]:
            if s == '0':
                continue
            if e2 == 1 and status[e1-1] == '0':
                return False
            if e2 == 0 and status[e1-1] == '1':
                return False
    return True
ans = 0
for x in range(2**N):
    status = format(x,'0%ib'%N)
    if check(status):
        value = status.count('1')
        if value > ans:
            ans = value
print(ans)

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

int main()
{
  int n,m,sum;
  cin>>n>>m;
  vector<int> d(m);
  for(int i=0;i<m;i++)
  {
    cin>>d.at(i);
  }
  sum=accumulate(d.begin(),d.end(),0);
  if(n-sum>=0)
    cout<<n-sum<<endl;
  else
    cout<<"-1"<<endl;
}


Measured memory_bytes: 3624
n = int(input())
a = [int(i) for i in input().split()] 
ans = 0
for i in range(max(a)):
        m = max(a)
        cnt = a.count(m)
        for y in range(len(a)-1):
                if a[y] == m == a[y+1]:
                        cnt -= 1
        a = [(z-1 if z == m else z) for z in a]
        ans += cnt
print(ans) 

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <set>
#define MAXN 200010
#define y1 zjtsb_y1
using namespace std;

int x1,y1,x2,y2;
int n;
pair<int,int> a[MAXN];
set< pair<int,int> > S;

double PI=acos(-1.0);

int main(){
#ifdef DEBUG
	freopen("C.in","r",stdin);
#endif
	scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
	int _n;
	scanf("%d",&_n);
	while(_n--){
		int x,y;
		scanf("%d%d",&x,&y);
		if(x>=min(x1,x2) && x<=max(x1,x2) && y>=min(y1,y2) && y<=max(y1,y2))
			a[++n]=make_pair(x,y);
	}
	if(x1>x2){
		for(int i=1;i<=n;i++) a[i].first=x1+x2-a[i].first;
		swap(x1,x2);
	}
	if(y1>y2){
		for(int i=1;i<=n;i++) a[i].second=y1+y2-a[i].second;
		swap(y1,y2);
	}
	sort(a+1,a+n+1);
	int res=0;
	for(int i=n;i>=1;i--){
		set< pair<int,int> >::iterator it=S.lower_bound(make_pair(a[i].second,0));
		int temp;
		if(it==S.end()) temp=1;
		else temp=it->second+1;
		if(temp>res) res=temp;
		it=S.insert(make_pair(a[i].second,temp)).first;
		while(it!=S.begin() && (--it)->second<=temp){
			set< pair<int,int> >::iterator it2=it;
			it2++;
			S.erase(it);
			it=it2;
		}
	}
	double ans=(double)(x2-x1+y2-y1)*100;
	ans-=res*(20-5*PI);
	if(res==min(x2-x1+1,y2-y1+1)) ans+=5*PI;
	printf("%.10lf\n",ans);
}


Measured memory_bytes: 11136
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		System.out.print(s.charAt(0));
		System.out.print(s.length()-2);
		System.out.print(s.charAt(s.length()-1));
	}
}

Measured memory_bytes: 35400