akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
class Main{
    int x,y,men,hen;
    public void kozueteacher() {
    Scanner sc = new Scanner(System.in);
    x = sc.nextInt();
    y = sc.nextInt();
        men = x * y;
        hen = x + x + y + y;
        System.out.println(men + " " + hen);
    }
    public static void main(String[] args) {
        new Main().kozueteacher();
    }
} 

Measured memory_bytes: 17324
package main

import "fmt"

func main() {
	var N, X int
	fmt.Scan(&N, &X)
	a := 1
	d := 0
	for i := 0; i < N; i++ {
		var L int
		fmt.Scan(&L)
		d += L
		if d <= X {
			a++
		}
	}
	fmt.Println(a)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn = 2e5 + 5;
int n , k , h[maxn];
bool cmp(int a, int b) {
	return a > b;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> k;
	for(int i =1; i <= n; ++i) cin >> h[i];
	sort(h + 1, h + n + 1 , cmp);
	ll sum = 0;
	for(int i = k + 1; i <= n; ++i)
		sum += h[i];
	cout << sum << endl;
 	return 0;
} 

Measured memory_bytes: 1024
N = int(input())
if N & 1:
    print((N-1)**2//2)
    for i in range(N):
        for j in range(i+1, N):
            if i + j == N - 2 and j < N - 1: continue
            print(i+1, j+1)
else:
    print(N*N//2-N)
    for i in range(N):
        for j in range(i+1, N):
            if i + j == N - 1: continue
            print(i+1, j+1)


Measured memory_bytes: 3612
n, m = map(int, input().split())
id = set(i for i in range(1, n + 1))
L = []
R = []
for i in range(m):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
print( min(R) - max(L) + 1 if min(R) - max(L) + 1 > 0 else 0)


Measured memory_bytes: 19560
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n;
multiset<int> st;

int calc(int num){
    int ret = 1;
    while(ret <= num)ret *= 2;
    return ret - num;
}

int main(){
    INIT;
    cin >> n;
    REP(i, n){
        int a;
        cin >> a;
        st.insert(a);
    }
    int ans = 0;
    while(st.size()){
        int num = *st.rbegin();
        //cout << num <<endl;
        auto it = st.end();
        it--;
        st.erase(it);
        if(st.count(calc(num))){
            ans++;
            st.erase(st.find(calc(num)));
        }
    }
    cout << ans <<endl;
}

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


void solve(long long N, long long K, std::vector<long long> p){
    sort(p.begin(), p.end());
    long long sum = 0;
    for (int i = 0; i < K; i++) {
        sum += p[i];
    }
    cout << sum << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 3700
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")


N, M, X, Y = list(map(int, sys.stdin.readline().split()))
Xs = list(map(int, sys.stdin.readline().split()))
Ys = list(map(int, sys.stdin.readline().split()))

Xs.append(X)
Ys.append(Y)
if max(Xs)< min(Ys):
    print('No War')
else:
    print('War')


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

int main(void){
  string a,b,c;
  cin>>a>>b>>c;
  
  a[0]=toupper(a[0]);
  b[0]=toupper(b[0]);
  c[0]=toupper(c[0]);
  
  cout<<a[0]<<b[0]<<c[0]<<endl;
  return 0;
  
}

Measured memory_bytes: 3596
// In the name of God

#include <bits/stdc++.h>

using namespace std;

#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout << #x << ": " << x << endl;

const int mod = 1e9+7;
int a[2*(int)1e5+5], sz, pre[2*(int)1e5+5], ind[2*(int)1e5+5];
long long dp[2*(int)1e5+5];
vector<int> v;

int main() {
	IOS
	int n;
	cin >> n;
	for(int i=0; i<n; i++) cin >> a[i];
	v.push_back(a[0]);
	for(int i=1; i<n; i++) {
		if(a[i-1] != a[i]) v.push_back(a[i]);
	}
	dp[0] = 1;
	n = v.size();
	for(int i=0; i<=2*(int)1e5; i++) ind[i]=-1;
	ind[v[0]] = 0;
	pre[0] = 0;
	for(int i=1; i<n; i++) {
		if(ind[v[i]] != -1) {
			pre[i] = ind[v[i]];
			ind[v[i]] = i;
		}
		else pre[i]=i, ind[v[i]]=i;
	}
	for(int i=0; i<n; i++) {
		if(i==0) continue;
		dp[i] = dp[i-1];
		if(pre[i]!=i) dp[i] += dp[pre[i]];
		dp[i]%=mod;
	}
	cout << dp[n-1]%mod;
	return 0;
}


Measured memory_bytes: 5108
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

signed main(){
    int n,l;
    cin >> n >> l;
    int a[100010];
    int x = -1;
    rep(i,n){
        cin >> a[i];
    }
    rep(i,n-1){
        if(a[i] + a[i+1] >= l){
            x = i;
            break;
        }
    }
    if(x == -1){
        cout << "Impossible" << endl;
    }else{
        cout << "Possible" << endl;
        for(int i = 0;i < x;i++)cout << i+1 << endl;
        for(int i = n-2;i > x;i--)cout << i+1 << endl;
        cout << x+1 << endl;
    }


    
    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 1536
FIRST_MIN_VALUE = 20000000

N = int(input())
P = list(map(lambda x: int(x), input().split()))

"""
初期戦略
for で一個ずつ回していくのはきつい気がする。
N <= 2*10**5だし、
まあ一回やってみるか
MIN_VALUEを更新して行ってカウントアップしていく
"""

min_val = FIRST_MIN_VALUE
count = 0
for p in P:
  if p <= min_val:
    min_val = p
    count += 1

print(count)

Measured memory_bytes: 24744
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int K;
vector<pair<int,int> >f(int X,int Y)
{
	if(X+Y==K)
	{
		return{make_pair(X,Y)};
	}
	long l=max((X+Y+K-1)/K,2);
	l+=(l*K-X-Y)%2;
	long T=(l*K-X-Y)/2;
	long V=0;
	if(T>=K)V=T-K,T=K;
	vector<pair<int,int> >ret;
	ret.push_back(make_pair(K-T,-T));
	long x=K-T,y=-T;
	for(int i=1;i<l-1;i++)
	{
		if(x+K<=X+V)
		{
			ret.push_back(make_pair(x+=K,y));
		}
		else
		{
			int p=X+V-x;
			ret.push_back(make_pair(x=X+V,y+=K-p));
		}
	}
	ret.push_back(make_pair(X,Y));
	return ret;
}
main()
{
	int x,y;cin>>K>>x>>y;
	int X=abs(x),Y=abs(y);
	if(K%2==0&&(X+Y)%2==1)
	{
		cout<<-1<<endl;
		return 0;
	}
	bool flag=false;
	if(X<Y)
	{
		swap(X,Y);
		flag=true;
	}
	vector<pair<int,int> >ret=f(X,Y);
	cout<<ret.size()<<endl;
	for(pair<int,int>p:ret)
	{
		if(flag)swap(p.first,p.second);
		cout<<p.first*(x<0?-1:1)<<" "<<p.second*(y<0?-1:1)<<endl;
	}
}


Measured memory_bytes: 3952
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		int amount = 0;
		int count = 0;
		byte[][][] buildings = new byte[4][3][10];
		try {
			while ((buffer = reader.readLine())  != null) {
				String[] strings = buffer.split(" ");
				if (amount == 0) {
					amount = Integer.valueOf(strings[0]);
				}
				else {
					int b = Integer.valueOf(strings[0]);
					int f = Integer.valueOf(strings[1]);
					int r = Integer.valueOf(strings[2]);
					int v = Integer.valueOf(strings[3]);
					buildings[b - 1][f - 1][r - 1] += v;
					if (++count >= amount) {
						for (byte building = 0; building < 4; building++) {
							for (byte floor = 0; floor < 3; floor++) {
								for (byte room = 0; room < 10; room++) {
									System.out.print(" " + buildings[building][floor][room]);
								}
								System.out.println();
							}
							if (building < 3) {
								System.out.println("####################");
							}
						}
						return;
					}
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}



Measured memory_bytes: 24680
W,H,x,y = list(map(int,input().split()))
area = W*H/2.0
mx = W / 2.0
my = H / 2.0
if mx - x == 0 and my - y == 0:
    n = 1
else:
    n = 0
print('{} {}'.format(area,n)) 

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

int main(){
  vector<vector<int>> c(3,vector<int>(3));
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin >> c.at(i).at(j);
    }
  }

  for(int a1=0;a1<=100;a1++){
    for(int a2=0;a2<=100;a2++){
      for(int a3=0;a3<=100;a3++){
        bool flag=true;
        for(int j=0;j<3;j++){
          int bx=c.at(0).at(j)-a1;
          int by=c.at(1).at(j)-a2;
          int bz=c.at(2).at(j)-a3;
          if(bx!=by || by!=bz || bz!=bx)  flag=false;
        }
        if(flag){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;

  return 0;
}


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

int gcd(long long a,long long b){
  if (a%b==0) return b;
  else return gcd(b,a%b);
}

int main(){
  long long n,xx;
  cin >> n >> xx;
  long long x[n];
  for (int i=0;i<n;i++){
    cin >> x[i];
    x[i] = abs(x[i]-xx);
  }
  long long d=0;
  for (int i=0;i<n;i++){
    d = gcd(d,x[i]);
  }
  cout << d << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define sz(arr) (int)arr.size()
#define all(arr) arr.begin(), arr.end()

using namespace std;

void _cin() {}
template <class Head, class... Tail>
void _cin(Head&& head, Tail&&... tail) {
  cin >> head;
  _cin(forward<Tail>(tail)...);
}

#define Cin(T, ...) \
  T __VA_ARGS__;    \
  _cin(__VA_ARGS__)

int main() {
  Cin(int, n, k);

  if (k == 1)
    puts("0");
  else
    cout << n - k << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,a,b;

int DP[100005];
vector<int> graph[100005];
int dp(int curr){
	if(graph[curr].size()==0) return 1;
	if(DP[curr]!=-1) return DP[curr];
	int ret = 0;
	for (int i= 0 ;i<graph[curr].size();i++){
		ret = max(ret, dp(graph[curr][i]));
	}
	return DP[curr] = ret+1;
}

int main(){
	memset(DP, -1, sizeof DP);
	scanf("%d%d",&n,&m);
	while(m--){
		scanf("%d%d",&a,&b);
		graph[a].push_back(b);
	}
	int ans = 0;
	for (int i = 1;i<=n;i++){
		ans = max(ans, dp(i));
	}
	printf("%d\n",ans-1);
	return 0;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int MOD = 1e9 + 7;
int n;
int a[N], mp[N], ans[N];
int px, py, d;
int F[N], Finv[N], inv[N];//F是阶乘，Finv是逆元的阶乘 
void init(){
    inv[1] = 1;
    for(int i = 2; i < N; i ++){
        inv[i] = (MOD - MOD / i) * 1ll * inv[MOD % i] % MOD;
    }
    F[0] = Finv[0] = 1;
    for(int i = 1; i < N; i ++){
        F[i] = F[i-1] * 1ll * i % MOD;
        Finv[i] = Finv[i-1] * 1ll * inv[i] % MOD;
    }
}
int comb(int n, int m){//comb(n, m)就是C(n, m) 
	if(n <= 0) return 0;
    if(m < 0 || m > n) return 0;
    return F[n] * 1ll * Finv[n - m] % MOD * Finv[m] % MOD;
}
int main(){
	init();
	ios::sync_with_stdio(false);
	memset(mp, -1, sizeof(mp));
	cin >> n;
	for(int i = 0; i <= n; ++ i){
		cin >> a[i];
		if(mp[a[i]] == -1){
			mp[a[i]] = i;
		}else{
			px = mp[a[i]];
			py = i;
			d = py - px - 1;
		}
	}
	if(n == 1){
		puts("1");
		puts("1");
		return 0;
	}
	for(int i = 0; i <= n; ++ i){
		ans[i] = comb(n, i);
	}
	for(int i = 2; i <= n; ++ i){
		ans[i] = (ans[i] + comb(n-1, i-1)) % MOD;
	}
	for(int i = 2; i <= n+1; ++ i){
		ans[i] = (ans[i] + comb(n-1, i-2)) % MOD;
	}
	for(int i = 2; i <= n+1; ++ i){
		ans[i] = ((ans[i] - comb(n-1-d, i-1)) % MOD + MOD) % MOD;
	}
	for(int i = 1; i <= n+1; ++ i){
		printf("%d\n", ans[i]);
	}

}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <sstream>
#include <cmath>

using namespace std;

int main(){

	string a;
	string b;
	cin >> a >> b;
	
	int x;
	string c = a+b;
	stringstream ss;
	ss << c;
	ss >> x;

	int y = sqrt(x);
	if(y*y == x){
		puts("Yes");
	}else{
		puts("No");
	}


	return 0;
}


Measured memory_bytes: 256
def byte_minus(byte, num)
  if 97 <= byte && byte <= 122 then   #小文字
    if byte - 97 >= num then
      return byte - num
    else
      byte_minus(90, num - (byte - 96) )
    end
  elsif 65 <= byte && byte <= 90 then   #大文字
    if byte - 65 >= num then
      return byte - num
    else
      byte_minus(122, num - (byte - 64) )
    end
  end
end

while true do
  n = gets.to_i
  break if n == 0
  keys = gets.split.map {|x| x.to_i}
  cipher = gets.chomp
  cipher.each_byte.with_index do |byte, i|
    key_index = i % keys.size
    print byte_minus(byte, keys[key_index]).chr
  end
  puts ''
end

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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define bit(n) (1<<(n))

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

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

	if((x * y * z) == 175)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
	
	return 0;
}


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

///--->>> CONTAINERS <<<---///
using i64 = int64_t;
using ll = long long;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vector< ll > >;
using vpi = vector<pair<ll,ll> >;
using pi = pair<ll,ll>;
using st = set<ll>;
using stk = stack<ll>;
using kiwi = queue<ll>;
using pkiwi = priority_queue<ll>;
using mp = map<ll,ll>;
using ump = unordered_map<ll,ll>;

///--->>> MACROS<<<---///
const ll mx = 3e5+123;
#define MOD 1000000007
#define REP(i,n) for (ll i=1;i<=n;++i)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

///--->>>OPTIMIZE<<<---///
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

///--->>> DEBUGGER<<<---///
#define dbg(args...) do {cerr<<#args<<" : "; diraf(args); } while(0)
void diraf ()  {        cerr << endl;}
template < typename T, typename ... hello>void diraf( T arg, const hello &... rest) {cerr<<arg<< ' ';diraf(rest...);}

vi adj[mx];
bool visited[mx];

void dfs(ll src){
visited[src] = true;
    for(auto& kids: adj[src]){
        if(!visited[kids])
            dfs(kids);
    }
}

int main(int argc, char* argv[]){
    fastio;
    ll n, m, e, n1, n2, cnt=0; cin>>n>>m;
    while(m--)
        cin>>n1>>n2, adj[n1].emplace_back(n2), adj[n2].emplace_back(n1);
    for(ll i=1;i<=n;++i){
        if(visited[i]==0 && i!=1)
            dfs(i), cnt++;
        else if(!visited[i]) dfs(i);
    }
    cout<<cnt<<endl;
return 0;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  string res;
  for (int k = 0; k < (1 << ((int)S.size() - 1)); k++) {
    int a = S[0] - '0';
    res = S[0];
    for (int i = 0; i < (int)S.size() - 1; i++) {
      if ((k >> i) & 1) {
        a += S[i + 1] - '0';
        res = res + "+" + S[i + 1];
      } else {
        a -= S[i + 1] - '0';
        res = res + "-" + S[i + 1];
      }
    }
    if (a == 7) {
      cout << res << "=7" << '\n';
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::unordered_map;using std::unordered_set;using std::bitset;using std::pair;using std::set;using std::string;using std::vector;using std::sort;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}

const int N=3e5+5,B=60,M=1e9+7;
vector<pii> a[N];
int32_t main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;++i){
        int z;
        cin>>z;
        a[i].resize(z);
        for(pii&p:a[i])cin>>p.f>>p.s;
    }
    int ans=0;
    forn(mask,1<<n){
        int ok=1;
        for(int i=1;i<=n;++i){
            if(mask>>(i-1)&1){
                for(pii p:a[i]){
                    int j=p.f;
                    if(p.s){
                        ok&=(((mask>>(j-1))&1)==1);
                    }else{
                        ok&=(((mask>>(j-1))&1)==0);
                    }
                }
            }
        }
        if(ok)upx(ans,__builtin_popcount(mask));
    }
    cout<<ans<<'\n';

    return 0;
}


Measured memory_bytes: 7296
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	static Scanner sc = new Scanner(System.in);

	static class FastScanner {
		private final InputStream in;
		private final byte[] buffer = new byte[1024];
		private int ptr = 0;
		private int buflen = 0;

		public FastScanner(InputStream source) {
			in = source;
		}

		private boolean hasNextByte() {
			if (ptr < buflen) {
				return true;
			} else {
				ptr = 0;
				try {
					buflen = in.read(buffer);
				} catch (IOException e) {
					e.printStackTrace();
				}
				if (buflen <= 0) {
					return false;
				}
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte()) return buffer[ptr++];
			else return -1;
		}

		private static boolean isPrintableChar(int c) {
			return 33 <= c && c <= 126;
		}

		public boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
			return hasNextByte();
		}

		public String next() {
			if (!hasNext()) throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) throw new NoSuchElementException();
			long n = 0;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			if (b < '0' || '9' < b) {
				throw new NumberFormatException();
			}
			while (true) {
				if ('0' <= b && b <= '9') {
					n *= 10;
					n += b - '0';
				} else if (b == -1 || !isPrintableChar(b)) {
					return minus ? -n : n;
				} else {
					throw new NumberFormatException();
				}
				b = readByte();
			}
		}

		public int nextInt() {
			long nl = nextLong();
			if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
				throw new NumberFormatException();
			return (int) nl;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args){

		solve_abc161_b();
	}

  
  
	public static void solve_abc161_b(){

		FastScanner sc = new FastScanner(System.in);
		
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		int sum = 0;
		int[] a = new int[n];
		
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
			sum += a[i];
		}
		
		Arrays.sort(a);
		
		boolean ans = true;
		double d = (double)sum / (4.0 * (double)m);
		
		for(int i=n-1;i>n-1-m;i--){
			
			if((double)a[i] < d) ans = false;
		}

		if(ans) System.out.println("Yes");
		else System.out.println("No");
	}
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		sc.close();
		boolean ans = false;
		for (int i = 0; i < 9; i++) {
			for (int j = 0; j < 9; j++) {
				if (n == (i + 1) * (j + 1)) {
					ans = true;
				}
			}
		}
		System.out.println(ans ? "Yes" : "No");
	}

	public static int[] arrayInt(Scanner sc, int n) {
		int[] array = new int[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextInt();
		}
		return array;
	}

	public static long[] arrayLong(Scanner sc, int n) {
		long[] array = new long[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextLong();
		}
		return array;
	}

	public static double[] arrayDouble(Scanner sc, int n) {
		double[] array = new double[n];
		for (int i = 0; i < n; i++) {
			array[i] = sc.nextDouble();
		}
		return array;
	}
}


Measured memory_bytes: 23124
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

A,B,C,K = I()
if K%2 == 0:
    num = A-B
else:
    num = B-A
if abs(num) > 10**18:
    print('Unfair')
else:
    print(num)

Measured memory_bytes: 77344
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD 1000000007
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;
 
char S[505050]; int N;
int fail[505050], fail2[505050];
 
int kmp(int *feil)
{
	int m = strlen(S), i, j = feil[0] = -1;
	for (i = 0; i < m; ++i) {
		for (; ~j && S[j] != S[i]; j = feil[j]);
		feil[i + 1] = ++j;
	}
	return m;
}
 
bool isok(int i, int f)
{
	return i % (i - f) != 0 || f == 0;
}
 
int main()
{
	scanf("%s", S);
	N = strlen(S);
 
	kmp(fail);
 
	if (isok(N, fail[N])) {
		printf("1\n1\n");
		return 0;
	}
	if (N - fail[N] == 1) {
		printf("%d\n1\n", N);
		return 0;
	}
	reverse(S, S + N);
	kmp(fail2);
 
	int ret = 0;
	for (int i = 1; i < N; ++i) {
		if (isok(i, fail[i]) && isok(N - i, fail2[N - i])) {
			++ret;
		}
	}
	printf("%d\n%d\n", 2, ret);
	return 0;
}

Measured memory_bytes: 4608
N, D = map(int, input().split())
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力の

count = 0

for i in range(N):
    X, Y = map(int, input().split())
    if D**2 >= X**2+Y**2:
        count += 1

print(count)

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

int main() {
    int a, b, c;
    int k;
    int cnt = 0;
    cin >> a >> b >> c >> k;

    while (b <= a) {
        b *= 2;
        cnt++;
    } 
    while (c <= b) {
        c *= 2;
        cnt++;
    }

    if (k >= cnt) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cstring>

char s[11];
int a[10], n, m;

int main(){
	scanf("%s", s);
	n = strlen(s);
	m = 0;
	for(int i=0; i<n; i++){
		if(s[i]=='B'){
			if(m){
				m--;
			}
		} else {
			a[m++] = s[i]-'0';
		}
	}
	for(int i=0; i<m; i++)	putchar(a[i]+'0');
	putchar('\n');
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <climits>
#include <sstream>

using namespace std;

int main(){
  int A, B, C, D, ans;

  cin >> A >> B >> C >> D;

  if(C < A){
    if(D < A) ans = 0;
    else if(B < D) ans = B - A;
    else ans = D - A;

  }else if(B < C){
    ans = 0;

  }else{
    if(D < B) ans = D - C;
    else ans = B - C;
  }

  cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<cstdio>

#define LL long long
#define MAXN 100000
#define MOD 1000000007
LL fac[2*MAXN+5];
LL inv[2*MAXN+5];

LL Pow(LL x,LL p){
    LL ret=1;
    while(p){
        if(p&1)
            ret=ret*x%MOD;
        x=(x*x)%MOD;
        p>>=1;
    }
    return ret;
}

void Prep(int N){
    fac[0]=1;
    for(int i=1;i<=N;i++)
        fac[i]=fac[i-1]*i%MOD;
    //inv[fac[i]]=Pow(fac[i],MOD-2)=Pow(1,MOD-2)...Pow(i,MOD-2)
    //inv[fac[i-1]]=Pow(fac[i-1],MOD-2)=Pow(1,MOD-2)...Pow(i-1,MOD-2)=Pow(fac[i],MOD-2)/Pow(i,MOD-2)=inv[i]*i
    inv[0]=1;
    inv[N]=Pow(fac[N],MOD-2);
    for(int i=N-1;i>=1;i--)
        inv[i]=inv[i+1]*(i+1)%MOD;
}

LL C(int m,int n){
    return fac[m]*inv[n]%MOD*inv[m-n]%MOD;
}

int main(){
    int H,W,A,B;
    scanf("%d%d%d%d",&H,&W,&A,&B);
    Prep(H+W);
    LL Ans=0;
    for(int i=B+1;i<=W;i++){
        LL tmp1=C(H-A+i-2,i-1);
        //C(m+n-x-y-2,m-x-1)
        //(H-A,i) -> (H,W)
        LL tmp2=C(A+W-i-1,A-1);
        Ans=(Ans+(tmp1*tmp2)%MOD)%MOD;
    }
    printf("%lld",Ans);
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pair2;
typedef pair<int, pair<int, int> > pair3;
typedef pair<int, pair<int, pair<int, int> > > pair4;
#define MAXN 200013
#define INF 1000000000000000000LL
#define MOD 1000000007LL
#define IINF 1000000000
#define mp make_pair
#define pb push_back
#define remove pop
#define all(x) x.begin(), x.end()

int main() {
	if (fopen("FILENAME.in", "r")) {
		freopen("FILENAME.in", "r", stdin);
		freopen("FILENAME.out", "w", stdout);
	}
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);

	int a, b;

	cin >> a >> b;

	cout << max(0, a - 2 * b);
}

//GCD GCD GCD USE GCD IN MATH


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

using namespace std;

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

  long long n, W; cin >> n >> W;
  long long w[n], v[n];
  for(long long i = 0; i<n; ++i) cin >> w[i] >> v[i];

  vector<long long> dp(W+1, 0);
  set<long long> poss;
  poss.insert(0);
  long long ret = 0;
  for(long long i = 0; i<n; ++i) {
    set<long long> next = poss;
    auto it = poss.end();
    while(it != poss.begin()) {
      it--;
      long long ddpp = dp[*it];
      if(*it+w[i] <= W) {
        dp[*it+w[i]] = max(dp[*it+w[i]], ddpp+v[i]);
        ret = max(ret, dp[*it+w[i]]);
        next.insert(*it+w[i]);
      }
    }
    
    poss = next;
  }

  cout << ret << endl;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ull unsigned long long
#define ll long long
#define ld long double
#define PSET(x,y) fixed<<setprecision(y)<<x
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define lop(i,a,b) for(ll i=a;i<b;i++)
#define lopr(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define ff first
#define ss second
#define pi pair<int,int>
#define pll pair<ll, ll>
#define ti tuple<int,int>
#define tll tuple<ll, ll>
#define si set<int>
#define sll set<ll>
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll>,greater<ll>>
#define state tuple<int,int,int>
#define graph map<ll,list<ll>>

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld PI = asin(1) * 2;
inline int sbt(int x){return __builtin_popcount(x);} //returns number of set bits

using namespace std;

#define TRACE
#ifdef TRACE
#define deb(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');
        cerr.write(names, comma - names) << " : " << arg1<<" | ";
        __f(comma+1, args...);
    }
#else
#define deb(...)
#endif

const ll SIZE = 0;

int main(){
    // clock_t tStart = clock();
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    
    FastIO
    
    int n;
    cin>>n;

    int v[n], c[n];
    vector<pi> vec(n);
    lop(i,0,n) cin>>v[i];
    lop(i,0,n) cin>>c[i];
    
    lop(i,0,n)
    	vec[i] = mp(v[i],-1*c[i]);

	sort(all(vec));
	reverse(all(vec));

	int ans=0;
	lop(i,0,n){
		auto p  = vec[i];
		int cur = p.ff+p.ss;
		if(ans+cur>=ans)
			ans += cur;
	}

	cout<<ans;
    // printf("Time taken: %.6fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    na = list(map(int, input().split()))
    x1, y1, x2, y2 = na[0], na[1], na[2], na[3]

    x3, y3 = x2 - (y2 - y1), y2 + (x2 - x1)
    x4, y4 = x3 - (x2 - x1), y3 - (y2 - y1)

    print('{} {} {} {}'.format(x3, y3, x4, y4))


if __name__ == '__main__':
    main()



Measured memory_bytes: 3060
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <stdlib.h>
#include <set>
typedef long long ll;
using namespace std;

int main() {
	int a,b,c;
	cin>>a;
	if(a==1){
		cout<<"Hello World"<<endl;
	}else if(a==2){
		cin>>b>>c;
		cout<<b+c<<endl;
	}

	return 0;
}


Measured memory_bytes: 256
N = int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

hap = 0
for i in range(N):
  hap += B[i]
  if i<N-1 and A[i] + 1 == A[i+1]:
      hap += C[A[i]-1]

    
print(hap)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  int n, k; cin >> n >> k;
  vector<int> a(n, 0);
  for (int i = 0; i < k; i ++) {
    int d; cin >> d;
    for (int j = 0; j < d; j ++) {
      int t; cin >> t;
      t --;
      a[t] ++;
    }
  }

  int ans = 0;
  for (int i = 0; i < n; i ++) {
    if (a[i] == 0) ans ++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3632
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;
typedef long long int ll;
const ll mod = 1000000007;
const ll lim = 100000 + 1;

ll solve(void);

int main(void) {
	
	cout << solve() << endl;

	return 0;

}

ll solve(void) {

	ll N, T;
	cin >> N >> T;

	vector<ll> count(lim, 0);
	vector<ll> v(lim,0);
	vector<ll> w(lim, 0);
	vector<ll> num;

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

	for (int i = 0; i + 1 < lim; i++) {
		v[i + 1] += v[i] + count[i+1];
	}

	for (int i = T+1; i < lim; i++) {
		w[i] = v[i-T-1];
	}

	for (int i = 0; i < lim; i++)
		for( int j = 0; j < count[i]; j++)
			num.push_back(i);

	ll ans = 1;
	
	for (ll i = 1; i < num.size(); i++) {
		ll j = i + 1;
		ans = (ans * (j - w[num[i]])) % mod;
	}

	return ans;

}

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

int main(void) {
    long a, n, min, max;
    long sum = 0;
    
    cin >> n;
    
    cin >> a;
    max = a;
    min = a;
    sum += a;
    for(int i = 1; i < n; ++i) {
        cin >> a;
        if(a < min) {
            min = a;
        }
        if(a > max) {
            max = a;
        }
        sum += a;
    }
    
    cout << min << ' ' << max << ' ' <<  sum << endl;
    
    return 0;
}




Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<(int)n;i++)
const ll INF = (1LL<<60);
const int MOD = 1000000007;


int main(){
    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N){
        ll a; cin >> a;
        A[i] = -a;
    }

    vector<ll> dp(100010,INF);
    rep(i,N){
        *lower_bound(dp.begin(),dp.end(),A[i]+1) = A[i];
    }
    cout << lower_bound(dp.begin(),dp.end(),INF) - dp.begin() << endl;
}

Measured memory_bytes: 4836
#include<cstdio>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
typedef pair< int, int > Pi;
const int INF = 1 << 30;
int info[100][100];
bool used[100];

int prim(const int& V){
  fill_n( used, V, false);
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  que.push(Pi( 0, 0));
  int ret = 0;
  while(!que.empty()){
    Pi p = que.top();
    que.pop();
    if(used[p.second]++) continue;
    ret += p.first;
    for(int i = 0 ; i < V ; i++){
      if(~info[p.second][i]) que.push( Pi( info[p.second][i], i));
    }
  }
  return ret;
}

int main(){
  int N;
  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    for(int j = 0 ; j < N ; j++){
      scanf("%d", &info[i][j]);
    }
  }
  printf("%d\n", prim(N));
}

Measured memory_bytes: 1188
#include <iostream>
//#include <vector>
using namespace std;
int main() {
	int x, y;
	cin >> x >> y;
	char boxs[60][60] = {0}; //2次元表の作成・初期値に0を入力
	//追記:vectorなら  vector <vector <char>> boxs(60,vector <char>(60,0));
	for (int i = 0; i < x; i++) {
		for (int j = 0; j < y; j++) {
			cin >> boxs[i][j];						//表に値を代入
		}
	}
	for (int i = 0; i < x; i++) {					//縦
		for (int j = 0; j < y; j++) {				//横
			if (boxs[i][j] == '#') {
				cout << '#';						//配列の中身が#ならばそのまま#を入力し無視する。
			}
			else if(boxs[i][j] =='.'){				//空きマスかを確認（初期値を0としているため）
				int add=0;							//ボムの量をカウントするカウンターの作成
													//存在するなら値を１プラスする
				if (i != 0 && j != 0) {				//左上に配列が存在するならば左上が#か確認
					if (boxs[i - 1][j - 1] == '#') {
						add++;
					}
				}
				if (i != 0) {						//上に配列が存在するなら
					if (boxs[i - 1][j + 1] == '#') {//右上を確認
						add++;
					}
					if (boxs[i - 1][j] == '#') {	//上を確認
						add++;
					}
				}
				if (j !=0) {						//左が存在するならば
					if (boxs[i][j - 1]=='#') {		//左を確認
						add++;
					}
					if (boxs[i + 1][j - 1] == '#') {//左下を確認
						add++;
					}
				}
				if (boxs[i][j + 1] == '#') {		//右を確認
					add++;
				}
				if (boxs[i + 1][j] == '#') {		//下を確認
					add++;
				}
				if (boxs[i + 1][j+1] == '#') {		//右下を確認
					add++;
				}
				cout << add;						//値を出力
			}
		}
		cout << endl;								//改行を入力
	}
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(void)
{
    int a, b, c, maxn = 0, temp;

    scanf("%d %d %d", &a, &b, &c);

    if ((temp = a * 10 + b + c) > maxn)
        maxn = temp;
    if ((temp = b * 10 + a + c) > maxn)
        maxn = temp;
    if ((temp = c * 10 + a + b) > maxn)
        maxn = temp;

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

    return 0;
}


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  ll attack = 0;
  for (int i = N - K - 1; i >= 0; i--) {
    attack += H[i];
  }
  cout << attack << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	static int[] in, out;
	static boolean[][] edge;
	static boolean[] visited;
	
	static void dfs(int pos) {
		visited[pos]=true;
		for(int i=0; i<26; i++) {
			if(edge[pos][i] && !visited[i]) {
				dfs(i);
			}
		}
	}
	
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				int n=sc.nextInt();
				if(n==0) break;
				in=new int[26];
				out=new int[26];
				edge=new boolean[26][26];
				visited=new boolean[26];
				Arrays.fill(visited, true);
				String s="";
				for(int i=0; i<n; i++) {
					s=sc.next();
					int from=s.charAt(0)-'a';
					int to=s.charAt(s.length()-1)-'a';
					in[from]++;
					out[to]++;
					edge[from][to]=true;
					visited[to]=visited[from]=false;
				}
				boolean check=true;
				//1.有向グラフにおけるオイラーグラフ判定(出る次数と入る次数が同じならば良い)
				//	オイラーグラフとは･･･一筆書きしてもどってこれるグラフ
				//	(無向グラフでは全ての頂点の次数が偶数であればよい!?)
				for(int i=0; i<26; i++) {
					if(in[i]!=out[i]) {
						check=false;
						break;
					}
				}
				//2.閉路判定(全ての頂点を訪れているか判定)
				if(check) {
					dfs(s.charAt(0)-'a');
					for(int i=0; i<26; i++) {
						if(!visited[i]) {
							check=false;
							break;
						}
					}
				}
				System.out.println(check? "OK":"NG");
				
			}
			
		}
	}
}


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

int main(void){
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int val = n % 10;
  if (val == 2 or val == 4 or val == 5 or val == 7 or val == 9) cout << "hon" << endl;
  else if (val == 3) cout << "bon" << endl;
  else cout << "pon" << endl;
  return 0;
}



Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

using static Input;
using static Util;
class Program
{
    static int[] N;
    static void INPUT()
    {
        N = LineInt();
    }
    static void OUT()
    {
        
        Console.WriteLine(string.Format("{0} {1} {2}", N[2], N[0], N[1]));
    }
    static void Main(string[] args)
    {
#if DEBUG  
        //TESTINPUT();
        INPUT();

#else
        INPUT();
#endif
        OUT();
    }

    static void TESTINPUT()
    {
    }

}

public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}

class Util
{
    /// <summary>
    /// 素因数分解
    /// </summary>
    /// <param name="n"></param>
    /// <returns></returns>
    public static IEnumerable<long> PrimeFactor(long n)
    {
        var i = 2L;
        var tmp = n;

        while (i * i <= n)
        {
            if (tmp % i == 0)
            {
                tmp /= i;
                yield return i;
            }
            else
            {
                i++;
            }
        }
        if (tmp != 1) yield return tmp;
    }
}




Measured memory_bytes: 13268
n=int(input())
a=list(map(int,input().split()))
a = sorted(a)
def trian(a):
    n=len(a)
    res = 0
    for x in range(n):
        z=x+2
        for y in range(x+1,n):
            while(z<n and a[x]+a[y]>a[z]):
                z+=1
            res += z-y-1
    return res
print(trian(a))


Measured memory_bytes: 3188
#include<iostream>
#include<cstdio>
#include<cstring>

using namespace std;

int main()
{
    char S;
    int counterA = 0, counterB = 0;
    for(int i = 0 ; i < 3 ; i++)
    {
        scanf("%c", &S);
        if(S == 'A')
            counterA++;
        else
            counterB++;
    }

    if(counterA && counterB)
        printf("Yes\n");
    else
        printf("No");

    return 0;
}


Measured memory_bytes: 256
using System.Collections.Generic;
using System;

public class hello
{
    public static void Main()
    {
        var s = new Stack<int>();
        var acu = 0;
        string[] line = Console.ReadLine().Trim().Split(' ');
        for (int i = 0; i < line.Length; i++)
        {
            switch(line[i])
            {
                case "+":
                    acu = s.Pop();
                    acu += s.Pop();
                    s.Push(acu);
                    break;
                case "-":
                    acu = s.Pop();
                    acu -= s.Pop();
                    s.Push(-acu);
                    break;
                case "*":
                    acu = s.Pop();
                    acu *= s.Pop();
                    s.Push(acu);
                    break;
                default:
                    s.Push(int.Parse(line[i]));
                    break;
            }
        }
        Console.WriteLine(s.Pop());
    }
}

Measured memory_bytes: 10132
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  int c = a*b % 2;
  if ( c == 0 ) {
    cout << "Even" << endl;
  }
  else {
    cout << "Odd" << endl;
  }
}

Measured memory_bytes: 256
/* author   : mpily :-()
title : Competing.cpp
time :Sat Oct 19 15:14:39 2019

*/
#include<bits/stdc++.h>
using namespace std;
int main(){
	int A,B;
	cin>>A>>B;
	cout<<max(0,A-2*B)<<"\n";
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

typedef unsigned uint;
typedef long long Int;
typedef unsigned long long UInt;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }
int in() { int x; scanf("%d", &x); return x; }
double fin() { double x; scanf("%lf", &x); return x; }
Int lin() { Int x; scanf("%lld", &x); return x; }

char S[1024];

int main() {
  scanf("%s", S);
  const int N = strlen(S);

  if ((count(S, S + N, 'N') > 0) ^ (count(S, S + N, 'S') > 0)) {
    puts("No");
    return 0;
  }
  if ((count(S, S + N, 'E') > 0) ^ (count(S, S + N, 'W') > 0)) {
    puts("No");
    return 0;
  }
  puts("Yes");
  return 0;
}


Measured memory_bytes: 256