akhauriyash/Code-Regression huggingface dataset:
#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define int ll
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define PB push_back

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const int MOD = 1000000007;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
  out<<'('<<a.first<<','<<a.second<<')';
  return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
  out<<'[';
  REP(i, a.size()) {out<<a[i];if(i!=a.size()-1)out<<',';}
  out<<']';
  return out;
}

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

int a[305][305], l[100010], r[100010];
int dp[90010];
PII pos[90010];
signed main(void)
{
  int h, w, d;
  cin >> h >> w >> d;
  REP(i, h) REP(j, w) cin >> a[i][j];
  int q;
  cin >> q;
  REP(i, q) cin >> l[i] >> r[i];

  REP(i, h) REP(j, w) pos[a[i][j]] = {i, j};
  for(int st=1; st<=d; ++st) {
    for(int i=st+d; i<=h*w; i+=d) {
      // prev -> i への移動
      int cost = abs(pos[i-d].first-pos[i].first) + abs(pos[i-d].second-pos[i].second);
      dp[i] = dp[i-d] + cost;
    }
  }

  // REP(i, h*w+1) cout << dp[i] << " ";
  // cout << endl;

  REP(i, q) {
    cout << dp[r[i]] - dp[l[i]] << endl;
  }

  return 0;
}


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

int vector_finder(int p[], int n, int x) {
  int r=0;
  for(int i=0;i<n;i++){
    if(p[i]==x){
      r = 1;
      break;
    }
  }
  return r;
}

int main() {
  int X, N, ans;
  cin >> X >> N;
  
  if(N==0){
    cout << X << endl;
  }
  else{
    int p[N];
    for(int i=0;i<N;i++){
      int l;
      cin >> l;
      p[i] = l;
    }
    
    
    int tmp,check;
    check = vector_finder(p,N,X);
    if (check==0){
      ans = X;
    }
    else{
      int j=1;
      while(1){
        tmp  = X-j;
        check = vector_finder(p, N, tmp);
        if (check==0){
          ans = tmp;
          break;
        }
        tmp = X+j;
        check = vector_finder(p, N , tmp);
        if (check==0){
          ans = tmp;
          break;
        }
        j++;
      }
    } 
    cout << ans << endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std ;
int  Kai(int i) {
        if(i==1)return 1;
        else return i*Kai(i-1);
    }
int main(){
    int N;
    cin >> N;
    int X[N];
    int Y[N];
    for(int i=0;i<N;i++)cin >> X[i] >> Y[i];
    double Ans=0;
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(i==j)Ans+=0;
            else{
                double dx = X[i]-X[j];
                double dy = Y[i]-Y[j];
                Ans += pow(dx*dx+dy*dy,0.5);
            }
        }
    }
    Ans = (Ans * Kai(N-1))/Kai(N);
    cout << setprecision(10) << Ans << endl;
}

Measured memory_bytes: 4112
/* /\ In The Name of ALLAH /\
    Author : Jawahiir Nabhan */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

map <string,int> :: iterator it;
int main()
{
    string s,t; cin>>s>>t;
    map <char , int> mp;
    int n = (int)s.size(),k = (int)t.size();
    if(k >= n)
    {
        int cnt = 0;
        for(int i = 0;i < n;i++)
            if(s[i] != t[i]) cnt++;
        cout<<cnt + (k - n)<<endl;
        return 0;
    }
    int res = k;
    for(int i = 0;i < n - k;i++){
        int cnt = 0;
        for(int j = i;j < i + k;j++){
            if(s[j] != t[j - i]) cnt++;
        }
        res = min(res , cnt);
    }
    cout<<res<<endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz size()
#define pb(x) push_back(x) 
#define bg begin()
#define ed end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define mp(x,y) make_pair(x,y)

int main(){
	ll N; cin>>N;
	vector<P> p(N);
	rep(i,N){
		ll A; cin>>A;
		p[i]=mp(A,i+1);
	}
	sort(p.bg,p.ed);
	set<ll> se;//添え字
	se.insert(0);
	se.insert(N+1);
	ll ans=0;
	rep(i,N){
		//p[i].b==添え字
		auto itr=se.upper_bound(p[i].b);
		ll tmp=*itr;
		itr--;
		ll tmp2=*itr;
		//cout<<tmp2<<" "<<p[i].b<<" "<<tmp<<endl;
		ans+=(p[i].b-tmp2)*(tmp-p[i].b)*(i+1);
		se.insert(p[i].b);
	}
	cout<<ans;
}


Measured memory_bytes: 12800
#include<bits/stdc++.h>
using namespace std;
int N;
long long v[404040];
long long solve1(int mini, int maxi)
{
    int minA = v[mini];
    int maxB = v[maxi];
    int minB = v[mini^1];
    int maxA = v[maxi^1];
    for(int i=0; i<N; ++i)
    {
        int v1 = v[2*i], v2 = v[2*i+1];
        if(v1>v2) swap(v1, v2);
        minB = min(minB, v2);
        maxA = max(maxA, v1);
    }
    return 1LL * (maxA-minA) * (maxB-minB);
}
long long solve2(int mini, int maxi)
{
    int minv = min(v[maxi^1], v[mini^1]);
    int maxv = max(v[maxi^1], v[mini^1]);
    
    set<pair<int, int> > S;
    for(int i=0; i<N; ++i)
    {
        if(mini/2 == i || maxi/2 ==i) continue;
        S.insert(make_pair(max(v[2*i],v[2*i+1]), i));
    }
    int ans = maxv - minv;
    if(!S.empty())
    {
        ans = max(maxv, S.rbegin()->first) - min(minv, S.begin()->first);
        for(int i=0; i<S.size(); ++i)
        {
            pair<int, int> x = *S.rbegin();
            int xf = x.first;
            x.first ^= (v[x.second*2]^v[x.second*2+1]);
            if(xf <= x.first)
                break;
            S.erase(*S.rbegin()); S.insert(x);
            ans = min(ans,
                max(maxv, S.rbegin()->first) - min(minv, S.begin()->first));
        }
    }
    return 1LL*(v[maxi]-v[mini])*ans;
}
int main()
{
    scanf("%d", &N);
    for(int i=0; i<N; ++i)
        scanf("%lld%lld", v+(2*i), v+(2*i)+1);
    
    int minind = min_element(v, v+2*N) - v;
    int maxind = max_element(v, v+2*N) - v;
    long long ans = solve1(minind, maxind);
    if((minind^1) != maxind) ans = min(ans, solve2(minind, maxind));
    
    printf("%lld\n", ans);
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define N 1000005
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree < int, null_type, less_equal<int>,rb_tree_tag,tree_order_statistics_node_update >
signed main()
{
	ios_base::sync_with_stdio(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{   
		int n;
		cin >> n;
		ordered_set s;
		int ans = 0;
		int mn = INF;
		rep(i,0,n){
			int t;
			cin>>t;
			if(i==0 || mn>t){
				ans++;
			}
			mn= min(mn,t);
			// trace(ans,mn);
		}
		cout<<ans;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ii pair <int,int>
#define pl pair <ll,ll>
#define pll pair<pl,ll>
#define fr(i,x,y) for (int i=x;i<=y;i++)
#define ft(i,x,y) for (int i=y;i>=x;i--)
#define N 100005
#define x fi.fi
#define y fi.se
using namespace std ;
ll  dem,n,root[N],tim[N],answer;
pll a[N],E[2*N];
void inp(){
    // freopen("D_build.inp","r",stdin) ;
    // freopen("D_build.out","w",stdout);
     scanf("%lld",&n) ;
     fr(i,1,n)
      {
          scanf("%lld%lld",&a[i].x,&a[i].y) ;
          a[i].se = i ;
      }
}
int get_root(int u){
     if (root[u]!=u) root[u]=get_root(root[u]) ;
     return root[u] ;
}
void make_root(int u,int v){
     int ru = get_root(u) ;
     int rv = get_root(v) ;
     if (ru==rv) return ;
     if (ru>rv) swap(ru,rv) ;
     root[rv] = ru  ;
}
bool ss(pll a,pll b){
   if (a.y==b.y) return a.x<b.x ;
   return a.y<b.y ;
}
bool ss2(pll a,pll b){
    return a.se<b.se ;
}
void making_graph(){
    sort(E+1,E+dem+1,ss2);
    fr(i,1,dem){
        int ru = get_root(E[i].x) ;
        int rv = get_root(E[i].y) ;
        if (ru!=rv){
            answer+=E[i].se ;
            make_root(ru,rv) ;
        }
    }
}
void sub(){
     sort(a+1,a+n+1) ;
     fr(i,1,n) root[i]=i;
     fr(i,1,n-1){
         dem++ ;
         E[dem].x = a[i].se ;
         E[dem].y = a[i+1].se ;
         E[dem].se = a[i+1].x-a[i].x ;
     }
     sort(a+1,a+n+1,ss) ;
     fr(i,1,n-1){
         dem++ ;
         E[dem].x = a[i].se ;
         E[dem].y = a[i+1].se ;
         E[dem].se = a[i+1].y-a[i].y ;
     }
     making_graph() ;
     cout<<answer;
}
int main(){
    inp() ;
    sub() ;
}


Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long
#define ld long double
#define pii pair<int,int>
#define fi first
#define se second
#define mex 1000005
#define fast  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
vector<int> adj[mex];
		
int main(){
	int n;
	string s;
	cin>>n>>s;
	if(int(s.length())<=n)
	 cout<<s;
	else{
		for(int i=0;i<n;i++)
		 cout<<s[i];
		cout<<"...";
	}
  
}



Measured memory_bytes: 27064
A, B, C, X = int(input()), int(input()), int(input()), int(input())
cnt = 0
for n_500 in range(A + 1):
    for n_100 in range(B + 1):
        for n_50 in range(C + 1):
            if n_500 * 500 + n_100 * 100 + n_50 * 50 == X:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  size_t n; std::cin >> n;
  std::vector<int> a(n), x(n, 0);
  std::for_each(a.begin(), a.end(), [](auto& x){std::cin >> x;});
  for (size_t i = 0; i < n; i++) {
    x.at(0) += (i % 2 == 0 ? +1 : -1) * a.at(i);
  }
  for (size_t i = 1; i < n; i++) {
    x.at(i) = 2 * a.at(i - 1) - x.at(i - 1);
  }
  for (size_t i = 0; i < n; i++) {
    std::cout << (i > 0 ? " "  : "" ) << x.at(i);
  }
  std::cout << std::endl;
  return 0;
}

Measured memory_bytes: 2176
st = input()[::-1]
n = len(st)

arr = [0]*2019
arr[0] += 1
count = 0
dig = 1
r = 0

for i in range(0,n):
  r = (r + int(st[i]) * dig) % 2019
  arr[r] += 1
  dig = dig * 10 % 2019

for i in arr:
  count += i*(i-1)//2;

print(count)

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

int main()
{
    ll n , d;
    cin >> n >> d;
    ll cnt = 0;
    while(n--){
       ll x, y;
       cin >> x >> y;

       ll res;
       res = (x * x + y * y);
       ll ans;
       ans = d * d;

       if(res <= ans)
        cnt++;
    }
     cout << cnt <<endl;
     return 0;
}


Measured memory_bytes: 3636
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var I=0;
while(true){
   var nS=Arr[I].split(" ").map(Number);
   I++;
   var n=nS[0];
   var S=nS[1];
   if(n==0 && S==0)break;
   var arr=[];
   for(var i=0;i<n;i++){
      var r=Arr[I]-0;
      I++;
      arr.push(r);
   }
   arr.sort(function(a,b){return a-b;});
   var cnt=0;
   for(var i=0;i<n;i++){
      for(var j=i+1;j<n;j++){
         if(arr[i]+arr[j]>S){cnt+=n-j;break;}
      }
   }
   console.log(cnt);
}

Measured memory_bytes: 45440
#include<stdio.h>
#include<stdlib.h>
typedef struct{
  int par;
  int dep;
}node;

typedef struct{
  int id;
  int k;
  int *val;
}cnode;

int dep;

int getdep(node* T, int i){
  if(T[i].par == -1) return dep;
  dep++;
  return getdep(T, T[i].par);
}

void print(node T,cnode C){
  int i;
  printf("node %d: parent = %d, depth = %d, ",C.id,T.par,T.dep);

  if(T.par == -1) printf("root");
  else if(C.k == 0) printf("leaf");
  else printf("internal node");

  printf(", [");
  for(i=0;i<C.k;i++){
    printf("%d",C.val[i]);
    if(i != C.k-1) printf(", ");
  }
  printf("]\n");
}

int main(){
  node T[100000];
  cnode C[100000];
  int i,j,n;
  
  scanf("%d",&n);
  
  for(i=0;i<n;i++) T[i].par = -1;
  
  for(i=0;i<n;i++){
    scanf("%d%d",&C[i].id,&C[i].k);
  
     C[i].val = (int *)malloc(sizeof(int)*C[i].k);
      for(j=0;j<C[i].k;j++){
        scanf("%d",&C[i].val[j]);
        T[C[i].val[j]].par = C[i].id;
      }
  }

  for(i=0;i<n;i++){
    dep=0;
    T[i].dep = getdep(T,i);
  }

  for(i=0;i<n;i++){
    j=0;
    while(i!=C[j].id) j++;
    print(T[i],C[j]);

    free(C[j].val);
  }

  return 0;
}



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

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

  int F[45];
  F[0] = F[1] = 1;

  for (int i = 2; i <= N; ++i)
  {
    F[i] = F[i - 1] + F[i - 2];
  }

  cout << F[N] << endl;

  return 0;
}



Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    int s[M], c[M];
    for(int i = 0; i < M; i++){
        cin >> s[i] >> c[i];
    }

    char num[N];
    int check[N];
    for(int i = 0; i < N; i++){
        num[i] = '0';
        check[i] = 0;//non change
    }

    bool check2 = true;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < M; j++){
            if(s[j]-1 == i){
                if(check[i] != 0 && c[j] != num[i]-'0'){
                    check2 = false;
                }
                // cout << "input" << c[j] << endl;
                num[i] = '0' + c[j];
                check[i] = 1;
            }
            // cout << "i=" << i << "j=" <<j <<"num=" << num << endl;
        }
    }
    if(N != 1){
        if(num[0] == '0'){
            if(check[0] == 1){
                check2 = false;
            }else{
                num[0] = '1';
            }
        }
    }


    if(!check2){
        cout << -1 << endl;
    }else{
        cout << num << endl;

    }

}

Measured memory_bytes: 256
#include <stdio.h>

//１０個のデータを入力し、大きい順で３つのデータを取り出すプログラム

int main(void)
{
	int i, j;		//繰り返し変数
	int h[10];		//データ格納スペース
	int n = 0;			//一時変数
	int rank[3];	//順位付けしたデータを格納

	for (i = 0; i < 10; i++){
		scanf("%d", &h[i]);
	}
	for (j = 0; j < 3; j++){
		for (i = 0; i < 10; i++){
			if (h[n] < h[i]){
				n = i;
			}
		}
		rank[j] = h[n];
		h[n] = -1;
		n = 0;
	}

	printf("%d\n", rank[0]);
	printf("%d\n", rank[1]);
	printf("%d\n", rank[2]);

	return (0);
}

Measured memory_bytes: 1028
/**
 * @Author: Mingyu Li
 * @Date:   2019-02-24T19:53:08+08:00
 * @Email:  class11limingyu@126.com
 * @Filename: task.cpp
 * @Last modified by:   Mingyu Li
 * @Last modified time: 2019-02-24T20:07:18+08:00
 */

#include <bits/stdc++.h>
#define tpname typename
#define go(i , x , y) for(__typeof(x) i = x; i <= y; i++)
#define god(i , y , x) for(__typeof(y) i = y; i >= x; i--)
typedef long long LL;
typedef long double ld;
typedef unsigned long long ULL;
template < tpname T > void scan(T& t) {
  char c = getchar(); T x = 1; t = 0; while(!isdigit(c)) {if(c == '-') x = -1; c = getchar();}
  while(isdigit(c)) t = t * 10 + c - '0' , c = getchar();t *= x;
}
template < tpname T , tpname... Args > void scan(T& t , Args&... args) {scan(t); scan(args...);}
template < tpname T > T mul(T x , T y , T _) {
  x %= _,y %= _;
  return ((x * y - (T)(((ld)x * y + 0.5) / _) * _) % _ + _) % _;
}
using namespace std;

int pre[3] , now[3];
string s;
int main() {
  cin >> s;
  pre[0] = 2019; pre[1] = 4; pre[2] = 30;
  int p = 0;
  for(char x : s) {
    if(x == '/') {
      p++;
    }
    else now[p] = now[p] * 10 + x - '0';
  }

  for(int i = 0; i < 3; i++) {
    if(pre[i] != now[i]) {
      if(now[i] > pre[i]) {
        puts("TBD");
        return 0;
      }
    }
  }
  puts("Heisei");
  return 0;
}


Measured memory_bytes: 256
const main = input => {
  const number = parseInt(input.replace(' ', ''), 10)
  const square = Math.sqrt(number)
  if (square === parseInt(square, 10)) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

vector<vector<string>>boards={
{},{},{},
{
"aab",
"c.b",
"cdd"
},
{
"abcc",
"abdd",
"eefg",
"hhfg",
},
{
"abc..",
"abc..",
"deeff",
"d.ghh",
"iigjj"
},
{
"abc...",
"abc...",
"d.eeff",
"dghh..",
".g.ijj",
"kk.ill",
},
{
"abc....",
"abc....",
"def....",
"def....",
"g..hhii",
"g..jjkk",
".llmmnn",
}
};

int n;
char ans[2000][2000];

void print(int x,int y,int d){
	rep(i,d)rep(j,d){
		ans[x+i][y+j]=boards[d][i][j];
	}
}
void answer(){
	rep(i,n)printf("%s\n",ans[i]);
	exit(0);
}

int main(){
	cin>>n;
	if(n==2){puts("-1");return 0;}
	rep(i,n)rep(j,n)ans[i][j]='.';
	if(n==3){
		print(0,0,3);
		answer();
	}
	int x=0;
	while(1){
		if(n-x>=8){
			print(x,x,4);
			x+=4;
		}
		else{
			print(x,x,n-x);
			answer();
		}
	}
}

Measured memory_bytes: 3200
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;


int main(void){
  long N;
  cin >> N;
  string s, t;
  cin >> s;
  t = s;
  int count = 0;

  int flag = 1;
  while (true){
    START:
    if (t[count]  == '(') {
      	for(int j = count+1; j<t.size(); j++){
        	if (t[j] ==')') {
                t.erase(j, 1);
           		t.erase(count, 1);
           		goto START;
        	}
        }
      break;
  	}
    else {
      count += 1;
      if (count >t.size()) break;
    } 
    
  }
  if (t.size()>=1){
   for (int i = 0; i<t.size(); i++){
     if (t[i] == '(') s=s+')';
     else s = '(' + s;
   }
  } 
    
   cout << s << endl;
  
}

Measured memory_bytes: 256
///#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
///#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,popcnt,avx,avx2,tune=native")

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

/*
    zet:
        find_by_order(k): k-stat [k > 0]
        order_of_key(k) : {el < k}

    gp_hash_table<key, val, custom_hash>

    rope<T>:
        iterators: mutable_begin, ..
        methods  : erase, insert, substr, ..
*/

#define all(x) (x).begin(), (x).end()
#define size(x) (int)((x).size())
#define em_back emplace_back

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<typename T>
using zet = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

mt19937 eng(chrono::steady_clock::now().time_since_epoch().count());

ld x, p;

void solve() {
    cin >> x >> p;
    p /= 100;

    cout << setprecision(9) << fixed << int((x + 1) / 2) / p << "\n";
}

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

    int z = 1;
    /// cin >> z;

    while (z--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 3756
a,b,k = gets.split(" ").map!{|i| i.to_i}
if a+k-1 < b-k+1
  a.upto(a+k-1) do |j|
    puts j
  end
  (b-k+1).upto(b) do |l|
    puts l
  end
else a.upto(b) do |u|
    puts u
  end
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
int main() {
  char a[2];
  cin >> a[0] >> a[1];
  if (a[0] < a[1]) {
    cout << "<";
  } else if (a[0] > a[1]) {
    cout << ">";
  } else {
    cout << "=";
  }
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
string S[2020];
short L[1500][1500],R[1500][1500];
int dp[1500][1500];


void solve() {
	int i,j,k,l,r,x,y,x2,y2; string s;
	
	cin>>N;
	FOR(y,N) {
		cin>>S[y];
		FORR(c,S[y]) {
			if(c!='#') c-='0';
			else c=0;
		}
	}
	ll ret=0;
	for(y=N-1;y>=0;y--) {
		L[y][N]=N;
		R[y][N]=-1;
		for(x=N-1;x>=0;x--) {
			int down=(y<N-1) && (S[y+1][x]>0);
			int right=(x<N-1) && (S[y][x+1]>0);
			
			if(S[y][x]==0) {
				for(y2=y;y2<N;y2++) {
					L[y][x]=N;
					R[y][x]=-1;
				}
			}
			else {
				dp[y][x]=dp[y+1][x]+dp[y][x+1];
				L[y][x]=x;
				if(down&&right) {
					R[y][x]=R[y][x+1];
					
					int r=0;
					for(y2=y+1;y2<N;y2++) {
						if(L[y2][x+1]<=R[y2][x] && r<L[y2][x+1]) {
							dp[y][x]-=dp[y2][L[y2][x+1]];
						}
						r=R[y2][x];
						R[y2][x]=max(R[y2][x],R[y2][x+1]);
						L[y2][x]=min(L[y2][x],L[y2][x+1]);
					}
				}
				else if(down) {
					R[y][x]=x;
				}
				else if(right) {
					R[y][x]=R[y][x+1];
					for(y2=y+1;y2<N;y2++) {
						L[y2][x]=L[y2][x+1];
						R[y2][x]=R[y2][x+1];
					}
				}
				else {
					R[y][x]=x;
					for(y2=y+1;y2<N;y2++) {
						L[y2][x]=N;
						R[y2][x]=0;
					}
				}
				ret+=S[y][x]*dp[y][x];
				dp[y][x]+=S[y][x];
			}
		}
	}
	
	
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 12800
#include <bits/stdc++.h>
typedef unsigned long long ll;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
typedef std::vector<long long > vi ;
#define F first
#define S second
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define PB push_back
#define MP make_pair
#define PI 3.14159265358979323846
#define all(a) a.begin(),a.end()
#define mx(a) *max_element(all(a))
#define mn(a) *min_element(all(a))
#define endl '\n'
#define show(a) for(auto el:a)cout<<el<<" "
const ll INF=LLONG_MAX/2;
const ll N=2e5+1;
#define yesno(f) yes(f);no(f);
#define yes(f) if(f)cout<<"YES\n";
#define no(f) if(!f)cout<<"NO\n";
using  namespace std;
ll pow1(ll n,ll p)
{
	if(p==0)	return 1;
	ll x=pow1(n, p/2);
	x=(x*x)%mod;
	if(p%2==0)
		return x;
	else
		return (x*n)%mod;
}
int main()
{
    fast;
   ll t=1;
   //std::cin >> t;
   while(t--)
   {
       ll s;
       std::cin >> s;
       ll dp[2001]={0};
       fr(i,6,2001)
       dp[i]=1;
       dp[1]=0,dp[2]=0,dp[3]=1,dp[4]=1,dp[5]=1;
       fr(i,6,s+1)
       {
           rf(j,i,3)
           {
               dp[i]=(dp[i]+dp[i-j])%mod;
           }
       }
       cout<<dp[s]<<"\n";
   }
}

Measured memory_bytes: 3660
#include<iostream>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

class position{
public:
	int x,y;
};

int main(){
	int a,b,n;
	while(1){
		cin>>a>>b;
		if(!a && !b)break;
		int dt[a][b];
		cin>>n;
		position error[n];
		rep(i,n){
			int ax,ay;
			cin>>ax>>ay;
			error[i].x=ax-1;
			error[i].y=ay-1;
		}
		int dirx[2]={1,0};
		int diry[2]={0,1};
		queue<position> que;
		position start;
		start.x=0;
		start.y=0;
		que.push(start);
		long long ans=0;
		while(!que.empty()){
			position now=que.front();
			que.pop();
			position next;
			rep(i,2){
				next.x=now.x+dirx[i];
				next.y=now.y+diry[i];
				int cnt=0;
				if(next.x==a-1 && next.y==b-1){//????????°????????????
					ans++;
					continue;
				}
				rep(j,n){//??\????????´????????????
					if(next.x==error[j].x && next.y==error[j].y){
						cnt++;
					}
				}
				if(cnt==0 && next.x<a && next.x>=0 && next.y>=0 && next.y<b ){//??????????????£??????????????\????????´??????????????£????????????
					que.push(next);
				}
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

class Program
{
  static void Main(string[] args)
  {
    var hw = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList();
    var h = hw[0];
    var w = hw[1];
    var s = new List<string>();
    for (int i = 0; i < h; i++) {
        s.Add(Console.ReadLine().Trim());
    }
    var dw = new List<List<int>>();
    var dh = new List<List<int>>();
    for (int i = 0; i < h; i++) {
      var cw = new List<int>();
      var count = 0;
      for (int j = 0; j < w; j++) {
        if (s[i][j] == '#') {
          cw.Add(0);
        }
        else if (j == 0 || s[i][j - 1] == '#') {
          count = 0;
          for (int k = j; k < w; k++) {
            if (s[i][k] == '.') {
              count++;
            }
            else {
              break;
            }
          }
          cw.Add(count);
        }
        else {
          cw.Add(count);
        }
      }
      dw.Add(cw);
    }
    for (int j = 0; j < w; j++) {
      var ch = new List<int>();
      var count = 0;
      for (int i = 0; i < h; i++) {
        if (s[i][j] == '#') {
          ch.Add(0);
        }
        else if (i == 0 || s[i - 1][j] == '#') {
          count = 0;
          for (int k = i; k < h; k++) {
            if (s[k][j] == '.') {
              count++;
            }
            else {
              break;
            }
          }
          ch.Add(count);
        }
        else {
          ch.Add(count);
        }
      }
      dh.Add(ch);
    }
    var max = 0;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        var sum = dw[i][j] + dh[j][i];
        if (max < sum) {
          max = sum;
        }
      }
    }
    Console.WriteLine(max - 1);
  }
}


Measured memory_bytes: 78368
n = int(input())
flst = []
for _ in range(n):
  flst.append(int(''.join(input().split()), 2))
plst = []
for _ in range(n):
  plst.append([int(i) for i in input().split()])
m = - 1 << 30
for i in range(1, 1 << 10):
  r = 0
  for j in range(n):
    s = i & flst[j]
    c = 0
    while s:
        s &= s - 1
        c += 1
    r += plst[j][c]
  m = max(m, r)
print(m)

Measured memory_bytes: 3064
/*
h s, d't skp th si tll i's sved
 * ABC141 E
 * ABC145 D
 * ABC147 F
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
string s,t;
cin>>s>>t;
int a,b;
cin>>a>>b;
string u;
cin>>u;
if(u==s)
{
cout<<a-1<<" "<<b<<endl;
}
else
{
cout<<a<<" "<<b-1;
}
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#define NMAX (100000)
using namespace std;

int main(void) {
	
	int n;
	int a[NMAX];
	cin >> n;

	
	for(int i=0; i<n; i++) {
		cin >> a[i];
	}
	sort(a, a+n);
	int nMax = a[n-1];
	int r = a[0];

	for(int i=0; i<n-1; i++) {
		if(abs(((nMax+1)/2) - r) > abs(((nMax+1)/2) - a[i])) {
			r = a[i];
		}
	}
	cout << nMax << ' ' << r;

	return 0;
}

Measured memory_bytes: 768
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 10;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions 

#endif



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

    string S; cin >> S;
    int N = S.size();

    stack<char> st;
    st.push(S[0]);
    FOR(i,1,N) {
        if (st.size()>0 && st.top() != S[i]) {
            st.pop();
        } else {
            st.push(S[i]);
        }
    }

    int ans = N - st.size();

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,f;
    cin>>n>>f;
    int ar[n];
    for(int i=0; i<n; i++)cin>>ar[i];
    sort(ar,ar+n);
    int s = 0;
    for(int i=0; i<f; i++)s+=ar[i];
    cout<<s;
}


Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
typedef long long ll;

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    ll diff = b - a;
    if (diff % 2 == 0)cout << diff / 2 << endl;
    else cout << min(a - 1, n - b) + 1 + diff / 2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a[5];
  for(int i=0;i<5;i++){
    cin>>a[i];
  }
  for(int i=0;i<5;i++){
    if(a[i]==0){
      cout<<i+1;
    }
  }
  return 0;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_HW = 23;
char maze[MAX_HW][MAX_HW];
bool visit[MAX_HW][MAX_HW];
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};
int H,W;

void init()
{
	rep(i,MAX_HW)
	{
		rep(j,MAX_HW)
		{
			visit[i][j] = false;
		}
	}
}

int bfs(int m, int n) //m行n列をスタートにした時の最大距離
{
	init();
	int ans = 0;
	queue< pair<P, int> > Q;
	pair<P, int> Pa;
	Pa.first = P(m,n);
	Pa.second = 0;
	Q.push(Pa);
	visit[m][n] = true;
	while(!Q.empty())
	{
		pair<P, int> now = Q.front();
		Q.pop();
		int nowm = now.first.first, nown = now.first.second, d = now.second;
		rep(i,4)
		{
			int nextm = nowm+dx[i], nextn = nown+dy[i];
			if (maze[nextm][nextn] == '.' && visit[nextm][nextn] == false && nextm >= 0 && nextm < H && nextn >= 0 && nextn < W)
			{
				visit[nextm][nextn] = true;
				ans = max(ans,d+1);
				pair<P, int> Pa2;
				Pa2.first = P(nextm,nextn);
				Pa2.second = d+1;
				Q.push(Pa2);
			}
		}
	}
	return ans;
}

int main()
{
	cin >> H >> W;
	rep(i,H)
	{
		rep(j,W)
		{
			cin >> maze[i][j];
		}
	}

	int ans = 0;
	rep(i,H)
	{
		rep(j,W)
		{
			//cout << i << " " << j << " " << bfs(i,j) << endl;
			if (maze[i][j] == '.') ans = max(ans,bfs(i,j));
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

const int MAX_HW = 1010;
ll sum[MAX_HW][MAX_HW];

ll getSum(int y1, int y2, int x1, int x2) {
    y1--;
    x1--;
    return sum[y2][x2] - sum[y1][x2] - sum[y2][x1] + sum[y1][x1];
}

void calcSum2D(int H, int W) {
    for(int i = 1; i <= H; i++) {
        for(int j = 0; j <= W; j++) {
            sum[i][j] += sum[i-1][j];
        }
    }
    for(int i = 0; i <= H; i++) {
        for(int j = 1; j <= W; j++) {
            sum[i][j] += sum[i][j-1];
        }
    }
}

int main(){
#ifdef LOCAL_TEST
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    int n, k;
    cin >> n >> k;
    vi X(n), Y(n);
    rep(i, n) cin >> X[i] >> Y[i];
    map<int, int> mpX, mpY;
    rep(i, n) {
        mpX[X[i]] = 0;
        mpY[Y[i]] = 0;
    }
    int cntX = 0, cntY = 0;
    for(auto& p : mpX) p.se = ++cntX;
    for(auto& p : mpY) p.se = ++cntY;
    rep(i, n) {
        int x = mpX[X[i]], y = mpY[Y[i]];
        sum[y][x]++;
    }
    // for(auto& p : mpX) {
    //     cout << "(" << p.fi << ", " << p.se <<") " << endl;
    // }
    // cout << endl;
    // for(auto& p : mpY) {
    //     cout << "(" << p.fi << ", " << p.se <<") " << endl;
    // }
    // cout << endl;
    int H = cntY, W = cntX;
    calcSum2D(H, W);
    ll ans = 8e18;
    for(const auto& px1 : mpX) for(const auto& py1 : mpY) {
        for(const auto& px2 : mpX) for(const auto& py2 : mpY) {
            int cnt = getSum(py1.se, py2.se, px1.se, px2.se);
            if(cnt < k) continue;
            ans = min(ans, (ll)abs(py2.fi - py1.fi) * abs(px2.fi - px1.fi));
            // cout << py2.fi << " " << py1.fi << " " << px2.fi << " " << px1.fi << " " << cnt << endl;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  int A;
  A = N;
  
  int total = 0;
  while ( N / 10 > 0 ){
    total += N % 10;
    N /= 10;
  }
  total += N;
  
  if( A % total == 0 ) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  
}


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

using namespace std;

int dp[1003][1003];

int hell = 1000000007;
int movx[] ={1,0};
int movy[] = {0,1};
int n,m;
char mat[1003][1003];
bool isSafe(int i , int j){
        
    if(i>=0 && i<n && j>=0 && j<m && mat[i][j]=='.')return 1;
    return 0;
}

int fun(int i , int j ){
    
    if(i==n-1 and j ==m-1) return 1;
    
    if(dp[i][j]!=-1)return dp[i][j];
    int ans = 0;
    for(int x=0;x<2;x++){
        if(isSafe(i+movx[x],j+movy[x])){
            ans+=fun(i+movx[x],j+movy[x]);
            ans%=hell;
        }
    }
    return dp[i][j]=ans;
}

int main(){
    
    cin>>n>>m;
    for(int i =0;i<n;i++)
        for(int j=0;j<m;j++)cin>>mat[i][j],dp[i][j]=-1;
        
    cout<<fun(0,0)<<endl;
    return 0;
}

Measured memory_bytes: 5248
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	LP p[200000];
	ll w, h; cin >> w >> h;
	ll c1 = 0; ll c2 = 0;
	rep(i, w) {
		ll x; cin >> x;
		p[i] = { x,0 };
	}
	rep(i, h) {
		ll x; cin >> x;
		p[i + w] = { x,1};
	}
	sort(p, p + h + w);
	ll sum = 0;
	rep(i, h + w) {
		if (p[i].second == 0) {
			sum += p[i].first*(h + (ll)1 - c2);
			c1++;
		}
		else {
			sum += p[i].first*(w + (ll)1 - c1);
			c2++;
		}
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 3328
import java.util.*;

public class Main {

    static ArrayList<Integer> divisor(int x) {
        ArrayList<Integer> ans = new ArrayList<Integer>();
        for (int i=1;i*i<=x;i++) {
            if (x%i==0) ans.add(i);
            if (x%i==0 && i*i!=x) ans.add(x/i);
        }
        Collections.sort(ans);
        return ans;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());
        int[] A = new int[N];
        int sum = 0;
        for (int i=0;i<N;i++) {
            A[i] = Integer.parseInt(sc.next());
            sum += A[i];
        }
        ArrayList<Integer> list = divisor(sum);
        for (int i=list.size()-1;i>=0;i--) {
            int tmp = list.get(i);
            int[] B = new int[N];
            for (int j=0;j<N;j++) {
                B[j] = A[j]%tmp;
            }
            Arrays.sort(B);
            int right = N-1;
            long cnt = 0L;
            for (int j=0;j<N;j++) {
                if (j>right) break;
                int val = B[j];
                cnt += val;
                // System.out.println(tmp+" "+Arrays.toString(B));
                while (val>0) {
                    if (j==right) break;
                    if (tmp-B[right]>val) {
                        B[right]+=val;
                        val-=val;
                    } else { //  tmp-B[right]<=val
                        val-=tmp-B[right];
                        B[right]+=tmp-B[right];
                        right--;
                    }
                }
            }
            if (cnt<=K) {
                System.out.println(tmp);
                return;
            }
        }
    }
}

Measured memory_bytes: 28280
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] ans = new int[n];
        for(int x=1; x<=100; x++) {
            for(int y=1; y<=100; y++) {
                for(int z=1; z<=100; z++) {
                    int f = x*x + y*y + z*z + x*y + y*z + z*x;
                    if(f>n) {
                        break;
                    }
                    ans[f-1]++;
                }
            }
        }
        for(int i=0; i<n; i++) {
            System.out.println(ans[i]);
        }
    }
}


Measured memory_bytes: 38908
#include <iostream>
 
using namespace std;
 
int main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int x;
  cin >> x;
  if (x == 0)
    cout << 1 << '\n';
  
  else if (x == 1)
    cout << 0 << '\n';
    
}

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

#define hi(x) ((x)>>16)
#define lo(x) ((x)&0xffff)

struct comp{
    bool operator()(const unsigned a, const unsigned b){return hi(a)*lo(a) < hi(b)*lo(b);}
};

int main(){
	int n,w,d;
	for(;scanf("%d%d%d",&n,&w,&d),w;puts("")){
		vector<unsigned> v;
		v.push_back((w<<16)+d);
		for(;n--;){
			int p,s,state=0;
			scanf("%d%d",&p,&s);p--;
			s%=hi(v[p])+lo(v[p]);
			unsigned x=hi(v[p]),y=lo(v[p]),_x=0,_y=0;
			for(;s--;)
				if(state==0){_x++;if(_x==x)state=1;}else _y++;
			unsigned x1, x2, y1, y2;
			if(state==0)x1=_x,x2=x-_x,y1=y2=y;
			else x1=x2=x,y1=_y,y2=y-_y;

			v.erase(v.begin()+p);
			if(x1*y1>x2*y2){
				v.push_back((x2<<16)+y2);
				v.push_back((x1<<16)+y1);
			}else{
				v.push_back((x1<<16)+y1);
				v.push_back((x2<<16)+y2);
			}
		}

		sort(v.begin(), v.end(), comp());
		for(;v.size();){
			printf("%d", hi(v[0])*lo(v[0]));
			v.erase(v.begin());
			if(v.size())printf(" ");
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;            //

int main(void)
{
    int N, M;
    cin >> N >> M;

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

    sort(A.begin(), A.end(), greater<int>());
    int counter = 0;
    for (int i = 0; i < A.size(); i++)
    {
        // printf("%d ", A[i]);
        if (A[i] * 4 * M >= sum)
        {
            // printf("%d > sum\n", A[i], sum);
            counter++;
        }
    }
    if (counter >= M)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return (0);
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  double R;
  cin >> R;
  double pi = 3.1415926535;
  cout << 2.0 * pi * R << endl;
  return 0;
}


Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  FOR(i, 1, n) ans += i;
  cout << ans << endl;

  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 long long ll;

int main(){
	string s;
	cin>>s;
	
	int cnt=0;
	for(int i=0; i<3; i++){
		if(s[i]=='1') cnt++;
	}
	
	cout << cnt << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N;
  cin >> N;
  int l = 0;
  int r = N-1;
  vi seat(N,-1);
  cout << l << endl << flush;
  string s;
  cin >> s;
  if(s == "Vacant") {
    return 0;
  }
  seat[l] = s == "Male";
  cout << r << endl << flush;
  cin >> s;
  if(s == "Vacant") {
    return 0;
  }
  seat[r] = s == "Male";
  while(1) {
    int m = (l+r)/2;
    cout << m << endl << flush;
    cin >> s;
    if(s == "Vacant") return 0;
    bool male = s == "Male";
    seat[m] = male;
    if((seat[l] && male) || (!seat[l] && !male)) {
      if((m-l)%2 != 0) {
        r = m;
        continue;
      }
    }
    if((seat[l] && !male) || (!seat[l] && male)) {
      if((m-l)%2 == 0) {
        r = m;
        continue;
      }
    }
    if((seat[r] && male) || (!seat[r] && !male)) {
      if((r-m)%2 != 0) {
        l = m;
        continue;
      }
    }
    if((seat[r] && !male) || (!seat[r] && male)) {
      if((r-m)%2 == 0) {
        l = m;
        continue;
      }
    }
    
  }
  return 0;
}

Measured memory_bytes: 1236
/**
 *      purpose : Tenka1 Programmer Contest C
 *      author  : kyomukyomupurin
 *      created : 2018-11-13 02:56:04
**/

#include <bits/stdc++.h>
using namespace std;
#define int64 long long
#define print(x) cout << (x) << '\n'

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

    for (int i = 1; i <= 3500; ++i){
        for (int j = 1; j <= 3500; ++j){
            if (4 * i * j - N * i - N * j <= 0) continue;
            if ((N * i * j) % (4 * i * j - N * i - N * j) == 0 && (int64) (N * i * j) / (4 * i * j - N * i - N * j) > 0){
                cout << i << " " << j << " " << (int64) (N * i * j) / (4 * i * j - N * i - N * j) << '\n'; return 0;
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 256
void main() {
	auto ip = readAs!(int[]), A = ip[0], B = ip[1];
	writeln(A <= 5 ? 0 : A < 13 ? B/2 : B);
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

Measured memory_bytes: 256
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    a, b, k = map(int, input().split())
    cnt = 0
    for i in range(min(a,b), 0, -1):
        if a%i==0 and b%i==0:
            cnt += 1
        if cnt == k:
            print(i)
            return
        
if __name__ == '__main__':
    main()


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

typedef vector<int> vi;

const int SHIFT = 12;
const int MASK = 0x0fff;
const int dx[4] = {  0, 1, 0, -1 };
const int dy[4] = { -1, 0, 1,  0 };

int H, W;
int ans = 0;
vector<vi> M;
queue<int> Q;

void input_init(void) {
	cin >> H >> W;
	M.resize(H + 2, vi(W + 2, -1));
	string S;
	for (int i = 0; i <= W + 1; ++i)
		M[0][i] = M[H + 1][i] = 0;
	for (int j = 1; j <= H; ++j) {
		M[j][0] = M[j][W + 1] = 0;
		cin >> S;
		for (int i = 1; i <= W; ++i) {
			if (S[i - 1] == '#') {
				M[j][i] = 0;
				int yx = (j << SHIFT) | i;
				Q.push(yx);
			}
		}
	}
}

void solve(void) {
	while (!Q.empty()) {
		int yx = Q.front();
		Q.pop();
		int x = yx & MASK;
		int y = (yx >> SHIFT);
		for (int k = 0; k < 4; ++k) {
			int x2 = x + dx[k];
			int y2 = y + dy[k];
			if (M[y2][x2] == -1) {
				yx = (y2 << SHIFT) | x2;
				Q.push(yx);
				M[y2][x2] = M[y][x] + 1;
				if (M[y2][x2] > ans)
					ans = M[y2][x2];
			}
		}
	}
}

int main(void) {
	input_init();
	solve();

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 8320
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let n: usize = s.next().unwrap().parse().unwrap();
	let k: usize = s.next().unwrap().parse().unwrap();
	if k > (n - 1) * (n - 2) / 2 {
		println!("-1");
	} else {
		let mut edge = vec![];
		for i in 2..=n {
			edge.push((1, i));
		}
		let mut left = (n - 1) * (n - 2) / 2 - k;
		if left > 0 {
			'a: for i in 2..=n - 1 {
				for j in i + 1..=n {
					edge.push((i, j));
					left -= 1;
					if left == 0 {
						break 'a;
					}
				}
			}
		}
		use std::io::Write;
		let out = std::io::stdout();
		let mut out = std::io::BufWriter::new(out.lock());
		writeln!(out, "{}", edge.len()).unwrap();
		for (a, b) in edge {
			writeln!(out, "{} {}", a, b).unwrap();
		}
	}
}


Measured memory_bytes: 2164