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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

const int MAX = 1e5+10;

int X, Y, A, B, C, P[MAX], Q[MAX], R[MAX];

ll solve() {
    priority_queue<ii> q;
    REP (i, A) q.push(ii(P[i], 1));
    REP (i, B) q.push(ii(Q[i], 2));
    REP (i, C) q.push(ii(R[i], 0));

    ll ans = 0;
    int Z = 0;
    while (X + Y - Z > 0) {
        int x = q.top().first, k = q.top().second;
        q.pop();
        if (k == 1) {
            if (X == 0) continue;
            X--;
            ans += x;
        } else if (k == 2) {
            if (Y == 0) continue;
            Y--;
            ans += x;
        } else {
            Z++;
            ans += x;
        }
    }
    return ans;
}

int main() {
    cin >> X >> Y >> A >> B >> C;
    REP (i, A) cin >> P[i];
    REP (i, B) cin >> Q[i];
    REP (i, C) cin >> R[i];
    cout << solve() << endl;
}

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

const int N = 1e5 + 5;

int n, a[N], m;

bool f[N];

int main(void) {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; ++ i) a[i] = 1;
	f[1] = true;
	while (m --) {
		int x, y; scanf("%d%d", &x, &y);
		-- a[x]; ++ a[y];
		if (f[x]) f[y] = true;
		if (a[x] == 0) f[x] = false;		
	}
	int num = 0;
	for (int i = 1; i <= n; ++ i) num += f[i];
	cout << num << endl;
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}    
#define N 100005


int main(){
    
    string s;
    cin>>s;

    int a=0,b=0;
    for(int i=0;i<3;i++)
    {
    	if(s[i]=='A') a++;
    	else b++;
    }
    if(a==3 or b==3)
    {
    	 cout<<"No"<<endl;
    }
    else
    {
    	 cout<<"Yes"<<endl;
    }


}

Measured memory_bytes: 256
from collections import deque

N,M = map(int,input().split())

G=[[] for i in range(N+1)]

for i in range(M):
    n,m=map(int,input().split())
    G[n].append(m)
    G[m].append(n)

visited=[0]*(N+1)
ans=0
def dfs(now, num_visited=0):
    global ans
    visited[now] = 1
    num_visited+=1
    
    if num_visited==N:
        ans+=1
    
    for i in G[now]:
        next=i
        if visited[next]!=1:dfs(next,num_visited)

    visited[now] = 0

dfs(1)
print(ans)

Measured memory_bytes: 3316
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<bitset>
#include<vector>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<iomanip>
#include <functional>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1 << 28;
//cout << fixed << std::setprecision(9)
//memset(a, 0, sizeof(a));
//--------------------------

static const int N = 100;

int main()
{
	int n;
	int p[N + 1];
	int m[N + 1][N + 1];

	cin >> n;

	for (int i = 1; i <= n; i++) {
		cin >> p[i - 1] >> p[i];
	}

	for (int i = 1; i <= n; i++) m[i][i] = 0;

	for (int l = 2; l <= n; l++)
		for (int i = 1; i <= n - l + 1; i++) {
			int j = i + l - 1;
			m[i][j] = (1 << 27);
			for (int k = i; k < j; k++) {
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}

	cout << m[1][n] << endl;

	return 0;
}

Measured memory_bytes: 1196
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(intl i=0;i<(intl)(n);i++)
#define Rep1(i,n) for(intl i=1;i<(intl)(n)+1;i++)
#define vec vector
#define fi first
#define se second
#define pub push_back
#define pob pop_back
#define SortA(v) sort(v.begin(), v.end())
#define SortD(v) sort(v.rbegin(), v.rend())
#define All(a) (a).begin(),(a).end()
using intl = int64_t;
using vi = vec<intl>;
using vvi = vec<vi>;
using pi = pair<intl,intl>;
using vpi = vec<pi>;
vec<intl> dx = {0, 1, 0, -1, 1, 1, -1, -1};
vec<intl> dy = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr intl INF = 9223372036854775807;


int main(){
  intl X,Y;
  cin >>X>>Y;
  if(Y%2 == 0 && (Y >= X * 2 &&  Y <= X *4)){
    cout <<"Yes";
  }
  else { cout << "No";}
}

  

Measured memory_bytes: 3640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();
            long rs = S.Count(c => c == 'R');
            long gs = S.Count(c => c == 'G');
            long bs = S.Count(c => c == 'B');
            long count = rs*gs*bs;

            for (var i = 0; i < N; i++)
            {
                for (var j = 1; j < N; j++)
                {
                    var ll = i - j;
                    var rr = j + i;
                    if (!(0 <= ll && ll < N && 0 <= rr && rr < N)) continue;
                    if (!(S[ll] != S[i] && S[rr] != S[i] && S[ll] != S[rr])) continue;
                    count--;
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 18468
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef ll Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<double,int,double> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
ll MOD=1000000007;
int main(){
	int n;
	cin>>n;
	string s,t;
	cin>>s>>t;
	vi dp(2);
	rep(i,n){
		vi ndp(2);
		if(s[i]==t[i]){
			if(i==0)ndp[0]=3;
			else ndp[0]=(dp[0]*2+dp[1])%MOD;
		}else{
			if(i==0)ndp[1]=6;
			else ndp[1]=(dp[0]*2+dp[1]*3)%MOD;
			i++;
		}
		dp=ndp;
	}
	cout<<(dp[0]+dp[1])%MOD<<endl;
}









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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            double input = double.Parse(Console.ReadLine());
            for(double i = 100; i <= input; i = i * 1.01)
            {
                count++;
                i = Math.Floor(i);
            }
            Console.WriteLine(count);
            Console.Read();
        }
    }
}


Measured memory_bytes: 27332
function main(arg) {
  const array = arg.trim().split("\n");
  const S = array[0];
  const T = array[1];

  if (S == T) {
    console.log(0);
    return;
  }

  let counter = 0;
  for (let i = 0; i < S.length; i++) {
    if (S[i] != T[i]) {
      counter++;
    }
  }
  console.log(counter);
}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
// main("apple\napple");
//https://atcoder.jp/contests/abc167/tasks/abc167_b


Measured memory_bytes: 33000
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
const ll MOD = (ll)1e9+7;
const ll INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

int main(){
	int n;
	cin >> n;
	vector<ll> line(n*3);
	foreach(i, line){
		cin >> i;
	}

	ll lsum = 0;
	ll rsum = 0;
	multiset<ll> ls, rh, rl;
	rep(i, n){
		lsum += line[i];
		ls.insert(line[i]);
	}
	for(int i=n;i<3*n;++i){
		rh.insert(line[i]);
	}
	rep(i, n){
		ll d = *rh.begin();
		rsum += d;
		rh.erase(rh.begin());
		rl.insert(d);
	}
	ll ans = lsum - rsum;
	for(int i=n;i<2*n;++i){
		lsum += line[i];
		ls.insert(line[i]);
		ll d = *ls.begin();
		ls.erase(ls.begin());
		lsum -= d;
		if(rh.count(line[i])){
			rh.erase(rh.find(line[i]));
		}else{
			rsum -= line[i];
			rl.erase(rl.find(line[i]));
			d = *rh.begin();
			rh.erase(rh.begin());
			rl.insert(d);
			rsum += d;
		}
		chmax(ans, lsum - rsum);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 16640
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<pi,null_type,less<pi>,rb_tree_tag,tree_order_statistics_node_update> indexed_set_pair;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)1e3+5;
const int Q = 102;
const int logN = 19;

const double pie = acos(-1);

void solve() {
  int n;
  cin>>n;
  vector<ll> a(n+2);
  a[0] = INT_MAX;
  a[n+1] = INT_MIN;
  ll amount = 1000, maxAmount = 1000;
  REP(i,1,n) {
    cin>>a[i];
  }
  ll cntStockPossessed = 0;
  REP(i,1,n) {
    if(cntStockPossessed) {
      if(a[i]>=a[i-1] && a[i]>a[i+1]) {
        amount += (cntStockPossessed * a[i]);
        cntStockPossessed = 0;
        maxAmount = max(maxAmount, amount);
      }
    } else {
      if(a[i]<=a[i-1] && a[i]<a[i+1]) {
        cntStockPossessed = amount / a[i];
        amount %= a[i];
      }
    }
  }
  cout<<maxAmount;
}
int main() {
    //freopen("./sort/b2.in","r",stdin);
    //freopen("output.txt","w",stdout);

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
#define endl			"\n"
#define ll				long long
#define all(v)			((v).begin()), ((v).end())
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)
#define vi				vector <int>
#define vl				vector <ll>
#define ii				pair <ll,ll>
#define vii				vector <ii>
#define ull				unsigned long long
const double PI = 2 * acos(0.0);
void run() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
}
void solve() {
	string s;
	cin >> s;
	int n = sz(s);
	string sub1 = s.substr(0, n / 2);
	string sub2 = s.substr((n + 1) / 2, n / 2);
	string rev1 = sub1, rev2 = sub2, rev = s;
	reverse(all(rev1));
	reverse(all(rev2));
	reverse(all(rev));
	if (rev == s && rev1 == sub1 && rev2 == sub2) {
		cout << "Yes" << endl;
	} else
		cout << "No" << endl;

}
int main() {
	run();
	int t = 1;
	///cin>>t;
	while (t--)
		solve();
	return 0;
}


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

int main() {
  string s_abc = "abcdefghijklmnopqrstuvwxyz";
  set<char> set_abc(s_abc.begin(), s_abc.end()); 
  string S;
  cin >> S;
  set<char> set_S(S.begin(), S.end());
  set<char> set_diff;
  set_difference(
      s_abc.begin(), s_abc.end(),
      set_S.begin(), set_S.end(),
      inserter(set_diff, set_diff.end()));
  vector<char> vec(set_diff.begin(), set_diff.end());
  sort(vec.begin(), vec.end());
  if (vec.empty()) {
    cout << "None" << endl;
  } else {
    cout << vec[0] << endl;
  }
}


Measured memory_bytes: 512
def main():
    a, b, c, x = [int(input()) for _ in range(4)]
    coins = ((500, a), (100, b), (50, c))

    print(solve(coins, x))

def solve(coins, x):
    if len(coins) == 1:
        if coins[0][0] * coins[0][1] >= x and x % coins[0][0] == 0:
            return 1
        else:
            return 0

    t = 0
    for i in range(coins[0][1] + 1):
        r = x - coins[0][0] * i
        if r >= 0:
            t += solve(coins[1:], r)

    return t

main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	vector<int>a1(n), a2(n);
	for(int i = 0; i < n; i++){
		cin >> a1[i];
	}
	for(int i = 0; i < n; i++){
		cin >> a2[i];
	}
	//iはどこまでa1を足すかを表す
	int ans = 0;
	for(int i = 0; i < n; i++){
		int ans_temp = 0;
		for(int j = 0; j <= i; j++){
			ans_temp += a1[j];
		}
		for(int j = i; j < n; j++){
			ans_temp += a2[j];
		}
		ans = max(ans, ans_temp);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
from itertools import compress

H, W = map(int, input().split())
grid = [input() for _ in range(H)]

nonwhiterow = [any(c == '#' for c in row) for row in grid]
nonwhitecol = [any(row[i] == '#' for row in grid) for i in range(W)]

for row in compress(grid, nonwhiterow):
    comp = compress(row,  nonwhitecol)
    print(''.join(comp))


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

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

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun main ()
  (let* (lst)
    (dotimes (i 6) (push (read) lst))
    (if (or (= 3 (count 1 lst))
            (= 3 (count 2 lst))
            (= 3 (count 3 lst))
            (= 3 (count 4 lst)))
        (println "NO")
        (println "YES"))))

#-swank(main)


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

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

	vector<int> h(n + 1), c(n + 1, 0);

	for(int i = 1; i <= n; i++) {
		cin >> h[i];
	}


	for(int i = n - 1; i > 0; i--) {
		if(h[i+1] <= h[i]) c[i] = c[i+1] + 1;
		else c[i] = 0;
	}



	int ans = 0;
	for(int i = 0; i <= n; i++) {
		ans = max(ans, c[i]);
	}

	cout << ans;
	
	return 0;
}

Measured memory_bytes: 1024
#include <vector>
#include <cstdio>
using namespace std;
class union_find{
	int *parent,n;
public:
	union_find(int _n){n=_n;parent=new int[n+1];for(int i=1;i<=n;i++)parent[i]=i;}
	~union_find(){delete []parent;}
	int root(int a){return parent[a]==a?a:(parent[a]=root(parent[a]));}
	int unite(int a,int b){
		int x=root(a),y=root(b);
		if(x==y)return 0;
		parent[x]=y;
		return 1;
	}
};
int main(){
	int N,M;
	scanf("%d%d",&N,&M);
	union_find uf(M);
	vector<int>v(M+1);
	for(;N--;){
		int n,x,y;
		scanf("%d%d",&n,&x);
		v[x]++;
		n--;
		for(;n--;){
			scanf("%d",&y);
			uf.unite(x,y);
			v[y]++;
		}
	}
	int root=-1;
	for(int i=1;i<=M;i++){
		if(v[i]){
			if(root<0)root=uf.root(i);
			else if(root!=uf.root(i)){puts("NO");return 0;}
		}
	}
	puts("YES");
}

Measured memory_bytes: 1152
#include<cstdio>
#define get(x) ((x)^((x)>>1))
using namespace std;
const int maxs=1<<17|5;
int n,m,A,B,ans[maxs];
int cnt(int x){int ret=0;while(x) x-=x&-x,ret++;return ret;}
inline void add(int&x,int&y,int L){x|=(y&1)<<L;y>>=1;}
int main(){
	scanf("%d%d%d",&n,&A,&B);B^=A;
	int n1=cnt(B),n2=n-n1;
	if(!(n1&1)) return puts("NO")&0;
	puts("YES");
	for (int i=0,si=1<<n1;i<si;i++){
		int now=0,s=i;
		for (int j=1<<n1-1;s;j>>=2) if(s&j){
			now|=j|(j>>1)*((s+3&3)>>1);
			s=(s^j)>>1;
		}else{now|=get(s);break;}
		for (int j=0,sj=1<<n2;j<sj;j++){
			int x=now,y=get(i&1?sj-1-j:j);
			for (int k=0;k<n;k++)
			add(ans[m],B&(1<<k)?x:y,k);
			m++;
		}
	}
	for (int i=0,si=1<<n;i<si;i++)
	printf("%d ",ans[i]^A);
	putchar('\n');
	return 0;
}

Measured memory_bytes: 1408
//   PIGMEISTER™   //

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

#define ll long long
#define sidha(i,x,n) for(ll i=(ll)(x);i<(ll)(n);++i)
#define ulta(i,x,n) for(ll i=(ll)(x);i>=(ll)(n);--i)
#define sab(a) a.begin(),a.end()
#define bas(a) a.rbegin(),a.rend()
#define test ll _;cin>>_;while(_--)
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD (ll)1000000007
//#define MOD (ll)998244353
#define MAX 100005

int main()
{
    jaldi;
    
    ll x;
    cin >> x;

    ll ans = 0, y = 100;
    while (y < x) {
        y += y/100;
        ++ans;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <queue>

int main()
{
	int n, q; std::cin >> n >> q;
	
	std::priority_queue<int>* que = new std::priority_queue<int>[n];
	
	;
	for (int i=0; i<q; i++) {
		int op, x, t;
		std::cin >> op;
		switch (op) {
		case 0:
			std::cin >> t >> x;
			que[t].push(x);
			break;
		case 1:
			std::cin >> t;
			if (!que[t].empty()) std::cout << que[t].top() << std::endl;
			break;
		case 2:
			std::cin >> t;
			if (!que[t].empty()) que[t].pop();
			break;
		}
	}
	
	delete[] que;
	
	return 0;
}
		



Measured memory_bytes: 4024
A,B,C,X,Y = map(int, input().split())

l = []

#パターン１ AとBだけ作るとき
price1 = A * X + B * Y
l.append(price1)

#パターン2 AB分割とあまり調整
if X > Y:
    if A < 2*C:
        price2 = 2 * Y * C + A * abs(X-Y)
        l.append(price2)
    else:
        price3 = 2 * Y * C + C * abs(X-Y) * 2
        l.append(price3)
elif X < Y:
    if B < 2*C:
        price4 = 2 * X * C + B * abs(Y-X)
        l.append(price4)
    else:
        price5 = 2 * X * C + C * abs(Y-X) * 2
        l.append(price5)

else:
    price6 = 2 * X * C
    l.append(price6)


print(min(l))

Measured memory_bytes: 9104
#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 pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    ll A, B, N;
    cin >> A >> B >> N;
    ll res = ((A*N)/B- A*(N/B));
    ll n = N/B;

    n = (n-1)*B + B-1;
    if (n<=N)
        res = max(res,(A*n)/B - A*(n/B));
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3636
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// ReSharper disable PossibleNullReferenceException
// ReSharper disable AssignNullToNotNullAttribute

namespace ProCon
{
    internal class Program
    {
        private static List<int>[] _link;
        private static int[] _group;

        private static void Main(string[] args)
        {
            var nmk = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = nmk[0];
            var m = nmk[1];
            var k = nmk[2];
            _link = new List<int>[n];
            _group = new int[n];
            var hate = new List<int>[n];
            for (int i = 0; i < n; ++i)
            {
                _link[i] = new List<int>();
                hate[i] = new List<int>();
                _group[i] = -1;
            }

            for (int i = 0; i < m; ++i)
            {
                var ab = Console.ReadLine().Split(' ').Select(tmp=>int.Parse(tmp)-1).ToArray();
                _link[ab[0]].Add(ab[1]);
                _link[ab[1]].Add(ab[0]);
            }
            for (int i = 0; i < k; ++i)
            {
                int[] cd =  Console.ReadLine().Split(' ').Select(tmp=>int.Parse(tmp)-1).ToArray();
                hate[cd[0]].Add(cd[1]);
                hate[cd[1]].Add(cd[0]);
            }

            int groupId = 0;
            int[] groupMemberNum = new int[n];
            for (int i = 0; i < n; ++i)
            {
                if (_group[i] != -1) continue;
                groupMemberNum[groupId] = Visit(i, groupId);
                groupId++;
            }
            var suggest = new int[n];
            for (int i = 0; i < n; ++i)
            {
                var g = _group[i];
                suggest[i] = groupMemberNum[g]-1-_link[i].Count- hate[i].Count(tmp => _group[tmp] == g);
            }
            Console.WriteLine(string.Join(" ", suggest.Select(tmp=>tmp.ToString())));
        }

        private static int Visit(int idx, int group)
        {
            if (_group[idx] != -1) return 0;
            int num = 1;
            _group[idx] = group;
            foreach (var l in _link[idx])
            {
                num+=Visit(l, group);
            }
            return num;
        }
    }
}


Measured memory_bytes: 66236
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	a = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

vector<int> g[225816];
int d[225816];
queue<int> q;

int main(void){
	int n,i,a,b,r=-INF;
	cin >> n;
	for(i=1; i<n; ++i){
		cin >> a >> b;
		--a; --b;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	q.push(0);
	fill(d,d+n,INF);
	d[0] = 0;
	while(!q.empty()){
		b = q.front();
		q.pop();
		for(i=(g[b].l_ength()-1); i>=0; --i){
			if(d[g[b][i]]>d[b]+1){
				d[g[b][i]] = d[b]+1;
				if(d[g[b][i]] > d[a]){
					a = g[b][i];
				}
				q.push(g[b][i]);
			}
		}
	}
	q.push(a);
	fill(d,d+n,INF);
	d[a] = 0;
	while(!q.empty()){
		b = q.front();
		q.pop();
		for(i=(g[b].l_ength()-1); i>=0; --i){
			if(d[g[b][i]]>d[b]+1){
				d[g[b][i]] = d[b]+1;
				q.push(g[b][i]);
			}
		}
	}
	for(i=0; i<n; ++i){
		r = max(r,d[i]);
	}
	cout << ((r%3==1)?"Second":"First") << endl;
	return 0;
}


Measured memory_bytes: 14196
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int a, b;

int main()
{
	scanf ("%d %d", &a, &b);
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)	printf ("Possible\n");
	else printf ("Impossible\n");
}

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

int main(){
  char c1,c2,c3,c4,c5,c6;
  cin >> c1 >> c2 >> c3 >> c4 >> c5 >> c6;
  if(c1 == c6 && c2 == c5 && c3 == c4)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
 
using namespace std;
int main(void){
    long long N, count = 0, result = 0;
    char tmp[11];
    queue<long> q;

    scanf("%lld", &N);
    vector<string> S(N);

    for(auto &e : S){
        scanf("%s", tmp);
        e = tmp;
        sort(e.begin(), e.end());
    }

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

    auto set = [&](){
        if(count != 0){
            q.push(count + 1);
            count = 0;
        }
    };

    for(auto itr = S.begin(); itr != S.end() - 1; itr++){
        if(*itr == *(itr + 1))
            count++;
        else 
            set();
    }
    set();



    while(!q.empty()){
        result += q.front() * (q.front() - 1) / 2;
        q.pop();
    }

    cout << result << endl;
}

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

int main() {
	string s;
	cin >> s;
	vector<string>w = {"SUN","MON","TUE","WED","THU","FRI","SAT"};
	int x = 0;
	for (int i = 0; i < w.size(); i++)if (s == w.at(i))x = i;
	x = 0 - x + 7;
	cout << x << endl;
}

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

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

  int N; cin >> N;
  int M; cin >> M;
  string ans = "No";
  if (M == N) ans = "Yes";
  cout << ans << '\n';
  return 0;
}

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

using namespace std;

int main(){
	ios_base::sync_with_stdio (false);
	cout << fixed;
	cout.precision(10);
	if(fopen("joke.in", "r")){
		freopen ("joke.in","r",stdin);
		freopen ("joke.out","w",stdout);
	}

	int n, m;
	cin >> n >> m;

	vector<long long> a(m);
	vector<int> masks(m);
	for(int i = 0; i < m; ++i){
		int b;
		cin >> a[i] >> b;
		int mask = 0;
		for(int j = 0; j < b; ++j){
			int c;
			cin >> c;
			c--;
			mask |= 1UL << c; 
		}
		masks[i] = mask;
	}

	vector<vector<long long>> dp(m + 1, vector<long long>((1 << n) + 1, 1e18));

	dp[0][masks[0]] = a[0];
	for(int i = 1; i < m; ++i){
		dp[i][masks[i]] = min(dp[i][masks[i]], a[i]);
		for(int j = 0; j < (1 << n); ++j){
			int newmask = j | masks[i];
			dp[i][j] = min(dp[i][j], dp[i - 1][j]);
			dp[i][newmask] = min({dp[i][newmask], dp[i - 1][newmask], dp[i - 1][j] + a[i]});
		}
	}

	long long res = dp[m - 1][(1 << n) - 1];
	cout << (res == 1e18 ? -1 : res);
    return 0;
}


Measured memory_bytes: 32384
#include <math.h>

#include <algorithm>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int, int>;

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

  if (a == 'A' || a == 'B' || a == 'C' || a == 'D' || a == 'E' || a == 'F' ||
      a == 'G' || a == 'H' || a == 'I' || a == 'J' || a == 'K' || a == 'L' ||
      a == 'M' || a == 'N' || a == 'O' || a == 'P' || a == 'Q' || a == 'R' ||
      a == 'S' || a == 'T' || a == 'U' || a == 'V' || a == 'W' || a == 'X' ||
      a == 'Y' || a == 'Z')
    cout << "A";
  else
    cout << "a";
  return 0;
}


Measured memory_bytes: 3588
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<string.h>
#include <iomanip>
#include <sstream>
using namespace std;

int main() {
  int n, M;
  double ans = 0.0;
  string s;

  cin >> n;
  double N = (double)n;
  if(n%2 == 0){
    ans = (double)N/2.0/(double)N;
  }else if(n == 1){
    ans = 1;
  }else{
    ans = ((double)N/2.0+0.5)/(double)N;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int p=1e9+7;
int N,a[25][25],f[25][1<<21];
bool vis[25][1<<21];
int Add(int &x,const int &y){(x+=y)>=p?x-=p:0;}
int dfs(int n,int s)
{
	if(!n)return s==0;
	if(vis[n][s])return f[n][s];
	vis[n][s]=1;
	for(int i=1;i<=N;++i){
		if(!a[n][i])continue;
		int ss=s&(~(1<<(i-1)));
		if(ss!=s)Add(f[n][s],dfs(n-1,ss));
	}
	return f[n][s];
}
int main()
{
	scanf("%d",&N);
	for(int i=1;i<=N;++i)
		for(int j=1;j<=N;++j)
			scanf("%d",&a[i][j]);
	printf("%d\n",dfs(N,(1<<N)-1));
	return 0;
}

Measured memory_bytes: 209024
#include <bits/stdc++.h>
using namespace std;
int main(){
    string inp;
    cin >> inp;
    if(inp=="SUN"){
        cout << 7;
    }
    else if(inp=="MON"){
        cout << 6;
    }
    else if(inp=="TUE"){
        cout << 5;
    }
    else if(inp=="WED"){
        cout << 4;
    }
    else if(inp=="THU"){
        cout << 3;
    }
    else if(inp=="FRI"){
        cout << 2;
    } 
    else{
        cout<< 1;
    }  
    return 0;
}

Measured memory_bytes: 256
from collections import deque

N,M,K=map(int,input().split())
Sn=[0]*N
Sm=[0]*N
Sk=[0]*N
S=[0]*N

friend=[[] for _ in range(N)]
for i in range(M):#連結数,友達数
    A,B=map(int,input().split())
    Sm[A-1]+=1
    Sm[B-1]+=1
    
    friend[A-1].append(B-1)
    friend[B-1].append(A-1)



label=[-1]*N
for i in range(N):
    if label[i]==-1:
        label[i]=i
        F=deque(friend[i])
        while F:
            F0=F.pop()
            if label[F0]==-1:
                Sn[i]+=1
                label[F0]=i
                for ii in friend[F0]:
                    if label[ii]==-1:
                        F.append(ii)
    else:
        Sn[i]=Sn[label[i]]

for i in range(K):#ブロック数
    C,D=map(int,input().split())
    if label[C-1]==label[D-1]:
        Sk[C-1]+=1
        Sk[D-1]+=1

for i in range(N):
    S[i]=str(Sn[i]-Sm[i]-Sk[i])

print(' '.join(S))

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

#define int long long
#define rep(i,n) for(int i=0; i<(n); i++)
#define lep(j,n) for(int j=0; j<(n); j++)
#define reps(i,n) for(int i=1; i<=(n); i++)
#define leps(j,n) for(int j=1; j<=(n); j++)


using namespace std;
signed main(){

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


    // 入力, キューにまずは順に要素を追加します
    int N;
    int Q; // クオンタム
    cin >> N >> Q;
    queue<pair<string,int> > que;
    for (int i = 0; i < N; ++i) {
        string name;
        int time;
        cin >> name >> time;
        que.push(make_pair(name, time));
    }

    // ラウンドロビンスケジーリング   
    int cur_time = 0;
    while (!que.empty()) {
        long long a = que.front().second;
        string b = que.front().first;
        que.pop();

        // Q 秒以上かかるとき、Q 秒処理してまたキューに追加>
        if(a>Q){
            cur_time += Q;
            a -= Q;
            que.push(make_pair(b,a));
        }
        // Q 秒以内に終了するときは、処理を終えてプログラムを出力する
        else {
            cur_time += a;
            cout << b << " " << cur_time << endl;
        }
    }
}



Measured memory_bytes: 6348
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll x, a;
  in2(x, a);
  if(x < a)
    out(0);
  else
    out(10);
  memi;
}

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

struct segtree{
  int size;
  vector<int> add;
  segtree(int n){
    size = 1;
    while(size<n) size *= 2;
    add.assign(2*size-1,0);
  }
  void update(int a,int b,int x,int k,int l,int r){
    if(a<=l&&r<=b) add[k] += x;
    else if(b<=l||r<=a) return;
    else{
      update(a,b,x,2*k+1,l,(l+r)/2);
      update(a,b,x,2*k+2,(l+r)/2,r);
    }
  }
  void update(int a,int b,int x){update(a-1,b,x,0,0,size);}
  int query(int i,int k,int l,int r){
    if(i<l||r<=i) return 0;
    int ret = 0;
    if(l<=i&&i<r) ret += add[k];
    if(k<size-1) ret += query(i,2*k+1,l,(l+r)/2) + query(i,2*k+2,(l+r)/2,r);
    return ret;
  }
  int query(int i){return query(i-1,0,0,size);}
};

int main(){
  int n,q;
  scanf("%d %d",&n,&q);
  segtree st(n);
  for(int i=0;i<q;i++){
    int cmd;
    scanf("%d",&cmd);
    if(cmd==0){
      int s,t,x;
      scanf("%d %d %d",&s,&t,&x);
      st.update(s,t,x);
    }else if(cmd==1){
      int i;
      scanf("%d",&i);
      printf("%d\n",st.query(i));
    }
  }
  return 0;
}

Measured memory_bytes: 3408
import sys
readline = sys.stdin.buffer.readline

def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    now=1
    flg = 0
    path = [1]
    pathcheck ={1}
    for i in range(k):
        now = a[now-1]
        if now in pathcheck:
            flg = -1
            path.append(now)
            break
        path.append(now)
        pathcheck.add(now)


    if flg == 0:
        print(now)
        exit()

    x1 = path.index(now)
    x2 = len(path)-1
    x3 = (k-x1)%(x2-x1)
    print(path[x1+x3])

if __name__ == '__main__':
    main()

Measured memory_bytes: 32256
#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 (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

#define INF INT_MAX/3
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define SET(a,c) memset(a,c,sizeof a)
#define CLR(a) memset(a,0,sizeof a)
#define PII pair<int,int>
#define PCC pair<char,char>
#define PIC pair<int,char>
#define Pci pair<char,int>
#define VS vector<string>
#define VI vector<int>
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define PI 2*acos(0.0)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE() freopen("out0.txt","w",stdout)
#define IN scanf
#define OUT(x) cout<<x<<endl
#define LL long long
#define ll long long
#define ULL unsigned long long
#define EPS 1e-14
#define FST first
#define SEC second

#include<iostream>
#include<climits>

using namespace std;
int main()
{
  // 入力
  int N;
  cin >> N;
  int a[N];
  REP(i,N){
      cin >> a[i];
  } 

  int last_sum = INF;
  FOR(i,-100,101) {
    int sum = 0;
    REP(j, N){
      sum += (i - a[j]) * (i - a[j]);
    }
    if(last_sum < sum) break;
    last_sum = sum;
  }
  OUT(last_sum);
  return 0;
}


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

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

const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main()
{
    ll n, p;
    cin >> n >> p;
    
    if (p == 1) {
        cout << 1 << endl;
        return 0;
    }

    if (n == 1) {
        cout << p << endl;
        return 0;
    }

    vector <int> a(1000000, 0);

    for (ll i = 2; i <= 1000000; i++) {
        if (p % i != 0) continue;
        ll cnt = 0;
        while (p % i == 0) {
            cnt++;
            p /= i;
        }
        a[i] = cnt;
    }
    ll ans = 1;
    for (ll i = 2; i <= 1000000; i++) {
        if (a[i] >= n) ans *= pow(i, a[i] / n);
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 4096
n, y = map(int, input().split())
swi = 0

for a in range(2001):
    b = (y - 1000 * n - 9000 * a) // 4000
    c = n - a - b
    if a + b + c == n and 10000 * a + 5000 * b + 1000 * c == y and a >= 0 and b >= 0 and c >= 0:
        print(a, b, c)
        swi = 1
        break
if swi == 0:
    print(-1, -1, -1)

    

Measured memory_bytes: 3060
public class Main {
	public static void main(String[] args) {
		try (java.util.Scanner sc = new java.util.Scanner(System.in)) {
			int S = sc.nextInt();
			int h = S / 3600;
			S = S - h * 3600;
			int m =  S / 60;
			int s = S - m * 60;
			System.out.println(h + ":" + m + ":" + s) ;
		}
	}
}


Measured memory_bytes: 26344
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long int x;
  cin >> x;
  
  if(x <= 599) cout << 8 << endl;
  else if(799 >= x) cout << 7 << endl;
  else if(999 >= x) cout << 6 << endl;
  else if(1199 >= x) cout << 5 << endl;
  else if(1399 >= x) cout << 4 << endl;
  else if(1599 >= x) cout << 3 << endl;
  else if(1799 >= x) cout << 2 << endl;
  else cout << 1 << endl;
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
*this << "[";
for (auto it = d.b; it != d.e; ++it)
*this << ", " + 2 * (it == d.b) << *it;
ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define cool ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int  long long int
#define pb push_back
#define fe first
#define lb lower_bound 
#define ub upper_bound
#define pii pair<pair<int,int>,pair<int,int> >
#define se second
#define endl "\n"
#define pi pair<int, int>
#define mi          map<int,int>
#define mii         map<pi,int>
#define vi vector<int> 
#define vvi vector<vi>
#define bs   binary_search
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i<=b;i++)	
#define all(c) (c).begin(),(c).end()
#define sz(x)       (int)x.size() 
#define PI 3.14159265358979323846

 const int N=5e5+5;

 int mod= 1e9+7;
 int dx[4]={0,0,+1,-1};
 int dy[4]={+1,-1,0,0};  
 
 
int po(int a, int b) {
	a %= mod;
	int res = 1;
	while (b > 0) {
		if (b & 1)
			res = (res * a) % mod;
		a =(a*a) % mod;
		b >>= 1;
	}
	 return res;	
   }



void solve() {
   int n,m;
   cin>>n>>m;
   
   vi a(n,0);
   int sum=0;
   rep(i,0,n) {
	   cin>>a[i];
	   sum+=a[i];
   }
   
   int cnt=0;
   rep(i,0,n) {
	      if((a[i]*4*m)>=sum ) {
			    cnt++;
			  }
		  if(cnt==m) {
			     cout<<"Yes\n";
			     return;
			     
			  }	  
	   }
	   
	   cout<<"No\n";
   
      
              
}

    
int32_t main() {
	cool;
	int t=1;	

	//cin>>t;
	while(t--)
	  solve();

  return 0;	   
}


Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long
#define inf 1010000000
#define infll 1010000000000000000ll
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mpr make_pair
#define fi first
#define se second
#define vi vector<int>
#define pb push_back
#define mod 1000000007
#define ad(x,y) (x=(x+(y))%mod)
#define up(x,y) (x<(y)?x=(y):0)
#define dn(x,y) (x>(y)?x=(y):0)
#define N 200009
using namespace std;

int H,W,n,sr,sc; char a[N],b[N];
void gg(){ puts("NO"); exit(0); }
int main(){
	scanf("%d%d%d%d%d%s%s",&H,&W,&n,&sr,&sc,a+1,b+1);
	int i;
	int l=1,r=W,u=1,d=H;
	for (i=n; i; i--){
		if (b[i]=='L') r++; if (b[i]=='R') l--;
		if (b[i]=='U') d++; if (b[i]=='D') u--;
		up(l,1); up(u,1); dn(d,H); dn(r,W);
		if (a[i]=='L') l++; if (a[i]=='R') r--;
		if (a[i]=='U') u++; if (a[i]=='D') d--;
		if (l>r || u>d) gg();
	}
	if (sr<u || sr>d || sc<l || sc>r) gg(); puts("YES");
	return 0;
}


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

using namespace std;

int main(){

    long long int i,j,n,k,l;

    cin>>n;

    long long int a[n],b[n];

    for(i=0;i<n;i++){
        cin>>a[i];
        b[i]=0;
    }

    for(i=1;i<n;i++){

        if(i==1)
            b[i]=max(a[i],a[i-1])-min(a[i],a[i-1]);
        else{
            b[i]=min((b[i-1]+max(a[i],a[i-1])-min(a[i],a[i-1])),(b[i-2]+max(a[i],a[i-2])-min(a[i],a[i-2])));
        }
    }

    cout<<b[n-1]<<"\n";

    return 0;
}


Measured memory_bytes: 1792
#! coding utf-8

n, k, s = map(int, input().split())

padnum = 10**9 if s != 10**9 else 1


for i in range(k):
    print(s, end=" ")

for i in range(n-k):
    print(padnum, end=" ")

# # print(h, w, n)
# # print(n//h+1, n//w+1)
# ret = min(ceil(n/h), ceil(n/w))

# print(ret)


Measured memory_bytes: 4340
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define all(a) (a).begin(), (a).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int MOD = 1e9+7;
const ll LINF = 1e18;
const int INF = 1e9;
ll A, B, C, D, E, F, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S, T;

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);
}

int main()
{
    cin >> N;
    cout << lcm(2,N);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 10000
#define NIL -1

typedef struct {
    int p,l,r;
} Node;

Node T[MAX];
int n;

void preParse(int u){
    if(u==NIL) return;
    printf(" %d",u);
    preParse(T[u].l);
    preParse(T[u].r);
    
}

void inParse(int u){
    if(u==NIL)return;
    inParse(T[u].l);
    printf(" %d",u);
    inParse(T[u].r);
}


void postParse(int u){
    if(u==NIL)return;
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d",u);
}

int main(){
    int i,v,l,r,root;
    scanf("%d",&n);
    for(i=0;i<n;i++) T[i].p=NIL;
    
    for(i=0;i<n;i++){
        scanf("%d %d %d",&v,&l,&r);
        T[v].l=l;
        T[v].r=r;
        if(l!=NIL)T[l].p=v;
        if(r!=NIL)T[r].p=v;
    }
    
    for(i=0;i<n;i++) if(T[i].p==NIL)root=i;
    printf("Preorder\n");
    preParse(root);
    printf("\n");
    printf("Inorder\n");
    inParse(root);
    printf("\n");
    printf("Postorder\n");
    postParse(root);
    printf("\n");
    
    return 0;
    
}



Measured memory_bytes: 2108
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	for(;;){
		int a,b;
		if(scanf("%d %d",&a,&b) == EOF){break;}
		int c = a+b, count = 0;
		while(c>0){
			c=c/10;
			count++;
		}
		cout <<count<<endl;
	}
	return 0;
}

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

int main() {
	// your code goes here
	int n,i,c[30],v[30],ans=0;
	cin >> n;
	for(i=1;i<=n;i++) cin >> v[i];
	for(i=1;i<=n;i++) cin >> c[i];
	for(i=1;i<=n;i++) if(v[i]>c[i]) ans+=(v[i]-c[i]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 100005;
const ll m1 = 10007;
const ll m2 = 10009;
const ll mod1 = 100000007;
const ll mod2 = 100000009;

vi G[MAX_N];
bool flag[MAX_N];
pll sz[MAX_N];
map<pll,ll> mp;

void dfs(int u)
{
    flag[u] = true;
    rep(i,len(G[u])){
        if(!flag[G[u][i]]){
            dfs(G[u][i]);
            sz[u].fi += sz[G[u][i]].fi;
            sz[u].se += sz[G[u][i]].se;
        }
    }
    sz[u].fi = sz[u].fi*m1%mod1;
    sz[u].se = sz[u].se*m2%mod2;
    sz[u].fi++,sz[u].se++;
    mp[sz[u]]++;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    rep(i,n-1){
        int a,b;
        cin >> a >> b;
        G[a-1].pb(b-1),G[b-1].pb(a-1);
    }
    dfs(0);
    ll res = 0;
    each(it,mp){
        res += it.se*(it.se-1)/2;
    }
    cout << res << "\n";
    return 0;
}

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> table(H, vector<char>(W));
  
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      cin >> table.at(i).at(j);
    }
  }
  
  vector<bool> row(H, false);
  vector<bool> col(W, false);
  
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      if (table.at(i).at(j)=='#') {
        row.at(i)=true;
        col.at(j)=true;
      }
    }
  }
  
  for (int i=0; i<H; i++) {
    if (row.at(i)) {
      for (int j=0; j<W; j++) {
        if (col.at(j)) {
          cout << table.at(i).at(j);
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int n;
  double res;
  double *a;
  scanf("%d\n",&n);
  a=(double*)malloc(n*sizeof(double));
  res=0;
  for (int i=0;i<n;i++){
    scanf("%lf",&a[i]);
    res=res+1/a[i];
  }
  res=1/res;
  printf("%f\n",res);
  free(a);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <cstdio>
#include <deque>
#include <algorithm>
#include <string>
#include <cstring>
#include <list>
#include <stack>

using namespace std;
int a[11];
int b[11];
int n, m;
int d[10001];
int c[11];
int inf = 999999999;
int go(int y) {
	if (d[y] != -1)return d[y];
	if (y == 0)return d[y] = 0;
	d[y] = -inf;
	for (int i = 0; i < m; i++) {
		if (y - b[a[i]] >= 0)
			d[y] = max(d[y], go(y - b[a[i]]) + 1);
	}
	return d[y];
}
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> n >> m;
	b[1] = 2; b[2] = 5; b[3] = 5; b[4] = 4; b[5] = 5; b[6] = 6; b[7] = 3; b[8] = 7; b[9] = 6;
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		c[b[a[i]]] = max(c[b[a[i]]], a[i]);
	}
	memset(d, -1, sizeof(d));
	int match = go(n) - 1;
	sort(a, a + m);
	int k = n;
	string ans = "";
	while (match >= 0) {
		for (int i = m - 1; i >= 0; i--) {
			if (k - b[a[i]] >= 0 && d[k - b[a[i]]] == match) {
				ans += to_string(a[i]);
				k -= b[a[i]];
				break;
			}
		}
		match -= 1;
	}
	cout << ans << '\n';



}


Measured memory_bytes: 512