akhauriyash/Code-Regression huggingface dataset:
n = list(input())

if n[0] != '9':
    if n.count('9') != len(n)-1:
        n[0] = str(int(n[0])-1)
        for i in range(1, len(n)):
            n[i] = '9'

else:
    for i in range(len(n)-1):
        if n[i+1] != '9':
            n[i] = str(int(n[i])-1)
            for j in range(i+1, len(n)):
                n[j] = '9'

ans = 0
for i in range(len(n)):
    ans += int(n[i])
print(ans)


Measured memory_bytes: 3064
//	Author : amnptl 
//	   Godbless
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define NeedForSpeed() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define MOD (1000000007); // 1e9+7
int main()
{
	NeedForSpeed();
	int s,w; cin>>s>>w;
	(w>=s) ? cout<<"unsafe"<<endl : cout<<"safe"<<endl;		
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N,M;
    cin >>N>>M;
    vector<ll> A(N);
    vector<ll> B(N);
    vector<Pi> AB(N); 
    rep(i,N){
        cin>>A[i]>>B[i];
        AB[i] = mp(A[i],B[i]);
    }

    sort(all(AB));
    priority_queue<ll, vector<ll>, less<ll>> Q;
    ll cnt = 0;
    ll ans = 0;
    rep2(i,M){
        while(cnt<N){
            if(AB[cnt].first ==i){
                Q.push(AB[cnt].second);
            }else{
                break;
            }
            cnt++;
        }
        if(Q.empty()) continue;
        ans += Q.top();
        Q.pop();
    }

    
    
    cout << ans << endl;


    return 0;
    

}

Measured memory_bytes: 7336
n = int(input())
a = list(map(int,input().split()))
b = [[0 for i in range(2)] for j in range(n)]
c = []
for i in range(n):
    b[i][1] = a[i]
    b[i][0] = i+1
b.sort(key=lambda x:x[1])
for i in range(n):
    c.append(b[i][0])
print(*c)

Measured memory_bytes: 25148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
const ll mod = 998244353;
ll dp[4000][4000];
ll N, S;
vector<ll> A;
ll ans;

int main() {
    cin >> N >> S;
    A.resize(N);
    for(int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for(int i = 0; i < N; i++) {
        dp[i+1][A[i]] += i+1;
        for(ll j = 0; j <= S; j++) {
            dp[i+1][j] += dp[i][j];
            if(j+A[i] <= S) dp[i+1][j+A[i]] += dp[i][j];
        }
        for(int j = 0; j <= S; j++) {
            dp[i+1][j] %= mod;
        }
        ans += dp[i+1][S];
        //cerr << i << " " << dp[i+1][S] << endl;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 94208
D=int(input())
C=list(map(int,input().split()))
import sys
S=sys.stdin.readlines()
A=[0]*26
B=[0]*D
k=0
for i in range(26):
  if C[i]!=0:
    k+=C[i]
for i in range(26):
  if i<25:
    A[i]=int(C[i]/k*D)
  else:
    A[i]=D-sum(A[:25])

for i in range(25):
  for j in range(A[i]):
    m=max([l if B[l]==0 and l<(D+1)//(A[i]+1)*j else 0 for l in range(D)])
    B[m]=i+1

for i in range(D):
  if B[i]==0:
    B[i]=26

for i in range(D):
  print(B[i])


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

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n, m = map(int, raw_input().split())
            if n == 0 and m == 0:
                break
            l = []
            for i in range(n):
                d, p = map(int, raw_input().split())
                l.append((p, d))
            l.sort(reverse=True)
            rest = m
            prob = 0
            for p, d in l:
                rest -= d
                if rest < 0:
                    prob += -1 * rest * p
                    rest = 0
            print prob
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Measured memory_bytes: 5892
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 200003
#define MOD 1000000007

int main(){
  int A,B,C;
  cin>>A>>B>>C;
  if(A==B&&B==C){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main () {
  string S;
  int a;
  cin >> S;
  string s[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
  for (int i = 0; i < 7; i ++) {
    if (S == s[i]) a = 7 - i;
  }
  cout << a << endl;
}


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

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define rep(x,n) for(ll i=x;i<n;++i)
#define repd(x,n) for(ll i=x-1;i>=n;--i)
#define repn(x,n) for(ll j=x;j<n;++j)
#define repnd(x,n) for(ll j=x-1;j>=n;--j)
#define dbg(x,y) cout<<x<<" "<<y<<endl
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;
//-----------------------------------------//

void solve(){
	string a,b;
	cin>>a;
	cin>>b;
	int cnt=0;
	rep(0,a.size()){
		if(a[i]!=b[i]) cnt++;
	}
	cout<<cnt<<endl;
}

int main(){
	solve();

}





Measured memory_bytes: 3912
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t a,b,n;
  cin>>a>>b>>n;
  if(n>=b-1) cout<<(a*(b-1))/b-a*((b-1)/b)<<endl;
  else cout<<(a*n)/b-a*(n/b)<<endl;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,r,f=0;
  cin>>n;
  while(n){
    r=n%10;
    if(r==7){
      f=1;
    }
    n/=10;
  }
  if(f){
    cout<<"Yes";
  }
  else
    cout<<"No";
}

Measured memory_bytes: 3620
from collections import deque
a = int(input())

dl = deque()
for i in range(a):
    o = input().split()

    if o[0] == 'delete':
        try:
            dl.remove(o[1])
        except ValueError:
            pass
    elif o[0] == 'deleteFirst':
        dl.popleft()
    elif o[0] == 'deleteLast':
        dl.pop()
    else:
        dl.appendleft(o[1])

print(" ".join([str(i) for i in dl]))



Measured memory_bytes: 69736
#include <iostream>
#include <complex>
#include <cmath>
#include <iomanip>
#include <vector>
#include <algorithm>
using namespace std;
typedef complex<double> xy;
double eps = 1e-9;
double dot_product(xy a,xy b) {return (conj(a)*b).real();}
double cross_product(xy a,xy b) {return (conj(a)*b).imag();}
double dist_lp(xy a1,xy a2,xy p){
    if(dot_product(a2-a1,p-a1)<eps) return abs(p-a1);
    if(dot_product(a1-a2,p-a2)<eps) return abs(p-a2);
    return abs(cross_product(a2-a1,p-a1))/abs(a2-a1);
}
xy projection(xy p,xy b) {return b*dot_product(p,b)/norm(b);}
xy projection2(xy p1,xy p2,xy p){
    p -= p1; p2 -= p1;
    xy proj = projection(p,p2);
    return p1+proj;
}

bool is_online(xy a1,xy a2,xy p){
    return abs(a1-p)+abs(a2-p)<=abs(a1-a2)+eps;    
}

bool is_intersected(xy a1, xy a2, xy b1, xy b2){
    if(is_online(a1,a2,b1) || is_online(a1,a2,b2)) return true;
    if(is_online(b1,b2,a1) || is_online(b1,b2,a2)) return true;
    return (cross_product(a2-a1,b1-a1)*cross_product(a2-a1,b2-a1)<-eps) && 
    (cross_product(b2-b1,a1-b1)*cross_product(b2-b1,a2-b1))<-eps;
}

double dist_ll(xy a1,xy a2,xy b1,xy b2){
    if(is_intersected(a1,a2,b1,b2)) return 0;
    return min({dist_lp(a1,a2,b1),dist_lp(a1,a2,b2),dist_lp(b1,b2,a1),dist_lp(b1,b2,a1)
    ,abs(a1-b1),abs(a1-b2),abs(a2-b1),abs(a2-b2)});   
}

double area_of_polygon(vector<xy>& v){
    int n = v.size();
    double res = 0;
    for(int i=0;i+2<n;i++){
        res += cross_product(v[i+1]-v[0],v[i+2]-v[0]);
    }
    return res/2;
}

int N;
vector<xy> v;
int main(){
    cin >> N;
    double x,y;
    for(int i=0;i<N;i++){
        cin >> x >> y;
        v.push_back(xy(x,y));
    }
    cout << fixed;
    cout << setprecision(1) << area_of_polygon(v) << endl;
}


Measured memory_bytes: 3296
def div(p,q):
	d,r = "",[p]
	while True:
		p *= 10
		d += str(p//q)
		p -= q*(p//q)
		r.append(p)
		if r[-1] == 0 or r[-1] in r[:-1]: return d,r
		
while True:
	try:
		p,q = map(int, raw_input().split())
		d,r = div(p,q)
		s = r.index(r[-1])
		if s == len(r)-1:
			print d
		else:
			print "{}\n{}".format(d," "*s+"^"*(len(r)-s-1))
	except:
		break

Measured memory_bytes: 4228
#include<stdio.h>

int main()
{
	int x[10],y[10];
	int b,c,d,e,i,n=0,br;

	scanf("%d",&d);

	while(n<d)
	{
		scanf("%d %d %d %d %d %d %d %d %d %d",x,x+1,x+2,x+3,x+4,x+5,x+6,x+7,x+8,x+9);
		br=0;
		for(i=0;i<10;i++)
			y[i]=0;
		for(i=0;i<10;i++)
		{
			if(x[i]<1||x[i]>10)
			{
				br=1;
				break;
			}
			y[x[i]-1]++;
			if(y[x[i]-1]>1)
			{
				br=1;
				break;
			}
		}
		if(br)
			continue;

		n++;
		b=0;
		c=0;
		e=1;

		for(i=0;i<10;i++)
		{
			if(b>=c)
			{
				if(x[i]>b)
				{
					b=x[i];
					continue;
				}
				else if(x[i]>c)
				{
					c=x[i];
					continue;
				}
			}
			else
			{
				if(x[i]>c)
				{
					c=x[i];
					continue;
				}
				else if(x[i]>b)
				{
					b=x[i];
					continue;
				}
			}
			e=0;
			break;
		}

		if(e)
			printf("YES\n");
		else
			printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 576
module mod_segment_tree
  implicit none
  integer(8), parameter :: DEFAULT = -100000000000000000_8
  type segment_tree
    integer :: n, p
    integer(8), pointer :: arr(:) => null()
  end type segment_tree
  private
  public :: segment_tree, init_segtree, update, query, DEFAULT
contains
  integer(8) function op(x,y)
    implicit none
    integer(8) :: x, y
    op = max(x,y)
    return
  end function op
  subroutine init_segtree(st,n)
    implicit none
    type(segment_tree) :: st
    integer, intent(in) :: n
    integer :: p
    p = 1
    do while (p.lt.n)
      p = 2*p
    end do
    st%n = n
    st%p = p
    allocate(st%arr(2*p-1))
    st%arr = DEFAULT
    return
  end subroutine init_segtree
  subroutine update(st,i,v)
    implicit none
    type(segment_tree) :: st
    integer, intent(in) :: i
    integer(8), intent(in) :: v
    integer :: x
    x = i+st%p-1
    st%arr(x) = v
    do while (x > 1)
      x = x/2
      st%arr(x) = op(st%arr(2*x),st%arr(2*x+1))
    end do
    return
  end subroutine update
  integer(8) function query(st,a,b)
    type(segment_tree) :: st
    integer, intent(in) :: a, b
    integer :: l, r
    query = DEFAULT
    l = a+st%p-1
    r = b+st%p-1
    do while (l <= r)
      if (mod(l,2) == 1) then
        query = op(query,st%arr(l))
        l = l+1
      end if
      if (mod(r,2) == 0) then
        query = op(query,st%arr(r))
        r = r-1
      end if
      l = l/2
      r = r/2
    end do
    return
  end function query
end module mod_segment_tree
program paired_parentheses
  use mod_segment_tree
  implicit none
  type(segment_tree) :: st1, st2
  integer :: n, q, p, pnum = 0, i
  integer(8) :: a(200000) = 0_8, b(200000) = 0_8, x, y
  integer(8) :: atot, ptot = 0_8
  read(*,*) n, q
  read(*,*) a(1:2*n)
  read(*,*) b(1:2*n)
  call init_segtree(st1,2*n)
  call init_segtree(st2,2*n)
  atot = sum(a(1:2*n))
  do i = 2, 2*n-1
    if (b(i) >= a(i)) then
      ptot = ptot+b(i)-a(i)
      pnum = pnum+1
      call update(st1,i,a(i)-b(i))
    else
      call update(st2,i,b(i)-a(i))
    end if
  end do
  do i = 1, q
    read(*,*) p, x, y
    atot = atot-a(p)
    if ((.not.(p == 1 .or. p == 2*n)).and.(b(p) >= a(p))) then
      ptot = ptot-b(p)+a(p)
      pnum = pnum-1
    end if
    a(p) = x
    b(p) = y
    atot = atot+a(p)
    if ((.not.(p == 1 .or. p == 2*n)).and.(b(p) >= a(p))) then
      ptot = ptot+b(p)-a(p)
      pnum = pnum+1
    end if
    if (.not.(p == 1 .or. p == 2*n)) then
      if (b(p) >= a(p)) then
        call update(st1,p,DEFAULT)
        call update(st2,p,a(p)-b(p))
      else
        call update(st1,p,b(p)-a(p))
        call update(st2,p,DEFAULT)
      end if
    end if
    if (mod(pnum,2) == 0) then
      write(*,'(i0)') atot+ptot
    else
      write(*,'(i0)') atot+ptot+max(query(st1,2,2*n-1),query(st2,2,2*n-1))
    end if
  end do
  stop
end program paired_parentheses

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

#define INF INT_MAX

using namespace std;

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

int aa[26];
int cc[26];

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

    string s;
    cin >> s;
    
    bool f = false;
   
    for(int i = 0;i < s.size();i++){
        aa[s[i] - 'A']++;
    }

    int c = 0;
    for(int i = 0;i < 26;i++){
        if(aa[i]){
            cc[c] = aa[i];
            c++;
        }
    }
    // cout << c << " " << cc[0] << " " << cc[1] << endl;
    if(c != 2 || cc[0] != cc[1]){
        cout << "No" << endl;
        return 0;
    }
 
    cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,m;
inline int read()
{
	int num=0,f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar())
	if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
	num=(num<<1)+(num<<3)+c-48;
	return num*f;
}
void init()
{
	n=read();m=read();
}
void work()
{
	if(n==1&&m==1)
	{
		cout<<1;
		exit(0);
	}
	if(n==1&&m==2)
	{
		cout<<2;
		exit(0);
	}
	if(n==2&&m==1)
	{
		cout<<2;
		exit(0);
	}
	if(n==1)
	{
		cout<<m-2;
		exit(0);
	}
	if(m==1)
	{
		cout<<n-2;
		exit(0);
	}
	cout<<(m-2)*(n-2);
}
int main()
{
	init();
	work();
	return 0;
}

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

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

    vector<ll> a(n);
    for(int i = 0; i < n; ++i)
        cin >> a[i];

    sort(a.begin(), a.end());

    for(int i = 0; i < n - 1; ++i)
    {
        if(a[i] == a[i + 1])
        {
            cout << "NO" << "\n";
            return 0;
        }
    }

    cout << "YES" << "\n";
    return 0;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
using namespace std;
#define pi pair < int, int>
#define ff first
#define ss second
#define int long long
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define endl "\n"
#include "string"
const int M = 1e9 + 7;

class dsu {
private:
	vector < int > par, sz;
public:
	dsu(int n) {
		par.resize(n + 1);
		sz.resize(n + 1, 1);
		iota(par.begin() , par.end() , 0);
	}

	int find(int u ) {
		if(par[u] == u)
			return u;
		return par[u] = find(par[u]);
	}

	int Union(int u, int v) {
		u = find(u);
		v = find(v);
		if(u == v)
			return sz[u];
		if(sz[u] > sz[v]) {
			par[v] = u;
			sz[u] += sz[v];
		}
		else {
			par[u] = v;
			sz[v] += sz[u];
		}
		return max(sz[u], sz[v]);
	}
};

int32_t main(){
	boost;
	int n, m;
	cin >> n >> m;
	dsu d(n);
	int ans = 1;
	for(int i = 0, u, v; i < m; i++) {
		cin >> u >> v;
		ans = max(ans , d.Union(u, v));
	}	
	cout << ans << endl;
}

Measured memory_bytes: 6340
#include <bits/stdc++.h>
#define ll long long
#define PI 3.14159265358979323846
using namespace std;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   /// https://ideone.com/Fd5s8n
   int n;
   cin>>n;
   ll sum=0;
   for(int i=1;i<=n;i++){
      if(i%3!=0&&i%5!=0)
        sum+=i;
   }
   cout <<sum << endl;
}


Measured memory_bytes: 3648
class UnionFind
  def initialize(n)
    @data = Array.new(n, -1)
  end

  def union_set(a, b)
    a = root(a)
    b = root(b)
    if a != b
      a, b = b, a if @data[b] < @data[a]
      @data[a] += @data[b]
      @data[b] = a
    end
    return a != b
  end

  def find_set(a, b)
    root(a) == root(b)
  end

  def root(a)
    return a if @data[a] < 0
    @data[a] = root(@data[a])
  end

  def size(a)
    return -@data[root(a)]
  end
end

n, m, k = gets.chomp.split.map(&:to_i)

uf = UnionFind.new(n)

friend = Array.new(n, 0)
block = Array.new(n) { Array.new }

m.times do
  a, b = gets.chomp.split.map(&:to_i)
  a -= 1
  b -= 1
  friend[a] += 1
  friend[b] += 1
  uf.union_set(a, b)
end

k.times do
  a, b = gets.chomp.split.map(&:to_i)
  a -= 1
  b -= 1
  block[a].push(b)
  block[b].push(a)
end

n.times do |i|
  res = uf.size(i) - 1 - friend[i]
  block[i].each do |k|
    res -= 1 if uf.find_set(i, k)
  end
  print ' ' if i != 0
  print res
end
puts ''



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

int n, a[100010];
int b[100010];

int main(){

    string s;
    while(cin >> s){
        bool N = s.find('N') == string::npos;
        bool S = s.find('S') == string::npos;
        bool E = s.find('E') == string::npos;
        bool W = s.find('W') == string::npos;
        puts((N^S) || (E^W) ? "No" : "Yes");
    }
}


Measured memory_bytes: 256
n = int(input())
p = list(map(int,input().split()))
i = 1
count = 0
while(i < len(p)-1):
    if(p[i-1] < p[i]):
        if(p[i] < p[i+1]):
            count += 1
    elif(p[i] < p[i-1]):
        if(p[i+1] < p[i]):
            count += 1
    i += 1
print(count)

Measured memory_bytes: 3064
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <iostream>
#include <string>
#include<algorithm>
#include<map>
#include <vector>
#include <cassert>
#include<cmath>
using namespace std;

int main() {
	int i, j,k;
	int flag = 1;
	string S;
	cin >> S;
	int cnt = 0;
	if (S.size() % 2==0) {
		S.erase(S.size() - 2);
		//cout << S;
	}
	else {
		S.erase(S.size() - 1);
		//cout << S;
	}

	while (1) {
		int k_size = S.size() / 2;
		k= S.size() / 2;
		//cout << k_size << endl;//db
		for (i = 0; i < k_size; ++i) {
			//cout << "S[i]" << S[i] << endl;//db
			//cout << "S[k]" << S[k] << endl;//db
			if (S[i] != S[k]) {

				flag = 0;
			}
			++k;
		}
		//cout << endl;//db
		if (flag == 1) {
			cout << S.size() << endl;
			break;
		}
		S.erase(S.size() - 2);
		flag = 1;
	}

}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

int main(){
  ll n;cin>>n;
  vll a(n),b(n);
  rep(i,0,n){cin>>a[i];}
  if(n%2){
    rep(i,0,n/2+1){
      b[i]=a[n-1-i*2];
    }
    rep(i,n/2+1,n){
      b[i]=a[(i-n/2)*2-1];
    }
  }
  else{
    rep(i,0,n/2){
      b[i]=a[n-1-i*2];
    }
    rep(i,n/2,n){
      b[i]=a[(i-n/2)*2];
    }
  }
  rep(i,0,n){
    cout<<b[i]<<" ";
  }
  cout<<endl;
}



Measured memory_bytes: 6372
#include<string>
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)

ll MIN(ll a, ll b){
    if(a>b){
        return b;
    }else{
        return a;
    }
}

int main() {
    ll T;
    cin>>T;
    vector <ll> ans(T,-1);
    
    rep(i,T){
        ll N;
        cin>>N;
        vector<ll> A(N,-1);
        rep(j,N){
            cin>>A[j];
        }
        string S;
        cin>>S;
        vector< vector<ll> > cand(N+1,vector<ll>());
        //cand[N].push_back(0);
        bool flag=false;
        for(ll j = N-1; j >= 0; j--){
            ll x=A[j];
            for(auto y: cand[j+1]){
                x=min(x,x^y);
            }
            cand[j]=cand[j+1];
            if (x!=0) {
                if( S[j] == '0'){
                    cand[j].push_back(x);
                }else{
                    flag=true;
                    break;
                }
            }
        }
        if (flag){
            ans[i]=1;
        }else{
            ans[i]=0;
        }
    }
    rep(i,T){
        cout<<ans[i]<<endl;
    }
    return 0;
}

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


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

	
	int N, T;
	cin >> N >> T;
	int A[100000];
	rep(i, N) cin >> A[i];

	int B[100000];
	B[0] = A[0];
	rep1(i, N - 1) {
		B[i] = min(B[i - 1], A[i]);
	}

	int mouke = 0;
	int siire, uru;
	rep1(i, N - 1) {
		if (A[i] - B[i] > mouke) {
			mouke = A[i] - B[i];
		}
	}

	int kosuto = 0;
	rep(i, N) {
		if (A[i] - B[i] == mouke) kosuto++;
	}

	co(kosuto);

	Would you please return 0;
}

Measured memory_bytes: 1024
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end
w,a,b = inp
p [(a-b).abs-w,0].max

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

using namespace std;

int main()
{
   int n,a[1005]={},k,s=0;
   cin>>n>>k;
   for(int i=1;i<=n;i++){
    cin>>a[i];

   }
   sort(a+1,a+n+1);

   for(int i=1;i<=k;i++){
    s=s+a[i];
   }
   cout<<s;
    return 0;
}


Measured memory_bytes: 3600
///In the name of Almighty Allah(swt).

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    string s;
    cin>>s;
    ll sum=0,i,m;
    for(i=0; i<s.size(); i++){
        m = s[i]-48;
        sum += m;
    }

    if(sum % 9 ==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;


    return 0;
}



Measured memory_bytes: 3760
using System.Numerics;
using System;

public class hello
{

    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var w = int.Parse(line[0]);
            var h = int.Parse(line[1]);
            if (w == 0 && h == 0) break;
            var map = new string[h, w];
            for (int i = 0; i < h; i++)
            {
                var s = Console.ReadLine().Trim();
                for (int j = 0; j < w; j++)
                {
                    int t;
                    map[i, j] = int.TryParse(s[j].ToString(), out t) ? s[j].ToString() : "#";
                }
            }
            var dp = new string[h, w];
            goDp(map, h, w, dp);
        }
    }
    static void goDp(string[,] map, int h, int w, string[,] dp)
    {
        var ans = "-1";
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                if (map[i, j] != "#")
                {
                    string t;
                    if ((i - 1 < 0) || (map[i - 1, j] == "#")) t = map[i, j];
                    else t = dp[i - 1, j] + map[i, j];
                    string t2;
                    if ((j - 1 < 0) || (map[i, j - 1] == "#")) t2 = map[i, j];
                    else t2 = dp[i, j - 1] + map[i, j];
                    dp[i, j] = checkAB(t, t2) ? t : t2;
                    ans = checkAB(ans, dp[i, j]) ? ans : dp[i, j];
                }
            }
        }
        print(ans);
    }
    static void print (string s)
    {
        var ans = "";
        var p = 0;
        var first = true;
        while (p < s.Length)
        {
             if (first && s[p] != '0') { ans += s[p]; first = false; }
            else if (!first) ans += s[p];
            p++;
        }
        Console.WriteLine(ans);

    }
    static bool checkAB(string s, string t)
    {
        BigInteger s2 = BigInteger.Parse(s);
        BigInteger t2 = BigInteger.Parse(t);
        return s2 > t2;
    }
}



Measured memory_bytes: 31928
#include <iostream>

using namespace std;
int main(){
	int i,k,t,a[100],mx = 0,j;
	cin >> k >> t;
	for(i=0;i<t;i++){
		cin >> a[i];
		mx = max(a[i],mx);
	}
	cout << max(2*mx-k-1,0) << endl;
}

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++)


int main() {
    ll n, m; cin >> n >> m;
    if(m==0){
        cout << 0 << " " << 0 << endl;
        return 0;
    }

    vector<ll> p(m);
    vector<string> s(m);
    rep(i, m) cin >> p.at(i) >> s.at(i);
    vector<bool> ok(n+100, false);
    vector<bool> ok2(n+100, false);

    ll ac=0, pena=0;
    rep(i, m){
        if(!ok.at(p.at(i))){
            if(s.at(i)=="AC"){
                ok.at(p.at(i)) = true;
            } 
        }
        else continue;
    }

    rep(i,m){
        if(ok.at(p.at(i))&&!ok2.at(p.at(i))){
            if(s.at(i)=="WA") pena++;
            else ok2.at(p.at(i)) = true;
        }
    }

    rep(i, n) if(ok.at(i+1)) ac++; 
    cout << ac << " " << pena << endl;
}

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

int main() {
  int n;
  int a[110][110] = {0}, b[110][110] = {0};
  cin >> n;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < n; j++) {
      cin >> a[i][j];
    }
  }
  b[0][0] = a[0][0];
  b[1][0] = a[1][0];
  for (int i = 0; i < 2; i++) {
    for (int j = 1; j < n; j++) {
      b[i][j] = a[i][j] + b[i][j - 1];
    }
  }
  int ans = b[0][0] + b[1][n - 1];
  for (int i = 1; i < n; i++) {
    int tmp = b[0][i] + b[1][n - 1] - b[1][i - 1];
    if (tmp > ans) {
      ans = tmp;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main(){
    int n;
    string s = "No";
    cin >> n;

    for(int i = 1;i <= 9;i++)
        if(n % i == 0 && n / i < 10)
            s = "Yes";

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,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 main(){
    ll t;cin >> t;
    while(t--){
        ll n;cin >> n;
        vl a(n);rep(i,n)cin >> a[i];
        string s;
        cin >> s;
        vl dp[n+1];
        ll r=0;
        dp[n].pb(0);
        per(i,n){
            if(s[i]=='0'){
                vl bases=dp[i+1];
                ll v=a[i];
                for(auto e:bases){
                    chmin(v,v^e);
                }
                if(v!=0)bases.pb(v);
                dp[i]=bases;
            }
            else{
                ll v=a[i];
                vl bases=dp[i+1];
                for(auto e:bases){
                    chmin(v,v^e);
                }
                if(v==0)dp[i]=dp[i+1];
            }
        }
        if(binary_search(all(dp[0]),0))cout << 0 <<endl;
        else cout << 1 <<endl;
        /*rep(i,n+1){
            for(auto p:dp[i]){
                cout << p<<" ";
            }
            cout << endl;
        }*/
    }
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
//const int mod = 1000000007;
const int mod = 998244353;

int n;
vector<int> a;
int dp1[310][90010], dp2[310][90010];

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

    cin >> n;
    a.resize(n);
    rep(i, n) cin >> a[i];
    int ans = 1;
    rep(i, n) ans = (ans * 3) % mod;
    int sum = 0;
    rep(i, n) sum += a[i];
    dp1[0][0] = dp2[0][0] = 1;
    rep(i, n)
    {
        rep(j, 90010)
        {
            dp1[i + 1][j] = 2 * dp1[i][j] % mod;
            if (j >= a[i])
                (dp1[i + 1][j] += dp1[i][j - a[i]]) %= mod;
            dp2[i + 1][j] = dp2[i][j];
            if (j >= a[i])
                (dp2[i + 1][j] += dp2[i][j - a[i]]) %= mod;
        }
    }
    if (sum % 2 == 0)
        (ans += 3 * dp2[n][sum / 2]) %= mod;
    Rep(i, (sum + 1) / 2, 90010)(ans -= 3 * dp1[n][i]) %= mod;
    cout << (ans + mod) % mod << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> cards(N); 
  for(int i = 0; i < N; i++) {
    int v = 0;
    cin >> v;
    cards.at(i) = v;
  }
  sort(cards.begin(), cards.end());
  reverse(cards.begin(), cards.end());
  int diff = 0;
  for(int i = 0; i < N; i++) {
    if((i % 2) == 0)
      diff += cards.at(i);
    else
      diff -= cards.at(i);
  }
  cout << diff << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int H = 5;
const int W = 5;

int v[H][W];

int check(int Y1, int X1, int Y2, int X2){
  int res = 0;
  FOR(y, Y1, Y2 + 1){
    FOR(x, X1, X2 + 1){
      if(v[y][x] == 0) return 0;
      res += v[y][x];
    }
  }
  return res;
}

int main() {
  int T; cin >>T;
  REP(t, T){
    REP(i, H) REP(j, W) cin >>v[i][j];
    int ans = 0;
    REP(Y1, H) REP(X1, W) FOR(Y2, Y1, H) FOR(X2, X1, W) ans = max(ans, check(Y1, X1, Y2, X2));
    cout <<ans <<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#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;
  if(s=="SUN") cout << 7 << "\n";
  else if(s=="MON") cout << 6 << "\n";
  else if(s=="TUE") cout << 5 << "\n";
  else if(s=="WED") cout << 4 << "\n";
  else if(s=="THU") cout << 3 << "\n";
  else if(s=="FRI") cout << 2 << "\n";
  else if(s=="SAT") cout << 1 << "\n";  

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second

using namespace std;
typedef long long int64;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    cout << (s == "ABC" ? "ARC" : "ABC");
    
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
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; }

int main() {
  string S; cin >> S;
  REP(i, S.size()) {
    if (i % 2 == 0) cout << S[i];
  }
  cout << endl;
  return 0;
}

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

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

const int MOD = 1e+9 + 7;


int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> A(N), B(M);
    for( int i = 0; i < N; ++i ) cin >> A[i];
    for( int i = 0; i < M; ++i ) cin >> B[i];

    vector<bool> in_A(N*M+1, false), in_B(N*M+1, false);
    REP(i, N) in_A[A[i]] = true;
    REP(i, M) in_B[B[i]] = true;

    // 大きいものから順に決めていく
    long long ans = 1;
    int rc = 0, rr = 0; // row, col でそれぞれ今まで現れた値の数
    for(int i = N*M; i > 0; --i){
        if(in_A[i] and in_B[i]) ++rc, ++rr;
        else if(in_A[i]){
            ans *= rr % MOD;
            ++rc;
        }else if(in_B[i]){
            ans *= rc % MOD;
            ++rr;
        }else{
            ans *= (long long) (rc * rr - (N*M-i)) % MOD;
        }
        ans %= MOD;
    }
    cout << ans << endl; 

    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
//#define endl "\n"
#define fi first
#define se second
#define fr front
#define m_p make_pair
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

int jousu(int, int);
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}




signed main() {
	int h, w;
	cin >> h >> w;
	if (h == 1 || w == 1) {
		cout << 1 << endl;
		return 0;
	}
	cout << (h * w + 1) / 2 << endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <queue>
#include <stack>
#include <cstring>
#include <ctime>
#include <cassert>


#define pb emplace_back
#define re return
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using namespace std;
using namespace __gnu_cxx;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265359;

int n;
ll d;
ll delta;
pair <ll, ll> a[200000];
struct node
{
    ll s;
    ll bonus;
    node *le;
    node *ri;
    node()
    {
        s = bonus = 0;
        le = ri = 0;
    }
};
void add(node *t, ll tl, ll tr, ll x)
{
    t->bonus += x;
    t->s += x * (tr - tl);
}
void push(node *t, ll tl, ll tr)
{
    ll tc = (tl + tr) / 2;
    if (t->le == 0)
        t->le = new node();
    add(t->le, tl, tc, t->bonus);
    if (t->ri == 0)
        t->ri = new node();
    add(t->ri, tc, tr, t->bonus);
    t->bonus = 0;
}
void add(node *t, ll tl, ll tr, ll l, ll r, ll x)
{
    if (tl == l && tr == r)
    {
        add(t, tl, tr, x);
        re;
    }
    ll tc = (tl + tr) / 2;
    push(t, tl, tr);
    if (l < tc)
    {
        if (t->le == 0)
            t->le = new node();
        add(t->le, tl, tc, l, min(tc, r), x);
    }
    if (r > tc)
    {
        if (t->ri == 0)
            t->ri = new node();
        add(t->ri, tc, tr, max(tc, l), r, x);
    }
    if (t->le == 0)
        t->le = new node();
    if (t->ri == 0)
        t->ri = new node();
    t->s = t->le->s + t->ri->s;
}
ll sum(node *t, ll tl, ll tr, ll l, ll r)
{
    if (tl == l && tr == r)
        re t->s;
    ll tc = (tl + tr) / 2;
    push(t, tl, tr);
    ll ans = 0;
    if (l < tc)
    {
        if (t->le == 0)
            t->le = new node();
        ans += sum(t->le, tl, tc, l, min(tc, r));
    }
    if (r > tc)
    {
        if (t->ri == 0)
            t->ri = new node();
        ans += sum(t->ri, tc, tr, max(tc, l), r);
    }
    re ans;
}
int main()
{
    //freopen("distance.in", "r", stdin);
    //freopen("distance.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n >> d >> delta;
    for (int i = 0; i < n; i++)
        cin >> a[i].fi >> a[i].se;
    sort(a, a + n);
    node *root = new node();
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        ll x = a[i].se - sum(root, 0, 1e10, a[i].fi, a[i].fi + 1);
        if (x <= 0)
            continue;
        else
        {
            ll t = x / delta;
            if (x % delta)
                t++;
            add(root, 0, 1e10, a[i].fi, a[i].fi + 2 * d + 1, t * delta);
            ans += t;
        }
    }
    cout << ans;
}
/// ACTUAL CODE STARTS HERE:
//  I'm red in soul
/*
     ▄▀▀▀▄
▄███▀░◐░░░▌
    ▌░░░░░▐
    ▐░░░░░▐
    ▌░░░░░▐▄▄
    ▌░░░░▄▀▒▒▀▀▀▀▄
   ▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
   ▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
    ▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
      ▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
           ▌▌░▌▌
           ▌▌░▌▌
         ▄▄▌▌▄▌▌        */


Measured memory_bytes: 368896
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using namespace std;


int main(){
    int R,G;
    cin >> R >> G;

    int result = 2*G - R;

    cout << result << endl;

    return 0;
}


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

void ALLIN1_NUMBER(vector<ll>& V)
{
    for(auto& x : V)
    {
        cin >> x;
    }
}

void ALLOUT_NUMBER(vector<ll> V)
{
    ll N = V.size();
    for(ll i=0;i<N;i++)
    {
        cout << V[i];
        if(i<N-1) cout << ' ';
    }
    cout << endl;
}

template<class T>
void OUT0(T N)
{
    cout << N << endl;
}

static const double pi = acos(-1.0);

double Cos(double D)
{
    return cos(pi/180 * D);
}

bool Ans(ll X, ll Y)
{
    if(Y%2==0 && Y >= X*2 && Y <= X*4) return true;
    else return false;
}

int main()
{
    ll X,Y;
    cin >> X >> Y;

    if(Ans(X,Y)) OUT0("Yes");
    else OUT0("No");

    return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);in(name)
#define vv(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__))
#define VV(type,name,h,...) vector<vector<type>>name(h,vector<type>(__VA_ARGS__));in(name)
#define vvv(type,name,h,w,...) vector<vector<vector<type>>>name(h,vector<vector<type>>(w,vector<type>(__VA_ARGS__)))
inline int scan(){ return getchar(); }
inline void scan(int &a){ scanf("%d", &a); }
inline void scan(unsigned &a){ scanf("%u", &a); }
inline void scan(long &a){ scanf("%ld", &a); }
inline void scan(long long &a){ scanf("%lld", &a); }
inline void scan(unsigned long long &a){ scanf("%llu", &a); }
inline void scan(char &a){ cin >> a; }
inline void scan(float &a){ scanf("%f", &a); }
inline void scan(double &a){ scanf("%lf", &a); }
inline void scan(long double &a){ scanf("%Lf", &a); }
inline void scan(vector<bool> &vec){ for(unsigned i = 0; i < vec.size(); i++) { int a; scan(a); vec[i] = a; } }
inline void scan(string &a){ cin >> a; }
template<class T> inline void scan(vector<T> &vec);
template<class T, size_t size> inline void scan(array<T, size> &vec);
template<class T, class L> inline void scan(pair<T, L> &p);
template<class T, size_t size> inline void scan(T (&vec)[size]);
template<class T> inline void scan(vector<T> &vec){ for(auto &i : vec) scan(i); }
template<class T, size_t size> inline void scan(array<T, size> &vec){ for(auto &i : vec) scan(i); }
template<class T, class L> inline void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
template<class T, size_t size> inline void scan(T (&vec)[size]){ for(auto &i : vec) scan(i); }
template<class T> inline void scan(T &a){ cin>>a; }
inline void in(){}
template <class Head, class... Tail> inline void in(Head &head, Tail&... tail){ scan(head); in(tail...); }
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
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 Graph = vector<vector<int>>;
/* 4方向への隣接頂点への移動を表すベクトル */
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const long long INF = 1LL << 60;
int main(){
 	LL(n,q);
	STR(s);
	for(int i = 0; i < n-1; ++i){
		if(s[i]=='A'&&s[i+1]=='C')s[i]='a';
	}
	vector<ll> rui(n+2,0);
    for(int i = 0; i < n; ++i){
		rui[i+1]+=rui[i];
		if(s[i]=='a'){
            rui[i+1]++;
        }
	}
 
	for(int i = 0; i < q; ++i){
		LL(l,r);
		cout<<rui[r-1]-rui[l-1]<<endl;
	}
}

Measured memory_bytes: 1792
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

struct point {
	double x, y, z;
	point(double x = 0, double y = 0, double z = 0):x(x), y(y), z(z){}
};

istream& operator>>(istream& is, point& p) {
	return is >> p.x >> p.y >> p.z;
}

inline double abs(const point& p) {
	return sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
}

inline double dot(const point& a, const point& b) {
	return a.x * b.x + a.y * b.y + a.z * b.z;
}

inline double angle(const point& a, const point& b) {
	return acos(dot(a, b) / (abs(a) * abs(b)));
}

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

	for(int n; cin >> n && n;) {
		vector<point> s(n);
		for(int i = 0; i < n; ++i) {
			cin >> s[i];
		}

		int m;
		cin >> m;

		vector<bool> observed(n, false);
		for(int i = 0; i < m; ++i) {
			point t;
			double psy;
			cin >> t >> psy;

			for(int j = 0; j < n; ++j) {
				if(observed[j]) continue;
				if(angle(s[j], t) < psy) observed[j] = true;
			}
		}

		cout << count(observed.begin(), observed.end(), true) << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1324
n=int(input())
if n>=400 and n<=599:
  print("8")
elif n>=600 and n<=799:
  print("7")
elif n>=800 and n<=999:
  print("6")
elif n>=1000 and n<=1199:
  print("5")
elif n>=1200 and n<=1399:
  print("4")
elif n>=1400 and n<=1599:
  print("3")
elif n>=1600 and n<=1799:
  print("2")
elif n>=1800 and n<=1999:
  print("1")

Measured memory_bytes: 9196
#include <bits/stdc++.h>
using namespace std;
	
typedef long long ll;
typedef unsigned long long ull;
typedef long double db;
	
#define MOD 1000000007
#define mi 18446744073709551615
#define ff first
#define ss second
#define pb push_back
#define vii vector<int>
#define pii pair<int,int>
#define vpii vector<pii>

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int T=1;
	//cin>>T;
	while(T--)
	{
		int n,ans=0;
		cin>>n;
		int a[n];
		map <int,int> m;
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
		}
		sort(a,a+n);
		for(int i=0;i<n;i++)
		{
			for(int j=i+1;j<n;j++)
			{
				for(int k=j+1;k<n;k++)
					if(a[i]+a[j]>a[k])
					{
						if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i])
						{
							//cout<<a[i]<<" "<<a[j]<<" "<<a[k]<<"\n";
							ans++;
						}
					}
			}
		}
		cout<<ans<<"\n";
	}  
	return 0;
}

Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.AbstractMap;
import java.util.StringTokenizer;

public class Main {

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

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		
		out.println(180*(n-2));
	}

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

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(final K key, final V value) {
        super(key, value);
    }
 }

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

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

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

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 20820
package main

import (
    "fmt"
)

func main() {
    var a, b int 
    fmt.Scan(&a, &b) 
    if a == b { 
        fmt.Println(a + b)
    } else if a > b { 
        fmt.Println(a*2 - 1)
    } else {
        fmt.Println(b*2 - 1)
    }   
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
//解説写し
int main(){
  int n;
  cin >> n;
  vector<string> s(n);
  for(int i=0;i<n;i++) cin >> s.at(i);
  
  int m;
  cin >> m;
  vector<string> t(m);
  for(int i=0;i<m;i++) cin >> t.at(i);
  
	int ans = 0;
  for(int i=0;i<n;i++){
    int score = 0;
    for(int j=0;j<n;j++) if(s[i]==s[j]) score++;
    for(int j=0;j<m;j++) if(s[i]==t[j]) score--;
    ans = max(ans,score);
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
  long N,B,R;
  scanf("%ld %ld %ld",&N,&B,&R);
  if(B==0)
    printf("0");
  else if (N<=B)
    printf("%ld",N);
  else if(N<=(B+R))
    printf("%ld",B);
  else
  {
    long set=N/(R+B);
    long ans=N-set*(R+B);
    if(ans>B)
      ans=B;
    ans+=set*B;
    printf("%ld",ans);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define lint long long
#define P pair<int, int>

int main(){
    lint X, Y;
    cin >> X >> Y;
    
    int cnt = 0;
    
    while(X <= Y){
        X *= 2;
        cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 256