akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int N;
const int MAX=200200;
vector<int> g[MAX];//connected
vector<int> dist(int u){
	vector<int> d(N,-1);//distance
	vector<int> q={u};//node in order to close to u
	d[u]=0;
	for(int i=0;i<q.size();i++){
		int x=q[i];
		for(int y:g[x]){
			if(d[y]==-1){
				d[y]=d[x]+1;
				q.push_back(y);
			}
		}
	}return d;
}
int main(){
	cin>>N;
	int a,b;
	for(int i=0;i<N-1;i++){
		cin>>a>>b;
		a--;b--;
		g[a].push_back(b);
		g[b].push_back(a);
	}
	vector<int> temp=dist(0);
	int rofl=max_element(temp.begin(),temp.end())-temp.begin();
	temp=dist(rofl);
	int diam=*max_element(temp.begin(),temp.end());
	if(diam%3==1)
		cout<<"Second\n";
	else
		cout<<"First\n";
	return 0;
}

Measured memory_bytes: 15332
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1ll<<60;

int main(int argc, char **argv)
{
	ll N; cin >> N;
	vector<ll> A(5); for (ll i = 0; i < 5; ++i) cin >> A[i];

	ll min = *min_element(A.begin(), A.end());

	ll res{5};
	res += ((N-1) / min);
	std::cout << res << std::endl;
}

Measured memory_bytes: 256
/*
ID: dorijan1
TASK: tu napisi ime zadatka molim te molim te ali samo ako si na usaco training
LANG: C++11
*/
#include <bits/stdc++.h>

using namespace std;

const int MOD=1000000007;
typedef long long int ll;
const ll LLINF=1ll<<60;

ll sti(string a)
{
	ll k=0;
	for (int i=0;i<a.size();++i)
	{
		k*=10;
		k+=a[i]-'0';
	}
	return k;
}

string its(ll k)
{
	string a;
	while (k)
	{
		a.push_back((k%10)+'0');
		k/=10;
	}
	reverse(a.begin(),a.end());
	return a;
}

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

template<class T,class K>
pair<T,K> mp(T a,K b)
{
	return make_pair(a,b);
}

ll mult(ll a,ll b)
{
	return (a*b)%MOD;
}

ll pot(ll n,ll k)
{
	if (k==0) return 1;
	ll a=pot(n,k/2);
	a=mult(a,a);
	if (k%2) return mult(a,n);
	else return a;
}

ll divide(ll a,ll b)
{
	return mult(a,pot(b,MOD-2));
}

ll sub(ll a,ll b)
{
	return (a-b+MOD)%MOD;
}

ll add(ll a,ll b)
{
	return (a+b)%MOD;
}

bool prime(ll a)
{
	if (a==1) return 0;
	for (int i=2;i<=round(sqrt(a));++i)
	{
		if (a%i==0) return 0;
	}
	return 1;
}

int n;
string go;
bool st;

void bs(int lo,int hi)
{
	int mid=(lo+hi)/2;
	cout<<mid<<endl;
	cin>>go;
	if (go=="Vacant") return;
	if ((go=="Male" && (st+mid)%2==0) || (go=="Female" && (st+mid)%2==1)) bs(mid+1,hi);
	else bs(lo,mid);
}

int main()
{
	std::ios_base::sync_with_stdio(false);
	cin>>n;
	cout<<0<<endl;
	cin>>go;
	if (go=="Female") st=1;
	bs(0,n);
}



Measured memory_bytes: 852
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
typedef vector<int> vi;

int main() {
  int N, K;
  cin >> N >> K;
  vi h(N);
  int cnt = 0;
  rep(i,N) {
    cin >> h[i];
    if(h[i] >= K) cnt++;
  }
  cout << cnt << endl;
  return 0;
}

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

int main() {
  int a,b;
  char op;
  cin >> a>>op>>b;
  int sum=a;
  //char c=s2.at(0);
	if(op=='+'){
      sum+=b;
      cout<<sum<<endl;
    }
  else{
    sum-=b;
    cout<<sum<<endl;
  }
  //cout<<s1[0]<<s2[0]<<s3[0]<<endl;

}



Measured memory_bytes: 3552
pas = input()

if len(pas) < 6 :
    print("INVALID")
else :
    num = 0
    Lstr = 0
    Sstr = 0
    for i in range(len(pas)) :
        if ord(pas[i]) >= 48 and ord(pas[i]) <= 57 :
            num += 1
        if ord(pas[i]) >= 97 and ord(pas[i]) <= 122 :
            Lstr += 1
        if ord(pas[i]) >= 65 and ord(pas[i]) <= 90 :
            Sstr += 1
    if num == 0 or Lstr == 0 or Sstr == 0 :
        print("INVALID")
    else :
        print("VALID")


Measured memory_bytes: 5560
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,a,b;
  scanf("%d %d %d",&n,&a,&b);
  a=n*a;
  if(a>b)
  {
    printf("%d",b);
  }
  else if(a<b)
  {
    printf("%d",a);
  }
  else
  {
    printf("%d",a);
  }
  return 0;
}

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

const ll inf = 1e18 + 1;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);


		string n;
		cin>>n;
		if(n[0] == '7' || n[1] == '7' || n[2] == '7')cout<<"Yes\n";
		else cout<<"No\n";

	return 0;
}


Measured memory_bytes: 3644
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

N, M = ints()
A = ints()
A.sort()
A.reverse()

def combinations_and_kofukudo(x):
  c = 0
  k = 0
  si = 0
  i = 0
  for j in reversed(range(N)):
    while i<N and A[i]+A[j]>=x:
      si += A[i]
      i += 1
    c += i
    k += si + A[j]*i
    
  return (c, k)

def bsearch(l, u):
  m = (l+u)//2
  c, k = combinations_and_kofukudo(m)
  if c<M:
    return bsearch(l, m)
  else:
    if l==m:
      print(k-(c-M)*l)
      exit()
    return bsearch(m, u)

bsearch(0, A[0]*2+1)


Measured memory_bytes: 13972
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <map>

#define INF (1 << 8)

using namespace std;

map<string, int> table;
map<string, vector<string> > recipe;

int rec(string item)
{
    if(recipe[item].size() == 0) {
        return table[item];
    } else {
        int ret = 0;
        for(int i = 0; i < recipe[item].size(); i++) ret += rec(recipe[item][i]);
        return min(ret, table[item]);
    }
}

int main()
{
    int N, R; 
    while(cin >> N && N) {
        table.clear();
        for(int i = 0; i < N; i++) {
            int v; string name;
            cin >> name >> v;
            table.insert( map<string, int>::value_type(name, v));
        }
        
        cin >> R;
        recipe.clear();
        for(int i = 0; i < R; i++) {
            int n; string name, tmp; vector<string> child;
            cin >> name >> n;
            for(int j = 0; j < n; j++) {
                cin >> tmp;
                child.push_back(tmp);
            }
            recipe.insert( map<string, vector<string> >::value_type(name, child));
        }

        string query;
        cin >> query;
        cout << rec(query) << endl;
    }
}

Measured memory_bytes: 0
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE NumDecimals #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}

import Control.Applicative
import Control.Arrow
import Control.Monad
import Control.Monad.ST

import Data.Char
import Data.List
import Data.Maybe

import qualified Data.ByteString.Char8 as B

import Data.Array.ST.Safe
import Data.STRef

import Debug.Trace
import Text.Printf

readInt = readLn :: IO Int
readInts = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine
readNInts = readInt >>= flip replicateM readInt

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

modifyArray a i f = writeArray a i =<< f <$> readArray a i

main = do
	[ n, m ] :: [Integer] <- map fromIntegral <$> readInts
	s <- getLine
	t <- getLine
	let
		l = lcm n m
		ps = zip s $ map ( * ( l `div` n ) ) [ 0 .. ]
		qs = zip t $ map ( * ( l `div` m ) ) [ 0 .. ]
	print $ if f ps qs
		then l
		else -1

f [] _ = True
f _ [] = True
f list1@( ( c1, p1 ) : rest1 ) list2@( ( c2, p2 ) : rest2 )
	| p1 < p2 = f rest1 list2
	| p1 > p2 = f list1 rest2
	| c1 == c2 = f rest1 rest2
	| otherwise = False

Measured memory_bytes: 8956
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
using namespace std;

int main()
{
	int a[3];
	int k;
	int ans = 0;

	cin >> a[0] >> a[1] >> a[2];
	cin >> k;

	int maxv = 0;
	int maxi;
	for( int i = 0; i < 3; i++ ) {
		if( maxv < a[i] ) {
			maxi = i;
			maxv = a[i];
		}
	}

	for( int i = 0; i < k; i++ ) {
		a[maxi] *= 2;
	}

	for( int i = 0; i < 3; i++ ) {
		ans += a[i];
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;

int main() {
    int R[10000], cnt = 0;
    REP(i, 10000) {
        cin >> R[i];
        if (R[i] == 0) break;
        cnt ++;
    }

    REP(i, cnt) {
        cout << "Case " << i+1 << ": " << R[i] << endl;
        
    }
    
    return 0;
}


Measured memory_bytes: 3036
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
#define LNF __LONG_LONG_MAX__
const ll MOD = 1000000007;
const int MAX = 200000;

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

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// 法mでのaの逆元を計算
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//最大公約数
int gcd(int x, int y) { return (x % y)? gcd(y, x % y): y; }
//最小公倍数
int lcm(int x, int y) { return x / gcd(x, y) * y; }
// nが大きく,kが10^7程度の時の二項係数
long long com[200005];
void combination(long long n,long long k){
    com[0] = 1;
    for(int i=1;i<=k;i++){
        com[i] = (com[i-1]*(n-i+1)%MOD)*modinv(i,MOD)%MOD;
    }
}

int main(){
    int N; cin >> N;
    vector<int> a(N);
    vector<int> b(N);
    for(int i=0;i<N;i++){
        cin >> b[i];
        b[i]--;
    }
    for(int i=0;i<N;i++){
        int num=-1;
        for(int j=0;j<b.size();j++){
            if(b[j]==j) num=j;
        }
        if(num==-1){
            cout << -1 << endl;
            return 0;
        }
        b.erase(b.begin()+num);
        a[i]=num;
        for(int j=0;j<b.size();j++){
            cerr << b[i] << "\t";
        }
        cerr << "\n";
    }
    for(int i=0;i<N;i++){
        cout << a[N-1-i]+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <numeric>
#include <functional>
#include <string> 
#include <vector>
#include <bitset>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>

using namespace std;
using ll = long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) { if (flg) { cout << hoge << endl; exit(0); } }
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) { o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o; }
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) { o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o; }
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) { o << "{" << obj.first << ", " << obj.second << "}"; return o; }
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) { o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o; }
void print(void) { cout << endl; }
template <class Head> void print(Head&& head) { cout << head; print(); }
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) { cout << head << " "; print(forward<Tail>(tail)...); }
void YN(bool flg) { cout << ((flg) ? "YES" : "NO") << endl; }
void Yn(bool flg) { cout << ((flg) ? "Yes" : "No") << endl; }
void yn(bool flg) { cout << ((flg) ? "yes" : "no") << endl; }

int main() {
	V<int> a(4);
	REP(i, 4) cin >> a[i];
	sort(ALL(a));
	YN(a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9);

	
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split().ToArray();
            var r = "A" + s[1].Substring(0,1) + "C";

            Console.WriteLine(r);
        }
    }
}


Measured memory_bytes: 13268
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
template <class T>
T ceil(T a, T b) {
    return (a + b - 1) / b;
}
template <class T>
T round(T a, T b) {
    return (a + b / 2) / b;
}
template <class T>
T gcd(T a, T b) {
    return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}
template <class T>
bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    if (B % A == 0) {
        cout << A + B << endl;
    } else {
        cout << B - A << endl;
    }
    return 0;
}


Measured memory_bytes: 892
n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
cc = list(map(int, input().split()))
score = bb[aa[0]-1]
for i in range(1,n):
    score += bb[aa[i]-1]
    if aa[i] == aa[i-1] +1:
        score += cc[aa[i-1]-1]
print(score)

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

#define pb push_back
#define F first
#define S second

#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define int long long
#define ll long long


	
void solve(){
	int n, k, sum = 0;
	cin >> n >> k;
	int a[n];
	for(int i = 0 ; i < n ; i++){
		cin >> a[i];	
	}
	sort(a, a + n);
	for(int i = 0 ; i < k ; i++){
		sum += a[i];	
	}
	cout << sum;
}

signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}

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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
using P = pair<ll, ll>;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
struct edge {
  ll to, cost;
};

int main() {
  int N, M; cin >> N >> M;
  vector<vector<int>> tree(N + 1);
  REP(i, M) {
    int a, b; cin >> a >> b;
    tree[a].push_back(b);
    tree[b].push_back(a);
  }
  REP(i, N + 1) sort(all(tree[i]));
  vector<int> array(N); REP(i, N) array[i] = (i + 1);
  int ans = 0;
  do{
    if(array[0] != 1) continue;
    bool flag = true;
    for(int i = 0; i < array.size() - 1; ++i){
      if(!binary_search(all(tree[array[i]]), array[i + 1])) {
        flag = false;
        break;
      }
    }
    if(flag) ans++;
  } while(next_permutation(all(array)));
  cout << ans << endl;
}

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

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  string s;
  ll q;
  cin >> s >> q;

  bool rev_flg = false;
  deque<char> deq;

  rep(i,sz(s))
  {
    deq.push_back(s[i]);
  }

  rep(i,q)
  {
    ll t; cin >> t;

    if(t == 1)
    {
      rev_flg = !rev_flg;
    }
    else if(t == 2)
    {
      ll f;
      char c;
      cin >> f >> c;

      if( (f == 1 && !rev_flg) || (f == 2 && rev_flg) )
      {
        deq.push_front(c);
      }
      else
      {
        deq.push_back(c);
      }
    }   
  }

  ll num = deq.size();

  if(!rev_flg)
  {
    rep(i,num)
    {
      cout << deq.front();
      deq.pop_front();
    }
  }
  else
  {
    rep(i,num)
    {
      cout << deq.back();
      deq.pop_back();
    }
  }
  

  cout << endl;
  
  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 896
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {

    int n = 0;
    char[] row = null;
    try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
      n = Integer.parseInt(br.readLine());
      row = br.readLine().toCharArray();
    } catch (IOException e) {
      e.printStackTrace();
      System.exit(1);
    }

    int[] e = new int[n];
    int[] w = new int[n];
    initCumulativeSum(row, e, w);

    for (int i = 1; i <= row.length - 1; i++) {
      if (row[i] == 'E') {
        e[i] = e[i - 1] + 1;
        w[i] = w[i - 1];
      } else if (row[i] == 'W') {
        w[i] = w[i - 1] + 1;
        e[i] = e[i - 1];
      }
    }

    int min = e[e.length-1];
    for (int i = 1; i < n; i++) {
      int sum = (e[e.length-1] - e[i]) + (w[i - 1]);
      min = Math.min(min, sum);
    }
    System.out.print(min);
  }


  private static void initCumulativeSum(char[] row, int[] e, int[] w) {
    if (row[0] == 'E') {
      e[0] = 1;
      w[0] = 0;
    } else if (row[0] == 'W') {
      e[0] = 0;
      w[0] = 1;
    }
  }
}


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

int main()
{
	int m,r,f  = 0;
	vector<char> score;
	int i = 0;

	while (1) {
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1)
			break;

		if (m == -1 || f  == -1) {
			score.push_back('F');
		} else if ((m + f) >= 80) {
			score.push_back('A');
		} else if (65 <= (m+f) && (m+f) < 80) {
			score.push_back('B');
		} else if (50 <= (m+f) && (m+f) < 65) {
			score.push_back('C');
		} else if (30 <= (m+f) && (m+f) < 50) {
			if (r >= 50) 
				score.push_back('C');
			else 
				score.push_back('D');
		} else if ((m+f) < 30) {
			score.push_back('F');
		}

	}
	for (int i = 0; i < score.size(); i++)
		cout << score[i] << '\n';

	return 0;
}


Measured memory_bytes: 3100
H, W, h, w =list(map(int,input().split()))
INF = 10**10
mat = [[1000 for _ in range(H)] for _ in range(W)]

val =-h*w*1000+ 999
for h_new in range(h-1,H,h):
    for w_new in range(w-1,W,w):
        mat[w_new][h_new] = val

if (sum(sum(mat[j][i] for i in range(H)) for j in range(W)))< 0:
    print("No")
else:
    print("Yes")
    for i in range(H):
        for j in range(W):
            print(mat[j][i], end =" ")
        print("")

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

int main(){
	int a,b,k;
	scanf("%d %d %d",&a,&b,&k);
	if(a<b){
		int tmp = a;
		a = b;
		b = tmp;	
	}
	int r = a%b;
	while(r!=0){
		a = b;
		b = r;
		r = a%b;
	}
	int gcd = b;
	int sum =0;
	for(int i=gcd;i!=0;i--){
		if(gcd%i==0) sum++;
		if(sum == k){
			printf("%d\n",i);
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
def g;gets.split.map &:to_i;end
def r c;c.map{|i|i.reverse}.transpose;end
while(n,m=g)[0]>0
v=(1..n).map{g}
c=(1..m).map{g}
t=[c,s=r(c),u=r(s),r(u)]
w=0..n-m
d=[*0..m-1]
e=d.product d
puts (a=w.find{|i|m=w.map{|j|j+t.map{|k|e.all?{|y,x|k[y][x]<0||v[i+y][j+x]==k[y][x]}?k[0].index{|l|l>=0}:n}.min}.min;m<n})?[m+1,a+1]*" ":"NA"
end

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

int main() {
    int n, h;
    cin >> n >> h;
    int a[n], b[n];
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    int max_a = a[max_element(a, a + n) - a];
    sort(b, b + n, greater<int>());
    
    int count = 0;
    for (int x: b) {
        if (h <= 0) {
            cout << count << endl;
            return 0;
        }
        if (x < max_a)
            break;
        count++;
        h -= x;
    }
    if (h <= 0) {
        cout << count << endl;
        return 0;
    }
    cout << (count + (h - 1) / max_a + 1) << endl;
    return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);
	int n, m, x, y,z, a, b, c;
	string s;
	cin >> x>>y>>z;

	cout << z << " " << x << " " << y;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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; }

long long N,x,ans,sum;

int main(){
    in(N);in(x);
    ans=0;
    sum=0;
    long long a[N];
    rep(i,N){
        in(a[i]);
        sum+=a[i];
    }
    if(sum==x){
        out(N);
        return 0;
    }else if(sum<x){
        out(N-1);
        return 0;
    }
    sort(a,a+N);
    int i=0;
    while(x>0){
        x-=a[i];
        i++;
        ans++;
    }
    if(x<0){
        ans--;
    }
    out(ans);
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <numeric>
#include <stack>
#include <string>
#include <utility>
#include <vector>

class Info {
  public:
    int n;
    bool is_end;
    int children[26];
    int step, link;
    Info(int n = 0) {
      this->n = n;
      is_end = false;
      for (int i = 0; i < 26; ++i) {
        children[i] = -1;
      }
      step = 0;
      link = -1;
    }
};

int main() {
  int n, q, k;
  std::string s[100000];
  std::string p;
  std::vector<Info> trie;
  std::stack<int> st;
  trie.push_back(Info());
  st.push(0);
  std::cin >> n;
  for (int ni = 0; ni < n; ++ni) {
    int ptr = 0;
    std::cin >> s[ni];
    for (char c : s[ni]) {
      if (trie[ptr].children[c - 'a'] < 0) {
        trie[ptr].children[c - 'a'] = trie.size();
        st.push(trie.size());
        trie.push_back(Info());
      }
      ++trie[ptr].n;
      ptr = trie[ptr].children[c - 'a'];
    }
    ++trie[ptr].n;
    trie[ptr].is_end = true;
  }
  while (not st.empty()) {
    int id = st.top();
    st.pop();
    if (not trie[id].is_end) {
      int num = 0;
      int one;
      for (int i = 0; i < 26; ++i) {
        int x = trie[id].children[i];
        if (x >= 0) {
          ++num;
          one = x;
        }
      }
      if (num == 1) {
        if (trie[one].link < 0) {
          trie[id].step = 0;
          trie[id].link = one;
        } else {
          trie[id].step = 1 + trie[one].step;
          trie[id].link = trie[one].link;
        }
      }
    }
  }
  std::cin >> q;
  for (int qi = 0; qi < q; ++qi) {
    int ans = 1;
    int idx[26];
    int ptr = 0;
    std::cin >> k >> p;
    for (int i = 0; i < 26; ++i) {
      idx[p[i] - 'a'] = i;
    }
    for (std::size_t pos = 0; pos < s[k - 1].length(); ++pos) {
      char c = s[k - 1][pos];
      int end = idx[c - 'a'];
      for (int i = 0; i < end; ++i) {
        int cid = trie[ptr].children[p[i] - 'a'];
        if (cid >= 0) {
          ans += trie[cid].n;
        }
      }
      if (trie[ptr].is_end) {
        ++ans;
      }
      if (trie[ptr].link < 0) {
        ptr = trie[ptr].children[c - 'a'];
      } else {
        pos += trie[ptr].step;
        ptr = trie[ptr].link;
      }
    }
    std::printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 65640
#include <iostream>
#include <algorithm>
using namespace std;
int dp[3010][3010]={0};
int main() {
  string s,t,res="";
  cin>>s>>t;
  int ss=s.size(),ts=t.size();
  for(int i=0;i<ss;++i)for(int j=0;j<ts;++j){
    dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    if(s[i]==t[j])dp[i+1][j+1]=dp[i][j]+1;
  }
  while(ss>0&&ts>0)
    if(dp[ss][ts]==dp[ss-1][ts])--ss;
    else if(dp[ss][ts]==dp[ss][ts-1])--ts;
    else{--ss;--ts;res=s[ss]+res;}
  cout<<res<<endl;
}


Measured memory_bytes: 35584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//--<for debugging>
#define whatis(x) cout << #x << " is " << x<<" ";
#define whatisl(x) cout << #x << " is " << x<<"\n";
#define parr(array,end)for(ll loop=0;loop<end;loop++)cout<<array[loop]<<" ";cout<<"\n";
#define lline cout<<"\n";
#define errorl(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"\n";}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout<<"___";}
    
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a <<" , ";
    err(++it, args...);
}
//--</for debugging> 
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define testcase ll tt; cin >> tt; while(tt--)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define vars ll h,i,j,k,d,l,p,q,r,x,y,a,b,c,v,var,n,m,z,s,ans,ind1,ind2,flag,limit1,limit2,limit3,mod;
#define vll vector<ll>
#define pll pair<ll,ll>
#define sll set<ll>
#define pint pair<int,int>
const ll INF=1e9+7;
const ll MOD=1e9+7;
int main()
{
    boost vars
    string str;
    cin>>str;
    n=str.length();
    flag=0;
    for(i=1;i<n;i++)
    {
        if(str[i]==str[i-1])
        {
            flag=1;
            break;
        }
    }
    if(flag){cout<<i<<" "<<i+1;return 0;}
    for(i=2;i<n;i++)
    {
        if(str[i]==str[i-2])
        {
            flag=1;
            break;
        }
    }
    if(flag){cout<<i-1<<" "<<i+1;return 0;}
    cout<<"-1 -1";
}

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

typedef long long ll;

int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n), b(n);
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        b[i] = a[i];
    }
    sort( b.begin() , b.end() );
    for(int i=0;i<n;i++)
    {
        auto  l1 = lower_bound(b.begin() , b.end() , a[i] );
        if( l1 - b.begin() >= n/2 )
            cout<<b[n/2 - 1 ]<<endl;
        else cout<<b[n/2 ]<<endl;
    }
}

Measured memory_bytes: 6292
#include <iostream>
#include <algorithm>
#include <string>


using namespace std;









int main(){
  string str[100],strb[100];
  int num,mini,hantei=1;
  
  cin >>num;

  for(int i=0;i<num;i++){
    cin >>str[i];
  }

  for(int i=0;i<num;i++){
    strb[i]=str[i];
  }

  

  
  //bubble sort
for(int i=0;i<num-1;i++){

  for(int j=num-1;j>i;j--){

    if((str[j]).substr(1,1)<(str[j-1]).substr(1,1)){
      swap(str[j],str[j-1]);
      
    }
    
  }
 }


//selection sort
 for(int i=0 ; i<num-1;i++){
    mini=i;
    for(int j=i+1;j<num;j++){//num-1
      
      if((strb[j]).substr(1,1)<(strb[mini]).substr(1,1)){ mini=j;
      }
    
    

    }
    if(mini!=i){
    swap(strb[i],strb[mini]);
    if((strb[i]).substr(0,1)==(strb[mini]).substr(0,1)){
      hantei =0;
    }
    
    }

  }
  




 
// (str[i]).substr(1,1)

//bubble
 for(int i=0;i<num;i++){

   if(i!=num-1){ cout << str[i]<<" ";
   }else{

     cout <<str[i]<<endl;
     
   }

   
 }

 cout<<"Stable"<<endl;
 
 //selection
 for(int i=0;i<num;i++){

   if(i!=num-1){ cout << strb[i]<<" ";
   }else{
     
     cout <<strb[i]<<endl;
     
   }

   
 }
 if(hantei==1){
   
  cout<<"Stable"<<endl;
 }else {

cout<<"Not stable"<<endl;

 }


  
  
  
  

  
  
  
  return 0;
}

Measured memory_bytes: 3140
#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>


using namespace std;
int main(){

    double xA, yA, xB, yB, xC, yC, xD, yD;
    while(cin>>xA>>yA>>xB>>yB>>xC>>yC>>xD>>yD){
//        double tan1 = atan((yA-yB)/(xA-xB));
//        double tan2 = atan((yC-yD)/(xC-xD));
        
        if((yA-yB)*(yC-yD)==-1.0*(xA-xB)*(xC-xD))cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

        
//        double deg = tan1-tan2;
//        //cout<<deg<<endl;
//        if(deg==M_PI_2||deg==-M_PI_2)cout<<"YES"<<endl;
//        else cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 1216
n, k = map(int, input().split())
ans = 0
if k == 0:
  print(n**2)
  exit(0)
for i in range(k+1,n+1):
  a = n-n%i
  ans += (i-k)*(a//i)
  if n%i >=k:
    ans += n%i-k+1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    int n,k;
    cin >> n >> k;

    vector<double> p(n);
    for(auto &x:p){
        cin >> x;
    }

    vector<double> exp(n);
    vector<double> sum(n+1,0);
    for(int i=0;i<n;i++){
        exp[i]=(p[i]+1)/2;
        sum[i+1]=exp[i]+sum[i];
    }

    double maxval=sum[k];
    for(int i=k+1;i<n+1;i++){
        maxval=max(maxval,sum[i]-sum[i-k]);
    }

    cout << maxval << endl;

    return 0;
}


Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();

ll bikkuri(int n){
    ll count=1;
    FOR(i,1,n+1){
      count*=i; 
    }
    return count;
}

int main(void)
{ 
    ll n; cin>>n;
    vector<ll> p(n);
    vector<ll> q(n);
    vector<bool> v1(n,1); 
    vector<bool> v2(n,1);
    ll a=0,b=0;

    REP(i,n){
        int count=0;
        int count2=0;

        cin>>p[i];
        v1[p[i]-1]=0;
        REP(j,n){
            //if (v1[j])count++;
            if (v1[j]&&j+1<p[i])count2++;
        }
        a+=count2*bikkuri(n-i-1);
        //cout<<count<<' '<<count2<<' '<<a<<endl;
    }
//cout<<endl;
    REP(i,n){
        int count=0;
        int count2=0;

        cin>>q[i];
        v2[q[i]-1]=0;
        REP(j,n){
            //if (v2[j])count++;
            if (v2[j]&&j+1<q[i])count2++;

        }
        b+=count2*bikkuri(n-i-1);
       //cout<<count<<' '<<count2<<' '<<b<<endl;
    }
  cout<<abs(a-b)<<endl;   
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
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; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

int main(){

  ll n,m;cin>>n>>m;
  ll c[m];rep(i,0,m)cin>>c[i];
  const ll MAX_N=50001;
  ll dp[MAX_N];
  rep(i,0,MAX_N)dp[i]=INF;
  dp[0]=0;

  rep(i,1,n+1){
    rep(j,0,m){
      if(i-c[j]>=0){
        chmin(dp[i],dp[i-c[j]]+1);
      }
    }
  }

  out(dp[n]);

  return 0;
}



Measured memory_bytes: 3520
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
int n, x[200010], y[200010];
int main() {
  cin >> n;
  rep(i,n) {
    cin >> x[i];
    y[i] = x[i];
  }
  sort(y,y+n);
  int l = y[n/2-1], r = y[n/2];
  rep(i,n) {
    if (x[i] <= l) cout << r << endl;
    else if (x[i] >= r) cout << l << endl;
  }

  return 0;
}

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

int N,A,B;

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

    if((B-A)%2 == 0){
        cout << "Alice" << endl;
    } else {
        cout << "Borys" << endl;
    }
        
    return 0;
}

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


def main():
    A, B, C, D, E, F = map(int, input().split())

    A *= 100
    B *= 100

    water = []
    sugar = []

    for i in range(1 + F // A):
        for j in range(1 + F // B):
            if i * A + j * B <= F:
                water.append(i * A + j * B)

    for i in range(1 + F // C):
        for j in range(1 + F // D):
            if i * C + j * D <= F:
                sugar.append(i * C + j * D)

    max_sugar_percent = 0
    max_water = 0
    max_sugar = 0

    water.sort()
    sugar.sort()

    for w in water:
        for s in sugar:
            if w + s > F:
                break

            if s > E * w / 100:
                break

            sugar_percent = w and(100 * s) / (w + s)
            if sugar_percent >= max_sugar_percent:
                max_sugar_percent = sugar_percent
                max_sugar = s
                max_water = w + s

    print(max_water, max_sugar)


if __name__ == "__main__":
    main()


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

int main()
{
  int N, nums[2][100];

  cin >> N;
  for(int i = 0; i < 2; i++) for (int j = 0; j < N; j++) cin >> nums[i][j];

  for (int i = 1; i < N; i++) nums[0][i] += nums[0][i - 1];
  nums[1][0] += nums[0][0];
  for (int i = 1; i < N; i++) nums[1][i] += max(nums[1][i - 1], nums[0][i]);
  cout << nums[1][N - 1] << endl;
  return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	int sum=0;
	while(a>=b)
	{
		b*=2;
		sum++;
	}
	while(c<=b)
	{
		sum++;
		c*=2;
	}
	if(sum<=d) 
	printf("Yes");
	else
	printf("No");
	return 0;
}

Measured memory_bytes: 3740
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#define int long long
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
int start,len=31;
inline int myabs(int x){
	return x<0?-x:x;
}
int _x,_y;
void Move(int &x,int &y,int len){
	int l1=myabs(x+len)+myabs(y);
	int l2=myabs(x-len)+myabs(y);
	int l3=myabs(x)+myabs(y+len);
	int l4=myabs(x)+myabs(y-len);
	int Min=min(min(l1,l2),min(l3,l4));
	if(l1==Min){
		cout<<"D";
		_x-=len;
		x+=len;
		return;
	}
	if(l2==Min){
		cout<<"U";
		_x+=len;
		x-=len;
		return;
	}
	if(l3==Min){
		cout<<"L";
		_y-=len;
		y+=len;
		return;
	}
	if(l4==Min){
		cout<<"R";
		_y+=len;
		y-=len;
		return;
	}
	while(1);
}
void solve(int &x,int &y){
	_x=0;_y=0;
	for(int i=len;i>=start;i--){
		Move(x,y,1ll<<i);
	}
	cerr<<endl<<_x<<" "<<_y<<" ";
	int cnt=0;
	if(x||y){
		while(x<0){
			x++;
			_x--;cnt++;
			cout<<"D";
		}
		while(x>0){
			x--;
			_x++;cnt++;
			cout<<"U";
		}
		while(y<0){
			y++;
			_y--;cnt++;
			cout<<"L";
		}
		while(y>0){
			cout<<"R";
			y--;cnt++;
			_y++;
		}
	}
	while(cnt<8){
		cout<<"LR";
		cnt+=2;
	}
//	cout<<endl<<_x<<" "<<_y<<" ";
	cout<<endl;
}
int n;
int x[1005],y[1005];
signed main(){
//	freopen("data.in","r",stdin);
//	freopen("data.out","w",stdout); 
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i]>>y[i],swap(x[i],y[i]);
	for(int i=1;i<=n;i++)if(abs(x[i]+y[i])%2!=abs(x[1]+y[1])%2){
		puts("-1");return 0;
	}
	cout<<(abs(x[1]+y[1])%2?len+9:len+8)<<endl;
	start=1-abs(x[1]+y[1])%2;
	for(int i=len;i>=start;i--)cout<<(1ll<<i)<<" ";
	cout<<"1 1 1 1 1 1 1 1"<<endl;
	for(int i=1;i<=n;i++){
		solve(x[i],y[i]);
	}
	return 0;
}

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

using namespace std;

int strNum(string a){
    if(a == "A")
        return 10;
    
    else if(a == "B")
        return 11;
    
    else if(a == "C")
        return 12;
    
    else if(a == "D")
        return 13;
    
    else if(a == "E")
        return 14;
    
    else
        return 15;
}



int main(){
    string x,y; cin >> x >> y;
    int a = strNum(x);
    int b = strNum(y);
    
    if(a > b)
        cout << ">" << endl;
    
    else if(a < b)
        cout << "<" << endl;
    
    else
        cout << "=" << endl;
}

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

TA=0
AO=0
L=[]
for i in range(N):
    A,B=map(int,input().split())
    L.append([[A+B],A,B])
L.sort(reverse=True)

for i in range(N):
    if i%2==0:
        TA+=L[i][1]
    else:
        AO+=L[i][2]

print(TA-AO)

Measured memory_bytes: 34232
def main():
    examA()

def examA():
    N = I()
    ans = 1^N
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

def test():
    i = I()
    li = LI()
    lsi = LSI()
    si = LS()
    print(i)
    print(li)
    print(lsi)
    print(si)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,alphabet_convert,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 1<<31
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    main()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Measured memory_bytes: 10548
object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, ma, mb = sc.nextInt()
  val (a, b, c) = Array.fill(n)((sc.nextInt(), sc.nextInt(), sc.nextInt())).unzip3
  val m = 10*n
  val dp = Array.fill(n+1, m+1, m+1)(Int.MaxValue/2)
  dp(0)(0)(0) = 0
  for {
    i <- 1 to n
    ca <- 0 to m
    cb <- 0 to m
  } {
    dp(i)(ca)(cb) = dp(i)(ca)(cb).min(dp(i-1)(ca)(cb))
    if (ca >= a(i-1) && cb >= b(i-1)) {
      dp(i)(ca)(cb) = dp(i-1)(ca)(cb).min(dp(i-1)(ca - a(i-1))(cb - b(i-1)) + c(i-1))
    }
  }
  var ans = Int.MaxValue
  for {
    ca <- 0 to m
    cb <- 0 to m
    if (ca != 0 || cb != 0) && ca * mb == cb * ma
  } {
    ans = ans.min(dp(n)(ca)(cb))
  }
  println(if (ans == Int.MaxValue/2) -1 else ans)
}


Measured memory_bytes: 92284
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

typedef complex<double> P;

double dif(P a,P b,P c){
    a=b-a;
    c-=b;
    double ret=fabs(arg(c)-arg(a));
    if(ret>=asin(1)*2){ret=asin(1)*4-ret;}
    return ret;
}

double dist(P a,P b){
    return abs(a-b);
}


int main(){
    ll n;
    double r,s;
    cin>>n>>r>>s;
    s*=asin(1)/90;
    ll mx=10003;
    vector<vector<vector<double>>> dp(mx,vector<vector<double>>(n,vector<double>(n,E)));
    vector<P> a(n);
    for(auto &i:a){
        double x,y;
        cin>>x>>y;
        i={x,y};
    }
    ll ans=0;
    vector<vector<vector<double>>> edge(n,vector<vector<double>>(n,vector<double>(n,E)));
    for(int i=0;i<n;i++){
        for(int t=0;t<n;t++){
            for(int h=0;h<n;h++){
                if(i==h || t==h || i==t || dif(a[i],a[t],a[h])>s){continue;}
                edge[i][t][h]=dist(a[t],a[i]);
            }
        }
    }
    for(int i=1;i<n;i++){
        dp[1][i][0]=dist(a[i],a[0]);
        if(dp[1][i][0]<=r){ans=1;}
    }
    for(int i=1;ans==i;i++){
        for(int t=0;t<n;t++){
            for(int h=0;h<n;h++){
                if(t==h || dp[i][t][h]>r){continue;}
                //cout<<i<<" "<<t<<" "<<h<<" "<<dp[i][t][h]<<endl;
                for(int k=0;k<n;k++){
                    //if(k==h || k==t || dif(a[k],a[t],a[h])>s){continue;}
                    dp[i+1][k][t]=min(dp[i+1][k][t],dp[i][t][h]+edge[k][t][h]);
                    if(dp[i+1][k][t]<=r){ans=i+1;}
                }
            }
        }
    }
    cout<<ans<<endl;
    
    
    
    return 0;
}



Measured memory_bytes: 42476
n,k = map(int,input().split())
l = []
a = list(map(int,input().split()))
for i in range(len(a)):
  c = 0
  for j in range(len(a)-i):
    c += a[i+j]
    l.append(c)
m = len(bin(sum(a)))-2
x = 0
for i in range(m-1,-1,-1):
  c = 0
  cu = 2**i
  for j in l:
    if x+cu & j == x+cu:
      c += 1
    if c == k:
      x += cu
      break
print(x)

Measured memory_bytes: 66044
#include<cstdio>
#include<stack>
int main() {
	std::stack<int> s;
	int a, b;
	char c[8];
	scanf("%d%d", &a, &b);
	s.push(a);
	s.push(b);
	while (scanf("%s", c)!=EOF) {
		if (c[0] < '0' || '9' < c[0]) {
			a = s.top();
			s.pop();
			b = s.top();
			s.pop();
			if (c[0] == '+') {
				s.push(a + b);
			}
			else if (c[0] == '-') {
				s.push(b - a);
			}
			else if (c[0] == '*') {
				s.push(a * b);
			}
		}
		else {
			a = 0;
			b = 0;
			while (c[b] != '\0') {
				a = a * 10 + (c[b] - '0');
				b++;
			}
			s.push(a);
		}
	}
	printf("%d\n", s.top());
	return 0;
}


Measured memory_bytes: 2760
#import pysnooper
#import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy
setrecursionlimit(10**6)
input=stdin.readline

s=input().rstrip()
t=input().rstrip()
ans=set()
for i in range(len(s)):
    try:
        n=s[i:].index(t)+i
        ans.add(n)
    except:
        continue
for i in sorted(ans):
    print(i)


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

int main() {
  int n;
  long long k;
  std::cin >> n >> k;

  std::vector<std::pair<int, long long>> ops;
  ops.reserve(n);

  for (int i=0; i<n; i++) {
    int a;
    long long b;
    std::cin >> a >> b;
    ops.emplace_back(a, b);
  }

  std::sort(ops.begin(), ops.end());

  for (auto p : ops) {
    if (k <= p.second) {
      std::cout << p.first << std::endl;
      break;
    }
    k -= p.second;
  }

  return 0;
}


Measured memory_bytes: 1792
#include <iostream>

int main()
{
  int x, a;
  using namespace std;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> x;
  char *result = (char *)"Good";
  if ((x / 1000) == (x % 1000 / 100) || (x % 1000 / 100) == (x % 100 / 10) || (x % 100 / 10) == (x % 10))
    result = (char *)"Bad";

  cout << result << endl;

  return 0;
}


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


double sisyagonyu(double num, int keta){

    if(keta < 1)return num;
    
    int i  = num * pow(10, keta);
    int sg = num * pow(10, keta + 1) - i * 10;
    
    
    if(sg >= 5)i++;
    else if(sg <= -5)i--;

    return i / pow(10.0, keta);
};

int main(){

    double a,b,c,d,e,f;
    double x,y;
    
    while(cin >> a >> b >> c >> d >> e >> f){
        
        x = (c * e - b * f) / (a * e - b * d);
        y = (a * f - c * d) / (a * e - b * d);

        cout << setiosflags(ios::fixed) << setprecision(3);
        cout << sisyagonyu(x, 3) << ' ' << sisyagonyu(y, 3)  << endl;
     }
         
	return 0;
}

Measured memory_bytes: 1328