akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
long n,x[51],y[51],s,i,k=1;
while(cin>>n){
if(n==0)break;
for(i=0;i<n;i++)cin>>x[i]>>y[i];
x[n]=x[0];y[n]=y[0];
for(s=0,i=0;i<n;i++)s+=x[i]*y[i+1]-x[i+1]*y[i];
if(s<0)s=-s;
printf("%d %.1f\n",k++,s/2.);
}
return 0;
}

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

int main(void)
{
	int n, ok = 1,max;
	long  int stair[100001] = { 0 };
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%ld", &stair[i]);
	}

	max = stair[0];
	for (int i = 1; i <= n; i++) {
		if (max - 1 <= stair[i]) {
			if (max < stair[i])max = stair[i];
			continue;
		}else {
			ok--;
			break;
		}
	}
	if (ok) printf("Yes\n");
	else printf("No\n");

	return 0;
}


Measured memory_bytes: 896
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair < llint, llint> pllint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;
#define Pi 3.1415926535897932384626

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

bool check(pint a, pint b) {
	if (a.second == b.second) {
		return a.first > b.first;
	}
	return a.second > b.second;
}

// mod. m での a の逆元 a^{-1} を計算する
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

//aCbを1000000007で割った余りを求める
llint convination(llint a, llint b) {
	llint ans = 1;
	for (llint i = 0; i < b; i++) {
		ans *= a - i;
		ans %= 1000000007;
	}
	for (llint i = 1; i <= b; i++) {
		ans *= modinv(i, 1000000007);
		ans %= 1000000007;
	}
	return ans;
}

//aのb乗を1000000007で割った余りを求める
llint power(llint a, llint b) {
	if (b == 1)return a;
	if (b == 0)return 1;
	llint tmp = power(a, b / 2);
	tmp *= tmp;
	tmp %= 1000000007;
	if (b % 2 == 1) {
		tmp *= a;
		tmp %= 1000000007;
	}
	return tmp;
}

int main() {
	int a;
	cin >> a;
	string s;
	cin >> s;
	if (a >= 3200)cout << s << endl;
	else cout << "red" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int N, D, x, i, cnt = 0;
    int a[10000];
    
    scanf("%d %d %d", &N, &D, &x);
    
    for(i = 0; i < N; i++){
        scanf("%d", &a[i]);
    }
    
    for(i = 0; i < N; i++){
        if(D % a[i] == 0){
            cnt = cnt + (D / a[i]);
            //printf("%d\n", cnt);
        }else{
            cnt = cnt + ((D / a[i])) + 1;
            //printf("%d\n", cnt);
        }
    }
    printf("%d\n", cnt + x);
    
}


Measured memory_bytes: 1744
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int main(void){
  int a, b;
  
  while (cin >> a >> b){
    vector<pair<int, int> > v;
    if (a==0 && b==0) break;
    v.push_back(make_pair(a+b, 0));
    for (int i=1; i<5; i++){
      cin >> a >> b;
      v.push_back(make_pair(a+b, i));
    }
    sort(v.begin(), v.end());
    cout << (char)('A'+v[4].second) << " " << v[4].first << endl;
  }
  return 0;
}
  
  



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

int ctoi(char c) {
   return c - '0';
}
int main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);

   ll a;
   string B;
   cin >> a >> B;
   int b = ctoi(B[0]) * 100 + ctoi(B[2]) * 10 + ctoi(B[3]);

   ll ans = a * b / 100;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
const int MAX = 2147483647;
int min(int a, int b) {
	return a < b ? a : b;
}
int getSegTreeSize(int len) {
	if (len == 0)
		return 0;
	int ret, cnt = 0, memo = 1;
	while (memo < len) {
		memo *= 2;
		cnt++;
	}
	ret = 1 << (cnt + 1);
	return ret;
}
class RMQ {
  private:
	int size, length;
	std::vector<int> memo;
	RMQ() {}
	void update(int index) {
		index /= 2;
		if (index == 0)
			return;
		memo[index] = min(memo[index * 2], memo[index * 2 + 1]);
		update(index);
	}
	int get(int left, int right, int node, int node_left, int node_right) {
		if (node_right < left || right < node_left)
			return MAX;
		if (left <= node_left && node_right <= right)
			return memo[node];
		return min(get(left, right, node * 2, node_left, (node_left + node_right) / 2), get(left, right, node * 2 + 1, (node_left + node_right) / 2 + 1, node_right));
	}

  public:
	RMQ(int size) {
		this->size = getSegTreeSize(size) / 2;
		this->length = getSegTreeSize(size);
		memo.resize(this->length);
		fill(memo.begin(), memo.end(), MAX);
	}
	void update(int index, int element) {
		index += length / 2 - 1;
		memo[index] = element;
		update(index);
	}
	int find(int left, int right) {
		return get(left, right, 1, 1, size);
	}
};
class RSQ {
  private:
	int size, length;
	std::vector<int> memo;
	RSQ() {}
	void update(int index) {
		index /= 2;
		if (index == 0)
			return;
		memo[index] = memo[index * 2] + memo[index * 2 + 1];
		update(index);
	}
	int get(int left, int right, int node, int node_left, int node_right) {
		if (node_right < left || right < node_left)
			return 0;
		if (left <= node_left && node_right <= right)
			return memo[node];
		return get(left, right, node * 2, node_left, (node_left + node_right) / 2) + get(left, right, node * 2 + 1, (node_left + node_right) / 2 + 1, node_right);
	}

  public:
	RSQ(int size) {
		this->size = getSegTreeSize(size) / 2;
		this->length = getSegTreeSize(size);
		memo.resize(this->length);
		fill(memo.begin(), memo.end(), 0);
	}
	void update(int index, int element) {
		index += length / 2 - 1;
		memo[index] += element;
		update(index);
	}
	int find(int left, int right) {
		return get(left, right, 1, 1, size);
	}
};
int main() {
	int n, q;
	std::cin >> n >> q;
	RSQ segTree(n);
	for (int i = 0; i < q; i++) {
		int com, x, y;
		std::cin >> com >> x >> y;
		if (com == 0)
			segTree.update(x, y);
		else
			std::cout << segTree.find(x, y) << std::endl;
	}
}


Measured memory_bytes: 3888
#include <bits/stdc++.h>
using namespace std;
 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define eb emplace_back
 
typedef long long ll;

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

vector<ll> fac;

vector<vector<int> > G;

ll res = 1;
int N, K;

void explore(int v, int depth, int from) {
	if (depth == 0) {
		res *= K;
		int childs = G[v].size();
		if (childs > 0) {
			res *= K-1;
			res %= MOD;
			res *= fac[childs-1];
			res %= MOD;
		}
	} else {
		int childs = G[v].size()-1;
		res *= fac[childs];
		res %= MOD;
	}
	
	for (int e : G[v]) if (e != from) {
		explore(e, depth+1, v);
	}
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	
	cin >> N >> K;
	
	G = vector<vector<int> >(N);
	
	for (int i=0; i<N-1; i++) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	fac = vector<ll>(max(N, K)+1);
	fac[0] = 1;
	for (int i=1; i<(int)fac.size(); i++) {
		fac[i] = (fac[i-1] * (K-i-1))%MOD;
	}
	
	explore(0, 0, -1);
	cout << res << endl;
	
	
	
	
	
	
}


Measured memory_bytes: 9984
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int a, b, w;
    cin >> w >> a >> b;
    if ( a + w < b ) cout << b - ( a + w ) << endl;
    else if ( b + w < a ) cout << a - ( b + w ) << endl;
    else if ( a <= b && b <= a + w || b <= a && a <= b + w ) cout << 0 << endl; 
    return 0;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
use proconio::{fastout, input};
#[fastout]
fn main() {
    input! {
        n: usize,
        mut a: [isize; n]
    }
    let mut b: Vec<isize> = vec![0];
    b.append(&mut a);
    b.push(0);

    let mut total = 0;
    for i in 0..n + 1 {
        total += (b[i + 1] - b[i]).abs();
    }
    for i in 1..n + 1 {
        println!(
            "{}",
            total + (b[i - 1] - b[i + 1]).abs()
                - ((b[i - 1] - b[i]).abs() + (b[i] - b[i + 1]).abs())
        );
    }
}


Measured memory_bytes: 4232
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt"
struct query {
	int type;
	long long int lx;
	long long int len;
};
int main() {
	int N; cin >> N;
	multimap<long long int, query>mp;
	for (int i = 0; i < N; ++i) {
		long long int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
		x1 *= 3; x2 *= 3; y1 *= 3; y2 *= 3;
		if (x1 == x2) {
			
			if (y1 > y2)swap(y1, y2);
			assert(y1 <= y2);
			y1--;
			y2++;
			mp.insert(make_pair(y1,query{ 0,x1,y2 - y1 }));
			mp.insert(make_pair(y2, query{ 2,x1,y2 - y1 }));
		}
		else {
			if (x1 > x2)swap(x1, x2);
			assert(x1 <= x2);
			x1--;
			x2++;
			mp.insert(make_pair(y1, query{1,x1,x2 - x1 }));
		}
	}
	vector<long long int>lines;
	int ans = 0;
	for (auto m : mp) {
		query q(m.second);
		if (q.type==1) {
			auto lt = lower_bound(lines.begin(), lines.end(), q.lx);
			auto rt = upper_bound(lines.begin(), lines.end(), q.lx + q.len);
			ans += rt - lt;
		}
		else if(q.type==0){
			lines.insert(lower_bound(lines.begin(), lines.end(), q.lx),q.lx);
		}
		else {
			lines.erase(lower_bound(lines.begin(), lines.end(), q.lx));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 18816
n, m, x = list(map(int, input().split()))
books = []
dp = [[0]*(m+1) for i in range(2**(n))]
for i in range(n):
    book = list(map(int, input().split()))
    books.append(book)

    
min_cost = -1


for i in range(2**(n)):
    if i == 0:
        continue
    refbook = 0
    keta = 0
    for j in range(13):
        if (i >> j) % 2 == 1:
            refbook += 2**j
            keta = j
        elif i >> j == 0:
            refbook -= 2**(keta)
            break
    refbook = max(0, refbook)   
    checker = True
    for k in range(m+1):
        dp[i][k] = dp[int(refbook)][k] + books[keta][k]
        if k != 0 and dp[i][k]<x:
            checker = False
            
    if checker:
        if min_cost == -1:
            min_cost = dp[i][0]
        else:
            min_cost = min(min_cost, dp[i][0])
          
print(min_cost)

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

using namespace std;

string out;

int op(int x, int y, char op) {
  return (op == '+' ? x+y : x-y);
}

void dfs(vector<int> &nums, string ops) {
  if (ops.size() == 3) {
    int res = nums[0];
    for (int i = 1; i < 4; ++i) {
      res = op(res, nums[i], ops[i-1]);
    }
    if (res == 7) out = ops;
    return;
  }
  dfs(nums, ops+'+');
  dfs(nums, ops+'-');
  return;
}

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

  string s;
  cin >> s;
  vector<int> nums(4);
  for (int i = 0; i < 4; ++i) nums[i] = s[i]-'0';
  dfs(nums, "");
  cout << s[0];
  for (int i = 1; i < 4; ++i) {
    cout << out[i-1] << s[i];
  }
  cout << "=7" << endl;

  return 0;
}



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

typedef long long int int64;

void run(void){
  int a[7];
  int i;
  for(i=0;i<7;i++) scanf("%d",a+i);
  int64 ans=2*a[1];//2*2
  const int I=a[0];
  const int L=a[3];
  const int iL=a[4];
  ans+=4*(I/2);//1*4
  ans+=4*(L/2);//L
  ans+=4*(iL/2);//inv L
  if(I>0 && L>0 && iL>0){
    if(I%2==1 && L%2==1 && iL%2==1){
      ans+=6;
    } else if(I%2+L%2+iL%2==2){
      ans+=2;
    }
  }
  printf("%lld\n",ans/2);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,x,i,wa;
  cin>>n>>x;
  vector<int> vec(n);
  for(i=0; i<n; i++){
    cin>>vec.at(i);
    x=x-vec.at(i);
  }
  sort(vec.begin(),vec.end());
  n=n+x/vec.at(0);
  cout<<n;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX_N = 1<<17;
ll mod;

class RSQ2{
public:
  ll n,dat[2*MAX_N-1],td[2*MAX_N-1];
  RSQ2(){n=MAX_N,memset(dat,0,sizeof(dat)),memset(td,0,sizeof(td));};
  RSQ2(int n_){
    n=1;
    while(n<n_)n*=2; //????´???°n???2???????????????
    for(int i=0;i<2*n-1;i++)dat[i]=td[i]=0;
  }
  
  ll add(int a,int b,ll x,int k=0,int l=0,int r=-1){
    if(r==-1) r=n;
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b){
      dat[k]=(dat[k]+(r-l)*x)%mod; 
      td[k]=(td[k]+x)%mod;
      return dat[k];
    }

    dat[k]=(dat[k]+(min(r,b)-max(l,a))*x)%mod;
    ll kl=k*2+1,kr=k*2+2,t=td[k]*(r-l)/2;
    dat[kl]=(dat[kl]+t)%mod, dat[kr]=(dat[kr]+t)%mod;
    td[kl]=(td[kl]+td[k])%mod, td[kr]=(td[kr]+td[k])%mod;
    td[k]=0;

    ll vl=add(a,b,x,k*2+1,l,(l+r)/2);
    ll vr=add(a,b,x,k*2+2,(l+r)/2,r);
    return (vl+vr)%mod;
  }
  
  ll sum(int a,int b){return add(a,b,0);}
};

string i2S(ll num){
  string res;
  if(num==0)return "0";
  while(num) res=(char)(num%10+'0')+res,num/=10;
  return res;
}


int main(){
  while(1){
  ll A,B;
  cin>>A>>B>>mod;
  if(!A&&!B&&!mod)return 0;
  RSQ2 T(B-A+1);
  vector<string> num,S;
  for(ll i=A;i<=B;i++)num.push_back(i2S(i));
  S = num;
  sort(num.begin(),num.end());
  
  ll ans = 0;
  T.add(0,T.n,1);
  for(int i=0;i<S.size();i++){
    int idx = lower_bound(num.begin(),num.end(),S[i])-num.begin();
    ll val = T.sum(idx,idx+1);
    ans=(ans+val)%mod;
    T.add(idx,T.n,val);
  }
  cout<<ans<<endl;
  }
  return 0;
}

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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }
///(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)(´・ω・`)///

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	RREP(i, n/2) {
		if (s.substr(0, i) == s.substr(i,i)) {
			cout << i * 2 << endl;
			break;
		}
	}
}


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

long long FloorSum(long long n, long long m, long long a, long long b) {
    long long ret=0;
    while(1) {
        if(a >= m) ret += ((n-1)*n*(a/m))>>1,a%=m;
        if(b >= m) ret += n*(b / m),b%=m;
        long long y=(a*n+b)/m, x=(y*m-b);
        if(y==0) return ret;
        ret += (n-(x+a-1)/a)*y;
        b=(a-x%a)%a; swap(a,m); n=y;
    }
}

using ll = long long;
int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int Q; cin >> Q;
    while(Q--){
        ll N,M,A,B; cin >> N >> M >> A >> B;
        cout << FloorSum(N,M,A,B) << "\n";
    }
    return 0;
}

Measured memory_bytes: 3676
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		long N = long.Parse(str[0]);
		long M = long.Parse(str[1]);
		long mod = 1000000007;
		List<long> list = PrimeFactors(M);
		long ans = 1;
		while(list.Count > 0){
			long p = 0;
			long t = list[0];
			while(true){
				p += 1;
				list.RemoveAt(0);
				if(list.Count == 0){
					break;
				}
				if(list[0] != t){
					break;
				}
			}
			ans = ans * Ncr(N+p-1,p,mod) % mod;
			if(list.Count == 0){
				break;
			}
		}
		Console.WriteLine(ans);
	}

	public static List<long> PrimeFactors(long n){
		long i = 2;
		long tmp = n;
		var list = new List<long>();
		while(i*i<=n){
			if(tmp%i==0){
				tmp /= i;
				list.Add(i);
			} else {
				i++;
			}
		}
		if(tmp != 1){
			list.Add(tmp);
		}
		return list;
	}

	public static long Mpow(long x,long n,long m)
	{
		long ans = 1;
		while(n > 0){
			if(n % 2 == 1){
				ans = ans * x % m;
				n -= 1;
			}
			x = x * x % m;
			n /= 2;
		}
		return ans;
	}

	public static long Ncr(long n,long r,long m)
	{
		long ans = 1;
		for(var i=n-r+1;i<=n;i++){
			ans = ans * i % m;
		}
		for(var i=2;i<=r;i++){
			ans = ans * Mpow(i,m-2,m) % m;
		}
		return ans;
	}
}

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


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


    int n, m;
    cin >> n >> m;
    vector<int> a;
    int s = 0;
    rep(i, n) {
        int buf;
        cin >> buf;
        a.push_back(buf);
        s += buf;
    }
    double l = (s*1.0) / (4*m);
    int c = 0;
    rep(i, n) {
        if (a[i] >= l) {
            c++;
        }
    }

    if (c >= m) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return 0;
}



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

signed main(void)
{
	long long n, ans;
	cin >> n;
	map<char, int> S;
	vector<long long> sum;

	rep(i, n)
	{
		string s;
		cin >> s;
		if (s[0] == 'M' || s[0] == 'A' ||\
				s[0] == 'R' || s[0] == 'C' || s[0] == 'H')
			S[s[0]]++;
	}
	for (auto p: S)
	{
		auto v = p.second;
		sum.push_back(v);
	}
	ans = 0;
	int m = sum.size();
	rep(i, m - 2)
		FOR(j, i + 1, m - 1)
			FOR(k, j + 1, m)
				ans += sum.at(i) * sum.at(j) * sum.at(k);
	cout <<  ans << endl;
	return 0;
}


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

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

	int ans = N;
	if (ans == 100) {
		ans++;
	}

	while (D--) {
		ans *= 100;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include<map>
#include<deque>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define erep(i, n) for (int i = 0; i <= (int)(n); i++)

int main() {
    ll l, r; cin >> l >> r;

    ll end;
    if (l + 2018 < r) end = l + 2018;
    else end = r;

    ll ans = 2020;
    for (ll s = l; s < end; s++) {
        for (ll e = s + 1; e <= end; e++) {
            if ((s * e) % 2019 < ans) ans = (s * e) % 2019;
        }
    }
    cout << ans << endl;
}


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

int N;
#define MAXN 100000

int main() {
  scanf("%d", &N);
  int n = 0;
  for(int i = 0; i < N; ++i) {
    int A; scanf("%d", &A); if(A % 2 == 1) ++n;
  }
  printf("%s\n", n % 2 == 0 ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


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

    if(A%3==0||B%3==0 || (A+B)%3==0){
        cout<<"Possible"<<endl;
    }else{
        cout << "Impossible" << endl;
    }
    
    


    return 0;
    

}

Measured memory_bytes: 3544
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

from itertools import accumulate

def main():
    N, K = LI()
    A = LI()
    negs = [min(0, a) for a in A]
    poss = [max(0, a) for a in A]
    nacc = [0] + list(accumulate(negs))
    pacc = [0] + list(accumulate(poss))
    neg = max(q - p for p, q in zip(nacc, nacc[K:]))
    pos = min(q - p for p, q in zip(pacc, pacc[K:]))
    ans = sum(a for a in A if a > 0) + max(neg, -pos)

    return ans

print(main())

Measured memory_bytes: 19208
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define f first
#define s second
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define fast 
#define f first
#define s second

int main(){
long long n;
cin >> n;
long long count=0;
count = (n/500) * 1000;
n=n%500;
count  = count + (n/5)*5;
cout << count <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int64_t i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define COUTDOUBLE(d,i) cout << setprecision((i)) << (d) << endl;
#define VIN(v) for(int64_t i=0;i<(v).size();i++){cin >> (v).at(i);}
#define MREP(i,m) for(auto i=(m).begin(); i != (m).end(); ++i) // auto key = i->first;auto value = i->second;

using namespace std;
typedef int64_t I;
typedef pair<I,I> P;
typedef vector<I> V;

I MOD = pow(10,9)+7;
I MAX = LONG_MAX;
I MIN = LONG_MIN;

// 最大公約数
I gcd(I a, I b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数
I lcm(I a, I b) {
  return a * b / gcd(a, b);
}

int ctoi(char c){
  return c - '0';
}

I com[2006][2006];

int main(){
  int64_t n, k;
  cin >> n >> k;
  int64_t r = n - k;

  com[0][0] = 1;
  for(int i = 1; i<2006; i++){
    com[i][0] = 1;
    for(int j = 1; j<2006; j++){
      com[i][j] = com[i-1][j-1] + com[i-1][j];
      com[i][j] %= MOD;
    }
  }
  REP(i,k){
    int64_t t=0;
    t = com[k-1][i] * com[r+1][r-i];
    cout << t % MOD << endl;
  }

  /*
  REP(i,k){
    if (i==0){
      cout << r+1 << endl;
    }else{
      int64_t j = r - i;
      if (j < 0 || i >= k){
        cout << 0 << endl;
        continue;
        //break;
      }
      unsigned long long c=1;
      unsigned long long cc=0;
      REP(l,i){ // (k-1)C(i+1-1)
        c *= (k -1 - l);
        if ( c / MOD != 0){
          cc += c / MOD;
          c %= MOD;
        }
      }
      REP(l,i){ // (k-1)C(i+1-1)
        while ( c < MOD && cc > 0 && c % (l+1) != 0){
          c += MOD;
          cc--;
        }
        cc += (c / (l+1)) / MOD;
        c = (c / (l+1)) % MOD;
      }
      unsigned long long t=1;
      unsigned long long tt=0;
      int64_t ccc = i+1;
      ccc = min(r-i,ccc);
      REP(l,ccc){ // (r+1)C(r-i-1+1)
        t *= (r + 1 - l);
        if ( t / MOD != 0){
          tt += t / MOD;
          t %= MOD;
        }
      }
      REP(l,ccc){ // (k-1)C(i+1-1)
        while ( t < MOD && tt > 0 && t % (l+1) != 0){
          t += MOD;
          tt--;
        }
        tt += (t / (l+1)) / MOD;
        t = (t / (l+1)) % MOD;
      }
      //cout << "c:" << c << ",t:" << t << endl;
      cout << (t % MOD) * (c % MOD) % MOD << endl;
    }
  }
  */
  return 0;
}



Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
constexpr int MX = 500005;
int n, q, c[MX], l, r, p[MX], ans[MX];
struct Q{
	int l, r, i;
} qs[MX];
struct BIT{
	vector<int> dat;
	int sz;
	BIT(int n):sz(n+1), dat(n+1){};
	void set(int x, int n){
		for(int i = n; i < sz; i += i&-i) dat[i] += x;
	}
	int get(int n){
		int ret = 0;
		for(int i = n; i > 0; i -= i&-i) ret += dat[i];
		return ret;
	}
};
int main(){
	scanf("%d%d", &n, &q);
	BIT bt(n);
	rep(i,n) scanf("%d", c+i+1);
	rep(i,q){
		scanf("%d%d", &l, &r);
		qs[i] = Q{l,r,i};
	}
	sort(qs, qs+q, [](Q &a, Q &b){return a.r < b.r;});
	r = 1;
	rep(i,q){
		for(; r <= qs[i].r; r++){
			if(p[c[r]]) bt.set(-1, p[c[r]]);
			bt.set(1, p[c[r]] = r);
		}
		ans[qs[i].i] = bt.get(qs[i].r) - bt.get(qs[i].l-1);
	}
	rep(i,q) printf("%d\n", ans[i]);
}

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

int main(){
    int N;
    cin >> N;
    vector<int> H(N);
    int a=0;
    int b=0;
    for (int i=0;i<N;i++){
        cin >> H.at(i);
        if (a<=H.at(i)){
            a=H.at(i);
            b=b+1;
        }
    }
    cout << b << endl;
    
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  long long int a,b;cin>>a>>b;
  vector<vector<char>>c(a,vector<char>(b));
  bool e[a];
  bool f[b];
  rep(i,a)rep(j,b)cin>>c[i][j];
  rep(i,a){
    bool d=true;
    e[i]=false;
    rep(j,b){
      if(c[i][j]!='.')d=false;
  }
    if(d)e[i]=true;
  }
  rep(i,b){
    bool d=true;
    f[i]=false;
    rep(j,a){
      if(c[j][i]!='.')d=false;
    }
    if(d)f[i]=true;
  }
  rep(i,a){
    if(e[i])continue;
    rep(j,b){
      if(f[j]){
        continue;
        j++;
      }
      cout<<c[i][j];
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
// 標準入力
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).trim().split('\n');
main();

function main(){
  for(var i = 0, len = input.length; i < len; i++){
    var c = input[i].split(' ');

    var div = c[0]/c[1] + '.';
    var decimalNumber = div.split('.')[1].split('');

    var result = 0;
    for(var j = 0; j < +c[2]; j++){
      var num = +decimalNumber[j];
      result += num ? num : 0;
    }
    
    console.log(result);
  }
  
}

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

using namespace std;
using namespace boost::multiprecision;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPI(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define ALL(x) (x).begin(),(x).end()



int main () {
  int n, in;
  long long count = 0;
  vector<int> as;

  cin >> n;

  REP(i, n+1) {
    cin >> in;
    as.push_back(in);
  }

  int prevleft = 0;
  REP(i, n) {
    cin >> in;

    if(as[i] <= prevleft) {
      count += as[i];
      prevleft = in;
    }
    else {
      count += min(as[i], prevleft + in);
      prevleft = max(0, in - (as[i] - prevleft));
    }
  }

  count += min(as[n], prevleft);

  cout << count << endl;

  return 0;
}


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

int main() {
  long N,M;
  cin >> N >> M;
  
  vector<int> num(M);
  
  for(int i = 0; i < M; i++){
    cin >> num.at(i);
  }
  
  long sum = 0;
  for(int i = 0; i < M; i++){
    sum += num.at(i);
  }
  
  if (sum > N){
    cout << "-1" << endl;
  }
  if (sum <= N){
    cout << (N - sum) << endl;
  }
}

Measured memory_bytes: 3672
#include "bits/stdc++.h"
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int>A(N);
	vector<int>Color = { 400,800,1200,1600,2000,2400,2800,3200, 4801 };
	vector<int>kinds(9, 0);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
		for (int j = 0; j < 9; j++) {
			if (A.at(i) < Color.at(j)) {
				kinds.at(j)++;
				break;
			}
		}
	}
	int ans = 0;
	for (int i = 0; i < 8; i++) {
		if (kinds.at(i) != 0) ans++;
	}
	int free = kinds.at(8);
	cout << (ans == 0 ? 1 : ans) << ' ' << ans + free << endl;
}


Measured memory_bytes: 256
/*	MASTER HAS FAILED MORE TIMES
	THAN BEGINNER HAS EVER TRIED
*/

#include <bits/stdc++.h>

using namespace std;

#define endl            '\n'
#define mem(a, n)       memset(a, n, sizeof(a))
#define repeat(n)       for(int i=0; i<n; i++)
#define Unique(n)       (n).erase(unique(all(n)), (n).end())
#define isPowerOfTwo(n) (n && !(n & (n - 1)))
#define NumofDigits(n)  ((int)log10(n)+1)
#define all(a)          a.begin(), a.end()

long long gcd(long long a, long long b){ return a%b ? gcd(b, a%b) : b; }
long long lcm(long long a, long long b){ return a*b/gcd(a, b); }

void quicken(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); }

/*
    Special functions:
        find_by_order(k) --> returns iterator to the kth largest element counting from 0
        order_of_key(val) --> returns the number of items in a set that are strictly smaller than our item
*/

int main(){
    quicken();

    int n, odd, even; cin >> n;

    even = n/2;
    odd = n-even;

    cout << fixed << setprecision(10) << (double)odd/(double)n;

    return 0;
}


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

using namespace std;

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		vector<long long> a(n, 0);
		for (int i = 0; i < n; i++) cin >> a[i];
		sort(a.rbegin(), a.rend());
		queue<long long> q;
		long long ans = 0;
		q.push(a[0]);
		for (int i = 1; i < n; i++) {
			ans += q.front();
			q.pop();
			q.push(a[i]);
			q.push(a[i]);
		}
		cout << ans << "\n";
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 6368
#include <iostream>

using namespace std;

const long MOD = 1000000007;

long pow10(long n){
    long ans = 1;
    long tmp = 10;
    for(int i = 0; i <= 30; i++){
        int m = (1<<i);
        if(m&n) {
            ans *= tmp;
            ans %= MOD;
        }
        tmp = tmp*tmp;
        tmp %= MOD;
    }
    return ans;
}

int main(){
    long S;
    long ans = 0;
    cin >> S;
    for(long i = 1; i <= S; i++){
        if(S/i < 8) break;
        if(S%i == 0){
            //cout << i << ' ' << S/i << endl;
            long n = S/i;
            if(n == 8) break;
            long tmp = pow10(n-1);
            ans += (10*tmp-tmp-i+1);
            ans %= MOD;
            ans += MOD;
            ans %= MOD;
            //cout << ans << endl;
        }else{
            ans++;
            ans %= MOD;
        }
    }
    
    int l = 1;
    int r = 1;
    long sum = 1;
    long l_tmp = 1;
    long r_tmp = 1;
    long l_next = 10;
    long r_next = 10;
    if(S == 1) ans++;
    
    while(true){
        while(sum <= S){
            r++;
            if(r >= 1e+8){
                cout << ans << endl;
                return 0;
            }
            if(r >= r_next){
                r_next*=10;
                r_tmp++;
            }
            sum += r_tmp;
            if(sum == S) {
                //cout << l << ' ' << r << endl;
                ans++;
                ans %= MOD;
            }
        }
        while(sum >= S){
            l++;
            sum -= l_tmp;
            if(l >= l_next){
                l_next*=10;
                l_tmp++;
            }
            if(sum == S) {
                //cout << l << ' ' << r << endl;
                ans++;
                ans %= MOD;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const A = parseInt(arg[0].split(" ")[0]);
    const B = parseInt(arg[0].split(" ")[1]);
    
    // X * 0.08 = A;
    // X * 0.1  = B;
    
    // const X = A / 0.08;
    
    // if(X % 1 !== 0) {
    //     console.log(-1);
    //     return;
    // }
    
    // const temp1 = Math.floor(X * 0.08);
    // const temp2 = Math.floor(X * 0.1);
    
    // console.log(temp2)
    
    // if(temp1 === A && temp2 === B) {
    //     console.log(X);
    //     return;
    // }
    
    // console.log(-1);

    for(let i=1; i<=10000; i++) {
        const temp1 = Math.floor(i * 0.08);
        const temp2 = Math.floor(i * 0.1);
        
        if(temp1 === A && temp2 === B) {
            console.log(i);
            return;
        }
    }
    
    console.log(-1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include <stdio.h>
int main(void)
{
  int n, a, b, c, h[100005], h2;
  int mid, low, high, flg, max, x, x2, i;
  scanf("%d %d %d", &n, &a, &b);

  c = a-b;
  max = -1;
  for(i = 0; i < n; i++){
    scanf("%d", &h[i]);
    if(max < h[i]) max = h[i];
  }
  low = 1;
  high = max/b+1;  
  while(low <= high){
    mid = (low + high)/2; 
    flg = 1;
    x = mid;
    for(i = 0; i < n; i++){
      h2 = h[i]-b*mid;
      if(h2 > 0){
	x2 = h2/c; 
	if(h2 % c != 0) x2++;
	x -= x2;   
	if(x<0){   
	  flg = 0;
	  break;
	}
      }
    }
    if(flg != 1) low = mid+1; 
    else high = mid-1;
  }
  printf("%d\n", low);
  return 0;
} 

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

using namespace std;

int main() {
	int i, j;
	string s, t;
	cin >> s >> t;
	for (i = s.size() - t.size(); i >= 0; i--) {
		for (j = 0; j < t.size(); j++) {
			if (s[i + j] != '?' && s[i + j] != t[j])
				break;
		}
		if (j == t.size())
			break;
	}
	if (i < 0)
		printf("UNRESTORABLE\n");
	else {
		for (j = 0; j < t.size(); j++)
			s[i + j] = t[j];
		for (i = 0; i < s.size(); i++) {
			if (s[i] == '?')
				s[i] = 'a';
		}
		cout << s << "\n";
	}
	return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define hii cout << "hii" << endl
#define int ll
#define endl '\n'
#define all(s) s.begin(), s.end()
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) 
	{ 
		cerr << name << " : " << arg1 << endl;
	}
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) 
    {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#endif
 
 
const int N = 3e5 + 5;
const int MAXN = 1e5 + 5;
const int M = 1e5;
const int mod = 1e9 + 7;
const int MOD = 1e9 + 7;
const ll INF = 1e15;
const int LG = 21;


int arr[N];
vector<int> v[N];
map<int, int> mp;
map<int, int> ret;


void solve() 
{
	string input1, input2;
	cin >> input1 >> input2;
	input2.pop_back();
	if(input1 == input2)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
}
 
 
int32_t main() 
{	
    ios_base:: sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

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

Measured memory_bytes: 10572
var
  n,a1,a2,a3,a4,i1,i2,i3,i4,s:longint;
begin
  readln(n);
  a1:=n div 1000;
  a2:=n div 100 mod 10;
  a3:=n div 10 mod 10;
  a4:=n mod 10;
  for i1:=0 to 1 do
    for i2:=0 to 1 do
      for i3:=0 to 1 do
        begin
          s:=a1;
          if i1=0 then s:=s-a2 else s:=s+a2;
          if i2=0 then s:=s-a3 else s:=s+a3;
          if i3=0 then s:=s-a4 else s:=s+a4;
          if s=7 then
            begin
              write(a1);
              if i1=0 then write('-') else write('+');
              write(a2);
              if i2=0 then write('-') else write('+');
              write(a3);
              if i3=0 then write('-') else write('+');
              write(a4);
              writeln('=7');
              exit;
            end;
        end;
end.

Measured memory_bytes: 128
import math

X = int(input())
NUM = 1000000

FOOD = [100, 101, 102, 103, 104, 105]

ONI = 0
SND = 1
COK = 2
CKE = 3
AME = 4
PCN = 5

units = X / 100
mod = X % 100

counter = 0

if (units == 0):
    print(1)
    exit()
else:
    while(counter < units):
        if (mod >= PCN):
            mod -= PCN
        elif (mod >= AME):
            mod -= AME
        elif (mod >= CKE):
            mod -= AME
        elif (mod >= COK):
            mod -= AME
        elif (mod >= SND):
            mod -= AME
        else:
            print(1)
            exit()
        counter += 1

print(0)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll> a(n), b(n);
  REP(i,n) cin >> a[i];
  REP(i,n) cin >> b[i];
  
  int ans = 0;
  ll minus_sum = 0;
  vector<ll> plus;
  REP(i,n){
    if(a[i]<b[i]){
      ans++;
      minus_sum += b[i]-a[i];
    }else if(a[i]>b[i]){
      plus.push_back(a[i]-b[i]);
    }
  }
  sort(ALL(plus), greater<ll>());
  REP(i,plus.size()){
    if(minus_sum<=0) break;
    ans++;
    minus_sum -= plus[i];
  }
  cout << (minus_sum>0 ? -1: ans) << '\n';
  return 0;
}

Measured memory_bytes: 2428
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 0x3F3F3F3F;
const int maxn = 2e5 + 555;
const int MOD = 1e9 + 7;
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    cout << fixed;
    ll a;
    cin >> a;
    cout << a + a * a + a * a * a << endl;
    return 0;
}

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

#define PI 3.141592653589
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define ii pair<int,int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pll pair<ll,ll>
#define vv vector
int MOD=1e9+7;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
ll min(ll a,ll b){return (a>b)?b:a;}
ll max(ll a,ll b){return (a>b)?a:b;}
bool prime[1000001];
vi primes;
void SieveOfEratosthenes(int n) 
{ 
    memset(prime, true, sizeof(prime)); 
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
    for(int p=2;p<1000001;p++)
        if(prime[p])
            primes.pb(p);
}
ll fact[1001];
void factorial(int n){
    fact[0]=1;
    for(int i=1;i<=n;i++)
        fact[i]=fact[i-1]*i,fact[i]%=MOD;
}
ll ncr(ll n,ll r)
{
    if(n<r)
        return -1;
    else{
        ll x=fact[r]*fact[n-r]%MOD;
        return fact[n]*fermat_inv(x)%MOD;
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int t=1;
    //cin>>t;
    //SieveOfEratosthenes(1000000);
    //factorial(1000);
    while(t--){
        int n,m;
        cin>>n>>m;
        int xi,xf,yi,yf;
        cin>>xi>>yi>>xf>>yf;
        xi--,yi--,xf--,yf--;
        char ch[n][m];
        int dp[n][m];
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                cin>>ch[i][j];
                dp[i][j]=0;
            }
        }
        deque<ii >q;
        q.push_front({xi,yi});
        dp[xi][yi]=1;
        while(!q.empty()){
            auto a=q.front();
            q.pop_front();
            int x=a.ff,y=a.ss;
            int k=dp[x][y];
            for(int i=-2;i<=2;i++){
                for(int j=-2;j<=2;j++){
                    if(x+i<0||x+i>=n||y+j<0||y+j>=m||ch[x+i][y+j]=='#')
                        continue;
                    if(abs(i)+abs(j)<=1){
                        if(!dp[x+i][y+j]||dp[x+i][y+j]>k){
                            dp[x+i][y+j]=k;
                            q.push_front({x+i,y+j});
                        }
                    }
                    else{
                        if(!dp[x+i][y+j]||dp[x+i][y+j]>k+1){
                            dp[x+i][y+j]=k+1;
                            q.push_back({x+i,y+j});
                        }
                    }
                }
            }
        }
        cout<<dp[xf][yf]-1;
    }
}

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

typedef long long ll;
int prime_num[1000];
void Count_Prime_Factor(int num)
{
  int i=2;
  while(num!=1)
  {
    if(num%i==0)
    {
      prime_num[i]++;
      num/=i;
    }else{
      i++;
    }
  }
}
int main(){
  int n; cin>>n;
  //Prime_Factor(n);
  for(int i=2;i<=n;i++)
  {
    Count_Prime_Factor(i);
  }
  ll ans = 1;
  for(int i=2;i<=1000;i++)
  {
    ans *=(prime_num[i]+1);
    ans %= ll(1e9+7);
  }
  cout<<ans<<"\n";

}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n;
	int i,j;
	int dan[31],s;
	
	scanf("%d",&n);
	while(n!=0){
		for(i=0;i<31;i++){
			dan[i]=0;
		}
		dan[0]=1;
		dan[1]=2;
		dan[2]=4;
		for(i=3;i<n;i++){
			dan[i]=dan[i-3]+dan[i-2]+dan[i-1];
		//	printf("dan[%d]=%d\n",i,dan[i]);
		}
		s=dan[n-1]/10;
		s=s/365;
		printf("%d\n",s+1);
		scanf("%d",&n);
	}
	return 0;
}

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

int aa(int a, int b, int c) {
    int res = 0;
    int m = min(a,min(b , c));
    FOR(i, 1, m + 1) {
        if(a % i == 0 && b % i == 0 && c % i == 0) {
            res = i;
        }
    }
    return res;
}


int main(){
    int n;
    ll result = 0;
    cin >> n;
    FOR(i, 1, n+1) {
        FOR(j, 1, n+1) {
            FOR(k, 1, n+1) {
                result += aa(i, j, k);
            }
        }
    }
    cout << result << endl;
}

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

namespace AtCoder {

    class Program {

        static void Main(string[] args) {

            var N = int.Parse(Console.ReadLine());
            var V = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            var C = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            var result = 0;

            for (int i = 0; i < N; i++) {

                var v = V[i];
                var c = C[i];
                if(v > c) {

                    result += v - c;
                }
            }
            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 11220
N, Q = map(int, input().split())
S = input()

ACindex = []
index = 0
while (True):
    index = S.find("AC", index)
    if index == -1:
        break
    ACindex.append(index)
    index += 2
# print(ACindex)

ACs = []
num_of_AC = 0
pre = -1
for i in ACindex:
    ACs += [num_of_AC]*(i-pre)
    num_of_AC += 1
    pre = i

ACs += [num_of_AC]*(N-1-pre)

for i in range(Q):
    L, R = map(int, input().split())
    L -= 1
    R -= 1
    count = ACs[R]-ACs[L]
    print(count)
# print(ACs)


Measured memory_bytes: 8168
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
const int INF = 0x3f3f3f3f;
int main() {
  int k, x;
  cin >> k >> x;
  if (k * 500 < x)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}

Measured memory_bytes: 3516
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <math.h>
#include <set>

using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
ll MOD = 1000000007;
int main() {
	ll A, B; cin >> A >> B;
	cout << max(A + B, max(A - B, A*B)) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

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

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

	ll a, b;cin >> a >> b;
	if (a > b)cout << "safe" << endl;
	else cout << "unsafe" << endl;

	return 0;
}


Measured memory_bytes: 3652
n = int(input())
x = []
u = []
sum = 0.0
for i in range(n):
    tmp1, tmp2 = input().split()
    x.append(float(tmp1))
    u.append(tmp2)
    if u[i] == "JPY":
        sum += x[i]
    else:
        sum += x[i] * 380000

print(sum)


Measured memory_bytes: 2940
fn read<T: std::str::FromStr>() -> T
{
    std::io::Read::bytes(std::io::stdin())
                    .map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>()
                    .parse().ok().unwrap()
}

fn main() {
    let n: usize = read();
    let mut a = vec![0; n];

    for i in 0..n {
        let j: usize = read();
        a[j-1] = i;
    }

    let mut seq: usize = 1;
    let mut c: usize = 1;
    for i in 1..n as usize {
        if a[i] > a[i-1] {
            c += 1;
            seq = std::cmp::max(seq, c);
        } else {
            c = 1;
        }
    }

    println!("{}", n - seq);
}


Measured memory_bytes: 6396