akhauriyash/Code-Regression huggingface dataset:
function main(input){
  const args1=input.split('\n')[0];
  const args2=input.split('\n')[1];
  const H = parseInt(args1.split(" ")[0], 10);
  const W = parseInt(args1.split(" ")[1], 10);
  const h = parseInt(args2.split(" ")[0], 10);
  const w = parseInt(args2.split(" ")[1], 10);
  console.log((H-h)*(W-w));

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 11468
// Goods things are coming, just keep believing 
 
#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 FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define okay cout << "okay" << endl
// #define hey cout << "hey" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define endl '\n'
#define ff first 
#define int long long
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 #define ld long double
#define INF 1000000000;
 
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
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
 
 
const int N = 5e5 + 5;
const int LG = 20;
const int mod = 1e9 + 7;

int arr[N];

void solve()
{
	int n, m;
	cin >> n >>m;
	if(n == m)cout << "Yes";
	else cout << "No";
}
 
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
const int INF=10000000;

int main(){
  int n,m;
  cin >> n >> m;
  vector<int>to[100005];
  for(int i=0;i<m;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  
  queue<int>q;
  vector<int>dist(n,INF);
  vector<int>pre(n,-1);
  dist[0]=0;
  q.push(0);
  while(!q.empty()){
    int v=q.front();
    q.pop();
    for(int u:to[v]){
      if(dist[u]!=INF){
        continue;
      }
      dist[u]=dist[v]+1;
      pre[u]=v;
      q.push(u);
    }
  }
  cout << "Yes" << endl;
  for(int i=1;i<n;i++){
    int ans=pre[i];
    ans++;
    cout << ans << endl;
  }
}

Measured memory_bytes: 10748
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>

int main(){

    int n;
    bool flag = false;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i < n;i++){
        cin >> a[i];

    }
    for(int i=0;i < n;i++){
    
        if(a[i] % 2 == 0){
            if(a[i] % 3 == 0 || a[i] % 5 == 0 ) flag = true;
            else {
                flag  = false;
                break;
            }
        }else{
            flag = true;
        }

        
    }

    if(flag) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <queue>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <map>
#include <functional>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))

using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;
const ll inf = (1LL << 60);
const ll mod = 1000000007;
ll max(ll a, ll b) {
	if (a < b)
		return b;
	else
		return a;

}
ll min(ll a, ll b) {
	if (a < b)
		return a;
	else
		return b;

}


map<pair<string, string>, ll> s1l, s2l;


ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}

	else {

		return gcd(b, a % b);
	}

}

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

	ll d = gcd(C, D);

	ll p = C / d, q = D / d;
	ll com = p * q * d;
	ll ans = (B - A + 1) - (B / C - A / C + (A % C == 0 ? 1 : 0)) - (B / D - A / D + (A % D == 0 ? 1 : 0)) + (B/com- A/com + (A%com == 0 ? 1:0));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int ans[100*1000*10];

int nCk(int n,int k){
  long long ret = 1;
  REP(i,k) ret*=(n-i);
  REP(i,k) ret/=(i+1);
}

int main(){
  int n;
  while(scanf("%d",&n),n){
    pair<int,int> card[n];
    int mm = 0;
    REP(i,n) scanf("%d%d",&(card[i].f),&(card[i].s));
    sort(card,card+n);
    memset(ans,0,sizeof(ans));
    ans[0] = 1;
    REP(i,n){
      for(int j=mm; j>=0; j--){
	if(ans[j] != 0){
	  for(int k=1; k<=card[i].s; k++){
	    //printf("j=%d, j+k*card[i].f=%d ans[j]=%d\n",j,j+k*card[i].f,ans[j]);
	    ans[j+k*card[i].f] += ans[j];
	  }
	  mm = max(mm, j+card[i].s*card[i].f);
	}
      }
    }
    int g; cin>>g;
    REP(i,g){
      int gg; cin>>gg;
      cout << ans[gg] << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 0
use contest::io::Scanner;

fn main() {
    let mut sc = Scanner::new(std::io::stdin());
    let res = f(sc.next()) ^ f(sc.next::<i64>() + 1);
    println!("{}", res);
}

fn f(x: i64) -> i64 {
    match x % 4 {
        0 => 0,
        1 => x - 1,
        2 => 1,
        3 => (x - 1) ^ 1,
        _ => 0,
    }
}
pub mod contest {
    pub mod io {
        /// Scanner
        ///
        /// # Example
        /// ```
        /// use contest::io::Scanner;
        /// let mut sc = Scanner::new("1 2 \n\n \r\t \n 3.5".as_bytes());
        /// assert_eq!("1".to_string(), sc.next::<String>());
        /// assert_eq!(2, sc.next());
        /// assert_eq!(3.5, sc.next());
        ///
        /// // To create a scanner from stdin:
        /// Scanner::new(std::io::stdin());
        /// ```
        use std;
        use std::io;
        use std::io::BufRead;

        pub struct Scanner<R: io::Read> {
            br: io::BufReader<R>,
            // Read tokens are stored in reversed order per line.
            buf: Vec<String>,
        }

        pub fn new<R: io::Read>(r: R) -> Scanner<R> {
            Scanner::new(r)
        }

        impl<R: io::Read> Scanner<R> {
            #[inline]
            pub fn new(r: R) -> Scanner<R> {
                Scanner {
                    br: io::BufReader::new(r),
                    buf: vec![],
                }
            }
            #[inline]
            pub fn next<T>(&mut self) -> T
            where
                T: std::str::FromStr,
                T::Err: std::fmt::Debug,
            {
                self.next_string()
                    .map(|s| s.parse::<T>().expect("Parse failed: "))
                    .expect("Unexpected EOF")
            }
            #[inline]
            pub fn next2<T1, T2>(&mut self) -> (T1, T2)
            where
                T1: std::str::FromStr,
                T2: std::str::FromStr,
                T1::Err: std::fmt::Debug,
                T2::Err: std::fmt::Debug,
            {
                (self.next(), self.next())
            }
            fn next_string(&mut self) -> Option<String> {
                self.buf.pop().or_else(|| match self.update() {
                    true => self.next_string(),
                    false => None,
                })
            }
            #[inline]
            fn update(&mut self) -> bool {
                let mut s = String::new();
                let res = self.br.read_line(&mut s);
                match res.expect("I/O error.") {
                    0 => false,
                    _ => {
                        self.buf = s.split_whitespace().map(|x| x.to_string()).rev().collect();
                        true
                    }
                }
            }
        }

        #[test]
        fn test_next() {
            let mut sc = new("hoge".as_bytes());
            let s: String = sc.next();
            assert_eq!("hoge", s);
        }
    }
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,maxn=0,minn=INT_MAX;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int k;
		cin>>k;
		maxn=max(maxn,k);
		minn=min(minn,k);
	}
	cout<<maxn-minn<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());
        int d = Integer.parseInt(sc.next());
        int ans1 = (int)Math.ceil(c * 1.0 / b);
        int ans2 = (int)Math.ceil(a * 1.0 / d);
        if (ans1 > ans2) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}

Measured memory_bytes: 35680
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD=998244353;
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)

int main(void){
    string s;
    cin>>s;
    rep(i,s.size()) cout<<'x';
    cout<<endl;
    return 0;
}

Measured memory_bytes: 3548
#include <cstdio>
#include <cstring>
#include <vector>
#define MAXN 20
#define MAXS 33000
#define LL long long
using namespace std;

const LL P=1000000007;

int n,m,maxs;
int w[MAXN][MAXN];
LL f[MAXN][MAXS];
vector< pair<int,LL> > trans[MAXS];
LL g[MAXS];

void pre_gao(int x){
	for(int y=x;;y=(y-1)&x){
		LL res=1;
		int cnt=0;
		for(int i=1;i<=n;i++)
			if((1<<(i-1))&y){
				int temp=0;
				for(int j=i+1;j<=n;j++)
					if(((1<<(j-1))&x) && !((1<<(j-1))&y) && w[i][j])
						temp++;
				res=res*((1LL<<temp)-1)%P;
			}else if((1<<(i-1))&x){
				for(int j=i+1;j<=n;j++)
					if(((1<<(j-1))&y) && w[i][j])
						cnt++;
			}
		while(cnt--) res=res*2%P;
		if(res) trans[x].push_back(make_pair(y,res));
		if(!y) break;
	}
	int temp=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(w[i][j] && ((1<<(i-1))&x) && ((1<<(j-1))&x))
				temp++;
	g[x]=1;
	while(temp--) g[x]=g[x]*2%P;
}

inline void update(LL &x,LL y){ x=(x+y)%P; }

int main(){
#ifdef DEBUG
	freopen("F.in","r",stdin);
#endif
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		w[x][y]=1;
	}
	maxs=1<<n;
	for(int i=0;i<maxs;i++) pre_gao(i);
	f[0][maxs-1]=1;
	LL ans=0;
	for(int i=0;i<n;i++)
		for(int j=0;j<maxs;j++)
			if(f[i][j]){
				for(int k=0;k<trans[j].size();k++)
					if((trans[j][k].first&3)==3)
						update(f[i+1][trans[j][k].first],f[i][j]*trans[j][k].second);
					else if((trans[j][k].first&3)==0)
						update(ans,f[i][j]*trans[j][k].second%P*g[trans[j][k].first]);
			}
	LL temp=1;
	for(int i=1;i<=m;i++) temp=temp*2%P;
	ans=(temp-ans+P)%P;
	printf("%lld\n",ans);
}


Measured memory_bytes: 119804
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    int a,b;
    cin >> a >> b;
    cout << (a-1) * (b-1) << endl;
    return 0;
}

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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<pair<string,ll> > svp;

#define spc        ' '
#define endl       '\n'
#define F          first
#define S          second
#define pp         pop_back`
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define PI         2*acos(0.0);
#define lb         lower_bound
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define btpc       __builtin_popcountll
#define sp(x)      cout<<fixed<<setprecision(x)

const   long long  cs=2e5+5;
const   long long  inf=1e18;
const   long long  mod=1e9+7;
char s[cs],s1[cs];
void solve()
{
    ll t,n,m,a,b,d,e,i,j,k,x,y,z,cnt=0,cnt1=0,cnt2=0;
    bool flag = false;   /*vector<long long>v,v1;*/
    
    char c;
    cin>>c;
    if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u')  
        cout<<"vowel"<<endl;
    else {
        cout<<"consonant"<<endl;
    }
    

}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

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

    // ll tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}


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

using namespace std;

void fastio() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
}

int main() {
	fastio();
	int n; cin >> n;
	if (n >= 30) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 3664
import Control.Applicative
import Data.List
import qualified Data.Set as Set
import qualified Data.IntMap as IMap

main = do
    [n,k] <- map read . words <$> getLine  :: IO [Int]
    list <- sequence (replicate n ((\[x,y]->(x,y)) . map read . words <$> getLine)) :: IO [(Int,Int)]
    print $ solve k list

solve :: Int -> [(Int,Int)] -> Int
solve k list = fd k dic
    where dic = make list

fd k dic = if b >= k then a else (fd (k-b) dic_)
    where ((a,b),dic_) = IMap.deleteFindMin dic

make :: [(Int,Int)] -> IMap.IntMap Int
make list = foldl append IMap.empty list

append :: IMap.IntMap Int -> (Int,Int) -> IMap.IntMap Int
append dic (a,b) = case mb of Nothing -> IMap.insert a b dic
                              Just x  -> IMap.update (\y -> Just (b+y)) a dic
    where mb = IMap.lookup a dic



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

int main() {
  int count = 0;
  for (int i = 0; i < 5; i++) {
    int X;
    cin >> X;
    if (X == 0) {
      break;
    }
    count++;
  }
  cout << count + 1 << endl;
}

Measured memory_bytes: 3596
//各iにおいて、2を足してB[i] > A[i]にするという操作を行い
//その操作を(ΣB - ΣA)回までに行えたら、望んだ数列を作れる
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;
    int A[N+3], B[N+3];
    ll diff = 0;
    for(int i = 0; i < N; ++i) { cin >> A[i]; diff -= A[i]; }
    for(int i = 0; i < N; ++i) { cin >> B[i]; diff += B[i]; }

    ll cnt = 0;
    for(int i = 0; i < N; ++i) {
        if(B[i] > A[i]) {
            ll d = B[i] - A[i];
            cnt += (d%2 ? d/2 + 1 : d/2);
        }
        if(cnt > diff) { cout << "No" << endl; return 0; }
    }

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

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

int main()
{
	ll T1, T2;
	ll A1, A2;
	ll B1, B2;
	cin >> T1 >> T2 >> A1 >> A2 >> B1 >> B2;
	A1 *= T1;
	A2 *= T2;
	B1 *= T1;
	B2 *= T2;
	if (A1 + A2 == B1 + B2) {
		cout << "infinity" << endl;
		return 0;
	}
	if (A1 < B1 && A1 + A2 < B1 + B2) {
		cout << 0 << endl;
		return 0;
	}
	if (A1 > B1 && A1 + A2 > B1 + B2) {
		cout << 0 << endl;
		return 0;
	}
	if (A1 > B1) swap(A1, B1), swap(A2, B2);
	ll d = (A1 + A2) - (B1 + B2);
	cout << ((B1 - A1) / d * 2 + ((B1 - A1) % d != 0)) << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int d = sc.nextInt();
        int x2000 = sc.nextInt();
        int xprev = x2000;
        for (int i = 2001; i <= 2010; i++) {
            int x = r * xprev - d;
            System.out.println(x);
            xprev = x;
        }
    }

}


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

int main() {
    int A, B, cnt=0;
    cin>>A>>B;

    while(A<=B){
        if(A/10000==A%10){
            if((A%10000)/1000==(A%100)/10) cnt++;
        }
        A++;
    }
    
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


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

    l = [[0] * W for _ in range(H)]
    r = [[0] * W for _ in range(H)]
    u = [[0] * W for _ in range(H)]
    d = [[0] * W for _ in range(H)]

    for h in range(H):
        cur = 0
        for w in range(W):
            if grid[h][w] == '#':
                cur = 0
            else:
                cur += 1
            l[h][w] = cur

    for h in range(H):
        cur = 0
        for w in reversed(range(W)):
            if grid[h][w] == '#':
                cur = 0
            else:
                cur += 1
            r[h][w] = cur

    for w in range(W):
        cur = 0
        for h in range(H):
            if grid[h][w] == '#':
                cur = 0
            else:
                cur += 1
            u[h][w] = cur

    for w in range(W):
        cur = 0
        for h in reversed(range(H)):
            if grid[h][w] == '#':
                cur = 0
            else:
                cur += 1
            d[h][w] = cur

    ans = 0
    for h in range(H):
        for w in range(W):
            ans = max(ans, r[h][w] + l[h][w] + u[h][w] + d[h][w] - 3)
    print(ans)


resolve()

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

#define ll long long
#define all(x) (x).begin(), (x).end()
const long long INF = 1LL << 60;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)  //(i, 10) i=0～i=9まで
#define repr(i, n) for (int i = n; i >= 0; i--)   // (i, 10) i=10～i=0まで
#define FOR(i, m, n) for (int i = m; i < n; i++)  // (i, 3, 10) i=3～i=9まで

// 総数を1000000007で割った余り
const long long mod = 1e9 + 7;

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

    // 入力
    double a, b;
    cin >> a >> b;

    // 処理
    // 出力
    cout << ceil((a + b) / 2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

struct UnionFind
{
  vector<int> p;
  UnionFind(int n) : p(n, -1) {}

  void unite(int x, int y){
    x = root(x);
    y = root(y);
    if (x != y) {
      if (p[y]<p[x]) std::swap(x,y);
      p[x] += p[y];
      p[y] = x;
    }
  }

  bool same(int x, int y){
    return root(x) == root(y);
  }

  int root(int x){
    return p[x] < 0 ? x : p[x] = root(p[x]);
  }
};

int main(int argc, char const *argv[])
{
	int n, q;
	cin >> n >> q;
	vector<int> ans;
	UnionFind uf(n);
	for (int i = 0; i < q; ++i) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com) ans.push_back(uf.same(x, y) ? 1 : 0);
		else uf.unite(x, y);
	}

	for (int i = 0; i < ans.size(); ++i){
		cout << ans[i] << endl;
	}

	return 0;
}


Measured memory_bytes: 3340
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

result = 0
result += a if a % 10 == 0 else a + 10 - a % 10
result += b if b % 10 == 0 else b + 10 - b % 10
result += c if c % 10 == 0 else c + 10 - c % 10
result += d if d % 10 == 0 else d + 10 - d % 10
result += e if e % 10 == 0 else e + 10 - e % 10

# i % 10が0以外で最小のものをみつける
min_mod = 10 if a % 10 == 0 else a % 10
if b % 10 != 0 and b % 10 < min_mod:
  min_mod = b % 10
if c % 10 != 0 and c % 10 < min_mod:
  min_mod = c % 10
if d % 10 != 0 and d % 10 < min_mod:
  min_mod = d % 10
if e % 10 != 0 and e % 10 < min_mod:
  min_mod = e % 10

if min_mod != 10:
  result -= 10 - min_mod
  
print(result)



Measured memory_bytes: 3064
# coding: utf-8
# Your code here!
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N, X = map(int, input().split())
a = list(map(int, input().split()))
x = list(map(lambda s: s - X , a))

print(abs(gcd_list(x)))

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll A[1005];

int main()
{
    ll N, K;
    cin >> N >> K;
    REP(i, N)
    {
        cin >> A[i];
    }
    vector<ll> v;
    REP(i, N)
    {
        ll s = 0;
        FOR(j, N, i)
        {
            s += A[j];
            v.push_back(s);
        }
    }

    for (int n = 60; n >= 0; --n)
    {
        vector<ll> t;
        REP(i, v.size())
        {
            if (((v[i] >> n) & 1) == 1)
                t.push_back(v[i]);
        }

        if (t.size() >= K)
            v = t;
    }

    ll ans = v[0];
    REP(i, v.size())
    {
        ans &= v[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6384
n = int(input())
tree = [[] for i in range(n+1)]
for i in range(n-1):
    a, b = map(int, input().split())
    tree[a].append([b, i+1])
    tree[b].append([a, i+1])

edge = [0] * n #ans
visit = [False] * (n+1) #vert
color = [set() for i in range(n+1)]
visit[1] = True
q = [1]
edge[1] = 1

while q:
    now = q.pop()
    c = 1
    for next, num in tree[now]:
        if not visit[next]:
            while c in color[now]:
                c += 1
            edge[num] = c
            color[next].add(c)
            visit[next] = True
            q.append(next)
            c += 1
    before = now

print(max(edge))
for i in range(1, n):
    print(edge[i])


Measured memory_bytes: 72052
#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 i64 = int_fast64_t;
using P = pair<int,int>;

int main(){
    int N, M;
    cin >> N >> M;
    const int MOD = 1e9 + 7;
    unordered_set<int> st;
    rep(i, M) {
        int a; cin >> a;
        st.insert(a);
    }

    vector<int> dp(N+1, 0);
    dp[0] = 1;
    if(!st.count(1)) dp[1] = 1;
    for(int i = 2; i <= N; i++){
        if(st.count(i)) continue;
        dp[i] = (dp[i-1] + dp[i-2]) % MOD;
    }

    cout << dp[N] << endl;

}


Measured memory_bytes: 4772
#k=int(input())
n,m=map(int,input().split())
#hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

sl=[]
cl=[]

for i in range(m):
    s,c=map(int,input().split())
    sl.append(s)
    cl.append(c)
flag=False
for i in range(1000):
    if len(str(i))==n:
        val=str(i)
        temp_flag=True
        for s,c in zip(sl,cl):
            if val[s-1]!=str(c):
                temp_flag=False
                break
        if temp_flag:
            flag=True
            break
if flag:
    print(i)
else:
    print(-1)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
#define REP(i,n) for(ll i=0; i<(n); i++)
#define REP2(i,x,n) for(ll i=x; i<(n); i++)
#define REP3(i,x,n) for(ll i=x; i>(n); i--)
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
#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(){
    char c;
    cin >> c;
    c++;
    cout << c << endl;
    return 0;
}

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

int main()
{
  	int n, ans=0;
  	cin>>n;
  	
  	int a[n+3];
  	for (int i=0; i<n; i++)
    {
      	cin>>a[i];
    }
 
  	int min=INT_MAX;
 
  	for (int i=0; i<n; i++)
    {
      	if (a[i] < min)
        {
          	min = a[i];
        }
      	if (a[i] <= min)
        {
          	ans++;
        }
    }
  	
  	cout<<ans<<endl;
}

Measured memory_bytes: 1024
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
mod=10**9+7
def bp(a,n):
        r=1
        while(n):
           if n%2:
              r=r*a%mod
           a=a*a%mod
           n>>=1
        return r
[n,k]=i2()
if n<=k:
   x=1
   for i in range(n-1):
      x*=2*n-1-i
      x%=mod
   y=1
   for i in range(n-1):
      y*=i+1
      y%=mod
   print((x*bp(y,10**9+5))%mod)   
   
else:
   x=1
   y=1
   t=1
   for i in range(k):
      t*=i+1
      t%=mod
      y*=n-1-i
      y%=mod
      y*=n-i
      y%=mod
      c=bp(t,10**9+5)
      x+=y*c*c
      x%=mod
   print(x)   

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

using namespace std;

long long int dis[500][500], g[500][500];

const long long int INF = 1e17;

int main(void) {
    long long int n, m, l;
    cin >> n >> m >> l;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            dis[i][j] = INF;
        }
        dis[i][i] = 0;
    }
    for (int i = 0; i < m; i++) {
        long long int a, b, c;
        cin >> a >> b >> c;
        dis[a][b] = dis[b][a] = c;
    }
    
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (dis[i][k] + dis[k][j] < dis[i][j]) {
                    dis[i][j] = dis[i][k] + dis[k][j];
                }
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n; j++) {
            g[i][j] = dis[i][j] <= l ? 0 : INF;
        }
    }
    for (int k = 1; k <= n; k++) {
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (g[i][k] + g[k][j] < g[i][j]) {
                    g[i][j] = g[i][k] + g[k][j] + 1;
                }
            }
        }
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int s, t;
        cin >> s >> t;
        if (g[s][t] >= INF) {
            cout << -1 << endl;
        } else {
            cout << g[s][t] << endl;
        }
    }
	return 0;
}



Measured memory_bytes: 2816
N = int(input())
a = list(map(int, input().split()))

cnt = {}
for i, ai in enumerate(a):
    cnt.setdefault(ai, 0)
    cnt.setdefault(ai + 1, 0)
    cnt.setdefault(ai - 1, 0)
    #
    cnt[ai] += 1
    cnt[ai + 1] += 1
    cnt[ai - 1] += 1

ans = max(cnt.values())
print(ans)

Measured memory_bytes: 19756
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	long long A,B,C;
	cin>>A>>B>>C;
	long long x = max(max(A,B),C);
	if (x%2==0){
		cout<<0<<endl;
	}else{
		if (x == A){
			cout<<B*C<<endl;
		}else if (x== B){
			cout<<A*C<<endl;
		}else if (x==C){
			cout<<A*B<<endl;
		}

	}

	return 0;
}

Measured memory_bytes: 256
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T

main :: IO ()
main = do
  [a, b, c, d] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  print . maximum $ [a * c, a * d, b * c, b * d]

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3708
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    std::string S;
    int K;
    std::cin >> S;
    std::cin >> K;

    const int L = S.size();

    std::set<std::string> cands;

    for (int i = 0; i < L; ++i) {
        for (int j = 1; j <= 5; ++j) {
            cands.insert(S.substr(i, j));
        }
    }

    auto itr = cands.begin();
    for (int i = 0; i < K-1; ++i) {
        itr++;
    }

    std::cout << *itr << std::endl;

    return 0;
}


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

int m, n, table[20][20];

bool ifcrossed(){
    bool flg = false;
    for(int j = 0; j < m-1 && !flg; j++){
        for(int k = 0; k < n-1 && !flg; k++){
            if( table[j][k] != table[j+1][k] &&
                    table[j][k] != table[j][k+1] &&
                    table[j+1][k] != table[j+1][k+1] &&
                    table[j][k+1] != table[j+1][k+1] ){
                flg = true;
            }
        }
    }
    return flg;
}

int tatami(int d){
    int i;
    bool cross;
    for(i = 0; i < m*n; i++){
        if( table[i/n][i%n] == 0 ) break;
    }
    int ans = 0;
    if( i%n < n-1 && !table[i/n][i%n]  && !table[i/n][i%n+1] ){
        table[i/n][i%n] = d;
        table[i/n][i%n+1] = d;
        if( d == m*n/2 ){
            bool flg = ifcrossed();
            if( !flg ) ans++;
            /*
            if( !flg ){
                for(int j = 0; j < m; j++){
                    for(int k = 0; k < n; k++){
                        cout << setw(3) << table[j][k];
                    }
                    cout << '\n';
                }
                cout << '\n';
            }
            */
        }else{ 
            if( !ifcrossed() ){
                ans += tatami(d+1);
            }
        }
        table[i/n][i%n] = 0;
        table[i/n][i%n+1] = 0;
    }
    if( i/n < m-1 && table[i/n][i%n] == 0 && table[i/n+1][i%n] == 0){
        table[i/n][i%n] = d;
        table[i/n+1][i%n] = d;
        if( d == m*n/2 ){
            bool flg = ifcrossed();
            if( !flg ) ans++;
            /*
            if( !flg ){
                for(int j = 0; j < m; j++){
                    for(int k = 0; k < n; k++){
                        cout << setw(3) << table[j][k];
                    }
                    cout << '\n';
                }
                cout << '\n';
            }
            */
        }else{
            if( !ifcrossed() ){
                ans += tatami(d+1);
            }
        }
        table[i/n][i%n] = 0;
        table[i/n+1][i%n] = 0;
    }
    return ans;
}

int main(){
    cin >> m >> n;
    while(m + n > 0){
        for(int i = 0; i < m; i++){
            for(int j = 0; j < n; j++){
                table[i][j] = 0;
            }
        }
        if( m%2 && n%2 ){
            cout << 0 << endl;
        }else{
            cout << tatami(1) << endl;
        }
        cin >> m >> n;
    }
    return 0;
}

Measured memory_bytes: 1176
import java.util.*;

class Main{
	public static void main(String agrs[]){
Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int m = sc.nextInt();
if(s>m){
		System.out.println("a > b");
}else if(s<m){
		System.out.println("a < b");
}else{
		System.out.println("a == b");
}
	}
}

Measured memory_bytes: 26260
#include <bits/stdc++.h>
#define sz(arr) (int)(arr).size()
#define rng(arr) arr.begin(), arr.end()
#define show(x) cout << #x << " = " << x << endl;
#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;
typedef long long int ll;

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

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

#define Cins(T, n, xs) \
  vector<T> xs(n);     \
  for (int i = 0; i < n; ++i) cin >> xs[i]

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

void Main() {
  Cin(int, n);
  Cins(int, n, a);

  int mxidx = distance(a.begin(), max_element(rng(a)));

  sort(rng(a));

  rep(i, n) {
    if (i == mxidx)
      cout << (a[n - 2]) << endl;
    else
      cout << a[n - 1] << endl;
  }
}


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

int cc[10001];
int su[10001];
int cntt = 0;
int dp[101][205];

int main(){
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&su[i]);
        if(!cc[su[i]]){
            cntt++;
            cc[su[i]] = cntt;
        }
        su[i] = cc[su[i]];
    }
    int m = cntt + n + 1;
    for(int i=1;i<=m;i++){
        dp[1][i] = 1;
    }
    dp[1][su[1]] = 0;
    for(int i=2;i<=n;i++){
        for(int ii=1;ii<=m;ii++) dp[i][ii] = 2100000000;
        for(int ii=1;ii<=m;ii++){
            for(int jj=1;jj<=m;jj++){
                if(ii == jj) continue;
                dp[i][jj] = min(dp[i][jj], dp[i-1][ii] + (su[i] != jj));
            }
        }
    }
    int ans = 2100000000;
    for(int i=1;i<=m;i++) ans = min(ans, dp[n][i]);
    printf("%d\n", ans);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
// Type alias
using ll=long long;
using ld=double;
 
using pi=pair<int,int>;
using pll=pair<ll,ll>;
using pld=pair<ld,ld>;
using ti3=tuple<int, int, int>;
 
using vi=vector<int>;
using vll=vector<ll>;
using vld=vector<ld>;
using vpi=vector<pi>;
using vpll=vector<ll>;
using vpld=vector<ld>;
using vti3=vector<ti3>;
 
// Constants
const double EPS = 1e-9;
const int inf = numeric_limits<int>::max();
 
// Macro
#define rep(i,n) for(int i=0;i<int(n);++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;--i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(i,a,b) for(int i=int(b-1);i>=int(a);--i)
#define SHOW(a) cout << #a << " = " << a << endl
#define ARR(a,n) for(int i=0;i<int(n);++i) cout << #a << "[" << i << "]" << " = " << a[i] << endl
 
#define ALL(a) a.begin(),a.end()
 
// Funtcions
ll pow(ll base, ll i, ll mod){
  ll a = 1;
  while(i){
    if (i & 1) {
      a *= base;
      a %= mod;
    }
    base *= base;
    base %= mod;
    i >>= 1;
  }
  return a;
}
ll gcd(ll a, ll b){
  while(b){
    ll c = a % b;
    a = b;
    b = c;
  }
  return a;
}
ll lcm(ll a, ll b){
  return a / gcd(a, b) * b;
}
 
 
void solve(){
  ll N, K;
  cin >> N >> K;

  N = N % K;
  if(N < K - N)
    cout << N;
  else
    cout << K-N;
  cout << endl;
}
 
int main(){
  // FastIO
  //ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}





















Measured memory_bytes: 256
#include <stdio.h>

int main(void){

  int n;
  scanf("%d", &n);
  char s[n+1];
  scanf("%s", s);

  int x[26];
  int y[26];
  int count;
  int max = 0;

  for (int i = 0; i < n-1; i++) {
    for (int j = 0; j < 26; j++) {
      x[j] = 0;
      y[j] = 0;
    }
    for (int j = 0; j < i+1; j++) {
      x[s[j]-'a']++;
    }
    for (int j = i+1; j < n; j++) {
      y[s[j]-'a']++;
    }
    count = 0;
    for (int j = 0; j < 26; j++) {
      if (x[j] > 0 && y[j] > 0) {
        count++;
      }
    }
    if (count > max) {
      max = count;
    }
  }
  printf("%d\n", max);

  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
main(){
  int a[10001]={0},i,j,n;
    for(i=2;i<=10000;i++){
      if(a[i]==0){
	for(j=2;i*j<=10000;j++){
	  a[i*j]=1;
	}     
      }
    }
    while(1){
      scanf("%d",&n);
      if(n==0)break;
      for(i=n;i>=2;i--){
	if(a[i]==0&&a[i-2]==0){
	  printf("%d %d\n",i-2,i);
	  break;
	}
      }
    }
    return 0;
}

Measured memory_bytes: 644
import sys

MOD = 10 ** 9 + 7

def make_table(size=10**6, p=MOD):
    fac = [None] * (size + 1)
    fac[0] = 1
    for i in range(size):
        fac[i+1] = fac[i] * (i + 1) % p
    ifac = [None] * (size + 1)
    ifac[size] = pow(fac[size], p-2, p)
    for i in range(size, 0, -1):
        ifac[i-1] = ifac[i] * i % p
    return fac, ifac

fac, ifac = make_table(5*10**5)

def comb(n, r, mod=MOD):
    if r > n or r < 0:
        return 0
    return fac[n] * ifac[r] % mod * ifac[n-r] % mod

def nHr(n, r):
    return comb(n-1+r, r)

n, k = map(int, sys.stdin.readline().split())

def main():
    if k >= n - 1:
        return nHr(n, n)
    else:
        res = nHr(n, n)
        for i in range(k+1, n+1):
            res -= comb(n, i) * nHr(n-i, i) % MOD
            res %=MOD

        return res % MOD
    
if __name__ == '__main__':
    ans = main()
    print(ans)

Measured memory_bytes: 42612
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
using namespace std;
const int mod=1e9+7;

ll solve(){
    string s,t;
    cin>>s>>t;
    int ans=t.size();
    for(int i=0;i<=s.size()-t.size();i++){
        int tmp=0;
        for(int j=0;j<t.size();j++){
            if(s[i+j] != t[j]) tmp++;
        }
        ans=min(ans,tmp);
    }
    return ans;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    int t=1;
    //cin>>t;
    while(t--) cout<<solve()<<'\n';
    //while(t--) solve(),cout<<'\n';
    return 0;
}


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

int main(){
	int n;scanf("%d",&n);
	int Min=INT_MAX;
	rep(i,n){
		int a,b;scanf("%d%d",&a,&b);
		Min=min(Min,b+a);
	}
	cout<<Min<<endl;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * e.cc: E - Red Scarf
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

/* global variables */

int as[MAX_N];

/* subroutines */

/* main */

/*
  s=b0^b1^..^bn
  s=ai^bi -> s^bi=ai ->sigma{s^bi}=sigma{ai}
  -> sigma{s^bi} = sigma{s}^sigma{bi} = sigma{bi} = s = sigma{ai}
 */

int main() {
  int n;
  scanf("%d", &n);

  int s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", as + i);
    s ^= as[i];
  }

  for (int i = 0; i < n; i++) {
    printf("%d", s ^ as[i]);
    putchar(i + 1 < n ? ' ' : '\n');
  }

  return 0;
}


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

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> words;
    string word;
    for (int i = 0; i < n; i++){
        cin >>  word;
        words.push_back(word);
    }

    sort(words.begin(), words.end());
    string out = "";
    for (string w:words) out+= w;
    cout << out << endl;
    return 0;

}

Measured memory_bytes: 3112
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int ans=0;
int n,m;
vi v[8];
vi used(8,0);

void dfs(int now,int time){
  int i;
  if(time==0){
    bool c=true;
    rep(i,n)
      if(used[i]==0)c=false;
    if(c)ans++;
    used[now]--;
    return;
  }
  rep(i,v[now].size()){
    used[v[now][i]]++;
    dfs(v[now][i],time-1);
  }
  used[now]--;
}

int main(void) {
  cin>>n>>m;
  int i;
  rep(i,m){
    int a,b;
    cin>>a>>b;
    a--;b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  used[0]++;
  dfs(0,n-1);
  cout<<ans<<endl;
}


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

#define LL long long
typedef pair<int, int> pii;

template< typename T > inline void read(T &x)
{
    static char _c;
    static bool _f;

    x = 0;
    _f = 0;
    _c = getchar();

    while(_c < '0' || '9' < _c) {if(_c == '-') _f = true; _c = getchar();}
    while('0' <= _c && _c <= '9') {x = (x << 1) + (x << 3) + (_c & 15); _c = getchar();}
    if(_f) x = -x;
}

template < typename T > inline void Min(T &x, T y) {if(y < x) x = y;}
template < typename T > inline void Max(T &x, T y) {if(x < y) x = y;}


#define lowbit(x) ((x) & -(x))
#define lson l,mid,id<<1
#define rson mid+1,r,id<<1|1
#define ls id<<1
#define rs id<<1|1
#define MID(l,r) ((l)+(((r)-(l))>>1))
#define fi first
#define se second
#define mk make_pair
#define pb push_back

const int INF = 0x3f3f3f3f;
const double pi = (double) acos(-1.0);
const double eps = (double) 1e-8;
//const int MOD = (int) 1e9 + 7;
//const int MOD = (int) 998244353;
int MOD = 998244353;
const int maxn = (int) 1e5 + 20;
const int maxm = (int) 1e6 + 20;

inline int sig(double x) {return x < -eps ? -1 : eps < x;}
LL fp(LL a, LL n, LL mod = MOD)
{
    if(n < 0) a = fp(a, mod - 2, mod), n = -n;
    LL res = 1; for(; n; n >>= 1, a = a * a % mod) if(n & 1) res = res * a % mod; return res;
}

struct Mint
{
    LL x;
    Mint() {x = 0;}
    Mint(int _x): x(_x) {}
    Mint(LL _x): x(_x) {}
    Mint operator - () const{
        return Mint(MOD - x);
    }
    Mint operator + (const Mint &rhs) const{
        LL res = x + rhs.x; if(res >= MOD) res -= MOD; return Mint(res);
    }
    Mint operator - (const Mint &rhs) const{
        LL res = x - rhs.x; if(res < 0) res += MOD; return Mint(res);
    }
    Mint operator * (const Mint &rhs) const{
        return Mint(x * rhs.x % MOD);
    }
    Mint operator / (const Mint &rhs) const{
        return Mint(x * fp(rhs.x, -1) % MOD);
    }
    bool operator == (const Mint &rhs) const{
        return x == rhs.x;
    }
    bool operator != (const Mint &rhs) const{
        return x != rhs.x;
    }
    friend ostream& operator << (ostream &out, const Mint &rhs){
        return out << rhs.x;
    }
    friend istream& operator >> (istream &in, Mint &rhs){
        return in >> rhs.x;
    }
};

void work()
{
    int n, m;
    cin >>n >>m;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >>a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());

    int tot = 0;
    for(auto x : a) tot += x;
    if(4 * m * a[m - 1] >= tot) cout <<"Yes";
    else cout <<"No";
}


int main(int argc, char **argv)
{
#ifdef yukihana0416
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif // yukihana0416
//    get_prime();
//    pre();
    int tc = 1;
//    read(tc);
    for(int ca = 1; ca <= tc; ca++)
    {
//        printf("Case #%d: ", ca);
        work();
    }
    return 0;
}


Measured memory_bytes: 256
fn read_parameters<T>() -> Result<Vec<T>, String>
where
    T: std::str::FromStr,
{
    let mut line = String::new();
    std::io::stdin()
        .read_line(&mut line)
        .map_err(|err| format!("{:?}", err))?;

    let xs = line.trim().split_whitespace();
    let mut result = Vec::new();

    for x in xs {
        let ans = x.parse::<T>().map_err(|_| format!("{}", "parse error"))?;
        result.push(ans);
    }
    Ok(result)
}

fn main() {
    let (n, _l) = read_parameters::<usize>().map(|xs| (xs[0], xs[1])).unwrap();

    let mut ss = Vec::with_capacity(n);
    for _ in 0..n {
        let s = read_parameters::<String>().map(|s| s.to_owned()).unwrap();
        ss.push(s[0].clone());
    }

    ss.sort();
    let mut ans = ss.remove(0);
    for s in &ss {
        ans = ans + s;
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
#ifndef LOCAL
#define cerr if(0)cout
#endif
typedef long long ll;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it, len;
	fastio() {it=len=0;}
	inline char get()
	{
		if (it<len) return s[it++]; it=0;
		len=fread(s, 1, 100000, stdin);
		if (len==0) return EOF; else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while (c==' '||c=='\n') c=get();
		if (it>0) it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0; bool ng=0; char c; c=_buff.get();
	while (c!='-'&&(c<'0'||c>'9')) c=_buff.get();
	if (c=='-') ng=1, c=_buff.get();
	while (c>='0'&&c<='9') r=r*10+c-'0', c=_buff.get();
	return ng?-r:r;
}
template <class T> inline void putnum(T x)
{
	if (x<0) putchar('-'), x=-x;
	register short a[20]={}, sz=0;
	while (x) a[sz++]=x%10, x/=10;
	if(sz==0) putchar('0');
	for (int i=sz-1; i>=0; i--) putchar('0'+a[i]);
}
inline char getreal() {char c=_buff.get(); while (c<=32) c=_buff.get(); return c;}
ll qpow(ll x, ll k) {return k==0? 1: 1ll*qpow(1ll*x*x%mod,k>>1)*(k&1?x:1)%mod;}
const int maxn = 5011;
int n;
int a[maxn], b[maxn];
void input(int a[])
{
	for (int i=0; i<n; i++)
	{
		char c = getreal();
		a[i] = c-'0';
	}
	for (int i=n-1; i>=1; i--) a[i] ^= a[i-1];
}
vector<int> v;
int solve(int k)
{
	int it = 0, ans = 0;
	for (int i=0; i<=n; i++)
	{
		int times;
		if (a[i]==0) times=1;
		if (i==n) times = n;
		if (i==0) times = max(0, k);
		while (times>0&&k<0)
		{
			ans += i;
			k++;
			times--;
		}
		while (times>0&&it<v.size())
		{
			ans += abs(i-v[it++]);
			times--;
		}
		while (i<n&&times>0&&it==v.size())
		{
			ans += abs(i-n);
			times--;
		}
	}
	return ans;
}
int main()
{
	geti(n);
	input(a);
	input(b);
	for (int i=1; i<n; i++) if (b[i]==0) v.PB(i);
	int m = (n+1)/2;
	int ans = 1e9;
	for (int i=-m; i<=m; i++)
	{
		if ((i+a[0]-b[0])%2!=0) continue;
		ans = min(ans, solve(i));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 384
import java.util.*;
public class Main{
	class Node{
		int[] a;
		int idx;
		int hash;
		public Node(int idx){
			this.idx = idx;
			this.a = new int[26];
			hash = 0;
		}
		public void add(char c){
			a[c - 'a']++;
			hash = (hash + magic[c - 'a']) % 1000000007;
		}
		
		public boolean equals(Object o){
			if(o == null) return false;
			if(!( o instanceof Node)) return false;
			Node nn = (Node)o;
			if(nn.hash != hash) return false;
			for(int i = 0; i < 26; i++){
				if(nn.a[i] != a[i]) return false;
			}
			return true;
		}
		public int hashCode(){
			return hash;
		}
	}
	
	int[] magic;
	public void solve(){
		Random rand = new Random();
		magic = new int[26];
		for(int i = 0; i < 26; i++){
			magic[i] = rand.nextInt(1000000007);
		}
		
		Scanner sc = new Scanner(System.in);
		String s1 = sc.next();
		String s2 = sc.next();
		int len = Math.min(s1.length(), s2.length());
		Node[] n1 = new Node[s1.length()];
		Node[] n2 = new Node[s2.length()];
		for(int i = 0; i < s1.length(); i++){
			n1[i] = new Node(i);
		}
		for(int i = 0; i < s2.length(); i++){
			n2[i] = new Node(i);
		}
		int ans = -1;
		HashSet<Node> set = new HashSet<>();
		for(int i = 0; i < len; i++){
			set.clear();
			for(int j = 0; j < s1.length() - i; j++){
				n1[j].add(s1.charAt(i + j));
				set.add(n1[j]);
			}
			
			for(int j = 0; j < s2.length() - i; j++){
				n2[j].add(s2.charAt(i + j));
				if(i > ans && set.contains(n2[j])){
					ans = i;
				}
			}
		}
		
		System.out.println(ans + 1);
	}
	
	public static void main(String[] args){
		new Main().solve();
	}
}

Measured memory_bytes: 99904