akhauriyash/Code-Regression huggingface dataset:
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
void YES(bool ok){
    cout << (ok ? "Yes" : "No") << endl;
}
signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m; cin >> n >> m;
    string s;cin >> s;
    vector<vector<ll>> cnt(n, vector<ll>(2));
    vector<vector<ll>> g(n);
    rep(i,0,m){
        ll a,b; cin >> a >> b;
        a--;b--;
        g[a].emplace_back(b);
        cnt[a][s[b] - 'A']++;
        if(a != b){
            g[b].emplace_back(a);
            cnt[b][s[a] - 'A']++;
        }
    }
    debug(cnt);
    queue<ll> que;
    vector<ll> used(n);
    rep(i,0,n){
        if(!(cnt[i][0] * cnt[i][1])){
            que.emplace(i);
            used[i] = 1;
        }
    }
    ll c = 0;
    while(!que.empty()){
        auto f = que.front();que.pop();
        for(auto &to : g[f]) {
            if(used[to])continue;
            cnt[to][s[f] - 'A']--;
            if(!cnt[to][s[f] - 'A']){
                que.emplace(to);
                used[to] = 1;
            }
        }
        c++;
    }
    debug(c);
    YES(!(c == n));
}

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

using namespace std;

#define MAX_SIZE (1 << 17)

int dat[MAX_SIZE * 2 - 1] = { 0 }, size = 1;

int getSum(int sl, int sr, int s, int l, int r) {
    if (r <= sl || sr <= l) {
        return 0;
    }
    if (sl <= l && r <= sr) {
        return dat[s];
    }
    else {
        int vl = getSum(sl, sr, s * 2 + 1, l, (l + r) / 2);
        int vr = getSum(sl, sr, s * 2 + 2, (l + r) / 2, r);
        return vl + vr;
    }
}

void add(int s, int v) {
    s += size - 1;
    dat[s] += v;
    while (s > 0) {
        s = (s - 1) / 2;
        dat[s] = dat[s * 2 + 1] + dat[s * 2 + 2];
    }
}

int main() {
    int n, q, com, x, y;
    cin >> n >> q;
    
    while (size < n) {
        size <<= 1;
    }

    while (q--) {
        cin >> com >> x >> y;
        if (com) {
            cout << getSum(x - 1, y, 0, 0, size) << endl;
        }
        else {
            add(x - 1, y);
        }
    }

    return 0;
}

Measured memory_bytes: 1960
def count(seq, is_positive):
    operation = 0
    sum = 0
    for i in range(n):
        sum += seq[i]
        if sum == 0:
            operation += 1
            if is_positive:
                sum -= 1
            else:
                sum += 1
        elif sum > 0 and is_positive:
            operation += abs(sum) + 1
            sum = -1
        elif sum < 0 and not is_positive:
            operation += abs(sum) + 1
            sum = 1

        if sum > 0:
            is_positive = True
        else:
            is_positive = False

    return operation

if __name__ == "__main__":
    n = input()
    seq = map(int, raw_input().split(" "))

    print min(count(seq, False), count(seq, True))


Measured memory_bytes: 11272
#include <bits/stdc++.h>
using namespace std;
long long int mod = pow(10,9) + 7;

int main(){
  int N,M;
  cin >> N >> M;
  vector<int> g(N,0); //0 1 2 
  int Lmax = 0;
  int Rmin = N;
  for(int i = 0; i < M;i++){
    int L,R;
    cin >> L >> R;
    if(Lmax < L) Lmax = L;
    if(Rmin > R) Rmin = R;
  }
  
  cout << max(0,Rmin-Lmax + 1);
 
  return 0;
}

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

int main(){
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if(s == u) cout << a-1 << " " << b << endl;
  else if(t == u) cout << a << " " << b-1 << endl;
}

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

int main() {
  int A, B, M, N;
  
  cin >> A >> B; 
  
  M = (B-1)%(A-1);
  
  if ( M == 0 ) {
    N = (B-1)/(A-1);
  }
  else {
    N = (B-1)/(A-1) + 1;
  }

  cout << N << endl;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define _USE_MATH_DEFINES
using namespace std;

int main() {
	
	ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a,b;
    cin>>a>>b;
    cout<<a*b;
    
	return 0;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;
 

ll gcd(ll a, ll b){
    while (b>0){
        ll tempB = b;
        b = a % b;
        a = tempB;
    }
    return a;
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;//この順番だとオーバーフローが起きやすい
}


int main(){
    ll A, B;
    cin >> A >> B;

    cout << lcm(A, B) << endl;
}

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

int main() {
  int N;
  cin >> N;
  map<string, int> b_counter;
  map<string, int> r_counter;
  
  for (int i=0;i<N;i++){
    string key;
    cin >> key;
    if (!b_counter.count(key)){
      b_counter[key] = 0;
    } 
    b_counter[key] += 1;
  }
  
  int M;
  cin >> M;
  for (int i=0;i<M;i++){
    string key;
    cin >> key;
        if (!r_counter.count(key)){
      r_counter[key] = 0;
    } 
  r_counter[key] += 1;
  }
  
  
int ans = 0;
for (auto p : b_counter) {
  auto key = p.first;
  auto value = p.second;
  
  int money;
  if (r_counter.count(key)){
    money = value - r_counter[key];
  }
  else {
  money = value;}
  if (money > ans){
    ans = money;
  }
}  
  
  cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.*;
import java.math.*;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int start = 1000;
        int goal = 0;
        int N = Integer.parseInt(sc.next());
        for (int i=0; i<N; i++){
            int input = Integer.parseInt(sc.next());
            start = Math.min(start, input);
            goal = Math.max(goal, input);
        }
        System.out.println(goal - start);
    }
}

Measured memory_bytes: 35608
N = int(input())
MOD = 10**9 + 7

# DP[n][a][b][c] n-2文字目がa, n-1文字目がb, n文字目がcであるような長さnの文字列の数
DP = [[[[0 for _ in range(4)] for _ in range(4)]
       for _ in range(4)] for _ in range(N + 1)]

# T=0, A=1, G=2, C=3　とする

# DP初期化（3文字）
# AGC(123), GAC(213), ACG(132)を除外
for a in range(4):
    for b in range(4):
        for c in range(4):
            if (a, b, c) not in ((1, 2, 3), (2, 1, 3), (1, 3, 2)):
                DP[3][a][b][c] = 1

# 4~N文字の文字列について
# AGC(123), GAC(213), ACG(132)に加え、A*GC(1*23), AG*C(12*3)も除外
for i in range(4, N + 1):
    for a in range(4):
        for b in range(4):
            for c in range(4):
                # 末尾が T or A の場合は特に制限はない
                DP[i][b][c][0] += DP[i - 1][a][b][c]
                DP[i][b][c][1] += DP[i - 1][a][b][c]
                # 末尾が G の場合、ACGになってはならない
                if (b, c) != (1, 3):
                    DP[i][b][c][2] += DP[i - 1][a][b][c]
                # 末尾がCの場合、AGC, GAC, A*GC, AG*Cは不適
                if (b, c) != (1, 2) and (b, c) != (2, 1) and (a, c) != (1, 2) and (a, b) != (1, 2):
                    DP[i][b][c][3] += DP[i - 1][a][b][c]

ans = 0
# 末尾3文字（計64通り）の総和
for a in range(4):
    for b in range(4):
        for c in range(4):
            ans += DP[N][a][b][c]
            ans %= MOD

print(ans % MOD)


Measured memory_bytes: 75196
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

int main(){
  ll A,B; cin>>A>>B;
  cout << lcm(A,B);
}

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

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

int main(){
    ll k; cin >> k;
    ll x = 7;
    ll ans = 0;
    rep2(i,1001001){
        if(x%k==0) {
            ans = i;
            break;
        } else x = (10*x+7) % k;
    }
    if(!ans) cout << -1 << endl;
    else cout << ans << endl;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int W = sc.nextInt();
    for (int i = 0; i < H; i++) {
      String s = sc.next();
      System.out.println(s);
      System.out.println(s);
    }
  }
}

Measured memory_bytes: 23508
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <climits>
#define bogo_sort   std::sort
#define bozo_sort   std::stable_sort
#define alles(obj)  obj.begin(), obj.end()
#define elif        else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo        std::cout <<
#define read        std::cin >>
#define endl        std::endl
#define fin         << '\n'
#define bash        push_back
#define fish        push_front
#define makePair    std::make_pair
#define _           << ' ' <<
// type-define
#define Stack       std::stack
#define Queue       std::queue
#define Deque       std::deque
#define PQueue      std::priority_queue
#define Set         std::set
#define Vector      std::vector
#define Pair        std::pair
#define Map         std::map
#define HashMap     std::unordered_map
#define Greater     std::greater
using String  =     std::string;
using llong   =     long long;
using boolean =     bool;
using Pii     =     Pair<int, int>;
using Vi      =     Vector<int>;
using Vii     =     Vector<Pii>;
// utils
constexpr int   dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int   dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int   INF  = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm   ( A x,  B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    inline boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    signed call_of_Cthulhu( signed datum ) {

        int n;
        read n;
        for ( int i = 0; i < n; i++ ) {
            int tmp = i*4;
            for ( int j = 0; j < n; j++ ) {
                if ( tmp + j*7 == n ) {
                    echo "Yes" fin;
                    return 0;
                }
            }
        }
        echo "No" fin;

        return 0;
    }
}

signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


Measured memory_bytes: 256
#include<stdio.h>

int minimum(long a[10000],int n){
	int i = 0; 
	long s = a[0];
	for (; i < n; i++){
		if (s > a[i]){
			s = a[i];
		}
	}
	return s;
}

int maximum(long a[10000], int n){
	int i = 0;
	long s = a[0];
	for (; i < n; i++){
		if (s < a[i]){
			s = a[i];
		}
	}
	return s;
}

int sum(long a[10000], int n){
	int i = 0;
	long s = 0;
	for (; i < n; i++)
		s = s + a[i];

	return s;
}

int main(void){
	long a[10000];

	int i=0,n=0;
	scanf("%d", &n);
	for (; i < n; i++){
		scanf("%ld",&a[i]);
	}

	printf("%ld %ld %ld\n", minimum(a, n), maximum(a, n), sum(a, n));


	return 0;
}


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

int main(){
  ll n;
  string s,t,ans;
  cin>>n>>s>>t;
  rep(i,n){
  	ans.push_back(s[i]);
  	ans.push_back(t[i]);
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 384
n = int(input())

# 約数を列挙
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
ans = 0
divisors = make_divisors(n)
for x in divisors:
    tmp = x-1
    if tmp>0 and n//tmp == n%tmp:
        ans += tmp
print(ans)

Measured memory_bytes: 39024
use bigint;
(sprintf'%060b %060b',<>)=~/(.*)(.*) \1(.*)/;
$A=$2;$B=$3;
printf"%d\n",
+(eval'0b'.$B=~y/0/1/r)-(eval"0b$A")+1
-($-=(eval'0b'.$A=~s/0/1/r)-(eval'0b'.$B=~s/1.*?1\K.*/$&=~y!0!1!r/er)-1)


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

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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  rep(_, n) {
    s.push_back('x');
  }
  vector<int> cnt_r(n, 0), cnt_g(n, 0), cnt_b(n, 0);
  for (int i = 0; i < n; i++) {
    if (i != 0) {
      cnt_r[i] = cnt_r[i - 1];
      cnt_g[i] = cnt_g[i - 1];
      cnt_b[i] = cnt_b[i - 1];
    }
    if (s[i] == 'R') {
      cnt_r[i]++;
    } else if (s[i] == 'G') {
      cnt_g[i]++;
    } else {
      cnt_b[i]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) continue;
      map<char, int> mp;
      mp[s[i]]++, mp[s[j]]++;
      if (mp['R'] == 0) {
        ans += cnt_r[n - 1] - cnt_r[j];
        if (s[2 * j - i] == 'R') {
          ans--;
        }
      } else if (mp['G'] == 0) {
        ans += cnt_g[n - 1] - cnt_g[j];
        if (s[2 * j - i] == 'G') {
          ans--;
        }
      } else {
        ans += cnt_b[n - 1] - cnt_b[j];
        if (s[2 * j - i] == 'B') {
          ans--;
        }
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(){
    int a,b,c,i,count = 0;
    
    scanf("%d %d %d", &a,&b,&c);
    
	for(i=a;i<=b;i++)
	{
		if(c%i == 0){
			count ++;
		}
	}
    printf("%d\n",count);
    return 0;
}

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

using namespace std;

typedef long long int ll;
#define pb push_back
#define ALL(a) (a).begin() , a.end()

int mod = 1e9 + 7;
int add(int a, int b){
	if(a + b >= mod)return a+ b - mod;
	return a + b;
}
int mul(int a, int b){
	return 1LL * a * b  % mod;
}
int const N =3010;

/********************i**********************************/
ll dp[N][N], vec[N], INF = -5e15;
int n;
ll go(int i, int j){
	if(i > j)return 0;
	else if(i == j)return vec[i];
	else if(dp[i][j] != INF)return dp[i][j];
	else{
		auto &ans = dp[i][j];
		ans = max(vec[i] - go(i+1, j), vec[j] - go(i, j -1));
		return ans;
	}
}
void solve(){
	int n;
	cin >> n;
	for(int x = 0; x<n; x++){
		for(int y = 0; y<n; y++)
			dp[x][y] = INF;
	}
	for(int x =0;x<n; x++)cin >> vec[x];
	cout << go(0,n-1);

}


/******************************************************/
int main()
{
	ios_base::sync_with_stdio(false);cin.tie(nullptr);
	int t;
	t = 1;
	// cin >> t;
	while(t--){
		solve();
	}
}

Measured memory_bytes: 70912
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

#define int ll

//get vector of prime numbers which is lower than or equal n
vector<int> get_primes(int n)
{
    vector<bool> is_prime(n + 1, true);
    vector<int> res;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = 2 * i; j < is_prime.size(); j = j + i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

vector<pair<int, int>> factorize(int n)
{
    vector<pair<int, int>> res;
    for (int i = 2; i * i <= n; i++)
    {
        int tmp = 0;
        while (n % i == 0)
        {
            tmp++;
            n /= i;
        }
        res.push_back(make_pair(i, tmp));
    }
    if (n != 1)
    {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int mpow(int x, int n)
{
    int res = 1;
    while (n != 0)
    {
        if (n & 1)
            res = res * x % INF;
        x = x * x % INF;
        n = n >> 1;
    }
    return res;
}

//mod frac
vector<int> mfrac;
void set_mfrac(int n)
{
    if (mfrac.size() == 0)
    {
        mfrac.push_back(1);
    }
    for (int i = mfrac.size(); i <= n; i++)
    {
        mfrac.push_back((i * mfrac[i - 1]) % INF);
    }
}

//get nCm mod INF
int mcomb(int n, int m)
{
    if (mfrac.size() <= n)
    {
        set_mfrac(n);
    }
    int res = mfrac[n];
    res = res * mpow(mfrac[m], INF - 2) % INF;
    res = res * mpow(mfrac[n - m], INF - 2) % INF;
    return res;
}

vector<int> get_gcd(int n)
{
    vector<int> res;
    for (int i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            if (i * i == n)
            {
                res.push_back(i);
            }
            else
            {
                res.push_back(i);
                res.push_back(n / i);
            }
        }
    }
    return res;
}

signed main()
{
    int X;
    cin >> X;
    for (int i = 1; i <= 9; i++)
    {
        for (int j = 1; j <= 9; j++)
        {
            if (i * j == X)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}

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

int main() {
    int n, m; cin >> n >> m;
    vector<int> a(m), b(m);
    vector<int> d(n, 0);
    for(int i = 0; i < m; i++) {
        cin >> a[i] >> b[i];
        d[a[i]-1]++;
        d[b[i]-1]++;
    }
    
    for(int i = 0; i < n; i++) cout << d[i] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    int ar[300];
    memset(ar,0,sizeof(ar));
    for(int i=0;i<a.size();i++){
        ar[(int)a[i]]++;
    }
    int c1=0,c2=0;
    for(int i='a';i<='z';i++){
        if(ar[i]%2!=0) c2++;
    }
    if(c2!=0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
let S = readLine()!.characters.map{$0}
var ans = (0..<S.count).map{_ in 0}
var odd = 0
var even = 0
for i in 0..<S.count {
    if S[i] == "R" {
        i%2>0 ? (odd+=1) : (even+=1)
    } else {
        ans[i] += (i%2>0 ? odd : even)
        ans[i-1] += (i%2>0 ? even : odd)
        odd = 0
        even = 0
    }
}
for i in (0..<S.count).reverse() {
    if S[i] == "L" {
        i%2>0 ? (even+=1) : (odd+=1)
    } else {
        ans[i] += (i%2>0 ? even : odd)
        ans[i+1] += (i%2>0 ? odd : even)
        odd = 0
        even = 0
    }
}
print(ans.map{String($0)}.joinWithSeparator(" "))

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

bool check_sym(string sentence) {
	int sentence_half; bool sym=true;
	if (sentence.length() % 2 == 1) {
		sentence_half = sentence.length() / 2 ;
		for (int i = 1; i <= sentence_half; i++) {
			if (sentence[sentence_half - i] != sentence[sentence_half + i])sym = false;
		}
		return sym;
	}
	else if (sentence.length() % 2 == 0) {
		sentence_half = sentence.length() / 2-1;
		for (int i = 0; i <= sentence_half; i++) {
			if (sentence[sentence_half - i] != sentence[sentence_half + i + 1])sym = false;
		}
		return sym;
	}
}

int main() {
	int how = 0; string sentence; 
	while(cin >> sentence) {		
		if (check_sym(sentence)) { how++; }
	}
	cout << how<<endl;
	return 0;
}

Measured memory_bytes: 3068
import sys
import heapq
input = sys.stdin.readline

X,Y,Z,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


ALL=[0]*K
for a in A:
    for b in B:
        for c in C:
            if a+b+c>ALL[0]:
                heapq.heappush(ALL,a+b+c)
                heapq.heappop(ALL)
            else:
                break
                
ALL.sort(reverse=True)

for k in range(K):
    print(ALL[k])

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

int solve(int now, vector<int> pre_used, vector<vector<int>> &G) {
    vector<int> used = pre_used;
    used[now] = 1;
    bool end = true;
    REP(i, pre_used.size()) {
        if (used[i] != 1) {
            end = false;
            break;
        }
    }
    if (end) {
        return 1;
    }

    int ans = 0;
    for (auto v : G[now]) {
        if (used[v] != 1) {
            ans += solve(v, used, G);
        }
    }
    return ans;
}

int main() {
    int N, M;
    if (scanf("%d %d", &N, &M) == 1) {
        return 1;
    }

    vector<vector<int>> G(N); // adjacency list
    for (int i = 0; i < M; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        a--;
        b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    vector<int> used(N, 0);
    printf("%d\n", solve(0, used, G));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i=0; i < n; i++)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x, y, z) max((x), max((y), (z)))
#define tmin(x, y, z) min((x), min((y), (z)))
ll MM = 1000000000; ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
const ll INF = 1LL << 60;
//cout << fixed << setprecision(10);

int main(){
    ll n, x, y; cin>>n;
    double cnt=0.0, sum=0.0;
    vector<pair<double,double>> v;
    rep(i,n){
        cin>>x>>y;
        v.push_back(make_pair(x, y));
    }
    sort(all(v));

    do{
        cnt+=1.0;
        rep(i,n-1){
            sum+=sqrt(pow((v[i+1].first-v[i].first),2) + pow((v[i+1].second-v[i].second),2));
        }
    }while(next_permutation(all(v)));

    cout<<fixed<<setprecision(10)<<sum/cnt<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
  static int a, b, c;

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    a = sc.nextInt();
    b = sc.nextInt();
    c = sc.nextInt();

    if(a == b){
      System.out.println(c);
    }
    else if(b == c){
      System.out.println(a);
    }
    else{
      System.out.println(b);
    }
  }
}


Measured memory_bytes: 21716
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e18;


int calc(int x) {
	if (x == 1)return 1;
	else return 1+2 * (calc(x / 2));
}

void solve() {
	ll H; cin >> H;
	print(calc(H));
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q;cin>>q;
	//while(q--)
	solve();
}




Measured memory_bytes: 256
import collections
n=int(input())
a=[]
count=0
while n%2==0:
    a.append(2)
    n=n/2
num=3
while num**2<=n+1:
    if n%num==0:
        a.append(num)
        n=n/num
    else:
        num+=2
if n!=1:
    a.append(n)
a=collections.Counter(a)
for i in a.values():
    x=1
    while x<=i:
        count+=1
        i-=x
        x+=1
print(count)


Measured memory_bytes: 9448
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define PF push_front
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double
#define pii pair<int,int>
#define pll pair<LL,LL>
#define vi vector<int>
#define vl vector<LL>
#define vii vector<vi>
#define vll vector<vl>

const double pi = 3.14159265358979323846264;
const int mod=1000000007;

int main(){
    int n,k,s;
    cin>>n>>k>>s;
    int ss=s+1;
    if(s==1000*1000*1000){
        ss=7;
    }
    vi a(n,ss);
    FOR(i,0,k){
        a[i]=s;
    }
    FOR(i,0,n){
        cout<<a[i]<<" ";
    }
    
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string a, b;
    cin >> a >> b;
    int len = a.length();
    vector<char> one(26, '?'), two(26, '?');
    for(int i = 0; i < len; i++) {
        if(one[a[i] - 'a'] != '?' && one[a[i] - 'a'] != b[i]) {
            cout << "No";
            return 0;
        }
        one[a[i] - 'a'] = b[i];
        if(two[b[i] - 'a'] != '?' && two[b[i] - 'a'] != a[i]) {
            cout << "No";
            return 0;
        }
        two[b[i] - 'a'] = a[i];
    }
    cout << "Yes";
}

Measured memory_bytes: 3800
#include <set>
#include <cstdio>
#include <cstring>

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

inline int getInt(){ int s; scanf("%d", &s); return s; }

using namespace std;

int n;
int e[80];
int memo[80][100][100];

int solve(int pos, int prev, int now){
  if(pos == n - 1) return now;
  if(prev < 100 && now < 100)
    if(memo[pos][prev][now] != -1) return memo[pos][prev][now];

  int ret = 0;

  if(now > 0){
    // hit
    ret = max(ret, solve(pos + 1, now - 1, e[pos + 1] + prev));
  }

  ret = max(ret, solve(pos + 1, now, e[pos + 1]));

  return memo[pos][prev][now] = ret;
}

int main(){
  int cc = getInt();

  while(cc --> 0){
    n = getInt();
    REP(i,n) e[i] = getInt();
    memset(memo, -1, sizeof(memo));

    if(n >= 3)
      printf("%d\n", solve(1, e[0], e[1]));
    else
      printf("%d\n", e[n - 1]);
  }

  return 0;
}

Measured memory_bytes: 0
from collections import deque

def main():
    n,m = map(int,input().split())
    dq = []
    for _ in range(n):dq.append(deque())
    for _ in range(m):
        q = list(map(int,input().split()))
        if q[0] == 0:dq[q[1]].append(q[2])
        elif dq[q[1]]:
            if q[0] == 1:
                print(dq[q[1]][len(dq[q[1]])-1])
            else        :dq[q[1]].pop()


if __name__ == '__main__':
    main()




Measured memory_bytes: 14532
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    string S;
    cin >> S;
    int L=S.length();
    rep(i,L) cout << 'x';
    cout << endl;
}

Measured memory_bytes: 256
fun main(){
  val (n, k) = readLine()!!.split(" ").map(String::toInt)
  val prices = readLine()!!.split(" ").map(String::toInt).sorted()
  
  var ans = 0
  for(i in 0 until k) {
    ans += prices[i]
  }
  
  println(ans)
}

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

int main(){
    long long int n, k;
    cin>>n>>k;
    long long int temp;
    temp=n%k;
    if(temp==0){
        cout<<0<<endl;
        return 0;
    }
    vector <long long int> v;

    for(int i=0; i<100; i++){
        temp=abs(temp-k);
        v.push_back(temp);
    }
    sort(v.begin(), v.end());

    if(v[0]>n){
        cout<<n<<endl;
        return 0;
    }
    cout<<v[0]<<endl;

    return 0;
}



Measured memory_bytes: 256
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


inf = float('inf')


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_list_of_int():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


# inputs
N, W = 0, 0
Ws, Vs = [0], [0]


def set_inputs():
    global N, W, Ws, Vs
    N, W = get_list_of_int()
    ws, vs = [], []
    for _ in range(N):
        w, v = get_list_of_int()
        ws.append(w)
        vs.append(v)
    Ws, Vs = ws, vs


def main():
    set_inputs()
    value_sum = sum(Vs)
    weights = [inf] * (value_sum + 1)
    items = [0] * (value_sum + 1)
    weights[0] = 0
    for v in range(1, value_sum + 1):
        weights[v], items[v] = min((weights[v - Vs[i]] + Ws[i], items[v - Vs[i]] | 1 << i) if v - Vs[i] >= 0 and (items[v - Vs[i]] & 1 << i) == 0 else (inf, 0) for i in range(N))
    max_value = next(i for i in reversed(range(value_sum + 1)) if weights[i] <= W)
    print(sum(Vs[i] if items[max_value] & 1 << i > 0 else 0 for i in range(N)))


if __name__ == '__main__':
    main()


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

using namespace std;

const int INF = 1e9 + 7;

signed main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    for (int& x : h)
        cin >> x;
    vector<int> dp(n, INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {   
        for (int j = i + 1; j <= i + k; j++) {
            if (j < n) {
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }
    }
    cout << dp[n - 1] << "\n";
    return false;
}

Measured memory_bytes: 1024
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,m,x = LI()
    aa = [LI() for _ in range(n)]

    ii = [2**i for i in range(n)]
    r = inf
    for i in range(1,2**n):
        t = [0] * m
        tr = 0
        for j in range(n):
            if i & ii[j] > 0:
                tr += aa[j][0]
                for k in range(m):
                    t[k] += aa[j][k+1]
        if all(c >= x for c in t):
            if r > tr:
                r = tr
    if r == inf:
        return -1

    return r

print(main())





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

int main() {
    
    int a;
    int b;
    
    cin >> a >> b;
    
    int dis = b - a;
    
    int height = 0;
    int i = 1;
    while(true) {
        height += i;
        
        if(dis == i) {
            break;
        }
        i++;
    }
    
    int ans = height - b;
    
    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())

def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a

facts = Counter(prime_factorize(N))
cnt = 0

def pattern_cnt(n):
  res = 0
  cur = 1
  while n - cur >= 0:
    n -= cur
    res += 1
    cur += 1
  return res

for k in facts:
  cnt += pattern_cnt(facts[k])
  #print(k, cnt)

print(cnt)

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

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()
#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en
#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second
#define INF lli(1e19)

#define forz(i, n) for (lli i = 0; i < n; i++)
#define fore(i, m, n) for (lli i = m; i < n; i++)
#define rforz(i, n) for (lli i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (lli i = n - 1; i >= m; i--)
#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)
#define lb lower_bound
#define ub upper_bound
#define er equal_range
#define maxe *max_element
#define mine *min_element
#define mod 1000000007
#define mod2 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define newline cout<<endl;
//#define endl "\n"



inline lli power(lli x, lli y, lli p = mod)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

inline lli modadd(lli a, lli b, lli m = mod)
{
    a += b;
    if (a >= m)
        a -= m;
    return a;
}

inline lli modmul(lli a, lli b, lli m = mod)
{
    return ((a % m) * (b % m)) % m;
}

inline lli modi(lli a, lli m = mod) { return power(a, m - 2, m); }
inline lli md(lli x) {if(x>=0)return x; return -x;}
///////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////
lli n,m,k;
//const lli mxN = 1e6;
//lli u, v;
//bool vis[mxN];
//vector<lli> adj[mxN];
//void init()
//{
//    forz(i,n) vis[i]=0, adj[i].clear();
//}


int32_t main()
{
    kira;

    lli T=1;
    //cin>>T;

    while(T--)
    {
        cin>>n;
        lli x[n], pref[n];
        forz(i,n) cin>>x[i];
        pref[0]=x[0];

        lli ans = 0;
        for(lli i = 1; i<n; i++)
        {
            pref[i]=(pref[i-1]+x[i])%mod;
            ans=( ans + x[i]*pref[i-1])%mod;
        }
        cout<<ans<<endl;
    }

    return 0;

}


Measured memory_bytes: 6708
#include <bits/stdc++.h>
#define INF 2000000000
using namespace std;
typedef long long ll;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while(c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while(c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
string a, b;
void init(){
    cin >> a >> b;
}
void solve(){
    b.pop_back();
    if (a == b) printf("Yes\n");
    else printf("No\n");
}
int main(){
    init();
    solve();
    return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<stdio.h>

using namespace std;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n;
  cin >> n;
  
  int i,j;
  int h[n];

  for(i=0; i<n; i++){
    cin >> h[i];
  }

  int res=1;
  
  for(i=1; i<n; i++){
    bool flag = true;
    for(j=0; j<i; j++){
      if(h[i] < h[j]) flag = false;
    }
    if(flag) ++res;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(int argc, char const *argv[])
{
    int a, b, c;
    std::cin >> a >> b >> c;

    if (a < b && b < c) {
        std::cout << "Yes" << std::endl;
    }
    else
    {
        std::cout << "No" << std::endl;
    }

    return 0;
}



Measured memory_bytes: 3096
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

typedef int ll;

void go() {
	int n,a,b;
	cin >> n >> a >> b;
	if(abs(b-a)%2==0) cout << "Alice" << endl;
	else cout << "Borys" << endl;
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0);
	// int t; cin >> t; for(;t--;)
	go();
	return 0;
}



Measured memory_bytes: 256
fn main() {
    let mut sc = Scanner::new();
    let n: u64 = sc.read();
    let s: u64 = sc.read();
    for b in 2..2000000 {
        let mut cur = n;
        let mut check = 0;
        while cur > 0 {
            check += cur % b;
            cur /= b;
        }
        if check == s {
            println!("{}", b);
            return;
        }
    }

    if n > s {
        for x in (1..2000000).rev() {
            if (n - s) % x != 0 {
                continue;
            }

            let b = (n - s) / x + 1;
            if s < x { continue; }
            let y = s - x;
            if n == b * x + y && s == x + y && b > y {
                println!("{}", b);
                return;
            }
        }
    }

    if n == s {
        println!("{}", n + 1);
    } else {
        println!("-1");
    }
}

struct Scanner {
    ptr: usize,
    length: usize,
    buf: Vec<u8>,
    small_cache: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner { ptr: 0, length: 0, buf: vec![0; 1024], small_cache: vec![0; 1024] }
    }

    fn load(&mut self) {
        use std::io::Read;
        let mut s = std::io::stdin();
        self.length = s.read(&mut self.buf).unwrap();
    }

    fn byte(&mut self) -> u8 {
        if self.ptr >= self.length {
            self.ptr = 0;
            self.load();
            if self.length == 0 {
                self.buf[0] = b'\n';
                self.length = 1;
            }
        }

        self.ptr += 1;
        return self.buf[self.ptr - 1];
    }

    fn is_space(b: u8) -> bool { b == b'\n' || b == b'\r' || b == b'\t' || b == b' ' }

    fn read<T>(&mut self) -> T where T: std::str::FromStr, T::Err: std::fmt::Debug, {
        let mut b = self.byte();
        while Scanner::is_space(b) {
            b = self.byte();
        }

        for pos in 0..self.small_cache.len() {
            self.small_cache[pos] = b;
            b = self.byte();
            if Scanner::is_space(b) {
                return String::from_utf8_lossy(&self.small_cache[0..(pos + 1)]).parse().unwrap();
            }
        }

        let mut v = self.small_cache.clone();
        while !Scanner::is_space(b) {
            v.push(b);
            b = self.byte();
        }
        return String::from_utf8_lossy(&v).parse().unwrap();
    }
}



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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

A, B = MAP()

if A % 2 == 1:
    a = A
    A += 1
else:
    a = 0

seg = B - A + 1
if seg % 4 == 0:
    b = 0
elif seg % 4 == 1:
    b = B
elif seg % 4 == 2:
    b = 1
else:
    b = 1 ^ B

print(a ^ b)


Measured memory_bytes: 3064
n = int(input())
six = [6 ** x for x in range(1, 10) if 6 ** x <= 100000]
nine = [9 ** x for x in range(1, 10) if 9 ** x <= 100000]
sn = set(six + nine)

dp = [0] + [x for x in range(1, n + 1)]
for i in sn:
    for j in range(i, n + 1):
        dp[j] = min(dp[j], dp[j-i]+1)
print(dp[-1])


Measured memory_bytes: 7832
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using ll = long long;
using u64 = uint_fast64_t;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
template<class T1, class T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true;} return false; }
template<class T1, class T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return true;} return false; }
inline int popcount(int x) {return __builtin_popcount(x);}
inline int popcount(long long x) {return __builtin_popcountll(x);}
void print() { cout << "\n"; }
template<class T, class... Args>
void print(const T &x, const Args &... args) {
    cout << x << " ";
    print(args...);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int N; cin >> N;
    int ans = (N+999)/1000*1000;
    cout << ans-N << ln;
}


Measured memory_bytes: 3608
array1 = [1,3,5,7,8,10,12]
array2 = [4,6,9,11]
array3 = [2]

x,y = map(int,input().split())
if x in array1 and y in array1:
    print('Yes')
    exit()

if x in array2 and y in array2:
    print('Yes')
    exit()

if x in array3 and y in array3:
    print('Yes')
    exit()

print('No')

Measured memory_bytes: 3064