akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string.h>

int main() {

  char str[10000],kara;
  int i,j,k,t;
  int kr1,kr2,ks1,ks2,flag = 0;
  

  while(1) {
    int ks[101] = {0};
    int kr[101] = {0};
    int end[102] = {0};
    kr1 = kr2 = ks1 = ks2 = 0;
    flag = 0;

    i = 0;
    k = 0;
    while(1) {
      // printf("str[%d] = %c\n",i,str[i]);
      scanf("%c",&kara);
      if(kara == '.' && k == 0) {
	flag = 1;
	break;
      }
      if(kara == '.' && k == 1) {
	scanf("%c",&kara);
	break;
      }

      if(kara == '[' ||  kara == ']' || kara == '(' || kara == ')') {
	str[i] = kara;
	i++;
	//	printf("str[%d] = %c\n",i-1,str[i-1]); 
      } 

      k = 1;
    }

    k = i;
    t = 0;
    for(i=0;i<k;i++) {
      if(flag == 1) break;

      if(str[i] == '[') {
	end[t] = -1;
	ks1++;
	ks2++;
	t++;
      }
      else if(str[i] == '(') {
	end[t] = -2;
	kr1++;
	kr2++;
	t++;
      } else if(str[i] == ']') {
	ks2--;
	if(end[t-1] == -1) {
	  ks1--;
	  t--;
	}
      } else if(str[i] == ')') {
	kr2--;
	if(end[t-1] == -2) {
	  kr1--;
	  t--;
	}
      }
    }

   
    //  printf("kr1 = %d\nks1 == %d\n",kr1,ks1);
    
    
    
    
    if(flag == 1) break;

    //    printf("ks2 = %d\nkr2 = %d\n",ks2,kr2);  
  if(ks1 == 0 && kr1 == 0 && flag == 0 && ks2 == 0 && kr2 == 0) printf("yes\n");
  else printf("no\n");
  
  }
  
  return 0;
  
}

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

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

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

#define MAX 1000000020
#define INF 1001001001

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint comb(int n, int k) {
  mint a = 1, b = 1;
  rep(i,k) {
    a *= n-i;
    b *= i+1;
  }
  return a/b;
}

void solve(int n) {
  n -= 5;
  mint ans = 0;
  rep(od,12) {
    int m = n-od;
    if (m < 0 || m%2!=0) continue;
    ans += comb(11,od) * comb(m/2+15,15);
  }
  cout << ans << endl;
}
int main(int, char**)
{
  int ts;
  cin >> ts;

  rep(i,ts) {
    int n;
    cin >> n;
    solve(n);
  }

  return 0;
}


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

int64_t sum(int64_t x) {
  return x * (x + 1) / 2;
}

int64_t abs(int64_t x) {
  return max(x, -x);
}

int main() {
  string S;
  cin >> S;
  int64_t N = S.size() + 1LL;
  S.push_back('<');
  int64_t p=0LL, n=0LL;
  vector<int> v;
  for (int64_t i = 0; i < N - 1LL; i++) {
    if (S.at(i) == '<') {
      p++;
      if (S.at(i+1) == '>') {
        v.push_back(p);
        p = 0LL;
      }
      if (i == N - 2LL) {
        v.push_back(p);
      }
    }
    if (S.at(i) == '>') {
      n++;
      if (S.at(i+1LL) == '<') {
        v.push_back(-n);
        n = 0LL;
      }
    }
  }
  int64_t ans = 0;
  for (int64_t i = 0; i < v.size(); i++) {
    ans += sum(abs(v.at(i)));
  }
  for ( int64_t i = 0LL; i < v.size() - 1LL; i++) {
    if(v.at(i)>0LL) {
      ans -= min(v.at(i), abs(v.at(i+1)));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 2048
/*
	Copyright: razouq (c)
	Author: Anass BENDARSI
	Date: 19/07/2017 11:00:56
	flamers will **** you
*/
#include<bits/stdc++.h>
//#include<flamers.h>
#define ull unsigned long long
using namespace std;
int n;
map<int, vector<int>> vect;
int tab[100000+1] = {0};
vector<int> minn;
map<int, bool> bans;
void fct(int here){
	bans[here] = true;
//	cout<<here<<endl;
	for(int i = 0; i < vect[here].size(); ++i){
		if(bans[vect[here][i]] == false){	
			tab[vect[here][i]] = here;
			fct(vect[here][i]);
		}
	}
}

int nbrr = 0;
map<int, bool> nbans;
void nbr(int here){
	nbans[here] = true;
	nbrr ++;
	for(int i = 0; i < vect[here].size(); ++i){
		if(nbans[vect[here][i]] == false){
			nbr(vect[here][i]);
		}
	}
	return;
}

int main(){
	
	cin>>n;
	int a, b;
	for(int i = 0; i < n-1; i++){
		cin>>a>>b;
		vect[a].push_back(b);
		vect[b].push_back(a);
	}
	

	fct(1);
	
//	for(int i = 0; i < minn.size(); ++i){
//		cout<<minn[i]<<" - ";
//	}
//	cout<<endl;
	int one = 0;
	int k = n;
	vector<int> vv;
	
	while(tab[k] != 0){
		vv.push_back(k);
		k = tab[k];
	}
	vv.push_back(1);
//	for(int i = 1; i <= n; i++){
//		cout<<tab[i]<<" ";
//	}
//	cout<<endl;
//	for(int i = 0; i < vv.size(); ++i){
//		cout<<vv[i]<<" ";
//	}
//	cout<<endl;
	
	reverse(vv.begin(), vv.end());
	for(int i = (vv.size()+1)/2; i < vv.size(); i++){
		nbans[vv[i]] = true;
	}
	
	nbr(1);
//	cout<<nbrr<<endl;
	if(nbrr > n/2) cout<<"Fennec"<<endl;
	else cout<<"Snuke"<<endl;
	return 0;
}


Measured memory_bytes: 29180
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a, b;
    std::cin >> a >> b;

    int d = b - a;
    int ans = 0;
    FOR(i, 1, d) {
        ans += i;
    }
    ans -= d;
    ans -= a;
    std::cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <string>
#include <algorithm>
int a[10001];
bool com(int a,int b)
{
	return a>b;
}
int main()
{
	int n,m;
	cin>>n>>m;
	char s1[n][n+1];
	char s2[m][m+1];
	for(int i=0;i<n;i++)
	{
		cin>>s1[i];
	}
	for(int i=0;i<m;i++)
	{
		cin>>s2[i];
	}
	int flag;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if(s1[i][j]==s2[0][0])
			{
				for(int k=0;k<m;k++)
				{
					for(int l=0;l<m;l++)
					{
						if(s1[i+k][j+l]!=s2[k][l])
						{
							flag=0;
							break;
						}
						flag=1;
					}
					if(flag==0)
					break;
				}
			}
			if(flag==1)
			{
				cout<<"Yes";
				return 0;	
			}
		}
	}	
	cout<<"No";
	return 0;
}

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

int main() 
{
    ll n;
    cin>>n;
    string s,t,u;
    cin>>s>>t;
    for(int i=0;i<n;i++)
    {
        u+=s[i];
        u+=t[i];
    }
    for(int i=0;i<(2*n);i++)
    {
        cout<<u[i];
    }
	return 0;
}

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

void Prime(int);

int count=0;
int flag=0;

int main()
{
  int n;   //numbers of input
  int inp;   //input variable
  int i;  //loop counter variable

  scanf("%d", &n);

  //input natural number
  for( i = 0 ; i < n ; i++ ){
    scanf("%d", &inp);
    Prime(inp);
    if( flag == 0 ) count++;
    flag = 0;
  }

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

  return 0;
}

void Prime(int inp)
{
  int i;

  //judge prime number
  for( i = 2 ; i <= sqrt(inp) ; i++ ){
    if( inp % i == 0 ){
      flag = 1;
      break;
    }
  }
}

Measured memory_bytes: 596
import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }


void main() {
    int a, b, k;
    readf("%d %d %d\n",&a,&b,&k);

    int[int] S;
    foreach(i; a..a+k) if(a <= i && i <= b) S[i] = 1;
    foreach(i; b-k+1..b+1) if(a <= i && i <= b)  S[i] = 1;

    foreach(i; S.keys.sort()) {
        writeln(i);
    }

    auto _ = readln(); // dbg
}

Measured memory_bytes: 256
import java.util.*;

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

  private void run() {
    for(int i = 0; i < 5; i++) {
      lst.add(sc.nextInt());
    }

    Collections.sort(lst);

    for(int i = 4; i > 0; i--) {
      System.out.print(lst.get(i) + " ");
    }

    System.out.println(lst.get(0));
  }

  private final Scanner sc = new Scanner(System.in);
  private final List<Integer> lst = new ArrayList<Integer>();
}

Measured memory_bytes: 12000
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

	static Scanner scan = new Scanner(System.in);
	static PrintWriter out = new PrintWriter(System.out);
	static int[] ary = new int[10001];

	public static void main(String[] args) {
		init();
		while(scan.hasNext()){
			out.println(ary[si()]);
		}
		out.flush();
	}

	static void init(){
		ary[0] = 1;
		int b = 1;
		for (int i = 1; i <= 10000; i++) {
			ary[i]=ary[i-1]+b;
			b++;
		}
	}

	static int si() {
		return Integer.parseInt(scan.next());
	}
}

Measured memory_bytes: 17208
#include<bits/stdc++.h>                   // below comment for pbds
#include<ext/pb_ds/assoc_container.hpp>   // to use it make ordered_set
#include<ext/pb_ds/tree_policy.hpp>       // all set fnct + = 1. order_of_key(x); // number of 
#define ll long long                      //element strictly smaller than it;
#define ld long double                    // 2. find_by_order(x),pointer el at x pos after sort  use as s.f();
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace std;                     
using namespace __gnu_pbds;



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.flush();
	ll t=1;
	ll CaseN=1; 
	//cin>>t;
	while(t--)
	{
			string s,tt;
			bool ans=true;
			cin>>s>>tt;
		ll n = s.length();
		ll m = tt.length();
		if(m<=n)
		{
			ans = false;
		}
		else
		{
		for(ll i=0;i<min(n,m);i++)
		{
		if(s[i]!=tt[i])
		{
		ans = false;
		break;	
		}
			
		}	
			
			
			
		}
			
		
		//cout<<"Case #"<<CaseN<<": ";
		CaseN++;
		// print your ans below;
		if(ans)
{ cout<<"Yes"<<endl;  }
else
{cout<<"No"<<endl;}
	}

return 0;
}


Measured memory_bytes: 3656
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;

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

int main() {

    ll A[5];
    ll min = 10;
    ll out = 0;
    rep(i,5){
      cin >> A[i];
      out += A[i]/10*10;
      if(A[i]%10!=0) out += 10;
      if(A[i]%10<min&&A[i]%10!=0) min = A[i]%10;
    }
    out = out-10+min;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    string w;
    cin >> w;
    int a = (int)'a';
    // cout << a << endl;
    vector<pair<int,int>> cp(a+26);
    rep(i,26){
        cp.at(i).first=i;
    }
    
    rep2(i,a,a+26){
        rep(j,w.size()){
            if((int)w.at(j)==i){
                cp.at(i).second++;
            }
        }
    }
    bool ans=true;
    rep2(i,a,a+26){
        if(cp.at(i).second%2!=0){
            ans=false;
            break;
        }
    }
    if(ans){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.ParseException;

public class Main {

	public static void main(String[] args) throws ParseException, IOException {
		
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		
		String strTime = br.readLine();
		
		int intTime = Integer.parseInt(strTime);
		
		int intHour = intTime / 3600;
		int intMin =  (intTime%3600) / 60;
		int intSec = intTime % 60;
		
		System.out.println(intHour + ":" + intMin + ":" + intSec);
	}
}


Measured memory_bytes: 24328
#include<bits/stdc++.h>
#include<vector>
#include<cmath>
#define rep(i,a,b) for(int i=a;i<b;++i)
using namespace std;
typedef long long ll;
void chmin(int &a,int b){if(a>b) a=b;} //Compare two numbers and return smaller one in reference variety a
int m1,m2,d1,d2;


int main()
{

    cin>>m1>>d1;
    cin>>m2>>d2;
    if(m1!=m2 and d2==1)
    {
        cout<<1;
    }
    else cout <<0;
    
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
 
#define PI 3.14159265359
 
int main() {
    int n, x[100], y[100], i, s[100], max = 0;
    double result = 0;
    scanf("%d", &n);
    for(i = 0; i < n; ++i) {
        scanf("%d", &x[i]);
    }
    for(i = 0; i < n; ++i) {
        scanf("%d", &y[i]);
        s[i] = x[i] - y[i];
    }
    for(i = 0; i < n; i++) {
        if(s[i] < 0) {
            result -= (double)s[i];
            if(max < -s[i]) max = -s[i];
        }
        else {
            result += (double)s[i];
            if(max < s[i]) max = s[i];
        }
    }
    printf("%f\n", result);
    result = 0;
    for(i = 0; i < n; i++) {
        result += pow((double)s[i], 2.0);
    }
    result = sqrt(result);
    printf("%f\n", result);
    result = 0;
    for(i = 0; i < n; i++) {
        if(s[i] < 0) result -= pow((double)s[i], 3.0);
        else result += pow((double)s[i], 3.0);
    }
    result = cbrt(result);
    printf("%f\n", result);
    result = 0;
    printf("%f\n", (double)max);
     
    return 0;
}


Measured memory_bytes: 2148
n=int(input())
a=list(map(int,input().split()))
plus={}
minus={}
for i in range(n):
  if(a[i]+(i+1)<=10**9):
    if a[i]+(i+1) in plus.keys():
      plus[a[i]+(i+1)]+=1
    else:
      plus[a[i]+(i+1)]=1
  if(a[i]<(i+1)):
    if (i+1)-a[i] in minus.keys():
      minus[(i+1)-a[i]]+=1
    else:
      minus[(i+1)-a[i]]=1
ans=0
for i in plus.keys():
  if i in minus.keys():
    ans+=plus[i]*minus[i]
print(ans)


Measured memory_bytes: 117704
N,K = map(int,input().split(' '))
A = list(map(int,input().split(' ')))
F = list(map(int,input().split(' ')))

F.sort(reverse=True)
A.sort()
#print(A)
#print(F)

B = [f*a for f,a in zip(F,A)]
mn = 0
mx = max(B)

ans = mx
m = (mn+mx)//2
while True:
    flag = True 
    k = 0
    for i in range(N):
        if B[i] >= m:
            k += -(-(B[i] - m) // F[i])
            if k > K:
                flag = False
                break
    if flag:
        if m == mx:
            break
        ans = m
        mx = m
        m = (mn+mx)//2
    else:
        if m == mn:
            break
        mn = m
        m = (mn+mx)//2
print(ans)







Measured memory_bytes: 119644
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
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;
}
#define INF 1e9
using ll = int64_t;
#define waru 1000000007

void Main() {
  int n;
  std::cin >> n;
  std::vector<ll> a(n);
  for (auto &x : a) {
    std::cin >> x;
  }

  std::unordered_map<ll, ll> m;
  ll mmax = *max(a.begin(), a.end());
  rep(i, mmax) { m[i] = 0; }

  for (auto &x : a) {
    m[x]++;
  }

  ll ans = 0;
  repf(i, 1, 100001) { chmax(ans, m[i + 1] + m[i - 1] + m[i]); }
  std::cout << ans << '\n';

  return;
}

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


Measured memory_bytes: 5156
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define PR pair<int, int>
#define ios() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using namespace std;
//constexpr int MOD = 10e9+7;
constexpr int INF = 1LL << 60;
inline int in() {int x; cin >> x; return x;}
template <typename T> inline void out(const T& x) {cout << x << endl;}
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return 1;}return 0;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return 1;}return 0;}
//UP = 0;RIGHT = 1; DOWN = 2; LEFT =3;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b)
{
  if (a < b)
    gcd(b, a);
  int r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}
void eratos(bool * isPrime,int max){
  fill(isPrime,isPrime + max,true);
  isPrime[0] = false; 
  isPrime[1] = false; 
  for(int i=2; i<=max/i; ++i) 
      if(isPrime[i]) 
          for(int j=2; j<=max/i; ++j) 
              isPrime[i*j] = false;    
}
//

signed main()
{
  ios();
  int N,M;
  cin >> N >> M;
  for(int g = M/N;g >0; g--)
  {
    if(M % g == 0 &&  M/g >= N)
    {
      cout << g << endl;
      return 0;
    }
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const int MOD = 1000000007;
//const int MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const double pi = acos(-1.0);
const double EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct Union_Find_Tree{
    vector<int> par, rank, num;
    const int n;
    
    Union_Find_Tree(int n) : n(n){
        par.assign(n, -1), rank.assign(n, 0), num.assign(n, 1);
    }
    
    int root(int x){
        if(par[x] < 0 || par[x] == x) return x;
        return par[x] = root(par[x]);
    }
    
    bool unite(int x, int y){
        x = root(x), y = root(y);
        if(x == y) return false;
        if(rank[x] < rank[y]) swap(x, y);
        if(rank[x] == rank[y]) rank[x]++;
        par[y] = x, num[x] += num[y];
        return true;
    }
    
    int size(int x) {return num[root(x)];}
    
    bool same(int x, int y) {return root(x) == root(y);}
    
    void clear(){
        fill(all(par), -1), fill(all(rank), 0), fill(all(num), 1);
    }
};

int main(){
  ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  
    int N, Q;
    cin >> N >> Q;
    Union_Find_Tree uf(N);
    while(Q--){
        int q, u, v; cin >> q >> u >> v;
        if(q == 0) uf.unite(u, v);
        else cout << uf.same(u, v) << '\n';
    }
}

Measured memory_bytes: 5548
#include <iostream>
#include <math.h>
using namespace std;
using lld = long long int ;
#define mod 1000000007; 

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    char c[H][W];
    int count = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> c[i][j];
            if(c[i][j]=='#'){
                count++;
            }
        }
    }
    if(K>count){
        cout << 0 <<endl;
        return 0;
    }  
    int ans=0;
    for(int i=0;i<pow(2,H);i++){
        for(int j=0;j<pow(2,W);j++){
            int kcount=0;
            for(int k=0;k<H;k++){
                for(int l=0;l<W;l++){
                    if(((i>>k)%2==0)&&((j>>l)%2==0)){
                        if(c[k][l]=='#'){
                            kcount++;
                        }
                    }
                }
            }
            if(K==kcount){
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
    return 0;
}

Measured memory_bytes: 3944
#include <iostream>
using namespace std;
 
int main() {
    int A, B;
    cin >> A >> B;
 
    //Tとtimeの大小関係に応じて出力をする
    if (A == 1) {
        cout << "0" << endl;
    }
    else {
        cout << "1" << endl;
    }
}

Measured memory_bytes: 3632
#include<iostream>
#include<string.h>
using namespace std;
int nop(int x)
{
    int ans=0;
    for (int i = 1; i <= x;i++)
    {
        if(x%i==0)ans++;
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    int anss=0;
    for (int i = 1; i <= n;i=i+2)
    {
        if(nop(i)==8) anss++;
    }
    cout << anss;
    //system("pause");
    return 0;
}

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

int main () {
  long long int n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  long long int mina = min(a, b);
  mina = min(mina, c);
  mina = min(mina, d);
  mina = min(mina, e);

  long long int delay = n / mina;
  if (n % mina == 0) delay--;
  cout << 5 + delay << endl;
}


Measured memory_bytes: 256
def debug():
    import itertools
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    beauty = []
    for i in range(N):
        for j in range(i+1,N+1):
            part = a[i:j]
            beauty.append(sum(part))
    choise = [e for e in itertools.combinations(beauty,K)]
    ans = 0
    for pair in choise:
        res = pair[0]
        for i in range(1,len(pair)):
            res = res & pair[i]
        if res > ans :
            ans = res
            adopt = pair
    print(ans)
    print(pair)
    print(sorted(beauty))

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    degit = sum(a).bit_length()
    beaty = []
    manage = [[] for i in range(degit)]
    for i in range(N):
        for j in range(i+1,N+1):
            part_sum = sum(a[i:j])
            manage[part_sum.bit_length()-1].append(part_sum)
    
    candidate = []
    for i in range(degit-1,-1,-1):
        if len(manage[i]) >= K:
            candidate = manage[i]
            note = i
            break

    for i in range(note,-1,-1):
        final = []
        judge = pow(2,i)
        for e in candidate:
            if judge == judge & e:
                final.append(e)
        if len(final) == K:
            break
        elif len(final) > K:
            candidate = final
        if i == 0:
            final = candidate[:K]

    ans = final[0]
    for i in range(1,K):
        ans = ans & final[i]
    print(ans)    
main()

Measured memory_bytes: 24164
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

#ifdef LOCAL
#include<prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}


int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    int H, W;
    cin >> H >> W;

    char S[H][W];
    REP(i, H) {
        cin >> S[i];
    }

    int ch[H][W];
    int cw[H][W];

    // h
    REP(i, W) {
        int c = 0;
        int s = 0;
        REP(t, H) {
            if (S[t][i] == '#') {
                for(;s <= t;++s) {
                    ch[s][i] = c;
                }
                c = 0;
                ch[t][i] = 0;
            } else {
                c += 1;
                ch[t][i] = c;
            }
        }

        for(;s < H; ++s) {
            ch[s][i] = c;
        }
    }

    // W
    REP(i, H) {
        int c = 0;
        int s = 0;
        REP(t, W) {
            if (S[i][t] == '#') {
                for(;s <= t;++s) {
                    cw[i][s] = c;
                }
                c = 0;
                cw[i][t] = 0;
            } else {
                c += 1;
                cw[i][t] = c;
            }
        }
        for(;s <= W;++s) {
            cw[i][s] = c;
        }
    }

    int ans = 0;
    REP(i, H) REP(j, W) {
        ans = max(ch[i][j] + cw[i][j] - 1, ans);
    }

    cout << ans << endl;
    
}


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

#define fi first
#define se second

const int N = 200200;
const long long mod = 1e9 + 7;

using namespace std;

int n;
long long x[N];
long long y[N];
long long p[N];
long long d[N];
map < long long, set < pair < int, long long > > > s;
map < long long, long long > f;

void upd(long long i, int j, long long g)
{
        f[y[i]] += g;
        if(g == 1){
                s[y[i]].insert({j, i});
        } else if(s[y[i]].find({j, i}) != s[y[i]].end()){
                s[y[i]].erase(s[y[i]].find({j, i}));
        }
}

long long get(long long x) { return p[x] == x ? x : p[x] = get(p[x]); }

void un(int x, int y)
{
        x = get(x);
        y = get(y);
        if(x != y){
                p[x] = y;
        }
}

void solve(long long D, long long G)
{
        vector < int > v;
        for(int i = 1; i <= n; i++){
                v.push_back(i);
        }
        sort(v.begin(), v.end(), [&](int i, int j){
                return make_pair(x[i], y[i]) < make_pair(x[j], y[j]);
        });
        f.clear();
        s.clear();
        upd(v[0], 0, 1);
        for(int i = 0, l = 0, r = 0; i < n; i++){
                while(abs(x[v[i]] - x[v[l]]) > D - G){
                        upd(v[l], l, -1);
                        l += 1;
                }
                while(r + 1 < n && abs(x[v[i]] - x[v[r + 1]]) <= D - G){
                        r += 1;
                        upd(v[r], r, 1);
                }

                for(auto g: {y[v[i]] - D, y[v[i]] + D}){
                        if(f.find(g) == f.end() || f[g] == 0){
                                continue;
                        }
                        d[v[i]] += f[g];
                        while(s[g].size() > 1){
                                un(v[i], s[g].begin()->se);
                                s[g].erase(s[g].begin());
                        }
                        un(v[i], s[g].begin()->se);
                }
        }
}

int main()
{
        ios_base::sync_with_stdio(0);

        //freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);

        long long A, B;
        cin >> n >> A >> B;
        for(int i = 1; i <= n; i++){
                int X, Y;
                cin >> X >> Y;

                x[i] = X - Y;
                y[i] = X + Y;
                p[i] = i;
        }
        long long D = max(abs(x[A] - x[B]), abs(y[A] - y[B]));

        solve(D, 0);
        for(int i = 1; i <= n; i++){
                swap(x[i], y[i]);
        }
        solve(D, 1);

        long long res = 0;
        for(int i = 1; i <= n; i++){
                if(get(i) == get(A)){
                        res += d[i];
                }
        }

        cout << res / 2 << "\n";
}


Measured memory_bytes: 27760
import sys
N = input()
num =  [int(num) for num in input().split()]
flag=0
for n in num:
    if n % 2 == 0:
        if n % 3 == 0 or n % 5 == 0:
            flag = 0
        else:
            print('DENIED')
            sys.exit()
print('APPROVED')

Measured memory_bytes: 3060
import java.util.*;
public class Main {
	public static int f(long A, long B) {
		int a = (int)String.valueOf(A).length();
		int b = (int)String.valueOf(B).length();
		return Math.max(a, b);
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		long N = stdIn.nextLong();
		
		int min = f(1, N);
		for(int i = 1; i < Math.sqrt(N)+1; i++) {
			if(N%i == 0) {
				min = Math.min(min, f(i, N/i));
			}
		}
		
		System.out.println(min);

	}

}

Measured memory_bytes: 21716
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
#define itn int
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>=1;i--)
#define all(vec) vec.begin(),vec.end()
#define sort(vec) sort((vec).begin(),(vec).end())
#define rsort(vec) sort((vec).rbegin(), (vec).rend())
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef tuple<ll,ll,ll> tlll;
typedef tuple<int,int,int> tiii;
const ll mod=1e9+7;
const int inf=1<<30;
const ll lnf=1ll<<60;

int main(){
  itn n; cin >> n;
  vector<ll> a(n);
  vector<ll> s(n);
  rep(i,n) cin >> a[i];
  s[0]=a[0];
  rep(i,n-1){
    s[i+1]=a[i+1]+s[i];
  }
  int b=-1;
  bool p=1;
  rep(i,n){
    if(s[i]==0){
      b=i;
      if(i+1<n&&s[i+1]<0) p=0;
    }
  }
  if(b==n-1){
    cout << 1+2*(n-1) << endl;
    return 0;
  }
  ll add1=0;
  ll add2=0;
  if(b!=-1){
    if((b+1)%2==0&&s[b+1]<0||(b+1)%2==1&&s[b+1]>0){
      add1=-1;
      add2=1;
    }
    else{
      add1=1;
      add2=-1;
    }
  }
  else{
    if(s[0]<0) add2=1-s[0];
    else add2=-1-s[0];
  }
  ll ans1=abs(add1);
  ll ans2=abs(add2);
  ll newadd1=0;
  ll newadd2=0;
  rep(i,n-1){
    if((s[i]+add1)*(s[i+1]+add1)>=0){
      if(s[i]+add1<0) newadd1=1-(s[i+1]+add1);
      else newadd1=(-1)-(s[i+1]+add1);
      add1+=newadd1;
      ans1+=abs(newadd1);
    }
  }
  rep(i,n-1){
    if((s[i]+add2)*(s[i+1]+add2)>=0){
      if(s[i]+add2<0) newadd2=1-(s[i+1]+add2);
      else newadd2=(-1)-(s[i+1]+add2);
      add2+=newadd2;
      ans2+=abs(newadd2);
    }
  }
  cout << min(ans1,ans2) << endl;
}

Measured memory_bytes: 4852
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

int main() {
  char a, b; cin >> a >> b;
  bool ans;
  if (b == 'H') ans = true;
  else ans = false;
  if (a == 'D') ans = !ans;

  if (ans) cout << 'H' << endl;
  else cout << 'D' << endl;
  return 0;
}


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

int main() {
  int N, Y;
  cin >> N >> Y;
  bool a = true;
  
  for (int i = 0; i <= N; i++) {
    if (a == false) {
      break;
    }
    for (int j = 0; j <= N; j++) {
      if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y && 0<= N - i - j) {
        cout << i << " " << j << " " << N - i - j << endl;
        a = false;
      }
    }
  }
  
  if (a == true) {
    cout << "-1 -1 -1" << endl;
  }
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        int n1 = Integer.parseInt(bf.readLine());
        String[] sp1 = bf.readLine().split(" ");
        int n2 = Integer.parseInt(bf.readLine());
        String[] sp2 = bf.readLine().split(" ");
        int sum = 0;
        for (int j = 0; j < n2; j++) {
            if (binarySearch(sp1, sp2[j], 0, n1-1)) {
                sum++;
            }
        }
        System.out.println(sum);
    }

    private static boolean binarySearch(String sp2[], String key, int left, int right) {
        int mid = (left + right) / 2;
        if (left > right) {
            return false;
        }
        if (key.equals(sp2[mid])) {
            return true;
        } else if (Integer.parseInt(key) > Integer.parseInt(sp2[mid])) {
           return binarySearch(sp2, key, mid+1, right);
        } else {
            return binarySearch(sp2, key, left, mid-1);
        }

    }

}



Measured memory_bytes: 52236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define In_The_Name_Of_Allah_The_Merciful ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define Alhamdulillah return 0;
#define all(v) v.begin(),v.end()
#define debug(n) cerr << "[" << #n << " = " << n << "]" << endl 

void Suhaib_Sawalha (){

    int n;
    cin >> n;
    vector <int> v(n) , a(n) , b(n);

    for (int i = 0 ; i < n ; ++i)
        cin >> a[i];
    for (int i = 0 ; i < n ; ++i)
        cin >> b[i];
    iota(v.begin(),v.end(),1);

    int cnt = 0 , aa , bb;
    do {
        ++cnt;
        if (a == v) aa = cnt;
        if (b == v) bb = cnt;
    } while (next_permutation(v.begin(),v.end()));

    cout << abs(aa-bb);

}

int main(){
                                In_The_Name_Of_Allah_The_Merciful   /* بسم الله الرحمن الرحيم  */
#ifndef ONLINE_JUDGE
    freopen("SuhaibSawalha1.txt","r",stdin);
#endif
//int _;for(cin>>_;_;--_,cout<<'\n')
        Suhaib_Sawalha();
                                         Alhamdulillah                    /* الحمد لله */
}

Measured memory_bytes: 3612
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)


def dfs(prev, u):
    if visited[u]:
        return
    else:
        cnt[u] += cnt[prev]
        visited[u] = True
        for nu in graph[u]:
            if visited[nu]:
                continue
            else:
                dfs(u, nu)


n, q = map(int, input().split())
graph = defaultdict(list)

for _ in range(n - 1):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

cnt = [0] * (n + 1)

for _ in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

visited = [False] * (n + 1)

dfs(0, 1)

print(*cnt[1:])

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

int main() {
	int N, M; cin >> N >> M;
	int t = 100 * (N - M) + 1900 * M;
	for (int i = 0; i < M; i++)
		t *= 2;
	cout << t << endl;
	//system("pause");
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d",&a,&b);

    if(a < b){
      printf("a < b");
    }else if(a > b){
        printf("a > b");
    }else if(a == b){
        printf("a == b");
    }
    printf("\n");
    return 0;
}

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


def main():
    a = int(input())
    b = int(input())
    e = int(input())
    g = a + b - e
    i = b + e - g
    f = a + g - e
    c = a + i - g
    d = b + c - g
    h = a + d - i

    print(a, b, c)
    print(d, e, f)
    print(g, h, i)


if __name__ == '__main__':
    main()


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

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int m = int.Parse(In[1]);
            var L = new List<int>[m];//電球
            for (int i = 0; i < m; i++)
            {
                L[i] = new List<int>();
            }
            for (int i = 0; i < m; i++)
            {
                string[] In2 = Console.ReadLine().Split(' ');
                int k = int.Parse(In2[0]);
                for (int j = 0; j < k; j++)
                {
                    int s = int.Parse(In2[j + 1]);
                    L[i].Add(s-1);
                }
            }
            string[] In3 = Console.ReadLine().Split(' ');
            int[] P = new int[m];
            for (int i = 0; i < m; i++)
            {
                P[i] = int.Parse(In3[i]);
            }
            int ans = 0;
            for (int i = 0; i < (1 << n); i++)//1<<0=1 1<<1=2 1<<2=4　なので1<<nはn+1桁の2進数で表せる最大の数
            {
                var d = new int[n];//スイッチのオンオフ
                for (int j = 0; j < n; j++)
                {
                    if (((i >> j) & 1) == 1) { d[j] = 1; }//iのjビット目が１か
                }
                bool flag = true;
                for(int k = 0; k < m; k++)//電球
                {
                    int cnt = 0;

                    foreach (var l in L[k])
                    {
                        if (d[l] == 1) cnt++;
                    }
                    if (P[k] != cnt%2)
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag) ans++;
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27960
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc= new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    ArrayList<Integer> g[]= new ArrayList[n+1];
    for(int i=0;i<=n;i++)
      g[i]=new ArrayList<Integer>();
    for(int i=0;i<m;i++)
    {
      int x=sc.nextInt();
      int y=sc.nextInt();
      g[x].add(y);
    }
    boolean vis[]= new boolean[n+1];
    int dp[]=new int[n+1];
    for(int i=1;i<=n;i++)
    {
      if(!vis[i])
        dfs(vis,dp,g,i);
    }
    int max=0;
    for(int i=1;i<=n;i++)
		max=Math.max(max,dp[i]);
    System.out.println(max);
  }
  static void dfs(boolean vis[],int dp[],ArrayList<Integer> g[],int i)
  {
    vis[i]=true;
    for(int j=0;j<g[i].size();j++)
    {
      if(!vis[g[i].get(j)])
        dfs(vis,dp,g,g[i].get(j));
      dp[i]=Math.max(dp[i],1+dp[g[i].get(j)]);
    }
  }
}
      

Measured memory_bytes: 105852
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.PrintStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BGreedyTakahashi solver = new BGreedyTakahashi();
        solver.solve(1, in, out);
        out.close();
    }

    static class BGreedyTakahashi {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long a = in.nextLong();
            long b = in.nextLong();
            long k = in.nextLong();
            out.print(k <= a ? (a - k) + " " + b : "0 " + Math.max(0, (b - k + a)));
        }

    }

    static class FastReader {
        public BufferedReader br;
        public StringTokenizer st;
        String context = null;

        public FastReader(InputStream in) {
            this(new InputStreamReader(in));
        }

        public FastReader(InputStreamReader input) {
            br = new BufferedReader(input);
        }

        public String next() {
            if (context != null) {
                System.err.print("[" + context + "] Wait for input ...");
            }
            while (st == null || !st.hasMoreElements()) {
                try {
                    String s = br.readLine();
                    if (s == null)
                        return null;
                    st = new StringTokenizer(s);
                } catch (IOException e) {
                    e.printStackTrace();
                    throw new RuntimeException("Could not read");
                }
            }
            String res = st.nextToken();
            if (context != null) {
                System.err.println("[" + context + "] ... received : " + res);
            }
            return res;
        }

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

    }
}



Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
    int A, B, m;
    cin >> A >> B >> m;
    int a[A], b[B];
    int mna = INF, mnb = INF;
    rep(i, A) {
        cin >> a[i];
        mna = min(mna, a[i]);
    }
    rep(i,B){
        cin >> b[i];
        mnb = min(mnb, b[i]);
    }
    int x[m], y[m], c[m];
    rep(i,m){
        cin >> x[i] >> y[i] >> c[i];
        x[i]--;
        y[i]--;
    }
    int ans = mna + mnb;
    rep(i,m){
        ans = min(ans, a[x[i]] + b[y[i]] - c[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0 ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
 
}


int32_t main(){
  fastio;
  int n,m;
  cin>>n>>m;
  vector<int> v(n);
  int tot=0;
  for(int i=0;i<n;i++){
    cin>>v[i];
    tot+=v[i];
  }
  sort(v.begin(),v.end(),greater<int>());

  int can=0;
  for(int i=0;i<n;i++){
      if(v[i]*4*m>=tot)can++;
  }
  cout<<(can>=m ? "Yes" : "No")<<endl;
  // Math -> gcd it all // chack MAXN // check ll
  //did you check N=1? Did you mix up N,M?
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

n = int(input())
t = [list() for _ in range(n)]
color = [0] * (n-1)

for i in range(n-1):
    a, b = map(int, input().split())
    a -= 1; b -= 1
    t[a].append((b, i))
    t[b].append((a, i))

def dfs(v, p, pc):
    c = 1
    for nv, edge in t[v]:
        if nv == p: continue
        if c == pc: c += 1
        color[edge] = c
        dfs(nv, v, c)
        c += 1

dfs(0, -1, 0)
print(max(color))
print(*color, sep="\n")

Measured memory_bytes: 98204
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let k: usize = sc.read();
    let n: usize = sc.read();

    if k % 2 == 0 {
        print!("{}", k / 2);
        for _ in 1..n {
            print!(" {}", k);
        }
        println!();
        return;
    }

    let x = (k + 1) / 2;
    let mut cur = vec![x; n];
    let mut ptr = n - 1;
    for _ in 0..(n / 2) {
        cur[ptr] -= 1;
        if cur[ptr] == 0 {
            ptr -= 1;
        } else {
            while ptr + 1 < n {
                ptr += 1;
                cur[ptr] = k;
            }
        }
    }

    print!("{}", cur[0]);
    for i in 1..n {
        if cur[i] == 0 {
            break;
        }
        print!(" {}", cur[i]);
    }
    println!();
}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 10492
#include<bits/stdc++.h>
#define all(x) begin(x),end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << " " <<
using namespace std;
using ll=long long;

const int MXN=100005;
const int MOD=1e9+7;
int add(int x,int y){return(x+=y)<MOD?x:x-MOD;}
int sub(int x,int y){return(x-=y)>= 0?x:x+MOD;}
int mul(int x,int y){return(ll)x*y%MOD;}

int n,dp[MXN][2];
vector<int>adj[MXN];

void dfs(int x,int p){
  dp[x][0]=1;
  dp[x][1]=1;
  for(int y:adj[x]){
    if(y==p)continue;
    dfs(y,x);
    dp[x][0]=mul(dp[x][0],add(dp[y][0],dp[y][1]));
    dp[x][1]=mul(dp[x][1],dp[y][0]);
  }
}

int main(){
  scanf("%d",&n);
  for(int i=1;i<n;++i){
    int x,y;
    scanf("%d%d",&x,&y);
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1,0);
  printf("%d\n",add(dp[1][0],dp[1][1]));
}


Measured memory_bytes: 13440
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = 100003;
int n, a[N];
LL ans, mx = 1e9;
bool flag;
int main(){
	scanf("%d", &n);
	for(Rint i = 1;i <= n;i ++){
		scanf("%d", a + i); if(a[i] < 0) flag ^= 1;
	}
	sort(a + 1, a + n + 1);
	if(a[1] < 0 && flag){
		for(Rint i = 1;i <= n;i ++) ans += labs(a[i]);
		for(Rint i = 1;i <= n;i ++)
			if(mx > labs(a[i])) mx = labs(a[i]);
		ans -= mx * 2;
	} else {
		for(Rint i = 1;i <= n;i ++) ans += labs(a[i]);
	}
	printf("%lld", ans);
}

Measured memory_bytes: 640