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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}


ll tax(double a,double b, double r){
  a *= double((100+r)/100);
  b *= double((100+r)/100);
  debug(a);
  debug(b);
  a = (int)(a);
  b = (int)(b);
  return a+b;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  double x,y,s;
  while(cin >> x >> y >> s && x && y && s){
    vector<ll> v;
    double r = (100+x)/100,r2 = (100+y)/100;
    REP(i,1,s){
      double a,b;
      int f = 0;
      for(int j = 0; j <i+1;++j ){
        if(floor(r * j +eps)== i){
          a = floor(j*r2+eps);
//           cout << i<< "j:" << j<<":"<<a<<endl;
          ++f;
          break;
        }
      }
      for(int j = 0; j < s-1; ++j ){
        if(floor(r * j+eps) == s-i){
          b = floor(j*r2+eps);
//           cout << j << ":"<<b<<endl;
          ++f;
          break;
        }
      }
      if(f == 2){
        ll ans = a+b;
//         cout << ans<<endl;
        v.pb(ans);
      }
    }
    cout << *max_element(all(v))<<endl;
  }
  return 0;
}

Measured memory_bytes: 3296
//@winlere
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>

using namespace std;  typedef long long ll;   
inline int qr(){
      register int ret=0,f=0;
      register char c=getchar();
      while(!isdigit(c)) f|=c==45,c=getchar();
      while(isdigit(c)) ret=ret*10+c-48,c=getchar();
      return f?-ret:ret;
}

const ll inf=1e18;
const int maxn=1e5+5;
vector< vector< pair<int,int> > > e;
vector< pair<int,pair<int,int> > > edge;
typedef pair<int,int> P;
P node[maxn],sav[maxn];
int siz[maxn],n;
int spc[maxn],sum;
int d[maxn];
ll ans;

inline void add(const int&fr,const int&to,const int&w){
      e[fr].push_back({to,w}),e[to].push_back({fr,w});
      edge.push_back({w,{fr,to}});
}

void dfs(const int&now,const int&last){
      d[now]=d[last]+1;
      siz[now]=1;
      for(auto t:e[now])
	    if(t.first^last)
		  dfs(t.first,now),siz[now]+=siz[t.first];
}


inline void calc(){
      for(auto t:edge){
	    int u=t.second.first,v=t.second.second;
	    if(d[u]>d[v])swap(u,v);
	    ans+=2ll*siz[v]*t.first;
      }
}

int rt,val=1e9;
void pre(const int&now){
      siz[now]=1;
      int spc=0;
      for(auto t:e[now])
	    if(!siz[t.first])
		  pre(t.first),siz[now]+=siz[t.first],spc=max(spc,siz[t.first]);
      spc=max(spc,n-siz[now]);
      if(val>spc||(val==spc&&now>rt)) val=spc,rt=now;
}

int main(){
      sum=n=qr();
      e.resize(n+1);
      for(int t=1,t1,t2,t3;t< n;++t)
	    t1=qr(),t2=qr(),t3=qr(),add(t1,t2,t3);
      pre(1);
      for(int t=1;t<=n;++t) siz[t]=0;
      dfs(rt,0);
      calc();
      if(((n&1)^1)&& val==(n>>1) ){
	    for(auto t:e[rt])
		  if(siz[t.first]==(n>>1))
			ans-=0ll+t.second;
	    printf("%lld\n",ans);
      }
      else{
	    ll Min=inf;
	    for(auto t:e[rt])
		  Min=min(Min,0ll+t.second);
	    ans-=Min;
	    printf("%lld\n",ans);
      }
      return 0;
}



Measured memory_bytes: 12980
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  string ans="No";
  for(int i=0;i<26;i++){
    for(int j=0;j<15;j++){
      if(4*i+7*j==N){
        ans="Yes";}
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
s = list(input())
odd = ['R', 'U', 'D']
even = ['L', 'U', 'D']
ret = 'Yes'
for i, j in enumerate(s):
    if (i+1)%2 == 1 and j not in odd:
        ret = 'No'
        break
    elif (i+1)%2 == 0 and j not in even:
        ret = 'No'
        break
print(ret)

Measured memory_bytes: 61888
#include <math.h>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;

int main()
{
int n;
cin >> n;
while(n!=0)
{
vector<double> s(n);
double sum=0;
double sumr=0;
for(int i=0;i<n;i++){cin >> s.at(i);sum+=s.at(i);}
double m=sum/n;
for(int i=0;i<n;i++){sumr+=(s.at(i)-m)*(s.at(i)-m);}
double ans=pow(sumr/n,0.5);
cout << fixed << setprecision(7) << ans << endl;
cin >> n;
}
}




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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;

constexpr int MOD = 1000000007;

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

    int n, m;
    cin >> n >> m;
    cout << (n == m ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
class program{
    public static void Main(){
        int n = int.Parse(Console.ReadLine());
        int counter1 = 1, counter10 = 1, counter100 = 1, counter1000 = 1;
        bool flag = true;
        for (int i=1; i<=n; i++){
            flag = true;
            if(counter1000 == 3000){
                for(int j=0; j<1000&&i<=n; j++){
                    Console.Write(" {0}",i);
                    if(j != 999){
                        counter1++;
                        counter10++;
                        counter100++;
                        counter1000++;
                        counter1 = counter1%10;
                        counter10 = counter10%100;
                        counter100 = counter100%1000;
                        i++;
                    }
                }
                flag = false;
            }
            
            else if(counter100 == 300 && flag){
                for(int j=0; j<100&&i<=n; j++){
                    Console.Write(" {0}",i);
                    if(j != 99){
                        counter1++;
                        counter10++;
                        counter100++;
                        counter1000++;
                        counter1 = counter1%10;
                        counter10 = counter10%100;
                        counter100 = counter100%1000;
                        i++;
                    }
                        
                }
                flag = false;
            }
            
            else if(counter10 == 30 && flag){
                for(int j=0; j<10 && i<=n; j++){
                    Console.Write(" {0}",i);
                    if(j != 9){
                        counter1++;
                        counter10++;
                        counter100++;
                        counter1000++;
                        counter1 = counter1%10;
                        counter10 = counter10%100;
                        counter100 = counter100%1000;
                        i++;
                    }
                }
                flag = false;
            }
            
            else if(counter1 == 3 && flag){
                Console.Write(" {0}",i);
                flag = false;
            }
            
            else if(i%3==0 && flag){
                Console.Write(" {0}",i);
            }
            counter1++;
            counter10++;
            counter100++;
            counter1000++;
            counter1 = counter1%10;
            counter10 = counter10%100;
            counter100 = counter100%1000;
        }
        Console.WriteLine("");
    }
}


Measured memory_bytes: 17896
#include<iostream>
#include<vector>
#include<string>

using namespace std;

struct data{
    char c;
    int d;
};

void BubbleSort(data a[],int n){
    int i=0,flag=1;
    while(flag){
        flag=0;
        data temp;
        for(int j=0;j<n-i-1;j++){
            if(a[j].d>a[j+1].d){
                flag=1;
                temp=a[j];
                a[j]=a[j+1];
                a[j+1]=temp;
            }
        }
    }
}

void SelectSort(data a[],int n){
    int k,j;
    for(int i=0;i<n;i++){
        k=i;
        for(j=i+1;j<n;j++){
            if(a[j].d<a[k].d) k=j;
        }
        if(k!=i){
            data temp=a[i];
            a[i]=a[k];
            a[k]=temp;
        }
    }
}

bool isSame(data a[],data b[],int n){
    for(int i=0;i<n;i++){
        if(a[i].c!=b[i].c) return false;
    }
    return true;
}

int main(){
    int n,k;
    char c;
    string s;
    data a[37],b[37];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        b[i].c=a[i].c=s[0];
        b[i].d=a[i].d=s[1]-48;

    }
    BubbleSort(a,n);
    for(int i=0;i<n;i++){
        if(i) cout<<' ';
        cout<<a[i].c<<a[i].d;
    }
    cout<<endl<<"Stable"<<endl;

    SelectSort(b,n);
   for(int i=0;i<n;i++){
        if(i) cout<<' ';
        cout<<b[i].c<<b[i].d;
    }
    if(isSame(a,b,n))
        cout<<endl<<"Stable"<<endl;
    else
        cout<<endl<<"Not stable"<<endl;

    return 0;

}



Measured memory_bytes: 3164
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  string S;
  cin >> N >> S >> K;
  char a = S.at(K - 1);
  for(char b : S){
    if(a == b)cout << a;
    else cout << '*';
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
#ifdef DEBUG
	printf("");
#endif

	int a, b, c;
	int min1;
	int min2;
	
	scanf("%d %d %d", &a, &b, &c);
	if (a <= b) {
		min1 = a;
		min2 = b;
	}
	else {
		min1 = b;
		min2 = a;
	}

	if (min2 > c) {
		min2 = c;
	}

	printf("%d\n", min1 + min2);

	return 0;
}



Measured memory_bytes: 128
// AtCoder ABC124: C - Coloring Colorfully
// 2019.9.9 bal4u

#include <stdio.h>

#if 1
int getchar_unlocked(void);
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif

void ins(char *s) { // 文字列の入力　スペース以下の文字で入力終了
	do *s = gc();
	while (*s++ > ' ');
	*(s-1) = 0;
}

char S[100005];

int main()
{
	int c, a1, a2;
	char *s;
	
	ins(s = S);
	c = 0, a1 = a2 = 0;
	while (*s) {
		if ((*s & 0xf) == c) a2++; else a1++;
		s++, c = !c;
	}
	if (a1 > a2) a1 = a2;
	printf("%d\n", a1);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	long long x, y;
	cin >> x >> y;
	if (x % y == 0) cout << -1 << endl;
	else cout << x << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
#include<vector>
#include<cmath>
#include<algorithm>
#include<cstdio>

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

#define X real()
#define Y imag()

typedef long double D;
typedef complex<D> P;

// 内積
D dot(P a, P b) {return a.X * b.X + a.Y * b.Y;}
// 外積
D cross(P a, P b) {return a.X * b.Y - a.Y * b.X;}

D aTri(D a, D b, D c){
  D s = (a + b + c) / 2;
  return sqrt(max(s * (s - a) * (s - b) * (s - c), (D)0));
}

P circumscribedCircleCenter(P a, P b, P c) {
  P bc = c - b, ca = a - c, ab = b - a;
  return (b + c - bc * P(0, 1) * dot(ca, ab) / cross(ca, ab)) / (D)2;
}

D circumscribedCircleRadius(D a, D b, D c) {return a * b * c / (4 * aTri(a, b, c));}

int main() {
  int n;
  cin >> n;
  rep (i, n) {
    P a, b, c;
    cin >> a.X >> a.Y >> b.X >> b.Y >> c.X >> c.Y;
    P p = circumscribedCircleCenter(a, b, c);
    D r = circumscribedCircleRadius(abs(a - b), abs(b - c), abs(c - a));
    printf("%.3Lf %.3Lf %.3Lf\n", p.X, p.Y, r);
  }
  return 0;
}

Measured memory_bytes: 1268
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

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

	unordered_map<string, int> cnt;

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

	cout << "AC x " << cnt["AC"] << endl;
	cout << "WA x " << cnt["WA"] << endl;
	cout << "TLE x " << cnt["TLE"] << endl;
	cout << "RE x " << cnt["RE"] << endl;

	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define out(S) cout<<(S)<<endl;
#define ShowAll(collection) for(auto i:collection){out(i);}
#define beginend(v) v.begin(),v.end()

using pii=pair<int,int>;
using vb=vector<bool>;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vvc=vector<vector<char>>;
using ti3=tuple<int,int,int>;
template<typename T> void removeAt(vector<T>& v, int index) { v.erase(v.begin() + index); }
#define OCB(c) (c&1)|(c&2)<<2|(c&4)<<4|(c&8)<<6|(c&16)<<8|(c&32)<<10|(c&64)<<12|(c&128)<<14

//dp[i]=iで表せるステージをクリアしたときの最小の攻略時間
int dp[1<<16];

int solve(int n){
  vvi t(n,vi(n+1,0));
  rep(i,n) rep(j,n+1) cin>>t[i][j];
  rep(i,(1<<n)) dp[i]=1e9;

  dp[0]=0;

  rep(bit,1<<n){
    rep(j,n) if(!((bit>>j)&1)) {
      int ns=bit|(1<<j);
      int nc=t[j][0];
      rep(k,n) if((bit>>k)&1) nc=min(nc,t[j][k+1]);
      nc+=dp[bit];
      dp[ns]=min(nc,dp[ns]);
    }
  }
  
  return dp[(1<<n)-1];
}

int main(){
  int n;
  while(cin>>n,n){
    out(solve(n));
  }
}



Measured memory_bytes: 3412
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int k=nxt(),x=nxt(),y=nxt();
    bool xn=0,yn=0;
    if(x<0){
        x=-x;
        xn=1;
    }
    if(y<0){
        y=-y;
        yn=1;
    }
    if(k%2==0&&(x+y)%2)
    {
        cout<<"-1\n";
        return 0;
    }
    ll n = (x + y +k-1)/k;
    if (n == 1 && (x+y) != k) n++;
    while ((n*k-x-y)%2 != 0) n++;
    cout<<n<<endl;

    ll a=(n*k+x+y)/2;
    ll b=(n*k-x-y)/2;
    vector <pair<int,int> > test;
    int X=x;
    int Y=y;
    x=0;y=0;

    //cout<<a<<" "<<b<<endl;
    while(b>=k)
    {
        if(X-x<=Y-y)
        {
                x-=k;
                b-=k;
                test.push_back({x,y});
           
        }
        else
        {
              y-=k;
                b-=k;
                test.push_back({x,y});
        }
    }

    if(b>0)
    {
        if(X-x<=Y-y)
        {
                x-=b;
                y+=(k-b);
                b=0;
                test.push_back({x,y});
           
        }
        else
        {
              y-=b;
                x+=(k-b);
                b=0;
                test.push_back({x,y});
        }
    }
    

    while(X-x>=k)
    {
        x+=k;
        a-=k;
        test.push_back({x,y});
    }
    if(X-x>0)
    {
        y+=(k-(X-x));
        a-=(k-(X-x));
        x=X;
        test.push_back({x,y});
    }

    while(Y-y>=k)
    {
        y+=k;
        a-=k;
        test.push_back({x,y});
    }

    for(int i=0;i<test.size();i++){
        if(xn)
           test[i].first=-test[i].first;
        if(yn)
            test[i].second=-test[i].second;
        cout<<test[i].first<<" "<<test[i].second<<endl;
    }
    
    
    return 0;   
}


 
 


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

int main(){
	cout << fixed << setprecision(12);

	double r; //rは実数
	cin>>r;

	double PI = acos(-1);
	double area = r * r * PI;
	double cir = (r + r) * PI;
	cout<<area<<" "<<cir<<endl;

	return 0;
}


Measured memory_bytes: 3292
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,a,b) for(int i=0;i<b;i++)
#define REP(i,a,b) for(int i=0;i<=b;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define Yes(f) cout <<(f?"Yes":"No")<<endl//fが真の場合Yesを出力、偽の場合Noを出力
#define yes(f) cout <<(f?"yes":"no")<<endl
#define YES(f) cout <<(f?"YES":"NO")<<endl
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())

using namespace std;

const int mod=1e9+7;

signed main(){
    int n;
    cin >> n;
    cout << n*(n+1)/2 << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll x, y; cin >> x >> y;

    ll cnt = 1;

    while(1){
        x *= 2;
        if(x>y) break;
        else cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.HashSet;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        HashSet hs = new HashSet<Integer>();
        String str = "Yes";
        for(int i = 0; i < 3; i++){
            hs.add(sc.nextInt());    
        }
        if(hs.size() != 2){
            str = "No";
        }
        System.out.println(str);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < N; i++)
using namespace std;
int main()
{
    int A, B, N, i = 0;
    cin >> A >> B >> N;
    while (1)
    {
        A /= 2;
        B += A;
        i++;
        if (i == N)
        {
            break;
        }
        B /= 2;
        A += B;
        i++;
        if (i == N)
        {
            break;
        }
    }
    cout << A << " " << B << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

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

int main(void){
  int n;
  int sum = 0;
  scanf("%d", &n);
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      for(int k=1;k<=n;k++){
        sum += gcd(gcd(i,j), k);
      }
    }
  }

  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 1736
program main
  implicit none
  integer :: k, n, res
  integer, allocatable :: a(:)
  read (*, *) k, n
  allocate (a(0:n))
  read (*, *) a(1:n)
  a(0) = a(n) - k
  res = k - maxval(a(1:n) - a(0:n - 1))
  write (*, "(i0)") res
end program main


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

int N,input[111111];
int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>input[i];
		input[i]*=2;
	}
	sort(input,input+N);
	
	int x=input[N-1];
	int a=1e9,b=-1e9;
	auto p = lower_bound(input,input+N-1,x/2);
	if(p<input+N-1){
		a=*p;
	}
	if(p!=input){
		b=*--p;
	}
	if(a-x/2 < x/2-b){
		cout<<x/2<<' '<<a/2<<'\n';
	}
	else{
		cout<<x/2<<' '<<b/2<<'\n';
	}
	return 0;
}

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

int main(){
  string S; cin >> S;
  string S_dmy;
  int n = S.size()-1;
  long long ans=0;
  for(int bit=0; bit<(1<<n); bit++){
    S_dmy = S;
    int j=0;
    for(int i=0; i<n; i++){
      if(bit & (1<<i)){
        long long num = stoll(S_dmy.substr(0,i+1-j).c_str());
        ans += num;
        S_dmy = S_dmy.substr(i+1-j);
        j=i+1;
      }
    }
    ans += stoll(S_dmy.c_str());
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

vvl G;
vl c, d;
ll id = 1;

void dfs(ll v, ll p = -1) {
    for(auto u : G[v]) {
        if(u == p) {
            continue;
        }
        d[u] = c[id];
        id++;
        dfs(u, v);
    }
}

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

    G.resize(n);
    rep(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(b);
        G[b].pb(a);
    }

    c.resize(n);
    d.resize(n);
    rep(i, n) {
        cin >> c[i];
    }
    sort(rall(c));

    ll M = 0;
    exrep(i, 1, n-1) {
        M += c[i];
    }

    d[0] = c[0];
    dfs(0);

    out(M);
    rep(i, n) {
        cout << d[i] << " ";
    }

    cout << endl;
    re0;
}

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

using namespace std;

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

  int n, x;
  cin >> n >> x;
  vector<int> m(n);
  int sum = 0;
  for(auto &mm : m) {
    cin >> mm;
    sum += mm;
  }
  x -= sum;
  cout << n + x / *min_element(m.begin(), m.end()) << endl;

  return 0;
}



Measured memory_bytes: 256
/*===============================================================
*  Filename: B.cpp
*  Author: zhuyutian
*  Date: 2018.04.16
================================================================*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const int maxn = 100005;

int H,W;
int N;
int c[maxn];
int res[105][105];

int main()
{
    //freopen("B.in","r",stdin);
    //freopen("B.out","w",stdout);
    cin>>H>>W>>N;
	for(int i = 1; i <= N; i++) cin>>c[i];
	int x = 1,y = 1,dy = 1;
	for(int i = 1; i <= N; i++)
		while(c[i]--){
			res[x][y] = i;
			y += dy;
			if(y > W || y < 1){
				x++;
				dy = -dy;
				if(dy > 0) y = 1;
				else y = W;
			}
		}
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++)
			cout<<res[i][j]<<" ";
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int n,m,x;
    cin >> n >> m >> x;
    int a=0;
    rep(i,m){
        int t;
        cin >> t;
        if(x > t) a++;
    }
    cout << min(a,m-a) << endl;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
int main(){
    char a;
    cin >> a;
    if(a == 'A')
        cout << 'T' << endl;
    else if(a == 'T')
        cout << 'A' << endl;
    else if(a == 'G')
        cout << 'C' << endl;
    else
        cout << 'G' << endl;
return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cmath>
#define ll long long
#define INF 10000000000000000
#define MOD 1000000007
using namespace std;


int main(){
    string s,t;
    cin >> s >> t;
    
    int l=s.length();
    for(int i=0; i<l; i++){
        int ok=1;
        for(int j=0; j<l; j++){
            if(s[j]!=t[(i+j)%l]){
                ok=0;
                break;
            }
        }
        
        if(ok==1){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


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

using namespace std;

#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))

typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;

#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))

int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}

const int N = 2e5 + 10;

const int mod = 1e9 + 7;

int n, x, y, c[N], w[N], mi[N], cnt[N];

int fac[N], ifac[N];

int C(int n, int m)
{
	if (n < m || m < 0) return 0;
	return 1LL * fac[n] * ifac[n - m] % mod * ifac[m] % mod;
}

int main()
{
	giii(n, x, y);
	for (int i = 1; i <= n; ++i)
	{
		gii(c[i], w[i]);
		if (!mi[c[i]]) mi[c[i]] = i;
		else if (w[mi[c[i]]] > w[i]) mi[c[i]] = i;
		++cnt[c[i]];
	}
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % mod;
	ifac[0] = ifac[1] = 1;
	for (int i = 2; i <= n; ++i) ifac[i] = 1LL * (mod - mod / i) * ifac[mod % i] % mod;
	for (int i = 2; i <= n; ++i) ifac[i] = 1LL * ifac[i - 1] * ifac[i] % mod;
	int cho = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (!mi[i]) continue;
		if (!mi[cho]) cho = i;
		else
		{
			if (w[mi[cho]] > w[mi[i]])
				cho = i;
		}
	}
	int t = 1e9;
	for (int i = 1; i <= n; ++i)
		if (mi[i] && cho != i) t = min(t, w[mi[i]]);
	for (int i = 1; i <= n; ++i)
	{
		if (cho != c[i])
		{
			if (i == mi[c[i]]) continue;
			if (w[i] + w[mi[c[i]]] <= x) continue;
			if (w[i] + w[mi[cho]] <= y) continue;
		}
		else
		{
			if (i == mi[c[i]]) continue;
			if (w[i] + w[mi[c[i]]] <= x) continue;
			if (w[i] + t <= y) continue;
		}
		//cerr << i << endl;
		--cnt[c[i]];
	}
	/*for (int i = 1; i <= n; ++i)
		cerr << cnt[i] << endl;*/
	int num = 0;
	//cerr << w[mi[2]] << endl;
	for (int i = 1; i <= n; ++i)
	{
		if (mi[i] && w[mi[i]] + w[mi[cho]] <= y) num += cnt[i];
	}
	//cerr << num << endl;
	int ans = 1;
	for (int i = 1; i <= n; ++i)
	{
		if (mi[i] && w[mi[i]] + w[mi[cho]] <= y)
		{
			//cerr << cnt[i] << endl;
			ans = 1LL * ans * C(num, cnt[i]) % mod;
			num -= cnt[i];
		}
	}
	printf("%d\n", ans);
	return 0;
}

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

using namespace std;
const int MAX = 100000;
pair<pair<int, int>, int> city[MAX]; //<<P,Y>,i>
pair<int, int> num[MAX];// 求める数字の記録

int main() {
	int N, M, P, Y;
	cin >> N >> M;


	for (int i = 0; i < M;++i) {
		cin >> P >> Y;
		city[i] = make_pair(make_pair(P, Y), i);
	}

	sort(city, city + M);
	/*
	for (int i = 0, c = 1; i < M; ++i, c = i < M && city[i - 1].first.first == city[i].first.first ? c + 1 : 1) {
		num[city[i].second] = make_pair(city[i].first.first, c);
	}
	*/
	for (int i = 0, c = 1; i < M; ++i, c = city[i - 1].first.first == city[i].first.first ? c + 1 : 1) {
		num[city[i].second] = make_pair(city[i].first.first, c);
	}


	for (int i = 0; i < M; ++i) printf("%06d%06d\n",num[i].first, num[i].second);

	return 0;
}

Measured memory_bytes: 3456
const int N = 400005;
const int LG = 21;
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
const long long INFLL = 1e18;

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <bitset>
#include <deque>

using namespace std;

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

#define forn(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define fi first
#define se second
#define re return
#define uniq(x) sort(all(x)); (x).resize(unique(all(x)) - (x).begin())

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << " " << #x << " " << x << endl
#define ln cerr << __LINE__ << endl
#else
#define dbg(x) void(0)
#define ln void(0)
#endif // LOCAL

int cx[4] = {-1, 0, 1, 0};
int cy[4] = {0, -1, 0, 1};

ll inq(ll x, ll y)
{
    if (!y) re 1 % MOD;
    ll l = inq(x, y / 2);
    if (y % 2) re l * l % MOD * x % MOD;
    re l * l % MOD;
}

ll rev(ll x)
{
    return inq(x, MOD - 2);
}

bool __precomputed_combinatorics = 0;
vector<ll> __fact, __ufact, __rev;

void __precompute_combinatorics()
{
    __precomputed_combinatorics = 1;
    __fact.resize(N);
    __ufact.resize(N);
    __rev.resize(N);
    __rev[1] = 1;
    for (int i = 2; i < N; i++) __rev[i] = MOD - __rev[MOD % i] * (MOD / i) % MOD;
    __fact[0] = 1, __ufact[0] = 1;
    for (int i = 1; i < N; i++) __fact[i] = __fact[i - 1] * i % MOD, __ufact[i] = __ufact[i - 1] * __rev[i] % MOD;
}

ll fact(int x)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[x];
}

ll cnk(int n, int k)
{
    if (!__precomputed_combinatorics) __precompute_combinatorics();
    return __fact[n] * __ufact[n - k] % MOD * __ufact[k] % MOD;
}

int n;
ll sig = 0;

signed main()
{
    cin >> n;
    ll si = 0;
    vector<int> a(n);
    forn(i, n) cin >> a[i], sig += a[i];
    ll ans = INFLL;
    forn(i, n)
    {
        si += a[i];
        if (i + 1 != n)
        {
            ans = min(ans, abs(sig - si - si));
        }
    }
    cout << ans;
}

/* Note:
Check constants at the beginning of the code.
N is set to 4e5 but be careful in problems with large constant factor.
Check corner cases.
No def int long long for now.
*/


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

ll f(ll r){
    return (r * (r + 1)) / 2;
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<ll> p(n);
    rep(i,n) cin >> p[i];
    vector<double> E(n);
    rep(i,n){
        E[i] = (double)f(p[i]) / p[i];
    }

    vector<double> sum(n+1);
    sum[0] = 0;
    rep(i,n) sum[i+1] = sum[i] + E[i];
    double ans = 0;
    for(int i = 1; i <= n; i++){
        if (i + k - 1 > n) break;
        ans = max(ans, sum[i+k-1] - sum[i-1]);
    }
    printf("%.10lf\n", ans);
    return 0;
}

Measured memory_bytes: 8016
def comp_two_num(a: int, b: int):
    if (a < b):
        print("a < b")
    elif (a > b):
        print("a > b")
    else:
        print("a == b")


if __name__ == "__main__":
    a, b = map(lambda x: int(x), input().split())
    comp_two_num(a, b)



Measured memory_bytes: 5600
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


N, M = map(int, input().split())
S = input()
T = input()
gcd_val = gcd(N, M)
for i in range(gcd_val):
    if S[i * N // gcd_val] != T[i * M // gcd_val]:
        print(-1)
        exit()
print(lcm(N, M))


Measured memory_bytes: 3316
#include<iostream>

using namespace std;
int main(){
    int d,t,s;
    cin >> d >> t >> s;
    double ans=0;
    ans = (double)d/s;
    if(t >= (double)ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vi>;  // vi <=> vl
using P = pair<int, int>;  // int <=> ll
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main() {
  int n, t; cin >> n >> t;
  vi arr(n);
  rep(i,n) cin >> arr[i];
  int ans = t;
  rep(i,n-1) ans += min(t, arr[i+1]-arr[i]);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
n = int(input())
a, b = map(int, input().split())
p = [int(i) for i in input().split()]
x = len(list(filter(lambda x: x <= a, p)))
y = len(list(filter(lambda x: a < x <= b, p)))
z = len(list(filter(lambda x: b < x, p)))
print(min(x, y, z))


Measured memory_bytes: 9080
N = (int)(input())
A = []
for s in input().split():
    A.append((int)(s))

count = 0
mincount = 9999
for i in range(N):
    count = 0
    while(1):
        if not A[i]%2==0:
            break
        count = count + 1
        A[i] = A[i]/2
    if mincount>count:
        mincount = count
        
print(mincount)

Measured memory_bytes: 3064
#include <iostream>
#ifdef LOCAL
#define dbg(...) cout << (__VA_ARGS__) << endl;
#else
#define dbg(...) 42;
#endif
using namespace std;
int main()
{
    string s;
    cin >> s;
    int i, j;
    for (i = 0; i < (int)s.length(); i++)
    {
        if (s[i] == 'A')
        {
            break;
        }
    }
    for (j = s.length(); j >= 0; j--)
    {
        if (s[j] == 'Z')
        {
            break;
        }
    }
    dbg(i);
    dbg(j);
    cout << j - i + 1;

    return 0;
}

Measured memory_bytes: 640
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);

    string S;
    cin >> S;
    int n = S.length();
    int res = 0;
    for (int i = 0; i < n; ++i) {
        if (S[i] == 'R') {
            int cnt = 1;
            while (i + 1 < n && S[i + 1] == S[i]) {
                ++i;
                ++cnt;
            }
            res = max(res, cnt);
        }
    }

    cout << res << '\n';


    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int X,Y,Z; cin>>X>>Y>>Z;
	swap(X,Y); swap(X,Z);
	cout<<X<<" "<<Y<<" "<<Z<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int mapp[100][100],n,ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			mapp[i][j]=1;
	for(int i=n%2==0?1:0,j=n;i<=n;i++,j--)
		mapp[i][j]=0;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(mapp[i][j])
				ans++;
	cout<<ans<<endl;
	for(int i=1;i<=n;i++)
		for(int j=i+1;j<=n;j++)
			if(mapp[i][j])
				cout<<i<<' '<<j<<endl;

}

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

using namespace std;
int main()
{   
    // 整数の入力
    int a,b,c;
    cin >> a >>b;
    c = 0;

    if(a==1){
        c = c+300000;

    }else if(a==2){
        c = c+200000;

    }else if(a==3){
        c= c+100000;
    }

    if(b==1){
        c = c+300000;

    }else if(b==2){
        c = c+200000;

    }else if(b==3){
        c= c+100000;
    }

    if(a==1&b==1){
        c = c+400000;
    }

    cout << c;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))

num=0
rate=[0]*9
for i in range(N):
    dam=a[i]
    if dam<400:
        rate[0] = 1
    elif dam<800:
        rate[1] = 1
    elif dam<1200:
        rate[2] = 1
    elif dam<1600:
        rate[3] = 1
    elif dam<2000:
        rate[4] = 1
    elif dam<2400:
        rate[5] = 1
    elif dam<2800:
        rate[6] = 1
    elif dam<3200:
        rate[7] = 1
    else:
        rate[8] += 1

color = sum(rate[0:8])
# print(rate, val)

dai = color + rate[8]

if rate[8]==0:
    syo=color
else:
    if color==0:
        syo=1

    else:
        syo=color

print(syo,dai)


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

using namespace std;

vector<int> next_int_vector(int n) {
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v.at(i);
    }
    return v;
}

int main() {
    // https://img.atcoder.jp/abc172/editorial.pdf
    int n;
    cin >> n;

    long ans = 0;
    for (int i = 1; i <= n; ++i) {
        long y = n / i;
        ans += y * (y + 1) * (long) i / 2;
    }
    cout << ans << endl;
}


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

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair< long long, long long > P;
typedef pair< long long, P > PP;
typedef pair< P, P > PPP;

const long long MOD = 1e9 + 7;
const long long  INF = 5e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()

int a, b, c;
string s, t;

int main() {
	cin >> a >> b >> c;
	cout << max({ a * 10 + b + c,a + b * 10 + c,a + b + 10 * c }) << endl;
	return 0;
}


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

#define REP(i, n) for (ll (i) = 0 ; (i) < (ll)(n) ; ++(i))
#define REPN(i, m, n) for (ll (i) = m ; (i) < (ll)(n) ; ++(i))
#define REP_REV(i, n) for (ll (i) = (ll)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (ll (i) = (ll)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) (x).begin(),(x).end()
#define Ceil(x, n) (((((x))+((n)-1))/n))
#define CeilN(x, n) (((((x))+((n)-1))/n)*n)

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long

typedef pair<ll, ll> P;
vector<ll> h(100001), copyy(100001);
int n, a, b;

bool canKill(ll t) {
    REP(i, n) {
        copyy[i] = h[i] - t * b;
    }
    ll cnt = 0;
    REP(i, n) {
        if(copyy[i] > 0) {
            cnt += Ceil(copyy[i], (a-b));
        }
    }
    if(cnt <= t) {
        return true;
    } else {
        return false;
    }
}

int main(){
    cin >> n >> a >> b;
    REP(i, n) cin >> h[i];
    ll ub = 1000000005, lb = 0;

    while(ub - lb > 1) {
        ll mid = (lb + ub) / 2;
        //cout << mid << endl;
        if(canKill(mid)) ub = mid;
        else lb = mid;
    }

    cout << ub << endl;

    return 0;
}


Measured memory_bytes: 1792
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(1,n-1):
  if l[i]>l[i-1] and l[i]<l[i+1]:
    ans+=1
  elif l[i]<l[i-1] and l[i]>l[i+1]:
    ans+=1
print(ans)

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

int main() {
	int x[4] = {0};
	int y[4] = {0};
	cin >> x[0] >> y[0] >> x[1] >> y[1];

	cout << x[1]-(y[1]-y[0]) << " " << y[1]+(x[1]-x[0]) << " " << x[0]-(y[1]-y[0]) <<  " " << y[0]+(x[1]-x[0]) << endl;

}


Measured memory_bytes: 256
sx, sy, tx, ty = map(int, input().split())
tx -= sx
ty -= sy
sx = 0
sy = 0

for _ in range(tx - sx):
    print('R', end = '')
for _ in range(ty - sy):
    print('U', end = '')

for _ in range(tx - sx):
    print('L', end = '')
for _ in range(ty - sy):
    print('D', end = '')
    
print('L', end = '')
for _ in range(ty - sy + 1):
    print('U', end = '')
for _ in range(tx - sx + 1):
    print('R', end = '')
print('D', end = '')

   
print('R', end = '')
for _ in range(ty - sy + 1):
    print('D', end = '')
for _ in range(tx - sx + 1):
    print('L', end = '')
print('U', end = '')

Measured memory_bytes: 4468
s = list(map(int,input()))
d = [0 for _ in range(2019)]
r = 0
x = 1
for si in reversed(s):
  r += si*x
  r %= 2019
  d[r] += 1
  x *= 10
  x %= 2019
ans = d[0]
for v in d:
  if v >= 2:
    ans += v*(v-1)//2
print(ans)


Measured memory_bytes: 75848
N = int(input())
A = list(map(int, input().split()))

S = abs(A[-1])
for i in range(N):
    if i==0:
        S += abs(A[i])
    else:
        S += abs(A[i] - A[i-1])

for i in range(N):
    if i==0:
        prev = 0
    else:
        prev = A[i-1]
    if i==N-1:
        next = 0
    else:
        next = A[i+1]

    print(S-abs(A[i]-prev)-abs(A[i]-next)+abs(prev-next))


Measured memory_bytes: 14048
/*
    Author : Nishant Gupta 2.0
*/
#include<bits/stdc++.h>
using namespace std;

#define LL long long int
#define getcx getchar_unlocked
#define X first
#define Y second
#define PB push_back
#define MP make_pair
#define MAX 500005
#define LOG_MAX 20
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL (LL(1e18))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
#define MSV(A,a) memset(A, a, sizeof(A))
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define finish(x) {cout<<x<<'\n'; return;}
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';

/* Modulo exponentiation */
LL power(LL base, LL exp, LL ans, LL mod) {
	if(!exp) return ans % mod;
	if(exp&1) ans = (ans * base) % mod;
	return power((base * base) % mod, exp>>1, ans, mod);
}

int dp[MAX];
void pre() {
	MSV(dp, -1);
	dp[0] = 0;
	for(int i=1;i<MAX;i++) {
		int cnt = 0, copy = i;
		while(true) {
			int sb = __builtin_popcount(copy);
			int x = copy % sb;
			cnt++;
			if(dp[x] != -1) {cnt += dp[x];break;}
			copy = x;
		}
		dp[i] = cnt;
	}
}

void solve() {
	int n;
	in(n);
	string s;
	cin>>s;
	int sb = 0;
	for(int i=0;i<n;i++) {
		sb += (s[i] == '1');
	}
	
	int p = 0;
	LL mod1 = 0, mod2 = 0;
	for(int i=n-1;i>=0;i--,p++) {
		if(s[i] == '0') continue;
		if(sb>1)mod1 = (mod1 + power(2, p, 1, sb-1)) % (sb-1);
		mod2 = (mod2 + power(2, p, 1, sb+1)) % (sb+1);
	}
	
	LL ans[n];
	p = 0;
	for(int i=n-1;i>=0;i--,p++) {
		if(s[i] == '1') {
			if(sb - 1 == 0) {ans[i] = 0;continue;}
			LL now = (mod1 - power(2, p, 1, sb-1) + (sb-1)) % (sb-1);
			//assert for now?
			ans[i] = dp[now] + 1;
		}
		else {
			LL now = (mod2 + power(2, p, 1, sb+1)) % (sb+1);
			ans[i] = dp[now] + 1;
		}
	}
	
	for(int i=0;i<n;i++) {
		cout<<ans[i]<<en;
	}
}

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


Measured memory_bytes: 7320
#include <cstdio>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);
	int t[100],sum=0;
	rep(i,n) scanf("%d",t+i), sum+=t[i];

	int m; scanf("%d",&m);
	rep(i,m){
		int p,x; scanf("%d%d",&p,&x); p--;
		printf("%d\n",sum-t[p]+x);
	}

	return 0;
}


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

int main() {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);

    if (a < b && b < c) {
        printf("Yes");
    } else {
        printf("No");
    }

    printf("\n");

    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n,k;
	cin>>n>>k;
	int p[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>p[i];
	}
	int ans=n-k+1;
	set<int> memo;
	int ch[n]={};
	int f=0,cnt=0;
	for (int i = 0; i < n-1; ++i)
	{
		if (p[i]<p[i+1])
		{
			++cnt;
			if (cnt>=k-1)
			{
				ch[i-k+2]=1;
				if (f==0)
				{
					f=1;
				}
				else
				{
					--ans;
				}
			}
		}
		else
		{
			cnt=0;
		}
	}
	for (int i = 0; i < k; ++i)
	{
		memo.insert(p[i]);
	}
	for (int i = k; i < n; ++i)
	{
		memo.insert(p[i]);
		if (p[i-k]==(*memo.begin())&&p[i]==(*(--memo.end()))&&ch[i-k]==0)
		{
			--ans;
		}
		memo.erase(p[i-k]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 11136