akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <complex>
#include <string>
#include <vector>
#include <algorithm>
#define x real() 
#define y imag()
#define px second
#define py first
using namespace std;
typedef complex<double> vectol;
typedef pair <int,int> P;
P G[100001];
vector <P> stc;

int ccw(vectol a,vectol b,vectol c) {
  vectol ab=b-a, ac =c-a;
  vectol d =ac*conj(ab); 
  if(d.y > 0) return true;
  return false;
}

int main() {
  int n;
  cin >> n;
  for(int i=0;i<n;i++)cin >> G[i].px >> G[i].py;
  sort(G,G+n);
  
  stc.push_back(G[0]),stc.push_back(G[1]);
  for(int i=2;i<n;i++) {
    vectol av = vectol(stc[stc.size()-2].px,stc[stc.size()-2].py);
    vectol bv = vectol(stc[stc.size()-1].px,stc[stc.size()-1].py);
    vectol cv = vectol(G[i].px,G[i].py);
    if(ccw(av,bv,cv) && stc.size()!=1)stc.pop_back(),i--;
    else  stc.push_back(G[i]);
  }
  for(int i=n-2;i>=0;i--) {
    vectol av = vectol(stc[stc.size()-2].px,stc[stc.size()-2].py);
    vectol bv = vectol(stc[stc.size()-1].px,stc[stc.size()-1].py);
    vectol cv = vectol(G[i].px,G[i].py);
    if(ccw(av,bv,cv)) stc.pop_back(),i++;
    else stc.push_back(G[i]);
  }
  stc.pop_back();

  cout <<stc.size()<<endl;
  cout << stc[0].px <<" "<<stc[0].py<<endl;
  for(int i=stc.size()-1;i>0;i--) cout << stc[i].px <<" "<<stc[i].py<<endl;
  return 0;
}

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

int r, f, ans;
int g[1050][1050];
int dis[1050][1050];
int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };
int n, m;

struct node{
	int x, y, d;
}q[1050*1050];

void push(int x, int y, int d){
	q[r].x = x;
	q[r].y = y;
	q[r].d = d;
	r++;
}
node pop(){
	return q[f++];
}

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

int bfs(){
	int res = 0;
	while (f <= r){
		node tmp = pop();
		int xx = tmp.x;
		int yy = tmp.y;
		int d = tmp.d;
		for (int k = 0; k < 4; k++){
			int x = dx[k] + xx;
			int y = dy[k] + yy;
			if (x >= 1 && x <= n && y >= 1 && y <= m && g[x][y] == 0){
				res = max(res, d + 1);
				push(x, y, d + 1);
				g[x][y] = 1;
			}
		}
	}
	return res; 
}
int main(){
	//freopen("in.txt","r",stdin);
	scanf("%d %d\n",&n, &m);
	r = f = 0;
	char ch;
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			scanf("%c",&ch);
			if (ch == '#'){
				g[i][j] = 1;
				push(i, j, 0);
			}
			else{
				g[i][j] = 0;
			}
		}
		getchar();
	}
	ans = bfs();
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 19584
def binarySearch(A, key):
    left = 0
    right = len(A)
    while left < right:
        mid = (left + right) // 2
        if A[mid] == key:
            return True
        elif key < A[mid]:
            right = mid
        else:
            left = mid + 1
    return False

n = int(input())
S = list(map(int,input().split()))
q = int(input())
T = list(map(int,input().split()))

cnt = 0
for j in range(q):
    if binarySearch(S,T[j]):
        cnt += 1
        continue

print(str(cnt))


Measured memory_bytes: 16712
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

int main() {
  int N;
  while (cin >> N) {
    vector<string> S(N);
    for (int i = 0; i < N; i++) {
      cin >> S[i];
    }
    int res = 0;
    for (int B = 0; B < N; B++) {
      bool ok = true;
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
          // (i, j) -> (i, j + B)
          // (j, i) -> (j, i + B)
          if (S[i][(j + B) % N] != S[j][(i + B) % N]) {
            ok = false;
          }
        }
      }
      if (ok) {
        ++res;
      }
    }
    res *= N;
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 384
# AOJ ITP2_1_D: Vector II
# Python3 2018.6.24 bal4u

from collections import deque
n, q = map(int, input().split())
Q = []
for i in range(n): Q.append(deque())
for i in range(q):
	a = input().split()
	t = int(a[1])
	if   a[0] == '0': Q[t].append(a[2])   # pushBack
	elif a[0] == '1': print(*Q[t])        # dump
	else: Q[t].clear()                    # clear



Measured memory_bytes: 42832
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
template <class T>
bool maxi(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool mini(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll N,K; cin>>N>>K;
    vector<ll> A(N);
    vector<ll> B(N);
    rep(i,N){
        cin>>A[i]>>B[i];
    }
    ll ans=0;
    ll buf=0;
    rep(i,N){
        bool ok=true;
        rep(j,32){
            if(((K>>j)&1) ==0 and ((A[i]>>j &1)==1)) ok=false;
        }
        if(ok) buf+=B[i];
    }
    maxi(ans,buf);

    rep(k,31){
        if(((K>>k)&1) ==0) continue;

        ll buf=0;
        rep(i,N){
            bool ok=true;
            if((A[i]>>k)&1) ok=false;
            reps(j,k+1,32){
                if(((K>>j)&1) ==0 and ((A[i]>>j &1)==1)) ok=false;
            }
            if(ok) buf+=B[i];
        }
        maxi(ans,buf);
    }
    cout<< ans <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 1792
package main

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

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	t, _ := strconv.Atoi(sc.Text())
	return t
}

func main() {
	var a, n, ans int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	for i := 0; i < n; i++ {
		a = nextInt(sc)
		for a%2 == 0 {
			a /= 2
			ans++
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main()
{
	char a[10000];
	while(~scanf("%s",a))
	{
		int s,n,e,w;
		s=n=e=w=0;
		int len=strlen(a);
		for(int i=0;i<len;i++)
		{
			if(a[i]=='S')
			 s=-1;
			 if(a[i]=='N')
			 n=1;
			 if(a[i]=='E')
			  e=-1;
			  if(a[i]=='W')
			  w=1;
		}
		if(s+n==0&e+w==0)
		cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct compare{
    bool operator()(pair<int,int>&p1,pair<int,int>&p2){
        
        return p1.first>p2.first;
        
    }
};


int main()
{
   int n,x,t;
   
   cin>>n>>x>>t;
   
   cout<<((n+x-1)/x)*t;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

#define M_PI 3.141592653589793238462643383279

int main() {
    li a, b, h, m;
    cin >> a >> b >> h >> m;
    double rad_cho = (h * 60 + m) / (12.0 * 60) * 2 * M_PI;
    double rad_tan = m * 1.0 / 60.0 * 2 * M_PI;

    printf("%.12f\n", hypot(a * sin(rad_cho) - b * sin(rad_tan), a * cos(rad_cho) - b * cos(rad_tan)));

    return 0;
}

Measured memory_bytes: 4060
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
#include <limits>
#include <numeric>
#include <type_traits>
#define int long long
#define ll long long
#define mod  1000000007
#define inf 1e17
#define rep(i,j,n) for(int i=j;i<n;i++)
#define P pair<int,int>
#define ps push_back
double pi = 3.141592653589793;
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}
//ここから始めよう
int n,p;
int arr[114514];
vector<int> v;
//エラトステネスの篩
bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く
    
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }
    
    // 素数である
    return true;
}
signed main(){
   cin>>n>>p;
    if(n==1){
        cout<<p<<endl;return 0;
    }
    rep(i,2,sqrt(p)+1){
        if(IsPrime(i))v.ps(i);
    }
    int ans=1;
    rep(i,0,v.size()){
        //cout<<v[i]<<" ";
        int cnt=0;
        while(p%v[i]==0){
            p/=v[i];cnt++;
        }
        if(cnt>=n)ans*=pow(v[i],cnt/n);
        //cout<<ans<<endl;
    }cout<<ans<<endl;return 0;
}



Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k,mi;
	cin>>n>>k;
	mi=1000000000;
	int h[n];
	for(int i=0;i<n;i++){
		cin>>h[i];
	}
	sort(h,h+n);
	for(int i=0;i<n-k+1;i++){
		mi=min(mi,h[i+k-1]-h[i]);
	}
	cout<<mi<<endl;
}

Measured memory_bytes: 640
s = input()
n = len(s)

a = 0
for i in range(n):
    if i % 2 == 0:
        if s[i] != "0":
            a += 1
    else:
        if s[i] != "1":
            a += 1

b = 0
for i in range(n):
    if i % 2 == 0:
        if s[i] != "1":
            b += 1
    else:
        if s[i] != "0":
            b += 1

print(min(a, b))


Measured memory_bytes: 40176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
////////////////////////////////////////////////
int main()
{
    string s;
    cin >> s;
    int ans = 0, rain = 0;
    rep(i, 3)
    {
        if (s[i] == 'R')
            rain++;
        else
            rain = 0;
        ans = max(ans, rain);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(long long i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(long long i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
//ll const mod=998244353;
ll const mod=1e9+7;
const ll MAX=1000005;
using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}


int main(){
    int n;
    string s;
    int k;
    cin>>n>>s>>k;
    k--;
    char c=s[k];
    rep(i,n){
        if(s[i]!=c)s[i]='*';
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3556
s = gets.chomp

former = s[(0..1)].to_i
later  = s[(2..3)].to_i

is_former_month = (1..12).include?(former)
is_later_month = (1..12).include?(later)

if is_former_month && is_later_month
  puts 'AMBIGUOUS'
  exit
end

if is_former_month
  puts 'MMYY'
  exit
end

if is_later_month
  puts 'YYMM'
  exit
end

puts 'NA'


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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
// #define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(long& x) { if( scanf("%ld", &x) < 0 ) exit(0); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename W>
struct N003 {
   typedef std::vector<long> LI;
   typedef std::vector<W>    LW;
   long n, e;
   LI ss, ds;
   LW ws;
   std::vector<LI> iss;
   N003(long n_, const LI& ss_, const LI& ds_, const LW& ws_)
      : n(n_), e(ss_.size()), ss(ss_), ds(ds_), ws(ws_) {
      iss.resize(n+1);
      for(long i = 0; i < e; ++i) {
         iss[ss[i]].push_back(i);
      }
   }
};

template<typename W>
struct N005 {
   std::vector<W> xs;
   bool negativeCycle;
   N005(const N003<W>& g, long s, W inf) : xs(g.n+1, inf) {
      long latest;
      xs[s] = 0;
      for(long i = 0; i < g.n+1; ++i) {
         for(long k = 0; k < g.e; ++k) {
            if( xs[g.ss[k]] == inf ) continue;
            W nd = xs[g.ss[k]] + g.ws[k];
            if( nd < xs[g.ds[k]] ) {
               xs[g.ds[k]] = nd;
               latest = i;
            }
         }
      }
      for(long i = 0; i < g.n+1; ++i) {
         if( xs[i] >= inf / 2 ) xs[i] = inf;
      }
      negativeCycle = latest == g.n+1-1;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      typedef std::vector<long> LI;
      long v, e, r;
      scan(v, e, r);
      LI ss(e+1), ds(e+1);
      LI ws(e+1);
      for(long i = 0; i < e; ++i) {
         scan(ss[i], ds[i], ws[i]);
      }
      N003<long> g(v, ss, ds, ws);
      N005<long> bellmanford(g, r, (1LL << 60));
      if( bellmanford.negativeCycle ) {
         puts("NEGATIVE CYCLE");
      }
      else {
         for(long i = 0; i < v; ++i) {
            long res = bellmanford.xs[i];
            if( res == (1LL << 60) ) {
               puts("INF");
            }
            else {
               printf("%ld\n", res);
            }
         }
      }
   }
};

int main() {
  loop std::unique_ptr<Solver>(new Solver())->solve();
}

Measured memory_bytes: 3364
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0,ans=0;
bool graph[8][8];

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

     ll a[n+1],b[m+1],A[n+1],B[m+1];
     A[0] = 0;
     B[0] = 0;
     int l=0;
     for(int i=1;i<=n;i++){
         cin >> a[i] ;
         A[i] = A[i-1]+a[i];
     } 

     for(int i=1;i<=m;i++){
         cin >> b[i] ;
         B[i] = B[i-1]+b[i];
     } 

     

     ll j = m;
     for(int i=0;i<=n;i++){
         if(A[i] > k)break;
     
         while(B[j] > k-A[i]){
             j--;
         }
         
         ans = max(ans,i+j);
     }

     cout << ans << endl;
     
    }

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

int main(){
    int n, x, y;
    cin >> n >> x >> y;
    int a[n + 10];
    for(int i = 0; i < n + 10; i++) a[i] = 0;
    for(int i = 1; i <= n - 1; i++){
        for(int j = i + 1; j <= n; j++){
            a[min(abs(j - i), min(abs(x - i) + abs(y - j) + 1, abs(x - j) + abs(y - i) + 1))]++;
        }
    }
    for(int i = 1; i < n; i++){
        cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
using namespace std;
int main(void) {
	int n, m, a, b;
	set<int> st;
	cin >> n >> m;
	int cnt = 0;
	for (int i = 0; i < m; ++i) {
		cin >> a >> b;
		if (a == 1) st.insert(b), ++cnt;
		if (b == n) st.insert(a), ++cnt;
	}
	cout << (st.size() != cnt ? 
		"POSSIBLE" : "IMPOSSIBLE") << endl;
	return 0;
}

Measured memory_bytes: 9600
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct
{
	char g;
	int num;
}card;
card B[100000];
card L[(100000 / 2) +1], R[(100000 / 2)+1];
int A[100000];
char C[100000][2];
int Partition(int A[], int p, int r)
{
	int x, i, j, tmp;
	char mark[2];
	x = A[r];
	i = p - 1;
	for (j = p; j < r; j++)
  {
		if (A[j] <= x)
    {
			i++;
			tmp=A[i];
			A[i]=A[j];
			A[j]=tmp;
			strcpy(mark,C[i]);
			strcpy(C[i],C[j]);
			strcpy(C[j],mark);
		}
	}
	tmp=A[i+1];
	A[i+1]=A[r];
	A[r]=tmp;
	strcpy(mark,C[i+1]);
	strcpy(C[i+1],C[r]);
	strcpy(C[r], mark);
	return i+1;
}
void Quick(int A[],int p,int r)
{
	int q;
	if(p<r)
  {
		q=Partition(A,p,r);
		Quick(A,p,q-1);
		Quick(A,q+1,r);
	}
}
void merge(int n,int left,int mid,int right) {
	int i, j, k;
	int n1=mid-left;
	int n2=right-mid;
	for(i=0;i<n1;i++)L[i]=B[left+i];
	for(i=0;i<n2;i++)R[i]=B[mid+i];
	L[n1].num=R[n2].num =200000;
	i=j=0;
	for(k=left;k<right;k++)
  {
		if(L[i].num<=R[j].num)B[k]=L[i++];
		else	B[k]=R[j++];
	}
}
void merge_sort(int n,int left,int right)
{
	int mid;
	if(left+1<right)
  {
		mid=(left+right)/2;
		merge_sort(n,left,mid);
		merge_sort(n,mid,right);
		merge(n,left,mid,right);
	}
}
int main()
{
	int i,n,q,flag = 1;
	scanf("%d",&n);
	for(i=0;i<n;i++)
  {
		scanf("%s %d",C[i],&A[i]);
		B[i].g=*C[i];
		B[i].num=A[i];
	}
	Quick(A,0,n-1);
	merge_sort(n,0,n);
	for(i=0;i<n;i++)
  {
		if(*C[i]!=B[i].g||A[i]!= B[i].num)
    {
			flag=0;
			break;
		}
	}
	if(flag==0)printf("Not stable\n");
	else printf("Stable\n");

	for(i=0;i<n;i++)
  {
		printf("%s %d",C[i],A[i]);
		if(i!=n)printf("\n");
	}
	return 0;
}



Measured memory_bytes: 3980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int a, b;
  cin >> a >> b;
  
  priority_queue<int> pq;
  int i=0;
  
  while(pq.size()==0 && i<10001){
    i++;
      if(i*8/100 == a && i/10 == b){
        pq.push(i);
      }
    }
  
  if(pq.size()!=0){
  cout << pq.top() << endl;
  }
  else if(pq.size()==0) {
    cout << -1 << endl;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=(j);i<(k);i++)
#define mp make_pair
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef long double ld;
//----head----
int _abs(int a)
{
	if(a<0)return -a;
	return a;
}
int main()
{
	int x,a,b;
	scanf("%d%d%d",&x,&a,&b);
	if(_abs(x-a)>=_abs(x-b))puts("B");
	else puts("A");
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		while(true){
			int n = 1000 - in.nextInt();
			if(n==1000) return ;
			int cnt = 0;
			if(n>=500){
				cnt++;
				n -= 500;
			}
			if(n>=100){
				cnt += n/100;
				n %= 100;
			}
			if(n>=50){
				cnt++;
				n -= 50;
			}
			if(n>=10){
				cnt += n/10;
				n %= 10;
			}
			if(n>=5){
				cnt++;
				n -= 5;
			}
			cnt += n;
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 12000
#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 a,b,c;
  cin >> a >> b >> c;

  if((a==7 && b==5 && c==5) ||
    (a==5 && b==7 && c==5) ||
    (a==5 && b==5 && c==7) )
  {
    cout << "YES" << endl;
  }
  else
  {
    cout << "NO" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
int a,b;
char s[100];
int main()
{
	scanf("%d%d",&a,&b);
	scanf("%s",s);
	for(int i=0;i<a;i++)
	{
		if(!('0'<=s[i])&&(s[i]<='9'))
		{
		puts("No");
		return 0;
		}
	}
	if(s[a]!='-')
	{
		puts("No");
		return 0;
	}
	for(int i=a+1;i<=a+b;i++)
	{
		if(!('0'<=s[i])&&(s[i]<='9'))
		{		
		puts("No");
		return 0;
		}

	}
	puts("Yes");
	return 0;
}

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

using namespace std;

int main(void)
{
  int n,k;
  char c;
  vector<char>s;

  cin>>n>>k;
  for(int i=0;i<n;i++)
  {
    cin>>c;
    s.push_back(c);
  }

  s[k-1]= s[k-1] + 32;

  for(int i=0;i<n;i++)
  {
    cout<<s[i];
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

void InputArrayVal(int **array, int row, int column);

int main()
{
	int n, m, l;						// Aがn行m列、Bがm行l列
	
	// 行列のサイズ入力
	cin >> n >> m >> l;
	
	// 動的配列の作成
	int  **arrayA = new int*[n];
	int  **arrayB = new int*[m];
	long result   = 0;
	
	// arrayA, arrayBの動的確保
	for(int i = 0; i < n; i++)
	{
		arrayA[i] = new int[m];
	}
	for(int i = 0; i < m; i++)
	{
		arrayB[i] = new int[l];
	}
	
	// 行列要素の入力
	InputArrayVal(arrayA, n, m);
	InputArrayVal(arrayB, m, l);
	
	// 結果の計算、出力
	// 行列Aの行
	for(int i = 0; i < n; i++)
	{
		// 行列Bの列
		for(int j = 0; j < l; j++)
		{
			result = 0;
			
			for(int k = 0; k < m; k++)
			{
				result += arrayA[i][k] * arrayB[k][j];
			}
			cout << result;
			
			if(l - 1 == j)
			{
				cout << endl;
			}
			else
			{
				cout << " ";
			}
		}
		
	}
	
	// 動的配列の削除
	for(int i = 0; i < n; i++)
	{
		delete [] arrayA[i];
	}
	for(int i = 0; i < m; i++)
	{
		delete [] arrayB[i];
	}
	delete [] arrayA;
	delete [] arrayB;
	
	return 0;
}

void InputArrayVal(int **array, int row, int column)
{
	for(int i = 0; i < row; i++)
	{
		for(int j = 0; j < column; j++)
		{
			cin >> array[i][j];
		}
	}
}


Measured memory_bytes: 3176
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken().to!int; }
long readLong() { return readToken().to!long; }
real readReal() { return readToken().to!real; }

void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); }


immutable INF = 10L^^18;

int N;
long[] A;
int[] U, V;

int[][] G;
int[] sz;
long[][][] dp;

void dfs(int u, int p) {
  foreach (v; G[u]) {
    if (v != p) {
      dfs(v, u);
    }
  }
  sz[u] = 1;
  dp[u] = [[INF, INF]];
  chmin(dp[u][0][(A[u] < 0) ? 1 : 0], A[u]);
  foreach (v; G[u]) {
    if (v != p) {
      auto nxt = new long[][](sz[u] + sz[v], 2);
      foreach (x; 0 .. nxt.length) {
        nxt[x][] = INF;
      }
      foreach (x; 0 .. sz[u]) foreach (s; 0 .. 2) {
        if (dp[u][x][s] < INF) {
          foreach (y; 0 .. sz[v]) foreach (t; 0 .. 2) {
            if (dp[v][y][t] < INF) {
              // connect
              {
                chmin(nxt[x + y][s | t], dp[u][x][s] + dp[v][y][t]);
              }
              // cut
              if (t == 0 || dp[v][y][t] < 0) {
                chmin(nxt[x + y + 1][s], dp[u][x][s]);
              }
            }
          }
        }
      }
      sz[u] += sz[v];
      dp[u] = nxt;
    }
  }
}

void main() {
  try {
    for (; ; ) {
      N = readInt();
      A = new long[N];
      foreach (u; 0 .. N) {
        A[u] = readLong();
      }
      U = new int[N - 1];
      V = new int[N - 1];
      foreach (i; 0 .. N - 1) {
        U[i] = readInt() - 1;
        V[i] = readInt() - 1;
      }
      G = new int[][N];
      foreach (i; 0 .. N - 1) {
        G[U[i]] ~= V[i];
        G[V[i]] ~= U[i];
      }
      sz = new int[N];
      dp = new long[][][N];
      dfs(0, -1);
      debug {
        writefln("sz = %s", sz);
        foreach (u; 0 .. N) {
          writefln("dp[%s] = %s", u, dp[u]);
        }
      }
      int ans = N;
      foreach (x; 0 .. N) foreach (s; 0 .. 2) {
        if (dp[0][x][s] < INF) {
          if (s == 0 || dp[0][x][s] < 0) {
            chmin(ans, x);
          }
        }
      }
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}


Measured memory_bytes: 512380
import math

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

if abs(N - M) > 1:
    print(0)
elif abs(N - M) == 1:
    print((math.factorial(N) * math.factorial(M)) % (10 ** 9 + 7))
else:
    print((math.factorial(N) ** 2 * 2) % (10 ** 9 + 7))


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

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

    vector <long> spot(n);
    rep(i,n) cin >> spot[i];

    vector <long> ans(n,0);

    long sum=abs(spot[0]);
    for(int i=0; i<=n-2; i++){
        sum += abs(spot[i+1]-spot[i]);
    }
    sum += abs(spot[n-1]);


    for(int i=0; i<n; i++){
        if(i==0){
            ans[0] = sum - abs(spot[0]) - abs(spot[1] - spot[0]) + abs(spot[1]);
        }
        else if(i==n-1){
            ans[n-1] = sum - abs(spot[n-1]) - abs(spot[n-1]-spot[n-2]) + abs(spot[n-2]);
        }
        else{
            ans[i] = sum - abs(spot[i]-spot[i-1]) - abs(spot[i+1]-spot[i]) + abs(spot[i+1]-spot[i-1]);
        }
    }

    rep(i,n) cout << ans[i] << endl;
}

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

using namespace std;

int main(){
    
    string inp="";
    cin>>inp;
    if(inp.length()>9 && inp.length()<5){
        cout<<"NO\n";
    }
    else{
        int idx=0;
        if(inp[0]=='A' && inp[1]=='K' && inp[2]=='I' && inp[3]=='H'){
            idx=4;
        }
        else if(inp[0]=='K' && inp[1]=='I' && inp[2]=='H'){
            idx=3;
        }
        else{
            cout<<"NO\n";
            return 0;
        }
        if(inp[idx]=='A' && inp[idx+1]=='B' ){
            idx+=2;
        }
        else if(inp[idx]=='B'){
            idx++;
        }
        else{
            cout<<"NO\n";
            return 0;
        }
        if(inp[idx]=='A' && inp[idx+1]=='R' ){
            idx+=2;
        }
        else if(inp[idx]=='R'){
            idx++;
        }
        else{
            cout<<"NO\n";
            return 0;
        }
        if(inp.length()==idx){
            cout<<"YES\n";
            return 0;
        }
        else if(inp[idx]=='A'){
            idx++;
        }

        if(inp.length()==idx){
            cout<<"YES\n";
        }
        else{
            cout<<"NO\n";
        }
    }
    return 0;
}

Measured memory_bytes: 256
import math
n=int(input())
a_min=n/1.08
a_max=(n+1.0)/1.08
#print(a_min,a_max)
ans=a_min

if (math.ceil(a_min)<math.ceil(a_max)):
    print(math.ceil(a_min))
else:
    print(":(")

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

using namespace std;

#define int long long

const int INF = 1e18 + 118;

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; ++i)
    {
        int x, len;
        cin >> x >> len;
        a[i].first = x + len;
        a[i].second = x - len;
    }
    sort(a.begin(), a.end());
    int ans = 0;
    int rr = -INF;
    for (int i = 0; i < n; ++i)
    {
        if (a[i].second >= rr)
        {
            ++ans;
            rr = a[i].first;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
// #include "debug.h"
#define debug(...) 42

ll f(int a, int b) {
   return max((ll)to_string(a).length(), (ll)to_string(b).length());
}

void solve() {
   ll n;
   cin >> n;
   ll ans = LONG_MAX;
   for(ll i = 1; i * i <= n; i++) {
      if(n % i == 0) {
         ll a = i;
         ll b = n / i;
         ans = min(ans, f(a, b));
      }
   }
   cout << ans << endl;
} 

int main() {
   cin.tie(0);
   cin.sync_with_stdio(0);
   int testcase = 1;
   // cin >> testcase;

   for(int i = 0; i < testcase; i++) {
      solve();
   }
   return 0;
}


Measured memory_bytes: 3724
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  var n = sc.nextInt()
  val a:BigInt = 2
  var list = List(a,a-1)
  for (i <- 2 to 86){
    list :+= list(i-2) + list(i-1)
  }
  println(list(n))
}


Measured memory_bytes: 55380
#include <assert.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <bitset>
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

ll x[51];
ll y[51];

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

  ll N, K;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> x[i];
    cin >> y[i];
  }
  ull area = ULLONG_MAX;
  for (int xi = 0; xi < N; xi++) {
    for (int xj = 0; xj < N; xj++) {
      for (int yi = 0; yi < N; yi++) {
        for (int yj = 0; yj < N; yj++) {

          if (x[xi] >= x[xj] || y[yi] >= y[yj]) continue;

          ll contains = 0;

          ll xmin = x[xi];
          ll xmax = x[xj];
          ll ymin = y[yi];
          ll ymax = y[yj];

          for (int k = 0; k < N; k++) {

            if (xmin <= x[k] && x[k] <= xmax &&
                ymin <= y[k] && y[k] <= ymax) {
              contains++;
            }
          }

          if (contains == K) {
            ull xx = xmax - xmin;
            ull yy = ymax - ymin;
            area = min(area, xx * yy);
          }
        }
      }
    }
  }

  cout << area << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

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

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

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



signed main(){

    int H, N; cin >> H >> N;
    vec A(N), B(N);
    REP(i, N) cin >> A[i] >> B[i];
    vec dp(H + 1, INF);
    dp[0] = 0;
    REP(i, N){
        REP(j, H){
            int k = min(j + A[i], H);
            Min(dp[k], dp[j] + B[i]);
        }
    }
    Out(dp[H]);

    return 0;
}


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

int main()
{
    int x, y, a, b, c;
    cin >> x >> y >> a >> b >> c;

    vector<int> p(a), q(b), r(c);
    rep(i, a) cin >> p[i];
    rep(i, b) cin >> q[i];
    rep(i, c) cin >> r[i];

    vector<int> eat(x+y+c);
    //redの並び替えとトップの代入
    //partial_sort(p.begin(), p.begin()+x, p.end(), std::greater<int>());
    sort(p.rbegin(), p.rend());
    rep(i, x) eat[i] = p[i];
    //greenの並び替えとトップの代入
    //partial_sort(q.begin(), q.begin()+y, q.end(), std::greater<int>());
    sort(q.rbegin(), q.rend());
    rep(i, y) eat[x+i] = q[i];
    //clearの代入
    rep(i, c) eat[x+y+i] = r[i];

    //食べる候補の並び替え
    //partial_sort(eat.begin(), eat.begin()+x+y, eat.end(), std::greater<int>());
    sort(eat.rbegin(), eat.rend());

    long long int total_eat=0;
    rep(i, x+y) total_eat += eat[i];
    cout << total_eat << endl;

    return 0;
}

Measured memory_bytes: 2560
#include <stdio.h>

int main(void)
{
    int x;
    int count = 0;
   
    while(1)
    {
        scanf("%d", &x);
            
        if(x == 0)
        {
            break;
        }
        else
        {
            count++;
            printf("Case %d: %d\n", count, x);
        }
            
    }
   
    return 0;
}

Measured memory_bytes: 600
#include <stdio.h> 
 int main(){ 
     int i, n; 
     int a[100]; 
     scanf("%d", &n); 
     for(i=0;i<n;i++){ 
         scanf(" %d", &a[i]); 
     } 
     for(i=0;i<n;i++){ 
         if(i)printf(" "); 
         printf("%d", a[n-i-1]); 
     } 
     printf("\n"); 
     return 0; 
 } 



Measured memory_bytes: 2136
import java.util.Scanner;
import java.util.InputMismatchException;

public class Main{
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
		int b = scan.nextInt();
		
		System.out.println(a*b+" "+(a*2+b*2));
	}
}

Measured memory_bytes: 26004
#include <iostream>

using namespace std;

long cnt[5];

int main(){
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        string s;
        cin >> s;
        if(s[0] == 'M') cnt[0]++;
        if(s[0] == 'A') cnt[1]++;
        if(s[0] == 'R') cnt[2]++;
        if(s[0] == 'C') cnt[3]++;
        if(s[0] == 'H') cnt[4]++;
    }
    long ans = 0;
    for(int i = 0; i < 5; i++){
        for(int j = 0; j < i; j++){
            for(int k = 0; k < j; k++){
                ans += cnt[i]*cnt[j]*cnt[k];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;
int INF = 1001001001;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  vector<int> w(n);
  int ac, wa;
  ac = wa = 0;
  rep(i, m) {
    int p;
    string s;
    cin >> p >> s;
    p--;
    if(s == "AC") {
      if(a[p] == 0) {
        ac++;
        wa += w[p];
      }
      a[p]++;
    } else {
      w[p]++;
    }
  }
  printf("%d %d", ac, wa);
  return 0;
}

Measured memory_bytes: 3984
#include<algorithm>
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<queue>
using namespace std;

struct qwq{
	int a,b;
	inline bool operator<(const qwq &x)const{
	   return a<x.a;
	}
} x[100005];

priority_queue<int> q;

int main(){
	int n,m,i,j=1,s=0;
	
	scanf("%d%d",&n,&m);
	
	for(i=1;i<=n;++i)
	   scanf("%d%d",&x[i].a,&x[i].b);
	
	sort(x+1,x+n+1);
	
	for(i=1;i<=m;++i){
		for(;x[j].a==i&&j<=n;++j)
		   q.push(x[j].b);
		if(!q.empty()){
		   s += q.top();
		   q.pop();
		}
	}
	
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 1660
package main

import (
	"fmt"
)

func main() {

	var d, t, s int

	fmt.Scan(&d)
	fmt.Scan(&t)
	fmt.Scan(&s)
	//fmt.Printf("%d, %d, %d", d, t, s)

	dis := calc(s, t)

	if dis >= d {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func calc(s int, t int) int {
	ans := s * t
	return ans
}


Measured memory_bytes: 1768
n=int(input())
F = [int(input().replace(" ",""),2) for _ in range(n)]
P = [list(map(int,input().split())) for _ in range(n)]

total = -10**9
for i in range(1,2**10):
    pgain = 0
    for f,p in zip(F,P):
        pgain += p[bin(f&i).count("1")]
    if total < pgain:
        total = pgain
        k = i
print(total)

Measured memory_bytes: 9196
def shuffle_cards(cards, num_of_cards)
  cards[num_of_cards..-1] + cards[0..(num_of_cards-1)]
end

loop do
  cards = gets.chomp
  break if cards == "-" 
  num_of_shuffling = gets.chomp.to_i
  shuffle_num_of_cards = []
  num_of_shuffling.times { shuffle_num_of_cards.push(gets.chomp.to_i) }

  shuffle_num_of_cards.each do |i|
    cards = shuffle_cards(cards, i)
  end
  puts cards
end

Measured memory_bytes: 8636
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second

using namespace std;

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


int main(){

	ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
	
	int a , b;
	cin >> a >> b;

	if(a <= 0 && b >= 0)
	   cout << "Zero";
	else if(a > 0 || (min(0 , b) - a + 1)%2 == 0)
	   cout << "Positive";
	else
	   cout << "Negative";
	
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
use std::io;

fn concat(a: i64, b: i64) -> i64 {
    if b == 0 {
        a
    } else if b < 10 {
        a * 10 + b
    } else if b < 100 {
        a * 100 + b
    } else  {
        a * 1000 + b
    }
}

// 計算量減らせるけどサイズ小さいのできにしない
fn is_square(n: i64) -> bool {
    for i in 1..n {
        if i * i == n {
            return true
        }
    }
    false
}

#[test]
fn test_concat() {
    assert_eq!(concat(1, 5), 15);
    assert_eq!(concat(10, 9), 109);
    assert_eq!(concat(32, 10), 3210);
    assert_eq!(concat(23, 45), 2345);
    assert_eq!(concat(234, 99), 23499);
    assert_eq!(concat(543, 100), 543100);
}

fn main() {
    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();
    let mut iter = input.split_whitespace();
    let a: i64 = iter.next().unwrap().parse().unwrap();
    let b: i64 = iter.next().unwrap().parse().unwrap();
    let ab = concat(a, b);
    if is_square(ab) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
import sys
from math import *
from itertools import *

input = sys.stdin.readline

N, L = list(map(int,input().split()))
T = [int(input().strip()) for i in range(N)]
T.sort()

pairN = factorial(N)/(factorial(N-2)*factorial(2))
tripleN = factorial(N)/(factorial(N-3)*factorial(3))

ans = [0,0]
for i0, i1 in combinations(range(N),2):
	t0, t1 = T[i0], T[i1]
	tn = (t0+t1)/2
	to = tn+(L/2.0)
	cn = (cos(2.0*pi*tn/L),sin(2.0*pi*tn/L))
	co = (cos(2.0*pi*to/L),sin(2.0*pi*to/L))

	onum = (i1-i0)-1
	nnum = N-2-onum
	ans[0] += (cn[0]*nnum + co[0]*onum)/tripleN
	ans[1] += (cn[1]*nnum + co[1]*onum)/tripleN

print(" ".join(map(str,ans)))

Measured memory_bytes: 44652
n=int(input())
l=list(map(int,input().split()))
a=[0]*61
mod=10**9+7
for i in l:
    k=i
    j=0
    while k>0:
        a[j]+=k%2
        k=k//2
        j+=1
ans=0
for i in range(61):
    ans+=a[i]*(n-a[i])*pow(2,i,mod)
    ans%=mod
print(ans)

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

int main(void) {
  while (true) {
    int x, y, s;
    cin >> x >> y >> s;
    if(!x && !y && !s) break;

    int ret_x, ret_y, ans = -INF;
    FOR(i, 1, s) {
      int a = i - i * x / (100 + x), b = (s - i) - (s - i) * x / (100 + x);
      ret_x = a * (100 + x) / 100 + b * (100 + x) / 100;
      ret_y = a * (100 + y) / 100 + b * (100 + y) / 100;
      if (ret_x != s)
        continue;
      else
        ans = max(ans, ret_y);
    }

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

Measured memory_bytes: 3032
#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pb push_back
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[500005];
ll vis[500005],color[500005],I[101][101];

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res*=n;
			po--;
		}
		else
		{
			n*=n;
			po/=2;
		}
	}
	return res;
}

ll binpow(ll n, ll po, ll mod)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

ll swap(ll a, ll b)
{
	a=a+b;
	b=a-b;
	a=a-b;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll C(ll n, ll r) {
    if(r > n - r) r = n - r; 
    ll ans = 1;
    ll i;

    for(i = 1; i <= r; i++) {
        ans *= n - r + i;
        ans /= i;
        ans=ans%1000000007;
    }

    return ans;
}

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}


int main()
{
	ll n;
	string s;
	cin>>n>>s;
	ll t=s.size();
	if(n>=t) cout<<s;
	else
	{
		for(ll i=0;i<n;i++) cout<<s[i];
		cout<<"...";
	}
}

Measured memory_bytes: 15332
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;

char A[20];

int main(void){

	scanf("%s",A);

	for (int i = 0; i < 4; ++i)
	{
		printf("%c",A[i]);
	}
	printf(" ");
	for (int i = 4; i < 12; ++i)
	{
		printf("%c",A[i]);
	}
	printf("\n");

	return 0;

}


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

using namespace std;

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

	int a, b;
	cin >> a >> b;

	if (a >= 6 && a <= 12) b /= 2;
	else if (a <= 5)b = 0;
	cout << b << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  N = N % 10;
  string ans = "hon";
  if(N == 0)
    ans = "pon";
  if(N == 1)
    ans = "pon";
  if(N == 6)
    ans = "pon";
  if(N == 8)
    ans = "pon";
  if(N == 3)
    ans = "bon";
   
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<unordered_map>
#include<bits/stdc++.h>
#define ll long long 
#define dd double
using namespace std;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin>>n;
  cout<<pow(n,3)<<endl;
  
  return 0;
}

Measured memory_bytes: 4308
#include<map>
#include<queue>
#include<time.h>
#include<limits.h>
#include<cmath>
#include<ostream>
#include<iterator>
#include<set>
#include<stack>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define rep_1(i,m,n) for(int i=m;i<=n;i++)
#define mem(st) memset(st,0,sizeof st)
inline int read()
{
	int num=0, w=0;
	char ch=0;
	while (!isdigit(ch))
	{
		w|=ch=='-';
		ch = getchar();
	}
	while (isdigit(ch))
	{
		num = (num<<3) + (num<<1) + (ch^48);
		ch = getchar();
	}
	return w? -num: num;
}
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
typedef pair<double,double> pdd;
const int inf = 0x3f3f3f3f;
const int N=2e6+10;
int a[N];
int n,k;
bool check(int mid)
{
	int ans=0;
	for(int i=1;i<=n;i++)
		ans+=a[i]/mid+(a[i]%mid>0)-1;
	return ans<=k;
}
void solve()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	int l=1,r=1e9;
	while(l<r)
	{
		int mid=l+r>>1;
		if(check(mid))
			r=mid;
		else
			l=mid+1;
	}
	cout<<l<<endl;
}
signed main()
{
	int t=1; 
	while(t--)
		solve();
	return 0;
}



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

int compare_int(const void *a, const void *b)
{
    long long  A=*(long long*)a - *(long long*)b;
    if(A>0)return 1;
    if(A==0)return 0;
    if(A<0)return -1;
}

int main(){
	int n,i;
	long long da[200000],d,co=1;
	long long ans=0,a[200001];
	a[0]=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%ld",&da[i]);a[0]=0;
	for(i=1;i<=n;i++)a[i]=a[i-1]+da[i-1];
	//for(i=0;i<n;i++)printf("%lld,",a[i]);puts("");
	qsort(a,n+1,sizeof(long long),compare_int);
	//for(i=0;i<n;i++)printf("%lld,",a[i]);
	for(i=1;i<=n;i++){
		if(a[i-1]!=a[i]){
			ans+=co*(co-1)/2;
			co=1;
		}else co++;
	}
	ans+=co*(co-1)/2;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 4860
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
	int a, b, c, ans;cin>>a>>b>>c;
	cout << (a+b>=c?b+c:a+2*b+1) << endl;
}

Measured memory_bytes: 256