akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,k; cin>>n>>k;
  int type=0;
  vector<int> num(200001,0);
  for(int i=0;i<n;i++){
    int a; cin>>a;
    if(num[a]==0) type++;
    num[a]++;
  }
  if(type<=k){
    cout<<0<<endl;
    return 0;
  }
  type-=k;
  sort(num.begin(),num.end());
  long long ans=0;
  int i=0;
  while(type!=0){
    if(num[i]==0){
      i++;
      continue;
    }
    type--;
    ans+=num[i];
    i++;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
#![macro_use]

use std::cmp::*;
use std::collections::*;
use std::io::*;
use std::mem::*;
use std::num::*;
use std::slice::*;

fn main() {
    let mut io = IO::new(stdin(), stdout(), stderr());
    // ===================================== //
    let (n, p): (i64, i64) = (io.read(), io.read());
    let pf = prime_factor(p as i64);

    let mut ans = 1;
    for (key, value) in &pf {
        if *value >= n {
            let kakeru = *value / n;
            let mut mm = kakeru;
            let mut b = *key;
            while mm > 0 {
                if mm & 1 == 1 {
                    ans *= b;
                }
                b = b * b;
                mm >>= 1;
            }
        }
    }
    println!("{}", ans);
}

pub fn prime_factor(mut n: i64) -> HashMap<i64, i64> {
    let mut res: HashMap<i64, i64> = HashMap::new();
    let mut i = 2;
    while i * i <= n {
        while n % i == 0 {
            let v = match res.get(&i) {
                Some(v) => *v + 1,
                None => 1,
            };
            res.insert(i, v);
            n /= i;
        }
        i += 1;
    }
    if n != 1 {
        res.insert(n, 1);
    }
    res
}
// IO
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
}


Measured memory_bytes: 4352
N=int(input())
h=list(map(int,input().split()))
dp = [0, abs(h[1]-h[0])]
for i in range(2, N):
  dp.append(min(dp[i-1] + abs(h[i-1]-h[i]), dp[i-2]+abs(h[i-2]-h[i])))
print(dp[N-1])

Measured memory_bytes: 13928
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
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() {
    ll n;
    cin >> n;
    vector<ll> b(n-1);
    rep(i, 0, n-1) cin >> b[i];
    ll ans = b[0] + b[n-2];
    rep(i, 0, n-2) ans += min(b[i], b[i+1]);
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

type Point struct {
	x int
	y int
}

func getLength(p1 Point, p2 Point) float64 {
	return math.Sqrt(
		math.Pow(
			float64(p1.x - p2.x), 2) +
		math.Pow(
			float64(p1.y - p2.y), 2))
}

func getAllLength(p []Point) float64 {
	var length float64
	for i := 0; i < len(p) - 1; i++ {
		length += getLength(p[i], p[i+1])
	}
	return length
}

func combi(n int, stack []Point, tmp []Point, ret []float64) []float64 {
	for i := 0; i < len(stack); i++ {
		tmp := append(tmp, stack[i])
		if (len(tmp) == n) {
			return append(ret, getAllLength(tmp))
		} else {
			// 抽出は破壊的なのでコピー用に複製する
			childtmp := append([]Point{}, stack...)
			child := append(childtmp[:i], childtmp[i+1:]...)
			ret = combi(n, child, tmp, ret)
		}
	}
	return ret
}

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	point := make([]Point, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d %d\n", &point[i].x, &point[i].y)
	}
	stack := make([]Point, n)
	for i := 0; i < n; i++ {
		stack[i] = point[i]
	}
	ways := combi(n, stack, []Point{}, []float64{})
	var total float64
	for _, value:= range ways {
		total += value
	}
	fmt.Println(total/float64(len(ways)))
}

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

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

using namespace std;

int main(){
  ll n;cin>>n;
  vector<ll>  a(n),b(n);
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];

  ll suma=0, sumb=0, ap=0, bp=0;
  rep(i,n){
    suma+=a[i];
    sumb+=b[i];
    if(a[i]>b[i])ap+=(a[i]-b[i]);
    if(b[i]>a[i])bp+=ceil((double)(b[i]-a[i])/2.0);

//cout<<a[i]<<' '<<b[i]<<'|'<<ap<<' '<<bp<<endl;
  }

  if(sumb<suma){
    cout<<"No"<<endl;
  }else if(max(ap, bp)<=sumb-suma){
    cout<<"Yes"<<endl;
  }else{
//cout<<ap<<' '<<bp<<' '<<sumb<<' '<<suma<<endl;
    cout<<"No"<<endl;
  }

//cout<<suma<<' '<<sumb<<' '<<bp<<endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int H=1,A[2000001];

void mh(int i){
  int l=i*2,r=i*2+1,lar=i;
  if(A[l]>A[i]&&l<=H)lar=l;
  if(A[r]>A[lar]&&r<=H)lar=r;
  if(lar!=i){
    swap(A[lar],A[i]);
    mh(lar);
  }
}

void insert(int k){
  int i=H++;
  A[i]=k;
  while(i>0&&A[i/2]<A[i]){
    swap(A[i/2],A[i]);
    i/=2;
  }
}

int extrect(){
  int ans=A[0];
  A[0]=A[--H];
  mh(0);
  return ans;
}

int main(){
  string a;
  while(cin>>a){
    if(a=="insert"){
      int n;
      cin>>n;
      insert(n);
    }else if(a=="extract"){
      cout<<extrect()<<endl;
    }else break;
  }
  return 0;
}

Measured memory_bytes: 7044
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define len(s) s.length()
#define forp(i,a,b) for( i=a;i<=b;i++)
#define rep(i,n)    for( i=0;i<n;i++)
#define ren(i,n)    for( i=n-1;i>=0;i--)
#define forn(i,a,b) for( i=a;i>=b;i--)
#define all(v) v.begin(),v.end()
#define b(v) v.begin()
#define e(v) v.end()
#define mem(n,m) memset(n,m,sizeof(n))
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vii vector<int>
#define vll vector<long long>
#define gl(cin,s)  getline(cin,s);
#define bitc(n) __builtin_popcountll(n)
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define SIZE 3010

typedef long long  ll;
typedef unsigned long long ull;
typedef long double  ldo;
typedef double  db ;
using namespace std;
double dp[401][401][401];
int N;
int cnt[4];
double func(int c1,int c2,int c3)
{
  //cout<<c1<<" "<<c2<<" "<<c3<<endl;
  if(c1 == 0 and c2 == 0 and c3 == 0)
  return 0;
  if(dp[c1][c2][c3] != -1.00000000)
  return dp[c1][c2][c3];
  double fans = 1;
  if(c1){
    fans += 1.0000*func(c1-1,c2,c3)*c1 / N;
  }
  if(c2){
    fans += 1.0000*func(c1+1,c2-1,c3)*c2 / N;
  }
  if(c3){
    fans += 1.0000*func(c1,c2+1,c3-1)*c3 / N;
  }
  fans *= N;
  fans /= ((1.000000)*(c1+c2+c3));
  dp[c1][c2][c3] = fans;
  return fans;
}
int main()
{
    boost;
    cin>>N;
    for(int i=1;i<=N;i++){
      int x;
      cin>>x;
      cnt[x]++;
    }
    for(int i=0;i<401;i++){
      for(int j=0;j<401;j++){
        for(int k=0;k<401;k++){
          dp[i][j][k] = -1.0000000000;
        }
      }
    }
    cout<<fixed<<setprecision(11);
    cout<<func(cnt[1],cnt[2],cnt[3])<<endl;
    return 0;
}


Measured memory_bytes: 504064
#include "bits/stdc++.h"
using namespace std;

void solve() {

}


int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s, t;
	cin >> s >> t;
	cout << t << s << endl;
}

Measured memory_bytes: 256
/**
 *      author  : kyomukyomupurin
 *      created : 2018/08/19
**/
//ABC 104 A

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

int main(){
    int R;
    cin >> R;

    if (R < 1200){
        cout << "ABC";
    }
    else if (R < 2800){
        cout << "ARC";
    }
    else {
        cout << "AGC";
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MAX = 1000;
const int INF = 1e9;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};
#define PI 3.14159265358979323846264338327950L
//setprecision(15)

int main() {
	vector<vector<int>> v(3, vector<int>(3));
	rep(i, 3) {
		rep(j, 3) {
			cin >> v.at(i).at(j);
		}
	}
	int N; cin >> N;
	rep(i, N) {
		int temp; cin >> temp;
		rep(j, 3) {
			rep(k, 3) {
				if (v.at(j).at(k) == temp) {
					v.at(j).at(k) = 0;
				}
			}
		}
	}
	rep(i, 3) {
		if (v.at(i).at(0) != 0) {
			continue;
		}
		if (v.at(i).at(1) == 0 && v.at(i).at(2) == 0) {
			goto BINGO;
		}
	}
	rep(i, 3) {
		if (v.at(0).at(i) != 0) {
			continue;
		}
		if (v.at(1).at(i) == 0 && v.at(2).at(i) == 0) {
			goto BINGO;
		}
	}
	if (v.at(0).at(0) == 0 && v.at(1).at(1) == 0 && v.at(2).at(2) == 0) {
		goto BINGO;
	}
	if (v.at(2).at(0) == 0 && v.at(1).at(1) == 0 && v.at(0).at(2) == 0) {
		goto BINGO;
	}
	cout << "No" << endl;
	return 0;
BINGO:
	cout << "Yes" << endl;
	return 0;
}

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

vector<int> v;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	for(int i=1; i<=150; ++i)
		for(int j=i+1; j<=150; ++j)
			v.push_back(1000*(i*i+j*j)+i);
	sort(v.begin(), v.end());
//	for(int i=0; i<100; ++i)
//		cout << v[i] << "\n";
	while(1){
		int h, w;
		cin >> h >> w;
		if(h + w == 0) return 0;
		auto ite = upper_bound(v.begin(), v.end(), 1000*(h*h+w*w)+h);
		int a, b;
		a = (*ite)%1000;
		b = 0;
		while(b*b < (*ite)/1000 - a*a) ++b;
		cout << a << " " << b << "\n";
	}
}


Measured memory_bytes: 3272
#include<stdio.h>

#include<string.h>


int main(void)


{


int sum;


char str[1100];


int i;


for(i=0;i<1100;i++){


str[i]=0;


}


while(1){


scanf("%s",str);


if(strcmp(str,"0")==0){


break;


}


sum=0;


for(i=0;str[i]!='\0';i++){


sum+=str[i]-'0';


}


printf("%d\n",sum);


}


return 0;


}

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

/* using */
using namespace std;

/* main constructor */
struct Fast
{
    Fast()
    {
        std::cin.tie(0);
        ios::sync_with_stdio(0);
        //cout << fixed << setprecision(12);
    }
} fast;

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

/* define */
#define REP(i, x, n) for (int i = x; i < (int)(n); ++i)
#define RREP(i, x, n) for (int i = x - 1; i >= (int)(n); --i)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) REP(i, 1, n + 1)
#define rrep(i, n) RREP(i, n, 0)
#define each(i, n) for (auto &i : n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define eunique(x) \
    sort(all(x));  \
    (x).erase(unique(all(x)), (x).end())
#define mp make_pair
#define r0 return 0

/* const */
const int inf = 1e9 + 7;
const int dxl[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dyl[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dxs[4] = {1, 0, -1, 0};
const int dys[4] = {0, 1, 0, -1};

/* main */
signed main(void)
{
    int a, b, c, k;
    cin >> a >> b >> c >> k;
    int maxi = max({a, b, c});
    int sum = (a + b + c) - maxi;
    rep(i, k)
    {
        maxi *= 2;
    }
    cout << sum + maxi << endl;
    return 0;
}


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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) { cin1(x[i]); }
#define ncin2(n, x, y)      REP(i, 0, n) { cin2(x[i], y[i]); }
#define ncin3(n, x, y, z)   REP(i, 0, n) { cin3(x[i], y[i], z[i]); }
#define ncinp(n, p)         REP(i, 0, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }
#define ncin1_1(n, x)       REPE(i, 1, n) { cin1(x[i]); }
#define ncin2_1(n, x, y)    REPE(i, 1, n) { cin2(x[i], y[i]); }
#define ncin3_1(n, x, y, z) REPE(i, 1, n) { cin3(x[i], y[i], z[i]); }
#define ncinp_1(n, p)       REPE(i, 1, n) { lli p1,p2; cin >> p1 >> p2; p[i] = P(p1, p2); }

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n;
    cin1(n);
    string s;
    cin1(s);
    lli count[n] = {0};
    // まず一番左の人をリーダーにした場合の答えを出す
    REP(i,1,n) {
        if (s[i] == 'E')
            count[0]++;
    }

    lli ans = count[0];
    // i 人目をリーダーにしたい人を、i-1人目の結果をもとに算出していく
    REP(i,1,n) {
        lli x = count[i-1];
        if (s[i-1] == 'W')
            x++;
        if (s[i] == 'E')
            x--;
        count[i] = x;
        //cout2(i,x);
        ans = min<lli>(ans, x);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3076
// Code for C - Marks
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define FOR(i,x,y) for(ll i=x;i<(ll)(y);i++)

#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

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

  vector<int> A(N);
  REP(i, N) {
    cin >> A[i];
  }

  REP(i, N - K) {
    if (A[i] < A[i + K]) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3996
// TEMPLATE
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (int i = (a); (i) < (b); (i)++)
#define FORS(i, a, b) for (int i = (a); (i) <= (b); (i)++)
#define REP(i, n) for (int i = 0; (i) < (n); (i)++)
#define REPS(i, n) for (int i = 1; (i) <= (n); (i)++)
#define RREP(i, n) for (int i = (n - 1); (i) >= 0; (i)--)
#define RREPS(i, n) for (int i = n; (i) > 0; (i)--)
#define len(x) ((int)(x).size())
#define print(x) (cout << (x) << "\n")

// LIBRARY

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) {}
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return;
    if (data[y] < data[x])
      swap(x, y);
    data[x] += data[y];
    data[y] = x;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
  int size(int x) { return -data[root(x)]; }
};

// SOLVE
void solve() {
  int H, W;
  cin >> H >> W;
  vvi C(H, vector<int>(W));
  UnionFind uf(H * W + 1);
  REP(i, H) {
    string str;
    cin >> str;
    REP(j, W) {
      if (str[j] == '.') {
        C[i][j] = 0;
      } else {
        C[i][j] = 1;
      }
    }
  }
  REP(i, H) {
    REP(j, W) {
      if (j != 0 && C[i][j] != C[i][j - 1]) {
        uf.unite(i * W + j, i * W + j - 1);
      }
      if (i != 0 && C[i][j] != C[i - 1][j]) {
        uf.unite((i - 1) * W + j, i * W + j);
      }
    }
  }
  set<ll> s;
  map<ll, ll> wc;
  map<ll, ll> bc;
  REP(i, H) {
    REP(j, W) {
      ll root = uf.root(i * W + j);
      s.insert(root);
      if (C[i][j] == 0) {
        wc[root]++;
      } else {
        bc[root]++;
      }
    }
  }
  ll ans = 0;
  for (set<ll>::iterator it = s.begin(), end = s.end(); it != end; ++it) {
    ans += wc[*it] * bc[*it];
  }
  print(ans);
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}


Measured memory_bytes: 25344
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <assert.h>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <complex>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
ll mod=1e9+7;
double eps=1e-7;
ll exp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=(x*x)%mod){if(y&1)ret=(ret*x)%mod;}return ret;}
ull pexp(ull x,ull y){if(y<0) return 0; ull ret=1; for(;y;y>>=1,x=(x*x)){if(y&1)ret=(ret*x);}return ret;}
ll gcd(ll x,ll y){if(!x||!y) return x+y; return x%y==0?y:gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll bsum(ll u,ll b){ll ret=0;if(u<b)return u;while(u){ret+=u%b;u/=b;}return ret;}
ll prival(ll u,ll p){ll cn=0;while(u%p==0){cn++;u=u/p;}return cn;}
ll minv(ll a,ll b){return 1<a?b-minv(b%a,a)*b/a:1;}
ll extm(ll a,ll b){ll ret=0;while(a!=0){if(a%2==1){ret+=b;ret%=mod;}a>>=1;b=(2*b)%mod;}return ret;}   
ll eaphi(ll x){ll t=x,ret=x,i;for(i=2;i*i<=x;i++){if(t%i==0){ret-=ret/i;while(t%i==0) t/=i;}}if(t!=1) ret-=ret/t;return ret;}
ll eadivc(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=2;if(x%i==0 && i*i==x) ret+=1;}return ret;}
ll eadivs(ll x){ll ret=0;ll i;for(i=1;i*i<=x;i++){if(x%i==0 && i*i!=x) ret+=i+x/i;if(x%i==0 && i*i==x) ret+=i;}return ret;}
ll ndig(ll x, ll b){ll ret=0;while(x){x/=b; ret++;}return ret;}
ll rev(ll n, ll b){ll ret=0;while(n){ret=b*ret+n%b; n/=b;}return ret;}
ll sq(ll x){ll t=(ll)sqrt(x); for(ll i=t-2 ; i<=t+2 ; i++) if(i*i==x) return abs(i); return -1;}
ll extexp(ll x,ll y){if(y<0) return 0; ll ret=1;for(;y;y>>=1,x=extm(x,x)){if(y&1)ret=extm(ret,x);}return ret;}
bool isprime(ll x){if(x<=1) return false; for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;}
bool dp[5111][5111];
int n, k, vv[5111], lef, rig, mid, best, ans;

bool unnecessary(int x)
{
	int i, j;
	for(i=1 ; i<=n ; i++)
		for(j=0 ; j<=k ; j++)
			dp[i][j]=false;
	dp[0][0]=true;
	for(i=1 ; i<=n ; i++)
	{
		int v=vv[i]; if(i==x) v=0;
		for(j=0 ; j<=k ; j++)
			if(dp[i-1][j] || (j>=v && dp[i-1][j-v])) dp[i][j]=true;
	}
	for(i=max(k-vv[x],0) ; i<=k-1 ; i++) if(dp[n][i]) return false;
	return true;
}

int main(void)
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin>>n>>k; int i, j; lef=1; rig=n;
	for(i=1 ; i<=n ; i++) cin>>vv[i]; sort(vv+1,vv+n+1);
	while(lef<=rig)
	{
		mid=(lef+rig)/2;
		if(unnecessary(mid)) best=mid, lef=mid+1;
		else rig=mid-1;
	}
	cout<<best; return 0;
}

// it may be easier than you think
// it may be harder than you think
// ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

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

class FC{
public:
    int p[31];
    int n;
        
    bool is_over(){
     	return p[1]==p[2] && p[2]==p[3] && p[3]==p[4] && p[4]==p[5] &&
        	p[5]==p[6] && p[6]==p[7] && p[7]==p[8] && p[8]==p[9] &&
        	p[10]==p[11] && p[11]==p[12] &&
      		p[13]==p[14] && p[14]==p[15] &&
      		p[16]==p[17] && p[17]==p[18] &&
      		p[19]==p[20] && p[20]==p[21];
     }
          
    void rot1()
    {
        swap(p[7], p[22]);  swap(p[8], p[23]);  swap(p[9], p[24]);
        swap(p[10], p[12]);  swap(p[13], p[18]);
    }
 
    void rot2()
    {
        swap(p[1], p[28]);  swap(p[2], p[29]);  swap(p[3], p[30]);
        swap(p[19], p[21]);  swap(p[15], p[16]);
    }
 
    void rot3()
    {
        swap(p[1], p[24]);  swap(p[4], p[27]);  swap(p[7], p[30]);
        swap(p[16], p[18]);  swap(p[10], p[21]);
    }
 
    void rot4()
    {
        swap(p[3], p[22]);  swap(p[6], p[25]);  swap(p[9], p[28]);
        swap(p[13], p[15]);  swap(p[12], p[19]);
    }
};
 
int main()
{
    int N;
    cin >> N;
 
    for(int i=0; i<N; i++){
        FC now;
        for(int j=1; j<=30; j++){
            cin >> now.p[j];
        }
        now.n = 0;
 
        queue<FC> que;
        que.push(now);
 
        while(!que.empty()){
            now = que.front();
            que.pop();
 
            if(now.is_over()){
                cout << now.n << endl;
                break;
            }
 
            FC nex1 = now;  nex1.rot1();  nex1.n++;  que.push(nex1);
            FC nex2 = now;  nex2.rot2();  nex2.n++;  que.push(nex2);
            FC nex3 = now;  nex3.rot3();  nex3.n++;  que.push(nex3);
            FC nex4 = now;  nex4.rot4();  nex4.n++;  que.push(nex4);
        }
    }
 
    return 0;
}  

Measured memory_bytes: 13944
import java.util.Scanner;
import java.io.PrintWriter;
public class Main {
    public static void main(String args[]) {
      Scanner sc = new Scanner(System.in);
      PrintWriter out = new PrintWriter(System.out);
      int n = sc.nextInt();
      out.println((int)Math.pow(n,3.0));
      out.flush();
    }
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int n; cin >> n;
    vec a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    bool f = false;
    rep(i, n-2){
        if(a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2]){
            f = true;
        } 
    }
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7736
#define ENABLE_LL
#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr; typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; } char nextChar(){ char r; ist>>r; return r;} }; Scanner sc(cin);
void ALERT(bool judgememt, const char* phrase) { if (judgememt) { puts(phrase); throw "ALERT"; } }
bool alert(bool judgememt, const char* phrase) { if (judgememt) puts(phrase); return judgememt; }

void init() {
     
}

void mul(int &a, int b) {
    int x = a, res = 0;
    while (b) {
        if (x > (int)1e18) throw string("overFlow");
        if (b & 1) res += x;
        b >>= 1;
        x += x;
    }
    a = res;
    see(a);
    if (a>(int)1e18) throw string("overFlow");
}

const int N = 100005;
int a[N];

void solve() {
    int n; scanf(I,&n);
    rep (i,n) scanf(I,&a[i]);
    rep (i,n) if (alert(a[i]==0,"0")) return;
    int res = 1;
    rep (i,n) {
        try {
            mul(res, a[i]);
        } catch (string e) {
            puts("-1");
            return ;
        }
    }
    printf(IN,res);
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
#ifndef CUSTOM_MAIN
#ifdef MULTIPLE_TEST_CASES_WITH_T

int T; scanf("%d",&T); while(T--) {init(); solve();}

#else
#ifdef MULTIPLE_TEST_CASES_WITHOUT_T

while(1) {try{init(); } catch(bool t){return 0;} solve(); }

#else

init(); solve();

#endif
#endif
#endif
    return 0;
}



Measured memory_bytes: 4580
#include <iostream>
#include <set>

using namespace std;

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

int main(){
  int m,n;
  while(cin >> n >> m, m + n){
    int p[10001][2];
    set<int> fri1;
    set<int> fri2;
    rep(i,0,m){
      int a,b; cin >> a >> b;
      p[i][0] = a;
      p[i][1] = b;
      if(a == 1 || b == 1){
        fri1.insert(a);
        fri1.insert(b);
      }
    }
    if(fri1.size() == 0){
      cout << 0 << endl;
      continue;
    }
    rep(i,0,m){
      if(fri1.find(p[i][0]) != fri1.end() || fri1.find(p[i][1]) != fri1.end()){
        fri2.insert(p[i][0]);
        fri2.insert(p[i][1]);
      }
    }
    cout << fri2.size()-1 << endl;
  }
  return 0;
}

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

int main() {
    int N, X, T; cin >> N >> X >> T;
    int ans = (N-1) / X;
    ans++;
    ans *= T;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
	int w=0,a=0,b=0,ans=0;
	cin>>w>>a>>b;
	  if(b>a+w)
	    ans=b-(a+w);
	                   
	  else if(a>b+w)  
	    ans=a-(b+w);
	 
	  else
	    ans=0;
	    
		cout<<ans;  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
using namespace std;
typedef long long LL;
const int INF = 999999999;

struct edge
{
  int src, to, cost;
};
using Edges = vector<edge>;
using WeightedGraph = vector<Edges>;

vector<int> tsort(WeightedGraph &G){
    vector<int> tsorted;
    vector<bool> used(G.size(), false);
    function<void(int)> dfs = [&](int u){
        if(used[u]) return;
        used[u] = true;
        for(auto &e : G[u]) dfs(e.to);
        tsorted.pb(u);
    };
    rep(i, G.size()) dfs(i);
    reverse(all(tsorted));
    return tsorted;
}

int main()
{
  int n, m;
  cin >> n >> m;
  WeightedGraph G(n);
  rep(i, m)
  {
    int s, t;
    cin >> s >> t;
    G[s].emplace_back((edge){s, t, 1});
  }
  vector<int> ans = tsort(G);
  rep(i, n) cout << ans[i] << endl;
}



Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vvl = vector<vector<ll>>;
using vl  = vector<ll>;
#define _GLIBCXX_DEBUG
#define acc_io cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define DBG(a,b,c,d) cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
const ll MOD = 1000000007;
const double PI = acos(-1);  
//name[i]   -> vl  name(i)
//name[i][j]-> vvl name(i,vl(j))
//or-> ||
//map<int,int>mp

int k;
string s;
signed main(){
	acc_io;
	string p;
	cin>>k>>s;
	if(s.size()<=k){
		p=s;
	}
	else{
		rep(i,0,k){
			p.pb(s[i]);
		}
		p+="...";
	}
	cout<<p<<endl;
	return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string a;
	int k;
	cin>>k;
	cin>>a;
	if(a.length()<=k)
		cout<<a;
	else
	{
		for(int i=0;i<k;i++)
			cout<<a[i];
			cout<<"...";
	}
	return 0;
}

Measured memory_bytes: 3132
n = gets.to_i
a = gets.split.map &:to_i

mod = 1000000007

arr = Array.new(n + 1, 0)
sum = 1

arr[0] = 3

a.each{ |aa|
	aa2 = aa + 1
	sum = (sum * (arr[aa2 - 1] - arr[aa2])) % mod
	arr[aa2] += 1
}

puts sum


Measured memory_bytes: 8836
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int h, w;
std::string s;
std::vector<std::string> vec;

int main() {
    std::cin >> h >> w;
    for (int i = 0; i < h; i++) {
        cin >> s;
        vec.push_back(s);
    }
    
    
    for (int i = 0; i < w + 2; i++) {
        std::cout << "#";
    }
    cout << endl;
    for (int i = 0; i < h; i++) {
        cout << "#";
        cout << vec[i];
        cout << "#";
        cout << endl;
    }
    for (int i = 0; i < w + 2; i++) {
        cout << "#";
    }
    cout << endl;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[100005];
int main(){
	int n,k=1,ans,i;
	bool flag,res=false;
	scanf("%d",&n);
	scanf("%d",&a[0]);
	if(n==1){
		printf("1\n");
		return 0;
	}
	ans=a[0];
	for(i=1;i<n;i++){
		scanf("%d",&a[i]);
		if(!res){
			if(a[i]>ans){
				flag=true;
				res=true;
				ans=a[i];
			}
			else if(a[i]<ans){
				flag=false;
				res=true;
				ans=a[i];
			}
		}
		else{
			if(flag){
				if(a[i]>=ans)
					ans=a[i];
				else{
					k++;
					ans=a[i];
					res=false;
				}
			}
			else{
				if(a[i]<=ans)
					ans=a[i];
				else{
					k++;
					ans=a[i];
					res=false;
				}
			}
		}
	}
	printf("%d\n",k);
	return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,k;
    cin >> n >> k;
    int a[50];
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
    }
    sort(a,a+n,greater<int>());
    int sum = 0;
    for(int i=0;i<k;i++)
    {
        sum += a[i];
    }
    cout << sum << endl;
}

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

char x[1000], y[1000];

int lcs()
{
  int i, j;
  int m = strlen(x);
  int n = strlen(y);
  int c[m + 1][n + 1];
  
  for (i = 1; i <= m; i++) {
    c[i][0] = 0;
  }
  for (j = 0; j <= n; j++) {
    c[0][j] = 0;
  }
  
  for (i = 1; i <= m; i++) {
    for (j = 1; j <= n; j++) {
      if (x[i - 1] == y[j - 1]) {
        c[i][j] = c[i - 1][j - 1] + 1;
      } else if (c[i - 1][j] >= c[i][j - 1]){
        c[i][j] = c[i - 1][j];
      } else {
        c[i][j] = c[i][j - 1];
      }
    }
  }
  
  return c[m][n];
}

int main()
{
  int i, n;
  
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%s%s", x, y);
    printf("%d\n", lcs());
  }
  
    return 0;
}

Measured memory_bytes: 4512
N = int(input())
a = list(map(int, input().split()))
a = [0] + a

# 分かりやすくするために一番目はb[1]としたい
b = [0] * (N + 1)
for i in reversed(range(1, N + 1)):
    if sum(b[i::i]) % 2 != a[i]:
        b[i] = 1

if a.count(1) == -1:
    print(0)
else:
    print(b.count(1))
    print(' '.join(map(str, [i for i, x in enumerate(b) if x == 1])))

Measured memory_bytes: 18996
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, m;
int a[700*701/2], b[700*701/2];

set<int> G[710];
vector<int> H[710];

int temp[2];

// 二部グラフ判定
int color[710];
bool dfs(int v, int c) {
    color[v] = c;
    temp[c]++;
    for (int u : H[v]) {
        if (color[u] == c ||
            (color[u] < 0 && !dfs(u, 1-c))) {
            return false;
        }
    }
    return true;
}

int solve() {
    for (int i = 0; i < m; i++) {
        G[a[i]].insert(b[i]);
        G[b[i]].insert(a[i]);
    }
    int num_e = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (j != i && G[i].count(j) == 0) {
                H[i].push_back(j);
                num_e++;
            }
        }
    }
    num_e /= 2;

    vector<P> vec;
    memset(color, -1, sizeof(color));
    for (int i = 0; i < n; i++) {
        if (color[i] < 0) {
            temp[0] = temp[1] = 0;
            if (!dfs(i, 0))
                return -1;
            vec.push_back(make_pair(temp[0], temp[1]));
        }
    }

    bool c[n+1];
    memset(c, false, sizeof(c));
    c[0] = true;
    for (P p : vec) {
        for (int i = n; i >= 0; i--) {
            if (c[i]) {
                c[i] = false;
                c[i+p.first] = true;
                c[i+p.second] = true;
            }
        }
    }

    int res = inf;
    for (int i = 1; i < n; i++) {
        if (c[i]) {
            res = min(res, m - (i * (n - i) - num_e));
        }
    }
    return res;
}

void input() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        a[i]--;
        b[i]--;
    }
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 27900
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

ll L;
ll ans=0;
map< ll , ll > mp;
vector< ll > t,s;

void dfs(int p,ll cnt,ll num){
  if(p==(int)s.size()){
    ans+=cnt;return;
  }
  ll size=t[p],k=1;
  for(int i=0;i<=size;i++){
    dfs(p+1, (i==size?cnt*(size+1):cnt), num*k );
    k*=s[p];
  }
}

int main(){
  while(1){
    cin>>L;
    if(L==0)break;
    t.clear();s.clear();
    mp.clear();ans=0;
    ll x=L;
    for(ll i=2;i*i<=L;i++){
      while(x%i==0){
        mp[i]++;
        x/=i;
      }
    }
    if(x>1)mp[x]++;

    map<ll,ll> :: iterator it;    
    for( it=mp.begin();it!=mp.end();it++){
      s.push_back( it->first );
      t.push_back( it->second );
    }
    dfs(0,1,1);
    cout<<(ans+1LL)/2LL<<endl;
  }
  return 0;
}

Measured memory_bytes: 1220
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
	"strings"

)


func main() {
	solve(os.Stdin, os.Stdout)
}

type ReaderEx struct {
	baseScanner *bufio.Scanner
	words       []string
	nextWordIdx func() int
	initWordIdx func(int)
}

func NewScannerEx(stdin io.Reader) *ReaderEx {
	var this ReaderEx
	var idx int
	var wordsCnt int
	this.baseScanner = bufio.NewScanner(stdin)
	this.baseScanner.Buffer(make([]byte, 0), 1E+11)
	this.nextWordIdx = func() int {
		cur := idx
		idx = (idx + 1) % wordsCnt
		return cur
	}
	this.initWordIdx = func(wc int) {
		idx = 0
		wordsCnt = wc
	}
	return &this
}

func (me *ReaderEx) Scan(doSplit bool) (isScanned bool) {
	isScanned = me.baseScanner.Scan()
	if doSplit {
		me.words = strings.Fields(me.baseScanner.Text())
	} else {
		me.words = []string{me.baseScanner.Text()}
	}
	me.initWordIdx(len(me.words))
	return
}

func (me *ReaderEx) nextBytes() []byte {
	return []byte(me.words[me.nextWordIdx()])
}
func (me *ReaderEx) nextString() string {
	return me.words[me.nextWordIdx()]
}

type StringArray []string

func (me *ReaderEx) nextStringArray() StringArray {
	return me.words[me.nextWordIdx():]
}

func (me StringArray) toStrings() []string {
	return me
}

func (me StringArray) toInts() []int {
	strValues := me.toStrings()
	values := make([]int, len(strValues))
	for i, v := range strValues {
		n, err := strconv.Atoi(v)
		if err != nil {
			panic(err)
		}
		values[i] = n
	}
	return values
}
func (me *ReaderEx) nextInt() int {
	n, err := strconv.Atoi(me.words[me.nextWordIdx()])

	defer func() {
		if err != nil {
			panic(fmt.Sprintf("getInt(%d)", n))
		}
	}()
	return n
}

func pow(x, y, mod int) (ans int) {

	ans = 1
	for bit := 1 << uint(math.Floor(math.Log2(float64(y)))); ; bit >>= 1 {
		if y&bit != 0 {
			ans *= x
			if mod > 0 {
				ans %= mod
			}
		}
		if bit <= 1 {
			return
		}
		ans *= ans
		if mod > 0 {
			ans %= mod
		}
	}
}

type factType struct {
	prime int
	count int
}

func fact(n int) (facts []*factType) {

	for i := 2; i*i <= n; i++ {
		if n%i == 0 {
			fa := factType{prime: i}
			for n%fa.prime == 0 {
				n /= fa.prime
				fa.count++
			}
			facts = append(facts, &fa)
		}
	}
	if n > 1 {
		facts = append(facts, &factType{prime: n, count: 1})
	}
	return facts
}
func dec2bin(n int) (ret []bool) {
	for bit := 1 << uint(math.Floor(math.Log2(float64(n)))); ; bit >>= 1 {
		ret = append(ret, n&bit != 0)

		if bit <= 1 {
			return
		}
	}

}

func abs(v int) int {
	if v < 0 {
		v = -v
	}
	return v
}

func b2i(b bool) (i int) {
	if b {
		i = 1
	} else {
		i = 0
	}
	return
}

func solve(stdin io.Reader, stdout io.Writer) {

	r := NewScannerEx(stdin)
	r.Scan(true)
	n, k, q := r.nextInt(), r.nextInt(), r.nextInt()
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = k
	}
	for i := 0; i < q; i++ {
		r.Scan(false)
		a[r.nextInt()-1]++
	}

	for i := range a {
		fmt.Fprintln(stdout, []string{"No", "Yes"}[b2i(a[i]-q > 0)])
	}
}


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

int main() {
  int A;
  cin >> A;
  int B = A;
  int n = 0;
  while (A  > 0) {
    n += A%10;
  	A /= 10; 
  }
  if (B % n == 0) {
  	cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> >vvi;
const ll MOD=1000000007LL;
int main(){
  ll n,a,b,c,d,e;
  cin>>n>>a>>b>>c>>d>>e;
  cout<<5+(n-1)/min({a,b,c,d,e})<<endl;
}

Measured memory_bytes: 256
s = input()
keyence = 'keyence'

if s[:len(keyence)] == keyence:
    print('YES')
    exit(0)

for i in range(len(keyence) + 1):
    head, tail = keyence[:i], keyence[-(len(keyence) - i):]
    s_head, s_tail = s[:i], s[-(len(keyence) - i):]
    if head == s_head and tail == s_tail:
        print('YES')
        exit(0)

#print('YES')
print('NO')


Measured memory_bytes: 3060
var testCase: Int = Int(readLine()!)!
var ac: Int = 0
var wa: Int = 0
var tle: Int = 0
var re: Int = 0

for i in 1...testCase {
    var resultCode: String = readLine()!
    
    switch resultCode {
    case "AC":
        ac += 1
    case "WA":
        wa += 1
    case "TLE":
        tle += 1
    case "RE":
        re += 1
    default:
        continue
    }
}

print("AC x " + String(ac))
print("WA x " + String(wa))
print("TLE x " + String(tle))
print("RE x " + String(re))

Measured memory_bytes: 7876
#include <stdio.h>

int main(void){
    int S;
    scanf("%d",&S);
    int a=S/100, b=S%100;
    if(1<=a && a<=12){
        if(1<=b && b<=12) printf("AMBIGUOUS\n");
        else printf("MMYY\n");
    }
    else if(1<=b && b<=12) printf("YYMM\n");
    else printf("NA\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define NMAX 300001
using namespace std;
 
typedef long long ll;
map<ll,ll> pos;
ll v[NMAX],sortedv[NMAX];
int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,i,nr=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>v[i];
        pos[v[i]]=i;
        sortedv[i]=v[i];
    }
    sort(sortedv,sortedv+n);
    for(i=0;i<n;i++){
        if((pos[sortedv[i]]^i)&1)
            nr++;
    }
    cout<<nr/2;
    return 0;
}

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

int main (){
int x,a,b,xa,xb;
cin >> x >> a >> b;
xa = abs(x-a);
xb = abs(x-b);
if(xa >= xb)cout << "B" << endl;
else cout << "A" << endl;

}
    


Measured memory_bytes: 256
// abc153_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    ll H, N;
    cin >> H >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    ll sm = accumulate(ALL(A), 0);
    if (sm >= H){
        print("Yes");
    } else {
        print("No");
    }


    return 0;
}


Measured memory_bytes: 1024
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro with-output-buffer (&body body)
  "Buffers all outputs to *STANDARD-OUTPUT* and flushes them to
*STANDARD-OUTPUT* at the end. Note that only BASE-CHAR is allowed."
  (let ((out (gensym)))
    `(let ((,out (make-string-output-stream :element-type 'base-char)))
       (let ((*standard-output* ,out))
         ,@body)
       (write-string (get-output-stream-string ,out)))))

(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body
(defun main ()
  (declare #.OPT)
  (let* ((m (read))
         (k (read))
         (len (expt 2 (+ m 1)))
         (res (make-array len :element-type 'uint32)))
    (declare (uint32 k)
             ((integer 0 17) m))
    (with-output-buffer
      (cond ((zerop k)
             (dotimes (i len (terpri))
               (unless (zerop i) (write-char #\ ))
               (write (floor i 2))))
            ((= k (loop with res of-type uint32 = 0
                        for i from 0 below (expt 2 m)
                        unless (= i k)
                        do (setf res (logxor res i))
                        finally (return res)))
             (let ((index 0))
               (dotimes (num (expt 2 m))
                 (if (= num k)
                     (progn (setf (aref res (- (expt 2 m) 1)) num)
                            (setf (aref res (- len 1)) num))
                     (progn
                       (setf (aref res index) num)
                       (setf (aref res (- len 2 index)) num)
                       (incf index)))))
             (loop with init = t
                   for c across res
                   do (if init
                          (setq init nil)
                          (write-char #\ ))
                      (princ c))
             (terpri))
            (t (println -1))))))

#-swank(main)


Measured memory_bytes: 22504