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


bool cmp(pair<long long,long long>p1, pair<long long,long long>p2)
{
    if(p1.first==p2.first)return p1.second>p2.second;
    return p1.first < p2.first;
}
void show(vector<ll>&vc)
{
    for(auto it:vc)
    {
        cout<<it<<" ";
    }
    cout<<endl;
    return;

}


void solve()
{

    ll n,k;
    vector<ll>vc;
    cin>>n>>k;

    for(int i=0;i<n;i++)
    {
        ll temp;
        cin>>temp;
        vc.push_back(temp);

    }

    ll dp[100007];
    for(int i=0;i<100007;i++)dp[i]=1000000000;
    dp[0] = 0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            if(i-j>=0)
            dp[i] = min(dp[i],dp[i-j]+abs(vc[i]-vc[i-j]));
        }

    }

    cout<<dp[n-1]<<endl;




}

int main()
{


    ll t=1;
    //cin>>t;
    //t=1;

    while(t--)
    {
        solve();
    }
}


Measured memory_bytes: 1908
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, k: usize, a: usize, b: usize);
    let mut ret = 0;
    while ret <= b {
        if ret >= a {
            println!("{}", "OK");
            return;
        }
        ret += k;
    }
    println!("{}", "NG");
    return;
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2140
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;




int main() {
	int k, a, b;
	cin >> k >> a >> b;
	if ((a / k != b / k) || (a % k == 0) || (b % k == 0)) {
		cout << "OK";
	} else {
		cout << "NG";
	}

	return 0;
}


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
#define pri(n) printf("%d",n)
#define lpri(n) printf("%lld",n)
#define priln(n) printf("%d\n",n)
#define lpriln(n) printf("%lld\n",n)
#define F first
#define S second
const int mod=1e9+7;

int main()
{
    int n;
    cin>>n;
    
    int arr[n+1];
    for(int i=0;i<n;i++)
        cin>>arr[i];
    
    int dp[n]={0};
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<n;i++)
        dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
    
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
#N, K = map(int, input().split())
# 文字列の入力
N = int(input())
#開業されたN個要素を受け付ける
#input_list = [list(map(int, input().split())) for i in range(N)]

#print("test")

if(N == 1):
    print(0)
else:
    tmp1 = 1;
    tmp2 = 1;
    tmp3 = 1;
    for i in range(N):
        tmp1 = (tmp1 * 8) % 1000000007;
        tmp2 = (tmp2 * 9) % 1000000007;
        tmp3 = (tmp3 * 10) % 1000000007;
    print((tmp3 - (tmp2 + tmp2 - tmp1)) % 1000000007)


Measured memory_bytes: 9088
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define chmin(a,b) a = min((a), (b))
using namespace std;
using ll = long long;
const ll INF = 100000000000000;


int main()
{
    int n, m;
    cin >> n >> m;
    vector<ll> cost(m);
    vector<ll> key(m);
    rep(i, 0, m)
    {
        int b;
        cin >> cost[i] >> b;
        ll state = 0;
        rep(j, 0, b)
        {
            ll c;
            cin >> c;
            --c;
            state += 1LL << c;
        }
        key[i] = state;
    }
    vector<vector<ll>> dp(m+1, vector<ll>(10000, INF));
    dp[0][0] = 0;
    rep(i, 0, m)
        rep(j, 0, 10000)
        {
            ll next_state = j | key[i];

            chmin(dp[i+1][next_state], dp[i][j]+cost[i]);
            chmin(dp[i+1][j], dp[i][j]);
            // cout << "************" << endl;
            // cout << i+1 << ' ' << j << ' ' << next_state << ' ' << dp[i+1][next_state] << ' ' << endl;
        }

    ll full = (1 << n) - 1;
    // cout << full << ' ' << m << endl;
    // cout << dp[3][3] << endl;
    if (dp[m][full] == INF)
        cout << -1 << endl;
    else       
        cout << dp[m][full] << endl;
    return 0;
}

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

int n;

int main()
{
    cin >> n;
    int cnt = 0;
    int l = 0, r = 0, lr = 0;
    rep(i, n)
    {
        string s;
        cin >> s;
        rep(i, s.size() - 1)
        {
            if(s[i] == 'A' && s[i + 1] == 'B')
            {
                cnt++;
            }
        }
        if(*s.begin() == 'B' && *(s.end() - 1) == 'A')
        {
            lr++;
        }
        else if(*s.begin() == 'B')
        {
            l++;
        }
        else if(*(s.end() - 1) == 'A')
        {
            r++;
        }
    }
    
    //cout << res << " " << lr << " " << l << " " << r << endl;
    if(r == 0 && l == 0 && lr != 0)
    {
        cout << cnt + lr - 1 << endl;
    }
    else
    {
        cout << cnt + min(l, r) + lr << endl;
    }

    return 0;
}

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

public class Main {

    private static final long mod = 1_000_000_007l;
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        long[] arr = new long[N];
        for (int i = 0; i < N; ++i) {
            arr[i] = in.nextLong();
        }

        long ans = 0;
        for (int i = 0; i < 61; ++i) {
            int[] c = new int[2];
            for (int j = 0; j < N; ++j) {
                c[(int) (arr[j] % 2)]++;
                arr[j] >>= 1;
            }


            ans = (ans + mul((long) c[0], (long) c[1], (1l<<i) % mod)) % mod;
        }
        
        System.out.println(ans);
    }

    public static long mul(long a, long b, long c) {
        long ret = 1;
        ret = (ret * a) % mod;
        ret = (ret * b) % mod;
        ret = (ret * c) % mod;
        return ret % mod;
    }
}

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

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;
	if ((A + B) % 2 == 0) {
		cout << (A + B) / 2 << endl;
	} else {
		cout << "IMPOSSIBLE" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

vll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;
ll ans=0;
int main(){

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

    cin >> N;
    rep(ni,N){
        cin >> ltmp;
        A.push_back(ltmp);
    }

    for( ll ni = 1 ; ni <N ; ni++ ){
        if(A[ni]<A[ni-1]){
            ans+= (A[ni-1] - A[ni]);
            A[ni] = A[ni-1];
        }
    }
    cout << ans << endl;

    

}

Measured memory_bytes: 5320
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


ll mod = 998244353;


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


	ll N, S;
	cin >> N >> S;
	vector<vector<ll>>dp(2,vector<ll>(S+1));
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ll A;
		cin >> A;
		for (int j = 0; j <= S; j++)dp[1][j] = 0;
		for (int j = 0; j <= S; j++) {
			dp[1][j] = dp[0][j];
			if (j - A >= 0)dp[1][j] += dp[0][j - A];
			if (j == A)dp[1][j] += 1;
			if (j == 0)dp[1][j] += 1;
			dp[1][j] %= mod;
		}
		ans = ans + dp[1][S];
		ans %= mod;
		swap(dp[0], dp[1]);
	}
	puts(ans);

	return 0;
}

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

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

int const B = 1024;
template<class T>
struct RMQ {
    int n;
    enum : T { inf = INT_MAX };
    T Bmin[B], dat[B][B];
    RMQ(int n_){
        n = n_;
        if(n%B) n += B-n%B;
        rep(i,B)rep(j,B) dat[i][j] = inf;
        rep(i,B) Bmin[i] = inf;
    }
    void set(int k, T x){
        get(k) = x;
        Bmin[k/B] = inf;
        rep(i,B) Bmin[k/B] = min(Bmin[k/B], get(k/B*B+i));
    }
    int & get(int k){
        return dat[k/B][k%B];
    }
    int rmq(int l, int r){
        T res = inf;
        if(l/B != r/B){
            while(l%B) res = min(res, get(l++));
            while(r%B) res = min(res, get(--r));
            loop(i,l/B,r/B) res = min(res, Bmin[i]);
        } else {
            while(l<r) res = min(res, get(l++));
        }
        return res;
    }
};

int main(){
    int n,q;
    cin >> n >> q;
    static RMQ<int> rmq(n);
    rep(i,q){
        int c,x,y;
        cin >> c >> x >> y;
        if(c) cout << rmq.rmq(x,y+1) << endl;
        else rmq.set(x,y);
    }
}

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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  string s;
  cin >> n >> s >> k;
  char c = s[k - 1];
  rep(i, n) {
    if (s[i] != c) {
      s[i] = '*';
    }
  }
  cout << s;
  return 0;
}


Measured memory_bytes: 3660
using System;

namespace ABC
{
    class Program
    {
        static void Main(string[] args)
        {
           
            // スペース区切りの整数の入力
            string[] input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);
            // 文字列の入力
            string s = Console.ReadLine();
            var flag = true && s.Length == a + b + 1;
            for (var i = 0; i < a+b+1;i++){
                if(i == a){
                    if(s[i] == '-'){
                        
                    }else{
                        flag = false;
                    }
                }else{
                    int n = 0;
                    bool result = int.TryParse(s[i].ToString(), out n);
                    if(result == true){
                        
                    }else{
                        flag = false;
                    }
                }
            }
            if(flag){
                Console.WriteLine("Yes");
            }else{
                Console.WriteLine("No");
            }

        }
    }
}


Measured memory_bytes: 11092
using System;
using System.ComponentModel.DataAnnotations;
using System.IO.Pipes;
using System.Linq;

namespace ChokudaiScanner
{
    class MainClass
    {
        static void Main()
        {
            Scanner cin = new Scanner();

            int N = cin.NextInt();
            int M = cin.NextInt();
            int K = cin.NextInt();
            int[] A = cin.ArrayInt(N);
            int[] B = cin.ArrayInt(M);
            long[] a = new long[N + 1];
            long[] b = new long[M + 1];
            int ans = 0;

            for(int i = 1; i < a.Length ; i++)
            {
                a[i] = a[i - 1] + A[i - 1];
            }
            for (int i = 1; i < b.Length; i++)
            {
                b[i] = b[i - 1] + B[i - 1];
            }

            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] > K)
                {
                    break;
                }

                while (b[M] > K - a[i])
                {
                    M--;
                }
                ans = Math.Max(ans, i + M);
            }
            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string Next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return Next();
            i = 0;
            return s[i++];
        }

        public string[] ArrayNext(int N)
        {
            string[] Array = new string[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = Next();
            }
            return Array;
        }

        public int NextInt()
        {
            return int.Parse(Next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextInt() + add;
            }
            return Array;
        }

        public long NextLong()
        {
            return long.Parse(Next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextLong() + add;
            }
            return Array;
        }

        public double NextDouble()
        {
            return double.Parse(Next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = NextDouble() + add;
            }
            return Array;
        }
    }
}



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

using namespace std;

using ll = long long;

int const maxn = 1010;
int const maxs = 20101;

struct Block {
    int w, cap, c;

    bool operator<(Block const& rhs) const {
        return cap + w < rhs.cap + rhs.w;
    }
};

ll dp[maxn][maxs];

ll solve(vector<Block> const& v, int i, int resta) {
    if (i == -1) {
        return 0;
    }
    if (resta == 0) {
        return 0;
    }

    ll& d = dp[i][resta];

    if (d != -1) {
        return d;
    }

    d = solve(v, i-1, resta);

    if (v[i].w <= resta) {
        d = max(d, v[i].c + solve(v, i-1, min(v[i].cap, resta - v[i].w)));
    }

    return d;
}

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

    int n;
    cin >> n;

    vector<Block> v(n);
    for (auto& i : v) {
        cin >> i.w >> i.cap >> i.c;
    }

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

    memset(dp, -1, sizeof(dp));

    cout << solve(v, n-1, maxs-1) << "\n";

}

Measured memory_bytes: 158976
n = str(input())

if n[-1] == "2" or n[-1] == "4" or n[-1] == "5" or n[-1] == "7" or n[-1] == "9":
    print("hon")

elif n[-1] == "0" or n[-1] == "1" or n[-1] == "6" or n[-1] == "8":
    print("pon")

else:
    print("bon")

Measured memory_bytes: 61612
n=int(input())
a=list(map(int,input().split()))
a.sort()
cnt,ans=0,0
p=0
for x in a:
  if p==x:
    cnt+=1
  else:
    if cnt>p:
      ans+=cnt-p
    elif cnt<p:
      ans+=cnt
    p=x
    cnt=1
if cnt>p:
  ans+=cnt-p
elif cnt<p:
  ans+=cnt
print(ans)

Measured memory_bytes: 14672
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

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

int n;
vector<int> edges[105];

queue<int> q;
int depth[105];
int degAtDepth[105];

void init(vector<int> v) {
  while(q.size()) q.pop();
  for(int i = 0; i <= n; i++) {
    depth[i] = 1e9;
    degAtDepth[i] = 0;
  }
  for(int out: v) {
    depth[out] = 0;
    q.push(out);
  }
}

int bfs() {
  int ret = 0;
  while(!q.empty()) {
    int curr = q.front();
    ret = depth[curr];
    q.pop();
    int dd = 0;
    for(int out: edges[curr]) {
      if(depth[out] == 1e9) {
        depth[out] = 1 + depth[curr];
        dd++;
        q.push(out);
      }
    }
    degAtDepth[depth[curr]] = max(degAtDepth[depth[curr]], dd);
  }
  return ret;
}

pll solveEdge(int a, int b) {
  init({a, b});
  int below = bfs();
  ll numLeaves = 2;
  for(int i = 0; i < below; i++) {
    numLeaves *= degAtDepth[i];
  }
  return {below+1, numLeaves};
}

pll solveCenter(int k) {
  if(edges[k].size() == 1) return {1e18, 1e18};
  init({k});
  int below = bfs();
  ll numLeaves = 1;
  for(int i = 0; i < below; i++) {
    numLeaves *= degAtDepth[i];
  }
  return {below+1, numLeaves};
}

void solve() {
  cin >> n;
  if(n == 2) {
    cout << "1 2\n";
    return;
  }
  for(int i = 1; i < n; i++) {
    int a, b;
    cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  pll ret = {1e18, 1e18};
  for(int i = 1; i <= n; i++) {
    ret = min(ret, solveCenter(i));
  }
  for(int i = 1; i <= n; i++) {
    for(int out: edges[i]) {
      ret = min(ret, solveEdge(i, out));
    }
  }
  cout << ret.first << " " << ret.second << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  solve();
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
}


Measured memory_bytes: 256
N, M = map(int, input().split())  # N個のコマ, M個の訪れるべき座標

if N >= M:
    print(0)
else:
    A = sorted(list(map(int, input().split())))
    B = sorted(A[i]-A[i-1] for i in range(1, len(A)))
    print(sum(B[0:M-N]))


Measured memory_bytes: 13968
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

string nor(string s) {
	map<char, char> m;
	REP(i, s.size()) {
		if(!m.count(s[i])) m[s[i]] = m.size()+'a';
	}
	string v;
	REP(i, s.size()) {
		v.PB(m[s[i]]);
	}
	return v;
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	string s,t;
	while(cin>>s>>t) {
		cout<<YN(nor(s)==nor(t))<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1684
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long int;

int main(){
    int n; cin >> n;
    vector<ll>a(n); for(int i=0; i<n; i++){cin >> a[i];} 
    vector<ll>b(n); for(int i=0; i<n; i++){cin >> b[i];} 
    ll ans = 0;
    for(int i=0; i<30; i++){
        vector<ll> ord_a(n);
        vector<ll> ord_b(n);
        for(int j=0; j<n; j++){
            ord_a[j] = a[j] % (1 << (i+1));
            ord_b[j] = b[j] % (1 << (i+1));
        }
        sort(ord_b.begin(), ord_b.end());
        ll res = 0;
        ll low = 1 << i;
        for(auto& v:ord_a){
            res += lower_bound(ord_b.begin(), ord_b.end(), low*2 - v) - lower_bound(ord_b.begin(), ord_b.end(), low - v);
            res += lower_bound(ord_b.begin(), ord_b.end(), low*4 - v) - lower_bound(ord_b.begin(), ord_b.end(), low*3 - v);
        }
        ans += res % 2 << i;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 6552
def solve(st):
    d = st.split()
    l = []
    for i in xrange(len(d)):
        if d[i] == "+":
            l.append(l.pop()+l.pop())
        elif d[i] == "-":
            l.append(-l.pop()+l.pop())
        elif d[i] == "*":
            l.append(l.pop()*l.pop())
        elif d[i] == "/":
            l.append(1/l.pop()*l.pop())
        else:
            l.append(float(d[i]))
    return l[0]

while True:
    try:
        s = raw_input()
        print solve(s)
    except:
        break

Measured memory_bytes: 4244
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long s = sc.nextLong();
		long left = 0;
		long right = (long) 1e17;
		while(left + 1 < right) {
			long c = (left + right) >>> 1;
			if (length(c) < s) {
				left = c;
			}else{
				right = c;
			}
		}
		int begin = (int) (s - length(left) - 1);
		System.out.println(fizzbuzzFrom(left + 1, 20).substring(begin, begin + 20));
	}

	public static long length(long x) {
		long sum = (x / 3 + x / 5) * 4;
		long min = 1;
		for(int i=0;i<18;i++) {
			if (x < min) break;
			long max = Math.min(x, min * 10 - 1);
			long nonFizzBuzz = nonFizzBuzz(max) - nonFizzBuzz(min - 1);
			sum += nonFizzBuzz * (i + 1);
			min *= 10;
		}
		return sum;
	}
	
	public static String fizzbuzzFrom(long x,int n) {
		StringBuilder sb = new StringBuilder();
		for(long i=x;i<x+n;i++) {
			if (x == 0) continue;
			if (i % 15 == 0) {
				sb.append("FizzBuzz");
			}else if(i % 3 == 0) {
				sb.append("Fizz");
			}else if(i % 5 == 0) {
				sb.append("Buzz");
			}else{
				sb.append(i);
			}
		}
		return sb.toString();
	}
	
	public static long nonFizzBuzz(long x) {
		return x - (x / 3 + x / 5 - x / 15);
	}
}

Measured memory_bytes: 26472
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

// ans = ceil((double)(N - 1) / (K - 1))

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

    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    int ans = 0;
    int right = 0;
    while (true)
    {
        if (ans == 0)
        {
            right += K;
        }
        else
        {
            right += K - 1;
        }
        ans++;

        if (right >= N)
        {
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3720
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================


int main() {

	////==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	////==================================
	
	ll N;
	string S;

	cin >> N;
	cin >> S;



	ll n_R = 0;
	ll n_G = 0;
	ll n_B = 0;
	for (int i = 0; i < N; i++)
	{
		if (S[i] == 'R')
		{
			n_R++;
		}
		if (S[i] == 'G')
		{
			n_G++;
		}
		if (S[i] == 'B')
		{
			n_B++;
		}

	}
	
	ll ans = n_R * n_G * n_B;


	for (int d = 1; d < N; d++)
	{
		for (int i = 0; i < N; i++)
		{
			int j = i + d;
			int k = j + d;

			if (k >= N)
			{
				continue;
			}

			bool flg = S[i] != S[j] && S[j] != S[k] && S[i] != S[k];
			if (flg)
			{
				ans--;
			}

		}



	}


	cout << ans;





}





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

int main() {
   int A, B, C, D;
   cin >> A >> B >> C >> D;

   if(A + B < C + D) cout << "Right";
   else if(C + D < A + B) cout << "Left";
   else cout << "Balanced";
   
    return 0;
}


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

struct M{
	long long b;
	long long ka;
	long long t;
	long long w;
	long long ki;
};
M mkM(long long a,long long b,long long c,long long d,long long e){
	M m;
	m.b=a; m.ka=b; m.t=c; m.w=d; m.ki=e;
	return m;
}

struct C{
	long long y;
	long long m;
	long long d;
};
C mkC(long long a,long long b,long long c){
	C cc;
	cc.y=a; cc.m=b; cc.d=c;
	return cc;
}

long long MtoN(M m){
	long long ret=0;
	ret+=m.b; ret*=20;
	ret+=m.ka; ret*=20;
	ret+=m.t; ret*=18;
	ret+=m.w; ret*=20;
	ret+=m.ki;
	return ret;
}

M NtoM(long long n){
	M m;
	m.ki=n;
	m.w=m.ki/20; m.ki%=20;
	m.t=m.w/18; m.w%=18;
	m.ka=m.t/20; m.t%=20;
	m.b=m.ka/20; m.ka%=20;
	m.b%=13;
	return m;
}

long long D[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

long long CtoN(C c){
	if(c.y==2012)return c.d-21;

	long long ret=0;
	while(c.y>=2013+400){
		c.y-=400;
		ret+=365*400+97;
	}
	//ret+=(365*400+97)*((c.y-2013)%400);
	//c.y-=400*((c.y-2013)%400);
	ret+=c.d-1; c.d=1;
	while(c.m>1){
		c.m--;
		ret+=D[c.m];
		if(c.m==2&&c.y%4==0&&(c.y%100!=0||c.y%400==0))ret++;
	}
	while(c.y>2013){
		c.y--;
		ret+=365;
		if(c.y%4==0&&(c.y%100!=0||c.y%400==0))ret++;
	}

	return ret+11;
}

C NtoC(long long n){
	C c;
	c.y=2012; c.m=12; c.d=21;
	if(n<11){ c.d+=n; return c; }
	c.y=2013; c.m=1; c.d=1; n-=11;

	while(n>=365*400+97){
		n-=365*400+97;
		c.y+=400;
	}
	while(n>=365){
		if(c.y%4==0&&(c.y%100!=0||c.y%400==0)){
			if(n>=366){
				c.y++;
				n-=366;
			}
			else break;
		}
		else {
			c.y++;
			n-=365;
		}
	}
	if(c.y%4==0&&(c.y%100!=0||c.y%400==0)){
		D[2]++;
		while(n>=D[c.m]){
			n-=D[c.m];
			c.m++;
		}
		c.d+=n;
		D[2]--;
	}
	else {
		while(n>=D[c.m]){
			n-=D[c.m];
			c.m++;
		}
		c.d+=n;
	}

	return c;
}

int main(){
	string s;
	while(1){
		cin>>s;
		if(s=="#")break;

		long long t=0;
		long long a[6]={0};
		for(long long i=0;i<s.size();i++){
			if(s[i]=='.')t++;
			else {
				a[t]*=10;
				a[t]+=s[i]-48;
			}
		}

		M m;
		C c;
		if(t==4){
			m.b=a[0];
			m.ka=a[1];
			m.t=a[2];
			m.w=a[3];
			m.ki=a[4];
			long long n=MtoN(m);
			c=NtoC(n);
		
			printf("%d.%d.%d\n",c.y,c.m,c.d);
		}
		else {
			c.y=a[0];
			c.m=a[1];
			c.d=a[2];
			long long n=CtoN(c);
			m=NtoM(n);

			printf("%d.%d.%d.%d.%d\n",m.b,m.ka,m.t,m.w,m.ki);
		}
	}
}		

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  
  int cnt=0;
  sort(a.begin(),a.end());
  
  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if(a.at(k) < a.at(i)+a.at(j) ){
          cnt++;
        }
      }
    }
  }
  
  cout << cnt << endl;
  
  return(0);
}

Measured memory_bytes: 3612
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
#define _CRT_SECURE_NO_WARNINGS

int main(){
    char s[11];
    char t[11];
    int judge=0;
    cin >> s;
    cin >> t;

    for(int i=0;i<11;i++){
        if(s[i]=='\0'){
            i=100;
        }else if(s[i]!=t[i]){
            judge++;
            i=100;
        } 
    }
    if(judge!=0){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define PUTS(x) cout << (x) << endl;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define PB push_back
#define ALL(v) (v).begin(), (v).end()
struct Info {
    Int maxValue = 0;
    Int totalSize = 0;
};
struct Component {
    Int size, value;
};

int main() {
    Int n, T;
    cin >> n >> T;
    auto v = vector<Component>();
    rep(i, n) {
        Int a, b;
        cin >> a >> b;
        v.PB(Component{a, b});
    }

    auto dpL = vector<vector<Info>>(n, vector<Info>(T));
    rep(i, n) {
        rep(t, T) {
            if (i == 0) {
                if (v[0].size > t) {
                    dpL[0][t] = Info{0, 0};
                } else {
                    dpL[0][t] = Info{
                        v[0].value,
                        v[0].size};
                }
            } else {
                if (v[i].size > t) {
                    dpL[i][t] = dpL[i - 1][t];
                } else {
                    auto a = dpL[i - 1][t];
                    auto b = dpL[i - 1][t - v[i].size];
                    if (a.maxValue >= b.maxValue + v[i].value) {
                        dpL[i][t] = a;
                    } else {
                        dpL[i][t] = Info{
                            b.maxValue + v[i].value,
                            b.totalSize + v[i].size,
                        };
                    }
                }
            }
        }
    }

    auto dpR = vector<vector<Info>>(n, vector<Info>(T));
    for (int i = n - 1; i >= 0; i--) {
        rep(t, T) {
            if (i == n - 1) {
                if (v[n - 1].size > t) {
                    dpR[n - 1][t] = Info{0, 0};
                } else {
                    dpR[n - 1][t] = Info{
                        v[n - 1].value,
                        v[n - 1].size};
                }
            } else {
                if (v[i].size > t) {
                    dpR[i][t] = dpR[i + 1][t];
                } else {
                    auto a = dpR[i + 1][t];
                    auto b = dpR[i + 1][t - v[i].size];
                    if (a.maxValue >= b.maxValue + v[i].value) {
                        dpR[i][t] = a;
                    } else {
                        dpR[i][t] = Info{
                            b.maxValue + v[i].value,
                            b.totalSize + v[i].size,
                        };
                    }
                }
            }
        }
    }

    auto ans = 0LL;
    rep(i, n) {
        rep(t, T) {
            auto result = v[i].value;
            if (i > 0) result += dpL[i - 1][t].maxValue;
            if (i < n - 1) result += dpR[i + 1][T - 1 - t].maxValue;
            ans = max(ans, result);
        }
    }
    PUTS(ans)
}


Measured memory_bytes: 281856
#include "bits/stdc++.h"

#ifdef PRINTERS
#include "printers.hpp"
using namespace printers;
#define tr(a)        cerr<<#a<<" : "<<a<<endl
#else
#define tr(a)    
#endif

#define ll          long long
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b)    for(int i=a;i<b;i++)
using namespace std;

int dp[5][105];
void solve(){
    int N;
    cin>>N;
    rep(i,1,3){
        rep(j,1,N+1){
            cin>>dp[i][j];            
        }
        if(i==1){
            rep(j,1,N+1){
                dp[i][j]+=dp[i][j-1];
            }
        }
        else{
            for(int j=N;j>0;j--){
                dp[i][j]+=dp[i][j+1];
            }
        }
    }
    int ans=0;
    rep(i,1,N+1){
        ans=max(ans,dp[1][i]+dp[2][i]);
    }
    cout<<ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <numeric>
#include <regex>
#include <tuple>
#include <iomanip>
#include <math.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007 // 10^9 + 7
#define INF 1000000000 // 10^9
#define LLINF 1LL<<60
const double PI = 3.14159265358979323846;

int A[200009];
int check[200009]; // -1:未定  0:0個  1:1個 

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

	int N; cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> A[i];
	}
	check[N] = A[N] % 2;
	for (int i = N; i >= 1; i--) {
		int cnt = 0;
		for (int j = 2; i * j <= N; j++) cnt += check[i*j];
		cnt %= 2;
		check[i] = abs(A[i] - cnt);
	}
	int M = 0;
	for (int i = 1; i <= N; i++) if (check[i] == 1) M++;
	cout << M << endl;
	if (M > 0) {
		for (int i = 1; i <= N; i++) if (check[i] == 1) cout << i << " ";
		cout << endl;
	}

	return 0;
}

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

int main()
{
    int n;
    string s;
    cin >> n;
    cin >> s;
    
    int sum = 0;
    for(int i = 0; i < n - 2; i++)
    {
        if(s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C')
            sum++;
    }
    cout << sum << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define RREP(i, n) for (int i = n; 0 <= i; i--)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define FORSTEP(i, start, end, step) for (int i = start; i < end; i += step)
#define ALL(a) a.begin(), a.end()
typedef long long ll;
const int INF32 = 2147483647;
const ll INF64  = 9223372036854775807;
using namespace std;

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

    int N;
    cin >> N;
    vector<int> x(N), y(N), h(N);
    REP(i, N) cin >> x[i] >> y[i] >> h[i];

    int xx, yy, hh;
    REP(i, N) {
        if (h[i] > 0) {
            xx = x[i];
            yy = y[i];
            hh = h[i];
            // break;
        }
    }

    REP(i, 101) {
        REP(j, 101) {
            ll H      = hh + abs(xx - i) + abs(yy - j);
            bool flag = true;
            REP(k, N) {
                ll b = H - abs(x[k] - i) - abs(y[k] - j);
                ll a = max(b, 0LL);
                if (a != h[k])
                    flag = false;
            }
            if (flag) {
                cout << i << " " << j << " " << H << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdio>
using namespace std;
vector<int>res;
int ma,cnt;

void dfs(int s,const int t,const string n,vector<int>&v){
	if(s>t)return;
	if(n.empty()){
		if(ma<s)ma=s,cnt=0;
		if(ma==s)res=v,cnt++;
	//}else if(n[0]=='0'){
	//	v.push_back(0);
	//	dfs(s,t,n.substr(1),v);
	//	v.pop_back();
	}else{
		int add=0;
		for(int i=0;i<n.size();i++){
			add=add*10+n[i]-'0';
			v.push_back(add);
			dfs(s+add,t,n.substr(i+1),v);
			v.pop_back();
		}
	}
}

int main(){
	int t;
	string n;
	for(;cin>>t>>n,t;){
		vector<int>v;
		ma=0,cnt=0;
		dfs(0,t,n,v);
		if(cnt>1)puts("rejected");
		else if(!ma)puts("error");
		else{
			printf("%d",ma);
			for(int i=0;i<res.size();i++)printf(" %d",res[i]);
			puts("");
		}
	}
}

Measured memory_bytes: 1232
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>

int main(void) {
  int n;

  std::string str;
  std::cin >> str;
  n = std::stoi(str);

  int count = 0;
  int sosuu[255] = {0};
  //int index[55555]  = {0};

  size_t ncount = 0;
  int result[n] = {0};

  for (int i = 2; i <= 55555; ++i) {
    bool is_sosuu = true;
    for (int j = 0; j < count; ++j) {
      if (sosuu[j] > (int)std::sqrt(i)) {
        break;
      }
      if (i % sosuu[j] == 0) {
        is_sosuu = false;
        break;
      }
    }
    if (is_sosuu) {
      sosuu[count] = i;
      //index[i] = 1;
      if (i % 5 == 1) {
        result[ncount++] = i;
        if (ncount == n) {
          break;
        }
      }
      count++;
    }
  }

  std::cout << result[0];
  for (size_t i = 1; i < n; i++) {
    std::cout << " " << result[i];
  }
  std::cout << std::endl;

  return 0;
}

Measured memory_bytes: 256
# 全探索

import sys
readline=sys.stdin.readline

H,W,K = map(int,readline().split())

C = [None] * H
for i in range(H):
  C[i] = readline().rstrip()
  
def count_black(C,y,x):
  cnt = 0
  for i in range(H):
    for j in range(W):
      if C[i][j] == ".":
        continue
      # 黒の場合
      if y[i] != "1" and x[j] != "1":
        cnt += 1
  return cnt

# 色は塗らずに、カウントだけする
ans = 0
yketa = len(bin(H)[2:])
xketa = len(bin(W)[2:])

for y in range(2 ** H):
  yst = bin(y)[2:].zfill(H)
  for x in range(2 ** W):
    xst = bin(x)[2:].zfill(W)
    if count_black(C,yst,xst) == K:
      ans += 1
    
print(ans)

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

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

  if (n == 3) {
    cout << "2 5 63" << endl;
    return 0;
  }

  if (n & 1) {
    int cycle[] = {6, 2, 10, 3, 9, 4, 8, 12};
    for (int i = 0; i < n; ++i) {
      cout << cycle[i & 7] << ' ';
      cycle[i & 7] += 12;
    }
  } else {
    int cycle[] = {2, 10, 3, 9, 4, 8, 6, 12};
    for (int i = 0; i < n; ++i) {
      cout << cycle[i & 7] << ' ';
      cycle[i & 7] += 12;
    }
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N;
  cin >> N;
  int x = 0;
  int y = 0;
  x = N * 800;
  y = (N / 15) * 200;
  int ans = x - y;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
from sys import stdin
import sys

n = int(stdin.readline().rstrip())

A = [0, 0, 0]
for i in range(n):
    B = [int(j) for j in stdin.readline().rstrip().split()]

    t = B[0]-A[0]
    x = abs(B[1]-A[1])
    y = abs(B[2]-A[2])

    z = x+y

    if t % 2 == 1:
        if not(z % 2 == 1 and z <= t):
            print("No")
            sys.exit()

    else:
        if not(z % 2 == 0 and z <= t):
            print("No")
            sys.exit()

    A = B

print ("Yes")








Measured memory_bytes: 8864
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    int n, z, w;
    cin >> n >> z >> w;

    int a1;
    for (int i = 0; i < n - 1; i++) {
        cin >> a1;
    }

    int a;
    cin >> a;

    int r = abs(a - w);
    if (n > 1) r = max(r, abs(a1 - a));
    cout << r << endl;

    return 0;
}

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

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

int MOD = 1e9 + 7;
ll INF = 1e18;

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

int main(){
    ll x, y; cin>>x>>y;

    int cnt=0;
    while(x <= y){
        x *= 2;
        cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
MODULE intQsortMod
! 整数型のクイックソート
! precisionで整数の精度を定める．
! インデックスの小さいほうが値も小さい(昇順)．

! 参考
! https://t.doujin-constant.net/post/143374686394/fortranをより使いこなしたquick-sort

      implicit none
      integer,parameter,private :: precision = 16
      
      interface qSort
        module procedure :: intQsort
      end interface
      
      contains
      pure recursive function intQsort( a ) result( r )
        implicit none
        integer(precision), intent(in) :: a(:)
        integer(precision) :: r( size(a) )
        integer(precision) :: sample(3), len, i,j
        
        len = size( a(:) )
        if( len<=1 )then
          r = a
        else
          !select pivot
          sample(1:3) = [a(1), a(len/2), a(len)]
          do i = 1,2
            do j = 2,3
              if( sample(i)>sample(j) )then
                len = sample(i) !len is buffer
                sample(i) = sample(j)
                sample(j) = len
              end if
            end do
          end do
          
          r = [ qSort( pack(a(:), a(:)< sample(2) ) ), &
                       pack(a(:), a(:)==sample(2) )  , &
                qSort( pack(a(:), a(:)> sample(2) ) ) ]
        end if
      end function intQsort
      END MODULE intQsortMod


      PROGRAM piyo
      use intQsortMod
      IMPLICIT NONE
      integer(16) :: n
      integer(16),allocatable :: d(:)
      
      read*,n
      allocate(d(n))
      read*,d(1:n)
      
      d = qsort(d)
      
      print*,d(n/2+1) - d(n/2)
      
      
      
      
      
      
      END PROGRAM

Measured memory_bytes: 9432
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[6] = {0,1,0,-1,1,-1};
const int vy[6] = {1,0,-1,0,1,1};



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

    ll n,m;
    cin >> n >> m;
    vector<vector<int>> ab(m);
    rep(i,n){
        int x,y;
        cin >> x >> y;
        if(x > m) continue;
        x--;
        ab[x].push_back(y);
    }
    priority_queue<int> q;
    ll ans = 0;
    rep(i,m){
        for(auto x : ab[i]){
            q.push(x);
        }
        if(q.empty()) continue;
        ans += q.top();
        q.pop();
    }
    cout << ans  << endl;

    cout << endl;
    return 0;
}


Measured memory_bytes: 8348
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using boost::multiprecision::cpp_int;
using namespace std;

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

typedef long long ll;
typedef pair<ll, ll> p;


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x, y;
  cin >> x >> y;
  ll res = 0;
  map<int, int> mp;
  mp[3] = 100000;
  mp[2] = 200000;
  mp[1] = 300000;
  res = mp[x] + mp[y];
  if(x == 1 && y == 1) res += 400000;
  cout << res << endl;
}


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

int main(){
  int n,a=0,b=0;
  cin>>n;
  vector<int> card(n);
  for(int i=0;i<n;i++){
    cin>>card.at(i);
  }
  sort(card.begin(),card.end());
  reverse(card.begin(),card.end());
 
  for(int i=0;i<card.size();i=i+2){
    a+=card.at(i);
    if(i+1<n){
      b+=card.at(i+1);
    }
  }
  cout<<(a-b)<<endl;
}
  


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

namespace _2018
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x.Max() == 0) break;
                int[] a = new int[x[0]];
                for (int i = 0; i < x[0]; i++) a[i] = int.Parse(Console.ReadLine());
                Console.WriteLine(a[x[1] - 1] != 0 ? a.Sum() * (100 - x[2]) / a[x[1] - 1] : 0);
            }
        }
    }
}


Measured memory_bytes: 9692
#include<iostream>
using namespace std;
int main(void){
	int n,m,k;
	cin>>n>>m>>k;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){
			int l=i*m+j*n-2*i*j;
		//	cout<<l<<endl;
if(k==l||k==n*m-l){

	cout<<"Yes"<<endl;
	return 0;
}
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <math.h>
#include <queue>
#include <stack>
#include <numeric>
using namespace std;

int main(void){
  char str[100005];
  cin>>str;
  int N=strlen(str);
  int ans=0;
  for(int i=0;i<N;i++){
      if(i%2==0&&str[i]=='p'){ans--;}
      if(i%2==1&&str[i]=='g'){ans++;}
  }
  cout<<ans;
  return 0;
}


Measured memory_bytes: 384
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID
/*#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#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;
#define ll long long
#define print(o) for(auto it=(o).begin();it!=(o).end();it++) cout<<*it<<" ";
#define vll vector<ll>
#define pb push_back
#define FOR(n) for(ll i=0;i<=n;i++)
#define FORd(n) for(ll i=n;i>=0;i--)
#define FORrd(a,b) for(ll i=a;i>=b;i--)
#define FORr(a,b) for(ll i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define FIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define ff first
#define ss second
#define w(t) ll t;cin>>t;while(t--)

int main()
{
    ll n,m,s=0,sum=0;
    float lim;
    cin>>n>>m;
    ll a[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];sum+=a[i];
    }
    sort(a,a+n);
    lim=sum/(4.0*m);
    for(ll i=n-1;i>=0;i--)
    {
        if(a[i]>=lim)
        {
            s++;
        }
    }
    if(s>=m)
    {
        cout<<"Yes\n";
    }
    else{
        cout<<"No\n";
    }

    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 256