akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i ,n) for(int i = 0 ; i < (n) ; i ++ )
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using vin=vector<int>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;

ll kaijo(ll x){
  if(x==1) return x=1; 
  return x%inf*kaijo(x-1)%inf;
}



int main() {
  ll n,k;
  cin>>n>>k;
  vin a(n),b(n);
  rep(i,n) cin>>a[i]>>b[i];
  /////
  map<ll,ll> mp;
  rep(i,n){
    mp[a[i]]+=b[i]; 
  }
  ll count=0;
  for(auto v:mp){
    count+=v.second;
    if(count>=k) {
      cout<<v.first<<endl;
      return 0;
    }
  }
  
  
  
  
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll X;
    cin >> X;
    ll ans = X/500*1000;
    X %= 500;
    ans += X/5*5;
    cout << ans << "\n";
}

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

typedef struct{
  int len;
  int val;
}Number ;

void dump(stack<Number> S){
  stack<Number> tmp;
  while(!S.empty()){
    tmp.push(S.top());
    S.pop();
  }
  
  cout <<"dump: " ;
  while(!tmp.empty()){
    Number top = tmp.top(); tmp.pop();
    assert(top.len > 0);
    for(int i = 0;i < top.len ;i++){
      cout << (char)('a' + top.val -1);
    }
    cout <<" ";
  }
  cout << endl;
}

void decrease(stack<Number>  & S, int current_length, int target_length){
  while(!S.empty() && current_length > target_length){
    Number top = S.top();
    if (current_length - top.len >= target_length){
      S.pop();
      current_length -= top.len;
    } else if (current_length - top.len < target_length){
      S.top().len = target_length - (current_length - S.top().len);
      break;
    }
  }
}

bool add(stack<Number> & S, const int length, const int lim){
  stack<Number> tmp_stack;
  while(!S.empty()){
    Number top = S.top();
    S.pop();
    if (top.val != lim){
      Number a = {top.len-1, top.val};
      Number b = {1        , top.val+1};
      if (a.len != 0){
	S.push(a);
      }
      S.push(b);
      while(!tmp_stack.empty()){
	Number tmp = tmp_stack.top();
	tmp_stack.pop();
	tmp.val = 1;
	S.push(tmp);
      }
      return true;
    } else if (top.val == lim){
      Number a = {top.len, top.val};
      tmp_stack.push(a);
    }
  }

  if (S.empty()){
    return false;
  }
  return true;
}

bool solve(const int lim, vector<int> & in){
  stack<Number> S;
  const int n = in.size();
  int length = in[0];
  S.push((Number){in[0], 1});
  for(int i = 1;i < n;i++){
    bool fg = true;
    //dump(S);
    if (length < in[i]){
      //cout <<"push" << endl;
      S.push((Number){in[i] - length, 1});
    } else if (length <= in[i]){

      fg = add(S, in[i], lim);
    } else if (in[i] < length){
      //cout <<"decrease add " << endl;
      decrease(S, length, in[i]);
      //dump(S);
      fg = add(S, in[i], lim);
    }
    if (!fg)return false;
    length = in[i];
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  vector<int> in(n);
  for(int i = 0;i < n;i++){
    cin >> in[i];
  }
  int l = 1, r = n;
  while(l < r){
    int mid = (l+r)/2;
    bool can_solve = solve(mid, in);
    if (can_solve){
      r = mid;
    } else {
      l = mid+1;
    }
  }
  cout << l << endl;
  return 0;
}


Measured memory_bytes: 2720
N = int(input())
from collections import Counter
S = [Counter(input()) for _ in range(N)]

x = S[0]
for i in range(1, N):
    x = x & S[i]

ans = []
for k, v in x.items():
    for i in range(v):
        ans.append(k)
ans = sorted(ans)
print("".join(ans))

Measured memory_bytes: 9524
#include <bits/stdc++.h>
#define ll long long
#define FAST {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define f(i, a, b) for(ll i=a; i<b; i++)
#define fr(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pll pair<ll,ll>
#define LB lower_bound
#define UB upper_bound
#define endl "\n"
using namespace std;


int main()
{
    FAST
    ll ans=0;
    ll h,w,k;cin>>h>>w>>k;
    char gr[h][w];f(i,0,h) f(j,0,w) cin>>gr[i][j];
    int col[w]={},row[h]={};
    for(ll r=0;r<(1LL<<h);r++)
    {
        for(ll c=0;c<(1LL<<w);c++)
        {
            // cout<<r<<" - "<<c<<" ";
            memset(col,0,sizeof(col));
            memset(row,0,sizeof(row));
            f(i,0,h) if((r>>i)&(1LL)) row[i]++;
            f(i,0,w) if((c>>i)&(1LL)) col[i]++;
            ll curr=0;
            f(i,0,h)
            {
                f(j,0,w)
                {
                    if(gr[i][j]=='#' && !col[j] && !row[i]) curr++;
                }
            }
            // cout<<curr<<" \n";
            if(curr==k) ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3628
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
long long  INF=1'0000'0000'0000'0000'00;
using namespace std;

long long second[41];

long long Xor(long long n){
if(n%2==0){
    long long l=n/2;
    if(l%2==0){
        return 0^n;
    }
    else{
        return 1^n;
    }
}
else{
    long long l=(n+1)/2;
    if(l%2==0){
        return 0;
    }
    else{
        return 1;
    }
}

}


int main(){

long long A,B;
cin>>A>>B;
long long ans=Xor(A-1)^Xor(B);

    
cout<<ans<<endl;

 return 0;
}

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

#define all(x) begin(x), end(x)

using i64 = int_fast64_t;
using f64 = double;
using p64 = pair<i64, i64>;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n, k;
    cin >> n >> k;
    vector<i64> a(n);
    for (auto& e : a) cin >> e;

    if (*max_element(all(a)) < k) {
        cout << "IMPOSSIBLE" << endl;
        return;
    }

    i64 d = accumulate(all(a), 0l, __gcd<i64>);
    if (d == 1) {
        cout << "POSSIBLE" << endl;
        return;
    }

    if (__gcd(d, k) == 1) {
        cout << "IMPOSSIBLE" << endl;
        return;
    }

    cout << "POSSIBLE" << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
string s;
int i,n,an;
int main()
{
    cin>>s;
    n=s.length();
    for(i=0;i<n;i++)
    {
        if(s[i]=='1')
        an++;
    }
    cout<<an<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int parent[100001];

int find(int a)
{
	if(a==parent[a])	return a;
	int x=find(parent[a]);
	parent[a]=x;
	return x;
}

void unite(int a, int b)
{
	parent[find(a)]=find(b);
}
int main()
{
	int n,k;
	cin>>n>>k;
	int temp,temp2;
	for(temp=1;temp<=n;temp++)	parent[temp]=temp;
	int a[n];
	for(temp=1;temp<=n;temp++)	cin>>a[temp];
	for(temp=1;temp<=k;temp++)
	{
		int x,y;
		cin>>x>>y;
		unite(x,y);
	}
	int cnt=0;
	for(temp=1;temp<=n;temp++)	if(find(temp)==find(a[temp]))	cnt++;
	cout<<cnt<<"\n";
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<n;i++)
#define ll long long
#define ld long double
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define pb push_back(x)
 
void solve(){ /*
    Your code here
    */
    int n,m;
    cin>>n>>m;
    vector <ld> v;
    for (int i = 0; i < n; i++)
    {
        /* code */
        ld x,y;
        cin>>x>>y;
        ld d = sqrt(pow(x,2)+pow(y,2));
        v.push_back(d);
    }
    int count=0;
    for (int i = 0; i < n; i++)
    {
        /* code */
        if(v[i]<=m)
        { 
            count++;
        }
    }
    cout<<count<<endl;

}
 
int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    solve();
    return 0;
}

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

int main() {
    long n, x, ans = 0, a, temp = 0;
    cin >> n >> x;
    rep(i, n) {
        cin >> a;
        if(temp + a <= x) {
            temp = a;
        } else {
            ans += (a + temp - x);
            temp = x - temp;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int K = sc.nextInt();
		int biggestNum = 1;
		if (a >= b) {
			if (a >= c) {
				biggestNum = a;
				for (int i = 0 ; i < K ; i++) {
					biggestNum *=  2;
				}
				System.out.println(biggestNum + b + c);
			} else {
				biggestNum = c;
				for (int i = 0 ; i < K ; i++) {
					biggestNum *=  2;
				}
				System.out.println(biggestNum + a + b);
			}} else if (b >= c) {
				biggestNum = b;
				for (int i = 0 ; i < K ; i++) {
					biggestNum *=  2;
				}
				System.out.println(biggestNum + a + c);
			} else {
				biggestNum = c;
				for (int i = 0 ; i < K ; i++) {
					biggestNum *=  2;
				}
				System.out.println(biggestNum + a + b);
			}
		}
	}




Measured memory_bytes: 20948
#include<bits/stdc++.h>
#include<stdio.h> //per fare input output con scanf and printf
#include<stdlib.h> //per fare qsort e bsearch
#include<string.h> // per fare strcpy(sarrivo, spartenza) strcat(str, aggiungo) strcmp(a,b) che da 0 se sono uguali
#include<math.h>
#include<cmath>
#include<algorithm>
#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<map>
 
using namespace std;
 
#define ld long double
#define ll long long int
#define vi vector <ll> 
#define pi pair <int, int>
#define binary(v, el) binary_search((v).begin(), (v).end(), (el))
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define G(n, t) get<(n)>((t)) // get element of a tuple
#define F first
#define S second
#define input(type, n) type n; cin >> n
#define FORN(n) for (ll i=0;i<(n); i++)
#define print(x) cout << x << endl
#include <iomanip>      // std::setprecision
#define M 1000*1000*1000+7
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);


int main(){
  IOS
  string s; cin>>s;
  ll n = s.length();
  ll pos;
  vi res(n);
  vi attrattori;
  for (ll i=0;i<n-1;i++){
    if (s[i]=='R' && s[i+1]=='L') attrattori.PB(i);
  }
  attrattori.PB(1000000);
  ll j = 0;
  for (ll i=0;i<n;i++){
    if (i>attrattori[j]) j++;
    if (s[i]=='R') {
      pos = (attrattori[j] - i)%2;
      res[attrattori[j] + pos]++;
    }
    else {
      pos = (i- attrattori[j-1])%2;
      res[attrattori[j-1] + pos]++;
    }
  }
  for (auto x:res) cout << x << " ";
}

Measured memory_bytes: 1864
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e10
using namespace std;
typedef pair<ll, ll> P;

string s;
ll dp[50][2] = { 0 };
ll dfs(ll i,string l) {
	if (l.length() == 1) {
		ll y = l[0] - '0';
		return y;
	}
	if (i == l.length()-1) {
		ll sum = 0;
		for (ll j = 0;j <= i;j++) {
			ll x = l[j] - '0';
			sum = sum + x * pow(10, i - j);
		}
		return sum;
	}
	ll sum = 0;
	for (ll j = 0;j <= i;j++) {
		ll x = l[j] - '0';
		sum = sum + x * pow(10, i - j);
	}
	string t = l.substr(i + 1, l.length() - i - 1);
	return sum * pow(2, t.length() - 1) + dfs(i + 1, l) + dfs(0, t);
}
int main(void) {
	cin >> s;
	cout << dfs(0, s) << endl;
}

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

int main() {
	int N;
	double S[1000], sum, m;
	while (1) {
		sum = 0;
		cin >> N;
		if (N == 0) break;
		for (int i = 0; i < N; i++) {
			cin >> S[i];
			sum += S[i];
		}
		m = sum / N;
		sum = 0;
		for (int i = 0; i < N; i++) {
			sum += (S[i] - m) * (S[i] - m);
		}
		printf("%.8f\n", sqrt(sum / N));
	}
}


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

int main(void) {
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < n; i++) {
        x -= a.at(i);
        if (x < 0) break;
        ans++;
    }
    if (x > 0) ans--;
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    // cout << fixed << setprecision(5);

    // 入力
    int n, m;
    cin >> n >> m;

    // 処理
    // 出力
    cout << (n - 1) * (m - 1) << endl;

    return 0;
}


Measured memory_bytes: 256
(* 0-indexedなBIT *)
module FenwickTree = struct
  (* 可換モノイド *)
  module type CommutativeMonoid = sig
    type t
    val e : t
    val op : t -> t -> t
  end

  module Make (CM : CommutativeMonoid)
  : sig
    type t
    (* n要素の単位元からなるBITを作る *)
    val make : int -> t
    (* 添字iの要素にはf iが入ったn要素のBITを作る *)
    val init : int -> (int -> CM.t) -> t
    (* 与えられたリストの要素が入ったBITを作る *)
    val of_list : CM.t list -> t
    (* i番目の要素にxを加える *)
    val accumulate : t -> int -> CM.t -> unit

    (* 添字が[0, i)の範囲の要素を全て加えた値を求める *)
    val query : t -> int -> CM.t
  end
  = struct
    type t = CM.t array

    let make n = Array.make n CM.e

    let initialize a =
      for i = 0 to Array.length a - 1 do
        if i lor (i + 1) < Array.length a then
          a.(i lor (i + 1)) <- CM.op a.(i) a.(i lor (i + 1))
      done

    let init n f =
      let a = Array.init n f in
      initialize a; a

    let of_list l =
      let a = Array.of_list l in
      initialize a; a

    let rec accumulate a i x =
      if i < Array.length a then begin
        a.(i) <- CM.op x a.(i);
        accumulate a (i lor (i + 1)) x
      end

    let rec query acc a i =
      if i < 0
      then acc
      else query (CM.op acc a.(i)) a ((i land (i + 1)) - 1)
    let query a i = query CM.e a (i - 1)
  end
end

module SumBIT = FenwickTree.Make (struct
  type t = int
  let e = 0
  let op = ( + )
end)

let () = Scanf.scanf "%d %d\n" @@ fun n q ->
  let cs = Array.init n @@ fun _ -> Scanf.scanf "%d " pred in
  let lrs = Array.init q @@ fun i -> Scanf.scanf "%d %d\n" @@ fun l r -> i, l - 1, r - 1 in
  Array.sort (fun (_, _, r) (_, _, r') -> compare r r') lrs;
  let r = ref 0 in
  let ans = Array.make q 0 in
  let bit = SumBIT.make (n + 2) in
  let prev = Array.make n (n + 1) in
  Array.iter (fun (i, l, right) ->
    while !r <= right do
      SumBIT.accumulate bit !r 1;
      SumBIT.accumulate bit prev.(cs.(!r)) (-1);
      prev.(cs.(!r)) <- !r;
      incr r
    done;
    ans.(i) <- SumBIT.query bit (!r + 1) - SumBIT.query bit l) lrs;
  Array.iter (Printf.printf "%d\n") ans

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

typedef long double ld;
typedef unsigned long ul;
typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long> vl;
typedef vector<double> vd;
typedef map<int,int> mii;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,a,n) for(int i=a;i<n;i++)
#define ALL(a) (a).begin(),(a).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

#define pi 3.14159265358979
#define eps 1e-9
#define inf 1<<30
#define MOD 1000000007 // 1e9+7

char S[500][1000];
int main()
{
  int N;
  cin >> N;
  rep(i,N)rep(j,N){
    cin >> S[i][j];
    S[i][j+N] = S[i][j];
  }

  int ret = 0;
  for(int offset = 0; offset < N; offset++){
    bool flag = true;
    for(int i=0; i<N; i++){
      for(int j=0; j<i; j++){
        if( S[i][j+offset] != S[j][i+offset] ){
          flag = false;
          break;
        }
      }
      if( flag == false ) break;
    }
    if( flag == true ) ret += 1;
  }
  cout << ret*N << endl;
  
  return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

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

	string s;
	cin >> s;

	Int len = s.size();

	//2連続
	for (Int i = 0; i < len-1; i++) {
		if (s[i] == s[i + 1]) {
			printf("%lld %lld\n", i + 1, i + 2);
			//printf("%ld %ld\n", i + 1, i + 2);
			//cout << i + 1 << " " << i + 2 << "\n";
			return 0;
		}
	}

	//1つ飛ばし
	for (Int i = 0; i < len-2; i++) {
		if (s[i] == s[i + 2]) {
			printf("%lld %lld\n", i + 1, i + 3);
			// cout << i + 1 << " " << i + 3 << "\n";
			return 0;
		}
	}

	printf("%lld %lld\n", -1LL, -1LL);
	//cout << "-1 -1" << "\n";
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,c;
  cin >> a >> b >> c;
  cout << min(b / a,c) << endl;
}

Measured memory_bytes: 3604
#include <iostream>

using namespace std;

int main()
{
    int a, b, n, m;

    cin >> a >> b;

    for (int i = 1; i <= 999; i++)
    {
        n = (i * (i+1)) / 2;
        int j = i+1;

        m = (j * (j+1)) / 2;
        
        if ((n > a) && (m > b) && ((n - a) == (m - b)))
        {
            cout << n-a << endl;
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

S = input()
T = input()

# 1対1の対応表
start = [-1] * 26
goal = [-1] * 26

for i in range(len(S)):
    # アルファベットを0～25の数値に変換
    a = ord(S[i]) - ord('a')
    b = ord(T[i]) - ord('a')
    # 対応表の該当箇所がまだ空いてるかどうか
    if start[a] != -1 or goal[b] != -1:
        # 埋まっている場合、今回の組み合わせと一致しているかどうか
        if start[a] != b or goal[b] != a:
            print('No')
            exit()
    # 空いていれば対応表を埋める
    else:
        start[a] = b
        goal[b] = a

print('Yes')

Measured memory_bytes: 3632
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define out(ans) cout << ans << endl;

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

void Main(){
  int H, W; cin >> H >> W;
  vector<string> S(H);
  rep(i, 0, H) cin >> S[i];
  rep(i, 0, H){
    rep(j, 0, W){
      if(S[i][j] == '.') continue;
      bool ok = false;
      if(i > 0) if(S[i - 1][j] == '#') ok = true;
      if(i < H - 1) if(S[i + 1][j] == '#') ok = true;
      if(j > 0) if(S[i][j - 1] == '#') ok = true;
      if(j < W - 1) if(S[i][j + 1] == '#') ok = true;
      if(!ok){
        out("No");
        return;
      }
    }
  }
  out("Yes");
}

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

int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  //cout << std::fixed << std::setprecision(15);

  Main();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    int h, w, n;
    cin >> h >> w >> n;
    int ht = h, wt = w;
    int sum = 0, ans = 0;
    while (sum < n) {
        ans++;
        sum += max(ht, wt);
        if (ht >= wt) wt--;
        else ht--;
    }
    cout << ans << endl;
}

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


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		if (a + b == c || b + c == a || c + a == b) {
			pr.println("Yes");
		} else {
			pr.println("No");
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 10324
#include <bits/stdc++.h>
using namespace std;
const int maxn=200050;
typedef long long ll;
const ll MOD=998244353;
int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	ll ans=8e18;
	if(a>b) swap(a,b);
	if((b-a)%2==0) ans=min(ans, (b-a)/2);
	else {
		ans=min(ans, n-b+1+(b-a)/2);
		ans=min(ans, a+(b-a)/2);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int X=sc.nextInt();
		int ans = 0;
		
		for(int b=1; b <= X; b++) {
			for(int p = 2; p <= 1000; p++) {
				if(Math.pow(b,p) <= X) {
					ans = (Math.max((int)Math.pow(b,  p), ans));
					}
				}
		
		}
		
		System.out.println(ans);
		

	}
}


Measured memory_bytes: 23124
//
//  sublime text 3,
//  emre yazicioglu
//

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;
typedef vector <ll> vll;
#define pb push_back
#define fi first
#define se second
#define INF (ll) 1e18 + 7
#define MOD (ll) 1e9 + 7

const int N = 2e6 + 7;
ll mn = INF, mx = -INF;
ll n, m, k, s, q, t;
ll a, b, c, d, e;
ll ans, cur, sum, cnt;
ll ar[N], p[N], dp[N];
string str; bool h[N];
pll pp[N]; vll v;

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

  // freopen("../in.txt","r",stdin);
  // freopen("../out.txt","w",stdout);

  cin >> n;
  for(int i = 1; i <= sqrt(n); i++) {
    if(n % i == 0 && i < 10 && n / i < 10) {
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int expr(string &s, int &i);
int number(string &s, int &i);

int expr(string &s, int &i){
    ++i;
    if(isdigit(s[i])){
        int ret = number(s, i);
        ++i;
        return ret/2 + 1;
    }
    vector<int> v;
    while(s[i] == '['){
        v.push_back(expr(s, i));
    }
    sort(v.begin(), v.end());
    int ret = accumulate(v.begin(), v.begin()+v.size()/2+1, 0);
    ++i;
    return ret;
}

int number(string &s, int &i){
    int ret = 0;
    while(isdigit(s[i])){
        ret = ret * 10 + (s[i]-'0');
        ++i;
    }
    return ret;
}

int main(){
    int n;
    scanf("%d", &n);
    rep(_, n){
        string s;
        cin >> s;
        int idx = 0;
        printf("%d\n", expr(s, idx));
    }
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

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


	int N = getint();
	
	int ikeru = 1;
	int h = -1;
	rep(i, N) {
		int H = getint();
		if (H > h) h = H - 1;
		else if (H < h) ikeru = 0;
	}
	
	if (ikeru) printf("Yes");
	else printf("No");

	Would you please return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  map<ll, int> mp;
  vector<ll> A(n);
  rep(i, n) {
    cin >> A[i];
    mp[A[i]]++;
  }
  if(n % 3 == 0) {
    if(mp.size() > 3) cout << "No" << endk;
    else if(mp.size() == 3) {
      bool ok = true;
      ll sum = 0;
      for(auto ele: mp) {
        sum ^= ele.first;
        if(ele.second != n/3) ok = false;
      }
      if(ok && sum==0) cout << "Yes" << endk;
      else cout << "No" << endk;
    } else if(mp.size() == 2) {
      if(mp.count(0) && mp[0] == n/3) cout << "Yes" << endk;
      else cout << "No" << endk;
    } else {
      if(mp.count(0)) cout << "Yes" << endk;
      else cout << "No" << endk;
    }
  } else {
    if(mp.size() == 1 && mp.count(0)) cout << "Yes" << endk;
    else cout << "No" << endk;
  }
  return 0;
}


Measured memory_bytes: 8532
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>

using namespace std;

int main()
{
	char a, b;
	cin >> a >> b;

	if (a == 'H') {
		//AtCoDeerくん→正直者
		if (b == 'H') {
			//TopCoDeer君→正直
			cout << "H" << endl;
		}
		else {
			//TopCoDeer君→うそつき
			cout << "D" << endl;
		}
	}
	else {
		//AtCoDeerくん→うそつき
		if (b == 'H') {
			//TopCoDeer君→正直
			cout << "D" << endl;
		}
		else {
			//TopCoDeer君→うそつき
			cout << "H" << endl;
		}
	}



}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C) {
        cout << "Yes" << endl;
    } else cout << "No" << endl;
    return 0;
}

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

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

  int cnt=0;
  int ans=0;
  for (int i = 1; i < n; i++)
  {
    int h;
    cin >> h;

    if(h<=p){
      cnt++;
      ans=max(ans,cnt);
    }
    else{
      ans=max(ans,cnt);
      cnt=0;
    }
    p=h;
  }
  cout << ans << endl;
}

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

int min(int a, int b)
{
	int min;
	min = a <= b ? a : b;
	return min;
}

int main()
{
	int N, K;
	scanf("%d%d", &N, &K);
	
	int h[N];
	for(int i = 0;i < N;i++)
	{
		scanf("%d", &h[i]);
	}
	
	int step, dp[N];
	dp[0] = 0;
	for(int i = 1;i < N;i++)
	{
		step = K < i ? K+1 : i+1;
		dp[i] = dp[i-1] + abs(h[i]-h[i-1]);
		for(int j = 2;j < step;j++)
		{
			dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]));
		}
	}
	
	printf("%d", dp[N-1]);
	
	return 0;
}

Measured memory_bytes: 896
/*
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_5_A&lang=jp
 */

import java.util.*;
public class Main {
	int[] A;
	byte[][] dp;
	boolean solve(int m, int d) {
		//System.out.println(m + ", " + d);
		if (d >= A.length) return false;
		if (dp[m][d] == 1) return true;
		else if (dp[m][d] == -1) return false;
		int x = m - A[d];
		if (x == 0) return true;
		else {
			boolean b = solve(m, d+1);
			if (!b && x > 0) b = solve(x, d+1);
			dp[m][d] = (byte) (b ? 1 : -1);
			return b;
		}
	}
	
	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		A = new int[n];
		for (int i = 0; i < n; i++) A[i] = sc.nextInt();
		int q = sc.nextInt();
		for (int i = 0; i < q; i++) {
			int m = sc.nextInt();
			dp = new byte[m+1][A.length];
			if (solve(m, 0)) System.out.println("yes");
			else System.out.println("no");
		}
	}

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

}



Measured memory_bytes: 35860
#include <bits/stdc++.h>
using namespace std;
int main() {
    int w, h;
    while (cin >> h >> w, w) {
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                int t = min(i, h - i - 1);
                int u = min(j, w - j - 1);
                if (min(t, u) == 0) cout << "#";
                else cout << ".";
            }
            cout << endl;
        }
		cout << endl;
    }
}


Measured memory_bytes: 3120
#include<cstdio>
int n;
char p[101000];
int main() {
	int i;
	scanf("%s", p);
	for (i = 0; p[i]; i++);
	n = i;
	if ((n % 2 == 0) == (p[0]==p[n-1])){
		puts("First");
	}
	else puts("Second");
}

Measured memory_bytes: 256
def is8DivisorNumbers(n: int) -> bool:
    cnt = 0
    for i in range(1, n+1):
        if n%i == 0:
            cnt += 1

    return True if cnt == 8 else False

n = int(input())
odds = [i for i in range(1, n+1, 2)]

ans = 0
for odd in odds:
    if is8DivisorNumbers(odd):
        ans += 1

print(ans)


Measured memory_bytes: 2940
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n+2];

        for (int i = 0; i < n; i++) {
            a[i+1] = sc.nextInt();
        }

        for (int i = 0; i < k; i++) {
            int[] b = new int[n+2];
            for (int j = 1; j <= n; j++) {
                int max = Math.min(j+a[j]+1, n+1);
                int min = Math.max(j-a[j], 0);
                b[max]--; b[min]++;
            }

            int tmp = b[0];
            boolean isLoop = true;
            for (int j = 1; j <= n; j++) {
                tmp += b[j];
                if (a[j] != tmp) {
                    isLoop = false;
                    a[j] = tmp;
                }
            }

            if (isLoop)
                break;
        }

        PrintWriter pw = new PrintWriter(System.out);
        for (int i = 1; i <= n; i++)
            pw.print(a[i] + " ");
        pw.flush();
    }

    static class MyScanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

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

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

        long nextLong() {
            return Long.parseLong(next());
        }
    }
}

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

int main() {
  string s,t;
  cin >> s >> t;
  int cnt=0;
  for(int i=0; i<s.length(); i++) {
    if(s[i]==t[i]) continue;
    else cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 3812
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;
	
	private static long[] dp;
	public static void Main(string[] args)
	{
		var h = Console.ReadLine().ToLong();
		
		dp = new long[10000000];
		//1 00 00 00 00 00 00

		dp[1] = 1;
		for(int i = 2; i < dp.Length; i++)
		{
			dp[i] = dp[i/2]*2+1;
		}
		Console.WriteLine(Check((ulong)h));
	}
	
	private static ulong Check(ulong k)
	{
		if(k < (ulong)dp.Length)
		{
			return (ulong)dp[k];
		}
		var p = Check(k/2) * 2 + 1;
		return p;
	}


	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}


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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

template<class T>
bool ChangeMax(T&a,const T&b){
  if(a >= b) return false;
  a = b;    return true;
}

template<class T>
bool ChangeMin(T&a,const T&b){
  if(a <= b) return false;
  a = b;    return true;  
}

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T,class U>
istream& operator >> (istream&is, P<T,U>&p){
  is >> p.first >> p.second;
  return is;
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
  }
  return is;
}

int main(){
  string s; cin >> s;
  int k; cin >> k;
  int all_a = 0;
  for(auto e:s){
    all_a += (26-(e-'a'))%26;
  }
  debug(k);
  debug(all_a);
  if(k >= all_a){
    k -= all_a;
    k %= 26*(int)s.size();
    s = string((int)s.size(),'a');
    k %= 26;
    s.back() += k;
    cout << s << endl;
    return 0;
  }
  k %= all_a;
  for(auto&e:s){
    if(k <= 0)break;
    int need = (26-(e-'a'))%26;
    if(need <= k){
      e = 'a';
      k -= need;
    }
  }
  s.back() = 'a'+(s.back()+k-'a')%26;
  cout << s << endl;
}




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

int main(){
  string s = "Sunny";
  string c = "Cloudy";
  string r = "Rainy";

  string str;
  
  cin >> str;

  
  if(s == str){
   cout << c; 
  }else if(c == str){
   cout << r;
  }else{
   cout << s;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
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++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, K; cin >> N >> K;
  cout << N - K + 1 << endl;
  return 0;
}

Measured memory_bytes: 256
#![allow(unused_imports)]

//input
use proconio::input;
use proconio::marker::{Bytes, Chars};
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        x: f64,
    }
    let mut y = 100f64;
    let mut ans = 1;
    loop {
        y *= 1.01;
        y = y as u64 as f64;
        if y >= x {
            println!("{}", ans);
            return;
        }
        ans += 1;
    }
}

Measured memory_bytes: 2212
console.log((args=>{
  const [[N],...tmp] = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  const t = Array(N).fill(0);
  for ( let i = 0; i < N-1; i++ ) {
    const [C,S,F] = tmp[i];
    t[i] = S + C; 
    for ( let j = 0; j < i; j++ ) {
      t[j] = Math.max(S,Math.ceil(t[j]/F)*F);
      t[j] += C;
    }
  }
  return t.join`\n`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


Measured memory_bytes: 33692
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()

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

  string ans="No";
  for(int i=0;i<=25;i++){
    for(int j=0;j<=14;j++){
      if(i*4+j*7 == n) ans = "Yes";
    }
  }

  cout <<ans <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    for(int i=0;i>=0;i++){
        int x;
        cin>>x;
        if(x==0){
            return 0;
        }
        cout<<"Case"<<" "<<i+1<<":"<<" "<<x<<endl;
    }
}


Measured memory_bytes: 3000
#include<stdio.h>
int main(){
           int a,b,c,d,p,x,y;
           scanf("%d",&a);
           scanf("%d",&b);
           scanf("%d",&c);
           scanf("%d",&d);
           scanf("%d",&p);
           x=p*a;
           if(p<=c){
                    y=b;
           }else{
                 y=b+(p-c)*d;
           }
           if(x<y){
                   printf("%d\n",x);
           }else{
                 printf("%d\n",y);
           }
           return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define f0(i,n) for(int i=0;i<n;i++)
#define f1(i,n) for(int i=1;i<=n;i++)
#define f2(i,a,b) for(int i=a;i<=b;i++)
#define sp <<" "                // giving space
#define sp1 <<" "<<              // giving space between two elements
                 // new line
#define M 1000000007              // for mod
#define ll long long
#define ld long double
#define vii vector <pair<int,int>>
#define vll vector <pair<ll,ll>>
#define vi vector <int>
#define vl vector <ll>
#define pb(v,x) v.push_back(x)
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Sort(v) sort(v.begin(),v.end())
using namespace std;
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#include <set>
#include <map>


int main()
{
	ll h,n,sum=0;
	cin>>h>>n;
	vl v(n);
	f0(i,n)
	cin>>v[i];
	for(int i=1;i<n;i++)
		v[i]=v[i]+v[i-1];
	if(v[n-1]>=h)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
//#include <algorithm>
#include <set>
#include <boost/dynamic_bitset.hpp>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

int bfs(const vector<vector<int>>& G, boost::dynamic_bitset<>& eb, const uint u, const uint v, const uint p) {
	//cout << "bfs " << u << " " << v << " " << p << endl; 
	if(u == v) return 0;
	
	for(uint nu=0; nu<G[u].size(); nu++) {
		if(nu == p) continue;
		if(G[u][nu] == -1) continue;
		
		int nd = bfs(G, eb, nu, v, u);
		//cout << "nd " << u << " " << v << " " << nd << endl; 
		if(nd != -1) {
			eb.set(G[u][nu]);
			return nd + 1;
		}
	}
	
	return -1;
}

int main() {
	uint N;
	cin >> N;
	
	vector<vector<int>> G(N, vector<int>(N, -1));
	
	for(uint i=0; i<N-1; i++) {
		uint a, b;
		cin >> a >> b;
		
		G[a-1][b-1] = (int)i;
		G[b-1][a-1] = (int)i;
	}
	
	uint M;
	cin >> M;
	
	vector<boost::dynamic_bitset<>> ebits(M, boost::dynamic_bitset<>(M + N - 1));
	vector<set<boost::dynamic_bitset<>>> ps(2, set<boost::dynamic_bitset<>>());
	
	for(uint i=0; i<M; i++) {
		uint u, v;
		cin >> u >> v;
		
		int dist = bfs(G, ebits[i], u-1, v-1, u-1);
		ebits[i].set(i + N - 1);
		//cout << dist << " " << ebits[i] << endl;
	}
	
	ps[0].insert(boost::dynamic_bitset<>(M + N - 1, 0));
	ull ans = 0;
	
	for(uint i=0; i<=M; i++) {
		uint cur = i % 2;
		uint nxt = (i + 1) % 2;
		
		for(auto p : ps[cur]) {
			
			uint bcnt = p.count() - i;
			ull dif = (ull)1 << (N - 1 - bcnt);
			
			ans = (i % 2) ? ans - dif : ans + dif;
			
			for(uint j=0; j<M; j++) {
				auto np = p | ebits[j];
				if(p != np) {
					//cout << "np " << np << endl;
					ps[nxt].insert(np);
				}
			}
		}
		
		ps[cur].clear();
	}
	
	cout << ans;
	
	return 0;
}


Measured memory_bytes: 40832
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

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

  cout << max(A + B, max(A - B, A * B)) << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int x;
	scanf("%d",&x);
	if(400<=x&&x<=599){
		printf("8");
		return 0;
	}
	else if(600<=x&&x<=799){
		printf("7");
		return 0;
	}
	else if(800<=x&&x<=999){
		printf("6");
		return 0;
	}
	else if(1000<=x&&x<=1199){
		printf("5");
		return 0;
	}
	else if(1200<=x&&x<=1399){
		printf("4");
		return 0;
	}
	else if(1400<=x&&x<=1599){
		printf("3");
		return 0;
	}
	else if(1600<=x&&x<=1799){
		printf("2");
		return 0;
	}
	else if(1800<=x&&x<=1999){
		printf("1");
		return 0;
	}
}

Measured memory_bytes: 1628
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define p(s) cout<<(s)<<endl
#define REP(i,n,N) for(int i=n;i<N;i++)
#define RREP(i,n,N) for(int i=N-1;i>=n;i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define F first
#define S second
typedef long long ll;
using namespace std;
const ll mod = 1e9+7;

ll N, ans;
string s;
map<char,ll> m;
int main() {
    cin>>N;
    REP(i,0,N){
        cin>>s;
        m[s[0]]++;
    }
    ans += m['M']*m['H']*m['R'];
    ans += m['M']*m['H']*m['C'];
    ans += m['M']*m['H']*m['A'];
    ans += m['M']*m['R']*m['C'];
    ans += m['M']*m['R']*m['A'];
    ans += m['M']*m['A']*m['C'];
    ans += m['A']*m['H']*m['C'];
    ans += m['R']*m['H']*m['C'];
    ans += m['A']*m['R']*m['C'];
    ans += m['A']*m['H']*m['R'];
    ans = max<ll>(ans, 0);
    p(ans);
    return 0;
}

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

typedef long long int ll;

int main()
{
	string a,b;
	cin>>a>>b;
	int n=a.size(),m=b.size();
	int dp[n+1][m+1];
	for(ll i=0;i<n+1;i++)
	{
		for(ll j=0;j<m+1;j++)
		{
			if(i==0 || j==0)
				dp[i][j]=0;
			else if(a[i-1]==b[j-1])
				dp[i][j]=dp[i-1][j-1]+1;
			else
				dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
/*	for(ll i=0;i<n+1;i++)
	{
		for(ll j=0;j<m+1;j++)
		{
			printf("%d ",dp[i][j]);
		}
		printf("\n");
	}*/
	string ans;
	int maxi=0;
	int i=n,j=m;
	while(i>0 && j>0)
	{
		if(a[i-1]==b[j-1])
		{
			ans.push_back(a[i-1]);
			i--;
			j--;
		}
		else if(dp[i-1][j]>dp[i][j-1])
			i--;
		else
			j--;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
}


Measured memory_bytes: 38800
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fin(x) freopen(x,"r",stdin)
#define fout(x) freopen(x,"w",stdout)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll inf=0xc0c0c0c0c0c0c0c0;
const double pi=acos(-1);
int cnt[3];
char in[100005];
int main()
{
	scanf("%s",in);
	for(int i=0;in[i];i++)
		cnt[in[i]-'a']++;
	sort(cnt,cnt+3);
	if(cnt[2]<=cnt[0]+1)
		puts("YES");
	else
		puts("NO");
	return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;
using ll = long long;

int main()
{
    int n;
    ll a[100000];
    cin >> n;

    for(int i=0; i<n; i++){
        cin >> a[i];
        if(!a[i]){
            cout << 0 << endl;
            return 0;
        }
    }

    ll prod = 1;
    for (int i=0; i<n; i++){
        if(a[i] <= 1000000000000000000/prod){
            prod*=a[i];
        }else{
            cout << -1 << endl;
            return 0;
        }
    }
    cout << prod << endl;
    return 0;
}

Measured memory_bytes: 3888
#include<iostream>
#include<vector>
#include<numeric>
#include<algorithm>
#include<map>
using namespace std;

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

  map<int, int> list;

  for(int i = 0; i < N; i++){
    int A, B;
    cin >> A >> B;
    auto it = list.find(A);
    if(it == list.end()){
      list.insert(make_pair(A, B));
    }else{
      it->second = it->second + B;
    }
  }

  auto itr = list.begin();

  long long money = 0;

  while(1){
    if(itr->second < M){
      money += (long long)itr->first * itr->second;
      M -= itr->second;
      itr++;
    }else{
      money += ((long long)itr->first * M);
      break;
    }
  }

  cout << money << endl;

  return 0;
}

Measured memory_bytes: 4992
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1LL<<61;
int main(){
  int n,k;cin >> n >> k;
  int a[n];
  rep(i,n)cin>>a[i];
  sort(a,a+n);
  int sum=0;
  rep(i,k)sum+=a[i];
  cout << sum << endl;
}

Measured memory_bytes: 3564