akhauriyash/Code-Regression huggingface dataset:
def main():
    N, M = [int(x) for x in input().split()]

    accepted = set()
    ans = 0
    from collections import defaultdict
    wa_count = defaultdict(int)
    for i in range(M):
        p, s = input().split()
        if p in accepted:
            continue
        if s == "WA":
            wa_count[p] += 1
        else:
            accepted.add(p)
            ans += wa_count[p]
    print(len(accepted), ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 21560
module IntMap = Map.Make (struct
  type t = int
  let compare = compare
end)

type 'a church_list = { fold : 'b. ('a -> 'b -> 'b) -> 'b -> 'b }

let factorize :
  (* 素因数分解する整数 *)
  int ->
  (* 素因数と指数の組のリスト
     素因数について降順に出てくる *)
  (int * int) church_list
= fun n ->
  (* nをpで割れるだけ割って，割れた数c'にcを加えたものとn/p^c'を返す *)
  let rec iter_div p c n k =
    if 0 < n mod p
    then k c n
    else iter_div p (c + 1) (n / p) k in
  (* 素因数分解の処理の本体 *)
  let rec factorize f acc p n =
    if n <= 1
    then acc
    else if n < p * p
    then f (n, 1) acc
    else iter_div p 0 n @@ fun c ->
           factorize f (if c <= 0 then acc else f (p, c) acc) (p + 1) in
  { fold = fun f acc -> factorize f acc 2 n }

let rec solve x = function
  | [] -> if x = 1 then 1 else 0
  | n :: rest ->
      List.fold_left ( + ) 0 @@
      List.init (n + 1) @@ fun i ->
        if x mod (i + 1) <> 0 then 0
        else solve (x / (i + 1)) rest
let solve = solve 75

let () = Scanf.scanf "%d" @@ fun n ->
  Printf.printf "%d\n" @@
  solve @@
  List.map snd @@
  IntMap.bindings @@
  Array.fold_right (fun n ->
    (factorize n).fold @@ fun (p, n) ->
      IntMap.update p (fun m -> Some (n + Option.value ~default:0 m)))
  (Array.init n succ) IntMap.empty


Measured memory_bytes: 5172
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#include <set>
#include <list>
#define PI 3.141592653
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<int> a(100001, 0);
	rep(i, 0, n) {
		int in;
		cin >> in;
		a[in]++;
		if(in != 0) a[in - 1]++;
		a[in + 1]++;
	}
	int ans = 0;
	rep(i, 0, 100001) {
		ans = max(ans, a[i]);
	}
	cout << ans << endl;
}

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

int main() {
	// your code goes here
	int k,a,b,val = 0;
	cin>>k;
	cin>>a>>b;
	int rem = a%k;
	if(rem==0){ cout<<"OK"<<endl; return 0;}
	val = a + (k - rem);
	if(val<=b) cout<<"OK"<<endl;
	else cout<<"NG"<<endl;
	return 0;
}


Measured memory_bytes: 3624
# coding: utf-8

N, Y=(int(x) for x in input().split())

A = Y // 10000 #Yを越えない最大の10000円札の枚数
B = Y // 5000
C = Y // 1000

roop = 0
for i in range(A+1):
    if roop == 1:
        break
    for j in range(B+1):
        if i + j > N:
            break
        c = N - i - j #c:1000円札の枚数
        if 10*i + 5*j + c == Y//1000 and c >= 0:
            # a:10000円札、b:5000円札
            a = i
            b = j
            roop = 1
            break

if roop == 1:
    print("{0} {1} {2}".format(a, b, c))
else:
    a, b, c = -1, -1, -1
    print("{0} {1} {2}".format(a, b, c))

Measured memory_bytes: 3064
#include <stdio.h>

int main() {

  int n,m,p;
  int b,c;
  int i,j,k;
  int sum;

  while (1) {
    b = 0;
    sum = 0;
    int a[101] = {0};
    double p;
    c = 0;
   

    scanf("%d %d %lf",&n,&m,&p);

    if(n == 0 && m ==0 && p ==0)break;

    for(i = 0; i<n; i++) {
      scanf("%d", &a[i]);
      b = b + a[i];
    }

    b = b * 100;
    p = p / 100;
    //printf("p = %f",p);

    if(a[m-1] == 0) {
      c = 0;
    } else {
      p = b - b*p;
      c = p / a[m-1];
    }

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

  }

  return 0;
}

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

int main() {
    int x, y;
    cin >> x >> y;
    while((x !=0) or (y != 0) ){
        if(x > y){
            cout << y << " " << x <<endl;
        }
        else{
            cout << x << " " << y << endl;
        }
        cin >> x >> y ;
    }
}


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

int main(){
    int n;
    cin >> n;
    vector<ll> l(n+1);
    l[0] = 2;
    l[1] = 1;
    rep(i,n+1){
        l[i] = l[i-2] + l[i-1];
    }
    cout << l[n] << endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<pair<int,int>> A(N);
  for(int i=0; i<N; i++){
    cin >> A.at(i).first;
    A.at(i).second=i+1;
  }
  sort(A.begin(),A.end());
  for(int i=0; i<N; i++){
    if(A.at(N-1).second!=i+1){
      cout << A.at(N-1).first << endl;
    }
    else{
      cout << A.at(N-2).first << endl;
    }
  }
}

Measured memory_bytes: 3200
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
void vout(vl V) {
	for (ll i = 0; i < (ll)V.size(); i++) cout << V[i] << " ";
	cout << endl;
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color; vll path; vl A; vl dp; vl Ans;
ll gcd(ll x, ll y) {
	ll r;
	if (x < y) {
		swap(x, y);
	}
	while (y > 0) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
int main(){
	cin >> N >> X;
	vl x(N);
	for (i = 0; i < N; i++) cin >> x[i];
	sort(x.begin(), x.end());
	ans = abs(X - x[0]);
	for (i = 0; i < N-1; i++) {
		ans = gcd(ans, x[i + 1] - x[i]);
	}
	cout << ans;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;

int main(){
  int n, m;
  cin >> n >> m;
  vector<string> a(n), b(n);
  rep(i, n) cin >> a[i];
  rep(i, m) cin >> b[i];
  rep(ai, n){
    rep(aj, a[ai].length()){
      bool ok = true;
      rep(bi, m){
        rep(bj, b[bi].length()){
          if(ai + bi >= n || aj + bj >= a[ai].length()) {
            ok = false;
            break;
          }
          if(a[ai + bi][aj + bj] != b[bi][bj]){
            ok = false;
            break;
          }
        }
      }
      if(ok){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

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

int main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
 
	int n,m;
  cin>>n>>m;
  int sum=0;
  if(n>1){
    sum += n*(n-1)/2;
  }
  if(m>1){
    sum += m*(m-1)/2;
  }
  cout<<sum;
  
  

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define MX 1000003 
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;

lli prime[MX],i,j,ans=1,cur,fact; 
unordered_map<lli,lli> mp; 

lli power(lli a, lli n) 
{ 
	if (n==0) 
		return 1; 
	lli p=power(a,n/2)%mod; 
	p=(p*p)%mod; 
	if(n&1) 
		p=(p*a)%mod; 
	return p; 
} 

void sieve() 
{ 
	prime[0]=prime[1]=1; 
	for(i=2;i<MX;i++) 
	{ 
		if(prime[i]==0) 
		{ 
			for (j=i*2;j<MX;j+=i) 
				if (prime[j]==0)  
					prime[j]=i; 
			prime[i]=i; 
		} 
	} 
} 
 
lli LCM(lli a[], lli n) 
{ 
	for(i=0;i<n;i++) 
	{ 
		cur=a[i]; 
		unordered_map<lli,lli> mp1; 
		while(cur>1) 
		{  
			fact=prime[cur]; 
			mp1[fact]++;  
			cur/=fact; 
		} 
		for(auto it : mp1)
			mp[it.first]=max(mp[it.first],it.second); 
	}  
	
	for (auto it : mp) 
		ans=(ans*power(it.first, it.second))%mod; 

	return ans; 
}

int main()
{
	fastio;
	sieve();
	
	lli n,i;
	cin>>n;
	lli a[n],gcd,mul=1;
	
	for(i=0;i<n;i++)
	{
		cin>>a[i];
		mul=(mul*a[i])%mod;
	}
	
	gcd=a[0];
	for(i=1;i<n;i++)
		gcd=__gcd(gcd,a[i]);
	
	if(LCM(a,n)==mul)
		cout<<"pairwise coprime";
	else if(gcd==1)
		cout<<"setwise coprime";
	else
		cout<<"not coprime";
	
	return 0;
}


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

namespace AtCoderProject
{
    static class Program
    {
        static void Main(string[] args)
        {
            var date = ReadLine();
            Console.WriteLine(DateTime.Parse(date) < new DateTime(2019, 5, 1) ? "Heisei" : "TBD");
        }

#if DEBUG
        private static string ReadLineImpl() => queue.Dequeue();
        private static Queue<string> queue = new Queue<string>
        {
            "2019/05/04"
        };
#else
        private static string ReadLineImpl() => Console.ReadLine();
#endif
        static string ReadLine() => ReadLineImpl();
        static int ReadLineInt32() => int.Parse(ReadLine());
        static string[] ReadLineSplit(char c) => ReadLine().Split(',');
        static int[] ReadLineSplitInt32(char c) => ReadLine().Split(',').Select(s => int.Parse(s)).ToArray();
        static long[] ReadLineSplitInt64(char c) => ReadLine().Split(',').Select(s => long.Parse(s)).ToArray();
        static void Add<T>(this Queue<T> queue, T value) => queue.Enqueue(value);
    }
}


Measured memory_bytes: 13536
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
  	int N = sc.nextInt();
	int[] H = new int[N];
  	int cnt=1;
  
	for(int j=0;j<N;j++){
      H[j] = sc.nextInt();
    }
  
  	for(int i=N-1;i>=1;i--){
      if(H[i-1]-1==H[i]){
        H[i-1]--;
        cnt++;
      }else if(H[i-1]<=H[i]){
        cnt++;
      }else{
        break;
      }
    }
  	
  
	//System.out.println("cnt="+cnt);
	if(cnt == N){
		System.out.println("Yes");
    }else{
      	System.out.println("No");
    }
}
}

Measured memory_bytes: 50476
#include <stdio.h>
#include <string.h>

/* 各方向を向いているときの移動ベクトル (北, 西, 南, 東) */
int VECTOR[4][2] = { {0, 1}, {-1, 0}, {0, -1}, {1, 0} };

int w, h; /* 盤面の大きさ */
int x, y, a; /* ロボットの座標と向き */

/* 指定した移動量だけロボットを進める */
void move(int v) {
	x += VECTOR[a][0] * v;
	y += VECTOR[a][1] * v;
	/* 壁との衝突判定 */
	if (x < 1) x = 1; else if (x > w) x = w;
	if (y < 1) y = 1; else if (y > h) y = h;
}

/* 指定した角度だけロボットを回転させる ただし角度は90度を1とし左回りを正とする */
void rotate(int v) {
	a += v;
	while (a < 0) a += 4;
	while (a > 3) a -= 4;
}

int main(void) {
	char s[10];
	int k;

	/* データセット毎の処理 */
	while (scanf("%d%d", &w, &h) == 2 && w > 0 && h > 0) {
		/* ロボットの状態を初期化する */
		x = 1;
		y = 1;
		a = 0;
		/* 命令を入力する */
		while (scanf("%s", s) == 1) {
			/* 命令にそった処理 */
			if (strcmp(s, "FORWARD") == 0) {
				scanf("%d", &k);
				move(k);
			} else if (strcmp(s, "BACKWARD") == 0) {
				scanf("%d", &k);
				move(-k);
			} else if (strcmp(s, "RIGHT") == 0) {
				rotate(-1);
			} else if (strcmp(s, "LEFT") == 0) {
				rotate(1);
			} else if (strcmp(s, "STOP") == 0) {
				break;
			}
		}

		printf("%d %d\n", x, y); /* ロボットの座標を出力する */
	}

    return 0;
}

Measured memory_bytes: 600
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        while(true){
            int h = sc.nextInt(), w = sc.nextInt();
            if(h == 0 && w == 0) break;
            for(int i = 0; i < h; i++){
                for(int n = 0; n < w; n++){
                    System.out.print("#");
                }
                System.out.println();
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 35576
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)
#define For(i,N) for(int i=0;i<N;i++)
#define ll long long int
void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

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



int main() {
	map<ll, ll>S;
	ll N;
	cin >> N;
	vector<ll>A(N);
	rep(N) {
		cin >> A[i];
		S[A[i]]++;
	}
	int flag = 1;
	for (auto it = S.begin(); it != S.end(); it++) {
		if (it->second > 1)
			flag = 0;
	}
	YN(flag);
	return 0;
}

Measured memory_bytes: 14336
#include<iostream>
#include<string>
#include<vector>
#include<set>
using namespace std;

bool hantei[300001];//????????°????????????????´??????°??????
signed main() {
	for (int i = 2; i <= 300000; i++) {
		if (i % 7 == 1 || i % 7 == 6) {
			if (!hantei[i]) {
				for (int j = i * 2; j <= 300000; j+=i) {
					if (j % 7 == 1 || j % 7 == 6)hantei[j] = true;
				}
			}
		}
	}
	int a;
	while (cin >> a, a != 1) {
		if (!hantei[a]) { printf("%d: %d\n", a, a); continue; }
		set<int>U;
		cout << a << ":";
		for (int b = 6; b*b <= a; b++) {
			if (a%b == 0) {
				if (b % 7 == 1 || b % 7 == 6) {
					if (!hantei[b]) { U.insert(b); }
				}
				int c = a / b;
				if (c % 7 == 1 || c % 7 == 6) {
					if (!hantei[c]) { U.insert(c); }
				}
			}
		}
		for (int i : U)cout << " " << i;
		cout << endl;
	}
}

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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 2e5+5;
const int mod = 1e9+7;

void solve(){
    int n, x, y;
    cin >> n;
    vi diff[2];
    for(int i = 0; i < n; ++i){
        cin >> x >> y;
        diff[0].push_back(x+y);
        diff[1].push_back(x-y);
    }
    for(int i = 0; i < 2; ++i)
        sort(All(diff[i]));
    cout << max(diff[0].back()-diff[0][0], diff[1].back()-diff[1][0]) << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 6680
n = int(input())
a = list(map(int, input().split()))

b = []
for i in range(n, 0, -2):
    b.append(str(a[i - 1]))
for i in range(1 if n % 2 == 0 else 2, n, 2):
    b.append(str(a[i - 1]))
print(' '.join(b))


Measured memory_bytes: 31940
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> primeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}


#define in(x) cin >> x
#define out(x) cout << x
#define outn(x) cout << x << '\n'
#define outs(x) cout << x << ' '
#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)





int main() {
	ll n,a,b;
	in(n);
	in(a);
	in(b);
    if(a*n<b){
      outn(a*n);
      }
  else{
    outn(b);
    }

	return 0;

}


Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
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;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin>>a>>b>>c;
    if(b-a==c-b)YES;
    else NO;
}


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

namespace ConsoleApplication
{
    class Program
    {
        static void Main()
        {
            new Solution().answer();
        }
    }

    class Solution
    {
        string N, M;
        string[] M_split = new string[2];
        int N1;
        int T = 0;

        public Solution()
        {
            N = Console.ReadLine().ToString();
            N1 = Convert.ToInt32(N);
            string[] A = new string[N1];
            int i;

            List<string> result = new List<string>();

            for (i = 1; i <= N1; i++)
            {
                M = Console.ReadLine();
                result.Add(M);
            }

            result.Sort();
            int k = result.Count;

            for (i = 0; i <= k - 1; i++)
            {
                if (i + 1 <= k - 1)
                {
                    if (result[i] == result[i + 1])
                    {
                        i++;
                    }
                    else { T++; }
                }
                else
                {
                    T++;
                }
            }

        }

        public void answer()
        {
            Console.WriteLine(T.ToString());
        }
    }
}

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

int main() {
	int k,s,ans=0; cin>>k>>s;
	for (int x=0; x<=k; x++)
		for (int y=0; y<=k; y++)
			if (s-x-y <= k and s-x-y >= 0) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void) {
    int x, b, p, max=1;
    scanf("%d", &x);
    
    for(b=1; b<32; b++) {
        for(p=2; p<11; p++) {
            if(pow(b, p)<=x) {
                if(max<pow(b, p)) {
                    max = pow(b, p);
                }
            }
        }
    }
    printf("%d", max);
    return 0;
}

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

/// Constant:
#define         eps         10e-9
#define         pi          2*acos(0)
#define         P1          1e9+7
#define         P2          1e9+9

#define         lli         long long int
#define         PB          push_back
#define         pb          pop_back
#define         mk          make_pair
#define         I           insert
/// Loop:
#define         f1(a,b)     for (int i=a; i<=b; i++)
#define         f2(a,b)     for (int j=a; j<=b; j++)
#define         f-1(a,b)     for (int i=b; i>=a; i--)
#define         f-2(a,b)     for (int j=b; j>=a; j--)
///Print:
#define         pY          cout<<"YES"<<endl;
#define         pN          cout<<"NO"<<endl;
#define         py          cout<<"Yes"<<endl;
#define         pn          cout<<"No"<<endl;

using namespace std;
///ISNNJB

/// Functions:
//lli bigmod(lli b, lli p, lli m){if(p==0)return 1;if(p%2!=0) return b%m*fun(b,p-1,m)%m;if(p%2==0){ lli res=fun(b,p/2,m);return (res%m*res%m)%m;}}
//lli mod_inverse(lli a, lli mod) { return bigmod(a,mod-2,mod); }
//lli LCM(lli a, lli b){ return a*b/ __gcd(a,b);}

///Global Variable:
int ara[400005],brr[400004];

/**int fx[]={+1,-1,+0,+0};
int fy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};*/

int main() {

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

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    lli a,b,c,d,k,t,n,m,x,y,q,ctn=0,l1,l2,total=0,l,r;

    cin>>n;
    f1(1,n)
    cin>>ara[i];

    f1(1,n) {
        if(i%2!=0&&ara[i]%2!=0)
            ctn++;
    }
    cout<<ctn<<endl;

    return 0;
}




Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, n) for (int i = 1; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{

    ll l, r;
    cin >> l >> r;  

    ll mi = 2019;
    for (ll i = l; i < l + 2019; i++) {
        for (ll j = i + 1; j <= min(r, i + 2020); j++) {
            mi = min(mi, ((i % 2019) * (j % 2019)) % 2019);
        }
    }
    
    put(mi)

    return 0;
}

Measured memory_bytes: 3576
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll A, B;

int main() {
	scanf("%lld %lld", &A, &B);
	string X = "";
	string Y = "";
	for(int i = 0; i < A; i++) {
		X += to_string(B);
	}
	for(int i = 0; i < B; i++) {
		Y += to_string(A);
	}
	if(X <= Y) {
		cout << X << "\n";
	}
	else {
		cout << Y << "\n";
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main(){
    int N,K;
    cin>>N>>K;
    vector<int>A(N);
    rep(i,N)cin>>A[i];
    rep(ki,K){
        vector<int>B(N+1);
        rep(i,N){
            int l=max(0,i-A[i]);
            int r=min(N,i+A[i]+1);
            B[l]++;
            B[r]--;
        }
        rep(i,N)B[i+1]+=B[i];
        B.pop_back();
        if(A==B)break;
        A=B;
    }
    
    rep(i,N)cout<<A[i]<<" ";
    return 0;
}

Measured memory_bytes: 4844
main = do
    n <- readLn :: IO Int
    putStrLn . unwords . map show . take n $ filter ((== 1) . (`mod` 5)) primes

primes = [2, 3, 5] ++ f 5 7 (drop 2 primes)
   where f m s (p:ps) = [n | n <- ns, gcd m n == 1] ++ f (m * p) (p * p) ps
            where ns = [x + y | x <- [s,s + 6 .. p * p - 2], y <- [0, 4]]

Measured memory_bytes: 4056
def num(s,n,k):
  d,m,dm,dmc = 0,0,0,0
  for i in range(n,n*2):
    x,y = s[i],s[i-k]
    if y == 68:
      d -= 1
      dm -= m
    elif y == 77:
      m -= 1
    if x == 68:
      d += 1
    elif x == 77:
      m += 1
      dm += d
    elif x == 67:
      dmc += dm
  return dmc

def main():
  n = int(input())
  s = [0]*n + list(map(ord, list(input())))
  _ = input()
  l = list(map(int, input().split()))
  for k in l:
    print(num(s,n,k))

main()

Measured memory_bytes: 147004
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007LL;
const int INF = LLONG_MAX;

signed main(){
    
    map<char, char> m;
    m['A'] = 'T';
    m['T'] = 'A';
    m['C'] = 'G';
    m['G'] = 'C';
    char c; cin >> c;
    cout << m[c] << endl;
    return 0;
}

Measured memory_bytes: 256
import collections
n=int(input())
a=input()
a=a.split()
a=[int(n) for n in a]
q=int(input())
al=collections.Counter(a)
s=sum(a)
for i in range (q):
    x=input()
    x0=x.split()
    b=int(x0[0])
    c=int(x0[1])
    r=al[b]*(c-b)
    s=s+r
    print(s)
    al[c]=al[c]+al[b]
    al[b]=0

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

int main() {
  string s;
  cin >> s;
  if (s[0] == '9') s[0] = '1';
  else if (s[0] == '1') s[0] = '9';
  if (s[1] == '9') s[1] = '1';
  else if (s[1] == '1') s[1] = '9';
  if (s[2] == '9') s[2] = '1';
  else if (s[2] == '1') s[2] = '9';
  cout << s << endl;
  return 0;
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
 int N,T,cnt=0;
  cin >> N >> T;
  int a[N];
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=0;i<N-1;i++){
    cnt+=min(a[i+1]-a[i],T);
  }
  cout << cnt+T << endl;
}

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

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

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

   int count1 = 0, count2 = 0;

   for (int i = 0; i < S.length(); i += 2) {
     if (S.at(i) != '0') count1++;
   }
   for (int i = 1; i < S.length(); i += 2) {
     if (S.at(i) != '1') count1++;
   }
   for (int i = 0; i < S.length(); i += 2) {
     if (S.at(i) == '0') count2++;
   }
   for (int i = 1; i < S.length(); i += 2) {
     if (S.at(i) == '1') count2++;
   }
   cout << min(count1, count2) << endl;
 }


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

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

  int a[n];
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);

  int ans = INF;
  for (int i = 0; i <= 100; ++i) {
    int score = 0;
    for (int j = 0; j < n; ++j) {
      int d = i - a[j];
      score += d * d;
    }
    ans = min(ans, score);
  }
  
  printf("%d\n", ans);

  return (0);
}

Measured memory_bytes: 3824
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int N, K; cin >> N >> K;
    string S; cin >> S;
    queue<Pii> que;
    int now = S[0] - '0', c = 0;
    int ans = 0, tmp = 0, k = 0;
    REP(i, N){
        c++;
        if(i == N - 1 || S[i + 1] - '0' != now){
            tmp += c;
            que.push(Pii(c, now));
            if(now == 0) k++;
            while(k > K){
                Pii p = que.front(); que.pop();
                if(p.s == 0) k--;
                tmp -= p.f;
            }
            Max(ans, tmp);
            now = 1 - now;
            c = 0;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1360
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int k;
  string s;
  cin >> k;
  cin >> s;
  
  if(s.size()<=k){
    cout << s;
  }else{
   for (int i = 0; i < k; i++) {
  cout << s.at(i);
  }
    cout <<"...";
  }
}


Measured memory_bytes: 3628
N, P = map(int, input().split())
import math

a = 2
b = 1

if N == 1 :
	print(P)
else:
	while math.log(P) >= N * math.log(a):
		if P % a**N == 0:
			P /= a**N
			b *= a
			a = 1
		a += 1
	print(b)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	int x, a, b;
	cin >> x >> a >> b;
	x -= a;
	cout << x % b << endl;
	return 0;
}

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

class Main {
    public static void main(String args[]) {
        Scanner scan = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();

        while(true){
            int x = scan.nextInt();
            int y = scan.nextInt();

            int[] sort = {x,y};
            Arrays.sort(sort);

            if(x == 0 && y == 0) {
                break;
            }
            sb.append(sort[0]).append(" ").append(sort[1]).append("\n");
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 35376
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    static int[] w = new int[100010];
    static int[] v = new int[100010];
    static int[][] dp = new int[110][100010];
    static int k;

    static int chmin(int a, int b) {
        if (a > b) {
            a = b;
            return a;
        }
        return a;
    }

    static int chmax(int a, int b) {
        if (a < b) {
            a = b;
            return a;
        }
        return a;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<String> list = new ArrayList<String>();
        for (int i = 0; i < n; i++) {
            String w = sc.next();
            if (i != 0) {
                String prev = list.get(i - 1);
                if (list.contains(w) || prev.charAt(prev.length() - 1) != w.charAt(0)) {
                    System.out.println("No");
                    return;
                }
            }
            list.add(w);
        }
        System.out.println("Yes");

    }
}


Measured memory_bytes: 82388
n,k=map(int, input().split())
ans=0
for i in range(k, n+2):
    i_min = (i*(i-1))//2
    i_max = ((n*2 - i+1)*i)//2
    ans+=(1-i_min+i_max)
print(int(ans)%(10**9+7))


Measured memory_bytes: 9176
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		long[] p = nextLongs();

		Arrays.sort(p);

		long ans = 0;
		if(p[2]%2!=0){
			ans=p[0]*p[1];
		}


		System.out.println(ans);
	}

	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


Measured memory_bytes: 21204
#include "bits/stdc++.h"
#define rep(i,a,n) for(int i = (a);i < (n);i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;

int main(){
	int n,m;
  	cin >> n >> m;
  
  	for(int i = 0;i < n+1;i++){
      for(int j = i;j < n+1;j++){
        if(i+(j-i)*5+(n-j)*10 == m / 1000){
          cout << (n-j) << " " << (j-i) << " " << i << endl;
          return 0;
        }
      }
      
    }
  
  	cout << "-1 -1 -1" << endl;
	
	return 0;
}

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

using namespace std;

#define MAX_NODE 25

int n;

typedef struct {
  int num;
  int left;
  int right;
  int degree;
} binary_tree;

int getSibling(binary_tree A[],int parent,int key){

  if(parent == -1){
    return -1;
  }
  else if(A[parent].right == key){
    return A[parent].left;
  }
  else if(A[parent].left == key){
    return A[parent].right;
  }
}

int getDepth(int parent_list[],int key,int default_depth){

  int depth = default_depth;

  if(parent_list[key] != -1){
    depth = getDepth(parent_list,parent_list[key],depth+1);
  }
  return depth;
}

int getHeight(binary_tree A[],int num,int default_height){

  int height;
  int height_right = 0;
  int height_left = 0;

  if(A[num].right == -1 && A[num].left == -1){
    return default_height;
  }
  else {
    if(A[num].right != -1){
      height_right = getHeight(A,A[num].right,default_height+1);
    }
    if(A[num].left != -1){
      height_left = getHeight(A,A[num].left,default_height+1);
    }
    if(height_right < height_left){
      height = height_left;
    }
    else{
      height = height_right;
    }
  }
  return height;
}

char *getState(binary_tree A,int parent_list[]){

  if(parent_list[A.num] == -1){
    return "root";
  }
  else if(A.right == -1 && A.left == -1){
    return "leaf";
  }
  return "internal node";
}

void print(binary_tree A[],int parent_list[]){

  int i;

  for(i = 0;i < n;i++){
    cout << "node " << A[i].num << ": ";
    cout << "parent = " << parent_list[A[i].num] << ", ";
    cout << "sibling = " << getSibling(A,parent_list[A[i].num],A[i].num) << ", ";
    cout << "degree = " << A[i].degree << ", ";
    cout << "depth = " << getDepth(parent_list,A[i].num,0) << ", ";
    cout << "height = " << getHeight(A,A[i].num,0) << ", ";
    cout << getState(A[i],parent_list);
    cout << endl;
  }

}

int main(){

  int i;
  int num;
  int parent[MAX_NODE];
  binary_tree *A;

  cin >> n;

  A = (binary_tree *)malloc(sizeof(binary_tree)*n);

  for(i = 0;i < MAX_NODE;i++){
    parent[i] = -1;
  }

  for(i = 0;i < n;i++){
    cin >> num;
    A[num].num = num;
    cin >> A[num].left;
    cin >> A[num].right;
    parent[A[num].left] = num;
    parent[A[num].right] = num;
    A[num].degree = 0;
    if(A[num].left >= 0){
      A[num].degree++;
    }
    if(A[num].right >= 0){
      A[num].degree++;
    }
  }


  print(A,parent);

  return 0;

}

Measured memory_bytes: 1188
package main
import(
  "fmt"
)
func main(){
  var i, n int
  var a, w, t, r int
  a,w,t,r=0,0,0,0
  fmt.Scan(&n)
  s:=make([]string, n)
  for i=0;i<n;i++{
    fmt.Scan(&s[i])
    if s[i]=="AC"{
      a++
    }else if s[i]=="WA"{
      w++
    }else if s[i]=="TLE"{
      t++
    }else{
      r++
    }
  }
  fmt.Println("AC x",a)
  fmt.Println("WA x",w)
  fmt.Println("TLE x",t)
  fmt.Println("RE x",r)
}


Measured memory_bytes: 6500
MONEY = (300000, 200000, 100000)

x, y = map(int, input().split())
ret = 0
if x <= 3:
    ret += MONEY[x - 1]
if y <= 3:
    ret += MONEY[y - 1]
if x == y == 1:
    ret += 400000
print(ret)

Measured memory_bytes: 3060
#include<cstdio>
#include <algorithm>
#include<utility>

using namespace std;

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) for(int i=0; i<n; i++)

int type1(int h, int w){
  if(w%3==0) return 0;
  else return h;
}

int type2(int h, int w){
  if(h%3==0) return 0;
  else return w;
}

int type3(int h, int w){
  int ans = h+w;
  int mi;
  int a,b,c;
  FOR(i, w/3 ,w/3+2){
    FOR(j, h/2,h/2+1){
      a=i*h;
      b=(w-i)*j;
      c=(w-i)*(h-j);
      mi = max({abs(a-b),abs(b-c),abs(a-c)});
      if(mi<ans)ans=mi;
    }
  }
  return ans;
}

int type4(int h, int w){
  int ans = h+w;
  int mi;
  int a,b,c;
  FOR(i, h/3 ,h/3+2){
    FOR(j, w/2,w/2+1){
      a=i*w;
      b=(h-i)*j;
      c=(h-i)*(w-j);
      mi = max({abs(a-b),abs(b-c),abs(a-c)});
      if(mi<ans)ans=mi;
    }
  }
  return ans;
}


int main(){
  int h,w;
  scanf("%d %d",&h,&w);
  if(h>w)swap(h,w);
  int ans;
  ans = min(min(type1(h,w),type2(h,w)),min(type3(h,w),type4(h,w)));
  printf("%d",ans);
  return 0;
}


Measured memory_bytes: 128
n = int(input())
s = input()

l = list(s)
abc = list('abcdefghijklmnopqrstuvwxyz')
ans = 1
for i in range(len(abc)):
    cnt = l.count(abc[i])
    if cnt > 0:
        ans = ans*(((cnt + 1))%(10**9 + 7))
ans -= 1
ans = ans %(10**9 + 7)
print(ans)

Measured memory_bytes: 3956
#include<stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    char s[n + 1], t[n + 1];
    scanf("%s""%s", s, t);
    for(int i = 0; i < n; i++){
        printf("%c%c", s[i], t[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define f(i,l,n) for(ll i=l;i<n;i++)
#define ff first
#define ss second
#define pb push_back
#define E "\n"
#define mp make_pair
#define N (ll)pow(2,32)-1
 
const int M=1e9+7;


 int solve()
 {

  int n,m;
  cin >> n >> m;
  int sum=0,a[n];
  f(i,0,n) cin >> a[i],sum+=a[i];

  sort(a,a+n,greater<int>());

  
  if(a[m-1]*4*m<sum) cout<<"No\n";
  else cout<<"Yes\n";


  return 0;
 }
int32_t main()
{

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
const int mod = 998244353;

ll mpow(ll x, ll n) {
  ll res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n /= 2;
  }
  return res;
}

vl fac(1e5, 1);
vl invfac(fac.size(), 1);

ll bin(int n, int k) {
  if (k < 0 || k > n) return 0;
  return fac[n] * invfac[k] % mod * invfac[n - k] % mod;
}

ll d[3005][3005];

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int a, b, c, D;
  cin >> a >> b >> c >> D;
  int da = c - a, db = D - b;
  for (int i = 2; i < fac.size(); ++i) {
    fac[i] = fac[i - 1] * i % mod;
    invfac[i] = mpow(fac[i], mod - 2);
  }
  d[0][0] = 1;
  for (int x = 0; x <= da; ++x) for (int y = 0; y <= db; ++y) {
    if (x + 1 <= da) d[x + 1][y] = (d[x + 1][y] + d[x][y] * (y + b)) % mod;
    if (y + 1 <= db) d[x][y + 1] = (d[x][y + 1] + d[x][y] * (x + a)) % mod;
    if (y + 1 <= db && x + 1 <= da) d[x + 1][y + 1] = (d[x + 1][y + 1] - d[x][y] * (x + a) % mod * (y + b)) % mod;
//    cerr << x << ' ' << y << ' ' << d[x][y] << endl;
  }
  cout << (d[da][db] + mod) % mod << endl;
  return 0;
}


Measured memory_bytes: 75172
def main():
    N, M = map(int, input().split())
    *X, = map(int, input().split())

    ans = f(N, M, X)
    print(ans)


def f(N, M, X):
    """
    1 <= N, M <= 10^5
    |Xi| <= 10^5
    Xi != Xj

    入力例1より初期位置をマスにしてもいいので、0
    N < M なら1回以上動くコマが存在する
    N=1 なら
        X をsortして最小値から最大値まで動かす
    M=N+1 なら
        1動かす
        最後のXに1番近いコマを動かす
        1番近いかを調べるには、X同士の比較なのでN^2: TLE
        外側から内側に移動したほうがよい
            内側から外側に行ってから再度内側に行く場合、損する
            好きな整数座標なので-10^5-1でもよい
        Xをsortしたときの前との差分をとると、どこの間隔が長いか分かる
            その中で短い部分を移動
    """
    if N >= M:
        return 0

    X = sorted(X)
    diff = [abs(X[i+1] - X[i]) for i in range(M-1)]

    # 長い部分は除外する
    ans = sum(sorted(diff, reverse=True)[N-1:])

    return ans


if __name__ == '__main__':
    main()


Measured memory_bytes: 13960
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
var nq=arr[0].split(" ").map(Number);
var s = arr[1];
var a=[0,0];
var cnt=0;
for(var i=1;i<s.length;i++){
   if(s[i-1]+s[i]=="AC")cnt++;
   a.push(cnt);
}
var ans=[];
for(var i=2;i<nq[1]+2;i++){
   var lr=arr[i].split(" ");
   ans.push(a[lr[1]-0]-a[lr[0]-0]);
}
console.log(ans.join("\n"));

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

using namespace std;

inline int ctoi(char c) { if(c < '0' || '9' < c) throw invalid_argument("ctoi error"); return c - '0'; }
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for(int i = (int)(k); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

template <typename T>
inline T gcd(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("gcd error: x <= 0 or y <= 0");
	
	if(x < y) swap(x, y);
	T r = x % y;

	while(r != 0){
		x = y;
		y = r;
		r = x % y;
	}

	return y;
}
template <typename T>
inline T lcm(T x, T y){
	if (x <= 0 || y <= 0) throw invalid_argument("lcm error: x <= 0 or y <= 0");

	return x * y / gcd(x, y);
}

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

	if(x == 1) cout << 0;
	else cout << 1;
	
	return 0;
}

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

long long a[6],n,t[6];

int main(){
	cin>>n;
	int mi=1;
	for(int i=1;i<=5;++i){
		cin>>a[i];
		t[i]=max(t[i-1]+1,(long long)ceil((double)n/a[i])+i-1);
	}
	cout<<t[5]<<endl;
	return 0;
}

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


int main()
{
	int n; cin >> n;
	string s; cin >> s; 
	for (int i = 0; i < s.size(); ++i)
		cout << (char)((s[i] - 65 + n) % 26 + 65);
	cout << endl;
}



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

class Program
{
    //const int MOD = 1000000007;
    static void Main(string[] args)
    {
        new Program().Solve();
    }

    void Solve()
    {
        Scanner cin = new Scanner();
        long l = cin.NextLong();
        long r = cin.NextLong();

        long mod = 2019L;
        
        if (r - l >= mod)
        {
            Console.WriteLine(0);
        }
        else
        {
            long min = 10000000000;
            for (long i = l; i <= r; i++)
            {
                for (long j = i + 1; j <= r; j++)
                {
                    long thisMod = i * j % mod;
                    min = min > thisMod ? thisMod : min;
                    if (min == 0L)
                    {
                        break;
                    }
                }
                if(min == 0L)
                {
                    break;
                }
            }
            Console.WriteLine(min);
        }
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string Next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return Next();
        i = 0;
        return s[i++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public char[] ArrayChar()
    {
        return Next().ToCharArray();
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextInt() + add;
        }
        return Array;
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextLong() + add;
        }
        return Array;
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = NextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 11092