akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <unordered_set>

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1; i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979323846

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;

//==============================================
#define NIL -2000000050

struct node {
	int key;
	int left = NIL;
	int right = NIL;
};

node T[500050];

void insert(int z) {
	int y = NIL;
	int x = 0;

	if (z == 0) return;

	while (x != NIL) {
		y = x;
		if (T[z].key < T[x].key) {
			x = T[x].left;
		} else {
			x = T[x].right;
		}
	}

	if (T[z].key < T[y].key) {
		T[y].left = z;
	} else {
		T[y].right = z;
	}
}

int find(int x, int k) {
	while (x != NIL && k != T[x].key) {
		if (k < T[x].key) {
			x = T[x].left;
		} else {
			x = T[x].right;
		}
	}

	return x;
}

void inorder(int x) {
	if (x == NIL) return;
	inorder(T[x].left);
	cout << " " << T[x].key;
	inorder(T[x].right);
}

void preorder(int x) {
	if (x == NIL) return;
	cout << " " << T[x].key;
	preorder(T[x].left);
	preorder(T[x].right);
}


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

	int n;
	cin >> n;

	string s;
	int v;
	REP(i, n) {
		cin >> s;

		if (s == "insert") {
			cin >> v;
			T[i].key = v;
			insert(i);
		} else if (s == "find"){
			cin >> v;
			if (find(0, v) != NIL) {
				cout << "yes" << "\n";
			} else {
				cout << "no" << "\n";
			}
		} else {
			inorder(0);
			cout << "\n";
			preorder(0);
			cout << "\n";
		}
	}
	return 0;
}

Measured memory_bytes: 9084
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;
#define int ll
using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;

typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<int> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;

void solve() {
    vector<char> s(3);
    cin >> s;
    if (count(all(s), '7')) put("Yes");
    else put("No");
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

//    freopen("input.txt", "r", stdin);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}

Measured memory_bytes: 3036
fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => {
            get().parse::<$t>().unwrap()
        };
        () => {
            get!(i64)
        };
    }

    let x = get!();
    println!("{}", (x / 500) * 1000 + (x % 500 / 5) * 5);
}


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

using namespace std;

int main(){

  int a,b,c;

  cin >> a >> b >> c;

  int S = a * b;

  if(a < b)swap(a,b);

  while(b){

    int temp = a;

    a = b;

    b = temp % b;

  }

  cout << (S / (a * a)) * c << endl;

  return 0;

}

Measured memory_bytes: 3116
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main()
{
	string s;
	string ans;
	cin >> s;
	int i;
	for (i = 0; i < (int)s.length(); i++){
		if (s[i] == '0'){
			ans += '0';
		}
		else if (s[i] == '1'){
			ans += '1';
		}
		else{
			if(!ans.empty())
				ans.pop_back();
		}
	}
	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	_, K := getStdinInt2()
	p := getStdinIntArr()

	sort.Ints(p)

	sum := 0
	for i := 0; i < K; i++ {
		sum += p[i]
	}

	fmt.Printf("%d\n", sum)
}

var sc = bufio.NewReaderSize(os.Stdin, 1024*1024*10)

func getStdin() string {
	return readLine()
}
func getStdinInt2() (int, int) {
	list := getStdinIntArr()
	return list[0], list[1]
}
func getStdinIntArr() []int {
	str := getStdin()
	list := strings.Split(str, " ")
	rtn := make([]int, len(list))
	for idx, val := range list {
		rtn[idx], _ = strconv.Atoi(val)
	}
	return rtn
}
func readLine() string {
	buf := make([]byte, 0, 0)
	for {
		l, p, _ := sc.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}


Measured memory_bytes: 2204
import java.util.*;
     
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i = 1;
    do{
      int x = i;
      if(x%3==0){
        System.out.printf(" %d",i);
        continue;
      }
      do{
        if(x%10==3){
          System.out.printf(" %d",i);
          break;
        }
        x/=10;
      }while(x>0);
    }while(++i<=n);
    System.out.printf("\n");
  }
}

Measured memory_bytes: 41180
n=int(input())
d=[int(input()) for i in range(n)]
e=[]

d.sort()
d.append(0)
e.append(d[1])
for i in range(len(d)-1):
    if int(d[i])<int(d[i+1]):
        e.append(d[i+1])
print(len(e))


Measured memory_bytes: 3060
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, a, n) for (ll i = a; i < (ll)(n); ++i)
#define repr(i, a, n) for (ll i = n - 1; (ll)a <= i; --i)
#define ENDL '\n'
typedef pair<int, int> Pi;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 + 99);
const vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T, typename U>
inline bool chmin(T &t, const U &u)
{
  if (t > u)
  {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T, typename U>
inline bool chmax(T &t, const U &u)
{
  if (t < u)
  {
    t = u;
    return 1;
  }
  return 0;
}
template <typename T>
inline T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T, typename Y>
inline T mpow(T a, Y n)
{
  T res = 1;
  for (; n; n >>= 1)
  {
    if (n & 1)
      res = res * a;
    a = a * a;
  }
  return res;
}

V<ll> v;

ll cont(ll mid)
{
  ll cnt = 0;

  rep(i, 0, siz(v))
  {
    //ok2:積がmid以下の数で最大のindex
    if (v[i] >= 0)
    {
      ll ok2 = i, ng2 = siz(v), m2;
      while (abs(ok2 - ng2) > 1)
      {
        m2 = (ok2 + ng2) / 2;

        if (v[i] * v[m2] > mid)
        {
          ng2 = m2;
        }
        else
        {
          ok2 = m2;
        }
      }
      cnt += ok2 - i;
    }
    else
    {
      ll ok2 = siz(v), ng2 = i, m2;
      //ok2:積がmid以下の数で最小のindex

      while (abs(ok2 - ng2) > 1)
      {
        m2 = (ok2 + ng2) / 2;

        if (v[i] * v[m2] > mid)
        {
          ng2 = m2;
        }
        else
        {
          ok2 = m2;
        }
      }
      cnt += siz(v) - ok2;
    }

    //cerr<<i<<" "<<cnt<<ENDL;
  }
  return cnt;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  ll n, k;
  cin >> n >> k;
  v.resize(n);
  rep(i, 0, n)
  {
    cin >> v[i];
  }

  sort(all(v));
  ll ok = LINF, ng = -LINF, mid;
  //ok:ok以下がk以上の最小
  while (abs(ok - ng) > 1)
  {
    mid = (ok + ng) / 2;
    ll cnt = 0;

    cnt = cont(mid);//積がmid以下の数

    if (cnt >= k)
      ok = mid;
    else
      ng = mid;
  }
  cout << ok  << ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 1792
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x) ;
#define LINE 	;
#define dumpV(v);
#define STOP 	;
#endif
#define mp make_pair

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


ll f(ll b, ll n) {
	if(n < b) return n;
	return f(b, n/b) + n%b;
}

int main(){
	ll n, s;
	cin >> n >> s;
	if(s == n) {
		cout << n+1 << endl;
		return 0;
	}
	REP(i, 2, 1e6+10) {
		if(f(i, n) == s) {
			cout << i << endl;
			return 0;
		}
	}
	ll ans = 1e18;
	REP(p, 1, 1e6+10) {
		ll b = (n - s) / p + 1;
		if(b <= 1) continue;
		if(f(b, n) == s) ans = min(ans, b);
	}
	cout << (ans == 1e18?-1:ans) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=((ll)n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=((ll)a);i<((ll)n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
struct UnionFind{
    vl par,dist;
    UnionFind(int x){par.assign(x,-1); dist.assign(x,0);}
    ll find(ll x){return par[x]<0?x:find(par[x]);}
    ll depth(ll x){return par[x]<0?0:depth(par[x])+dist[x];}
    bool same(ll x,ll y){return find(x)==find(y);}
    ll size(ll x){return -par[find(x)];}
    ll diff(ll x,ll y){return same(x,y)?depth(x)-depth(y):LINF;}
    void unite(ll x,ll y,ll k=0){
        k+=depth(y); k-=depth(x); k=-k;
        x=find(x); y=find(y);
        if(x==y)return;
        if(size(x)<size(y)){swap(x,y);k=-k;}
        par[x]+=par[y]; par[y]=x; dist[y]=k;
    }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vl d(n);cin>>d;
    vl val(n,0);
    vvl edge(n);
    ll ans=0;
    rep(i,m){
        ll s,t;
        cin>>s>>t;
        s--; t--;
        chmax(val[s],d[t]);
        chmax(val[t],d[s]);
    }
    rep(i,n){
        if(d[i]>val[i])ans++;
    }
    puta(ans);
    return 0;
}

Measured memory_bytes: 7156
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

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

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    ll ans = 0;
    rep (i, 1, n + 1) {
        ll j = n / i;
        ans += ((ll)i + (ll)(j * i)) * j / 2;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
using namespace std;
 
long long gcd(long long a, long long b) {
	if(a == 0) return b;
	return gcd(b % a, a);
} 
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long n, x;
	cin >> n >> x;
	long long a = max(x, n - x), b = min(x, n - x);
	if(a % b == 0 or b % a == 0) cout << a / b * b * 2 + a << endl;
	else {
		long long ans = n;
		long long d = gcd(a, b);
		a /= d;
		b /= d;
		ans /= d;
		while(b) {
			ans += a / b * b * 2;
			a %= b;
			swap(a, b);
		}
		cout << ans * d - d << endl;
	}
	return 0;
}

Measured memory_bytes: 3604
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

int main()
{
	int n, k;
	cin >> n >> k;

	vector<int> a(n);

	for (int i = 0; i < n; i++)
	{
		cin >> a.at(i);
	}

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

	cout << accumulate(a.begin(), a.begin() + k, 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second
#define NIL -1
using ll = long long;
const ll MOD = 1000000007;
#define REP(i,n) for (ll i=0; i < (n); ++i)
#define FOR(i,a,b) for (ll i=(a); i < (b); ++i)
using namespace std;

int get_gcd(int a, int b){while(1){if (a < b) swap(a, b); if (b == 0) return a; a %= b;}}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

  int n;
  cin >> n;

  cout << pow(n,3) << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        short a = Short.parseShort(sc.next());
        short b = Short.parseShort(sc.next());
        if((a*b) % 2 == 0)
            System.out.println("Even");
        else
            System.out.println("Odd");
    }
}


Measured memory_bytes: 35608
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
// Debug Output https://qiita.com/ysuzuki19/items/d89057d65284ba1a16ac
#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); } }

// Problem https://atcoder.jp/contests/agc027/tasks/agc027_a
// Reference1 https://img.atcoder.jp/agc027/editorial.pdf
// Reference2(myself pythoncode) https://atcoder.jp/contests/agc027/submissions/3891295
int solver(int childN,int haveCandy,vector<int> childS){
    int result=0;
    bool handedFlag = true;
    sort(childS.begin(),childS.end());
//    debug(childS);
    int childC = 0 ;
    for(int j=0;j<childN;j++){
        haveCandy = haveCandy - childS.at(j);
        if(0 <= haveCandy){
            result = result + 1;
//            debug(result);
        }
        else
        {
            break;
        }
    }
    if( 0 < haveCandy) // 全員に配ってもまだ余る場合→残りの一人に押しつける→満足減少
        {
 //           debug("Amarunode osituke");
            result = result - 1;
        }
    return result;
}
int main(void){
    int N,x;
    int answer=0;
    cin >> N >> x ;
    vector<int> a(N);
    for(int j=0;j<N;j++){
        cin >> a.at(j);
    }
    answer = solver(N,x,a);
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <chrono>
#include <stack>
#include <string>
#include <bitset>
#include <unordered_map>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <tuple>
#include <iomanip>
#include <random>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <numeric>

using namespace std;

int u[111];

typedef long long ll;
const int maxn = (int) 1e5 + 1;
const int inf = (int)1e9+7;


int a[maxn], b[111];

int cnt[maxn];

string s, t;

int ans = 0, sum1, sum2, sum3;

int n, k;

int dp[maxn];

vector < int > v;

bool isprime(int x){
    if(x < 100){
        return 0;
    }
    for(int i = 2; i <= sqrt(x); i++){
        if(x % i == 0)
            return 0;
    }
    return 1;
}

int now = 0;

int GCD(int u, int v) {
    while ( v != 0) {
        int r = u % v;
        u = v;
        v = r;
    }
    return u;
}
int main(){
    cin >> n;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        a[x] = i;
    }
    for(int i = 1; i <= n; i++){
        cout << a[i] << " ";
    }
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define REPE(i, a, b) for (int i = (a); i <= int(b); ++i)
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
#define PB push_back
#define EB emplace_back
using LL = long long;
using PII = pair<int, int>;
#define F first
#define S second
void R(int &x) { scanf("%d", &x); }
void R(LL &x) { scanf("%lld", &x); }
void R(double &x) { scanf("%lf", &x); }
template <typename T> void R(T &t) { cin >> t; }
template <typename T> void R(vector<T> &ar) {
  for (auto &it : ar)
    R(it);
}
template <typename T, typename... Args> void R(T &t, Args &... args) {
  R(t);
  R(args...);
}

int main() {
  int n, k;
  R(n, k);
  unordered_map<int, int> m;
  REP(i, n) {
    int x;
    R(x);
    m[x]++;
  }
  vector<int> a;
  for (auto &it : m) a.PB(it.S);
  sort(ALL(a), greater<int>());
  int sum = 0;
  for (int i = k; i < SZ(a); ++i)
    sum += a[i];
  printf("%d\n", sum);
  return 0;
}



Measured memory_bytes: 10312
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int h=0,x=0,ans=0,a=0;
  scanf("%d %d",&h,&x);
  ans=h/x;
  if (h%x!=0) {
    ans++;
  }
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {
    ll A,B,C;
    cin >> A >> B >> C;
    if(A%2==0 || B%2==0 || C%2==0) cout << 0 << endl;
    else cout << min(A*B,min(A*C,B*C)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#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()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ll> A(N), B(N), sub(N);
  rep(i, N) cin >> A[i];
  rep(i, N) {
    cin >> B[i];
    sub[i] = B[i]-A[i];
  }
  sort(all(sub));
  ll cur = 0;
  rep(i, N) {
    if(sub[i] < 0) {
      cur += -sub[i];
    } else {
      cur -= min(sub[i]/2, cur);
    }
  }
  cout << (cur == 0 ? "Yes" : "No") << "\n";
  return 0;
}


Measured memory_bytes: 3780
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
st = []
res = [0] * N
for _ in range(N):
  a, b = map(int, input().split())
  st.append((a, b))
cp = []
for _ in range(M):
  a, b = map(int, input().split())
  cp.append((a, b))
for i in range(N):
  a, b = st[i]
  for j in range(M):
    c, d = cp[j]
    x, y = cp[res[i]]
    if abs(c - a) + abs(d - b) < abs(x - a) + abs(y - b):
      res[i] = j
  res[i] += 1
for r in res: print(r)


Measured memory_bytes: 39408
import math

n = int(input())
x = list(map(int, input().split()))
p1 = math.floor(sum(x) / n)
p2 = math.ceil(sum(x) / n)

result1 = 0
result2 = 0
for i in x:
  result1 += ((i - p1) * (i - p1))
  result2 += ((i - p2) * (i - p2))

if result1 <= result2:
  print(result1)
else:
  print(result2)
  

Measured memory_bytes: 3060
#include <iostream>
#define MOD 1000000007
using namespace std;
long long a,b,t1=1,t2=1,dif;
int main()
{
    cin>>a>>b;
    dif=a-b;
    if(dif<0) dif=-dif;
    if(dif>1) {cout<<0;return 0;}
    for(int i=2;i<=a;++i)
    {
        t1=t1*i;
        if(t1>MOD) t1=t1%MOD;
    }
    for(int i=2;i<=b;++i)
    {
        t2=t2*i;
        if(t2>MOD) t2=t2%MOD;
    }
    long long sol;
    sol=t1*t2;
    sol=sol%MOD;
    if(a==b) sol=(sol*2)%MOD;
    cout<<sol;
    return 0;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
s = input()
s = list(map(int, s))

v = []
now = 1  # 現在見ている数
cnt = 0  # nowが並ぶ数
for ss in s:
    if ss == now:
        cnt += 1
    else:
        v.append(cnt)
        now = 1 - now  # 0と1を切り替える計算 now ^= 1
        cnt = 1  # ss分を計上
if cnt > 0:
    v.append(cnt)
# 1-0-1-0-1-0-1のように
# 1で終わる配列が欲しい
# 1-0-1-0のように0で終わっていたら、1を足す

# ※1の人数-0の人数-...の配列

if len(v) % 2 == 0: v.append(0)
# 1が0個という項を追加して、
# 1-0-1-0-1にする

add = 2 * K + 1

c_sum = [0]
for vv in v:
    c_sum.append(c_sum[-1] + vv)
# print(v, c_sum)

# 1-0-1-...の1から始めるので、偶数番目だけ見る
lv = len(v)
ans = 0
for i in range(0, lv, 2):
    ans = max(ans, c_sum[min(lv, 2 * K + 1 + i)] - c_sum[i])
print(ans)


Measured memory_bytes: 8608
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		for (int i = n-1; i >= 0; i--) {
			System.out.print(a[i]);
			if (i > 0) {
				System.out.print(" ");
			}
		}
	System.out.println("");
	}

}

Measured memory_bytes: 26264
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
const int mod = 1000000007;

// auto mod int
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
      if ((x += a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator-=(const mint a) {
      if ((x += mod-a.x) >= mod) x -= mod;
      return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
      if (!t) return 1;
      mint a = pow(t>>1);
      a *= a;
      if (t&1) a *= *this;
      return a;
    }
  
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
  };
  istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
  ostream& operator<<(ostream& os, const mint& a) { return os << a.x;} 
  
  mint choose(int a, int b){
      //aCb
      mint x = 1, y = 1;
      for (int i = 1; i <= b; i++) {
          x *= (a - i + 1);
          y *= i;
      }
      return x / y;
  }


int main(){
    int m, n;
    cin >> m >> n;
    mint ans = mint (m).pow(n);

    cout << ans << endl;

    return 0;
}


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

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

const long long INF = 1LL << 60;

// 入力
int N;
long long h[100010];

// DP テーブル
long long dp[100010];

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

    // 初期化 (最小化問題なので INF に初期化)
    for (int i = 0; i < 100010; ++i) dp[i] = INF;

    // 初期条件
    dp[0] = 0;

    // ループ
    for(int i=1; i<N; i++){
        chmin(dp[i],dp[i-1]+abs(h[i]-h[i-1]));
        if(i==1)continue;
        chmin(dp[i],dp[i-2]+abs(h[i]-h[i-2]));
    }
    
    // 答え
    cout<<dp[N-1]<<endl;
}

Measured memory_bytes: 1792
s = int(input())
A = []
A.append(s)

for n in range(1,1000001):
    if A[-1] % 2 == 0:
        A.append(int(A[-1]/2))
    else:
        A.append(int(A[-1]*3+1))
    if A[n] in A[:n]:
        print(n+1)
        break


Measured memory_bytes: 2940
import java.util.*;
import java.awt.*;
import static java.lang.System.*;
import static java.lang.Math.*;
//Loopで使う文字列の長さは固定！
//intで大丈夫？オーバーフローしない？
//Loop回数は本当に10⁹以内になってる？Loopは回る？？
public class Main {
    public static void main(String[]$){
        Scanner sc = new Scanner(in);
        int n=sc.nextInt();
        int d=sc.nextInt();
        int x=sc.nextInt();
        int[] a=new int[n];
        for (int i = 0; i < n; i++) {
            a[i]=sc.nextInt();
        }
        int ans=x;
        for (int i = 0; i < n; i++) {
            int j=0;
            while(a[i]*j+1<=d){
                j++;
                ans++;
            }
        }
        out.println(ans);
    }
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

struct Edge {
    ll to, fee, time;
    Edge(){}
    Edge(ll to, ll fee, ll time):to(to),fee(fee),time(time){}
};

typedef pair<P, ll> T;

int main(int argc, char const *argv[]) {
    ll n,m,s; cin>>n>>m>>s;
    vector<ll> a(m),b(m),c(n),d(n);
    vector<vector<Edge>> g(n);
    rep(i,m) {
        int x,y; cin>>x>>y>>a[i]>>b[i];
        --x,--y;
        g[x].emplace_back(y,a[i],b[i]);
        g[y].emplace_back(x,a[i],b[i]);
    }

    rep(i,n) cin>>c[i]>>d[i];
    vector<vector<ll>> dp(n, vector<ll>(5010, LINF));
    priority_queue<T, vector<T>, greater<T>> pq;
    s = min(5000ll,s);
    dp[0][s] = 0;
    pq.emplace(P(0,s),0);

    while (!pq.empty()) {
        T cur = pq.top(); pq.pop();
        ll ct = cur.first.first;
        ll cm = cur.first.second;
        ll cv = cur.second;
        //cout << "ct = " << ct << '\n';
        //cout << "cm = " << cm << '\n';
        //cout << "cv = " <<cv << '\n';
        if (ct != dp[cv][cm]) continue;

        // 鉄道で移動する
        for (auto &&e: g[cv]) {
            ll nv = e.to;
            if (cm >= e.fee) {
                //cout << "nv = " << nv << '\n';
                ll nt = dp[cv][cm];
                ll nm = cm;
                nt += e.time; nm -= e.fee;
                if (chmin(dp[nv][nm], nt)) {
                    pq.emplace(P(dp[nv][nm], nm), nv);
                }
            }
        }

        // 銀貨を補充する
        ll nv = cv;
        ll nm = cm+c[cv];
        ll nt = ct+d[cv];
        if (nm > 5000) continue;
        if (chmin(dp[nv][nm], nt)) {
            pq.emplace(P(dp[nv][nm], nm), nv);
        }
    }

    for (int i = 1; i < n; ++i) {
        ll ans = LINF;
        for (auto &&e: dp[i]) chmin(ans,e);
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 11356
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
  long long int n,i,j;
  scanf("%lld",&n);
  long long int a[n+1];
  long long int b[n];
  for(i=0;i<n+1;i++) {
    scanf("%lld",&a[i]);
  }
  for(i=0;i<n;i++) {
    scanf("%lld",&b[i]);
  }
  long long int total = 0;
  long long int temp = 0;
  for(i=0;i<n;i++) {
    if(b[i] > a[i]) {
      temp = a[i];
    } else {
      temp = b[i];
    }
    a[i] -= temp;
    b[i] -= temp;
    total += temp;

    if(b[i] > a[i+1]) {
      temp = a[i+1];
    } else {
      temp = b[i];
    }
    a[i+1] -= temp;
    b[i] -= temp;
    total += temp;
  }
  printf("%lld\n",total);
  return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <map>
using namespace std;
typedef unsigned long long ull;
const int MAXN = 26 + 8;
const ull p = 1e12 + 7;             //!

struct HASH{
    ull Hash[MAXN], xp[MAXN];
    void inithash(){
        memset(Hash, 0, sizeof Hash);
    }
    void init1(int sz){
        xp[0] = 1;
        for(int i = 1; i <= sz; i++) xp[i] = xp[i-1] * p;
    }
    void init2(int *s){//0~n-1 based
        int sz = 26;
        Hash[sz] = 0;
        for(int i = sz - 1; i >= 0; i--){
            Hash[i] = Hash[i+1] * p + (s[i] - '0' + 1);
        }
    }
    ull get_Hash(const int& st, const int& len){
        return Hash[st] - Hash[st + len] * xp[len];
    }

} hh;

string s1, s2;
int ch[26], sz1, sz2;
map<ull, bool> mp;
inline bool check(int x){
    mp.clear();
    int i, j;
    for(i = 0; i < 26; i++) ch[i] = 0;

    for(i = 0; i < x; i++){
        ch[s1[i] - 'a']++;
    }
    hh.inithash();
    hh.init2(ch);
    mp[hh.get_Hash(0, 26)] = true;
    for(i = x; i < sz1; i++){
        ch[s1[i] - 'a']++;
        ch[s1[i-x] - 'a']--;
        hh.inithash();
        hh.init2(ch);
        mp[hh.get_Hash(0, 26)] = true;
    }
    //
    for(i = 0; i < 26; i++) ch[i] = 0;

    for(i = 0; i < x; i++){
        ch[s2[i] - 'a']++;
    }
    hh.inithash();
    hh.init2(ch);
    if(mp.find(hh.get_Hash(0, 26)) != mp.end()) return true;
    for(i = x; i < sz2; i++){
        ch[s2[i] - 'a']++;
        ch[s2[i-x] - 'a']--;
        hh.inithash();
        hh.init2(ch);
        if(mp.find(hh.get_Hash(0, 26)) != mp.end()) return true;
    }
    return false;
}

int main()
{
    #ifdef LOCAL
    freopen("d.txt", "r", stdin);
    //freopen("d.out", "w", stdout);
    int T = 4;
    while(T--){
    #endif // LOCAL
    ios::sync_with_stdio(false); cin.tie(0);


    cin >> s1 >> s2;
    sz1 = s1.size(), sz2 = s2.size();
    hh.init1(30);
    int ans = 0, i;
    for(i = min(sz1 , sz2); i >= 1; i--){
        if(check(i)){
            ans = i;
            break;
        }
    }
    cout << ans << "\n";



    #ifdef LOCAL
    cout << endl;
    }
    #endif // LOCAL
    return 0;
}

Measured memory_bytes: 3496
D = []
for i in range (5):
  D.append(int(input()))
D.reverse()
k = int(input())

for i in range(len(D) - 1):
  for j in range(i + 1, len(D)):
    if D[i] - D[j] > k:
      # print("Di" + str(D[i]))
      # print("Dj" + str(D[j]))
      print(":(")
      exit()
print("Yay!")

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

int main() {
	int N, ans;

	cin >> N;

	vector<int> vec(N);

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

 	 int loop=1;
 	 ans=0;

 	 while(loop){
 		 for(int i=0; i<N; i++){
 			if(vec[i] & 1){
 				loop=0;
 				break;
 			}
  			vec[i] /= 2;
 		 }
 		 if(loop)
 			 ans +=1;
 	 }

 	 cout << ans << endl;
}


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

using namespace std;

#define endl '\n'

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;

const double eps = 1e-9;
const int oo = 0x3f3f3f3f;
const int mod = 1000000007;

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

    int64 s; cin >> s;

    int64 x2 = min(1000000000LL, s);
    int64 y3 = (s + x2 - 1) / x2;

    int64 r = x2 * y3 - s;

    int64 y2 = r;
    int64 x3 = 1;

    cout << 0 << " " << 0 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;

    return 0;
}

Measured memory_bytes: 256
import sys
import collections

n = int(input())

v = list(map(int, input().split()))

v_odd = v[1::2]
v_even = v[0::2]
c_odd = collections.Counter(v_odd)
c_even = collections.Counter(v_even)

if c_odd.most_common()[0][0] != c_even.most_common()[0][0]:
    print(n - c_odd.most_common()[0][1] - c_even.most_common()[0][1])
else:
    if len(c_even.most_common()) == 1:
        print(n - c_odd.most_common()[0][1])
    elif len(c_odd.most_common()) == 1:
        print(n - c_even.most_common()[0][1])
    else:
        print(min(n - c_odd.most_common()[0][1] - c_even.most_common()[1][1],
                  n - c_odd.most_common()[1][1] - c_even.most_common()[0][1]))





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

class E
{
	static void Main()
	{
		var h = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int n = h[0], k = h[1], c = h[2];
		var s = Console.ReadLine().ToArray();

		int First(int start) => Enumerable.Range(start, n).First(i => s[i] == 'o');
		int[] Days()
		{
			var t = -c - 1;
			return new int[k].Select(_ => t = First(t + c + 1)).ToArray();
		}

		var d1 = Days();
		Array.Reverse(s);
		var d2 = Days();

		Console.WriteLine(string.Join("\n", Enumerable.Range(0, k).Where(i => d1[i] == n - 1 - d2[k - 1 - i]).Select(i => d1[i] + 1)));
	}
}


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


int main()
{
    int a[34];
    a[1]=2;
    a[0]=1;
    double g[34];
    g[1]=0.5;
    for(int i=2; i<20; i++)
    {
        a[i] = a[i-1] * 2;
        g[i] = g[i-1] / 2;
    }
    int n,m;
    scanf("%d%d",&n,&m);
    double x,y,ans=0;
    for(int i=1; i<=n; i++)
    {
        if(i>=m)
            ans=ans+1;
        else
        {
            for(int j=1; j<20; j++)
            {
                if(i*a[j]>=m)
                {
                    ans=ans+g[j];
                    break;
                }
            }
        }

    }
    ans = ans/(1.0*n);
    printf("%.12f\n",ans);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define all(x) (x).begin(),(x).end()
#define rep(i, a, b, c) for(int i=(a); i<=(b); i+=(c))
#define rep(i,a,b) for (int i=(a); i<=(b); ++i)
#define rep_it(it,x) for (__typeof((x).begin()) it=(x).begin(); it!=(x).end(); it++)
#define debug(x) cout<< #x << " => " << (x) << endl
#define debug_pair(x) cout<<"\n{ "<<(x).fir<<" , "<<(x).sec<<" }\n"
#define debug_arr(x,n) cout<<#x<<":\n"; rep(i,0,n) cout<<#x<<"["<<(i)<<"] => "<<x[i]<<endl
#define ms(a, b) memset(a, b, sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
const int inf = 0x3f3f3f3f;
const double PI=acos(-1);
const double eps=1e-9;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b)*b; }
int qpow(int a, int b, int mod){int res=1, base=a%mod;while(b){if(b&1)res*=base;base*=base;b>>=1;}return res;}
ll qpow(ll a, ll b, ll mod){ll res=1, base=a%mod;while(b){if(b&1)res*=base;base*=base;b>>=1;}return res;}
void file_put() {
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
}
const int maxn = 1e6+5;

int n, m;
string s;
int main() {
	cin >> s;
	if(s.length()<4) {
		cout <<"No\n";
		return 0;
	}
	if(s[0]=='Y' && s[1]=='A' &&s[2]=='K' &&s[3]=='I'){
		cout <<"Yes\n";
	} else {
		cout <<"No\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

int main() {
  int N; cin >> N;
  deque<int> color;
  for(int i=0;i<N;++i) {
    int a; cin >> a;
    auto it = all(lower_bound, color, a);
    if (it == color.begin()) color.push_front(a);
    else *(it-1) = a;
  }
  cout << color.size() << endl;

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<list>
#include<deque>
#include<cmath>
#include<unordered_map>
#include<unordered_set>
#include<numeric>
using namespace std;

using ll = int64_t;

/// <summary>
/// 単純なcoutの時に使う
/// </summary>
#define co(a) cout<<a<<"\n"


/// <summary>
/// [beg, end)の範囲を，添え字indexでループするfor文に置換します
/// </summary>
#define rep(i,a) for(ll i=0; i<a; ++i)

/// <summary>
/// 迷路等で使う方向のベクトル
/// </summary>
const vector<ll> dx = { 0, 1, 0, -1 }, dy = { 1, 0, -1, 0 };

/// <summary>
/// デバッグ時に使う
/// </summary>
#define DEBUG(x)     std::cout << #x << " : " << x << "\n"


///////////////////////////////////////////////////////////////////////////

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

	ll N;
	cin >> N;

	vector<ll> d (N);

	rep (i, N) {
		cin >> d[i];
	}

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

	cout << d[N / 2] - d[(N / 2) - 1] << endl;
}

Measured memory_bytes: 1024
#include<algorithm>
#include<cstdio>
using namespace std;

const int N_MAX = 2e5;
int n;
long k;
int a[N_MAX], f[N_MAX];

bool cmp(long x) {
    long sum = 0;
    for (int i = 0; i < n; i++) {
        if (static_cast<long>(a[i]) * f[i] > x) {
            sum += a[i] - x / f[i];
        }
    }
    if (sum <= k) return true;
    return false;
}

int main() {
    scanf("%d %ld", &n, &k);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    for (int i = 0; i < n; i++) scanf("%d", &f[i]);
    sort(a, a + n);
    sort(f, f + n, [](const int &i1, const int &i2)->bool {
        return i1 > i2;
    });
    
    long lb = 0;
    long rb = 1e12;
    if (cmp(0)) rb = 0;
    while (true) {
        if (rb - lb <= 1) break;
        long mid = (lb + rb) / 2;
        if (cmp(mid)) rb = mid;
        else lb = mid;
    }

    printf("%ld\n", rb);
    return 0;
}



Measured memory_bytes: 1664
fun main(args: Array<String>){
    val (N, M) = readLine()!!.split(" ").map { it.toInt() }
    val A = Array(N){ readLine()!! }
    val B = Array(M){ readLine()!! }

    for(i in 0 until N - M + 1){
        for(j in 0 until N - M + 1){
            var f = true
            for(x in 0 until M){
                for(y in 0 until M){
                    f = f && A[i+x][j+y] == B[x][y]
                }
            }
            if(f){
                println("Yes")
                return
            }
        }
    }
    println("No")
}

Measured memory_bytes: 38116
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
typedef long long ll;
ll dis[N],a,b,n,low;
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
		scanf("%lld",&dis[i]);
	for(int i=2;i<=n;i++)
		low=low+min((dis[i]-dis[i-1])*a,b);
	cout<<low<<"\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
//int 2×10の9乗
 
int main() {
    int n, m;
    cin >> n >> m;
    vector<int> l(m), r(m);
    rep(i, m) cin >> l[i] >> r[i];
    sort(l.rbegin(), l.rend());
    sort(r.begin(), r.end());
    int max=l[0], min=r[0];
    if(min - max + 1 <= 0){
        cout << 0 << endl;
        return 0;
    }
    else cout << min-max+1 << endl; 
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100//000000000
#define MOD 1000000007
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<int, int>
#define PP pair<P,P>
#define T tuple<int,int,int> 
using namespace std;

int main(){
    string s; cin >> s;
    int sl=s.length();
    ll ans=((ll)sl*(ll)(sl-1))/2;
    map<char,int> m;
    rep(i,sl) m[s[i]]++;
    for(auto x : m) ans-=((ll)(x.second)*(ll)(x.second-1))/2;
    cout << ans+1 << endl;
return 0;
}

Measured memory_bytes: 3744
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int c[4][4],a[4][4],i,j;
  for(i=0;i<3;i++){
	for(j=0;j<3;j++){
		cin>>c[i][j];
    }
  }
  
  for(j=0;j<2;j++){
  	for(i=0;i<3;i++){
	  a[i][j]=c[i][j+1]-c[i][j];
    }
    if(a[0][j]!=a[1][j] ||a[1][j]!=a[2][j]){
		cout<<"No"<<endl;
    	return 0;
    }
  }
  
  for(j=0;j<2;j++){
  	for(i=0;i<3;i++){
	  a[j][i]=c[j+1][i]-c[j][i];
    }
    if(a[j][0]!=a[j][1] ||a[j][1]!=a[j][2]){
		cout<<"No"<<endl;
    	return 0;
    }
  }
  cout<<"Yes"<<endl;
}
    

    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}

auto great(vector<int>&v,int x){
    int idx = (int)(lower_bound(all(v),x) - v.begin());
    //cout << (idx < v.size() ? v[idx] - x : INF) << endl;
    return (idx < v.size() ? v[idx] : INF);
}
auto smaller(vector<int>&v,int x){
    int idx = (int)(lower_bound(all(v),x) - v.begin());
    //cout << (idx-1 >= 0 ? x - v[idx-1] : INF) << endl;
    return (idx-1 >= 0 ? v[idx-1] : -INF);
}
signed main(){
    int a,b,Q;
    cin >> a >> b >> Q;
    vector<int>s(a),t(b);
    for(auto & e : s) cin >> e;
    for(auto & e : t) cin >> e;
    rep(_,Q){
        int x; cin >> x;
        int tans = INF;
        // -----t---x------------s
        cmin(tans, great(s,x) - x + x - smaller(t,x) + min(great(s,x) - x, x - smaller(t,x)));
        // -----s---x------------t
        cmin(tans, great(t,x) - x + x - smaller(s,x) + min(great(t,x) - x , x - smaller(s,x)));
        
        cmin(tans,max(great(t, x),great(s, x)) - x);
        cmin(tans,max(x - smaller(t, x),x - smaller(s, x)));
        
        cout << tans << endl;
    }
}



Measured memory_bytes: 2944
#include<iostream>
using namespace std;
int main(){
  int n;
  cin >>n;
  while(n--){
    string a,b,c;
    int x = 0,y = 0;
    cin >>a>>b;
    int as = a.size(),bs = b.size();
    for(int i=0; i<as || i<bs; i++){
      if(i<as && i<bs) x = a[as-i-1]+b[bs-i-1]+y-'0'*2;
      else if(i<as) x = a[as-i-1]+y-'0';
      else if(i<bs) x = b[bs-i-1]+y-'0';
      y = x/10;
      x%=10;
      c+=x+'0';
    }
    if(y == 1) c+='1';
    if(c.size() > 80) cout <<"overflow"<<endl;
    else{
      for(int i=c.size()-1; i>=0; i--) cout <<c[i];
      cout <<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1204
r, D, x2000 = map(int,input().split())

x2001 = r*x2000 - D
x2002 = r*x2001 - D
x2003 = r*x2002 - D
x2004 = r*x2003 - D
x2005 = r*x2004 - D
x2006 = r*x2005 - D
x2007 = r*x2006 - D
x2008 = r*x2007 - D
x2009 = r*x2008 - D
x2010 = r*x2009 - D
print(x2001)
print(x2002)
print(x2003)
print(x2004)
print(x2005)
print(x2006)
print(x2007)
print(x2008)
print(x2009)
print(x2010)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double m,n,s;
  cin >> n >> m;
  s = 0;
  vector<int> data(n);
  for (int i = 0; i < n; i++) {
    cin >> data.at(i);
    s = s + data.at(i);
    }
  
  int answer = 0;
  double x;
  x = s / (4*m);
 
  for (int i = 0; i < n; i++) {
 
    if (data.at(i) >= x ) {
      answer++;
    }
  }
    if (answer >= m) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
}

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

int main() {
  int n, k, x, sum;
  cin >> n >> k;
  
  for (int i = 0; i < n; i++) {
    cin >> x;
    int a = x * 2;
    int b = (x - k) * 2;
    if (b < 0) {
      b *= -1;
    }
    
    if (a < b) {
      sum += a;      
    }
    else {
      sum += b;
    }
  }
  
  cout << sum << endl;
}

Measured memory_bytes: 256