akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef long long ll;
typedef pair<ll,ll> P;
ll n,m,v,p;
vector<ll>score;
vector<ll>a;
 
bool judge(ll mid){
    if(mid<=p-1){
        if(a[mid]+m>=a[p-1])return true;
        else false;
    }
    else{
        ll num=0;
        for(ll i=0;i<n;i++){
            if(i<p-1)num+=m;
            else{
                if(i>=mid)num+=m;
                else num+=a[mid]+m-a[i];
            }
        }
        if(num>=m*v){
            if(a[mid]+m>=a[p-1])return true;
            else return false;
        }
        else return false;
    }
}
 
int main(void){
    ll ans=0;
    cin>>n>>m>>v>>p;
    a.resize(n,0);
    for(ll i=0;i<n;i++)cin>>a[i];
    sort(a.begin(),a.end(),greater<ll>());
    for(ll i=0;i<p;i++)score.push_back(a[i]);
    ll ok=p-1,ng=n;
    while(ng-ok>1){
        ll mid=(ok+ng)/2;
        if(judge(mid))ok=mid;
        else ng=mid;
    }
    cout<<ok+1<<endl;
    return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n, m; cin >> n >> m;
  priority_queue<ll> que;

  rep(i, n) {
    ll a; cin >> a;
    que.em(a);
  }

  rep(i, m) {
    ll x = que.top(); que.pop();
    que.em(x/2);
  }

  ll ans = 0;
  while (!que.empty()) ans += que.top(), que.pop();

  cout << ans << endl;

  return (0);
}


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

int main(void) {
    int n, x, cnt = 0, d = 0;
    int *l;
    

    scanf("%d%d", &n, &x);

    l = calloc(n, sizeof(int)); 

     int i;

     for (i = 0; i < n; i++) 
        scanf("%d", &l[i]);

    for (i = 0; i < n; i++) {
        d = d + l[i];
        if (d > x)
            break;
    }

    printf("%d\n", i + 1);

    return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
#define fst first
#define snd second
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    ll l, r, d; cin >> l >> r >> d;
    ll c = 0;
    rep(i, l, r+1){
        if(i%d == 0){
            c++;
        }
    }
    prtl(c);
}


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

int main(void){
    int n, m;
    cin>>n>>m;
    vector<pair<int, string> > v(m);
    int pena=0;
    int right=0;
    rep(i, m){
        int a;
        string b;
        cin>>a>>b;
        a--;
        v[i]=make_pair(a, b);
    }

    vector<int> ans(n);//waを出したか回数
    vector<int> ans2(n);//acしたかどうか
    rep(i, m){
        if(v[i].second=="WA"&&ans2[v[i].first]==0){
            ans[v[i].first]++;
        }
        else {
            ans2[v[i].first]=1;
        }
    }
    rep(i, n){
            if(ans2[i]==1){
                right++;
                pena+=ans[i];
            }

        }
    /*rep(i, n) cout<<ans[i]<<endl;
    rep(i, n) cout<<ans2[i]<<endl;*/
    cout<<right<<endl;
    cout<<pena<<endl;

}

Measured memory_bytes: 7296
#pragma region
// Author: Wenxing Mei
//   Date: 2018-09-01 20:28
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// using namespace __gnu_pbds;
#define rep(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define per(i, r, l) for (int i = (int)(r); i >= (int)(l); --i)
#define repv(ele, vec) for (auto &ele : vec)
#define zero(mem) memset(mem, 0, sizeof(mem))
#define sd(_) scanf("%d", &_)
#define sdd(_, __) scanf("%d%d", &_, &__)
#define sddd(_, __, ___) scanf("%d%d%d", &_, &__, &___)
#define sdddd(_, __, ___, ____) scanf("%d%d%d%d", &_, &__, &___, &____)
#define sf(_) scanf("%lf", &_)
#define sff(_, __) scanf("%lf%lf", &_, &__)
#define sfff(_, __, ___) scanf("%lf%lf%lf", &_, &__, &___)
#define sffff(_, __, ___, ____) scanf("%lf%lf%lf%lf", &_, &__, &___, &____)
#define sl(_) scanf("%lld", &_)
#define sll(_, __) scanf("%lld%lld", &_, &__)
#define slll(_, __, ___) scanf("%lld%lld%lld", &_, &__, &___)
#define sllll(_, __, ___, ____) scanf("%lld%lld%lld%lld", &_, &__, &___, &____)
#define sc(_) scanf("%c", &_)
#define ss(_) scanf("%s", _)
#define sz(x) (int)(x).size()
#define boost                                                                                                          \
  ios_base::sync_with_stdio(0);                                                                                        \
  cin.tie(0);
#define mid(a, b) (((a) + (b)) >> 1)
#define lfg(x) x << 1
#define rht(x) x << 1 | 1
#define inf 0x3f3f3f3f
#define all(container) container.begin(), container.end()
//#define MOD 19260817
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#pragma endregion

// Read the question correctly
// What are the exact constraints?
// Look out for SPECIAL CASES (n=1? n=1000000000?) and overflow (ull vs int?)

ii get(int x1, int y1, int x2, int y2) {
  int x3 = -(y2 - y1) + x2;
  int y3 = x2 - x1 + y2;
  return mp(x3, y3);
}

int main() {
  int x1, y1, x2, y2;
  sdddd(x1, y1, x2, y2);

  ii p3 = get(x1, y1, x2, y2);
  int x3 = p3.fi, y3 = p3.se;

  ii p4 = get(x2, y2, x3, y3);
  int x4 = p4.fi, y4 = p4.se;

  printf("%d %d %d %d\n", x3, y3, x4, y4);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <string>

int main(){
    int h, w;
    std::cin >> h >> w;

    int limit = h*w;
    char i, j;    
    std::string keyBuf;
    char valBuf;
    std::map<std::string, char> image;
    for(int i = 1; i <= h; ++i){
        for(int j = 1; j <= w; ++j){
            keyBuf = std::to_string(i) + "," + std::to_string(j);
            std::cin >> valBuf;
            image[keyBuf] = valBuf;
        }
    }

    for(int i = 1; i <= 2*h; ++i){
        for(int j = 1; j <= w; ++j){
            keyBuf = std::to_string((i + 1)/2) + "," + std::to_string(j);
        std::cout << image[keyBuf];
        }
        std::cout << std::endl;
    }

    return 0;
}

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

inline void Yes(){
    cout << "Yes" << "\n";
}
inline void No(){
    cout << "No" << "\n";
}
typedef pair<int,int> P;

int main(){
    int h,k;
    cin >> h >> k;
    if (h <= k){
        cout << 0 << "\n";
        return 0;
    }
    vector<int>v(h);
    for (int i = 0; i < h; i++){
        cin >> v.at(i);
    }
    sort(v.begin(),v.end());
    ll ans=0;
    for (int i = 0; i < h-k; i++){
        ans += v.at(i);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1024
N = int(input())

nums = [int(i) for i in input().split()]

count_dict = {}

for i in nums:
    num_minus = i - 1
    num = i
    num_plus = i + 1
    count_dict.setdefault(num_minus, 0)
    count_dict.setdefault(num, 0)
    count_dict.setdefault(num_plus, 0)
    count_dict[num_minus] += 1
    count_dict[num] += 1
    count_dict[num_plus] += 1
    
print(max(count_dict.values()))


Measured memory_bytes: 18712
#! /usr/bin/python
# -*- coding: utf-8 -*-
# ALDS1_2_C: Stable Sort

import copy

def BubbleSort(A, N):
    minj = 0
    tmp = 0
    flag = 1

    for i in range(1, N):
        for j in reversed(range(i, N)):
            if A[j][1] < A[j-1][1]:
                tmp = A[j]
                A[j] = A[j-1]
                A[j-1] = tmp
    # while flag:
    #     flag = 0    #数値の転倒があることを表すflagを定義
    #     for i in range(1, N):
    #         j = N - i   #末尾から見ていくための変数jを定義
    #         if A[j][1] < A[j-1][1]:   #転倒があるとき
    #             tmp = A[j]  #この行から下の2行目までで、転倒のある部分を入れ替える
    #             A[j] = A[j-1]
    #             A[j-1] = tmp
    #             flag = 1    #転倒があったことを表すflagを立てる。1度入れ替えたところで他にも入れ替えの必要がある要素がある可能性はあるので、そのためのフラグ。
    return A

def SelectionSort(A, N):
    minj = 0
    tmp = 0
    flag = 1
    for i in range(0, N):
        minj = i
        for j in range(i, N):
            if A[j][1] < A[minj][1]:  #一番小さい要素よりも小さいものを記憶する
                minj = j
        tmp = A[i]  #一番小さい要素とi番目の要素を入れ替え
        A[i] = A[minj]
        A[minj] = tmp
        
    return A

def isStable(list1, list2, N):
    for i in range(0, N):
        if list1[i][0] != list2[i][0]:
            print("Not stable")
            return 0
    print("Stable")
    return 0

if __name__ == "__main__":
    N=int(input()) # 数列の長さ
    A=list(input().split()) # 空白を区切文字として配列に格納
    L1 = copy.deepcopy(A)
    L2 = copy.deepcopy(A)
    # print(id(L1), id(L2))
    A1 = BubbleSort(L1, N)
    A2 = SelectionSort(L2, N)
    print(*A1)
    print("Stable")
    print(*A2)
    isStable(A1, A2, N)
    
    


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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	int n, k, g = 0, a, mx = 0;
	scanf("%d%d", &n, &k);
	REP(i, 0, n) {
		scanf("%d", &a);
		g = gcd(g, a);
		mx = max(mx, a);
	}
	if (k % g == 0 && k <= mx) {
		printf("POSSIBLE\n");
	} else {
		printf("IMPOSSIBLE\n");
	}
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string a, b;
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        a = ' ' + a;
        b = ' ' + b;
        vector<vector<int>> dp(a.length(), vector<int>(b.length(), 0));
        for (int j = 1; j < a.length(); j++)
        {
            for (int k = 1; k < b.length(); k++)
            {
                if(a[j] == b[k])
                {
                    dp[j][k] = dp[j - 1][k - 1] + 1;
                }
                else
                {
                    dp[j][k] = max(dp[j - 1][k], dp[j][k - 1]);
                }
            }
        }
        cout << dp[a.length() - 1][b.length() - 1] << "\n";
    }
}


Measured memory_bytes: 6904
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int n,m;
    while(cin>>n>>m){
        if(n==0&&m==0)break;
        int lis[1000]={0};
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                int p;
                cin>>p;
                if(p)lis[j]++;
            }
        }
        int cou=0;
        for(int i=1000;0<=i;i--){
            for(int j=0;j<m;j++){
                if(lis[j]==i){
                    printf("%d",j+1);
                    cou++;
                    if(cou!=m)printf(" ");
                }
            }
        }
        puts("");

    }
    return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string str;
  cin >> str ;
 int count = 0;
  for(int i=0; i < str.size(); i++) {
   
    if(str[i] == 'o'){
    
      count++;
    }  
  }
    cout << 700+(100*count) << endl;
  
}













Measured memory_bytes: 256
h, w = map(int, input().split())
cnt = [0]*w
wRemove = 0
hRemove = 0
squares = []
hRemoveList = []
wRemoveList = []
for _ in range(h) :
        a = list(input())
        squares.append(a)
for i in range(h) :
        for j in range(w) :
                if squares[i][j] == '.' :
                        cnt[j] += 1
for i in range(w) :
        if cnt[i] == h :
                wRemove += 1
                wRemoveList.append(i)
wRemoveList.sort(reverse = True)
if not wRemoveList == [] :
        for i in range(h) :
                for j in wRemoveList :
                        del squares[i][j]
for i in range(h) :
        if squares[i] == ['.']*(w - wRemove) :
                hRemove += 1 
                hRemoveList.append(i)   
hRemoveList.sort(reverse = True)           
for i in hRemoveList :
        del squares[i]
for i in range(h-hRemove) :  
        print(''.join(squares[i])) 

Measured memory_bytes: 3188
// 2009à\IF ÷ÜÁÄ¢±¤
#include <iostream>
#include <complex>
#include <vector>

using namespace std;

typedef complex<double> P;

const double EPS = 1e-8;
const double INF = 1e12;

double cross(P a, P b) { return imag(conj(a)*b); }
double angle(P a, P b) { return arg(conj(a)*b); }

P crossPoint(P lp, P lq, P mp, P mq){
	double A = cross(lq-lp, mq-mp);
	double B = cross(lq-lp, lq-mp);
	return mp + B / A * (mq-mp);
}

bool inTriangle(P a, P b, P c, P p){
	double A = cross(a-p,b-p);
	double B = cross(b-p,c-p);
	double C = cross(c-p,a-p);
	// ¡ñÍÓãÌ_ÍOÆµÄµ¤D¶áÈ¢ÆêxÍ¸ê½jÉÄxøÁ©©éD
	// ë·ÌÖWãC÷¬Èlà0ÆµÄl¦éD
	if(abs(A) < EPS || abs(B) < EPS || abs(C) < EPS) return false; 
	if(A*B < EPS || B*C < EPS || C*A < EPS) return false;
	return true;
}

int main(){
	int m, n, x, y;
	while(cin >> m >> n, m){
		vector<P> vl, vh;
		for(int i=0;i<m;i++){
			cin >> x >> y; vl.push_back(P(x,y));
		}
		for(int i=0;i<n;i++){
			cin >> x >> y; vh.push_back(P(x,y));
		}
		// ÐàªÅIIÉoR·é_ÌW
		vector<P> path;     path.push_back(vl[0]);
		// ÐàªCe_ÉÇê­ç¢ª«Â¢Ä¢é©ðo¦é
		vector<double> rot; rot.push_back(INF);
		P prev(vl[0]), cur(vl[1]);
		for(int i=2;i<m;i++){
			P next(vl[i]);
			while(true){
				P tmp = P(-1,-1);
				double minagl = 1e12;
				for(int j=0;j<n;j++){
					// prev, cur, next©çÈéOp`Éàï³êé_ðT·
					// ¼ü(cur,prev)ÆÈ·pxªÅà¬³¢jÉÐÁ©©é
					if(inTriangle(prev, cur, next, vh[j])){
						double a = abs(angle(cur-prev, vh[j]-prev));
						if(a < minagl){
							minagl = a;
							tmp = vh[j];
						}
					}
				}
				double agl;
				// real(tmp)ªÈçprev,cur,nextðÔOp`àÉ_ª³©Á½±ÆÉÈé
				if(real(tmp)<0) agl = angle(cur-prev,next-prev);
				else            agl = angle(cur-prev,tmp-prev);
				// RªÙÇ¯é»èDaglñµ½Æ«ÉCª½]·éêÍÙÇ¯éD
				// .back() ÅvectorÌÅãÌvfðQÆÅ«é
				if(rot.back()*(rot.back()+agl) < -EPS){
					path.pop_back();
					rot.pop_back();
					cur = crossPoint(prev, path.back(), cur, next);
					prev = path.back();
				} else {
					rot.back() += agl;
					if(real(tmp) < 0){
						// Ó(vl[i-1],vl[i])ãÌT[`I¹
						prev = path.back();
						cur = next;
						break;
					} else {
						// jtmpÉÐÁ©©éDcurÌÊuðißéD
						path.push_back(tmp);
						rot.push_back(0);
						cur = crossPoint(prev, tmp, cur, next);
						prev = tmp;
					}
				}
			}
		}
		// ÅI_ðÇÁ
		path.push_back(vl.back());
		double ans = 0.0;
		for(int i=1;i<path.size();i++) ans += abs(path[i]-path[i-1]);
		printf("%.5f\n", ans);
	}
}

Measured memory_bytes: 980
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<MOD>;

// nCr mod を計算する O(r)
// modintライブラリ必要
mint choose(int n, int r) {
    mint x = 1, y = 1;
    rep(i,r) {
        x *= n-i;
        y *= i+1;
    }
    return x / y;
}

int main() {
    long long N, A, B;
    cin >> N >> A >> B;
    mint res = modpow(mint(2), N) - 1;
    res -= choose(N, A) + choose(N, B);
    cout << res << endl;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define until(x) while(!(x))
#define unless(x) if(!(x))
#define all(x) (x).begin(),(x).end()

string s;
int ar[200005];
int n,a,b,c,d;

int32_t main(){
	//freopen("in.txt","r",stdin);
	cin>>n;
	// snuke: a->c, fnuke: b->d
	cin>>a>>b>>c>>d;
	cin>>s;
	//cout<<"sa2"<<endl;
	//cout<<s.length()<<endl;
	for(int i=1;i<=n;i++){
		ar[i]=(s[i-1]=='.');
		//cout<<i<<endl;
	}
	//cout<<"sa1"<<endl;
	// check no consecutive rocks
	for(int i=a;i<max(c,d);i++){
		unless(ar[i] || ar[i+1]){
			cout<<"No";
			return 0;
		}
	}
	//cout<<"sa"<<endl;
	// check 3 consecutive empty spaces
	if(c>d){
		for(int i=a+1;i<=d;i++){
			if(ar[i-1]&&ar[i]&&ar[i+1] && (i+1)!=b){
				cout<<"Yes";//<<i;
				return 0;
			}
		}
		cout<<"No";
		return 0;
	}
	cout<<"Yes";
}


Measured memory_bytes: 2052
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int cost[5];
    int dif[5];
    int sum = 0;
    int difmax = -1;
    REP(i,5)
    {
        int tmp; cin >> tmp;
        dif[i] = ((tmp+9) / 10) * 10 - tmp;
        dump(dif[i])
        sum += ((tmp+9) / 10) * 10;
        if(difmax < dif[i]) difmax = dif[i];
    }
    dump(sum)
    cout << sum - difmax << endl;





}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin >> s;
    int ans = s.size();
    for(int i = 0; i < s.size()-1; i++)
    {
        if(s[i+1] == s[i]) continue;
        int t = s.size()-i-1;
        int tmp = max(i+1, t);
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long ans = N/11*2;
		long left = N % 11;
		if(left != 0){
			if(left <= 6) ans++;
			else ans += 2;
		}
		Console.WriteLine(ans);
		
	}
	long N;
	public Sol(){
		N = rl();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

const int mod = 1e9 + 7;
const int MAX = 1234567;

long long fac[MAX], finv[MAX], inv[MAX];

inline void mod_add(long long &x, long long y) {
	x += y;
	if(x >= mod) x -= mod;
}

inline void mod_sub(long long &x, long long y) {
	x -= y;
	if(x < 0) x += mod;
}

inline long long mod_mul(long long x, long long y) {
	return (long long) (x % mod * y % mod);
}

inline long long mod_inv(long long x) {
	x %= mod;
	if(x < 0) x += mod;
	long long y = mod, u = 0, v = 1;
	while(y) {
		long long t = y / x;
		y -= t * x; swap(x, y);
		u -= t * v; swap(u, v);
	}
	if(u < 0) u += mod;
	return u;
}

inline long long mod_pow(long long x, long long y) {
	long long res = 1;
	while(y) {
		if(y & 1) res = mod_mul(res, x);
		x = mod_mul(x, x);
		y >>= 1;
	}
	return res;
}

inline void pre_mod_nCk() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for(int i = 2; i < MAX; i++) {
		fac[i] = mod_mul(fac[i - 1], i);
		inv[i] = mod - mod_mul(inv[mod % i], mod / i);
		finv[i] = mod_mul(finv[i - 1], inv[i]);
	}
}

inline long long mod_nCk(int n, int k) {
	if(n < k) return 0;
	if(n < 0 || k < 0) return 0;
	return mod_mul(fac[n], mod_mul(finv[k], finv[n - k]));
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	pre_mod_nCk();
	int h, w, a, b;
	cin >> h >> w >> a >> b;
	long long ans = 0;
	for(int i = 0; i < h - a; i++) {
		mod_add(ans, mod_mul(mod_nCk(b - 1 + i, i), mod_nCk((w - 1 - b) + (h - 1 - i), h - 1 - i)));
	}
	cout << ans << '\n';
	return 0;	
}


Measured memory_bytes: 29184
#[allow(unused_macros)]
macro_rules! invec {
    ( $t:ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s.trim().split_whitespace().map(|s| s.parse::<$t>().unwrap()).collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }}
}

#[allow(unused_macros)]
macro_rules! input {
    ( $($t:ty),* ) => {{
        let mut s = String::new();
        std::io::stdin().read_line(&mut s);
        let mut splits = s.trim().split_whitespace();
        ($(
            {
                 splits.next().unwrap().parse::<$t>().unwrap()
            },
        )*)
    }}
}

#[allow(unused_must_use)]
#[allow(unused_variables)]
fn solve() {
    let (N,) = input!(i64);

    for h in 1..3501 as i64 {
        for n in 1..3501 as i64 {
            let divisor = (4 * h * n) - (N * n) - (h * N);
            if divisor <= 0 {
                continue;
            }
            if (N * h * n) % divisor == 0 {
                println!("{} {} {}", h, n, (N * h * n) / divisor);
                std::process::exit(0);
            }
        }
    }
}

fn main() {
    solve();
}


Measured memory_bytes: 4352
/**
DufauX-XuafuD
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define reset(x) memset(x,-1,sizeof(x))
#define CheckBit(a,b) (a&(1ll<<b))
#define SetBit(a,b) a=(a|(1ll<<b))
#define UnSetBit(a,b) a=(a&(~(1ll<<b)))
#define maxx 1000006
#define PI 2*acos(0.0)
const long long INF = 2000000000000000000LL;	// 2e18
const int inf = 0x3f3f3f3f;	// 1061109567
const long double EPS = 1e-9;
bitset<maxx/2>vis;
vector<ll>prime;
void sieve(){
    ll x=maxx/2, y=sqrt(maxx)/2;
    for(ll i=1;i<=y;i++){
        if(vis[i]==0){
            for(ll j=(i*(i+1)*2);j<x;j+=(2*i)+1)
                vis[j]=1;
        }
    }
    prime.push_back(2);
    for(ll i=3;i<maxx;i+=2)
        if(vis[i/2]==0)
        prime.push_back(i);
}
bool isprime(ll a)
{
    if(a==2){
        return true;
    }
    if(a%2==0){
        return false;
    }
    for(ll i=0;i<prime.size() && prime[i]*prime[i]<=a;i++){
        if(a%prime[i]==0){
            return false;
        }
    }
    return true;
}
ll lcm(ll a,ll b)
{
    return (a*b)/__gcd(a,b);
}
ll gcd(ll a,ll b)
{
    return __gcd(a,b);
}
void Dufaux()
{
    ll arr[6]={0};
    ll number;
    for(int i=1;i<=5;i++){
        cin>>number;
        arr[number]=i;
    }
    cout<<arr[0]<<endl;
    return ;
}
int main()
{
	FastIO;
	///sieve();
	int test=1;
	while(test--){
        Dufaux();
	}
	return 0;
}






Measured memory_bytes: 3640
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in reversed(range(n)):
    x = i + 1
    cnt = 0
    for j in range(x + x, n + 1, x):
        cnt += b[j - 1]
    b[i] = (cnt + a[i]) % 2
ans = []
for i in range(n):
    if b[i]:
        ans.append(i + 1)
print(len(ans))
print(*ans)

Measured memory_bytes: 14140
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
int main() {
	int n, p[8], q[8], t[8], pCnt, qCnt, cnt = 0;
	bool isUse[8], isPerm, isP, isQ;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &p[i]);
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &q[i]);
	}
    int l = pow(n, n) - 1;
	for (int i = 0; i < l; i++) {
		int num = i;
		isPerm = true;
		for (int j = 0; j < n; j++) {
			isUse[j] = false;
		}
		for (int j = 0; j < n; j++) {
			t[j] = num % n + 1;
			isUse[t[j] - 1] = true;
			num /= n;
		}
		for (int j = 0; j < n; j++) {
			if (!isUse[j]) {
				isPerm = false;
				break;
			}
		}
		if (isPerm) {
			cnt++;
			isP = isQ = true;
			for (int j = 0; j < n; j++) {
				if (t[n - j - 1] != p[j]) {
					isP = false;
				}
				if (t[n - j - 1] != q[j]) {
					isQ = false;
				}
				if (!isQ && !isP)
					break;
			}
			if (isP) {
				pCnt = cnt;
			}
			if (isQ) {
				qCnt = cnt;
			}
		}
	}
	printf("%d\n", abs(pCnt - qCnt));
	return 0;
}

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

#define ff              first
#define fo(i,n)         for(i=0;i<n;i++)
#define Fo(i,k,n)       for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define deb(x)          cout << #x << "=" << x << endl
#define deb2(x, y)      cout << #x << "=" << x << "," << #y << "=" << y << endl
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const int N = 2e5 + 1, M = N;
//=======================

vi g[N];
bool vis[N];
int cc;

void ipgraph(int n, int m) {
	int i, u, v;
	while (m--) {
		cin >> u >> v;
		u--, v--;
		g[u].pb(v);
		g[v].pb(u);
	}
}


void dfs(int u) {
	vis[u] = 1;
	cc++;
	for (int v : g[u]) {
		if (!vis[v]) dfs(v);
	}
}

//graph coloring

void solve() {
	int i, j, n, m;
	cin >> n >> m;
	// g.resize(n + 1);
	ipgraph(n, m);
	// vis.assign(n + 1, 0);
	cc = 0;
	int ans = INT_MIN;
	fo(i, n) {
		if (!vis[i]) {
			// cc++;
			cc = 0;
			dfs(i);
			// deb2(i, cc);
			ans = max(ans, cc);
		}
	}
	cout << ans << "\n";
}

int32_t main()
{
	FIO;
#ifndef ONLINE_JUDGE
	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);
#endif
	solve();
	return 0;
}


Measured memory_bytes: 21000
#include <bits/stdc++.h>
#define f first
#define s second
#define ll long long
#define mk make_pair
#define pb push_back
#define pp pop_back
using namespace std ;
const ll N = 1e5 + 100 ;
ll a[N] , b[N] , n , w ,dp[101][N] ; 
vector<vector<int>>v ; 
ll cal (int index , int sum )
{
          
          if ( sum > w ) 
          {
                    return  -1e12;
          }
          if ( index == n  ) 
          {
                    return 0 ; 
          }
          if ( dp[index][sum] != -1)
          {
                    return dp[index][sum];
          }
          //cout << index << " " << sum << endl;
         // return max(cal(index+1,sum+a[index]) + b[index],cal(index+1,sum));
         ll val22 = cal(index+1,sum) ;
          ll val11 = cal(index+1,sum+a[index]) + b[index] ;
          
          return  dp[index][sum] = max(val11,val22) ; 
}
int main () 
{
    // cout << "Hello wolrd" ;
    cin >> n >> w ; 
    for ( int i = 0 ; i < n ; ++i ) 
    {
              cin >> a[i] >> b[i] ; 
    }
    memset(dp,-1,sizeof dp) ; 
    cout <<cal(0,0);
    
}

Measured memory_bytes: 80128
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;
int main(){
  int N;
  cin >> N;
  if(N % 2 == 0)printf("0.5\n");
  else{
    double p = (double)(N+1)/2;
    printf("%.14lf\n",p/N);
  }
}


Measured memory_bytes: 256
#include<iostream>
    #include<string>
    #include<vector>
    #include<math.h>
    #include<cmath>
    #include<stack>
    #include <algorithm>
    #include <functional>
    //#include<stdlib.h>
    using namespace std;
    //bool sosuhante(int x);
    //cin>> cout<<
    //vector<int>v(n(,初期化値));
    //long long int 10^18あたりまで
    //stack<str>s;
    //s.push({ 4,5,2 });
    //s.top().f;
    //メモリ：10^8ぐらい値を取れる
    //std::cin >>[string]    s[]で取り出せる
     
    //std::sort(data.begin(), data.end());//1-n
    //std::sort(&data[0],&data[5]);//上と同じ意味
    //std::sort(data.begin(), data.end(), std::greater<int>());//n-1
    int main() {
    	int n;
    	cin >> n; long long int  a = 0; bool c = true;
    	vector<int>l(n);
    	for (int k = 0; k < n; k++)
    	{
    		cin >> l[k];
    		if (l[k - 1] > 0 && l[k] > 0) { l[k]--; a++; }
    		a += l[k] / 2;
    		l[k] = (l[k] & 1);
    	}
    	cout << a;
    	return 0;
    }

Measured memory_bytes: 640
#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, V A){
    SORT(A);
    ll lo=-INF, hi=INF, ans=0;
    while(lo<=hi){
        ll mid=(lo+hi)/2, cnt=0;
        for (ll i = 0; i < N; i++) {
            if(A[i]<0){
                ll ng=0,ok=N-1,a=N;
                while(ng<=ok){
                    ll m=(ng+ok)/2;
                    if(A[m]*A[i]<=mid) ok=m-1, a=m;
                    else ng=m+1;
                }
                cnt+=N-a;
            }else{
                ll ng=0,ok=N-1,a=-1;
                while(ng<=ok){
                    ll m=(ng+ok)/2;
                    if(A[m]*A[i]<=mid) ng=m+1, a=m;
                    else ok=m-1;
                }
                cnt+=a+1;
            }
            if(A[i]*A[i]<=mid) cnt--;
        }
        cnt/=2;
        if(cnt>=K) ans=mid, hi=mid-1;
        else lo=mid+1;
    }
    cout << ans << endl;
}

int main(){
    ll N; cin>>N;
    ll K; cin>>K;
    V A(N);
    for (ll i = 0; i < N; i++) {
        cin>>A[i];
    }
    solve(N, K, move(A));
    return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
  ll x, y;
  cin >> x >> y;
  ll ans = 0;
  while (x <= y) {
    x *= 2;
    ans++;
  }
  cout << ans << endl;
}

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

Measured memory_bytes: 3608
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

typedef long long ll;

using namespace std;
using namespace boost::multiprecision;

ll gcd(ll a, ll b){
    if(a < b) return gcd(b, a);

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

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

int main(){

    int n,m;
    cin >> n >> m;
    
    vector<ll> a;

    ll lcmi = 1;
    bool b = true;

    rep(i,n){
        int tmp;
        cin >> tmp;

        assert(tmp % 2 == 0);
        a.pback(tmp / 2);
    }

    rep(i,n){

        lcmi = lcm(lcmi, a[i]);

        if(lcmi > (ll)m){
            b = false;
            break;
        }
    }

    rep(i,n){
        
        if((lcmi / a[i]) % 2 == 0){
            b = false;
            break;
        }
    }

    int ans = 0;
    
    if(b){

        for(int i = lcmi; i <= m; i = i + lcmi * 2){
            ans++;
        }

    }

    cout << ans << endl;

    return 0;
}


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

#define For(i, j, k) for (int i = j; i <= k; ++ i)
#define Forr(i, j, k) for (int i = j; i >= k; -- i)

using namespace std;

inline int read() {
	int x = 0, p = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') p = -1;
	for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
	return x * p;
}

inline void File() {
	freopen("C.in", "r", stdin);
	freopen("C.out", "w", stdout);
}

const int N = 100 + 10;
int mn = INT_MAX, mx = INT_MIN, n, a[N], ans = INT_MAX;

inline int cos(int x) {
	int res = 0;
	For(i, 1, n) res += (x - a[i]) * (x - a[i]);
	return res;
}

int main() {
	n = read();
	For(i, 1, n) a[i] = read(), mn = min(mn, a[i]), mx = max(mx, a[i]);

	For(i, mn, mx) ans = min(ans, cos(i));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<algorithm>
#include<cstdio>
#define s(A)std::sort(A,A+10);
main(){
int Z[20],i=0;
for(;i<20;)
scanf("%d",Z+i++);
s(Z);
s(Z+10);
printf("%d %d\n",Z[7]+Z[8]+Z[9],Z[17]+Z[18]+Z[19]);
}

Measured memory_bytes: 0
# ABC 160 C
k, n = map(int, input().split())
a = list(map(int, input().split()))
ans = -1*float('inf')
for i in range(n-1):
  # N番目の家とN-1番目の家の距離まで求める。
  ans = max(ans, a[i+1]-a[i])
  # N番目の家と１番目の家の距離も最後に求めて最大値をとる。
ans = max(k+a[0]-a[n-1], ans)
# 最短距離になる条件は、片道かつ二点間の家の距離が最も大きい区間を避けること、よって円周から導出した最大値を引いた値を出力して終了。
#　N番目の家と一番目の家の距離計算は工夫が必要。
print(k-ans)

Measured memory_bytes: 25840
k = gets.to_i

queue = [[1], [2], [3], [4], [5], [6], [7], [8], [9]]

count = 1
while true
  tmp = queue.shift
  last = tmp.last
  if last == 0
    queue << tmp + [0]
    queue << tmp + [1]
  elsif last == 1
    queue << tmp + [0]
    queue << tmp + [1]
    queue << tmp + [2]
  elsif last == 2
    queue << tmp + [1]
    queue << tmp + [2]
    queue << tmp + [3]
  elsif last == 3
    queue << tmp + [2]
    queue << tmp + [3]
    queue << tmp + [4]
  elsif last == 4
    queue << tmp + [3]
    queue << tmp + [4]
    queue << tmp + [5]
  elsif last == 5
    queue << tmp + [4]
    queue << tmp + [5]
    queue << tmp + [6]
  elsif last == 6
    queue << tmp + [5]
    queue << tmp + [6]
    queue << tmp + [7]
  elsif last == 7
    queue << tmp + [6]
    queue << tmp + [7]
    queue << tmp + [8]
  elsif last == 8
    queue << tmp + [7]
    queue << tmp + [8]
    queue << tmp + [9]
  elsif last == 9
    queue << tmp + [8]
    queue << tmp + [9]
  end
  count += 1
  if count > k
    puts tmp.join
    exit
  end
end


Measured memory_bytes: 38012
#include <stdio.h>

int s[1000];
int i;

void push(int x) {
  s[i]=x;
  i++;
}

int pop() {
  i--;
  return s[i];
}

int main() {
  i=0;
  char c[10];
  while(scanf("%s",c)==1) {
    if(c[0]=='+' || c[0]=='-' || c[0]=='*') {
      int x=pop();
      int y=pop();
      if(c[0]=='+') push(x+y);
      else if(c[0]=='-') push(y-x);
      else push(x*y);
    } else {
      int x=0,k=0;
      while(c[k]>='0' && c[k]<='9') {
	x*=10;
	x+=c[k]-'0';
	k++;
      }
      push(x);
    }
  }
  printf("%d\n",pop());
  return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define debug int debug = 0;
#define RREP(i,a) for(int i=a-1;i>=0;i--)
#define rrep(i,a,b) for(int i=a-1;i>=b;i--)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> Pi;
typedef pair<int, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

int main(){
    ll n, k;
    ll a[100002];
    cin >> n >> k;
    ll oneIndex = -1;
    REP(i, n){
        cin >> a[i];
        if(a[i] == 1){
            oneIndex = i;
        }
    }
    ll ans = 0;
    ll left, right;
    left = oneIndex + 1;
    right = n - oneIndex - 1;
    ll tmp;
    ll rem;
    tmp = (left - 1 + k - 1 - 1) / (k - 1);
    rem = left - tmp * (k - 1) - 1;
    right += rem;
    tmp += (right + k - 1 - 1) / (k - 1);

    left = oneIndex;
    right = n - oneIndex;
    ans = (right - 1 + k - 1 - 1) / (k - 1);
    rem = right - ans * (k - 1) - 1;
    left += rem;
    ans += (left +  k - 1 - 1) / (k - 1);
    ans = min(ans, tmp);
    print(ans);

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define faster() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const long long int infLL = 9000000000000000000;
#define mem(a,b) memset(a, b, sizeof(a) )
#define all(a) (a).begin(),(a).end()
#define mx_int_prime 999999937
const int inf = 2000000000;
const double PI = acos(-1);
const double eps = 1e-9;
typedef long double ld;
#define MOD 1000000007
const unsigned int M = 1000000007;
typedef long long ll;
const int mx=2e5+125;
int ar[mx],br[mx],pos[mx];
#define PB push_back
#define endl '\n'
#define S second
#define F first
void solve()
{
   int n;
   cin>>n;
   string s,t;
   cin>>s>>t;
   string ans="";
   int ck=n/2;
   for(int i=0; i<n; i++)
    ans+=s[i],ans+=t[i];
   cout<<ans<<endl;

}
int main()
{
    faster();
    int tc;
    tc=1;
    while(tc--)
        solve();
    return 0;
}



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

int main()
{
    int c=0;
    string s,s1;
    cin>>s>>s1;
    if(s[0]==s1[0])c++;
    if(s[1]==s1[1])c++;
    if(s[2]==s1[2])c++;

    cout<<c<<endl;


    return 0;
}


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

using namespace std;

int main() {
    string s;
    cin>>s;
    bool p=true;
    for(int i=0;i<s.length();i++){
        if(s[i]=='U'||s[i]=='D'){
            continue;
        }
        else{
            if(i%2==1){
                if(s[i]!='L'){
                    p=false ;
                    break;
                }
            }
            else{
                if(s[i]!='R'){
                    p=false ;
                    break;
                }
            }
        }
    }
    if(p)cout<<"Yes";
    else cout<<"No";

    return 0;
}

Measured memory_bytes: 256
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

a,b,c,d = I()
print(max(a*d,a*c,b*d,b*c))

Measured memory_bytes: 72688
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#define MOD 1000000007
typedef long long ll;
using namespace std;

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

  cout<<180*(N-2)<<endl;

  return 0;
}


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

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
   ll n, m; cin >> n >> m;
    vector<ll> a(n); rep (i, n) cin >> a[i];
    ll sum = 0; rep (i, n) sum += a[i];
    int x = 0;
    rep (i, n) if (a[i] * 4LL * m >= sum) x++;
    if (x >= m) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int n;
	cin >> n;
	int A[114514];
	for (int i = 0; i < n; i++)cin >> A[i];
	int m1 = 0;
	for (int i = 0; i < n; i++) {
		if (i % 2 == 0)m1 += A[i];
		else m1 -= A[i];
	}
	cout << m1 << endl;
	for (int i = 1; i < n; i++) {
		m1 = 2*A[i-1] - m1;
		cout << m1 << endl;
	}
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1050;
int ans[maxn][maxn];
int cnt[maxn];
int main() {
	int n,m,A,B;
	int x=-1,y=-1;
	scanf("%d%d%d%d", &n,&m,&A,&B);
	for(int i = 0; i <= n; ++i) {
		ll t=(ll)i*A+(ll)(n-i)*(m-A);
		for(int j = 0; j <= m; ++j) {
			ll T=(ll)j*B+(ll)(m-j)*(n-B);
			if(t==T) {
				x=i, y=j;
				break;
			}
		}
		if(x>=0) break;
	}
	if(x==-1) {
		puts("-1");
		return 0;
	}
	for(int i = 1; i <= n; ++i) {
		if(i<=x) cnt[i]=A;
		else cnt[i]=m-A;
	}
	for(int j = 1; j <= m; ++j) {
		int t=0;
		t=(j<=y?B:n-B);
		for(int i = 1; i <= n; ++i) {
			if(!t) break;
			if(cnt[i]) --cnt[i], ans[i][j]=1,--t;
		}
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			printf("%d%s", ans[i][j], j==m?"\n":"");
		}
	}
	return 0;
}


Measured memory_bytes: 5376