akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

const int INF = INT_MAX / 2;

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

    int ans = INF;

    // buy only A and B pizza
    chmin(ans, A * X + B * Y);

    // buy only C pizza
    chmin(ans, max(X, Y) * 2 * C);

    // buy A, B, and C pizza
    if (X < Y) {
        int acc = 2 * C * X;
        acc += (Y - X) * B;
        chmin(ans, acc);
    } else {
        int acc = 2 * C * Y;
        acc += (X - Y) * A;
        chmin(ans, acc);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3524
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0;i<(ll)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;
ll dp[200200]={};
int main(){
    fast_io
    
    ll n;
    cin>>n;
    ll ans=100100100100100, tmp;
    for(ll i = 1;i<=sqrt(n);i++){
        if(n%i==0){
            tmp=i+(n/i)-2;
        }
        ans=min(ans, tmp);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
/*  ex9_1
    suuxxu  */

#include <stdio.h>
#include <stdlib.h>
#define SIZE 10

typedef struct { // 文字列を格納するスタック
    int size; // 最大データ数
    int count; // 現在のデータ数
    char data[SIZE]; // データ配列
    char *top; // topへのポインタ
} stack;

void initialize_stack(stack *stk); // スタックの初期化
void print_stack(stack *stk); // スタックの中身を古い順に出力
void push(stack *stk, char chr); // スタックのpush操作
char pop(stack *stk); // スタックのpop操作

int main(void){
    int i;
    char input[10], tmp;

    stack stk;

    initialize_stack(&stk); // スタックを初期化
    
    scanf("%s", input); // 入力をinputに格納

    for(i = 0; i < strlen(input); i++){
        if(input[i] == 'B'){ // バックスペースなら
            tmp = pop(&stk); // popで1番新しい要素を削除
        }else{
            push(&stk, input[i]); // それ以外の文字ならpushで要素を追加
        }
    }

    print_stack(&stk); // 結果を出力

    return 0;
}

void initialize_stack(stack *stk){ // スタックの初期化
    stk->count = 0; // 現在のデータ数を0に
    stk->size = SIZE; // 最大データ数をSIZEに
    stk->top = &(stk->data[SIZE]); // topを配列の最終要素の1つ手前に
}

void push(stack *stk, char chr){ // スタックのpush操作
    if(stk->count >= stk->size){
        printf("Error: stack overflow. (x=%c)\n", chr); // 容量がオーバーフローする
        exit(1);
    }else{
        stk->top--; // topを1つ手前に移動
        *(stk->top) = chr; // topにデータを格納
        stk->count++; // データ数を1つ増やす
    }
}

char pop(stack *stk){ // スタックのpop操作
    char chr;
    if(stk->count > 0){
        chr = *(stk->top); // topの位置のデータを取り出す
        stk->top++; // topを1つ後ろに移動
        stk->count--; // データ数を1つ減らす
        return chr;
    }
}

void print_stack(stack *stk){ // スタックの中身を古い順に出力
    int i, len;
    char output[10];

    len = stk->count; // 出力の長さを記録

    for(i = 1; i <= len; i++){
        output[len - i] = pop(stk); // スタックからpopしたデータを後ろからoutputに記録
    }

    for(i = 0; i < len; i++){
        printf("%c", output[i]); // outputを出力
    }

    printf("\n");
}


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

int main(){
  int n,m,ans=1;cin>>n>>m;
  for(int i=2;i*i<=m;i++) if(!(m%i)){
    if(m/n>=i) ans=max(ans,i);
    if(m/n>=m/i) ans=max(ans,m/i);
  }
  if(n==1) ans=m;
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <cctype>
#include <ctime>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <tuple>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <functional>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#ifndef M_PI
#define M_PI 3.141592653589793238462643383279
#endif

#define int long long

#define mp make_pair
#define mt make_tuple
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>

#define debug(x) cerr << #x << " = " << x << ", line = " << __LINE__ << endl

typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef tuple<long long, long long, long long> tlll;
typedef tuple<int, int, int> tiii;
typedef tuple<int, int, int, int> tiiii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int MOD = 1e9 + 7;



int32_t main()
{
#ifdef chikibambony
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int j = 0; j < n; ++j) {
        cin >> b[j];
    }
    reverse(all(b));
    int c = -1;
    for (int i = 0; i < n; ++i) {
        if (a[i] == b[i]) {
            c = a[i];
            break;
        }
    }
    int l = 0;
    for (int i = 0; i < n; ++i) {
        if (a[i] == c && b[i] == c) {
            l = i;
            break;
        }
    }
    int r = -1;
    for (int i = n - 1; i >= 0; --i) {
        if (a[i] == c && b[i] == c) {
            r = i;
            break;
        }
    }

    for (int i = 0; i < n; ++i) {
        if (a[i] != c && b[i] != c && l <= r) {
            swap(b[i], b[l]);
            ++l;
        }
    }

    if (l <= r) {
        cout << "No\n";
        return 0;
    }

    cout << "Yes\n";

    for (int i = 0; i < n; ++i) {
        cout << b[i] << ' ';
        assert(b[i] != a[i]);
    }
    cout << "\n";

    return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define PI 3.14159265358979323846
ll A,B,X;
ll i, j, k;
double ans;

int main(){
    scanf("%lld%lld%lld",&A,&B,&X);
    if(X<=A*A*B/2){
        ans = 4 * X * X;
        ans /= ((double)B * B * B * B * A * A + 4.0 * X * X);
        printf("%.12lf", acos(sqrt(ans))*180/PI);
    }else{
        X = A * A * B - X;
        ans = 4 * X * X;
        ans /= ((double)A * A * A * A * A * A + 4.0 * X * X);
        printf("%.12lf", 90-acos(sqrt(ans))*180/PI);
    }
    

    return 0;
}

Measured memory_bytes: 256
def BellmanFord(edges,num_v,source):
  inf=float("inf")
  dist=[inf for i in range(num_v)]
  dist[source-1]=0
  for i in range(num_v):
    for edge in edges:
      if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
        dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
        if i==num_v-1: dist[edge[1]-1] = -inf
  for i in range(num_v):
    for edge in edges:
      if edge[0] != inf and dist[edge[1]-1] > dist[edge[0]-1] + edge[2]:
        dist[edge[1]-1] = dist[edge[0]-1] + edge[2]
  r = dist[-1]
  if r > 0: r = 0
  if r < 0: r=-r
  if r == inf: r=-1
  return r

import sys
input = sys.stdin.readline
N, M, P = map(int, input().split())
edges = []
for i in range(M):
    A, B, C = map(int, input().split())
    edges.append([A, B, P-C])
print(BellmanFord(edges, N, 1))


Measured memory_bytes: 43868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i, a, b) for(int i = (a); i<(b); ++i)
#define rep(i, n) for (int i=0; i<(n); ++i)
#define out(x) cout << x << endl

int main() {
    string S;
    int len, count;
    cin >> S;
    len = (int)(S.length());
    count = 0;
    rep(i, len/2) {
        if(S.at(i) != S.at(len-i-1)) count++;
    }
    out(count);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin>>N;
    int a[N];
    for(int j=0;j<N;j++){
        cin>>a[j];
    }
    int tmp;
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(a[i]<a[j]){
                tmp=a[i];
                a[i]=a[j];
                a[j]=tmp;
            }
        }
    }
    int ans=0;
    for(int i=0;i<N;i++){
        if(i%2==0){
            ans=ans+a[i];
        }else{
            ans=ans-a[i];
        }
    }
    cout<<ans<<endl;
}


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = LLONG_MAX;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(16);

	//cout << setprecision(10) << scientific << ans << endl;
}

signed main() {
	ll n, h;

	cin >> n;

	ll prev = -1;
	ll ans = 0;

	REP(i, n) {
		cin >> h;

		if (h >= prev) {
			ans++;
		}

		prev = max(prev, h);
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
// #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define N 1000000007
#define N2 998244353
#define Nmax 1005
#define INF (ll)1e18
#define pll pair<ll,ll>
#define mp make_pair
#define fi first
#define se second
#define vv vector
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(ll i=m;i<(n);i++)
#define repr(i,n) repr2(i,n,0)
#define repr2(i,m,n) for(ll i=m;i>=(n);i--)
#define get(n) ll (n); scanf("%lld",&(n));
#define get2(n,k) ll (n),(k); scanf("%lld%lld",&(n),&(k));
#define get3(n,m,k) ll (n),(m),(k); scanf("%lld%lld%lld",&(n),&(m),&(k));
#define gets(s) string (s); cin >> (s);
#define ALL(c) (c).begin(),(c).end()
#define fill_nums(A,n) vector<ll> A((n)); for(ll i=0;i<n;i++) scanf("%lld",&A[i]);
#define fill_edges(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1); adj[b-1].pb(a-1);}
#define fill_direct(adj,m) for(ll i=0;i<m;i++) {ll a, b; scanf("%lld %lld",&a,&b); adj[a-1].pb(b-1);}
#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); //cout.tie(0);
#define pi 3.1415926535897
#define db double
#define noop
#define flu fflush(stdout)
#define imp {cout<<"impossible\n"; return ;}
#define debug_vec(vec,n) {rep(idxi,n) cout<<vec[idxi]<<" "; cout<<endl;}

int main() {

    gets(s);
    gets(t);
    cout<<t<<s<<endl;
    return 0;  
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int N;
  cin>>N;
  int A[N];
  for(int i=0;i<N;i++)cin>>A[i];
  bool app=true;
  for(int i=0;i<N;i++){
    if(A[i]%2==0){
      if(A[i]%3==0||A[i]%5==0){
        
      }else{
        cout<<"DENIED";
        app=false;
        break;
      }
    }
  }
  if(app)cout<<"APPROVED";
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(Array) sort(Array.begin(), Array.end())
#define Reverse(a) reverse(a.begin(), a.end())
#define out(ans) cout << ans << endl;
const int MOD = 1000000007;
const int INF = 2147483647;
const ld PI = 3.14159265358979323846;

//------------↓------------- M -------------- E ---------------- M --------------- O ---------------↓--------------//
// コンパイル 
// g++ -std=c++1z
//
// -------型変換--------
// int を string に変換
// string s = to_string(n);
// string を int に変換
// int n = stoi(s);
//
// -------二分探索---------
// k以上の値が最初に現れる時のイテレータ
// lower_bound(data.begin(), data.end(), k)
// kより大きい値が最初の現れる時のイテレータ O(logN)
// upper_bound(data.begin(), data.end(), k)
// kがdataに存在するかをtrue or falseで返す O(logN)
// binary_search(data.begin(), data.end(), k)
// 
//
//
//
//
//
// 
//------------↑------------- M -------------- E ---------------- M --------------- O ---------------↑--------------//


ll modadd(long long a, long long b){return (a%MOD+b%MOD+MOD)%MOD;}
ll modmul(long long a, long long b){return a%MOD*b%MOD%MOD;}
ll modexp(long long a, long long n){if (a==0) return 0; if(n==0)return 1; if(n%2==0){ll e=modexp(a,n/2); return modmul(e,e);} return modexp(a,n-1)*a%MOD;}
ll modinv(long long n){return modexp(n%MOD,MOD-2);}
ll modfact(long long n){long long res=1; for (int i=1; i <= n; ++i){res *= i; res %= MOD;} return res;}
ll modncr(long long n, long long r){long long numer=1;long long denom=1;for(int i=1;i<=r;++i){numer=modmul(numer,n-r+i);denom=modmul(denom,i);}return modmul(numer, modinv(denom));}



int main() {

    int S; cin >> S;
    int N = S/3;
    ll ans = 0;
    for (int n = 1; n <= N; ++n) {
        ll a, b, c;
        a = modfact(S-2*n-1);
        b = modfact(S-3*n);
        c = modfact(n-1);
        ll tmp = modmul(a, modinv(modmul(b,c)));
        ans += tmp;
        ans %= MOD;
    }

    out(ans);


    return 0;
}





Measured memory_bytes: 3584
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,i,j,k,n,m,x,y,ans = 0;
	double  A,B,C;
	cin >> x;
	a = 100;
	while(1) {
		ans ++;
		b = a/100;
		if (a+b >= x) break;
		a += b;

	}
	cout << ans << endl;

}


Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <map>
using namespace std;

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

int aa[3][9];

bool rec(int n) {
  if (n==3) return 1;
  REP(i,3) {
    REP(j,9) {
      if (aa[i][j]>=3) {
        aa[i][j] -= 3;
        if (rec(n+1)) return 1;
        aa[i][j] += 3;
      }
    }
  }
  REP(i,3) {
    REP(j,7) {
      if (aa[i][j]>=1 && aa[i][j+1]>=1 && aa[i][j+2]>=1) {
        aa[i][j]--;aa[i][j+1]--;aa[i][j+2]--;
        if (rec(n+1)) return 1;
        aa[i][j]++;aa[i][j+1]++;aa[i][j+2]++;
      }
    }
  }
  return 0;
}

int main() {
  int n;
  cin >> n;
  
  while(n--) {
    int a[9];
    char b[9];
    REP(i,9)
      cin >> a[i];
    REP(i,9)
      cin >> b[i];

    memset(aa,0,sizeof(aa));
    REP(i,9) {
      int hoge;
      if (b[i]=='R') hoge = 0;
      else if (b[i]=='G') hoge =1;
      else hoge = 2;
      aa[hoge][a[i]-1]++;
    }
    if (rec(0))
      cout << 1 << endl;
    else cout << 0 << endl;
  }
}

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

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
    }
    int m;
    cin >> m;
    vector<int> b(m);
    for(int i = 0; i < m; ++i){
        cin >> b[i];
    }
    
    cout << includes(a.begin(), a.end(), b.begin(), b.end()) << endl;

    return 0;
}


Measured memory_bytes: 4424
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
    int x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << x2+y1-y2 << " " << y2+x2-x1 << " " << x1+y1-y2 << " " << y1+x2-x1 << endl;
}


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

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

    char s[100];
    scanf("%s",s);

    if(strlen(s) <= k)printf("%s\n",s);
    else{
        for(int i = 0;i<k;i++)printf("%c",s[i]);
        printf("...\n");
    }
    
    return 0;
}

Measured memory_bytes: 1656
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <algorithm>

int main() {
  int N;
  std::cin >> N;
  std::vector<int> cnt(100001, 0);
  for (int i = 0; i < N; ++i) {
    int a;
    std::cin >> a;
    ++cnt[a];
  }
  int ans = 0;
  for (int i = 1; i < 100000; ++i) {
    ans = std::max(ans, cnt[i - 1] + cnt[i] + cnt[i + 1]);
  }
  std::cout << ans << std::endl;
  return 0;
}

Measured memory_bytes: 640
#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);
  }
  
  int ans = 0;
  
  for (int i=0; i<n; i++){
    for (int j=i; j<n; j++){
      if (i != j){
        ans += d.at(i) * d.at(j);
      }
    }
  }
  
  cout <<ans <<endl;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

signed main() {
  int A,B,C;
  cin >> A >> B >> C;
  bool ok = true;
  if (A == B && B == C && C == A) {
    ok = false;
  }
  if (A != B && B != C && C!= A) {
    ok = false;
  }

  cout << (ok?"Yes":"No") << endl;
}

Measured memory_bytes: 256
import math
import numpy as np

if __name__ == "__main__":
  _h, _n = map(int, input().split())
  a_list = [int(x) for x in input().split()]

  a_list = np.array(a_list)
  s = np.sum(a_list)
  if _h > s:
    print("No")
  else:
    print("Yes")


Measured memory_bytes: 22928
#include <iostream>
using namespace std;
int main(void){
    int t, n, s, f, x;
    while(true){
        x = 0;
        cin >> t >> n;
        if(t == 0){
            break;
        }
        for(int i = 0; i < n; i++){
            cin >> s >> f;
            x += f-s;
        }
        if(x >= t){
            cout << "OK" << endl;
        }
        else{
            cout << t-x << endl;
        }
    }
}


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

int main(){
  
  int a,b,c;
  cin>>a>>b>>c;
  
  if(a==b&&b==c&&c==a||a!=b&&b!=c&&c!=a){
    cout<<"No";
  }
  else{
    cout<<"Yes";
  }

}

Measured memory_bytes: 256
/*
    Author : zzugzx
    Lang : C++
    Blog : blog.csdn.net/qq_43756519
*/
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define SZ(x) (int)x.size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int mod = 1e9+7;
//const int mod = 998244353;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int maxn = 1e6+10;
const ll inf = 0x3f3f3f3f;
const int dir[][2]={{0, 1}, {1, 0}, {0, -1}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};


int a[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//  freopen("in.txt", "r", stdin);
//  freopen("out.txt", "w", stdout);
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    sort(a + 1, a + 1 + n);
    reverse(a + 1, a + 1 + n);
    ll ans = a[1], d = 1, sum = n - 2, i = 1;
    while (1) {
        if (sum > 1ll << d)
        ans += min(a[i], a[i + 1]) * (1ll << d);
        else {
            ans += min(a[i], a[i + 1]) * sum;
            break;
        }
        sum -= 1ll << d;
        i++;
    }
    cout << ans;
    return 0;
}


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

int check(int i){
    if (i / 10 == 3 || i % 10 == 3)
        return 1;
    else if (i < 10)
        return 0;
    return (check(i /10));
}

int main(void){
    int n;
    cin >> n;
    for (int i = 1; i < n + 1; i++){
        if(i % 3 == 0)
            cout << " " << i;
        else if(check(i))
            cout << " " << i;
    }
    cout << endl;
}



Measured memory_bytes: 3092
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;
//ここから

void solve(){
  int n;
  cin>>n;
  vector<int>b(n-1);
  rep(i,n-1)cin>>b[i];
  int sum=0;
  sum+=b[0];
  b.pb(b.back());
  rep(i,n-1){
    sum+=min(b[i],b[i+1]);
  }
  cout<<sum;
}

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


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

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<int> a(N);

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

    int button = 0;
    int current = 1;
    bool reached = false;

    for(int i = 0; i < N; i++){
        current = a[current-1];
        button++;
        if(current == 2){
            reached = true;
            break;
        }
    }

    if(reached){
        cout << button << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3764
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

         Scanner sc = new Scanner(System.in);
         int val1;
         int val2;

         val1 = sc.nextInt();
         val2 = sc.nextInt();

         if(val1 == val2) {
             System.out.println("Yes");
         }
         else {
             System.out.println("No");
         }
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int n, a[1000000], ans = 0, cnt = 1;
int main () {
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for(int i = 0; i < n; i++) {
		if(a[i] == cnt) {
			cnt++;
			ans++;
		}
	}
	if(ans > 0) {
		cout << n - cnt + 1;
	}
	else {
		cout << -1;
	}
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
ll MOD = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin >> N;
  ll dp[N + 1][4][4][4];
  for(int n = 0; n < N + 1; n++) {
    REP(i, 4) REP(j, 4) REP(k, 4) { dp[n][i][j][k] = 0; }
  }

  REP(i, 4) REP(j, 4) REP(k, 4) {
    if(i == 0 && j == 2 && k == 1) {
      dp[3][i][j][k] = 0;
      continue;
    }
    if(i == 2 && j == 0 && k == 1) {
      dp[3][i][j][k] = 0;
      continue;
    }
    if(i == 0 && j == 1 && k == 2) {
      dp[3][i][j][k] = 0;
      continue;
    }
    dp[3][i][j][k] = 1;
  }
  ll ans = 0;
  for(ll n = 3; n < N; n++) {
    REP(i, 4) REP(j, 4) REP(k, 4) REP(l, 4) {
      if(j == 0 && k == 2 && l == 1) continue;
      if(i == 0 && k == 2 && l == 1) continue;
      if(i == 0 && j == 2 && l == 1) continue;
      if(j == 2 && k == 0 && l == 1) continue;
      if(j == 0 && k == 1 && l == 2) continue;
      dp[n + 1][j][k][l] = (dp[n + 1][j][k][l] + dp[n][i][j][k]) % MOD;
    }
  }
  REP(i, 4) REP(j, 4) REP(k, 4) { ans = (ans + dp[N][i][j][k]) % MOD; }
  cout << ans << endl;
  return 0;
}

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

int main() {
    double  n ;
    cin >> n;
    int k = int(sqrt(n)) ;
    ll nn = n;
    ll ans = n - 1;
    for(int i = 2; i <= k ; i++ ){
        ll yok = INF ;
        ll tate = INF ;
        if(nn % i == 0){
            yok = i ;
            tate = nn / i ;
        }
        if((yok + tate - 2) < ans){
            ans = yok + tate - 2 ;
        }
    }
    cout << ans << endl ;
}

Measured memory_bytes: 3776
#include<stdio.h>
#define n 100005
int main()
{
	int H,N,i,b=0;
	int A[n]={0};
	scanf("%d%d",&H,&N);
	for(i=0;i<N;i++)
	scanf("%d",&A[i]);
	for(i=0;i<N;i++)
	b+=A[i];
	if(b>=H)
	printf("Yes");
	else
	printf("No");
	return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush =
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			while(true) {
				var n = cin.ReadInt;
				if(n == 0) break;
				var A = cin.ReadIntArray(n);
				var k = cin.ReadInt;
				var start = 0;
				var last = n-1;
				var count = 0;
				while(start <= last) {
					count++;
					var mid = (start + last) / 2;
					switch(k.CompareTo(A[mid])) {
						case 1:
							start = mid + 1; break;
						case -1:
							last = mid - 1; break;
						default:
							goto OutPut;
					}
				}
				OutPut:
				Console.WriteLine(count);
			}
		}
	}
	static class ExtendClass {
		public static void Swap<T>(this T[] A, int x, int y) {
			var tmp = A[x];
			A[x] = A[y];
			A[y] = tmp;
		}
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);
		//http://baba-s.hatenablog.com/entry/2017/12/21/104600
		public static IEnumerable<IEnumerable<T>> Chunks<T>(this IEnumerable<T> self, int size) {
			while(self.Any()) {
				yield return self.Take(size);
				self = self.Skip(size);
			}
		}
	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek() == -1; }
		}
	}

}



Measured memory_bytes: 16160
n = gets.to_i
a = gets.split.map(&:to_i)
a.sort!
count = 0
loop do
  a.sort!
  break if a[-1] < n
  if a[0]>=n
    xxx = [a[0] - (n - 1), 0].max
    a.map!{|x| x - xxx}
    count += xxx * n
    next
  end
  modify = false
  (1...n).each{|q|
    q_fst = a[-q]
    q_snd = a[-q-1]
    q_nr = n + 1
    q_dct = (q_fst - q_snd) / q_nr
    modify = true if q_dct != 0
    count += q_dct * q
    a.map!{|x| x + q_dct * q}
    (1..q).each{|r| a[-r] -= q_dct * q_nr}
  }
  if not modify
    fst = a[-1]
    snd = a[-2]
    nr = n + 1
    dct = [(fst - snd) / nr, 1].max
    count += dct
    a.map!{|x| x + dct}
    a[-1] -= dct * nr
  end
end

puts count

Measured memory_bytes: 1788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main()
{
  ll A[3];
  cin >> A[0] >> A[1] >> A[2];
  if (A[0] % 2 == 0 || A[1] % 2 == 0 || A[2] % 2 == 0)
  {
    cout << 0 << endl;
  }
  else
  {
    cout << min(A[1] * A[2], min(A[2] * A[0], A[0] * A[1])) << endl;
  }
  return 0;
}

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

int main()
{
  long long H,W;
  int n;
  scanf("%lld%lld%d",&H,&W,&n);
  static pair<long long,long long> P[100000];
  for(int i=0;i<n;i++){
    scanf("%lld%lld",&(P[i].first),&(P[i].second));
  }
  static pair<long long,long long> Q[1000000];
  int N=0;
  for(int i=0;i<n;i++){
    for(int x=0;x<=2;x++){
      for(int y=0;y<=2;y++){
	if(1<=P[i].first-x&&P[i].first-x<=H-2&&1<=P[i].second-y&&P[i].second-y<=W-2){
	  Q[N]=make_pair(P[i].first-x,P[i].second-y);
	  N++;
	}
      }
    }
  }
  sort(P,P+n);
  sort(Q,Q+N);
  int ans[10]={0};
  for(int t=0;t<N;t++){
    if(t>0&&Q[t-1]==Q[t]){
      continue;
    }
    int c=0;
    for(int x=0;x<=2;x++){
      for(int y=0;y<=2;y++){
	pair<long long,long long> p=make_pair(Q[t].first+x,Q[t].second+y);
	int k=lower_bound(P,P+n,p)-P;
	if(k<n&&P[k]==p){
	  c++;
	}
      }
    }
    ans[c]++;
  }
  long long A=(H-2)*(W-2);
  for(int c=1;c<=9;c++){
    A-=ans[c];
  }
  printf("%lld\n",A);
  for(int c=1;c<=9;c++){
    printf("%d\n",ans[c]);
  }
  return 0;
}


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

int main() {
    int n, m, x, temp, l = 0, r = 0;
    cin >> n >> m >> x;
    vector<int> cost(n + 1, 0);
    rep(i, m) {
        cin >> temp;
        cost.at(temp)++;
    }
    rep(i, x) l += cost.at(i);
    rep(i, n - x) r += cost.at(n - i);
    cout << min(l, r) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define Mod 998244353
#define pi 3.14159265358979323846
#define endl '\n'
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<char> vc;

int main()
{
    IO
    int a;
    cin>>a;
    int b=a+a*a+a*a*a;
    cout<<b<<endl;
    return 0;
}


Measured memory_bytes: 3648
import java.math.*;
import java.util.*;

	public class Main {

		public static void main(String[] args) {

			Scanner sc = new Scanner(System.in);
			int a = sc.nextInt();
			int b = sc.nextInt();
			String ab ="" ;
			String ba ="" ;
			
			for(int i=0;i<b;i++) {
				ab +=a;
			}
			
			for(int i=0;i<a;i++) {
				ba +=b;
			}
			
			if(ab.compareTo(ba)>=0) {
				System.out.println(ba);
			}
			else {
				System.out.println(ab);
			}
			
		}

	}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
///ENDL na deyay WA SILO AGE
using namespace std;

/*****************MACRO*****/

#define ll long long
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;

/*******CONSTANT***********/
#define INF (1<<30) //infinity value
#define EPS 1e-9
#define MOD 10000007
#define SIZ 1005
#define PI (acos(-1))


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

    int m, n;
    cin>>n>>m;
    if(m==n) cout<<"Yes";
    else cout<<"No";
    ///WHY NEXT LINE IS WRONG ?
    ///cout<<(m==n)?"Yes":"No";
    cout<<"\n";



    return 0;
}

/**********************************************************************************







*************************************************************************************/


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

int main() {
    int n, t, a;
    cin >> n >> t >> a;

    int h[n];
    double tt[n];

    for (int i = 0; i < n; i++) {
        cin >> h[i];
        tt[i] = t - (h[i] * 0.006);
    }

    /*
    for (int i = 0; i < n; i++) {
        cout << tt[i] << endl;
        cout << abs(tt[i] - a) << endl;
    }
    */

    double sub = 1000000.0;
    int ans = 0;

    for (int i = 0; i < n; i++) {
        if (abs(tt[i] - a) < sub) {
            ans = i + 1;
            sub = abs(tt[i] - a);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
h = []
N = int(input())

for i in range(N):
    v = int(input())
    h.append(v)
h.sort()
hh = h.copy()

ans = 0
t = h.pop(-1)
t1 = t
pm = 0
while 1:
    t2 = h.pop(pm)
    ans += abs(t - t2)
    if len(h) == 0:
        break
    t = t2

    t3 = h.pop(pm)
    ans += abs(t1 - t3)
    if len(h) == 0:
        break
    t1 = t3

    if pm==0:
        pm = -1
    else:
        pm = 0

ans1 = 0
h = hh
t = h.pop(0)
t1 = t
pm = -1

while 1:
    t2 = h.pop(pm)
    ans1 += abs(t - t2)
    if len(h) == 0:
        break
    t = t2

    t3 = h.pop(pm)
    ans1 += abs(t1 - t3)
    if len(h) == 0:
        break
    t1 = t3
    if pm == 0:
        pm = -1
    else:
        pm = 0


print(max(ans, ans1))

Measured memory_bytes: 13636
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
typedef pair<int, pi> pii;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define fax(i, a) for (int i = 0; i < (a); i++)
#define f0x(i, a, b) for (int i = (a); i < (b); i++)
#define faxd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define f0xd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)
#define memeset memset

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

int main() {
   ios::sync_with_stdio(false);
   cin.tie(0);
   int a,b,c; cin >> a >> b >> c; int rem = a-b;
   cout << c - min(rem,c) << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    set<int >s;
    int a,b,c, k,cont1=0, cont2=0;
    cin>>a>>b>>c>>k;

    while (a>= b*pow(2,cont1)){
            cont1++;
    }
    b*=pow(2,cont1);
    while (b>= c*pow(2,cont2)){
        cont2++;
    }
    if(cont1+cont2<=k){
        cout<<"Yes";
    }
    else cout<<"No";

}

Measured memory_bytes: 4036
#pragma once

#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, char, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

const ll mod = 1000000007;

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	//int t;
	// cin>>t;
	 int n;
	// while(t--) {
	 	cin>>n;
		 if(n%1000) {
			for(int i=1000; i<n+1000; i+=1000) {
				  if(n<i) {
					cout<<i-n<<endl;
					break;
				  }
			}
		 }else {
		 	cout<<0<<endl;
		 }
	// }
   return 0;
}

Measured memory_bytes: 3548
#include <stdio.h>

int n, A[1000];

int solve ( int i, int m ) {
    if ( m == 0 ) {
        return 1;
    }
    if ( i >= n ) {
        return 0;
    }
    int res = solve ( i + 1, m ) || solve ( i + 1, m - A[i] );
    return res;
}

int main () {
    int q, x, i;
    
    scanf ( "%d", &n);
    for ( i = 0; i < n; i++ ) {
        scanf ( "%d", &A[i] );
    }
    scanf ( "%d", &q );
    for ( i = 0; i < q; i++ ) {
        scanf ( "%d", &x);
        if ( solve( 0, x ) ) {
            printf ( "yes\n" );
        }
        else {
            printf("no\n");
        }
    }
        return 0;
        
    
}



Measured memory_bytes: 2072
#include<bits/stdc++.h>
using namespace std;
#define nl '\n' 
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long int
#define pii pair <int,int>
ll mod=1000000007;
int main()
{
	int x;cin>>x;
	if(!x)cout<<1;
	else if (x==1)cout<<0;
}

Measured memory_bytes: 3640
/* ex4-1
    kas056 */
#include <stdio.h>
#include <math.h>

int main(void){
    
    int n, d,people;
    double div;
    scanf("%d %d", &n, &d);


    /*ルールによって監視する木の本数((i+d)-(i-d)+1)
    が一人当たり監視する最低限の木の本数(n/people)を上回ればいい */

    // n/people = (i+d)-(i-d)+1を式変形して得られる値をdiv
    div = (double)n /(2* (double)d + 1);
    people = ceil(div);//divを切り上げて最低限の人間を算出
    printf("%d",people);
    
    return 0;
} 

Measured memory_bytes: 128
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

const size_t INF=1uLL<<57;

size_t binary_knapsack(vector<size_t> w, vector<size_t> v, size_t c) {
    size_t n=w.size();
    size_t V=*max_element(v.begin(), v.end());
    vector<size_t> dp(n*V+1, INF); dp[0]=0;

    for (size_t i=0; i<n; ++i)
        for (size_t j=n*V; j>=v[i]; --j)
            if (dp[j] > dp[j-v[i]] + w[i])
                dp[j] = dp[j-v[i]] + w[i];

    size_t res=0;
    for (size_t k=0; k<=n*V; ++k)
        if (dp[k] <= c) res = k;

    return res;
}

int main() {
    size_t N, W;
    scanf("%zu %zu", &N, &W);

    vector<size_t> v(N), w(N);
    for (size_t i=0; i<N; ++i)
        scanf("%zu %zu", &v[i], &w[i]);

    printf("%zu\n", binary_knapsack(w, v, W));
    return 0;
}

Measured memory_bytes: 3156
a, b = map(int, input().split())
if a > 0 and b > 0:
  print('Positive')
elif a < 0 and b < 0:
  if (b - a + 1) % 2 == 0:
        print('Positive')
  else:
        print('Negative')
elif a * b < 0:
        print('Zero')

Measured memory_bytes: 9172
#include <bits/stdc++.h>
  
 using namespace std;
 #define rep(i,n) for(int i=0; i<(n); i++)
 typedef long long ll;
 #define INF 1e9
  
  
  
 int main(){
     ll n, a, b; cin >> n >> a >> b;
    
     
     if(!((b-a)&1)){
         cout << (b-a)/2 << endl;
         return 0;
     }
     
   
     
     ll l = a+((b-a-1)/2);
     ll r = (n-b+1) + (b-a-1)/2;
     cout << min(r, l) << endl;
     
    
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;

vector<long long int> inverse;
vector<long long int> f, f_inverse;

void factorial_Initialize(int max){
    vector<long long int> a(max+1,1);
    inverse = a;
    f = a;
    f_inverse = a;

    for (int i=2; i<=max; i++){
        inverse[i]   = MOD - inverse[MOD % i] * (MOD / i) % MOD;
        f[i]         = f[i-1]         * i          % MOD;
        f_inverse[i] = f_inverse[i-1] * inverse[i] % MOD;
    }
}

long long int nCr(int n, int r){
    if(n < r || r < 0) return 0;
    if (n >= f.size()){
        factorial_Initialize(n);
    }
    return f[n] * f_inverse[r] % MOD * f_inverse[n-r] % MOD;
}

//----------------------------------------------------------

struct DP{
    long long int dp;// initial value : 1
    int subtree_size;// initial value : 0

    DP operator + (const DP& a) const {
        return { (dp * a.dp) % MOD * nCr(subtree_size + a.subtree_size, subtree_size) % MOD, 
                 subtree_size + a.subtree_size };
    }
    DP proceed() const { return {dp, subtree_size + 1}; }// add root itself
};

vector<vector<int>> graph;
vector<vector<DP>> subtree_DP;
vector<DP> ans;

// usual tree DP
DP DFS(int v, int parent_v = -1){
    DP sum_DP = {1,0};
    subtree_DP[v].resize(graph[v].size());

    for(int i=0; i<graph[v].size(); i++){
        if(graph[v][i] == parent_v) continue;
        
        int child_v = graph[v][i];
        subtree_DP[v][i] = DFS(child_v, v);
        sum_DP = sum_DP + subtree_DP[v][i];// operator "+" is defined above
    }

    return sum_DP.proceed();
}

void BFS(int v, const DP& parent_DP = {1,0}, int parent_v = -1){
    // update --> one can then treat v itself as a genuine root
    for(int i=0; i<graph[v].size(); i++){
        if(graph[v][i] == parent_v) subtree_DP[v][i] = parent_DP;
    }

    // cumulative sum
    vector<DP> left(graph[v].size() + 1, {1,0}), right(graph[v].size() + 1, {1,0});
    for(int i=0; i<graph[v].size(); i++)    left[i+1] = left[i]    + subtree_DP[v][i];
    for(int i=graph[v].size()-1; i>=0; i--) right[i]  = right[i+1] + subtree_DP[v][i];

    ans[v] = left[graph[v].size()].proceed();// whole (with self included)

    // move on
    for(int i=0; i<graph[v].size(); i++){
        if(graph[v][i] == parent_v) continue;

        int child_v = graph[v][i];
        BFS(child_v, (left[i] + right[i+1]).proceed(), v);// parent_DP = left[i] + (parent) + right[i+1] --> update!
    }
}

int main(){
    int n;
    cin >> n;
    graph.resize(n);
    subtree_DP.resize(n);
    ans.resize(n);

    factorial_Initialize(1e6);

    for(int i=0; i<n-1; i++){
        int a, b;
        cin >> a >> b;
        a -= 1;
        b -= 1;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }

    DFS(0);
    BFS(0);
    for(int i=0; i<n; i++){
        cout << ans[i].dp << endl;
    }
    return 0;
}

Measured memory_bytes: 61628
# Generated by AtcoderGreedy on 2018-10-31
# ABC112 B
# Your code here

N,T = gets.strip.split.map(&:to_i)
i = 1
cnt = 10**9
while i <= N
  c,t = gets.strip.split.map(&:to_i)
  if t <= T
    if c <= cnt
      cnt = c
    end
  end
  i += 1
end

if cnt == 10**9
  puts "TLE"
else
  puts cnt
end


Measured memory_bytes: 1916
# coding: utf-8
# Your code here!
import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,m = map(int, readline().split())

g = {}

for _ in range(m):
    p,q,c = map(int, readline().split())
    pc = ((p-1)<<20)+c
    qc = ((q-1)<<20)+c
    pp = (p-1)<<20
    qq = (q-1)<<20
    
    if pc not in g: g[pc] = []
    if qc not in g: g[qc] = []
    if pp not in g: g[pp] = []
    if qq not in g: g[qq] = []
    
    g[pc].append(qc)
    g[pc].append(pp)

    g[qc].append(pc)
    g[qc].append(qq)

    g[pp].append(pc)
    g[qq].append(qc)

if 0 not in g: g[0] = []

from collections import deque
q = deque([(0,0)])
res = {0:0}

mask = (1<<20)-1
while q:
    vl,dv = q.popleft()
    if res[vl] < dv: continue
    if (vl>>20) == n-1:
        res[(n-1)<<20] = dv+1
        break
    for tl in g[vl]:
        ndv = dv + (vl&mask==0 or tl&mask==0)
        if tl not in res or res[tl] > ndv:
            res[tl] = ndv
            if vl&mask==0 or tl&mask==0:
                q.append((tl,ndv))
            else:
                q.appendleft((tl,ndv))

if (n-1)<<20 in res:
    print(res[(n-1)<<20]//2)
else:
    print(-1)






Measured memory_bytes: 224612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K,min=0;
  cin>>N>>K;
  for(int i=0;i<N;i++){
    int a,b,j;
    cin>>j;
      a=j; b=K-j;
  if(a>=b){min=min+b*2;}
    else{min=min+a*2;}
  }
  cout<<min<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
    string str;
    cin>>str;
    int ans=str.size();
    for(int i=0;i<str.size()-1;++i){
        if(str[i]!=str[i+1]){
            int d = max(i+1,(int)str.size()-i-1);
            ans = min(d,ans);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512