akhauriyash/Code-Regression huggingface dataset:
#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 int long long int
// #define ll int128_t
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 105;
int const inf = 2e16;
int a[N][N];
int dp[N][N][2];

void solve(){  
    int n,i,j,l,m,k;
    cin>>n>>m;
    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++){
            char c; cin>>c;
            a[i][j] = (c=='.'?0:1);
        }
    }

    if(a[1][1] == 0){
        dp[1][1][0] = 0;
        dp[1][1][1] = inf;
    }
    else{
        dp[1][1][0] = inf;
        dp[1][1][1] = 1;
    }

    for(j=2;j<=m;j++){
        if(a[1][j] == 0){
            dp[1][j][0] = min(dp[1][j-1][0] , dp[1][j-1][1]);
            dp[1][j][1] = inf;
        }
        else{
            dp[1][j][0] = inf;
            dp[1][j][1] = min(dp[1][j-1][0] + 1 , dp[1][j-1][1]);
        }
    }

    for(i=2;i<=n;i++){
        if(a[i][1] == 0){
            dp[i][1][0] = min(dp[i-1][1][0] , dp[i-1][1][1]);
            dp[i][1][1] = inf;
        }
        else{
            dp[i][1][0] = inf;
            dp[i][1][1] = min(dp[i-1][1][0] + 1 , dp[i-1][1][1]);
        }
    }

    for(i=2;i<=n;i++){
        for(j=2;j<=m;j++){
            if(a[i][j] == 0){
                dp[i][j][0] = min(dp[i-1][j][0] , min( dp[i][j-1][0] , min( dp[i-1][j][1], dp[i][j-1][1] ) ) );
                dp[i][j][1] = inf;
            }
            else{
                dp[i][j][0] = inf;
                dp[i][j][1] = min(dp[i-1][j][1] , dp[i][j-1][1]);
                dp[i][j][1] = min(dp[i][j][1] , min(dp[i-1][j][0] + 1 , dp[i][j-1][0] + 1));
            }   
        }
    }

    int ans = min(dp[n][m][0] , dp[n][m][1]);

    cout<<ans<<endl;
}       


int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Measured memory_bytes: 512
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	Scanner sc = new Scanner(System.in);
	public void run() {
		while(sc.hasNext()){
			int n = sc.nextInt();
			if(n == 0 )break;
			else calc(n);
			
		}
	}
	public void calc(int n){
		int[] count = new int[7];
		int[][] numMemo = new int[201][201];
		int[][] highMemo = new int[201][201];
		int nowX = 100;
		int nowY = 100;
		
		int[][] right = new int[7][7];
		right[1][2] = 3; right[1][3] = 5; right[1][4] = 2; right[1][5] = 4;
		right[2][1] = 4; right[2][3] = 1; right[2][4] = 6; right[2][6] = 3;
		right[3][1] = 2; right[3][2] = 6; right[3][5] = 1; right[3][6] = 5;
		right[4][1] = 5; right[4][2] = 1; right[4][5] = 6; right[4][6] = 2;
		right[5][1] = 3; right[5][3] = 6; right[5][4] = 1; right[5][6] = 4;
		right[6][2] = 4; right[6][3] = 2; right[6][4] = 5; right[6][5] = 3;
		
		for(int i = 0; i < n; i++){
			int t = sc.nextInt();
			int f = sc.nextInt();
			
			int nX = nowX;
			int nY = nowY;
			
			int nH = highMemo[nX][nY];
			
			boolean hantei = true;
			
			while(hantei){
				int nextX = 0;
				int nextY = 0;
				int nextB = 0;
				int nextF = 0;
				
				if(highMemo[nX+1][nY] < nH && nextB < right[t][f] && right[t][f] >= 4){
					nextX = nX + 1;
					nextY = nY;
					nextB = right[t][f];
					nextF = f;
				}
				if(highMemo[nX][nY-1] < nH && nextB < f && f >= 4){
					nextX = nX;
					nextY = nY-1;
					nextB = f;
					nextF = t;
				}
				if(highMemo[nX-1][nY] < nH && nextB < 7-right[t][f] && 7-right[t][f] >= 4){
					nextX = nX-1;
					nextY = nY;
					nextB = 7-right[t][f];
					nextF = f;
				}
				if(highMemo[nX][nY+1] < nH && nextB < 7-f && 7-f >= 4){
					nextX = nX;
					nextY = nY+1;
					nextB = 7-f;
					nextF = 7-t;
				}
				
				if(nextB != 0){
					nX = nextX;
					nY = nextY;
					nH = highMemo[nX][nY];
					t = 7-nextB;
					f = nextF;
				}
				else{
					hantei = false;
				}
			}
			highMemo[nX][nY] = highMemo[nX][nY] + 1;
			count[numMemo[nX][nY]] = count[numMemo[nX][nY]] - 1;
			numMemo[nX][nY] = t;
			count[t] = count[t] + 1;
			
			
		}
		
		
		System.out.print(count[1]);
		for(int i = 2; i < 7; i++){
			System.out.print(" " + count[i]);
		}
		System.out.println();
	}

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

Measured memory_bytes: 55224
#include <stdio.h>

int numbers[30];
bool flag = false;
int cou = 0, ans[2];

int main(void) {
	for (int i = 0; i < 28; ++i) { scanf("%d", &numbers[i]); }
	
	for (int i = 1; i <= 30; ++i) {
		for (int j = 0; j < 28; ++j) {
			if (numbers[j] == i) {
				flag = true;
				break;
			}
		}
		if (flag == false) {
			ans[cou] = i;
			cou++;
		}
		flag = false;
	}

	printf("%d\n%d\n", ans[0], ans[1]);
	return 0;
}

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


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner cin=new Scanner(System.in);
		int a,b;
		while(cin.hasNext()){
			a=cin.nextInt();
			b=cin.nextInt();
			System.out.printf("%d %d\n",GCD(a,b),LCM(a,b));
			
			
			
		}
	}
	static int GCD(int a,int b){
		if(a<b){
			int temp=a;a=b;b=temp;
		}
		if(b==0) return a;
		return GCD(b,a%b);
	}
	static int LCM(int a,int b){
		return a/GCD(a,b)*b;
	}

}

Measured memory_bytes: 18096
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,lm=1,ans=0;
	cin>>n;
	while(lm<n){
		lm*=3;
		ans++;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3164
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(int n) {
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            if (n == i * 4 + j * 7) {
                return true;
            }
        }
    }
    return false;
}

void main() {
    int n = readint;
    writeln(calc(n) ? "Yes" : "No");
}


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

int main(){
    int N;
    cin >> N;
    vector<int> A1(N,0);
    vector<int> A2(N,0);

    for(int i=0; i<N; i++){
        cin >> A1[i];
    }
    for(int i=0; i<N; i++){
        cin >> A2[i];
    }

    vector<int> count(N,0);

    for(int i=0; i<N; i++){
        int _count = 0;
        
        for(int j=0; j<=i; j++){
            _count += A1[j];
        }

        for(int k=i; k<N; k++){
            _count += A2[k];
        }

        count[i] = _count;
    }

    int ans = *max_element(count.begin(), count.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
import numpy as np
N,K=map(int,input().split())
m=np.zeros((3*K,3*K),dtype=int)
L=2*K
o=0
for _ in [0]*N:
	x,y,c=input().split()
	x,y=int(x)%L,int(y)%L
	t=c=='W'
	m[x,y]+=1-2*t
	o+=t
for _ in [0,0]:
	m[L:]=m[:K]
	m=np.cumsum(m,axis=0)
	m[:L]=m[K:]-m[:L]
	m=m.T
m=m[:L,:L]
print(o+(m+np.roll(np.roll(m,K,axis=0),K,axis=1)).max())

Measured memory_bytes: 153100
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define fr(it, a, b) \
    for (ll it = (a); it < (b); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
ll power(ll a, ll b)
{
    ll ans = 1;
    while (b > 0)
    {
        if (b % 2 == 1)
        {
            ans = (ans * a);
        }
        a = (a * a);
        b /= 2;
    }
    return ans;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x, a, b;
    cin >> x;
    map<ll, ll> M;
    fr(i, -200, 201)
    {
        M[power(i, 5)] = i;
    }
    for (ll i = 200; i >= -200; i--)
    {
        if (present(M, (power(i, 5) - x)))
        {
            a = i;
            b = M[power(i, 5) - x];
            break;
        }
    }
    cout << a << " " << b << "\n";
    return 0;
}

Measured memory_bytes: 3680
function Main(input) {
  const line = input.split(" ")
  const N = line[0]
  const X = line[1]
  const T = line[2]
  const kaisuu = Math.ceil(N / X)
  const jikan = kaisuu * T
 	console.log(jikan)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29656
import java.util.*;
import java.io.*;
import java.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class Main {

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

	public void run() throws Exception {
		FastIO file = new FastIO();
		String[] s = "000 111 222 333 444 555 666 777 888 999".split(" ");
		String t = file.next();
		boolean works = false;
		for (String ss : s) works |= t.contains(ss);
		System.out.println(works ? "Yes" : "No");
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, p / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, p / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

	public static boolean isPrime(int n) {
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}
}


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

#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
const ll MOD = 100000007LL;
const int IINF = INT_MAX;

int h,w,ax,ay,bx,by;
ll memo[1010][1010];
int mindist[1010][1010];
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};

bool isValid(int x,int y) { return 0 <= x && x < w && 0 <= y && y < h; }

int main(){
  cin >> w >> h >> ax >> ay >> bx >> by;
  rep(i,h) rep(j,w) mindist[i][j] = IINF;
  mindist[ay][ax] = 0;
  memo[ay][ax] = 1LL;
  deque<int> deq;
  deq.push_back(ax+ay*w);
  while( !deq.empty() ){
    int cur = deq.front(); deq.pop_front();
    int x = cur % w, y = cur / w;
    rep(i,4){
      int nx = x + dx[i], ny = y + dy[i];
      if( !isValid(nx,ny) ) {
        if( nx <  0 ) nx = w - 1;
        if( nx >= w ) nx = 0;
        if( ny <  0 ) ny = h - 1;
        if( ny >= h ) ny = 0;
      }
      if( mindist[ny][nx] >= mindist[y][x] + 1 ) {
        if( mindist[ny][nx] > mindist[y][x] + 1 ) deq.push_back(nx+ny*w);
        mindist[ny][nx] = mindist[y][x] + 1;
        ( memo[ny][nx] += memo[y][x] ) %= MOD;
      }
    }
  }
  cout << memo[by][bx] << endl;
  return 0;
}

Measured memory_bytes: 13104
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll h, w;
  cin >> h >> w;
  if(h == 1 || w == 1)
    cout << 1 << endl;
  else
    cout << h * (w / 2) + (w % 2) * ((h + 1) / 2) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
 
int n, m, l[200007], r[200007], d[200007];
 
ll pa[200007], dist[200007];

inline int read(){
	int k=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}
	return k*f;
}


pair<ll, ll> parent(int child){
  ll now = child, distance = 0;
  while(now != pa[now]){
    distance += dist[now];
    now = pa[now];
  }
  return make_pair(now, distance);
}
 
int main(void){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    //cin >> l[i] >> r[i] >> d[i];
    //scanf("%ld %ld %ld", &l[i], &r[i], &d[i]);
    l[i] = read(); r[i] = read(); d[i] = read();
    l[i]--; r[i]--;
  }
  for(int i=0;i<n;i++) pa[i] = i;
  
  bool flg = true;
  for(int i=0;i<m;i++){
  	pair<ll, ll> p1 = parent(l[i]); 
    int pa1 = p1.first; int dist1 = p1.second;
    pa[l[i]] = pa1; dist[l[i]] = dist1;
    pair<ll, ll> p2 = parent(r[i]);
    int pa2 = p2.first; int dist2 = p2.second;
    pa[r[i]] = pa2; dist[r[i]] = dist2;
	//cerr << pa1 << "," << dist1 << "  " << pa2 << "," << dist2 << endl;
    if (pa1 != pa2){
      if (rand()%2){
	      pa[pa1] = pa2; dist[pa1] = dist2 - dist1 + d[i];
      }else{
          pa[pa2] = pa1; dist[pa2] = dist1 - dist2 - d[i];
      }
    }else{ //矛盾判定
      if (dist1 - dist2 != d[i]) {flg = false; break;}
    }
  }
  cout << (flg ? "Yes" : "No" ) << endl;
  return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <stdlib.h>
#include <vector> //vector
#include <algorithm> //sort()

using namespace std;

template<class T> inline bool chmin(T& a, T b);
template<class T> inline bool chmax(T& a, T b);

long a, b, c, d, i, j, k, n;

int main(){
//////////////////////////////////////////////////////

    //string s;
    
    cin >> a>>b;

   // s[2] += 'a' - 'A';

    if ( a <= 12)b/=2;
    if ( a <= 5)b=0;


    cout <<  b << endl;

    // cout << "n:" << n << endl;

    // vector<long> input(n+1);
    // for (int i = 1 ; i <= n ; i ++ )
    // {
    //     cin >> input[i];
    //     cout << "input[" << i << "]=" << input[i] << endl;
    // }

    // sort(input.begin() , input.end());

    // uint64_t max = numeric_limits<uint64_t>::max();


    //////////////////////////////////////////////////////
    // DP

//     // 無限大の値
//     const uint64_t INF = (uint64_t)1 << 60;
//     //const int64_t NINF = -1 * ((int64_t)1 << 60 );

//     // DP テーブル
//     uint64_t dp[100010];

//     //DPテーブル初期化（最小化用）
//     for (int i = 0; i < 100010; ++i)
//     {
//         //dp[i] = INF;
//         dp[i] = 0;
//     } 

//     // 初期条件
//     dp[0] = 0;

//     // ループ
//     for (int i = 1; i <= n; ++i) {
//         //chmin( dp[i], dp[i - 1] + abs( input[i] - input[i - 1] ));
//         //if (i < 2)continue;
//         //chmin( dp[i], dp[i - 2] + abs( input[i] - input[i - 2] ));



//         // chmax ( dp [i] , dp[i - 1]);
//         // chmax ( dp [i] , dp[i - 1] + input[i]);
//         // cout << "dp[" << i <<"] = " << dp[i] << endl;

//     }



// //////////////////////////////////////////////////////

//     cout << dp[n] << endl;

//////////////////////////////////////////////////////
// Ctrl + Opt + N to make
    return 0;
}


//最小化用関数
template<class T> inline bool chmin(T& a, T b)
{
    if (a > b) 
    {
        a = b;
        return true;
    }
    return false;
}

//最大化関数
template<class T> inline bool chmax(T& a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class AIZU0027{

   public static void Main(string[] args) {
      int weight;
      string bin;
      char[] B;
      Queue<string> part = new Queue<string>();
      int gram;
      while (true) {
         string s = Console.ReadLine();
         if (string.IsNullOrEmpty(s)) break;
         weight=int.Parse(s);
         bin = Convert.ToString(weight,2);
         B=bin.Reverse().ToArray();
         part.Clear();gram=1;
         foreach (char b in B) {
            if (b=='1') part.Enqueue(gram.ToString());
            gram=gram<<1;
         }
         Console.WriteLine(string.Join(" ",part.ToArray()));
      }
   }
}

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

int main(){

int a=0,b=0;
cin>>a>>b;

if(a>b)
    for(int i=0; i<a; i++)
        cout<<b;
else if(a<b)
    for(int i=0; i<b; i++)
        cout<<a;
else
    for(int i=0; i<b; i++)
        cout<<a;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
typedef long long ll;
using namespace std;
ll dp[55][55][2551] = {1}, ans;
int x[2550], n, a;
int main() {
	scanf("%d%d", &n, &a);
	for(int i = 0; i < n; i++) scanf("%d", &x[i]);
	for(int i = 1; i<=n; i++) 
		for(int j=i; j>=0; j--) 
			for(int k=a*n+1; k>=0; k--) {
				dp[i][j][k]+=dp[i-1][j][k];
				if(k>=x[i-1] && j>=1)
					dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]];
			}
	for(int i=1; i<=n; i++) ans+=(dp[n][i][i*a]);
	printf("%lld",ans);
	return 0;
}

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

int main() {
	int n, x, sum;

	while (true) {
		cin >> n >> x;
		if (n == 0 && x == 0) break;
		sum = 0;

		for (int i = 1; i <= n; i++) {
			for (int j = i + 1; j <= n; j++) {
				for (int k = j + 1; k <= n; k++) {
					if (i + j + k == x) {
						sum++;
					}
				}
			}
		}
		cout << sum << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------



int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b;
    cin >> a >> b;
    cout << a * b << "\n";
    return 0;
}

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

int main(){
  int H,W;
  int i,j;
  int judge;
  cin >> H >> W;
  vector<vector<char>> grid(H,vector<char>(W));
  vector<bool> height(H);
  vector<bool> wide(W);
  for(i=0;i<H;++i){
    for(j=0;j<W;++j){
      cin >> grid.at(i).at(j);
    }
  }

  for(i=0;i<H;++i){
    judge = 0;
    for(j=0;j<W;++j){
      if(grid.at(i).at(j) == '.')
        judge += 1;
    }
    if(judge != W){
      height.at(i) = true;
    }else{
      height.at(i) = false;
    }
}

for(i=0;i<W;++i){
  judge = 0;
  for(j=0;j<H;++j){
    if(grid.at(j).at(i) == '.')
      judge += 1;
  }
  if(judge != H){
    wide.at(i) = true;
  }else{
    wide.at(i) = false;
  }

}

for(i=0;i<H;++i){
  if(height.at(i)){
    for(j=0;j<W;++j){
      if(wide.at(j)){
        cout << grid.at(i).at(j);
      }
    }
    cout << endl;
  }
}

}

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

const int MAX = 210000;
int Q;
long long type[MAX], a[MAX], b[MAX];

int main() {
    cin >> Q;

    long long sum = 0;
    priority_queue<long long> zen;
    priority_queue<long long, vector<long long>, greater<long long> > kou;
    long long zensum = 0;
    long long kousum = 0;
    
    for (int i = 0; i < Q; ++i) {
        cin >> type[i];
        if (type[i] == 1) {
            cin >> a[i] >> b[i];
            sum += b[i];

            if (zen.size() > kou.size()) {
                // kou に
                int t = zen.top();
                if (a[i] >= t) {
                    kou.push(a[i]); kousum += a[i];
                }
                else {
                    zen.pop(); zensum -= t;
                    zen.push(a[i]); zensum += a[i];
                    kou.push(t); kousum += t;
                }
            }
            else {
                // zen に
                if (zen.empty()) zen.push(a[i]), zensum += a[i];
                else {
                    int t = kou.top();
                    if (a[i] <= t) {
                        zen.push(a[i]); zensum += a[i];
                    }
                    else {
                        kou.pop(); kousum -= t;
                        kou.push(a[i]); kousum += a[i];
                        zen.push(t); zensum += t;
                    }
                }
            }
        }
        else {
            long long x = zen.top();
            long long res = (x * (int)zen.size() - zensum) + (kousum - x * (int)kou.size()) + sum;
            cout << x << " " << res << endl;
        }
    }
}

Measured memory_bytes: 8564
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
  ll N, H, W;
  cin >> N >> H >> W;

  vector<ll> A;
  vector<ll> B;

  for (size_t i = 0; i < N; i++) {
    ll a, b;
    cin >> a >> b;
    A.push_back(a);
    B.push_back(b);
  }

  ll result = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] >= H && B[i] >= W) {
      result++;
    }
  }

  cout << result << endl;

  return 0;
}


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

int main(){
  int N;
  cin>>N;
  vector<int64_t> a(N);
  int64_t sum=0;
  for(int i=0;i<N;++i){
    cin>>a.at(i);
    sum += a.at(i);
  }

  int64_t sub_sum=0;
  int64_t ans=pow(10,15);
  for(int i=0;i<N-1;++i){
    sub_sum += a.at(i);
    ans=min(ans,abs(2*sub_sum-sum));
  }

  cout<<ans<<endl;


}

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

int main() {
  string s;
  cin >> s;
  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
    cout << "Bad" << endl;
  } else {
    cout << "Good" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i, n)   for(int i = 0; i < (n); i++)
using namespace std;

int main(){
    int n;  cin >> n;
    int count = 0;
    for(int i = n; i >= 15; i-=15)   count++;
    cout << 800*n-count*200 << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	int a = stdIn.nextInt();
	int b = stdIn.nextInt();
	int coin = 0;
	
	for (int i = 0; i < 2; i++) {
		if (a >= b) {
			coin += a;
			a--;
		} else {
			coin += b;
			b--;
		}
	}
	
	System.out.println(coin);
	
	}
}

Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
using namespace std;
int n, a[200009], b[200009];
int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; ++i) cin >> a[i], b[--a[i]] = i;
	int l = 0, ret = 0;
	for (int i = 1; i <= n; ++i) {
		if (i == n || b[i] < b[i - 1]) {
			ret = max(ret, i - l);
			l = i;
		}
	}
	cout << n - ret << '\n';
	return 0;
}

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

using namespace std;

template<typename T>
class Bit {
public:
    Bit(int n): ar(n+1) {}
    T operator [](std::size_t i) {
        T res{};
        while (i > 0) {
            res += ar[i];
            i = i & (i - 1);
        }
        return res;
    }

    void update(int i, T val) {
        while ((unsigned int)i < ar.size()) {
            ar[i] += val;
            i += i & (-i);
        }
    }
private:
    std::vector<T> ar;
};

bool valid(int x, vector<int>& vals) {
    int cur = 0;
    Bit<int> bit(vals.size() * 2 + 2);
    unsigned long long res = 0;
    for (auto val: vals) {
        if (val >= x) cur += 1;
        else cur -= 1;
        if (cur >= 0) res += 1;
        res += bit[vals.size() + 1 + cur];
        bit.update(vals.size() + 1 + cur, 1);
    }
    /* cout << x << " " << res << endl; */
    return res * 2 >= vals.size() * (vals.size() + 1) / 2;
}

int main() {
    int n;
    cin >> n;
    vector<int> vs(n);
    for (int i = 0; i < n; ++i) cin >> vs[i];
    int lo = 1;
    int high = 0;
    for (auto val: vs) high = max(high, val);
    while (lo < high) {
        int mid = lo + (high + 1 - lo) / 2;
        if (valid(mid, vs)) lo = mid;
        else high = mid - 1;
    }
    cout << lo << endl;
    return 0;
}


Measured memory_bytes: 1420
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

#define len length()
#define sz size()
#define rep(i, n) for(int i = 0; i < n; i++)
#define sort(v) sort(v.begin(), v.end())
#define veci(a, n) vector<int> a(n)
#define vecs(a, n) vector<string> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define sp(n) cout << setprecision(n) << fixed

int main(){
    int N;
    cin >> N;
    int A[N];
    bool d=1;
    int ans=0;
    rep(i, N) cin >> A[i];
    
    while(d){
        rep(i, N){
            if (A[i]%2 == 0) A[i] /= 2;
            else {
                d = 0;
            }
        }
        ans++;
    }
    cout << ans - 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	if(a==b&&b==c&&c==d) printf("yes\n");
	else if(a==b&&c==d||a==c&&b==d||a==d&&b==c) printf("yes\n");
	else printf("no\n");
		
	return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));

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

signed main() {
	int H, W;
	cin >> H >> W;
	vector<string>a(H);
	rep(i, H)cin >> a[i];
	vector<vector<int>>dp(H, vector<int>(W , 0));
	dp[0][0] = 1;
	rep(i, H)rep(j, W) {
		rep(k, 2) {
			int nh = i + dx[k];
			int nw = j + dy[k];
			if (nh < 0 || nh >= H || nw < 0 || nw >= W || a[nh][nw] == '#')continue;
			dp[nh][nw] += dp[i][j];
			dp[nh][nw] %= MOD;
		}
	}
	cout << dp[H - 1][W - 1];
}

Measured memory_bytes: 9216
//Solution By SlavicG
#include "bits/stdc++.h"
using namespace std;
 
#define ll                          long long
 
#define forn(i,n)                   for(int i=0;i<n;i++)
#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(),v.rend()
	
#define pb                          push_back
#define sz(a)                       (int)a.size()
 
#define fastio                      ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define   endl                      "\n"

int main()
{
	int n;
	cin >> n;
	int a[n],b[n];
	forn(i,n)cin>>a[i]>>b[i];
	bool ok = false;
	for(int i =0;i + 2 < n;i++)
	{
		if(a[i]==b[i] && a[i+1]==b[i+1] && a[i+2]==b[i+2])
			ok = 1;
	}
	cout << (ok ? "Yes\n" : "No\n");
}

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

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

using namespace std;

typedef long long ll;

int main(void)
{
    constexpr int N_MAX = 1000;
    ll N, V;
    ll a[4][N_MAX];
    cin >> N >> V;
    REP(i, 4) REP(j, N) cin >> a[i][j];
    map<ll, ll> m[2];
    REP(i, 2) {
        REP(j, N) REP(k, N) {
            ll x = a[2 * i + 0][j] + a[2 * i + 1][k];
            if (m[i].count(x)) {
                m[i][x]++;
            } else {
                m[i][x] = 1;
            }
        }
    }
    ll result = 0;
    for (pair<ll, ll> p: m[0]) {
        if (m[1].count(V - p.first)) {
            result += p.second * m[1][V - p.first];
        }
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 128064
#include <bits/stdc++.h>
using namespace std;
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast;
 
long long mod = 1000000007;
 
long long div(long long a, long long b, long long c){
    return b / c - (a - 1) / c;
}
 
void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}
 
int main() {
    long long n, s, sum = 0, ans = 100000000;
    cin >> n;
    vector<long long> as(n);
    for (int i = 0; i < n; i++){
        cin >> as[i];
    }
    for (int i = 0; i < 100; i++){
        for (int j = 0; j < n; j++){
            sum += (as[j] - i)*(as[j] - i);
        }
        if (sum < ans){
            ans = sum;
        }
        sum = 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout <<" "<<kbrni;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

template<class V> class segtree {
private:
    int n;
    vector<V> node, lazy;

public:
    segtree(vector<V> v) {
        int sz = (int)v.size();
        n = 1;
        while(n < sz){
            n *= 2;
        }
        node.resize(2*n-1);
        lazy.resize(2*n-1, 0);
        rep(i,sz){
            node[i+n-1] = v[i];
        }
        for(int i=n-2; i>=0; i--){
            node[i] = min(node[i*2+1],node[i*2+2]);
        }
    }
    void eval(int k, int l, int r) {
        if(lazy[k] != 0) {
            node[k] += lazy[k];
            if(r - l > 1) {
                lazy[2*k+1] += lazy[k];
                lazy[2*k+2] += lazy[k];
            }
            lazy[k] = 0;
        }
    }
    void range(int a, int b, V x, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a){
            return;
        }
        if(a <= l && r <= b) {
            lazy[k] += x;
            eval(k, l, r);
        }
        else {
            range(a, b, x, 2*k+1, l, (l+r)/2);
            range(a, b, x, 2*k+2, (l+r)/2, r);
            node[k] = min(node[2*k+1],node[2*k+2]);
        }
    }
    V query(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        eval(k, l, r);
        if(b <= l || r <= a){
            return INF;
        }
        if(a <= l && r <= b){
            return node[k];
        }
        V vl = query(a, b, 2*k+1, l, (l+r)/2);
        V vr = query(a, b, 2*k+2, (l+r)/2, r);
        return min(vl,vr);
    }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vector<P> cond(n);
    rep(i,n){
        int l,r;
        cin >> l >> r;
        cond[i] = P(l,r);
    }
    sort(all(cond));
    segtree<int> st(vector<int>(m+5,0));
    rep(i,m+1){
        st.range(i+1,i+2,-i-1);
    }
    int ans = max(0,n-m);
    rep(i,n){
        st.range(0,cond[i].se+1,-1);
        ans = max(ans,-st.query(0,m+2)-(cond[i].first+m+1));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
 
int minFrog2(int n,int k,vector<int>height){
    vector<int> dp(n,INT_MAX);
    dp[0]=0;
    for(int i=1;i<n;i++){
        for(int j=i;j>i-k-1 && j>=0;j--){
            dp[i]=min(dp[i],dp[j]+abs(height[i]-height[j]));
        }
        
    }
    return dp[n-1];
}
 
int main() {
    int n;cin>>n;
    int k; cin>>k;
    int h;
    vector<int> height;
    for(int i=0;i<n;i++){
        cin>>h;
        height.push_back(h);
    }
    cout<<minFrog2(n,k,height);
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
string s;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>s;
    cout<<s[0]<<s[1]<<s[2];
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <climits>
int main(void){
    
    long N;
    std::cin >> N;
    long A[300000+1];
    for(long i=1; i<=N; i++){
        std::cin >> A[i];
    }

    long sum=0;
    long one=0,zero=0;
    long MOD = 1000000000+7;
    long shifter=1;
    for(long i=0; i<=60;i++){
        one=0;zero=0;
        for(long j=1; j<=N; j++){
            if((A[j]>>i)&1){
                one++;
            }else{
                zero++;
            }
        }
        long plus=(one*zero);
        plus%=MOD;
        sum+=(plus*shifter)%MOD;
        sum%=MOD;
        shifter*=2;
        shifter%=MOD;
    }
    std::cout << sum << std::endl;
    return 0;
}

Measured memory_bytes: 5972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
#define MOD 1000000007
int N;
int dp[200100];
int rui[200100];
int main(){
	cin >> N;
	vector<int> c(N);
	for(int i=0;i<N;i++)cin >> c[i];
	c.erase(unique(all(c)),c.end());
	N = c.size();
	dp[N]=1;
	for(int i=N-1;i>=0;i--){
		dp[i]=(rui[c[i]]+dp[i+1])%MOD;
		rui[c[i]]+=dp[i+1];
		rui[c[i]]%=MOD;
	}
	for(int i=0;i<N;i++){
		//cout << i << ' ' << dp[i] << endl;
	}
	cout << dp[0] << endl;
	return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>
#include <stdbool.h>

int main() {
	int x, y, aa, bb;
	int a[7] = { 1, 3, 5, 7, 8, 10, 12 };
	int b[4] = { 4, 6, 9 ,11 };
	int c = 2;
	bool xflag, yflag;

	scanf("%d %d", &x, &y);

	xflag = false;
	yflag = false;
	for (aa = 0; aa < 7; aa++) {
		if (x == a[aa]) xflag = true;
		if (y == a[aa]) yflag = true;
	}
	if (xflag == true && yflag == true) {
		printf("Yes\n");
		return 0;
	}

	xflag = false;
	yflag = false;
	for (bb = 0; bb < 4; bb++) {
		if (x == b[bb]) xflag = true;
		if (y == b[bb]) yflag = true;
	}
	if (xflag == true && yflag == true) {
		printf("Yes\n");
		return 0;
	}

	xflag = false;
	yflag = false;
	if (x == c) xflag = true;
	if (y == c) yflag = true;
	if (xflag == true && yflag == true) {
		printf("Yes\n");
		return 0;
	}

	printf("No\n");

	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef double db;
const int MAXN = 2e5 + 5, MAXM = 2e6 + 5, BOUND = 2e5, MOD = 1e9 + 7, INF = 0x3f3f3f3f, inv2 = 500000004;
const ll INFL = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1.0), eps = 1e-6;
#define mid l + ((r-l)>>1)
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define lc(x) c[x][0]
#define PII pair<int,int>
#define rc(x) c[x][1]
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
char gdffsaw;
#define G gdffsaw=getchar()
#define GO G;while(gdffsaw<'-')G
#define in(z) GO;z=gdffsaw&15;G;while(gdffsaw>'-')z*=10,z+=gdffsaw&15,G
int read() {
	int x = 0, f = 1; char ch = getchar();
	while (ch<'0' || ch>'9') { if (ch == '-')f = -1; ch = getchar(); }
	while (ch >= '0'&&ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int n, c[MAXN], l[MAXN];
vector<int> v[MAXN];
ll dp[MAXN];
int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n;
	rep(i, 1, n) {
		cin >> c[i];
	}
	dp[0] = 1;
	rep(i, 1, n) {
		dp[i] = (dp[i - 1]) % MOD;
		if (c[i - 1] != c[i] && l[c[i]]) {
			dp[i] = (dp[i] + dp[l[c[i]]]) % MOD;
		}
		l[c[i]] = i;
	}
	cout << dp[n] << '\n';
	return 0;
}

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

#define MOD (1000000000+7)
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) x.begin(), x.end()
#define print(vec,l,r) for(int i = l; i <= r; i++) cout << vec[i] <<" "; cout << endl;
#define forf(i,a,b) for(int i = (a); i < (b); i++)
#define forr(i,a,b) for(int i = (a); i > (b); i--)
// template starts
typedef long long int ll;
ll fact(ll n, ll p){
	ll ans = 1;
	for(ll i = 1; i <= n; i++){
		ans *= i;
		ans %= p;
	}
	return ans;
}
ll power(ll x, ll n, ll p){
	ll res = 1;
	if(n == 1) return x%p;
	if(n%2 == 1) res = x%p;

	ll temp = power(x,n/2,p);
	return res*((temp*temp)%p)%p;
}
ll inv(ll a, ll p){
	return power(a,p-2,p);
}
ll nCr(ll n, ll r, ll p){
	if(r > n) return 0;
	ll t1 = fact(n,p);
	ll t2 = inv(fact(r,p),p);
	ll t3 = inv(fact(n-r,p),p);

	return (((t1*t2)%p)*t3)%p;
}
vector<vector<ll> > multiply(vector<vector<ll> > &a, vector<vector<ll> > &b, ll p){
	int r1,c1,r2,c2;
	r1 = a.size(); c1 = a[0].size();
	r2 = b.size(); c2 = b[0].size();

	vector<vector<ll> > result(r1,vector<ll>(c2,0));

	if(c1 != r2) return result;

	for(int i = 0; i < r1; i++){
		for(int j = 0; j < c2; j++){
			for(int k = 0; k < c1; k++){
				result[i][j] += a[i][k]*b[k][j];
				result[i][j] %= p;
			}
		}
	}
	return result;
}

vector<vector<ll> > power(vector<vector<ll> >&a,ll n, ll p){
	int r = a.size();
	vector<vector<ll> > result(r,vector<ll>(r,0));
	for(int i = 0; i < r; i++) result[i][i] = 1;

	while(n > 0){
		if(n%2 == 1){
			result = multiply(result,a,p);
		}
		n /= 2;
		a = multiply(a,a,p);
	}
	return result;
}
// template ends here

void solve(){
	// code starts from here
	int N, M;
	cin >> N >> M;
	vector<int> vec(N);
	for(int i = 0; i < N; i++) cin >> vec[i];
	
	int total = accumulate(all(vec),0);
	int ans = 0;
	for(int i = 0; i < N; i++){
		if(total <= 4*M*vec[i]) ans++;
	}
	if(ans >= M){
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

int main(){
 	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int a,b,c,t;

    cin>>a>>b>>c;

    if(a>b){
        t=a;    a=b;    b=t;
    }if(b>c){
        t=b;    b=c;    c=t;
    }if(a>b){
        t=a;    a=b;    b=t;
    }

    cout<<a<<' '<<b<<' '<<c<<'\n';
}


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

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    public static void main(String args[]) {
        int t = 1;//ni();
        while (t-- > 0) {
            solve();
        }
        out.close();
    }

    static long mod = (long) 1e9 + 7;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static int maxn = 200005;

    static void solve() {
        char c[] = sn().toCharArray();
        int n = c.length;
        Stack<Character> st = new Stack<>();
        for (int i = 0; i < n; i++) {
            if (c[i] == 'B') {
                if (st.isEmpty()) continue;
                st.pop();
            } else
                st.push(c[i]);
        }
        StringBuilder sb = new StringBuilder();
        while (!st.isEmpty())
            sb.append(st.pop());
        out.println(sb.reverse());
    }
}

Measured memory_bytes: 21076
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 2000000009
#define mod 1000000007
using namespace std;

int main()
{ 
  fast;

ll a,b;
cin>>a>>b;

cout<<max((ll)0,a-2*b);

}


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

int Hurui(int n){

  bool flg[123456*2];
  int sum=0;
  int head;
  for(int i=0; i<n; i++){
    flg[i]=false;
  }

  head=2;
  while(head<=n){

    if(head > n/2){ sum++; }

    for(int i=1; i*head<=n; i++ ){
      flg[i*head -1]=true;
    }

    while(flg[head-1]==true && head<=n){
      head++;
    }

  }

  return sum;

}

int main(){

  int n;

  while(cin >> n){
    if(n==0){ break; }

    cout << Hurui(n*2) << endl;

  }


  return 0;
}

Measured memory_bytes: 1396
n = int(input())
a = list(map(int,input().split()))
largest = max(a)
b = [True] * (largest+1)
dict = {}
ans = 0
for num in a:
    if num in dict.keys():
        b[num] = False
    else:
        dict[num] = 1
        y = num * 2
        while(y <= largest):
            b[y] = False
            y += num
for num in a:
    if b[num] == True:
        ans += 1
print(ans)

Measured memory_bytes: 43468
#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;

#ifdef LOCAL
	#define debug(...) fprintf(stderr, __VA_ARGS__);fflush(stderr);
#else
	#define debug(...) 42
#endif

#define sf scanf
#define pf printf
#define nl printf("\n")
#define ps(s) printf("%s",s.c_str())
#define mem(x,val) memset(x,val,sizeof x)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend() 
#define sz(x) (int)(x).size()
#define test_case int ___t;scanf("%d", &___t);for(int cs=1;cs<=___t;cs++)

inline string getString(int n){char ch[n+5];sf(" %s",ch);return string(ch);}
inline string getLine(int n)
{char ch[n+5];fgets(ch,n+5,stdin);string s=string(ch);s.pop_back();return s;}

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
typedef long long ll;

const int S=100100;
int main()
{
	int n;
	while(~sf("%d",&n))
	{
		int ara[n+5];
		for(int i=0;i<n;i++)sf("%d",&ara[i]);

		int mx=*max_element(ara,ara+n);
		int fre[mx+5];
		mem(fre,0);
		for(int i=0;i<n;i++)fre[ara[i]]++;

		bool pairwise=true;
		for(int i=2;i<=mx;i++)
		{
			int cnt=0;
			for(int j=i;j<=mx;j+=i)
			{
				cnt+=fre[j];
				if(cnt>=2)
				{
					pairwise=false;
					break;
				}
			}
			if(!pairwise)break;
		}
		if(pairwise)puts("pairwise coprime");
		else
		{
			int g=0;
			for(int i=0;i<n;i++)g=__gcd(g,ara[i]);
			if(g==1)puts("setwise coprime");
			else puts("not coprime");
		}
	}
    return 0;
}



































Measured memory_bytes: 11544