akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <istream>
#include <map>
#include <set>
#include <queue>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i) 
const long long INF = 1000000007;
typedef long long ll;
using namespace std;
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() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	/*
	/
	/
	/
	*/
    ll a,b,c;
    cin>>a>>b>>c;
    ll temp = 0;
    vector<ll>p(a,b - c);
    rep0(i,c){
        cin>>temp;
        p[temp - 1]++;
    }
    rep0(j,a){
        if(p[j] > 0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        
    }

	return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W, K;
  cin >> H >> W >> K;
  int map[6][6];
  for (int h = 0; h < H; h++) {
    getchar();
    for (int w = 0; w < W; w++)
      map[h][w] = (getchar() == '#');
  }
  int count = 0;
  for (int hc = 0; hc < (1 << H); hc++) {
    bitset<6> hs(hc);
    for (int wc = 0; wc < (1 << W); wc++) {
      bitset<6> ws(wc);
      int hashs = 0;
      for (int a = 0; a < H; a++) {
        for (int b = 0; b < W; b++)
          hashs += map[a][b] * hs[a] * ws[b];
      }
      count += (int)(hashs == K);
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3644
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
pf={}
for i in range(2,int(n**0.5)+1):
  while n%i==0:
    pf[i]=pf.get(i,0)+1
    n//=i
if n>1:
  pf[n]=1
ans=0
for p in pf.keys():
  d=pf[p]
  tot=1
  cur=1
  ct=0
  while tot<=d:
    ct+=1
    if tot+cur+1>d:
      break
    else:
      cur+=1
      tot+=cur
  ans+=ct
print(ans)



Measured memory_bytes: 9468
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define DEBUGP(val) cerr << #val << "=" << val << "\n"

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
typedef pair<double, double> PD;

const double EPS = 1e-11;
double sq(double x) { return x * x; }

void solve(double ax, double ay, double bx, double by, int &ma,
		 const vector<double> &x, const vector<double> &y) {
  double sqdist = sq(ax - bx) + sq(ay - by);
  if (sqdist >= 4 + EPS) return;
  double dist = sqrt(sqdist);
  double ndist = sqrt(1 - sqdist / 4);
  double ex = (bx - ax) / dist, ey = (by - ay) / dist;
  int n = x.size();
  REP(i, 0, 2) {
    double coef = i == 0 ? 1 : -1;
    double cx = (ax + bx) / 2 + ey * coef * ndist;
    double cy = (ay + by) / 2 - ex * coef * ndist;
    int cnt = 0;
    REP(j, 0, n) {
      double sqdist = sq(x[j] - cx) + sq(y[j] - cy);
      if (sqdist <= 1 + EPS) {
	cnt += 1;
      }
    }
    ma = max(ma, cnt);
  }
}

int main(void) {
  int n;
  while(scanf("%d", &n) && n) {
    vector<double> x(n), y(n);
    REP(i, 0, n) scanf("%lf%lf", &x[i], &y[i]);
    int ma = 1;
    REP(i, 0, n) {
      REP(j, 0, i) {
        solve(x[i], y[i], x[j], y[j], ma, x, y);
      }
    }
    printf("%d\n", ma);
  }
}



Measured memory_bytes: 2736
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

ll n,m;
vector<ll> vec[100000];
vector<ll> visited(100000,-1);
void bfs(ll num){
  queue<pair<ll,ll>> q;
  q.push(make_pair(num,-1));
  pair<ll,ll> pa;
  while(!q.empty()){
    pa = q.front();
    q.pop();
    t1 = pa.first;
    t2 = pa.second;
    if(visited[t1] != -1){
      continue;
    }
    visited[t1] = t2;
    for(auto itr:vec[t1]){
      q.push(make_pair(itr,t1));
    }
  }
}
int main(){
  bool can = true;
  cin >> n >> m;
  rep(i,m){
    cin >> t1 >> t2;
    t1--,t2--;
    vec[t1].push_back(t2);
    vec[t2].push_back(t1);
  }
  bfs(0);
  REP(i,1,n){
    //cout << visited[i] << endl;
    if(visited[i] == -1){
      can = false;
    }
  }
  if(can){
    cout << "Yes" << endl;
    REP(i,1,n){
      cout << visited[i]+1 << endl;
    }
  }else{
    cout << "No" << endl;
  }
}

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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	int N;
	cin >> N;
	double ans = 1;
	double hoge = (double)N/3;
	rep(i,0,3){
		ans *= hoge;
	}
	printf("%.10lf\n", ans);
}

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;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


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

namespace arc072_b
{
	class Program
	{
		static void Main(string[] args)
		{
			long[] x = Console.ReadLine().Split().Select(long.Parse).ToArray();
			Console.WriteLine(Math.Abs(x[0] - x[1]) <= 1 ? "Brown" : "Alice");
		}
	}
}

Measured memory_bytes: 13396
import java.io.File;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Scanner;
import java.util.Set;
import java.util.Stack;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static Properties pps = System.getProperties();
	static boolean dbg = true;

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int a = ni();
		ns();
		int[] b = ni(a);

		Stack<Integer> s = new Stack<Integer>();
		List<Integer> l = new ArrayList<Integer>();
		for (int i : b) {
			l.add(i);
		}
		if (solve(s, l)) {
			while(!s.isEmpty())
				out(s.pop());
		} else {
			System.out.println(-1);
		}

	}

	private static boolean solve(Stack<Integer> s, List<Integer> l) {
		// TODO Auto-generated method stub
		while (l.size() > 0) {
			
			int i = 0;
			boolean tag=true;
			for (i = l.size()-1; i >=0; i--) {
				int k = l.get(i);
				if(i+1==k) {
					s.add(k);
					break;
				}
			}
			if(i==-1) {
				return false;
			}else {
				l.remove(i);
			}
		}
		return true;
	}

	private static void out(List<Integer> l) {
		// TODO Auto-generated method stub
		for (int i : l)
			System.out.println(i);

	}

	private static void out(int[] b) {
		// TODO Auto-generated method stub
		for (int i : b)
			System.out.println(i);

	}

	public static void out(String str) {

		if (dbg)
			System.out.println(str);
	}

	public static void out(int str) {

		if (dbg)
			System.out.println(str);
	}

	public static int ni() {

		return sc.nextInt();

	}

	public static String ns() {

		return sc.nextLine();
	}

	public static int[] ni(int k) {
		int[] res = new int[k];
		for (int i = 0; i < k; i++)
			res[i] = sc.nextInt();
		sc.nextLine();
		return res;
	}

	public static String[] ns(int k) {
		String[] res = new String[k];
		for (int i = 0; i < k; i++)
			res[i] = sc.nextLine();
		return res;
	}

	public static int[][] ni(int a, int b) {
		int[][] res = new int[a][b];
		for (int i = 0; i < a; i++)
			for (int j = 0; j < b; j++)
				res[i][j] = sc.nextInt();
		sc.nextLine();
		return res;
	}
}


Measured memory_bytes: 23764
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
ll dp[45][405][405];
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    V<int> s(n),t(n),u(n);
    for(int i=0;i<n;i++)cin>>s[i]>>t[i]>>u[i];
    for(int i=0;i<45;i++){
        for(int j=0;j<405;j++){
            for(int k=0;k<405;k++){
                dp[i][j][k]=inf;
    }
    }
    }
    dp[0][0][0]=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<405;j++){
            for(int k=0;k<405;k++){
                if(dp[i][j][k]>=inf)continue;
                chmin(dp[i+1][j][k],dp[i][j][k]);
                chmin(dp[i+1][j+s[i]][k+t[i]],dp[i][j][k]+u[i]);
            }
        }
    }
    ll ans=-1;
    for(int i=1;i<405;i++)for(int j=1;j<405;j++){
        if(dp[n][i][j]>=inf)continue;
        if(j*a==i*b){
            if(ans==-1)ans=dp[n][i][j];
            else chmin(ans,dp[n][i][j]);
        }
    }
    cout<<ans<<"\n";
}

Measured memory_bytes: 61264
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
typedef long long ll;
#define maxn 50
using namespace std;
int a,b,c;
int main(int argc,char const* argv[])
{
  int ans;
  cin >> a >> b >> c;
  if(a==b && b!=c) ans=c;
  else if(a==c && c!=b) ans=b;
  else if(b==c && c!=a) ans=a;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//Remove below header file if c++ version greater than 14
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define ll long long int
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(i=0; i<n; i++)
#define Fo(i, k, n) for(i=k; i<n; i++)

using namespace std;
using mii=map<int, int>;
using mll=map<ll, ll>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int mod = 1000000007;

ll desc(ll x, ll y)
{
    return x > y;
}

int main() {
    fastIO
    int i, n, x;
    cin >> n >> x;
    vi a(n, 0);

    fo(i, n)
        cin >> a[i];

    vll aux;
    aux.pb(0);

    for(int i = 1; i <= n; i++)
    {
        aux.pb(aux[i - 1] + a[i - 1]);
    }

    int idx = lower_bound(aux.begin(), aux.end(), x) - aux.begin();
    if(aux[idx] == x)
        cout << idx + 1 << endl;
    else
        cout << idx << endl;

    return 0;
}

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

int main(){
    int n; cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(to_string(i).length()%2==1) ans++;
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}
template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	string s;
	cin >> s;
	int ans = 0;
	int n = s.size();
	rep(i, n-1) {
		if (s[i] != s[i + 1])ans++;
	}
	print(ans);
}

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

int main(){
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int xd = -(y2 -y1);
    int yd = x2 -x1;
    cout << x2+xd << " " << y2+yd << " " << x1+xd << " " << y1+yd << endl;
    return 0;
}

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

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

    int N, M, X;
    cin >> N >> M >> X;

    int front = 0;
    int back = 0;

    for(int i = 0; i < M; i++) {
        int A;
        cin >> A;
        if(A < X) front++;
        else back++;
    }

    cout << min(front, back) << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author alireza_kaviani
 */

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

#define all(x)                      (x).begin(),(x).end()
#define Sort(x)                     sort(all((x)))
#define X                           first
#define Y                           second
#define sep                         ' '
#define endl                        '\n'
#define SZ(x)                       ll(x.size())

ll poww(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * poww(a * a % md, b / 2, md) % md : poww(a * a % md, b / 2, md) % md));
}

const ll MAXN = 1e6 + 10;
const ll LOG = 22;
const ll INF = 8e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;

ll n, k, ans;

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

    cin >> n >> k;
    while (n) {
        n /= k;
        ans++;
    }
    cout << ans << endl;

    return 0;
}
/*

*/


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

typedef vector<vl> mat;

mat mul(mat &a, mat &b){
	int x=a.size(), y=b.size(), z=b[0].size();
	mat c(x, vl(z));
	REP(i, x)REP(k, y)REP(j, z){
		(c[i][j]+=(a[i][k]*b[k][j]%MOD))%=MOD;
	}
	return c;
}

mat power(mat a, ll n){
	int x=a.size();
	mat b(x, vl(x));
	REP(i, x){
		b[i][i]=1;
	}
	while(n>0){
		if(n&1){
			b=mul(b, a);
		}
		a=mul(a, a);
		n>>=1;
	}
	return b;
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	// cout<<setprecision(10)<<fixed;
	int n, m;
	ll x[125252];
	cin>>n>>m;
	REP(i, m){
		cin>>x[i+1];
	}
	mat a(3, vl(3));
	a[0][0]=1;a[0][1]=0;a[0][2]=1;
	a[1][0]=2;a[1][1]=1;a[1][2]=2;
	a[2][0]=1;a[2][1]=1;a[2][2]=2;
	mat b(3, vl(3));
	b[0][0]=1;b[0][1]=0;b[0][2]=0;
	b[1][0]=2;b[1][1]=1;b[1][2]=0;
	b[2][0]=1;b[2][1]=1;b[2][2]=1;
	x[0]=0;x[m+1]=n;
	mat c=b;
	REP(i, m+1){
		mat t=power(a, x[i+1]-x[i]-1);
		c=mul(t, c);
		if(i!=m) c=mul(b, c);
	// 	REP(j, 3)REP(k, 3) cout<<c[j][k]<<" \n"[k==2];
	// 	cout<<"--------------------"<<'\n';
	}
	cout<<c[2][0]<<'\n';
	return 0;
}


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

int main()
{
    int n, m, c;
    cin >> n >> m >> c;

    vector<int> bVec;
    for (int i = 0; i < m; ++i)
    {
        int input;
        cin >> input;
        bVec.push_back(input);
    }

    int correctNum = 0;

    for (int i = 0; i < n; ++i)
    {
        int codeSum = 0;

        for (int aIndex = 0; aIndex < m; ++aIndex)
        {
            int aInput;
            cin >> aInput;

            codeSum += aInput * bVec.at(aIndex);
        }

        codeSum += c;

        if (codeSum > 0)
        {
            ++correctNum;
        }
    }

    cout << correctNum << endl;
}

Measured memory_bytes: 256
def wantans(nowp,sc,rlis,ans):

    if len(rlis) == 0:
        ans = min(ans , sc)
        return ans

    for i in range(len(rlis)):

        nexsc = sc

        nexlis = []
        for j in range(len(rlis)):
            if i != j:
                nexlis.append(rlis[j])

        if nowp != None:
            nexsc += lis[nowp][rlis[i]]
            
        ans = wantans(rlis[i],nexsc,nexlis,ans)

    return ans
        




N,M,R = map(int,input().split())

r = list(map(int,input().split()))

lis = [ [float("inf")] * N for i in range(N) ]

for i in range(N):

    lis[i][i] = 0

for i in range(M):

    A,B,C = map(int,input().split())

    A -= 1
    B -= 1

    lis[A][B] = C
    lis[B][A] = C

for k in range(N):

    for i in range(N):

        for j in range(N):

            lis[i][j] = min(lis[i][j],lis[i][k]+lis[k][j])



for i in range(R):
    r[i] -= 1
    
ans = wantans(None,0,r,float("inf"))

print (ans)


Measured memory_bytes: 74200
// なんとなくわかったようなわからないような
#include<iostream>
using namespace std;

typedef long long ll;

int main(){
    int n;
    cin >> n;
    int A[n];
    for(int i = 0; i < n; i++)  cin >> A[i];

    int r = 0;
    int nowsum = 0;
    int nowxor = 0;
    ll ans = 0;

    for(int l = 0; l < n; l++){
        while(r < n && (nowsum+A[r])==(nowxor^A[r])){
            nowsum += A[r];
            nowxor ^= A[r];
            r++;
        }

        ans += r-l;
        nowsum -= A[l];
        nowxor ^= A[l]; // (A xor B) xor B = A
    }

    cout << ans << endl;
    
    return 0;
}

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

void MatrixChainMultiplication(int n,int p[],int m[101][101]) {
	int i, j, k,l;
	for (i = 1; i <= n; i++) m[i][i] = 0;
	for (l = 2; l <= n; l++) {
		for (i = 1; i <= n - l +1; i++) {
			j = i + l - 1;
			m[i][j] = (1<<21);
			for (k = i; k <= j - 1; k++) {
				
				m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}
}

int main() {
	int n, p[101], m[101][101];
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> p[i - 1] >> p[i];
	MatrixChainMultiplication(n, p, m);
	cout << m[1][n] << endl;

	
}

Measured memory_bytes: 3124
import sys
input = sys.stdin.readline

mod = 10**9 + 7
n = int(input())

dp = [[[[1]*4 for _ in range(4)] for _ in range(4)] for _ in range(n + 1)]

dp[3][0][1][2] = 0
dp[3][1][0][2] = 0
dp[3][0][2][1] = 0

if n == 3:
    ans = 0
    for i in dp[-1]:
        for j in i:
            for k in j:
                ans += k
    print(ans)
    sys.exit()

for i in range(4, n + 1):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                if (j == 0 and k == 1 and l == 2) or (j == 1 and k == 0 and l == 2) or (j == 0 and k == 2 and l == 1):
                    dp[i][j][k][l] = 0
                    continue
                if l != 2:
                    dp[i][j][k][l] = sum([dp[i - 1][x][j][k] for x in range(4)])
                    dp[i][j][k][l] %= mod
                    continue
                dp[i][j][k][l] = sum([dp[i - 1][x][j][k] for x in range(4)])
                dp[i][j][k][l] %= mod

                if l == 2 and k == 1:
                    dp[i][j][k][l] -= dp[i - 1][0][j][1]
                    dp[i][j][k][l] %= mod
                
                if l == 2 and j == 1:
                    dp[i][j][k][l] -= dp[i - 1][0][1][k]
                    dp[i][j][k][l] %= mod
                
                if l == 2 and j == 1 and k == 1:
                    dp[i][j][k][l] += dp[i - 1][0][1][1]
                    dp[i][j][k][l] %= mod


ans = 0
for i in dp[-1]:
    for j in i:
        for k in j:
            ans += k
            ans %= mod
print(ans)


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n, m;
  cin >> n >> m;
  vector<pair<int, int>> vp(m);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    vp.at(i) = make_pair(b, a);
  }
  sort(vp.begin(), vp.end());
  int ans = 0, br = -1;
  rep(i, m){
    auto now = vp.at(i);
    // cerr << br << " " << vp.at(i).second << " " << vp.at(i).first << endl;
    if(br > now.second) continue;
    else{
      ans++;
      br = now.first;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;
using ll = long long;

// inf
const ll infl = 1LL << 60;
const int inf = 1 << 30;

int main() {
    int N, M; cin >> N >> M;
    vector<int> X(M);
    for (int i = 0; i < M; ++i) {
        cin >> X[i];
    }
    if (N >= M) {
        cout << 0 << endl;
        return 0;
    }
    sort(X.begin(), X.end());
    vector<ll> D(M - 1); 
    ll dsum = 0LL;
    for (int i = 0; i < M - 1; ++i) {
        D[i] = X[i + 1] - X[i];
        dsum += D[i];
    }
    sort(D.begin(), D.end(), greater<ll>());
    ll ans = dsum;
    for (int i = 0; i < N - 1; ++i) {
        ans -= D[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
S = input()
K = int(input())


Costs = {chr(98 + i): (25 - i) for i in range(25)}
Costs['a'] = 0
alphabets = [chr(97 + i) for i in range(26)]


ans = ""
for i in range(len(S)):
    s = S[i]
    if K >= Costs[s]:
        K -= Costs[s]
        ans += 'a'
    else:
        ans += s


ans = ans[:-1] + alphabets[(alphabets.index(ans[-1]) + K) % 26]
print(ans)


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

int n, a, b;

int main(void) {
  // Here your code !
  scanf("%d %d %d", &n, &a, &b);

  printf("%d\n", min(n * a, b));

  return 0;
}


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

using namespace std;

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

	int X[3];
	X[0] = A + B;
	X[1] = A - B;
	X[2] = A * B;

	cout << *max_element(X, X + 3) << endl;

	return 0;
}

Measured memory_bytes: 256
solve :: [(Int, Int)] -> Int -> [Int] -> [Int] -> Int
solve [] _ _ _ = 0
solve ((i, a):as) prev bs cs = st + ad + solve as a bs cs 
  where st = bs !! (i - 1)
        ad = if a == prev + 1 then cs !! (a - 2) else 0

main :: IO ()
main = do
  getLine
  as <- map read . words <$> getLine
  bs <- map read . words <$> getLine
  cs <- map read . words <$> getLine
  print $ solve (zip [1..] as) 100 bs cs


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



int main() {
  int A,B,C,X;
  cin >> A >> B >> C >> X;
  int sum = 0;
  int cnt = 0;
  bool f = false;

  for(int i = 0; i <= A; i++){
    for(int j = 0; j <= B; j++){
      for(int k = 0; k <= C; k++){
        sum = 500*i + 100*j + 50*k;
        if(sum == X){
          cnt++;
          f = true;
        }
      }
    }
  }

 if(f){
   cout << cnt << endl;
 }else{
   cout << 0 << endl;
 }


}





Measured memory_bytes: 3556
#include<iostream>
#include<vector>
#include<cstring>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<random>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

int h, n;
int a[1010], b[1010];

int main() {
    cin >> h >> n;
    rep(i, n) cin >> a[i] >> b[i];
    vector<vector<int>> dp(n+1, vector<int>(h+1, 0));
    repf(j, 1, h+1) dp[0][j] = 1000000000;
    rep(i, n) {
        rep(j, h+1) {
            if (j >= a[i])
            dp[i+1][j] = min(dp[i][j],
                    min(dp[i+1][j - a[i]] + b[i], dp[i][j - a[i]] + b[i]));
            else
            dp[i+1][j] = min(dp[i][j], min(dp[i+1][0] + b[i], dp[i][0] + b[i]));

        }
    }
    cout << dp[n][h] << endl;
    return 0;
}


Measured memory_bytes: 39424
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os, const map<T,U>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int,int>;
using vi = std::vector<int>;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int n,m; cin >> n >> m;
    vector<int> cnt(n,0);
    rep(i,m){
        int a,b; cin >> a >> b;
        a--; b--;
        cnt[a]++;
        cnt[b]++;
    }

    rep(i,n){
        if(cnt[i]%2==1){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 640
// atcoder/edpc/Z/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

template<typename T>
struct ConvexHullTrick {
  deque<pair<T, T>> q;
  ConvexHullTrick() {}
  void append(T a, T b) // DESC a, aX+b
  {
    if (q.size()) {
      assert(q.back().first >= a);
    }
    q.push_back({a, b});
    while (3 <= q.size() && check()) {
      q[q.size() - 2] = q[q.size() - 1];
      q.pop_back();
    }
    return ;
  }
  bool check(void)
  {
    pair<T, T> a = q[q.size() - 3];
    pair<T, T> b = q[q.size() - 2];
    pair<T, T> c = q[q.size() - 1];
    assert(a.first >= b.first);
    assert(b.first >= c.first);
    return (b.first - a.first) * (c.second - b.second) >= (b.second - a.second) * (c.first - b.first);
  }
  T eval(T x, pair<T, T> p)
  {
    return p.first * x + p.second;
  }
  T query(T x) // ASC x
  {
    while (2 <= q.size() && eval(x, q[0]) >= eval(x, q[1])) {
      q.pop_front();
    }
    return eval(x, q.front());
  }
};

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  lli c;
  while (cin >> n >> c) {
    vector<lli> h(n);
    cin >> h;
    ConvexHullTrick<lli> cht;
    for (int i = 0; i < n; ++i) {
      lli x = i ? cht.query(h[i]) + h[i] * h[i] : 0;
      cht.append(-2 * h[i], h[i] * h[i] + x + c);
    }
    cout << cht.query(h.back()) + h.back() * h.back() << endl;
  }

  return 0;
}


Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(){
  long long N,ans=0;
  while(cin>>N,N){
    ans=0;
  vector<long long> v(N);
  rep(i,N){
    cin>>v[i];
  }
  sort(v.begin(),v.end());
  for(int i=1;i<N-1;i++)ans+=v[i];
  cout<<ans/(N-2)<<endl;
  }
 return 0;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	VL so(n+1,0);
	LL ans = 0;
	for (int i = 2; i <= n; i++) {
		int num = i;
		for (int j = 2; num != 1; j++) {
			if (num % j == 0) {
				// 素因数jを1プラス
				so[j]++;
				num /= j;
				j--;
			}
		}
	}
	int n3=0,n5=0,n15=0,n25=0,n75=0;  // nx: x個の約数を持つ数字m(m^(x-1))
	for (int i = 2; i <= n; i++) {
		if (so[i] >= 2) {
			n3++;
		}
		if (so[i] >= 4) {
			n5++;
		}
		if (so[i] >= 14) {
			n15++;
		}
		if (so[i] >= 24) {
			n25++;
		}
		if (so[i] >= 74) {
			n75++;
		}
	}
	//75
	ans += n75;
	//3*25
	ans += n25*(n3 - 1);
	//5*15
	ans += n15 * (n5 - 1);
	// 3*5*5
	ans += n5 * (n5 - 1) * (n3 - 2) / 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define init(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, a, b) for (int i = a; i < b; i++)
#define loopr(i, a, b) for (int i = a; i >= b; i--)
#define loops(i, a, b, step) for (int i = a; i < b; i += step)
#define looprs(i, a, b, step) for (int i = a; i >= b; i -= step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie();                        \
    cout.tie();
#define FILE_READ_IN freopen("input.txt", "r", stdin);
#define FILE_READ_OUT freopen("output.txt", "w", stdout);
#define all(a) a.begin(), a.end()
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

void solve()
{
    ll h, n;
  	cin >> h >> n;
  	cout << (ll)ceill(h/(long double)n) << "\n";
}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ll>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a)%mod;  a = (a * a)%mod;  b/=2;  }  return res; }
#define rs resize
typedef tree< ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update > OST;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

const ll N = 100009;
ll i,n,l,s;
ll a[N];
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n;
    rep(i,1,n + 1){
        cin>>a[i];
        s = s + llabs(l - a[i]);
        l = a[i];
    }
    s += llabs(a[n]);
    rep(i,1,n + 1){
        l = s;
        l -= llabs(a[i] - a[i - 1]);
        l -= llabs(a[i] - a[i + 1]);
        l += llabs(a[i - 1] - a[i + 1]);
        cout<<l<<endl;
    }
    return 0;
}

Measured memory_bytes: 2048
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

type cxcyh struct {
	CX int
	CY int
	H  int
}

type xyh struct {
	x int
	y int
	h int
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	N := readInt()
	XYH := make([]xyh, 0, N)
	n := -1
	for i := 0; i < N; i++ {
		x := readInt()
		y := readInt()
		h := readInt()
		XYH = append(XYH, xyh{x, y, h})
		if h != 0 {
			n = i
		}
	}

	q := make([]cxcyh, 0, 101*101)
	for cx := 0; cx <= 100; cx++ {
		for cy := 0; cy <= 100; cy++ {
			H := XYH[n].h + abs(XYH[n].x-cx) + abs(XYH[n].y-cy)
			q = append(q, cxcyh{cx, cy, H})
		}
	}

	for i := 0; i < len(XYH); i++ {
		nq := make([]cxcyh, 0, len(q))
		for j := 0; j < len(q); j++ {
			if XYH[i].h == max(q[j].H-abs(XYH[i].x-q[j].CX)-abs(XYH[i].y-q[j].CY), 0) {
				nq = append(nq, q[j])
			}
		}
		q = nq
	}

	fmt.Printf("%d %d %d\n", q[0].CX, q[0].CY, q[0].H)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


Measured memory_bytes: 1152
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> P(N);
	int min = 200000;
	int count = 0;
	for (int i = 0; i < N; i++) {
		cin >> P.at(i);
		if (min >= P.at(i)) {
			count++;
			min = P.at(i);
		}
	}
	cout << count << endl;
	return 0;
}


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

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

Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define print(x)cout<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

ll d[101][101];

ll inf = 1001001001LL;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
  int n,k;
  cin >> n >> k;
  int x = (n-2)*(n-1)/2;
  if(k>x){
    cout<<-1<<endl;
    return 0;
  }
  cout<<x-k+n-1<<endl;
  srep(i,1,n){
    cout<<1 <<" " << i+1<<endl;
  }
  int c = x-k;
  int l = 2;
  int cnt = 0;
  while(c>cnt){
    rep(i,n-l){
      cout<<l<<" "<<l+i+1<<endl;
      cnt++;
      if(cnt>=c)break;
    }
    l++;
  }
  return 0;
}

Measured memory_bytes: 3640
#include<algorithm>
#include<cmath>
#include<cstdint>
#include<cstdio>
#include<functional>
#include<iostream>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
using namespace std;

#define loop(i,a,b) for(int i=(a); i<(b); ++i)
#define rep(i,n) for(int i=0; i<n; ++i)
#define all(v) begin(v), end(v)
#define dump(a) cerr << #a << " = " << (a) << "(L:" << __LINE__ << ")" << endl

const double PI = acos(-1.0);

int main() {
  std::ios::sync_with_stdio(false);

  string s;
  cin >> s;

  sort(s.begin(), s.end());
  if (s == "abc") {
    cout << "Yes"<< endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      (a)/GCD((a),(b))*(b)
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

// code
// ------------------------------------------------
int main() {

  int n,m;
  cin >> n >> m;
  int cnt = 0;
  int vote = 0;
  
  vi a(n);
  rep(i,n)
  {
    cin >> a[i];
    vote += a[i];
  }

  rep(i,n)
  {
    if(a[i] < (double)vote / 4.0 / m)
    {

    }
    else
      cnt++;
  }

  if(cnt >= m) cout << "Yes" << endl;
  else cout << "No" << endl;


  return 0;
}
// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


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

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int x = tx - sx, y = ty - sy; // 座標の差分
    string out1, out2; // 往路
    string home1, home2; // 復路

    for(int i = 0; i < y; i++){
        out1 += 'U';
        home1 += 'D';
    }
    for(int i = 0; i < x; i++){
        out1 += 'R';
        home1 += 'L';
    }
    out2 += 'L'; home2 += 'R';
    for(int i = 0; i < y + 1; i++){
        out2 += 'U';
        home2 += 'D';
    }
    for(int i = 0; i < x + 1; i++){
        out2 += 'R';
        home2 += 'L';
    }
    out2 += 'D'; home2 += 'U';

    cout << out1 + home1 + out2 + home2 << endl;

    return 0;
}

Measured memory_bytes: 256
a,b,c=map(int,input().split())
if a==1 and b==0 and c==0:
    print('Close')
elif a==0 and b==1 and c==0:
    print('Close')
elif a==1 and b==1 and c==0:
    print('Open')
elif a==0 and b==0 and c==1:
    print('Open')
elif a==0 and b==0 and c==0:
    print('Close')


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

using namespace std;

#define LOG(...) fprintf(stderr, __VA_ARGS__)
//#define LOG(...)
#define FOR(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REP(i, n) for(int i=0; i<(int)(n); ++i)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SQ(n) (n) * (n)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int gcd(int a, int b){
  return b == 0 ? a : gcd(b, a % b);
}

int main() {
  int H, h, m, s, a;
  while(cin >> H >> h >> m >> s, H | h | m | s) {
    a = -1;
    while(true) {
      int d = 119 * H - 1;
      int n = 60 * m * (H + 1) + 60 * 60 * (h + a * H);
      // LOG("n :%d d:%d\n", n, d);
      if(s * d <= n && n < 60 * d && n != m * d) {
        int g = gcd(n, d);
        // LOG("g %d\n", g);
        n /= g;
        d /= g;
        printf("%d %d %d %d\n", h, m, n, d);
        break;
      }

      a++;
      if(a > 1) {
        a = -1;
        s = 0;
        m++;
        if(m >= 60) {
          m = 0;
          h++;
          if(h >= H) {
            h = 0;
          }
        }
      }
    }
  }
}

Measured memory_bytes: 3152
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define test ll t; cin>>t; while(t--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
#define max 1000005
bool prime[max];
/*ull sieve()
{
	memset(prime,true,sizeof(prime));
	for(ull p=2;p*p<max;p++)
	{
		if(prime[p]==true){
			for(ull i=2*p;i<max;i+=p)
			{
				prime[i]=false;
			}
		}
	}
	prime[0]=0;
	prime[1]=0;
}*/
using namespace std;
signed main()
{
	fastio;
	int n,m;
	cin>>n>>m;
	double sum=0;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	double tot=(double)sum/(m*4);
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>=tot)
			cnt++;
	}
	if(cnt>=m)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 256