akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new MyInputStream(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(MyInputStream cin)
        {
            var N = cin.ReadInt();
            var ret = NearPow2(N);
            if (BitCount((uint)N) == 1) WriteLine(ret);
            else WriteLine(ret >> 1);
        }

        /// <summary>n以上の最小の2のべき乗を求める</summary>
        public static int NearPow2(int n)
        {
            if (n <= 0) return 0;
            n -= 1;
            n |= n >> 1;
            n |= n >> 2;
            n |= n >> 4;
            n |= n >> 8;
            n |= n >> 16;
            return n + 1;
        }

        public static int BitCount(uint n)
        {
            n = (n & 0x55555555) + ((n >> 1) & 0x55555555);
            n = (n & 0x33333333) + ((n >> 2) & 0x33333333);
            n = (n & 0x0f0f0f0f) + ((n >> 4) & 0x0f0f0f0f);
            n = (n & 0x00ff00ff) + ((n >> 8) & 0x00ff00ff);
            return (int)((n & 0x0000ffff) + ((n >> 16) & 0x0000ffff));
        }
    }

    public class MyInputStream
    {
        private readonly System.IO.TextReader _stream;
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(System.IO.TextReader s, char separator = ' ')
        {
            this.separator = separator;
            this._stream = s;
            inputStream = new Queue<string>();
        }
        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = _stream.ReadLine().Split(separator);
            for (int i = 0; i < tmp.Length; ++i)
                inputStream.Enqueue(tmp[i]);
            return inputStream.Dequeue();
        }
        public string ReadLine() { return _stream.ReadLine(); }
        public int ReadInt() { return int.Parse(Read()); }
        public long ReadLong() { return long.Parse(Read()); }
        public double ReadDouble() { return double.Parse(Read()); }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read(); return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt(); return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong(); return ret;}
    }
}

Measured memory_bytes: 13268
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;
int main()
{
	int A,B;
	cin >> A >> B;

	if((A+B)%2==0)
	{
		cout << (A+B)/2 << endl;
	}
	else{
		cout << "IMPOSSIBLE" << endl;
	}

}

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

int main(){
  string s ; cin >> s ;
  vector<int> cnt(26,0) ;
  for(int i=0;i<s.size();i++){
    cnt.at(s.at(i)-'a')++ ;
  }
  for(int i=0;i<26;i++){
    if(cnt.at(i)%2!=0){
      cout << "No" << endl ;
      return 0 ;
    }
  }
  cout << "Yes" << endl ;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  height, width, _ = map(int, input().split())
  r, c = map(int, input().split())
  s_coms = input()[::-1]
  t_coms = input()[::-1]
  left = 0
  right = 0
  up = 0
  down = 0

  for s, t in zip(s_coms, t_coms):
    if t == 'L':
      right = max(right - 1, 0)
    elif t == 'R':
      left = max(left - 1, 0)
    elif t == 'U':
      down = max(down - 1, 0)
    elif t == 'D':
      up = max(up - 1, 0)

    if s == 'L':
      left = left + 1
    elif s == 'R':
      right = right + 1
    elif s == 'U':
      up = up + 1
    elif s == 'D':
      down = down + 1

    if left >= width or right >= width or up >= height or down >= height:
      print('NO', flush=True)
      return

  if up < r <= height - down and left < c <= width - right:
    print('YES')
  else:
    print('NO')


if __name__ == '__main__':
  main()



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

int main() {
  int A, B;
  cin >> A >> B;
  int i = 0;
  
  for (int j = A; j <= B; j++) {
    int n1,n2,n3,n4,n5;
    n1 = j / 10000;
    n2 = (j - n1*10000) / 1000;
    n3 = (j - n1*10000 - n2*1000) / 100;
    n4 = (j - n1*10000 - n2*1000 - n3*100) / 10;
    n5 = j % 10;
    if (n1 == n5 && n2 == n4) {
      i++;
    }
  }
  
  cout << i << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H):
    '''
    H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) #一列の場合
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

# https://atcoder.jp/contests/abc106/tasks/abc106_c
S = input()
K = read_a_int()
# 1だけはそのままでそれ以外だと無限の長さになる
# 答えは1か初めて1以外になる数字に成る
for i, s in enu(S, start=1):
    if s != '1':
        print(s)
        exit()
    if i == K:
        print(1)
        exit()


Measured memory_bytes: 3316
MOD = 1000000007
t = input()
b = input()
lent = len(t)
lenb = len(b)
dp = [0] * (lenb + 1)
dp[0] = 1
for x in range(1, lent + 1):
  ct = t[x - 1]
  for y in range(lenb, 0, -1):
    if ct == b[y - 1]:
      dp[y] += dp[y - 1]
      dp[y] %= MOD
print(dp[lenb])


Measured memory_bytes: 5568
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7, A = 1e3 + 2;
int n, m, price[A], masks[8888];
ll dp[A][8888];
ll solve(int ind, int mask) {
    if (ind == m)
        return (mask == (1 << n) - 1 ? 0 : 1e18);
    if (~dp[ind][mask])
        return dp[ind][mask];
    ll val = solve(ind + 1, mask);
    val = min(val, solve(ind + 1, mask | masks[ind]) + price[ind]);
    return dp[ind][mask] = val;
}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int x, y;
        cin >> price[i] >> x;
        while(x--)
            cin >> y, masks[i] |=(1 << (y - 1));
    }
    memset(dp, -1, sizeof dp);
    ll ans = solve(0, 0);
    cout << (ans >= 1e18 ? -1 : ans);
    return 0;
}

Measured memory_bytes: 73260
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N, Q;
	cin >> N >> Q;

	// t = x - D_i と x = X_j (S_j <= t <= T_j) が交わるD_iの範囲を計算しておく
	vector <pair<pair<int, int>, int>> stx(N);
	for (int i = 0; i < N; i++) {
		int s, t, x;
		cin >> s >> t >> x;
		stx[i] = { { max(0, s - x), t - x }, x };
	}
	sort(stx.begin(), stx.end());

	set<pair<int,int>> st;
	vector<int> ans(Q, INF);
	auto first = stx.begin();
	auto last = stx.end();
	for (int i = 0; i < Q; i++) {

		int d;
		cin >> d;

		// add
		last = upper_bound(stx.begin(), stx.end(), make_pair(make_pair(d, INF), INF));
		for (auto itr = first; itr != last; itr++) st.emplace(itr->second, itr->first.second);
		first = last;

		//erase
		vector<pair<int, int>> memo;
		for (const auto &e : st) {
			if (d < e.second) {
				ans[i] = e.first;
				break;
			}
			else memo.emplace_back(e);
		}
		for (const auto e : memo) st.erase(e);

	}

	for (const auto &e : ans) cout << (e == INF ? - 1 : e) << "\n";

	return 0;
}


Measured memory_bytes: 15000
#include <iostream>
using namespace std;
int main(void){
    
    int N, X, L;
    int ans = 1;
    int point_X = 0;
    cin >> N >> X;
    
    for(int i = 0; i < N; i++){
        cin >> L;
        point_X += L;
        if(point_X <= X) ans++;
    }
    
    cout << ans << endl;
    
}


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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("d",&a,&b)
#define sfff(a,b,c)     scanf("d%d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int z=1 ; z<=t ; z++)
#define PRINT_CASE printf("Case %d: ",z)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;
int n,weight;
ll DP[110][maxn];
int w[110],v[110];

ll cal(int wgt, int pos)
{

    if(pos==n || wgt<0)
    {
        return 0LL;
    }

    ll &res = DP[pos][wgt];
    if(res!=-1)
        return res;

    res =  cal(wgt, pos+1);
    if(w[pos]<=wgt) res=max(res,cal(wgt-w[pos],pos+1)+v[pos]);

    return res;
}


int main()
{
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin>>n>>weight;

    f0(i,n)
    {
        cin>>w[i]>>v[i];
    }
    memset(DP, -1, sizeof(DP));

    cout<<cal(weight,0)<<endl;



    return 0;
}



Measured memory_bytes: 172160
import java.util.*;

 class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		int x = (int)(Math.log(n)/Math.log(2));
	    System.out.println((long)(Math.pow(2,x+1)-1));
	}
}



Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define V vector<int>
#define COUT(x) cout<<(x)<<endl
#define M map<int,int>
#define S set<int>
#define PQ priority_queue<int>
#define PQG priority_queue<int,V,greater<int>>

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

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
	if (a.second != b.second) {
		return a.second < b.second;
	}
	else {
		return a.first < b.first;
	}
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<P>tmp;
	rep(i, n) {
		int a, b; cin >> a >> b;
		tmp.push_back(make_pair(a, b));
	}
	sort(ALL(tmp), compare_by_b);
	int now = 0;
	rep(i, n) {
		now += tmp[i].first;
		if (now > tmp[i].second) {
			cout << "No" << endl; return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 6512
H,W=map(int,input().split())
a=[[int(i) for i in input().split()] for i in range(H)]
E=[]
b=[[(0,0) for i in range(W)] for j in range(H)]
for i in range(H):
    for j in range(W):
        if a[i][j]%2==1:
            E.append((i,j))
for i in range(H):
    for j in range(W):
        if i%2==0:
            if j==W-1:
                if i==H-1:
                    b[i][j]=(-1,-1)
                else:
                    b[i][j]=(i+1,j)
            else:
                b[i][j]=(i,j+1)
        else:
            if j==0:
                if i==H-1:
                    b[i][j]=(-1,-1)
                else:
                    b[i][j]=(i+1,j)
            else:
                b[i][j]=(i,j-1)
c=[[0 for i in range(W)] for i in range(H)]
p=(0,0)
k=0
while(True):
    c[p[0]][p[1]]=k
    k+=1
    p=b[p[0]][p[1]]
    if p[0]==-1 and p[1]==-1:
        break
F=sorted([(c[p[0]][p[1]],p[0],p[1]) for p in E])
N=len(F)//2
G=[]
for i in range(N):
    x=F[2*i]
    y=F[2*i+1]
    G.append((x[1],x[2],y[1],y[2]))
ans=[]
for pair in G:
    st=(pair[0],pair[1])
    fi=(pair[2],pair[3])
    np=st
    while(True):
        xp=b[np[0]][np[1]]
        if xp==(-1,-1):
            break
        ans.append((np[0],np[1],xp[0],xp[1]))
        if xp==fi:
            break
        np=xp
print(len(ans))
for t in ans:
    print(t[0]+1,t[1]+1,t[2]+1,t[3]+1)


Measured memory_bytes: 103168
#include "bits/stdc++.h"
#define LF '\n'
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<i64,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;
template<class Itr>void dump(Itr begin, Itr end) {
  for(;begin != end; ++begin) clog << ' ' << *begin;
  clog << LF;
}

int N;
i64 a[100100], b[100100];
pii dif[100100];
bool used[100100];

signed main()
{
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < N; ++i) {
    cin >> b[i];
  }


  for (int i = 0; i < N; ++i) {
    dif[i] = pii(a[i] - b[i],  i);
  }
  sort(dif, dif+N, greater<pii>());

  priority_queue<pii> large;
  priority_queue<pii> ls;


  for (int i = 0; i < N; ++i) {
    if (dif[i].first >= 0) {
      large.emplace(dif[i]);
    } else {
      ls.emplace(dif[i]);
    }
  }

  i64 stock = 0;
  while( large.size() )
  {
    if (ls.empty()) {
      break;
    }

    const auto big = large.top(); large.pop();
    // printf("\nbig: %5ld, %2d,  stock:%ld\n", big.first, big.second, stock);

    used[big.second] = true;
    stock += big.first;

    while( ls.size() && (abs(ls.top().first) <= stock) )
    {
      const auto sml = ls.top(); ls.pop();
      // printf("    sml: %5ld, %2d\n", sml.first, sml.second);
      used[sml.second] = true;
      stock -= abs(sml.first);
      // printf("    stock: %ld\n\n", stock);
    }
  }

  if ( !ls.empty() ) {
    cout << -1 << endl;
    return 0;
  }

  int ans = 0;
  for (int i = 0;i < N; ++i ) {
    if (used[i]) ++ans;
  }

  // printf("::::stock: %ld\n\n", stock);
  // if (stock > 0) ++ans;

  cout << ans << endl;


  return 0;
}



Measured memory_bytes: 5748
#include <stdio.h>
#include<math.h>
int main(void){
   double x1,y1,x2,y2;
   scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
   printf("%lf\n",sqrt(pow(x2-x1,2)+pow(y2-y1,2)));
    return 0;
}

Measured memory_bytes: 2752
#include<cmath>
#include<cstdio>
#include<algorithm>

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

using namespace std;

const double EPS=1e-8;

template<class T>
struct point3{
	T x,y,z;
	point3 &operator+=(const point3 &a){ x+=a.x; y+=a.y; z+=a.z; }
	point3 &operator-=(const point3 &a){ x-=a.x; y-=a.y; z-=a.z; }
	point3 operator-(const point3 &a)const{ return (point3){x-a.x,y-a.y,z-a.z}; }
};

template<class T>
point3<T> operator*(T c,const point3<T> &a){
	return (point3<T>){c*a.x,c*a.y,c*a.z};
}

template<class T>
struct sphere{
	point3<T> c;
	T r;
};

template<class T>
double abs(const point3<T> &a){
	return sqrt((double)a.x*a.x+(double)a.y*a.y+(double)a.z*a.z);
}

template<class T>
T abs2(const point3<T> &a){ return a.x*a.x+a.y*a.y+a.z*a.z; }

bool cover(const sphere<double> &S,const point3<double> &p){
	return abs(S.c-p)<S.r+EPS;
}

template<class T>
T dot(const point3<T> &a,const point3<T> &b){ return a.x*b.x+a.y*b.y+a.z*b.z; }

class smallest_enclosing_ball{
	static const int DIM=3;

	int n;
	point3<double> *P;

	int n_bd;
	point3<double> bd[DIM+1];

	sphere<double> naive(){
		if(n_bd==0) return (sphere<double>){(point3<double>){0,0},-1};

		point3<double> v[DIM];
		double z[DIM];

		point3<double> cen=bd[0];
		double R2=0;
		rep(i,n_bd-1){
			point3<double> delta=bd[i+1]-cen;

			v[i]=delta;
			rep(j,i){
				v[i]-=dot(v[j],delta)/z[j]*v[j];
			}
			z[i]=dot(v[i],v[i]);

			double mag=abs2(delta)-R2;
			cen+=mag/(2*z[i])*v[i];
			R2+=mag*mag/(4*z[i]);
		}

		return (sphere<double>){cen,sqrt(R2)};
	}

	sphere<double> dfs(int i){
		if(i==n || n_bd==DIM+1) return naive();

		sphere<double> S=dfs(i+1);
		if(S.r==-1 || !cover(S,P[i])){
			bd[n_bd++]=P[i];
			S=dfs(i+1);
			n_bd--;
		}
		return S;
	}

public:
	sphere<double> solve(int n,point3<double> *P){
		this->n=n;
		this->P=P;
		random_shuffle(P,P+n);
		n_bd=0;
		return dfs(0);
	}
};

int main(){
	for(int n;scanf("%d",&n),n;){
		point3<double> p[30];
		rep(i,n) scanf("%lf%lf%lf",&p[i].x,&p[i].y,&p[i].z);

		smallest_enclosing_ball SEB;
		printf("%.9f\n",SEB.solve(n,p).r);
	}

	return 0;
}

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

map<string,int> m;
int32_t main(){
	int n;
	cin>>n;
	string s;
	int t;
	int cur=0;
	for(int i=1;i<=n;i++){
		cin>>s>>t;
		m[s]=(cur+=t);
	}
	string last;
	cin>>last;
	int tot = cur;
	cout<<tot-m[last];
}


Measured memory_bytes: 256
from sys import stdin

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

def fn(a, x):
    return 5*a*(a**3 - 2*x*a**2 +2*(x**2)*a - x**3)

X =  int(stdin.readline().rstrip())
factors = factorization(X)

combi = []
combination = 1
for i in range(len(factors)):
    combi.append(factors[i][1])
    combination*=combi[i]+1

aa = [0 for _ in range(len(factors))]
candidate_list = []
for i in range(combination):
    candidate = 1
    for j in range(len(factors)):
        candidate *= factors[j][0]**aa[j]
    candidate_list.append(candidate)

    temp_pos = len(aa)-1

    while(True):
        aa[temp_pos] += 1
        if aa[temp_pos] > combi[temp_pos]:
            aa[temp_pos] = 0
            temp_pos -=1
            continue
        elif temp_pos==0 and aa[temp_pos] > combi[temp_pos] :
            break
        else:
            break




for i in range(len(candidate_list)):
    # 5A(A**3 )
    x = candidate_list[i]
    a=1
    flag=0
    comp = X/x - x**4
    check = X**0.3
    while(True):
        val = fn(a,x)
        if val ==comp:
            flag=1
            print(a, a-x)
            break
        #elif (a**3 > x**3*2) and check < a:
        elif val > comp and a> check:
            break
        a+=1
    if flag==1:
        break
        
if flag==0:
    print("1 1")




Measured memory_bytes: 69044
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#define DEBUG printf("Passing Line %d in Function [%s].\n",__LINE__,__FUNCTION__);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

const int INF = 0x3f3f3f3f;
const string S = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
const int L = 128;

int n;
string vec[66];

int Query(const string &s){
    cout << "? " << s << endl;
    int res;
    cin >> res;
    return res;
}

string dfs(int l,int r){
    if(l==r){
		return vec[l];
	}
	int mid=(l+r)>>1;
	string L=dfs(l,mid),R=dfs(mid+1,r),myh;
	int j=0;
	for(int i=0;i<(int)L.length();++i){
		while(j<(int)R.size()){
			string s=myh+R[j]+L.substr(i,L.length()-i);
			cout<<"? "<<s<<endl;
			int qwq;
			cin>>qwq;
			int o=L.length()+j+1;
			if(n-qwq!=o)break;
			myh+=R[j++];
		}
		myh+=L[i];
	}
	myh+=R.substr(j,R.length()-j);
	return myh;
}

int main(){
    // freopen("data.in","r",stdin);
    // freopen("data.out","w",stdout);
    int cnt=0;
    for(char c : S){
        string s(128,c);
        int num = 128 - Query(s);
        if(num)vec[cnt++]=s.substr(0,num);
        n += num;
    }
    string ans = dfs(0,cnt-1);
    cout << "! " << ans << endl;
    return 0;
}


Measured memory_bytes: 3804
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------
int h, w;
vector<string> a;
ll memo[1010][1010];

bool isinside(int i, int j){
    if(i >= 0 && i < h && j >= 0 && j < w){
        return true;
    } else {
        return false;
    }
}

ll dp(int i, int j){
    if(i <= 0 && j <= 0) return memo[i][j] = 1;
    if(a[i][j] == '#') return memo[i][j] = 0;
    if(memo[i][j] != -1) return memo[i][j];

    ll res = 0;
    if(isinside(i - 1, j)){
        if(a[i - 1][j] == '.'){
            res += dp(i - 1, j) % MOD;
        }
    }
    if(isinside(i, j - 1)){
        if(a[i][j - 1] == '.'){
            res += dp(i, j - 1) % MOD;
        }
    }

    return memo[i][j] = (res % MOD);
}

int main(void){
    cin >> h >> w;
    a.resize(h);
    for(int i = 0; i < h; i++) cin >> a[i];

    for(int i = 0; i <= h; i++){
        for(int j = 0; j <= w; j++){
            memo[i][j] = -1;
        }
    }

    cout << dp(h - 1, w - 1) << endl;
}

Measured memory_bytes: 9344
import java.io.CharArrayReader;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> arr = new ArrayList<Integer>();
        for(int i=0;i<5;i++)arr.add(sc.nextInt());
        int k=sc.nextInt();
        Collections.sort(arr);
        if(arr.get(4)-arr.get(0)>k)System.out.println(":(");
        else System.out.println("Yay!");
    }
}


Measured memory_bytes: 35632
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
	
	public class Main {
	
		public static void main(String[] args) {
			execute17_4();
		}
		
		private static void execute17_4() {
			try 
			(Scanner sc = new Scanner(System.in)) {
				int n = sc.nextInt();
				
				if(n<30) {
					System.out.println("No");
				} else {
					System.out.println("Yes");
				}
			}
			
		}
    }

Measured memory_bytes: 27056
#include<bits/stdc++.h>
#define ll long long
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(i, n) for(int i=0; i<=n; i++)
#define repr(i, n) for(int i=n; i>0; i--)
#define REPR(i, n) for(int i=n; i>=0; i--)
const ll INF = 1e18;
const int INT_INF = 1e9;
const ll MOD = 1e9+7;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

int N;
double a;
double denom = 0.0;

int main() {
    cin >> N;
    rep(i, N) {
        cin >> a;
        denom += (1 / a);
    }
    cout << setprecision(16) << 1 / denom << endl;
}


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

#define iter_v(v, t) vector<t>::iterator
#define each(i, v, t) for(iter_v(v, t) i = (v).begin(); i != (v).end(); ++i)

using namespace std;

int main( void )
{
	int n;
	bool card[201];
	while(cin >> n, n) {
		memset(card, true, sizeof(card));
		vector<int> t, h;
		for(int i=0; i < n; ++i) {
			int a; cin >> a;
			card[a] = false;
		}
		n *= 2;
		for(int i=1; i <= n; ++i) {
			if(card[i]) h.push_back(i);
			else		t.push_back(i);
		}
		int ba = 0;
		while(!h.empty()) {
			bool hit = false;
			each(it, t, int) {
				if(ba < *it) {
					ba = *it;
					t.erase(it);
					hit = true;
					break;
				}
			}
			if(!hit)
				ba = 0;
			if(t.empty()) break;
			hit = false;
			each(it, h, int) {
				if(ba < *it) {
					ba = *it;
					h.erase(it);
					hit = true;
					break;
				}
			}
			if(!hit)
				ba = 0;
		}
		cout << h.size() << endl;
		cout << t.size() << endl;
	}
	return 0;
}

Measured memory_bytes: 0
/**
*    author:  souzai32
*    created: 15.08.2020 18:14:27
**/

#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
typedef long long ll;
using namespace std;

int main() {

    string s;
    cin >> s;
    int n=s.size();
    int left=0,right=0;
    rep(i,n){
        if(s.at(i)=='S') right++;
        if(s.at(i)=='T'){
            if(right) right--;
            else left++;
        }
    }
    cout << left+right << endl;

    return 0;
}

Measured memory_bytes: 3748
import java.util.Scanner;
import java.lang.Math;
public class Main {
  public static void main (String[]args) {
    Scanner sc = new Scanner(System.in);
    String b = sc.next();
    String ans = "";
    if(b.equals("A")){
      ans = "T";
    } else if(b.equals("T")){
      ans = "A";
    }  else if(b.equals("C")){
      ans = "G";
    }  else if(b.equals("G")){
      ans = "C";
    }
  
    System.out.println(ans);


  }
}


Measured memory_bytes: 23124
import java.util.Scanner;
  
class Main{
 public static void main(String[] arge){
    
 Scanner sc=new Scanner(System.in);
  
 int w=sc.nextInt();
 int h=sc.nextInt();
 int x=sc.nextInt();
 int y=sc.nextInt();
 int r=sc.nextInt();


if((x+r<=w && x-r>=0) && (y+r<=h && y-r>=0)){

System.out.println("Yes");}

else{
System.out.println("No");}

}}




Measured memory_bytes: 26236
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main(int argc, const char *argv[]) {
  int N, M;
  long sum = 0;
  long res;
  cin >> N >> M;
  vector<int> A(M);

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

  res = N - sum;
  if (res < 0) {
    cout << "-1" << endl;
  } else {
    cout << N - sum << endl;
  }

  return 0;
}


Measured memory_bytes: 3604
import sys
import numpy as np
from numba import jit
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, K, *A = map(int, read().split())
K = min(50,K)

@jit
def imos(A):
  B = np.zeros_like(A)
  for i,x in enumerate(A):
    a = max(0,i-x)
    b = min(N-1,i+x)
    B[a] += 1
    if b+1 <= N-1:
      B[b+1] -= 1
  B = np.cumsum(B)
  return B

for i in range(K):
  if i >= 50:
    break
  A = imos(A)
print(*A)

Measured memory_bytes: 128628
if __name__ == "__main__":
    h, w = map(int, input().split())
    n = int(input())
    an = list(map(int, input().split()))

    seq = []
    for i, ai in enumerate(an):
        seq.extend([i+1]*ai)

    rows = [seq[s:e] for s, e in zip(range(0, h*w, w), range(w, h*w+w, w))]
    rows = [row if i%2 == 0 else row[::-1] for i, row in enumerate(rows)]

    for row in rows:
        print(' '.join(map(str, row)))



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

#define int long long
#define fi first
#define se second
#define otp(n) cout << n;
#define ct(n) cout << n << endl;
#define cts(n) cout << n << " ";
#define cte cout << endl;
#define ctv(v) rep(i,(v).size()) ct(v[i])
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repo(i,o,n) for(int i=o;i<n;i++)
#define repm(i,n) for(int i=n-1;i>=0;i--)
#define repv(i,v) for(int i=0;i<(v).size();i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end());
#define vdelete(v) (v).erase(unique(all(v)), (v).end());
#define pb(n) push_back(n);

int n,a,k,GCD,MAX;

int gcd(int a ,int b) {
    if (a<b) swap(a,b);
    while(b) {
        a %= b;
        swap(a,b);
    }
    return a;
}

main() {
    cin >> n >> k >> GCD;
    MAX = GCD;
    rep(i,n-1) {
        cin >> a;
        GCD = gcd(GCD,a);
        MAX = max(MAX,a);
    }
    if ((k%GCD) || k > MAX) ct("IMPOSSIBLE")
    else ct("POSSIBLE")
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <iomanip>
#include <map>
#include <algorithm>

using namespace std;

using ll = long long;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;

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

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

    cout << lucas[N] << endl;

    return 0;
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

int N,M;
int H[100005];

bool good[100005];
int ans;

signed main(){
    cin>>N>>M;
    for(int i=0;i<N;++i){
        cin>>H[i];
        good[i]=true;
    }
    for(int i=0;i<M;++i){
        int a,b;
        cin>>a>>b;
        a--,b--;
        if(H[a]<=H[b])good[a]=false;
        if(H[a]>=H[b])good[b]=false;
    }
    for(int i=0;i<N;++i)if(good[i])ans++;
    cout<<ans<<endl;
}

Measured memory_bytes: 4524
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;
template <int mod>
struct ModInt {
    int val;
    ModInt() : val(0) {}
    ModInt(long long x) : val(x >= 0 ? x % mod : (mod - (-x) % mod) % mod) {}
    int getmod() { return mod; }
    ModInt &operator+=(const ModInt &p) {
        if ((val += p.val) >= mod) {
            val -= mod;
        }
        return *this;
    }
    ModInt &operator-=(const ModInt &p) {
        if ((val += mod - p.val) >= mod) {
            val -= mod;
        }
        return *this;
    }
    ModInt &operator*=(const ModInt &p) {
        val = (int)(1LL * val * p.val % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }
    ModInt operator-() const { return ModInt(-val); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return val == p.val; }
    bool operator!=(const ModInt &p) const { return val != p.val; }
    ModInt inverse() const {
        int a = val, b = mod, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }
    ModInt pow(long long n) const {
        ModInt ret(1), mul(val);
        while (n > 0) {
            if (n & 1) ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.val; }
    friend istream &operator>>(istream &is, ModInt &a) {
        long long t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }
    static int get_mod() { return mod; }
};
const int MOD = 1000000007;  // if inv is needed, this shold be prime.
using modint = ModInt<MOD>;

int main() {
    int N;
    cin >> N;
    modint ans(1);
    for (int i = 0; i < N; i++) {
        ans *= (i + 1);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3612
// #include <bits/stdc++.h>
#include <iostream>
#include <string>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  string s;
  cin >> s;
  int ans = 700;
  ans += (s[0] == 'o') * 100;
  ans += (s[1] == 'o') * 100;
  ans += (s[2] == 'o') * 100;
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>
#define MAX 200000
#define SENTINEL 2000000000
typedef long long llong;
int L[MAX/2+2],R[MAX/2+2];

llong merge(int A[],int n, int left, int mid, int right)
{
	int i,j,k;
	llong cnt=0;
	int n1 = mid -left;
	int n2 = right - mid;
	for(i=0; i<n1;i++)
	{
		L[i] = A[left+i];
	}
	for(int i=0;i<n2;i++)
	{
		R[i] = A[mid+i];
	}
	L[n1]=R[n2]=SENTINEL;
	i=0;
	j=0;
	for(k=left;k<right;k++)
	{
		if(L[i]<=R[j])
		{
			A[k]=L[i++];
		}
		else
		{
			A[k]=R[j++];
			cnt += n1-i;
		}
	}
	return cnt;

}

llong mergeSort(int A[],int n,int left,int right)
{
	int mid;
	llong v1, v2, v3;
	if(left+1<right)
	{
		mid = (left+right)/2;
		v1=mergeSort(A,n,left,mid);
		v2=mergeSort(A,n,mid,right);
		v3=merge(A,n,left,mid,right);
		return v1+v2+v3;
	}else return 0;
}

int main()
{
	int A[MAX],n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	}
	llong ans=mergeSort(A,n,0,n);

	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 3328
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn count(s: String) -> [u8; 26] {
    let mut a = [0; 26];
    for c in s.chars() {
        a[(c as u8 - 'A' as u8) as usize] += 1;
    }
    a
}

fn main() {
    let b = count(read_line())
        .into_iter()
        .filter(|&&n| n == 2_u8)
        .count() == 2;
    println!("{}", if b { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#include <math.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(){
  ll N, A, B; cin >> N >> A >> B;
  ll ans = 0;
  if ((A + B) % 2 != 1) {
    ans = (B - A) / 2;
    
  } else {
    ll distBN = N - B;
    ll dist0A = A - 1;
    if ((B - A) > (distBN || dist0A)) {
      if (distBN > dist0A) ans = dist0A;
      else ans = distBN;      
      ans++;
      ans += (B - A) / 2;
    } else if (B - 1 > N - A) {
      ans = N - A;
    } else {
      ans = B - 1;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  string s;
  cin >> s;
  int n = s.size();
  rep(i,n){
    cout << 'x';
  }
  cout << "\n";
  return 0;
}


Measured memory_bytes: 256
def resolve():
    n, k = map(int, input().split())
    a=0
    for i in range(k,n+2):
        a+=(n*(n+1)/2)-((n-i)*(n-i+1)/2)
        a-=(i-1)*i/2-1
    print(int(a%(10**9+7)))
resolve()

Measured memory_bytes: 63580
import itertools
def permutation_all(seq, choice):
    return list(itertools.permutations(seq, choice))

a = []
for i in range(5):
    a.append(int(input()))
p = permutation_all(a,5)
ans = 1000000000
for i in range(len(p)):
    point = p[i]
    tot = 0
    for j in range(5):
        if j != 4:
            tot += (point[j]+9)//10 * 10
        else:
            tot += point[j]
    ans = min(ans,tot)
print(ans)



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

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> dp(n);
    fill(dp.begin(), dp.end(), 0x3f3f3f3f);
    dp[0] = 0;
    for (int i = 0; i < a.size(); i++) {
        for (int j = 1; j <= k; j++) {
            if (i + j < a.size()) {
                dp[i+j] = min(dp[i+j],dp[i]+abs(a[i+j]-a[i]));
            }
        }
    }
    cout << dp.back();
    return 0;
}


Measured memory_bytes: 1024
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        PrintWriter out = new PrintWriter(System.out);
        InputStreamScanner in = new InputStreamScanner(System.in);
        new Main().solve(in, out);
        out.flush();
    }

    private void solve(InputStreamScanner in, PrintWriter out) {
        int n = in.nextInt();
        int a4 = 0;
        int a2 = 0;
        int a1 = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt();
            if (a % 4 == 0) {
                a4++;
            } else if (a % 2 == 0) {
                a2++;
            } else {
                a1++;
            }
        }

        if (a2 > 0) {
            a1++;
        }

        out.println(a4 + 1 >= a1 ? "Yes" : "No");
    }

    static class InputStreamScanner {

        private InputStream in;

        private byte[] buf = new byte[1024];
        private int len = 0;
        private int off = 0;

        InputStreamScanner(InputStream in)	{
            this.in = in;
        }

        String next() {
            StringBuilder sb = new StringBuilder();
            for (int b = skip(); !isSpace(b);){
                sb.appendCodePoint(b);
                b = read();
            }
            return sb.toString();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        char nextChar() {
            return (char)skip();
        }

        int skip() {
            for (int b; (b = read()) != -1;) {
                if (!isSpace(b)) {
                    return b;
                }
            }
            return -1;
        }

        private boolean isSpace(int c) {
            return c < 33 || c > 126;
        }

        private int read() {
            if (len == -1) {
                throw new InputMismatchException("End of Input");
            }
            if (off >= len){
                off = 0;
                try {
                    len = in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException(e.getMessage());
                }
                if (len <= 0) {
                    return -1;
                }
            }
            return buf[off++];
        }
    }
}

Measured memory_bytes: 35728
/*input
6
1
2
3
4
5
6
*/

#include <bits/stdc++.h>
using namespace std;

#define fill(a,val) memset(a, (val), sizeof a)
#define pb push_back
#define lli long long int
#define scantype int
#define endl "\n"
#define unique(x) x.erase(unique(x.begin(),x.end()), x.end())
#define sort_f(x)  sort(x.begin(),x.end());
#define sort_r(x)  sort(x.rbegin(),x.rend());

lli MOD  = 1000000007;
lli inf = 1e15;

void scan(scantype &x);
lli powermod(lli _a,lli _b,lli _m){lli _r=1;while(_b){if(_b%2==1)_r=(_r*_a)%_m;_b/=2;_a=(_a*_a)%_m;}return _r;}
lli string_to_number(string s){lli x=0; stringstream convert(s); convert>>x; return x;}
lli add(lli a,lli b){lli x = (a+b)%MOD; return x; }
lli mul(lli a,lli b){lli x = (a*b)%MOD; return x; }
lli sub(lli a,lli b){lli x = (a-b+MOD)%MOD; return x; }
lli divi(lli a,lli b){lli x = a;lli y = powermod(b,MOD-2,MOD);lli res = (x*y)%MOD;return res;}

#define N 200003

long  divisors(long x) {
    long limit = x;
    long numberOfDivisors = 0;

    if (x == 1) return 1;

    for (long i = 1; i < limit; ++i) {
        if (x % i == 0) {
            limit = x / i;
            if (limit != i) {
                numberOfDivisors++;
            }
            numberOfDivisors++;
        }
        if(numberOfDivisors>=4)
        {
            break;
        }
    }

    return numberOfDivisors;
}
 bool isPrime(long n)
{
   
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n%2 == 0 || n%3 == 0) return false;
 
    for (long i=5; i*i<=n; i=i+6)
        if (n%i == 0 || n%(i+2) == 0)
           return false;
 
    return true;
}
#define max_a 100001
bool visit[max_a]={false};
vector<long> a[max_a];
long sum=0;
long cost[max_a];
void dfs(long node)
{
    visit[node]=true;
    
    for(int i=0;i<(int)a[node].size();i++)
    {
        if(visit[a[node][i]]==false)
        {
            sum+=cost[a[node][i]];
            dfs(a[node][i]);
            
        }
    }
    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<long> a;
    vector<long>::iterator itr;
    for(int i=0;i<n;i++)
    {
      int val;
      cin>>val;
      a.pb(val);  
     }
     sort_f(a);
     int ans=0;
     int countm=0;
     for(int i=0;i<n-1;i++)
     {
        countm=1;
        while(a[i]==a[i+1]  && i<n-1)
        {
           i++;
           countm++;
        }
        if(countm%2!=0)
        {
            ans++;
        }
     }
     if(a[n-1]!=a[n-2])
     {
        ans++;
     }
     cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 3832
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <utility> 
#include <tuple>
#include <iterator>
#include <functional>
#include <numeric>
using namespace std;
#define rep(i,n) for(long i=0; i<n; i++)


void solve(){
  int n;
  cin >> n;
  int p[n+10];
  rep(i,n) {cin >> p[i];}
  
  int count=0;
  for(int i=1; i<n-1; i++){
    if( (p[i-1]<p[i]&&p[i]<p[i+1]) ||  (p[i-1]>p[i]&&p[i]>p[i+1]) ) {
       count++;
    }
  }
  cout << count << endl;
}

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


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

int main(){
    int n; cin >> n;
    P  redy[n], bluex[n];
    rep(i, n) cin >> redy[i].second >> redy[i].first;
    rep(i, n) cin >> bluex[i].first >> bluex[i].second;
    sort(redy, redy+n);
    sort(bluex, bluex+n);

    int ans = 0;
    int ri = 0, bi = 0;
    bool usedr[n] = {0};
    rep(bi, n){
        vector<int> rcand;
        rep(ri, n){
            if(!usedr[ri] && redy[ri].second < bluex[bi].first && redy[ri].first < bluex[bi].second){
                rcand.push_back(ri);
            }
        }
        if(rcand.size()){
            sort(all(rcand), [&](const int a, const int b){
                return redy[a] > redy[b];
            });
            usedr[rcand[0]] = true;
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

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

#-------
# Initialize
S = str(input())[:-1]

#-------
# Define
def check(s):
    if len(s) % 2 == 1:
        return False
    if (s[:int(len(s)/2)] == s[int(len(s)/2):]):
        return True
    else:
        return False

#-------
# Do
while (len(S) > 0):
    if check(S):
        print(len(S))
        break
    else:
        S = S[:-1]


#-------
# Output


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define  mp make_pair
#define pb push_back
bool isValidIndex(int x, int y, int n, int m)
{
    return (x >= 0 and y >= 0 and x < n and y < m);
}

void findAns()
{
    int n;
    cin >> n;

    double p[n + 1];
    double dp[n + 1][n + 1];

    memset(dp, 0.0, sizeof(dp));

    for (int i = 1; i <= n; i++) cin >> p[i];
    dp[0][0] = 1.0;
    double ans = 0;

    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            if (j == 0)
                dp[i][j] = (1.0 - p[i]) * dp[i - 1][j];
            else
                dp[i][j] = dp[i - 1][j] * (1.0 - p[i]) +  dp[i - 1][j - 1] * p[i];

            // if (i < j) ans += dp[i][j];
        }

    }

    for (int i = (n + 1) / 2; i <= n; i += 1)
        ans += dp[n][i];

    cout << setprecision(9) << ans;






}
int main()
{

    fastio;
    // ll int t;
    // cin >> t;

    // while (t--)

    findAns();

    return 0;
}

Measured memory_bytes: 70656