akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <numeric>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

class input
{
public:
    input()
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var) { return std::cin >> var, *this; }
    template <class T>
    inline input& operator,(T& var) { return *this >> var; }

    template <class T>
    inline T read()
    {
        T var;
        std::cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            std::cin >> *head;
            ++head;
        }
    }

    template <class T>
    inline std::vector<T> read(std::size_t n)
    {
        std::vector<T> res;
        res.reserve(n);

        for (std::size_t i = 0; i < n; ++i) {
            T tmp;
            std::cin >> tmp;
            res.emplace_back(tmp);
        }
        return res;
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            std::cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

    template <class T, class... Args>
    void impl(T&& v, Args&&... args)
    {
        cout << std::forward<T>(v) << ' ';
        impl(std::forward<Args>(args)...);
    }
    template <class T>
    void impl(T&& v)
    {
        cout << std::forward<T>(v);
    }

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class... Args>
    void operator()(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
        cout << '\n';
    }
    template <class... Args>
    void noreturn(Args&&... args)
    {
        impl(std::forward<Args>(args)...);
    }

    template <class T>
    void print(const T& container)
    {
        bool first = true;
        for (auto&& x : container) {
            if (!first) {
                cout << ' ';
            }
            cout << x;
            first = false;
        }
        cout << '\n';
    }
};

void prog()
{
    input in;
    output out;

    boost::multiprecision::cpp_int a, b, c;
    in >> a, b, c;
    auto d = c - a - b;
    if (d < 0) {
        out("No");
        return;
    }
    out((4 * a * b < d * d) ? "Yes" : "No");
}

int main()
{
    prog();
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ab = sorted(ab, key=lambda x:x[1])
ans = 0
left, right = ab[0]
for a, b in ab[1:]:
    if a <= left and right <= b:
        continue
    if left < a and right > a:
        left = a 
        right = min(right, b)
    else:
        ans += 1
        left = a 
        right = b
print(ans+1)  

Measured memory_bytes: 66272
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin >> a;
  int l = a/100;
  int r = a%100;
  if(1 <= l && l <=12){
      if(1 <= r && r <= 12){
          cout << "AMBIGUOUS\n" << endl;
      }else{
          cout << "MMYY\n" << endl;
      }
  }else{
      if(1 <= r && r <= 12){
          cout << "YYMM\n" << endl;
      }else{
          cout << "NA\n" << endl;
      }
  }
  return 0;
}


Measured memory_bytes: 3464
import sys
# input = sys.stdin.readline

def main():
  n, k = map(int, input().split())
  alist = list(map(int, input().split()))
  suma = sum(alist)
  i = 1
  yaku = []
  while i*i<=suma:
    if suma % i == 0:
      yaku.append(i)
      if suma//i != i:
        yaku.append(suma//i)
    i += 1

  for d in sorted(yaku, key=lambda x: -x):
    rem = [a%d for a in alist]
    rem = list(sorted(rem))
    sumr = d*len(rem) - sum(rem)
    kc = 0
    for _r in rem:
      kc += _r
      sumr = sumr - (d-_r)
      if max(kc, sumr) <= k:
        print(d)
        sys.exit(0)


if __name__ == '__main__':
  main()


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<set>
#define ll long long
#define dou(s) atof(s.c_str())
#define lon(s) atoll(s.c_str())
#define str(n) to_string(n)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,b,a) for(ll i=b;i>=a;i--)
#define ALL(a) a.begin(),a.end()
#define fion(n) fixed<<setprecision(n)
#define endl "\n"
#define OR ||
#define AND &&
#define NOT !
#define line(s) getline(cin,s)
#define START int main(){cin.tie(0);ios::sync_with_stdio(false);
#define END }
using namespace std;
START
ll n;cin>>n;
map<string,ll> a;
rep(o,0,n){
  string s,t;cin>>s>>t;
  if(s[0]=='i')a[t]=1;
  else cout<<(a[t]==1?"yes":"no")<<endl;
}
END


Measured memory_bytes: 47476
import math
n, k = map(int, input().split())
S = str(input())

L = [0]

tmp = "1"

seq = 0
for i in range(n):
    if tmp != S[i]:
        L.append(1)
    else:  # 文字が連続してたらインクリメントする
        L[-1] += 1
    tmp = S[i]
if tmp == '0':
    L.append(0)  # この0の意味は、最後の文字が'0'で終わっている=それに続く'1'の個数が0という意味

M = len(L)
if math.ceil(M/2) <= k:
    # '0'が連続している箇所はMの半分(切り上げ)だけ。それより多くの回数の魔法が使えるなら全てを'1'に変えられる
    print(n)
    exit()
X = [0 for i in range(M+1)]
for i in range(M):
    X[i+1] = L[i]+X[i]  # 累積和

ans = 0
for i in range(0, M-k*2, 2):
    ans = max(ans, X[i+k*2+1]-X[i])
print(ans)

"""
最初が0か1かで奇数番目を使うか偶数番目を使うか変わる
"""

"""
if k >= len(combined):
    print(len(S))
    exit()
初めて書いた時もこんなこと書いてる。

"""


Measured memory_bytes: 8004
import numpy as np
a=[]


N = int(input())
a =[int(i) for i in input().split()]
a = np.array(a).astype(int)
a = np.where( (a-np.sort(a)) != 0)
if len(a[0]) > 2:
	print("NO")
else:
	print("YES")


Measured memory_bytes: 12408
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


void solve(long long N, long long K, std::vector<long long> p){
    vector<double> v(200000);
    vector<double> a(200000);
    double exp=0;
    for (ll i = 0; i < N; i++) {
        v[i]=((p[i]*(p[i]+1))/2)*1.0/p[i];
        // cout << v[i] << endl;
    }
    a[0]=v[0];
    for (ll i = 1; i < N; i++) {
        a[i]=v[i]+a[i-1];
    }
    exp=a[K-1];
    for (ll i = K; i < N; i++) {
        double tmp=a[i]-a[i-K];
        chmax(exp,tmp);
    }
    // cout << exp << endl;
    sp(exp);
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> p(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&p[i]);
    }
    solve(N, K, std::move(p));
    return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
int vis[100001];
int n,m;
vector<int>adj[100001];
int in_degree[100001];
int dist[100001];
void dfs(int a)
{
    vis[a]=1;
    for(int b : adj[a])
    {
        dist[b]=max(dist[b],dist[a]+1);
        --in_degree[b];
        if(in_degree[b]==0)
        dfs(b);
    }
}
int main()
{
    int i,j,k,x,y;
    cin>>n>>m;
    for(i=0;i<m;i++)
    {
        cin>>x>>y;
        adj[x].push_back(y);
        ++in_degree[y];
    }
    for(i=1;i<=n;i++)
    {
        if(vis[i]==0 && in_degree[i]==0)
        {
            dfs(i);
        }
    }
    int ans=0;
    for(i=1;i<=n;i++)
    {
        ans=max(ans,dist[i]);
    }
    cout<<ans;
}

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

typedef long long ll;

struct dsu {
    dsu(int n) {
        for(int i = 0; i < n; i++) {
            P.push_back(i);
            R.push_back(1);
        }
    }
    int findSet(int x) {
        return (P[x] == x) ? x : P[x] = findSet(P[x]);
    }
    bool unionSet(int x, int y) {
        x = findSet(x), y = findSet(y);
        if(x == y) return false;
        if(R[x] > R[y]) {
            P[y] = x;
            R[x] += R[y];
        }
        else {
            P[x] = y;
            R[y] += R[x];
        }
        return true;
    }
    int getRank(int x) {
        return R[findSet(x)];
    }
    private:
    vector<int> P, R;
};

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    int n, m;
    cin >> n >> m;

    vector<int> card(n + 1);
    dsu my_dsu(n);
    for(int i = 0; i < m; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        a--, b--;
        my_dsu.unionSet(a, b);
    }

    set<int> S;
    for(int i = 0; i < n; i++) {
        S.insert(my_dsu.findSet(i));
    }

    cout << S.size() << endl;

}

/**
1 / n * (1/2)^k
*/


Measured memory_bytes: 6132
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int fee_f, day_f, fee, day,total;


int main()
{
	cin >> day;
	cin >> day_f;
	cin >> fee_f;
	cin >> fee;
	
	for (int i = 0;i < day_f && i < day;i++)
	{
		total += fee_f;
	}
	for (int i = 0; i < day-day_f;i++)
	{
		total += fee;
	}
	cout << total << endl;


	

	
	//system("pause");

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define RFOR(i,a,b) for(int i = (int)(b-1);i>=(int)(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int euclid(int a, int b){
   int ta = max(a, b);
   int tb = min(a, b);
   int t = INF;
   while(t != 0){
     t = ta % tb;
     ta = tb;
     if(t != 0) tb = t;
   }
   return tb;
}

vector<P> prime_factorize(int n){
  vector<P> res;
  for(int p = 2; p * p <= n; p++){
    if(n % p != 0) continue;
    else{
      int num = 0;
      while(n % p == 0) {
        num++;
        n /= p;
      }
      res.push_back(make_pair(p, num));
    }
  }
  if(n != 1) res.push_back(make_pair(n, 1));
  return res;
}

signed main(){
  ios::sync_with_stdio(false);
  cout.tie(0);

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

  int g = euclid(a, b);
  cout << prime_factorize(g).size() + 1 << endl;

  return 0;
}

Measured memory_bytes: 256
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import heapq

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))
N,M = LI()
A = LI()

pq = []
for a in A:
    heapq.heappush(pq,-a)

for _ in range(M):
    heapq.heappush(pq,-(-heapq.heappop(pq) // 2))
    # print(pq)

print(-sum(pq))


Measured memory_bytes: 87316
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

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


	int N;
	cin >> N;
	int A[100000];
	ll goukei = 0;
	rep(i, N) {
		int a, b;
		cin >> a >> b;
		A[i] = a + b;
		goukei += b;
	}

	sort(A, A + N);
	reverse(A, A + N);

	ll kotae = -goukei;
	rep(i, N) if (i % 2 == 0) {
		kotae += A[i];
	}

	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main(){
  ll n;
  ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n){
    ll x;
    cin >> x;
    a.at(i)=x-1;
  }
  set<ll> b;
  ll sr=0;
  while(!(b.count(sr))){
    b.insert(sr);
    sr=a.at(sr);
  }
  int sta=0;
  int c=0;
  while(sta!=sr){
    sta=a.at(sta);
    c++;
  }
  ll syuki=b.size()-c;
  
  
  if(k>n)
    k=(k-c)%syuki+c;
  int ans=0;
  rep(i,k)
    ans=a.at(ans);
  cout << ans+1 << endl;
}

Measured memory_bytes: 13888
#include<bits/stdc++.h>
#define mp make_pair
#define fi first
#define se second
#define VAL 100000
#define ll long long
#define INF 10000000000000000LL
#define pll pair<long long , long long>
const int MAX=1e4+10;
const int MOD=1e9+7;
const int TOT_PRIMES=19;
const int MAX_A=70;
using namespace std;
vector<int>adj[MAX];

int p ,n;
int val[MAX];

int vis[(1<<16)][16][16];
int  mx;
ll arr[MAX];
int prime[10]={2, 3, 5, 7, 11, 13, 17, 19};
int coun(int x){
	return __builtin_popcount(x);
}

int main() 
{ 
	//ios_base::sync_with_stdio(false);
  //  cin.tie(NULL);	
//	#ifndef ONLINE_JUDGE
//	freopen("inp.txt" ,"r", stdin );
//	freopen("out.txt", "w", stdout);
//	#endif
	
	cin>>n;
	int f=0;
	while(n){
		if(n%10==7)
			f=1;
		n/=10;
	}
	if(f)
		cout<<"Yes";
	else
		cout<<"No";

}


Measured memory_bytes: 3860
/*************************************************************************
  >         File: D.cc
  >       Author: Yuan Lei
  >         Mail: yuanlei@indeed.com
  > Created Time: Sun 22 Oct 2017 09:28:32 PM JST
*************************************************************************/
#include <vector>
#include <cstdio>
#include <bitset>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <fstream>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <string>
#include <iostream>
#include <algorithm>
#include <functional>

int main() {
  std::ios::sync_with_stdio(0);
  std::string s;
  std::cin >> s;
  int n = s.size();
  int st = 0;
  std::map<int, int> mp;
  mp[0] = 0;
  for (int i = 0; i < n; ++i) {
    st ^= (1 << (s[i] - 'a'));
    int hs = n + 1;
    if (mp.count(st)) {
      hs = mp[st];
    }
    int &ans = mp[st];
    ans = hs;
    for (int j = 0; j < 26; ++j) {
      int prev = st ^ (1 << j);
      if (mp.count(prev)) {
        ans = std::min(ans, mp[prev] + 1);
      }
    }
  }
  int ans = mp[st];
  if (ans == 0) ans = 1;
  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 9876
#include <stdio.h>

#define N 500001

int n;
int A[N];

void maxHeapify(int A[], int i){
  int l, r, largest, buf;

  l = 2 * i;
  r = 2 * i + 1;
  
  if(l <= n && A[l] > A[i]) largest = l;
  else largest = i;
  
  if(r <= n && A[r] > A[largest]) largest = r;
  
  if(largest != i){
    buf = A[i];
    A[i] = A[largest];
    A[largest] = buf;
    maxHeapify(A, largest);
  }
}

void buildMaxHeap(int A[]){
  int i;

  for(i = n / 2; i >= 1; i--) maxHeapify(A, i);
}

int main(){
  int i;
  
  scanf("%d", &n);
  
  for(i = 1; i <= n; i++) scanf("%d", &A[i]);
  
  buildMaxHeap(A);
  
  for(i = 1; i <= n; i++){
    if(i != n + 1) printf(" ");
    
    printf("%d", A[i]);
  }
  
  printf("\n");
  
  return 0;
}

Measured memory_bytes: 2552
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <utility>
#include <set>

#include <cassert>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define FOR(i,a,b) for(ll i=(a); i < (b); i++)
#define RFOR(i,a,b) for(ll i=(b)-1; i >= (a); i--)
#define rep(i,n) FOR(i,0,(n))
#define rrep(i,n) RFOR(i,0,(n))

ll sum[200100];
ll mn[200100];
ll mx[200100];

void foo(ll S, set<ll> & st, int indx) {
	st.insert(S);
	auto it = st.lower_bound(S/2);
	
	ll a = *it;
	if(it != st.begin()) {
		it--;
		if(abs((*it)*2 - S) < abs(a*2 - S)) {
			a = *it;
		}
	}
	mn[indx] = min(min(a,S-a),mn[indx]);
	mx[indx] = max(max(a,S-a),mx[indx]);
}

int main() {
	ll N;
	cin >> N;
	vector<ll> A(N);
	rep(i,N) cin >> A[i];
	rep(i,N) {
		sum[i+1] = sum[i] + A[i];
	}

	rep(i,200100) {
		mn[i] = 1e15;
		mx[i] = -1e15;
	}

	set<ll> st;
	st.insert(sum[1]);
	for(int i = 1; i < N-2; i++) {
		ll S = sum[i+1];
		foo(S,st,i+1);
	}

	st.clear();
	st.insert(sum[N] - sum[N-1]);
	for(int i = N-2; i >= 2; i--) {
		ll S = sum[N] - sum[i];
		foo(S,st,i);
	}

	ll res = 1e15;
	for(int i = 2; i <= N-2; i++) {
		res = min(res, mx[i]-mn[i]);
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 15872
#include<bits/stdc++.h>
#define ll                 long long int
#define mod                9000000000000000000
#define pi                 3.14159265358979323846264338327950288419716939937510
#define setbit(x)          __builtin_popcountll(x)
#define db                 long double
#define pp(x)              pair<x,x>
#define ff                 first
#define ss                 second
#define FIO                ios_base::sync_with_stdio(false); cin.tie(NULL);
#define tc                 ll tc; cin>>tc; for(ll number = 1 ; number <= tc ; number ++ )
#define vv(x)              vector<x>
#define pb                 push_back
#define pob                pop_back
#define pf                 push_front
#define pof                pop_front
#define endl               "\n"
#define pq                 priority_queue
#define dbg(x)             { cout<< #x << ": " << (x) << endl; }
#define dbg2(x,y)          { cout<< #x << ": " << (x) << " , " << #y << ": " << (y) << endl; }
#define bp                 ll kkk; cin >>kkk;
#define dbgArr(a,n)        cout<<"Array "<<#a<<endl; for(ll i=0 ; i<n ; i++) cout<<a[i]<<" "; cout<<endl;
#define maxE(a,n)          *max_element(a,a+n);
#define minE(a,n)          *min_element(a,a+n);
#define forn(i,s,n)        for(ll i=s ; i<n ; i++)
#define fornr(i,e,s)       for(ll i=e-1 ; i>=s ; i--)
#define arr(a,n)           for(ll i=0;i<n;i++){ cin>>a[i]; }
#define arr1(a,n)          for(ll i=1;i<=n;i++){ cin>>a[i]; }
#define file freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define print cout<<"Case #"<<number<<": "
#define all(x) x.begin(), x.end()
ll power(ll x, ll b) {ll p = 1;while (b > 0) {if(b&1) {p = p * x; p %= mod;} b >>= 1; x *= x; x %= mod;} return p % mod;}
using namespace std;
# define INF 1e15
struct lex_compare {
    bool operator() (const pair<db,ll>  p1, const pair<db,ll> p2){
        return (p1.first ==  p2.first) ? p1.ss < p2.ss : p1.first > p2.first;
    }
};

int main(){
    FIO;
    char c; cin >> c;
    if( c  >= 'A' &&  c <= 'Z'){
        cout << 'A' << endl;
    }else{
        cout << 'a' << endl;
    }
    return 0;
}


Measured memory_bytes: 3648
import sys
import math
import collections
import bisect
import itertools
import decimal
import copy
import heapq

# import numpy as np

# sys.setrecursionlimit(10 ** 6)
INF = 10 ** 20
# MOD = 10 ** 9 + 7
MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))
flush = lambda: sys.stdout.flush()


# ===CODE===
def main():
    n, x, m = ns()

    total = x
    ai = x
    st = {x}
    prev = [x]

    for i in range(1, n):
        ai = ai ** 2 % m
        total += ai

        if ai in st:
            start = prev.index(ai)
            itrlen = len(prev) - start
            remainlen = n - i

            head = sum(prev[:start])
            itr = prev[start:]
            itrsum = sum(itr)
            remainitrsum = (remainlen // itrlen) * itrsum
            tail = sum(itr[:remainlen % itrlen])
            ans = head + itrsum + remainitrsum + tail
            print(ans)
            exit(0)

        st.add(ai)
        prev.append(ai)

    print(total)


if __name__ == '__main__':
    main()


Measured memory_bytes: 82864
#include "bits/stdc++.h"
using namespace std;

//諸機能
#pragma region MACRO 
#define putans(x)  std::cerr << "[ answer ]: " ; cout << (x) << endl
#define dputans(x) std::cerr << "[ answer ]: "; cout << setprecision(27) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define equals(a,b) (fabs((a)-(b)) < EPS)
#ifdef _DEBUG //ファイルからテストデータを読み込む
std::ifstream ifs("data.txt");
#define put ifs >>
#else //ジャッジシステムでいい感じにやる
#define put cin >>
#endif
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#ifdef _DEBUG
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#else
#define dbg(var0) {}
#define dbg2(var0, var1) {}
#define dbg3(var0, var1, var2) {}
#define dbgArray(a,n) {}
#endif 
#pragma endregion 
//typedef（書き換える、書き足す可能性ある）
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-10)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(2*1e9)
#pragma endregion


int main() {
	int n, a, b; put n >> a >> b;
	string s; put s;
	int sum = 0;
	int kaigaisum = 0;
	rep(i, n) {

		switch (s[i]) {
		case 'a':
			if (sum < a + b) {
				cout << "Yes" << endl;
				sum++;
			}
			else cout << "No" << endl;
			break;
		case 'b':
			if (sum < a + b && kaigaisum < b) {
				cout << "Yes" << endl;
				sum++;
				kaigaisum++;
			}
			else cout << "No" << endl;
			break;
		default:
			cout << "No" << endl;
			break;
		}

	}

END:
	return 0;
}



Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define SIZE(x) ((ll)(x).size())
#define INF 1000000000000

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
    int a, b;
    while(1){
    cin >> a >> b;
    if (a == 0 && b == 0) break;
    if (a > b) swap(a,b);
    cout << a << " " << b << endl;
    }
}


Measured memory_bytes: 3016
#include<stdio.h>
#include <string.h>
#include<math.h>

int main(){
	int i,j;
	for(i=1;i<10;i++){
		for(j=1;j<10;j++){
			printf("%dx%d=%d\n",i,j,i*j);
		}
	}
	return 0;
}

Measured memory_bytes: 524
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import Data.List

readIntsLine :: IO [Int]
readIntsLine = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

solve :: Int -> [Int] -> Bool
solve _ [] = True
solve c (h:hs)
  | h <= c = solve h hs
  | h > c && h - 1 <= c = solve (h - 1) hs
  | otherwise = False

main :: IO ()
main = do
  getLine
  as <- reverse <$> readIntsLine
  putStrLn $ if solve (10 ^ 10) as then "Yes" else "No"


Measured memory_bytes: 14844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ITP1_9_A
{
    class Program
    {

        static IEnumerable<string> ReadLines()
        {
            while (true)
            {
                yield return Console.ReadLine();
            }
        }


        static void Main(string[] args)
        {
            var word = Console.ReadLine().ToLower();

            var count = ReadLines()
                .TakeWhile(n => "END_OF_TEXT".Equals(n) == false)
                .SelectMany(n => n.ToLower().Split(' '))
                .Count(n => n == word);


            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 5912
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <functional>
using namespace std;
#define rep(i, n) for(int i=0; i<n; ++i)
typedef long long ll;
//必要な宣言

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

  int a_size = (int)(a.length());
  int b_size = (int)(b.length());

  if(a_size>b_size) {
    cout << "GREATER" << endl;
  }else if(a_size<b_size) {
    cout << "LESS" << endl;
  }else {
    rep(i, a_size) {
      if(a[i]>b[i]) {
        cout << "GREATER" << endl;
        return 0;
      }else if(a[i]<b[i]) {
        cout << "LESS" << endl;
        return 0;
      }
    }

    cout << "EQUAL" << endl;
  }

  return 0;
}


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

using namespace std;

typedef long long ll;

#define faster ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)

#define endl "\n"

ll pf(ll n)
{
	vector<pair<ll, ll>> primes;
	ll cnt = 0;
	for (ll i = 2; i * i <= n; i++)
	{
		if (n % i != 0)
			continue;
		ll p = i;
		int num = 0;

		while (n % p == 0)
		{
			n /= p;
			num++;
		}

		ll id = 1;

		while(num >= id){
			num -= id;
			id++,cnt++;
		}
	}

	if (n > 1)
	{
		cnt++;
	}
	return cnt;
}

int main()
{
	faster;

	ll n;
	cin >> n;
	ll num = 2, operation = 0;

	cout << pf(n) << endl;
	return 0;
}

Measured memory_bytes: 3628
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define pb            push_back
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())

// code
// ------------------------------------------------
int main() {
  int a,b;
  cin >> a >> b;
  ostringstream oss;

  int n = 0;
  for(int i = a; i <= b; i++)
  {
    int c[5];
    int d = i;
    rep(i,5)
    {
      c[i] = d % 10;
      d = d / 10;
    }

    if(c[0] == c[4])
    {
      if(c[1] == c[3])
      {
        n++;
      }
    }

  }

  cout << n;

  return 0;
}

// funcの実体
// ------------------------------------------------
int CalcSumOfDigit(int n)
{
  int s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AAlready2018 {
public:
	void solve(istream& in, ostream& out) {
        string s; in >> s;
        s[3] = '8';
        out << s << endl;
	}
};

int main() {
	AAlready2018 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
(defun main ())
(defun f ()
	(let (_n _t _ans)
		(setq _n (read))
		(setq _t (read))
		(setq _ans 1000000000)
		(dotimes (i _n)
			(let (tmp_c tmp_t)
				(setq tmp_c (read))
				(setq tmp_t (read))
				(if (<= tmp_t _t)
					(setq _ans (min _ans tmp_c))
					nil
				)
			)
		)
		(if (= _ans 1000000000)
			(format t "TLE~%")
			(format t "~a~%" _ans)
		)
	)
)
(f)


Measured memory_bytes: 15208
#include<bits/stdc++.h>
using namespace std;
#define tezi ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
typedef long long ll;

ll power(ll x, int n){
    ll res = 1;
    for(int i = 0; i < n; ++i){
        res *= x;
    }
    return res;
}

int main(){
    tezi;
    ll x;
    cin >> x;
    for(int i = -200; i <= 200; ++i){
        for(int j = -200; j <= 200; ++j){
            if(power(i, 5) - power(j, 5) == x){
                cout << i << " " << j << "\n";
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <unistd.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ll long long
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef vector<int> vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
typedef pair< double,double> dd;
#define sz(a) int((a).size())
#define all(c) c.begin(),c.end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define mp make_pair

const int INF = 1000000007;
const long long INFLL = (ll)INF * (ll)INF;

void test_case()
{
	double x;
	cin>>x;
	if(x==0)
	cout<<"1";
	else if(x==1)
	cout<<"0";
}

int32_t main()
{
	//int t;
	//cin>>t;
	//while(t--)
	{
		test_case();
		cout<<endl;
	}
	return 0;
}



Measured memory_bytes: 3776
#include <bits/stdc++.h>
using namespace std;
#define i64 long long
#define input freopen("input.txt", "r", stdin)
#define output freopen("output.txt", "w", stdout)
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);
#define pi 2.0*acos(0.0)
#define mp make_pair
#define pii pair<int,int>
#define pss pair<string,string>
#define fi first
#define se second
#define pb push_back
#define sortVA(v) sort(v.begin(),v.end())
#define sortVD(v) sort(v.begin(),v.end(),greater<int>())
#define ASC(a,n) sort(a,a+n);
#define DESC(a,n) sort(a,a+n,greater<int>());
#define out(x) cout <<x<<endl
#define outt(x,y) cout <<x<<" "<<y<<endl
#define mem(array,value) memset(array,value,sizeof(array))
#define llmax LONG_LONG_MAX
int main()
{
    fast_io
    i64 x,y;
    cin >>x>>y;
    vector <i64>mul;
    i64 i=2;
    if(x%y==0)return out(-1),0;
    while(i<=llmax){
        i64 a= x*i;
        if(a%y){out(a);break;}
        else{i++;}
    }
    return 0;
}






Measured memory_bytes: 256
# -*- coding: utf-8 -*-

s = input()

alph = 'abcdefghijklmnopqrstuvwxyz'
ar = [0 for i in range(26)]

for i in range(len(s)):
    ar[alph.find(s[i])] += 1

for i in range(len(s)):
    if 0 not in ar:
        print('None')
        break
    if ar[i] == 0:
        print(alph[i])
        break

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

int main(){
    vector<long long int> vec;

    int x,y,z,k;
    scanf("%d%d%d%d",&x,&y,&z,&k);

    long long a[1000],b[1000],c[1000];
    for(int i = 0;i <x;i++){
        scanf("%lld",&a[i]);
    }
    for(int i = 0;i <y;i++){
        scanf("%lld",&b[i]);
    }
    for(int i = 0;i <z;i++){
        scanf("%lld",&c[i]);
    }


    sort(a,a+x,greater<long long>());
    sort(b,b+y,greater<long long>());
    sort(c,c+z,greater<long long>());

    for(int i = 0;i < x;i++){
        for(int j = 0;j < y;j++){
            for(int h = 0;h < z;h++){
                if((i+1) * (j+1) * (h+1) <= k){
                    vec.push_back(a[i]+b[j]+c[h]);
                }else{
                    break;
                }
            }
        }
    }

    sort(vec.begin(),vec.end(),greater<long long>());
    for(int i = 0;i < k;i++){
        printf("%lld\n",vec[i]);
    }
    return 0;
}

Measured memory_bytes: 1400
N, M = map(int, input().split())
dic = {}
count = 0
goukei = 0
 
for i in range(N):
  price,honsu = map(int, input().split())
  if price in dic:
    dic[price] += honsu
  else:
    dic[price] = honsu
dic = sorted(dic.items())
for kakaku, number in dic:
    nokori = M-count
    count += number
    if count >= M:
      goukei += nokori*kakaku
      break
    else:
      goukei += number*kakaku
print (goukei)   

Measured memory_bytes: 22984
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int h,w;
  cin>>h>>w;
  vector<vector<char>> mp(h,vector<char>(w));
  rep(i,h) {
    string s;
    cin>>s;
    rep(j,w) {
      mp[i][j]=s[j];
    }
  }
  vector<vector<int>> dp(h,vector<int>(w));
  dp[0][0]=1;
  repeat(i,1,h) {
    if(mp[i][0]=='.')
      dp[i][0]=dp[i-1][0];
  }
  repeat(i,1,w) {
    if(mp[0][i]=='.')
      dp[0][i]=dp[0][i-1];
  }
  const int p = 1e9+7;
  repeat(hh,1,h) {
    repeat(ww,1,w) {
      if(mp[hh][ww]=='.') {
        dp[hh][ww]=(dp[hh-1][ww]+dp[hh][ww-1])%p;
      }
    }
  }
  cout << dp[h-1][w-1] << endl;
  return 0;
}


Measured memory_bytes: 5248
#include<iostream>
    using namespace std;
    int main(){
      int a, b, c;
      cin >> a >> b;
      if(a!=1 && b!=1)
        cout << 1 << endl;
      else if(a!=2 && b!=2)
        cout << 2 << endl;
      else if(a!=3 && b!=3)
        cout << 3 << endl;
      
      return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod=1000000007;
const long long MAXN=2010;
long long n,k,dp[MAXN][MAXN];
long long fac[MAXN*MAXN],inv[MAXN*MAXN];
long long C(long long x,long long y){return fac[x]*inv[y]%mod*inv[x-y]%mod;}
int main(){
	scanf("%lld%lld",&n,&k);
	fac[0]=1;for(register long long i=1;i<=n*k;i++)fac[i]=fac[i-1]*i%mod;
	inv[1]=1;for(register long long i=2;i<=n*k;i++)inv[i]=(mod-mod/i)*inv[mod%i]%mod;
	inv[0]=1;for(register long long i=1;i<=n*k;i++)inv[i]=inv[i-1]*inv[i]%mod;
	if(k==1){
		printf("1\n");
		return 0;
	}
	dp[0][0]=1;
	for(register long long i=1;i<=n;i++){
		for(register long long j=0;j<=i;j++){
			dp[i][j]=dp[i-1][j];
			if(j)dp[i][j]=(dp[i][j]+(n-j+1)*dp[i][j-1]%mod*C(n*k-i-(k-1)*(j-1)-1,k-2)%mod)%mod;			
		}
	}
	printf("%lld\n",dp[n][n]);
	return 0;
} 

Measured memory_bytes: 94848
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int n,c[510],s[510],f[510],tim;
int ans(int k,int t)
{
    if(k==n-1) {tim=t;return 0;}
    if(t<=s[k]) ans(k+1,s[k]+c[k]);
    else ans(k+1,t+c[k]+(f[k]-t%f[k])%f[k]);
    return 0;
}
int main()
{
    scanf("%d",&n);
    for(int i=0;i<n-1;i++)
    {
        scanf("%d %d %d",&c[i],&s[i],&f[i]);
    }
    for(int i=0;i<n;i++)
    {
        tim=0;
        ans(i,0);
        printf("%d\n",tim);
    }
    return 0;
}


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

int main()
{
    string s, t;
    cin >> s >> t;
    int n = s.size();
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3920
N = int(input())
num_list = list(int(i) for i in input().split())
ans = 0
for i in range (N-2):
	if num_list[i+1] > num_list[i]:
		if num_list[i+2] > num_list[i+1]:
			ans +=1
	else:
		if num_list[i+1] > num_list[i+2]:
			ans +=1
print(ans)

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

#define ll long long
#define tc(t) int t;cin >> t; while(t--)
#define pb push_back
#define fi first
#define se second
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);


void solve() {
    string s;
    cin >> s;
    int ok = 0;
    if(s[2] == s[3] && s[4] == s[5]) ok = 1;
    cout << (ok ? "Yes": "No");
}

int main() {_
    int t = 1;
    //cin >> t;
    // Please remember to uncomment for taking test cases
    for(int i = 1; i<=t; i++) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
abc = [list( map(int, input().split())) for _ in range(m)]

cost = [[] for _ in range(n)]
edges = dict()
for i in range(m):
    a = abc[i][0] - 1
    b = abc[i][1] - 1
    c = abc[i][2]
    cost[a].append((b, c))
    cost[b].append((a, c))

    edges[str(a) + ' ' + str(b)] = i
    edges[str(b) + ' ' + str(a)] = i

s = set()

# main
from heapq import heappop, heappush
for start in range(n):
    d = [float('inf') for i in range(n)] # 最短距離
    d[start] = 0

    q = [] # min-heap, (距離, 頂点)
    prev = [None] * n # 経路をたどるときに使う
    heappush(q, (d[start], start))
    while q:
        # print(q, d, prev)
        du, u = heappop(q) # 最短距離とその頂点
        if d[u] < du:
            continue
        for v, weight in cost[u]:
            alt = du + weight
            if d[v] > alt:
                d[v] = alt
                prev[v] = u
                heappush(q, (alt, v))

    # print('最短距離: ', d)

    for goal in range(start + 1, n):
        goal = [goal]
        while prev[goal[-1]] != None:
            goal.append(prev[goal[-1]])
        goal = goal[::-1]

        for j in range(len(goal) - 1):
            edge_idx = edges[str(goal[j]) + ' ' + str(goal[j + 1])]
            s.add(edge_idx)

print(m - len(s))


Measured memory_bytes: 3700
import numpy as np

N, H = map(int, input().split())
AB = [list(map(int,input().split())) for i in range(N)]

swing = sorted([AB[i][0] for i in range(N)], reverse=True)
throw = sorted([AB[i][1] for i in range(N)], reverse=True)

cnt = 0

if throw[0] > swing[0]:  ## 投げて強いものは（最後に）投げる
  big_throw = [throw[i] for i in range(N) if throw[i] > swing[0]]
  throw_cumsum = np.array(big_throw).cumsum()
  for i in range(len(big_throw)):
    if H - throw_cumsum[i] <= 0:
      print(i+1)
      exit()
  else:
    cnt += len(throw_cumsum)
    H -= throw_cumsum[-1]

## 残りは全部（最初に）切る
cnt += ((H + (swing[0]-1)) // swing[0])
print(cnt)

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

using namespace std;

int main(int argc, const char * argv[]) {
    int N = 0;
    cin >> N;
    vector<int> As(N,0);
    for(int i = 0; i < N; i++) {
        cin >> As[i];
    }

    vector<int> max_r;
    {
        int temp_max = 0;
        for(int i = 0; i < N; i++) {
            if(temp_max < As[i]) {
                temp_max = As[i];
            }
            max_r.push_back(temp_max);
        }
    }
    vector<int> max_l;
    {
        int temp_max = 0;
        for(int i = N-1; 0 <= i; i--) {
            if(temp_max < As[i]) {
                temp_max = As[i];
            }
            max_l.push_back(temp_max);
        }
        reverse(max_l.begin(), max_l.end());
    }

    for(int i = 0; i < N; i++) {
        int right = 0;
        if(0 <= i-1) {
            right = max_r[i-1];
        }

        int left  = 0;
        if(i+1<N) {
            left = max_l[i+1];
        }
        cout << max(right, left) << endl;
    }
    return 0;
}

/**
 cheat sheet

 vector<int> v{ 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
 sort(v.begin(), v.end());
 => 0 1 2 3 4 5 6 7 8 9

 vector<int> v{ 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
 sort(v.begin(), v.end(), greater<int>());
 => 9 8 7 6 5 4 3 2 1 0

 struct A { int x, y; };
 bool comp(A i1, A i2) { return (i1.y < i2.y); }
 vector<A> v { { 6, 8 }, { 1, 9 }, { 2, 4 }, { 4, 7 } };
 sort(v.begin(), v.end(), comp);
 => [1, 9] [2, 4] [4, 7] [6, 8]

 */


Measured memory_bytes: 4084
#include <iostream>                                             
using namespace std;                                            
                                                                
int GCD(int a,int b) {                                          
  if (a<=b) {                                                   
    swap(a,b);                                                  
  }                                                             
  if (b==0) {                                                   
    return a;                                                   
  }                                                             
  return GCD(b,a%b);                                            
}                                                               
                                                                
int main() {                                                    
  int x, y;                                                     
  cin >> x >> y;                                                
  cout << GCD(x,y) << endl;                                     
  return 0;                                                     
}                                                               
                                                                
     

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair

using namespace std;

ll n;

ll get(ll i)
{
    return i+n;
}

int main()
{
   FAST/**/
   
   //ll n;
   //cin>>n;
   cin>>n;
   
   ld arr[n];
   for(ll i=0;i<n;i++)
        cin>>arr[i];        
   
   ld dp[2*n+1];
   memset(dp,0,sizeof(dp));
   dp[get(1)] = arr[0];
   dp[get(-1)] = 1-arr[0];
   for(ll i=1;i<n;i++)
   {
       ld store[2*n+1];
       memset(store,0,sizeof(store));
       for(ll j=-n;j<=n;j++)
       {
           ll win = j-1;
           ll loss = j+1;
           
           ld fst = 0, sec = 0;
           if(win>=-n)
                fst = dp[get(win)]*arr[i];
           if(loss<=n)
                sec = dp[get(loss)]*(1-arr[i]);
           
           store[get(j)]+=fst+sec;        
       }
       
       for(ll j=0;j<2*n+1;j++)
            dp[j] = store[j];
   }
   
   ld ans = 0;
   
   for(ll i=1;i<=n;i++)
        ans+=dp[get(i)];
   cout<<fixed<<setprecision(20)<<ans;        
   
   return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#define M 1000000
#define INFTY 1000000001

void merge(int *,int,int,int);
void mergeSort(int *,int,int);

int count;

int main(){
  int n,S[M],i;
  
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  mergeSort(S,0,n);
  
  for(i=0;i<n-1;i++)printf("%d ",S[i]);
  printf("%d\n",S[i]);
  printf("%d\n",count);
  return 0;
}

void merge(int *A,int left,int mid,int right){
  int n1,n2,i,j,k,L[M],R[M];

  n1 = mid - left;
  n2 = right - mid;
  for(i=0;i<n1;i++) L[i] = A[left + i];
  for(i=0;i<n2;i++) R[i] = A[mid + i];

  L[n1] = INFTY;
  R[n2] = INFTY;
  i = 0;
  j = 0;

  for(k=left;k<right;k++){
    if( L[i] <= R[j]){
      A[k] = L[i];
      i = i + 1;
      count++;
    }else{ 
      A[k] = R[j];
      j = j + 1;
      count++;
    }
  }
}

void mergeSort(int *A,int left,int right){
  int mid;

  if( left+1 < right){
    mid = (left + right)/2;
    mergeSort(A, left, mid);
    mergeSort(A, mid, right);
    merge(A, left, mid, right);
  }
}



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

using namespace std;

int main(){
	int k;
	cin >> k;
	vector<int> a(k+1);
	
	a[0]=7 % k;
	if (a[0] == 0) {
		cout << 1 << endl;
		return 0;
	}
	for (int i = 0; i < k; i++) {
		a[i + 1] = (a[i] * 10 + 7) % k;
		if (a[i + 1] == 0) {
			cout << i + 2 << endl;
			return 0;
		}
	}
	cout << "-1" << endl;

	return 0;
}

Measured memory_bytes: 7080
N=W=S=E=0
for c=chomp(readline())
  if c=='N'
    N+=1
  elseif c=='W'
    W+=1
  elseif c=='S'
    S+=1
  elseif c=='E'
    E+=1
  end
end
println(N*S==0&&N+S>0||W*E==0&&W+E>0 ? "No" : "Yes")

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

int main()
{
  int n,m;
  cin >> n >> m;
  int arr[n+1];
  for(int i=0;i<=n;i++) arr[i] = -1;
  bool hit = true;
  for(int i=0;i<m;i++)
  {
    int x , c;
    cin >> x >> c;
    if(arr[x] == -1)
    {
      arr[x] = c;
    }
    else if(arr[x] == c) continue;
    else 
    {
      hit = false;
      break;
    }
    
  }
  if(!hit) 
  {
    cout << -1;
    return 0;
  }
  if(n==1)
  {
    if(arr[1]==-1) cout << 0;
    else cout << arr[1];
    return 0;
  }
  if(n==2)
  {
    if(arr[1]==-1) arr[1] = 1;
    if(arr[2]==-1) arr[2] = 0;
    if(arr[1]==0) cout << -1;
    else cout << arr[1] << arr[2];
    return 0;
  }
  if(n==3)
  {
    if(arr[1]==-1) arr[1] = 1;
    if(arr[2]==-1) arr[2] = 0;
    if(arr[3]==-1) arr[3] = 0;
    if(arr[1]==0) cout << -1;
    else cout << arr[1] << arr[2] << arr[3];
    return 0;
  }
  
}
  


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

int main(){
    int N;
    cin >> N;
    vector<string> S(N);
    rep(i, N) cin >> S.at(i);
    int num;
    sort(S.begin(), S.end());
    S.erase(unique(S.begin(), S.end()), S.end());
    num = S.size();

    cout << num << endl;

    return 0;
}

Measured memory_bytes: 9600
N, M = map(int, input().split())
H = list(map(int, input().split()))

R = [True]*N

for i in range(M):
    An, Bn = map(int, input().split())
    if H[An-1] <= H[Bn-1]:
        R[An-1] = False
    if H[Bn-1] <= H[An-1]:
        R[Bn-1] = False

print(R.count(True))

Measured memory_bytes: 19988
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <stdio.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;

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

int main() {

    ll N;
    cin >> N;
    ll a[N];
    rep(i,N) cin >> a[i];
    ll out = 1000000000;
    for(ll i=-100;i<=100;i++){
        ll sum = 0;
        rep(j,N) sum += (a[j]-i)*(a[j]-i);
        if(sum<out) out = sum;
    }
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
const int max = 200000;

void mergeSort(long int* a, long int l, long int r) {
  
  long int m, i, j, k;
  if (l >= r) return;
  
  m = (l+r)/2;
  mergeSort(a, l, m);
  mergeSort(a, m+1, r);
  
  int tmp[max];
  for (i = l; i <= m; i++) tmp[i] = a[i];
  for (i = m + 1, j = r; i <= r; i++, j--) tmp[i] = a[j];
  
  i = l;
  j = r;
  
  for (k = l; k <= r; k++) {
    if (tmp[i] <= tmp[j]) a[k] = tmp[i++];
    else a[k] = tmp[j--];
  }
}

int main(void) {
  long int N;
  scanf("%ld", &N);
  long int X[N], Y[N];
  for (int i = 0; i < N; i++) {
    scanf("%ld", &X[i]);
    Y[i] = X[i];
  }
  
  mergeSort(Y, 0, N-1);
  
  for (int i = 0; i < N; i++) {
    if (X[i] <= Y[N/2-1]) printf("%ld\n", Y[N/2]);
    else printf("%ld\n", Y[N/2-1]);
  }
  
  return 0;
}

Measured memory_bytes: 6016