akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    char c[55][55];
    int cnt = 0;
    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            cin >> c[i][j];
        }
    }
    for(int i = 1; i <= H; i++){
        for(int j = 1; j <= W; j++){
            if(c[i][j] == '#' && c[i][j-1] != '#'
                && c[i-1][j] != '#' && c[i][j+1] != '#'
                && c[i+1][j] != '#'){
                    cnt++;
                }
        }
    }

    cout << (cnt == 0 ?"Yes":"No") << endl;




}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int Search_path(int **,int*,int);
int main(){
  int i,j,n;
  int **array,*flag;
  scanf("%d",&n);
  flag = malloc(sizeof(int *)*n);
  for(i=0;i<n;i++)flag[i]=0;
  array = malloc(sizeof(int *)*n);
  for(i=0;i<n;i++)array[i] = malloc(sizeof(int)*n);

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

  //
  printf("%d\n",Search_path(array,flag,n));
  //
 
  for(i=0;i<n;i++)free(array[i]);
  free(array);
  free(flag);

  return 0;
}

int Search_path(int **array,int *flag,int n){
  int index,num,i,j,min=INT_MAX,sum=0;
  int passed[n],pass_count=1;//passed[]:既に通ったnode
  index=0;
  flag[index] = 1;
  passed[0]=index;
  while(1){
    num = -1;
    min = INT_MAX;
    for(j=0;j<pass_count;j++){
      index=passed[j];
      for(i=0;i<n;i++){
	if(flag[i] == 0 && min > array[index][i] && array[index][i] > -1){//通ったnodeから繋がっているnodeがまだ通ってないかつ、一番costが少ない所を選ぶ
	  min = array[index][i];
	  num = i;
	}
      }
    }
    if(num == -1)break;
    flag[num]=1;
    passed[pass_count++]=num;//通ったnodeを記録
    sum +=min;//最小コストを全て足す
  }
  return sum;
}
      
  
    
  
    
			



Measured memory_bytes: 2112
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long int;

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

    ll ans = 0;
    ll nowmax = 0;
    for(int i = 0; i < n; i++){
        if (nowmax < A[i]){
            nowmax = A[i];
        }
        else{
            ans += (ll)(nowmax - A[i]);
        }
    }

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

Measured memory_bytes: 3552
#include "bits/stdc++.h"

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

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int UI;

using namespace std;


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

	double n;
	cin >> n;

	int rootAns = (int)pow(n, 0.5);

	cout << rootAns * rootAns << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
//#include <stdlib.h>
//#include <string.h>
//#include <stdbool.h>
//#include <limits.h>
//#include <math.h>

int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  printf("%d\n", (a+b+1)/2);
  return 0;
}


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

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
#define INF 9223372036854775807
#define MOD 1000000007
#define pb push_back
#define F first
#define S second
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef pair<ll, ll> pll;
ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, tmp = 0;
string s;
bool flag;
#pragma endregion
#define MAX 111111



int main(void) {
  ll a, b;
  cin >> a >> b;
  if (a > 0) {
	cout << "Positive" << endl;
	return 0;
  }
  if (a <= 0 && b >= 0) {
	cout << "Zero" << endl;
	return 0;
  }
  if (llabs(a - b) % 2 == 0) {
	cout << "Negative" << endl;
  }
  else {
	cout << "Positive" << endl;
  }


  return 0;
}

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

using namespace std;

int main(){
    int N, X;
    cin >> N >> X;

    int count = 0;
    vector <int> m(N);
    for (int i = 0; i < N; i++){
        cin >> m[i];
        X -= m[i];
        count ++;
    }

    sort(m.begin(), m.end());
    
    while (X >= 0){
        X -= m[0];
        if (X < 0){
            break;
        }else{
            count ++;
        }
    }
    
    cout << count << endl;
    

    return 0;
}

Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
s = gets.chomp

if s.chars.all?{|c| c == 'R'} || s.chars.all?{|c| c == 'W'}
  puts 0
  exit
end

l = 0
r = n-1

ans = 0
while l < r
  while s[l] == 'R'
    l += 1
  end
  while s[r] == 'W'
    r -= 1
  end

  break unless l < r

  ans += 1
  l += 1
  r -= 1
end

puts ans


Measured memory_bytes: 35840
n = gets.to_i
arr = gets.split(' ').map(&:to_i)
answer = arr[n-1]

dp = n.times.map { [0]*21 }
dp[0][arr[0]] = 1
1.upto(n-2) do |i|
  0.upto(20) do |j|
    next if dp[i-1][j] <= 0
    cp = j + arr[i]
    cm = j - arr[i]

    dp[i][cp] += dp[i-1][j] if cp <= 20
    dp[i][cm] += dp[i-1][j] if cm >= 0
  end
end

puts dp[n-2][answer]

Measured memory_bytes: 6136
#include<stdio.h>

int main(){
    int a,b,c;
    int cnt = 0;
    int x;
    
    scanf("%d %d %d\n",&a,&b,&c);
    for(int i = a;i <= b;i++){
        x = c % i;
        if(x == 0){
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 2148
import math
N,D = map(int,input().split())
counter = 0
X = []
for i in range(N):
    ls = list(map(int,input().split()))
    X.append(ls)
for i in range(N-1):
    for j in range(i+1, N):
        dist = 0
        for k in range(D):
            dist += (X[i][k] - X[j][k])**2
        for l in range(1,int(math.sqrt(dist))+1):
            if l**2 == dist:
                counter += 1
print(counter)

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

int main() {
    int N; cin >> N;
    if (N > 81){
        cout << "No" << endl;
    } else {
        for (int i = 9; i >= 1; i--){
            if(N%i == 0){
                N = N/i;
                if(N > 9){
                    cout << "No" << endl;
                    return 0;
                } else {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }

    return 0;
}

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

using namespace std;

bool isPrime(int x)
{
  int sqx = sqrt(x);
  for(int i = 2; i < sqx+1; ++i)
  {
    if(x % i == 0)
      return false;
  }
  return true;
}

int main()
{
  int x;
  cin >> x;
  if(x == 2)
  {
    cout << x << endl;
    return 0;
  }
  if(x % 2 == 0)
    ++x;
  while(true)
  {
    if(isPrime(x))
      break;
    x += 2;
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int

	fmt.Scanf("%d", &n)

	total := 0
	a := 1
	b := 1

	for a = 1; a < n; a++ {
		for b = 1; b <= (n-1)/a; b++ {

			total++
		}
	}
	fmt.Println(total)
}


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

const int inf = 1000000000;

int main() {
    int n, m;
    cin >> n >> m;
    int a[n], b[n], c[m], d[m];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    for (int j = 0; j < m; j++) {
        cin >> c[j] >> d[j];
    }
    int dist[n], ans[n];
    for (int i = 0; i < n; i++) dist[i] = inf;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            dist[i] = min(dist[i], abs(a[i] - c[j]) + abs(b[i] - d[j]));
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (dist[i] == abs(a[i] - c[j]) + abs(b[i] - d[j])) {
                ans[i] = j + 1;
                break;
            }
        }
    }
    for (int i = 0; i < n; i++) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
int n,m,x,y,i,j,col[200005],aa[2][200005],cnt=0,vis[200005],h,v;
vector<int> a[200005];
queue<int> q;
char ss[200005];
int main()
{
	scanf("%d%d",&n,&m);
	scanf("%s",ss);
	for(i=1;i<=n;i++)col[i]=ss[i-1]-'A';
	for(i=1;i<=m;i++)
	{
		scanf("%d%d",&x,&y);
		if(x==y)aa[col[x]][x]++;
		else
		{
			aa[col[x]][y]++;
			aa[col[y]][x]++;
			a[x].push_back(y);
			a[y].push_back(x);
		}
	}
	for(i=1;i<=n;i++)
	{
		if(!aa[0][i]||!aa[1][i])
		{
			q.push(i);
			cnt++;
			vis[i]=1;
		}
	}
	while(!q.empty())
	{
		h=q.front();
		q.pop();
		for(i=0;i<a[h].size();i++)
		{
			v=a[h][i];
			if(!vis[v])
			{
				aa[col[h]][v]--;
				if(!aa[0][v]||!aa[1][v])
				{
				q.push(v);
				cnt++;
				vis[v]=1;
				}
			}
		}
	}
	if(cnt>=n)
	{
		printf("No\n");
		
	}
	else printf("Yes\n");
	return 0;
}

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

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

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    c-=a+b;
    if(c<0){cout<<"No"<<endl;return 0;}
    ll d = a*b;
    if(d<c*c/4+(c%2!=0))cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

using namespace std;

namespace {

#define VEVE(i, a, b) for (ll i = a, __##i = b; i < __##i; ++i)
#define DYDY(i, a, b) for (ll i = a, __##i = b; i > __##i; --i)
#define RARA(x, seq) for (auto &x : seq)
#define SIZE(x) ((ll)(x.size()))
#define ALL(x) x.begin(), x.end()

typedef int64_t ll;
typedef double dd;

void Solve(ll) {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  if (d < b) {
    cout << "No\n";
    return;
  }
//  DEBUG(a, b, c, d);
  if (a > c) {
    const ll k = (a - c + b - 1) / b - 1;
    a -= k * b;
    assert(a > c and a - b <= c);
  }
  if (a < b) {
    cout << "No\n";
    return;
  }
  // make first move
  a -= b;
  assert(a <= c);
  const ll diff = d - b;
  if (diff == 0 or b <= c + 1) {
    cout << "Yes\n";
    return;
  }
  const ll g = __gcd(d, b);
  const ll k = (c - a) / g + 1;
  a += k * g;
  assert(a > c and a - g <= c);
  if (a < b) {
    cout << "No\n";
  } else {
    cout << "Yes\n";
  }
//  VEVE(its, 0, 500000) {
//    {
//      const ll k = (c - a) / diff + 1;
//      a += k * diff;
//    }
//    assert(a > c and a - diff <= c);
//    {
//      const ll k = (a - c + b - 1) / b - 1;
//      a -= k * b;
//      assert(a > c and a - b <= c);
//    }
//    if (a < b) {
//      cout << "No\n";
//      return;
//    }
//    a -= b;
//  }
//  cout << "Yes\n";
}

void Init() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
}
}

int32_t main() {
#ifdef AZN
  freopen("input.txt", "r", stdin);
#endif
  Init();
  ll tests = 1;
  cin >> tests;
  VEVE(test, 1, tests + 1) Solve(test);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    std::string s; cin >> s;
    std::string t; cin >> t;
    map<char, char> mp {};
    map<char, char> mp2 {};

    bool flag = true;
    for(int i = 0; i < s.size(); ++i){
        auto itr = mp.find(s[i]);
        if( itr == mp.end() ) {
            mp[s[i]] = t[i];
        } else {
            if (mp[s[i]] != t[i]) {
                flag = false;
                break;
            }
        }
        auto itr2 = mp2.find(t[i]);
        if( itr2 == mp2.end() ) {
            mp2[t[i]] = s[i];
        } else {
            if (mp2[t[i]] != s[i]) {
                flag = false;
                break;
            }
        }

    }
    if(flag) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 776
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

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

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

#define ENC(x,y,w) ((y)*(w) + (x))
#define DECX(d,w) ((d) % (w))
#define DECY(d,w) ((d) / (w))

int memo[50][50];

int main(){
  int w,h;
  while((w = getInt()) + (h = getInt())){
    int f[h][w];
    int sx,sy,gx,gy;
    int bx,by;
    REP(i,h) REP(j,w){
      f[i][j] = getInt();
      if(f[i][j] == 2){
        bx = j; by = i;
        f[i][j] = 0;
      }else if(f[i][j] == 3){
        gx = j; gy = i;
        f[i][j] = 0;
      }else if(f[i][j] == 4){
        sx = j; sy = i;
        f[i][j] = 0;
      }
    }

    typedef pair<int,pair<int,int> > data;
    priority_queue<data,vector<data>,greater<data> > pq;
    memset(memo,0,sizeof(memo));
    pq.push(mp(0,mp(ENC(sx,sy,w),ENC(bx,by,w))));

    while(pq.size()){
      data d = pq.top();

      int md = d.s.f;
      int bd = d.s.s;
      int cost = d.f;

      int mx = DECX(md,w);
      int my = DECY(md,w);
      int cx = DECX(bd,w);
      int cy = DECY(bd,w);

      //printf("man:(%d,%d) box:(%d,%d) cost:%d\n",mx,my,cx,cy,cost);

      if(cx == gx && cy == gy){
        print(cost);
        break;
      }

      pq.pop();

      if(memo[md][bd]) continue;
      memo[md][bd] = 1;

      REP(i,4){
        int mmx = mx + _dx[i];
        int mmy = my + _dy[i];
        int cc = cost;
        int ccx = cx;
        int ccy = cy;

        if(!ISIN(mmx,mmy,w,h)) continue;
        if(f[mmy][mmx] == 1) continue;

        if(mmx == cx && mmy == cy){
          ccx += _dx[i];
          ccy += _dy[i];
          if(!ISIN(ccx,ccy,w,h)) continue;
          if(f[ccy][ccx] == 1) continue;
          ++cc;
        }

        if(!memo[ENC(mmx,mmy,w)][ENC(ccx,ccy,w)])
          pq.push(mp(cc,mp(ENC(mmx,mmy,w),ENC(ccx,ccy,w))));
      }
    }
    if(pq.empty())
      puts("-1");
  }
  return 0;
}

Measured memory_bytes: 0
#define VERNIY st();int ver=0,niy=0,hbk=0
//#pragma GCC optimize("0fast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <float.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <functional>
typedef unsigned long long LLU;
typedef long long LL;
using namespace std;
#define Lfmax DBL_MAX
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
typedef vector<int> vd;
typedef vector<pair<int,int> > vpd;
typedef pair<int,int> pd;
typedef queue<int> qd;
typedef queue<pair<int,int> > qpd;
typedef priority_queue<int> maxpqd;
typedef priority_queue<int, vector<int>, greater<int> > minpqd;
#define fr front
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; ++a)
#define forineq(a,b,c) for(int a=b ; a<=c ; ++a)
#define forde(a,b,c) for(int a=b ; a>=c ; --a)
#define UPC(oo) (oo>='A' && oo<='Z')
#define LWC(oo) (oo>='a' && oo<='z')
#define DGT(oo) (oo>='0' && oo<='9')
#define UPCVOC(oo) (oo=='A' || oo=='E' || oo=='I' || oo=='U' || oo=='O')
#define LWCVOC(oo) (oo=='a' || oo=='e' || oo=='i' || oo=='u' || oo=='o')
#define filein freopen("in.txt","r",stdin);
#define fileout freopen("out.txt","w",stdout);
#define setarr(a,b,c) memset(a,b,sizeof(c))

template<class Ver>
inline void in(Ver &a){cin>>a;}
template<class Ver>
inline void in(Ver &a, Ver &b){cin>>a>>b;}
template<class Ver>
inline void in(Ver &a, Ver &b, Ver &c){cin>>a>>b>>c;}

template<class Ver>
inline void out(Ver a){cout<<a<<"\n";};
template<class Ver>
inline void out(Ver a,Ver b){cout<<a<<" "<<b<<"\n";};
template<class Ver>
inline void out(Ver a, Ver b, Ver c){cout<<a<<" "<<b<<" "<<c<<"\n";};

inline void debug(){cout<<"asd"<<endl;}
template<class Ver>
inline void debug(Ver a){cout<<"--- "<<a<<endl;};
template<class Ver>
inline void debug(Ver a,Ver b){cout<<"--- "<<a<<" "<<b<<endl;};
template<class Ver>
inline void debug(Ver a,Ver b,Ver c){cout<<"--- "<<a<<" "<<b<<" "<<c<<endl;};

#define grav 9.8
#define pi 3.14159265

void st()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
}


int main()
{
	VERNIY;
	map<string,int> dict;
	in(ver);
	string a,b;
	forin(i,0,ver)
	{
		in(a,b);
		if(a[0]=='i')
		dict[b]=1;
		else
		out(dict[b]?"yes":"no");
	}
	
	return 0;
}



Measured memory_bytes: 48356
<?php
	$N=+fgets(STDIN);
	$M=1e9+7;
	$O=$M-1;
	$p[0]=1;
	for($i=0;$i<$N;$i++)
	{
		$p[$i+1]=$p[$i]*2%$M;
		fscanf(STDIN,"%d%d",$a,$b);
		if($a==0&&$b==0)$O++;
		else
		{
			$ga=$a;$gb=$b;
			while($gb!=0)
			{
				$t=$ga;
				$ga=$gb;
				$gb=$t%$gb;
			}
			$a/=$ga;
			$b/=$ga;
			if($a<0||$a==0&&$b>0)
			{
				$a=-$a;
				$b=-$b;
			}
			$f=0;
			if($b<0)
			{
				$t=$a;
				$a=-$b;
				$b=$t;
				$f=1;
			}
			$A[$a." ".$b][$f]++;
		}
	}
	$s=1;
	foreach($A as $k=>$v)
	{
		$s=$s*($p[+$v[0]]+$p[+$v[1]]-1)%$M;
	}
	echo ($s+$O)%$M,"\n";

Measured memory_bytes: 155524
#include <iostream>
#include <string>
#include <algorithm>
#define rep(i, N) for(int i = 0; i < N; ++i)
using namespace std;

typedef long long ll;

int main()
{
    ll n;
    cin >> n;

    string s;
    cin >> s;
    
    ll countR = 0;    
    ll countG = 0;    
    ll countB = 0;    
    rep(i, n)
    {
        if (s[i] == 'R') countR++;
        if (s[i] == 'G') countG++;
        if (s[i] == 'B') countB++;
    }
    ll total = countR * countG * countB;
    ll cancel = 0;
    for (int i = 0; i < n - 2; i++)
    {
        for (int j = i + 1; j < n -1; j++)
        {
            if(s[i] == s[j]) continue;
            int dist = j - i;

            char remain;
            if ((s[i] == 'R' && s[j] == 'G')
                || (s[i] =='G' && s[j] == 'R'))
            {
                remain = 'B';
            }
            else if ((s[i] == 'R' && s[j] == 'B')
                || (s[i] =='B' && s[j] == 'R'))
            {
                remain = 'G';
            }
            else
            {
                remain = 'R';
            }

            if (s[j+dist] == remain)
            {
                cancel++;
            }
        }
    }
    cout << total - cancel << endl;
    return 0;
}


Measured memory_bytes: 3628
if __name__ == '__main__':
	N, M=map(int, input().split())

	n=[]
	for j in range(N):
		n.append(0)

	for i in range(M):
		a,b=[int(i) for i in input().split()]
		n[a-1]+=1
		n[b-1]+=1

	flag = 0
	for i in range(N):
		if(n[i]%2==1):
			flag +=1

	if(flag<2):
		print('YES')
	else:
		print('NO')

Measured memory_bytes: 3888
import itertools

n = int(input())
a = list(map(int, input().split()))
q = int(input())
m = list(map(int, input().split()))

ans = set()
for i in itertools.product(range(2),repeat=n):
    ans.add(sum(itertools.compress(a,i)))

for i in m:
    if i in ans: print('yes')
    else: print('no')


Measured memory_bytes: 5704
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

#include <bits/stdc++.h>
using namespace std;


int main()
{
	int a, b; cin >> a >> b;

	if ((2 * b) >= a) {
		cout << 0;
		return 0;
	} else {
		cout << (a - (b * 2));
	}



	return 0;

}

Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

template <class T>
inline bool chmax(T& a, T b) {
    return a = (a < b) ? b : a;
}
template <class T>
inline bool chmin(T& a, T b) {
    return a = (a > b) ? b : a;
}

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;

    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    sort(ALL(A), greater<ll>());

    ll l1 = 0;
    ll l2 = 0;
    ll step = 1;
    for (ll i = 0; i < N; i += step) {
        step = 1;
        if (A[i] == A[i + 1]) {
            if (l1 == 0) {
                l1 = A[i];
                step = 2;
            } else if (l1 != 0 && l2 == 0) {
                l2 = A[i];
                step = 2;
            }
        }
    }
    cout << l1 * l2 << endl;

    return 0;
}

Measured memory_bytes: 3976
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root,Max;
void insert(int);
void inorder(Node);
void preorder(Node);
Node treeMaximum(Node);

Node treeMaximum(Node x)
{
  while(x->right != NIL){
    x=x->right;
  }
  return x;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL)
    {
      y = x;
      if(z->key < x->key)
        x = x->left;
      else
        x = x->right;
    }
  z->parent = y;

  if(y == NIL)
    root = z;
  else if(z->key < y->key)
    y->left = z;
  else
    y->right = z;
}

void inorder(Node u){
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if( com[0] == 'i'){
      scanf("%d", &x);
      insert(x);
    }
    else if ( com[0] == 'p' ){
      Max = treeMaximum(root);
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}


Measured memory_bytes: 25176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
  cin >>N;
   vector<int> d(N);
   for (int i = 0; i < N; i++) {
    cin >> d.at(i);
  }
sort(d.begin(), d.end());

  cout<< d[(N/2)]-d[(N/2)-1]<<endl;
}

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

using namespace std;

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		vector<int> s(n);
		for(int i = 0; i < n; ++i){ cin >> s[i]; }
		sort(s.begin(), s.end());
		int sum = 0;
		for(int i = 1; i + 1 < n; ++i){ sum += s[i]; }
		cout << sum / (n - 2) << endl;
	}
	return 0;
}

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

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
          var input = Console.ReadLine().Trim().Split(' ');
          var s = int.Parse(input[0]);
          var w = int.Parse(input[1]);
          if(s <= w)
          {
            Console.WriteLine("unsafe");
          }
          else
          {
            Console.WriteLine("safe");
          }           
        }
    }
}



Measured memory_bytes: 17864
#include <stdio.h>
int main(void) {
    int r, g, b, n;
    int sum, temp1, temp2, temp;
    int ans = 0;
    int i, j, k;
    scanf("%d %d %d %d", &r, &g, &b, &n);
    if (r > g) {
        temp = r;
        r = g;
        g = temp;
    }
    if (r > b) {
        temp = r;
        r = b;
        b = temp;
    }
    if (g > b) {
        temp = g;
        g = b;
        b = temp;
    }

    sum = 0;

    for (; 1; sum += r) {
        if (sum == n) {
            ans++;
            break;
        }
        if (sum > n) {
            break;
        }
        temp1 = sum;
        for (; 1; sum += g) {
            if (sum == n) {
                ans++;
                sum = temp1;
                break;
            }
            if (sum > n) {
                sum = temp1;
                break;
            }
            temp2 = sum;
            if ((n - sum) % b == 0) {
                ans++;
            }
            /*for (; 1; sum += b) {
                if (sum == n) {
                    ans++;
                    sum = temp2;
                    break;
                }
                if (sum > n) {
                    sum = temp2;
                    break;
                }
            }*/
        }
    }
    printf("%d\n", ans);
    return 0;
}


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

int main() {
    int A,B,X;
    cin >> A >> B >> X;
    int Aval=0;
    int Bval=0;
    if((A/2)<B){
        if(X>1000){
            Aval = X/1000;
            if( (X % 1000) > 500){
                Aval++;
            }else if( (B<A) && ( (X%1000)>0) ){
                Bval = 1;
            }
        }else if(X <= 500 && B<A){
            Bval=1;
        }else{
            Aval=1;
        }
        
    }else{
        Bval = X/500;
        if( (X%500)>1){
            Bval++;
        }
    }
    cout<<( (A*Aval)+(B*Bval) )<<endl;
    return 0;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


const int MAX = 1110000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void comb_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long comb(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll mod_pow(ll x, ll n, ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    comb_init();

    cout << comb(n+k-1, n) << endl;
}


Measured memory_bytes: 29204
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<bitset>
#include<random>
#include<cstdint>
#include<math.h>
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
#define shosu setprecision(17)
#define hayai cin.tie(0);ios::sync_with_stdio(false);
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
ll longinf=(1ll<<60);
ll inf=1ll<<29;
ll mod=998244353;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    cin>>h>>w;
    char a[h][w];
    rep0(i,h)rep0(j,w) cin>>a[i][j];
    P now={0,0};
    a[0][0]='.';
    bool ok=true;
    while(1){
      if(now==(P){h-1,w-1}){
        a[h-1][w-1]='.';
        break;
      }
      int hei=now.first;
      int wed=now.second;
      if(hei+1<h&&a[hei+1][wed]=='#'){
        a[hei+1][wed]='.';
        now={hei+1,wed};
      }
      else if(wed+1<w&&a[hei][wed+1]=='#'){
        a[hei][wed+1]='.';
        now={hei,wed+1};
      }
      else{
        ok=false;
        break;
      }
      //cout<<now.first<<" "<<now.second<<endl;
    }
    if(ok){
      rep0(i,h){
        rep0(j,w){
          if(a[i][j]=='#') ok=false;
        }
      }
    }
    if(ok){
      cout<<"Possible"<<endl;
    }
    else{
      cout<<"Impossible"<<endl;
    }

      return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    long long a, b, x;
    std::cin >> a >> b >> x;

    if(0 == a){
        std::cout << b/x + 1 << std::endl;
    }else{
        std::cout << b/x - (a - 1)/x << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cassert>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

Int n, a;
Int cnt[4];
double dp[330][330][330];

int main(){
    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a;
        cnt[a]++;
    }
    for(int i = 0;i <= n;i++){
        for(int j = 0;j <= n;j++){
            for(int k = 0;k <= n;k++){
                int nonzero = i + j + k;
                if(nonzero == 0){
                    dp[i][j][k] = 0;
                    continue;
                }
                dp[i][j][k] = (double) n / nonzero;
                if(i-1 >= 0)dp[i][j][k] += dp[i-1][j+1][k] * i / nonzero;
                if(j-1 >= 0)dp[i][j][k] += dp[i][j-1][k+1] * j / nonzero;
                if(k-1 >= 0)dp[i][j][k] += dp[i][j][k-1] * k / nonzero;
            }
        }
    }
    printf("%.10lf\n", dp[cnt[3]][cnt[2]][cnt[1]]);
    return 0;
}

Measured memory_bytes: 258176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,i,j,count=0;
    cin>>n;
    for(i=0;i<=25;i++){
        for(j=0;j<=15;j++){
            if(n==4*i+7*j)
            count++;
        }
    }
    if(count)
    cout<< "Yes"<<endl;
    else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
// T2020C2.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"

#include <iostream>
#include <vector>
#include <algorithm> // copy
using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	vector<int>a(n + 2);
	vector<int>b(n + 2);
	vector<int>c_sum(n + 2);
	for (int i = 1; i <= n; i++) {
		cin >> a.at(i);
	}
	for(int j=0;j<k;j++) {

		for (int i = 1; i <= n; i++)
		{
			int lp = i - a.at(i);
			if (lp < 0)
			{
				lp = 0;
			}
			b.at(lp) += 1;
			int rp = i + a.at(i) + 1;
			if (rp > n + 1)
			{
				rp = n + 1;
			}
			b.at(rp) -= 1;
		}
		c_sum.at(0) = b.at(0);
		for (int i = 1; i <= n; i++)
		{
			c_sum.at(i) = c_sum.at(i - 1) + b.at(i);
		}
		if (a == c_sum) {
			break;
		}
		else {
			a = c_sum;
			fill(b.begin(), b.end(), 0);
		}
	}
	for (int i = 1; i <=n; i++)
	{
		cout << c_sum.at(i) << " ";
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 5256
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
import java.math.*;

public class Main {

  static int gcd(int a, int b) {
    if (a == 0)
      return b;
    else
      return gcd(b % a, a);
  }

  static boolean next_permutation(int[] p) {
    for (int a = p.length - 2; a >= 0; --a)
      if (p[a] < p[a + 1])
        for (int b = p.length - 1;; --b)
          if (p[b] > p[a]) {
            int t = p[a];
            p[a] = p[b];
            p[b] = t;
            for (++a, b = p.length - 1; a < b; ++a, --b) {
              t = p[a];
              p[a] = p[b];
              p[b] = t;
            }
            return true;
          }
    return false;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n];
    int[] b = new int[n];
    int[] c = new int[n];
    for (int i = 0; i < n; i++)
      a[i] = sc.nextInt();
    for (int i = 0; i < n; i++)
      b[i] = sc.nextInt();
    for (int i = 0; i < n; i++)
      c[i] = i + 1;
    int x = 0, y = 0, cnt = 0;
    do {
      cnt++;
      if (Arrays.equals(a, c))
        x = cnt;
      if (Arrays.equals(b, c))
        y = cnt;
      // for (int i = 0; i < n; i++) {
      // System.out.print(c[i]);
      // System.out.print(' ');
      // }
      // System.out.print('\n');
    } while (next_permutation(c));
    // System.out.println(y);
    // System.out.println(x);
    System.out.println(Math.abs(y - x));
  }
}


Measured memory_bytes: 36532
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  string a;
  cin >> a;
  
  if (a.at(0) == '7' || a.at(1) == '7' || a.at(2) == '7') cout << "Yes" << endl;
  else cout << "No" <<endl;
}

Measured memory_bytes: 3556
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define loop(i,n) for(int i = 0;i < (n);i++)
#define range(i,a,b) for(int i = (a);i <= (b);i++)
#define all(A) A.begin(),A.end()
#define pb push_back
#define mp make_pair
#define sz(A) ((int)A.size())
#define vi vector<int>
#define vl vector<long long>
#define vd vector<double>
#define vp vector<pair<int,int> >
#define ll long long
#define pi pair<int,int>
#define popcnt(x) __builtin_popcountll(x)
#define LSOne(x) ((x) & (-(x)))
#define xx first
#define yy second
#define PQ priority_queue
#define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl
#define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")";
#define prArr(A,n,t)  cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl
#define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0)
#define what_is(x) cerr << #x << " is " << x << endl
#define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1)
const double PI = acos(-1);
using namespace std;

const int MAX = 2000 + 10,MAXF = 2000*2000 + 10;
const int mod = 1e9 + 7;
int fact[MAXF],rev[MAXF];
int dp[MAX][MAX];

inline int add(int a,int b) {
	a += b;
	if(a >= mod) a -= mod;
	return a;
}
inline int mul(int a,int b) {return (a*1LL*b)%mod;}
inline int powmod(int a,int p) {
	if(p <= 0) return 1;
	int b = 1;
	for(;p > 1;p >>= 1) {
		if(p&1) b = mul(a,b);
		a = mul(a,a);
	}
	return mul(a,b);
}

void init(){
	fact[0] = rev[0] = 1;
	for(int i = 1;i < MAXF;i++) {
		fact[i] = mul(fact[i - 1],i);
		rev[i] = powmod(fact[i],mod-2);
	}
}

int C(int n,int k) {
	if(k > n) return 0;
	int ret = fact[n];
	ret = mul(ret,rev[k]);
	ret = mul(ret,rev[n - k]);
	return ret;
}

int main(){
	#ifdef HOME
		freopen("in.in", "r", stdin);
	#endif
	init();
	int N,K;
	cin >> N >> K;
	if(K == 1) {
		cout << 1 << endl;
		return 0;
	}
    for (int r1 = N+1;r1 >= 1;r1--)
        for (int r2 = N+1;r2 >= 1;r2--) {
            if(r1 == N+1 && r2 == N+1) dp[r1][r2] = 1;
            else if(r2 > r1) dp[r1][r2] = 0;
            else {
                int ret = 0;
                if(r1 <= N) ret = dp[r1+1][r2];
                if(r2 < r1) ret = add(ret,mul(dp[r1][r2+1],C(N*K-(r1-1)-(r2-1)*(K-1)-1,K-2)));
                dp[r1][r2] = ret;
            }
        }
    int ans = mul(dp[1][1],fact[N]);
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 47232
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static List<Tuple<long, long>>[] graph;
        static long[] colors;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            graph = Enumerable.Range(0, (int)N).Select(_ => new List<Tuple<long, long>>()).ToArray();
            for (var i = 0L; i < N - 1; ++i)
            {
                var ab = Sarray();
                var a = ab[0] - 1;
                var b = ab[1] - 1;
                graph[a].Add(Tuple.Create(b, i));
                graph[b].Add(Tuple.Create(a, i));
            }
            colors = new long[N - 1];
            dfs(0, 0, -1);
            WriteLine(colors.Max() + 1);
            foreach (var c in colors)
                WriteLine(c + 1);
            Out.Flush();
        }
        static void dfs(long r, long p, long c)
        {
            var clr = 0L;
            foreach (var n in graph[r])
            {
                var nr = n.Item1;
                if (nr == p) continue;
                if (clr == c) clr++;
                colors[n.Item2] = clr;
                dfs(nr, r, clr);
                clr++;
            }
        }
    }
}

Measured memory_bytes: 35884
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++){
            a[i] = sc.nextInt();
        }
        sc.close();

        if(n == 1){
            System.out.println(0);
            return;
        }else if(n == 2){
            if(a[0] > a[1]){
                System.out.println(1);
            }else{
                System.out.println(0);
            }
            return;
        }

        int[] a1, a2;
        if(n % 2 == 0){
            a1 = new int[n/2];
            a2 = new int[n/2];
        }else{
            a1 = new int[n/2+1];
            a2 = new int[n/2];
        }
        for(int i=0; i<a1.length; i++){
            a1[i] = a[i*2];
        }
        for(int i=0; i<a2.length; i++){
            a2[i] = a[i*2+1];
        }

        Arrays.sort(a);
        long ans = 0;
        for(int i=0; i<a1.length; i++){
            int pos = Arrays.binarySearch(a, a1[i]);
            if(pos % 2 == 1) ans++;
        }

        // for(int i=0; i<n; i++){
        //     if(i % 2 == 0){
        //         a[i] = a1[i/2];
        //     }else{
        //         a[i] = a2[i/2];
        //     }
        // }

        // int pos1 = 0;
        // int pos2 = 0;
        // long ans = 0;
        // for(int i=0; i<n; i++){
        //     if(pos1 >= a1.length || pos2 >= a2.length) break;
        //     if(a1[pos1] > a2[pos2]){
        //         ans += (long)Math.max(0, pos2-pos1+1);
        //         pos2++;
        //     }else if(a1[pos1] < a2[pos2]){
        //         ans += (long)Math.max(0, pos1-pos2);
        //         pos1++;
        //     }else{
        //         if(pos1 <= pos2){
        //             pos1++;
        //         }else{
        //             pos2++;
        //         }
        //     }
        // }

        System.out.println(ans);
    }
}

Measured memory_bytes: 51828
open System

// prelude
let readStr () = stdin.ReadLine()

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let X = read int ()
let pow5 x = x*x*x*x*x

seq {
  for a in 0..1000 do
    for b in -1000..1000 do
      if (pow5 a)-(pow5 b)=X then     
        yield (a,b)
}
|> Seq.head
|> fun (a,b) -> printfn "%d %d" a b

Measured memory_bytes: 30172
N,T = map(int, input().split())

min_cost = float('inf')
for i in range(N):
    c,t = map(int, input().split())
    if (t <= T) and (c < min_cost):
        min_cost = c

if min_cost == float('inf'):
    print('TLE')
else:
    print(min_cost)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
  ll n,i,j,a,b,c,ans = 0;
  cin>>n;
  for(a = 1;a<n;a++)
  {
    ans += (n-1)/a;
  }
  cout<<ans;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

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

    int ans = B + C - A;
    if (ans < 0)
    {
        ans = 0;
    }

    cout << ans << endl;
}


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

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

  int num_group = 1;
  while(N > K + (K - 1)*(num_group - 1)) {
	  num_group++;
  }

  printf("%d", num_group);
  return 0;
}


Measured memory_bytes: 384
# B - Popular Vote
# https://atcoder.jp/contests/abc161/tasks/abc161_bß

# N 商品の種類数
# M 選択したい商品数
# votes 各商品ごとの投票数
N,M = list(map(int,input().split()))
votes = list(map(int,input().split()))

# 総投票数
total_vote = 0

# 総投票数算出
for vote in votes:
    total_vote += vote

# 購入できる商品数
i = 0

for vote in votes:
    # 得票数が総投票数の 1/4M 以上であれば商品を選択
    if vote >= total_vote*(1/(4*M)):
        i += 1

# 商品をM個購入できる場合
if i >= M:
    print("Yes")
else:
    print("No")

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

void solve () {
	int x, y;
	cin >> x >> y;

	if (y < x || y & 1) {
		cout << "No" << endl;
		return;
	}

	for (int i = 0; i * 4 <= y; i++) {
		if ((i * 4) + (x - i) * 2 == y) {
			cout << "Yes" << endl;
			return;
		}
	}
	cout << "No" << endl;
}

int main () {
	/*int t;
	cin >> t;
	while (t--) {
		solve();
	}*/
	
	solve();

	return 0;
}


Measured memory_bytes: 3544
import sys
group = [[1, 3, 5, 7, 8, 10, 12],[4, 6, 9, 11],[2]]
x, y = list(map(int, input().split()))
for g in group:
    if (x in g) and (y in g):
        print("Yes")
        sys.exit()
print("No")

Measured memory_bytes: 3060
package main

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

var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

type pair struct {
	first  int
	second int
}

func f(x int) pair {
	a := x % 10
	b := 0
	for x != 0 {
		b = x
		x /= 10
	}
	return pair{a, b}
}

func main() {
	nextReader = newScanner()
	N := nextInt()
	var freq = make(map[pair]int)
	for i := 1; i <= N; i++ {
		p := f(i)
		freq[p]++
	}
	var cnt int
	for i := 1; i <= N; i++ {
		p := f(i)
		q := pair{p.second, p.first}
		cnt += freq[q]
	}
	fmt.Println(cnt)
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i,a,b) for(LL i=(a);i<(LL)(b);i++)
#define REP(i,b) FOR(i,0,b)
#define ALL(c) c.begin(),c.end()
#define PB push_back
#define FF first
#define SS second
#define cat //cout << __LINE__ << endl;
using namespace std;
typedef long long LL;
typedef double ld;
typedef LL ut;
typedef vector<ut> VI;
typedef pair<ut,ut> pr;
typedef pair<ut,pr> ppr;
typedef vector<pr> Vpr;
typedef priority_queue<pr,Vpr> PQ;
const ut INF=1LL<<60;
const LL p=3+1e6;
const int SIZE=2005;
LL price[SIZE];
LL pprice[SIZE];
int main(){
	LL N,x;
	cin >> N >> x;
	REP(i,N){
		cin >> price[i];
	}
	LL minium=INF;
	REP(i,N){
		LL ans=0;
		REP(j,N)
			ans+=price[j];
		REP(j,N){
			pprice[(j+1)%N]=min(price[(j+1)%N],price[j]);			
		}
		REP(j,N){
			price[j]=pprice[j];
		}
		minium=min(minium,ans+x*(LL)i);
	}
	cout << minium << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

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

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 100005;

struct Line
{
	long double k, b;
	bool operator < (const Line &b) const { return k < b.k; }
} l[MAXN];

int n, A[MAXN], B[MAXN], C[MAXN];
long double d[MAXN], e[MAXN];
LL lim, ans;

inline void Solve(int l, int r)
{
	if (l == r)
		return ;
	int mid = l + r >> 1, ql = l, qr = mid + 1, cur = l;
	Solve(l, mid), Solve(mid + 1, r);
	while (ql <= mid && qr <= r)
		if (d[ql] < d[qr])
			e[cur ++] = d[ql ++], ans += r - qr + 1;
		else
			e[cur ++] = d[qr ++];
	while (ql <= mid)
		e[cur ++] = d[ql ++];
	while (qr <= r)
		e[cur ++] = d[qr ++];
	for (int i = l; i <= r; i ++)
		d[i] = e[i];
}

inline bool Chk(long double x)
{
	for (int i = 1; i <= n; i ++)
		d[i] = l[i].k * x + l[i].b;
	ans = 0;
	Solve(1, n);
	return ans >= lim;
}

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), lim = (1LL * n * (n - 1) >> 1) + 1 >> 1;
	for (int i = 1; i <= n; i ++)
	{
		A[i] = Read(), B[i] = Read(), C[i] = Read();
		l[i].k = -(long double)A[i] / B[i];
		l[i].b = (long double)C[i] / B[i];
	}
	sort(l + 1, l + n + 1);
	long double L = -1e9, R = 1e9;
	for (int i = 1; i <= 120; i ++)
	{
		long double mid = (L + R) / 2;
		if (Chk(mid))
			R = mid;
		else
			L = mid;
	}
	printf("%.10Lf ", L);
	for (int i = 1; i <= n; i ++)
	{
		swap(A[i], B[i]);
		l[i].k = -(long double)A[i] / B[i];
		l[i].b = (long double)C[i] / B[i];
	}
	sort(l + 1, l + n + 1);
	L = -1e9, R = 1e9;
	for (int i = 1; i <= 120; i ++)
	{
		long double mid = (L + R) / 2;
		if (Chk(mid))
			R = mid;
		else
			L = mid;
	}
	printf("%.10Lf\n", L);
	return 0;
}


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

int gcd(int a, int b, int cnt);

int main()
{
	int a, b;

	while (cin >> a >> b, a){
		int cnt = 0;
		gcd(max(a, b), min(a, b), cnt);
	}

	return (0);
}

int gcd(int a, int b, int cnt)
{
	if (b == 0){
		cout << a << " " << cnt << endl;
	}
	else {
		return (gcd(b, a % b, cnt + 1));
	}
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stack>

using namespace std;

int main(){
  stack<int> stk;

  int n;
  while(scanf("%d", &n)!=EOF){
    if(n==0){
      printf("%d\n", stk.top());
      stk.pop();
    }else{
      stk.push(n);
    }
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define int64 long long
#define uint64 unsigned long long
using namespace std;

int main()
{
	int64 nn, tmp;;
	cin >> nn;
	vector<int64> ans(nn + 1, 0);
	for(int64 ii = 1;ii < sqrt(nn) + 1;ii++)
	{
		for(int64 jj = ii;jj < sqrt(nn) + 1;jj++)
		{
			for(int64 kk = jj;kk < sqrt(nn) + 1;kk++)
			{
				tmp = ii * ii + jj * jj + kk * kk + ii * jj + jj * kk + kk * ii;
				if(tmp <= nn)
				{
					if(ii == jj && jj == kk)
					{
						ans[tmp]++;
					}
					else if(ii != jj && jj != kk && kk != ii)
					{
						ans[tmp] += 6;
					}
					else
					{
						ans[tmp] += 3;
					}
				}
				else
				{
					break;
				}
			}
		}
	}
	for(int64 ii = 1;ii <= nn;ii++)
	{
		cout << ans[ii] << ' ';
	}
	cout << endl;
	return 0;
}

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

int main() {

	long long n,i,j,k,sum=0,count=0,ans=0,x,b,c,d,mx=0,mn=1000000;
	cin>>n>>k;
    ans=(n)*(k-1)+(n*(n+1))/2;
    for(i=1;i<=n;i++)
    {
        if(mn>(abs(k-1+i)))
       { j=i; mn=abs(k-1+i);}
    }
    cout<<ans-(k-1+j);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin>>n;
  	int* h = new int[n];
  	for(int i=0; i<n; i++)
      	cin>>h[i];
  	int* dp = new int[n];
  	dp[0] = 0;
  	dp[1] = abs(h[1] - h[0]);
  	for(int i=2; i<n; i++){
      dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024