akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

string s, t;
int nex[100010][26];
int appear[26];

void solve() {
  cin >> s >> t;
  REP(i, 26) appear[i] = -1;
  string ss = s + s;
  for(int i = SZ(ss)-1; i >= 0; i--) {
    if(i < SZ(s)) {
      REP(j, 26) nex[i][j] = appear[j];
    }
    appear[ss[i]-'a'] = i;
  }
  LL res = 0;
  int now = SZ(s)-1;
  REP(i, SZ(t)) {
    LL _next = nex[now][t[i]-'a'];
    if(_next == -1) {
      cout << -1 << endl;
      return;
    }
    res += _next - now;
    now = _next % SZ(s);
  }
  cout << res << endl;
}

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


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

using namespace std;

int main() {
    string s;
    cin >> s;
    set<string> st;
    for (int i = 0; i < s.length(); ++i) {
        for (int j = i; j < s.length(); ++j) {
            string t;
            t += s.substr(0, i) + s.substr(j);
            st.insert(t);
        }
    }

    if (st.find("keyence") != st.end()) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
        int func(int a, int b){
if(a>=b){
if(b==0)
return a;
else
return func(b,a%b);
}
if(a<b){
if(a==0)
return b;
else
return func(a,b%a);
}
}
int main(){
int a,b,c,d;
while(scanf("%d%d",&a,&b)!=EOF){
c=func(a,b);
d=b/c*a;
printf("%d %d\n",c,d);
}
return 0;
}

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

using namespace std;

long long a, b, c, d, ans;

long long f(long long n, long long x){
	return n / x;
}

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

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

int main(){
	cin >> a >> b >> c >> d;
	ans = (b-a+1)- f(b,c) + f(a-1,c) - f(b,d) + f(a-1,d) + f(b,lcm(c,d))- f(a-1,lcm(c,d));
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>

#define max 10000
#define nil -1

typedef struct Node{
  int p, l, r;
} node;

node t[max];

int n, d[max], h[max];

void dep(int u, int D){
  if(u==nil)return;
  d[u]=D;
  dep(t[u].l, D+1);
  dep(t[u].r, D+1);
}

int hei(int u){
  int h1=0, h2=0;
  if(t[u].l!=nil)h1=hei(t[u].l)+1;
  if(t[u].r!=nil)h2=hei(t[u].r)+1;

  if(h1<h2)h[u]=h2;
  else h[u]=h1;
  return h[u];
}

int sib(int u){
  if(t[u].p==nil)return nil;
  if(t[t[u].p].l!=u && t[t[u].p].l!=nil)return t[t[u].p].l;
  if(t[t[u].p].r!=u && t[t[u].p].r!=nil)return t[t[u].p].r;
  return nil;
}

void Pr(int u){
  int deg=0;
  printf("node %d: ", u);
  printf("parent = %d, ", t[u].p);
  printf("sibling = %d, ", sib(u));
  if(t[u].l!=nil)deg++;
  if(t[u].r!=nil)deg++;
  printf("degree = %d, ", deg);
  printf("depth = %d, ", d[u]);
  printf("height = %d, ", h[u]);
  if(t[u].p==nil){
    printf("root\n");
  }else if(t[u].l==nil && t[u].r==nil){
    printf("leaf\n");
  }else {
    printf("internal node\n");
  }
}

int main(){
  int v, l, r, root=0, i;
  scanf("%d", &n);
  for(i=0 ; i<n ; i++)t[i].p=nil;
  for(i=0 ; i<n ; i++){
    scanf("%d%d%d",&v, &l, &r);
    t[v].l=l;
    t[v].r=r;
    if(l!=nil)t[l].p=v;
    if(r!=nil)t[r].p=v;
  }
  for(i=0 ; i<n ; i++)if(t[i].p==nil)root=i;
  dep(root, 0);
  hei(root);
  for(i=0 ; i<n ; i++)Pr(i);
  return 0;
}


Measured memory_bytes: 2108
//
//  main.cpp
//  atCoder
//
//  Created by 佐々木勇星 on 2019/07/23.
//  Copyright © 2019 佐々木勇星. All rights reserved.
//

#include <iostream>
#include <regex>


int main(void) {
    
    using namespace std;
    
    int N;
    int value = 0;
    cin >> N;
    
    int A[N], B[N], C[N-1];
    
    for(int i=0; i<N; i++){
        cin >> A[i];
        //cout << "A[i] = " << A[i] << endl;

    }
    
    for(int i=0; i<N; i++){
        cin >> B[i];
        //cout << "B[i]=" << B[i] << endl;
    }
    
    for(int i=0; i<N-1; i++){
        cin >> C[i];
        //cout << "C[i]=" << C[i] << endl;
    }
    
    
    for(int i=0; i<N; i++){
        value = value + B[A[i]-1];
        if(i > 0 && A[i] - A[i-1] == 1) value = value + C[A[i-1]-1];
        
        //cout << i << " " << value << endl;
    }
    
    cout << value << endl;
    
    return 0;
}


Measured memory_bytes: 256
//MIPT Cryptozoology 17.2
#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
    string s = FILENAME;
    //assert(!s.empty());
    freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
#else
    //freopen(FILENAME ".in", "r", stdin);
    //freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
    cout.sync_with_stdio(0);
    cin.tie(0);
#endif
    precalc();
    cout.precision(10);
    cout << fixed;
    //cin >> t;
    int testNum = 1;
    while (t--) {
        //cout << "Case #" << testNum++ << ": ";
        //cerr << testNum << endl;
        solve(true);
        //cerr << testNum - 1 << endl;
    }
    cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
    cout.flush();
    auto end = clock();

    usleep(10000);
    print_stats(end - start);
    usleep(10000);
#endif

    return 0;
}

void precalc() {
}

template<typename T>
inline T nxt() {
    T cur;
    cin >> cur;
    return cur;
}

#define int li
//const int mod = 1000000007;

void solve(__attribute__((unused)) bool read) {
    int n;
    cin >> n;
    vector<int> now;
    int res = 0;
    while (n) {
        now.push_back(n % 10);
        res += n % 10;
        n /= 10;
    }
    reverse(all(now));
    int cur_res = 0;
    for (int pref = 0; pref < now.size(); ++pref) {
        for (int c = 0; c < now[pref]; ++c) {
            res = max(res, cur_res + c + ((int)now.size() - 1 - pref) * 9);
        }
        cur_res += now[pref];
    }

    cout << res << endl;

}

Measured memory_bytes: 256
n = int(input())
for _ in range(n):
    n = [int(i) for i in list(input())]
    min_n = sorted(n)
    max_n = sorted(n,reverse=True)
    min_ = int("".join([str(i) for i in min_n]))
    max_ = int("".join([str(i) for i in max_n]))
    dif = max_ - min_
    print(dif)


Measured memory_bytes: 5600
#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 P[100001];

int Find(int A) {
	if (P[A] < 0) return A;
	return P[A] = Find(P[A]);
}

const int cm = 1 << 17;
char cn[cm], *ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 21;
char dn[dm], *di = dn, dt;
inline void putint(ll X) {
	if (X == 0) {
		*di++ = '0';
		*di++ = '\n';
		return;
	}
	int keta = 0;
	char C[20];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--) *di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N, M;
	N = getint();
	M = getint();

	int A[100000], B[100000];
	rep(i, M) {
		A[i] = getint();
		B[i] = getint();
	}

	ll sum = (ll)N * (N - 1) / 2;
	ll kotae[100001];
	kotae[M] = sum;

	rep1(i, N) P[i] = -1;

	for (int i = M - 1; i > 0; i--) {
		int ap = Find(A[i]);
		int bp = Find(B[i]);
		if (ap != bp) {
			sum -= (ll)P[ap] * P[bp];
			if (P[ap] > P[bp]) swap(ap, bp);
			P[ap] += P[bp];
			P[bp] = ap;
		}
		kotae[i] = sum;
	}

	rep1(i, M) putint(kotae[i]);
	fwrite_unlocked(dn, di - dn, 1, stdout);

	Would you please return 0;
}

Measured memory_bytes: 4480
// 直線の直行・平行判定
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<stack>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<vector>

#include<queue>

using namespace std;

// 浮動小数点のゼロ判定に使用する値
#define EPS (1e-10)
#define equals(a, b) ( fabs((a) - (b)) < EPS )

// 点を表すクラス
class Point
{
    public:
        double x, y;
        // コンストラクタ
        Point(double x = 0.0, double y = 0.0) : x(x), y(y){ }

        // -----▼▼▼ 演算子のオーバーロード ▼▼▼-----

        Point operator + (Point &p)
        {
            return Point(x + p.x, y + p.y);
        }

        Point operator - (Point &p)
        {
            return Point(x - p.x, y - p.y);
        }

        Point operator * (double a)
        {
            return Point(a * x, a * y);
        }

        bool operator == ( const Point &p) const
        {
            return fabs(x - p.x) < EPS && fabs(y -p.y) < EPS;
        }

        // -----▲▲▲ 演算子のオーバーロード ▲▲▲-----
};

// 線分を表すクラス
class Segment
{
    public:
        Point p1, p2;
        // コンストラクタ
        Segment(Point p1, Point p2) : p1(p1), p2(p2){ }
};

// 点とベクトルの表現は同じ
typedef Point Vector;
// 線分と直線の表現は同じ
typedef Segment Line;

double dot(Vector a, Vector b);
double cross(Vector a, Vector b);

int main(void)
{
    int q, x1, y1, x2, y2;
    Vector v1, v2;

    cin >> q;

    for(int i = 0; i < q; i++)
    {

        // ベクトル要素の格納
        cin >> x1 >> y1 >> x2 >> y2;
        v1.x = x2 - x1;
        v1.y = y2 - y1;
        // ベクトル要素の格納
        cin >> x1 >> y1 >> x2 >> y2;
        v2.x = x2 - x1;
        v2.y = y2 - y1;

        // 判定処理
        if( equals( dot(v1, v2), 0.0 ) )
        {
            // 内積がゼロなら, ベクトルは互いに直交している
            printf("1\n");
        }
        else if( equals( cross(v1, v2), 0.0 ) )
        {
            // 外積がゼロなら, ベクトルは平行である
            printf("2\n");
        }
        else
        {
            printf("0\n");
        }
    }

    return 0;
}

// 内積の計算をする関数
double dot(Vector a, Vector b)
{
    return ( ( a.x * b.x ) + ( a.y * b.y ) );
}

// 外積の計算をする関数
double cross(Vector a, Vector b)
{
    return ( ( a.x * b.y ) - ( a.y * b.x ) );
}



Measured memory_bytes: 3104
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a, b, c;
    
    scanf("%d %d %d", &a, &b, &c);
    
    if(a<b && b<c){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    
    return 0;
}


Measured memory_bytes: 2036
import java.util.Scanner;

public class Main {

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

      String a = in.next();
      String b = in.next();

      int ans = a.compareTo(b);

      if(ans < 0) {
          System.out.println("<");
      }
      else if(ans == 0) {
          System.out.println("=");
      }
      else {
          System.out.println(">");
      }



    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


#define MAX_N 200005


ll factorial[MAX_N];
void make_factorial_tableMOD(){
    factorial[0] = 1;
    for(int i = 1; i < MAX_N; i++){
        factorial[i] = factorial[i-1]*i%MOD;
    }
}

ll bisection_powerMOD(ll x,ll y){
    if(y==0)        { return 1; }
    ll t = bisection_powerMOD(x*x%MOD,y/2);
    if(y%2==1)      { t = t*x%MOD; }
    return t;
}

ll nCrMOD(int n, int r){
    if(n<r || n<=0 || r<0){return 0;}
    ll a = factorial[n];
    ll b = a*bisection_powerMOD(factorial[r],(MOD-2))%MOD;
    ll c = b*bisection_powerMOD(factorial[n-r],MOD-2)%MOD;
    return c % MOD;
}

int main(){
    ll n, k;
    cin >> n >> k;

    make_factorial_tableMOD();
    ll ans = 0;
    if(k > n){k = n;}
    for(int i = 0; i <= k; i++){
        ll t = 1;
        t *= nCrMOD(n,i);
        t %= MOD;
        t *= nCrMOD(n-1,i);
        t %= MOD;
        ans += t;
        ans %= MOD;

    }

    cout << ans << endl;


    return 0;

}


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

int main(){
	ll n;
	cin>>n;
	vector<ll> v(n);
	vector<int> a((1e6+5),0);
	for(int i=0;i<n;i++){
		cin>>v[i];
		if(a[v[i]]==0){
			for(ll j=v[i];j<a.size();j+=v[i])a[j]++;
		}
		else{
			a[v[i]]++;
		}
	}
	ll ans=0;
	for(int i=0;i<v.size();i++){
		if(a[v[i]]==1)ans++;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 8740
import numpy as np
from itertools import product
INF = 10**9

N, M, X = map(int, input().split())
C = [None]*N
A = [None]*N
for i in range(N):
    line = list(map(int, input().split()))
    C[i] = line[0]
    A[i] = np.array(line[1:])

choose = [True, False]

min_price = INF

for s in product([True, False], repeat=N):
    price = 0
    knowledge = np.zeros(M)
    for i in range(N):
        if s[i]:
            knowledge += A[i]
            price += C[i]
    if np.any(knowledge < X):
        continue
    if min_price == -1:
        min_price = price
    min_price = min(min_price, price)

if min_price == INF:
    print(-1)
else:
    print(min_price)


Measured memory_bytes: 27240
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	m := iScan()
	p := iScan()
	q := iScan()
	x := iSScan(n)
	y := iSScan(m)
	if p < q {
		if max(x) < q && min(y) > p && max(x) < min(y) {
			fmt.Println("No War")
		} else {
			fmt.Println("War")
		}
	} else {
		fmt.Println("War")
	}
}


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

int main() {
  char c;
  cin >> c;
  
  if(c=='a' || c=='i' || c=='u' || c=='e' || c=='o'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

int main() {
	int i, n, m, t;
	scanf("%d%d", &n, &m);
	vi o, e, A, B;
	for(i=0; i<m; i++) {
		scanf("%d", &t);
		if(t%2) o.pb(t);
		else e.pb(t);
	}
	if(sz(o)>2) {
		printf("Impossible\n");
		return 0;
	}

	if(sz(o)==0) {
		B.pb(1);
		for(i=0; i<m-1; i++) B.pb(e[i]);
		B.pb(e[m-1]-1);
		A=e;
	}
	else if(sz(o)==1) {
		B.pb(1);
		for(i=0; i<m-1; i++) B.pb(e[i]);
		if(o[0]>1) B.pb(o[0]-1);
		A=e;
		A.pb(o[0]);
	}
	else {
		B.pb(o[0]+1);
		for(i=0; i<m-2; i++) B.pb(e[i]);
		if(o[1]>1) B.pb(o[1]-1);
		A.pb(o[0]);
		for(int t:e) A.pb(t);
		A.pb(o[1]);
	}

	for(i=0; i<m; i++) printf(i==m-1? "%d\n":"%d ", A[i]);
	printf("%d\n", sz(B));
	for(i=0; i<sz(B); i++) printf(i==sz(B)-1? "%d\n":"%d ", B[i]);
   	return 0;
}

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define all(x) (x).begin(),(x).end()
#define S(x) (int)(x).size()
#define L(x) (int)(x).length()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int , null_type , less<int> , rb_tree_tag , tree_order_statistics_node_update> ordered_set;

const int mod = 1e9+7;
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;

void solve()
{
	ll a,b,v,w,t;
	cin>>a>>v>>b>>w>>t;
	if(a<b)
	{
		if(a+v*t>=b+w*t)
		cout<<"YES";
		else cout<<"NO";
	}
	else
	{
		if(a-v*t<=b-w*t)
		cout<<"YES";
		else cout<<"NO";
	}
}

int main()
{
	IOS
	int t=1;
	//cin>>t;
	while(t--)
	{
		solve();
	}
}


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

ts,xs,ys = 0,0,0

for i in range(N):
    t,x,y = map(int,input().split())
    if abs(x-xs) + abs(y-ys) > t-ts:
        print("No")
        break
    else:
        if (x-xs + y-ys - t-ts) % 2 != 0:
            print("No")
            break
        else:
            ts,xs,ys = t,x,y
    
if ts == t:
    print("Yes")

Measured memory_bytes: 3188
#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
ll MOD=998244353;
#define INF 1e9+7
#define N 310000
#define MAX_V 400010
#define vec vector<int>
#define ALL(c) (c).begin(),(c).end()

int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
using namespace std;
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umap unordered_map<ll,int,custom_hash>
struct pair_hash
{
    template<class T1,class T2>
    size_t operator() (const pair<T1,T2> &p)const{
        return hash<T1>()(p.first)^hash<T2>()(p.second);
    }
};

main(){
    int n,k;
    cin>>n>>k;
    vec a;
    rep(i,n){
        int x;
        scanf("%d",&x);
        if(x<k) a.pb(x);
    }
    sort(ALL(a),greater<int>());
    int dp[6000]={};
    dp[0]=1;
    int sum[6000]={};
    rep3(i,a.size()-1,0){
        sum[i]=sum[i+1]+a[i];
    }
    rep(i,a.size()){
        bool flag=false;
        if(sum[i]>=k) flag=true;
        for(int j=k-1;j>=0&&k-j<=sum[i];j--){
            if(dp[j])flag=true;

        }
        for(int j=k-1;j-a[i]>=0;j--){
            if(dp[j-a[i]])dp[j]=1;
        }
        if(!flag){
            cout<<a.size()-i;
            return 0;
        }
    }
    cout<<0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    try{
      String sen = sc.nextLine();
      for(int i=0;i<sen.length();i++){
        if(Character.isUpperCase(sen.charAt(i))){
          System.out.print(Character.toLowerCase(sen.charAt(i)));
        }else{
          System.out.print(Character.toUpperCase(sen.charAt(i)));
        }
      }
      System.out.println();
    }catch(Exception e){
    }
    sc.close();
  }
}


Measured memory_bytes: 27000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define debug(...) cerr<<__LINE__<<" ["<<#__VA_ARGS__<<"]:",debug_out(__VA_ARGS__)
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec)
    { for (auto v : vec) os << v << ' '; os << '\n'; return os; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa)
    { os << '(' << pa.first << ',' << pa.second << ')'; return os; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T)
    { cerr << " " << H; debug_out(T...); }
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    rep(i, (int) s.size()) {
        s[i] = (s[i] - 'A' + n) % 26 + 'A';
    }
    cout << s << endl;
}

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


Measured memory_bytes: 3640
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 1000000000;
const long long int llINF = 1000000000000000000;

using namespace std;
using ll = long long int;
using vv = vector<vector<ll>>;
using edge = struct {
  int to;
  int cost;
};
#define REP(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end());
#define MIN(vec) *std::min_element(vec.begin(), vec.end());
#define BIT(n, num) std::bitset<(n)>((num)).to_string()
#define REV(T) greater<T>()

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n)
        ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

map<ll, int> prime_factor(ll n) {
  map<ll, int> ret;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if (n != 1)
    ret[n] = 1;
  return ret;
}

ll factorial(int n) {
  ll ans = 1;
  for (int i = 2; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll P(int n, int m) {
  ll ans = 1;
  for (int i = m + 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  return ans;
}
ll power(int n, int m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = power(n, m / 2);
    return (tmp * tmp) % MOD;
  } else {
    return (n * power(n, m - 1)) % MOD;
  }
}
ll C(int n, int m) {
  return (P(n, n - m) * power(factorial(m), MOD - 2)) % MOD;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

typedef pair<ll, ll> Pair;
bool pairCompare(const Pair &firstElof, const Pair &secondElof) {
  return firstElof.second > secondElof.second;
}
bool pairCompare2(const Pair &firstElof, const Pair &secondElof) {
  return firstElof.second < secondElof.second;
}
auto c = [](Pair l, Pair r) { return l.second < r.second; };
auto c2 = [](Pair l, Pair r) { return l.second > r.second; };

int main() {
  ll N, K;
  priority_queue<Pair, vector<Pair>, decltype(c)> S(c);
  priority_queue<Pair, vector<Pair>, decltype(c2)> Change(c2);
  cin >> N >> K;
  REP(i, N) {
    ll t, d;
    cin >> t >> d;
    S.push(Pair(t, d));
  }
  set<ll> type;
  ll kouho = 0;
  ll ans = 0;

  REP(i, K) {
    Pair s = S.top();
    if (type.find(s.first) != type.end()) {
      Change.push(s);
    }
    kouho += s.second;
    type.insert(s.first);
    S.pop();
  }
  kouho += pow(type.size(), 2);
  ans = kouho;

  while (!S.empty()) {
    auto r = S.top();
    if (type.find(r.first) == type.end() && Change.size() > 0) {
      Pair c = Change.top();
      kouho +=
          pow(type.size() + 1, 2) - pow(type.size(), 2) + r.second - c.second;
      type.insert(r.first);
      Change.pop();
      if (ans < kouho)
        ans = kouho;
    }
    S.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5744
#include <bits/stdc++.h>
using namespace std;
#define ll	    long long
#define vi      vector <ll>
#define vii     vector <pair<int,int>>
#define ii      pair<int,int>
#define loop(n)	for(ll i=0;i<n;i++)
#define pb      push_back
const ll mod=1e9+7;
void fast();
int main()
{
    fast();
    int x;
    cin>>x;
    cout<<(x+1)/2;
}
void fast(){
std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
/*

*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2l(i, s, n) for (ll i = (ll)(s); i < (ll)n; i++)

int main() {
    int N;
    string S;
    cin >> N >> S;   
    vector<vector<int>> ruiseki(2, vector<int>(N+1, 0)); //0行;累積E　1行;累積W
    rep2(i, 1, N+1) {
        char s = S[i-1];
        if (s == 'E') {
            ruiseki[0][i] = ruiseki[0][i-1] + 1;
            ruiseki[1][i] = ruiseki[1][i-1];
        }
        else {
            ruiseki[0][i] = ruiseki[0][i-1];
            ruiseki[1][i] = ruiseki[1][i-1] + 1;
        }
    }
    priority_queue<int, vector<int>, greater<int>> ans;
    rep2(i, 1, N+1) {
        if (i == 1) {
            ans.push(ruiseki[0][N] - ruiseki[0][1]);
            continue;
        }
        if (i == N) {
            ans.push(ruiseki[1][N-1]);
            continue;
        }
        ans.push(ruiseki[0][N]-ruiseki[0][i] + ruiseki[1][i-1]);
    }
    cout << ans.top() << endl;
}

Measured memory_bytes: 6136
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;


int main(){
    int x ;
    cin >> x ;
    int ans = 1 ;
    int angle = x ;
    while (angle != 0)
    {
        ans ++ ;
        angle += x ;
        angle %= 360 ;
    }
    cout << ans << endl ;
}

Measured memory_bytes: 3628
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
const int maxn=2e5+5;
ll a[maxn];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%lld",&a[i]);
    ll ans=0;
    for(int i=1;i<=n;i++)
    {
        if(a[i]>=a[i-1]) continue;
        else
        {
            ans+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3244
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;


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

Measured memory_bytes: 256
P=10**9+7
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)
def inv(x):
    return egcd(x,P)[0]
H,W,A,B=map(int,input().split())
N=H+W
fact=[0 for i in range(N+1)]
finv=[0 for i in range(N+1)]
fact[0]=1
finv[0]=1
for i in range(1,N+1):
    fact[i]=(fact[i-1]*i)%P
    finv[i]=(inv(fact[i]))%P
def C(a,b):
    return (fact[a+b]*(finv[a]*finv[b])%P)%P
D=0
for i in range(B,W):
    K=(C(H-A-1,i)*C(A-1,W-1-i))%P
    D=(D+K)%P
print(D)
'''
HWAB
6734
4   C(2,4)*C(2,2)   15*6=90
5   C(2,5)*C(2,1)   21*3=63
6   C(2,6)*C(2,0)   28*1=28

'''

Measured memory_bytes: 55372
n = gets.to_i
w = gets.split.map{|e| e.to_i}

l = 0
r = w.inject{|r,v| r + v}
ans = r

(n-1).times do |i|
    l += w[i]
    r -= w[i]
    x = (l - r).abs
    ans = x if ans > x
end

puts ans

Measured memory_bytes: 1788
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N=200200,M=1<<19,P=924844033;
int i,j,k,n,m,ch,ff,En,x,y;
int a[N],sz[N],h[N],Jc[N],Jc_[N];
int A[M],B[M],rev[M],W[2][M];
struct edge { int s,n;} E[N<<1];
void R(int &x) {
	ff=x=0;ch=getchar();
	while (ch<'0' || '9'<ch) { if (ch=='-') ff=1;ch=getchar();}
	while ('0'<=ch && ch<='9') x=x*10+ch-'0',ch=getchar();
	if (ff) x=-x;
}
int ksm(int x,int y) {
	int z=1;
	for (;y;y>>=1,x=(ll) x*x%P) if (y&1) z=(ll) z*x%P;
	return z;
}
void pre(int n) {
	int i;
	Jc[0]=Jc_[0]=1; 
	for (i=1;i<=n;i++) Jc[i]=(ll) Jc[i-1]*i%P;
	Jc_[n]=ksm(Jc[n],P-2);
	for (i=n-1;i;i--) Jc_[i]=(ll) Jc_[i+1]*(i+1)%P;
}
void Pre(int n,int m) {
	int i,j,k;
	for (i=0;i<n;i++) {
		k=i;
		for (j=0;j<m;j++) rev[i]=(rev[i]<<1)|(k&1),k>>=1;
	}
	int w=ksm(5,(P-1)/n);
	W[0][0]=W[1][0]=1;
	for (i=1;i<n;i++) W[0][i]=(ll) w*W[0][i-1]%P;
	for (i=1;i<n;i++) W[1][i]=W[0][n-i];
}
void E_add(int x,int y) {
	E[++En].s=y;E[En].n=h[x];h[x]=En;
	E[++En].s=x;E[En].n=h[y];h[y]=En;
}
void dfs(int x,int F) {
	sz[x]=1;
	for (int k=h[x];k;k=E[k].n) if (E[k].s!=F) {
		dfs(E[k].s,x);
		sz[x]+=sz[E[k].s];
		a[sz[E[k].s]]++;
	}
	if (sz[x]!=n) a[n-sz[x]]++;
}
void NTT(int *A,int n,int m,int fg) {
	int i,j,k,l,t,u;
	for (i=0;i<n;i++) if (i<rev[i]) swap(A[i],A[rev[i]]);
	for (i=1;i<n;i<<=1)
		for (j=0;j<n;j+=i<<1)
			for (k=0,l=0;k<i;k++,l+=n/(i<<1)) {
				t=(ll) W[fg][l]*A[i+j+k]%P;
				u=A[j+k];
				A[j+k]=(u+t)%P;
				A[i+j+k]=(u+P-t)%P;
			}
	int n_=ksm(n,P-2);
	if (fg) for (i=0;i<n;i++) A[i]=(ll) n_*A[i]%P;
}
int main() {
	R(n);
	pre(n);
	for (i=1;i<n;i++) {
		R(x);R(y);
		E_add(x,y);
	}
	dfs(1,0);
	n++;
	for (i=1;i<n;i++) A[i]=(ll) Jc[i]*a[i]%P;
	for (i=0;i+i+1<n;i++) swap(A[i],A[n-1-i]);
	for (i=0;i<n;i++) B[i]=Jc_[i];
	m=0;
	while ((1<<m)<n) m++;
	m++;
	Pre(1<<m,m);
	NTT(A,1<<m,m,0);
	NTT(B,1<<m,m,0);
	for (i=0;i<(1<<m);i++) A[i]=(ll) A[i]*B[i]%P; 
	NTT(A,1<<m,m,1);
	for (i=0;i+i+1<n;i++) swap(A[i],A[n-1-i]);
	for (i=1;i<n;i++) {
		int t=(ll) Jc_[i]*A[i]%P;
		t=((ll) Jc[n-1]*Jc_[i]%P*Jc_[n-1-i]%P*(n-1)+P-t)%P;
		printf("%d\n",t);
	}
}

Measured memory_bytes: 27264
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n,A[510],B[510];
char ch[510][510];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%s",ch[i]+1);
	int tot=0;
	for (int i=1;i<=n;i++)
		for (int j=1;j<=n;j++) if (ch[i][j]=='#') tot++,A[j]++,B[i]++;
	if (tot==0){
		printf("-1\n"); return 0;
	}
	int ans=1e9,totw=0;
	for (int i=1;i<=n;i++) if (A[i]==n) totw++;
	for (int i=1;i<=n;i++){
		int num=(n-totw)+(A[i]==0)+(n-B[i]);
		ans=min(ans,num);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<math.h>
#define int long long
 
int min(int a,int b)
{
	if(a<b)
		return a;
	return b;
}
int main()
{ // dp array mein store kar ki n tak pahuchne mein ek pt se kitte paise lagenge
	int n;
	scanf("%lld",&n);
 
	int l=n+1;
	int h[l];
	int dp[l];
 
	for(int i=1;i<=n;i++)
	{scanf("%lld",&h[i]);}
	dp[1]=0;
	dp[2]=fabs(h[2]-h[1]);
	for(int i=3;i<=n;i++)
	{
		dp[i]=min((fabs(h[i]-h[i-1])+dp[i-1]),(fabs(h[i]-h[i-2])+dp[i-2]));
	}
	printf("%lld",dp[n]);
	return 0;
}
 
 
		

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

inline short int dist(short int a, short int b) {
    return a > b ? a - b : b - a;
}

int main() {
    short int a, b, c, d;
    cin >> a >> b >> c >> d;

    if (dist(a, b) <= d && dist(b, c) <= d) cout << "Yes\n";
    else if (dist(a, c) <= d) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}

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

using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, n) for (int i = 1; i < (int)(n+1); i++)
#define rep4(i, s, n) for (int i = (s); i < (int)(n+1); i++)
#define repr(i,n) for (int i = (n-1); i>=0;i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;



int main() {
const ll INF = 1001001001;
const ld PI = 3.14159265358979323846;
int N,count1=0,count2=0;
cin>>N;
rep3(i,N){
    if(i%2==1){
        count1=0;
        rep3(j,i){
            if(i%j==0)count1++;
        }
        if(count1==8)count2++;
    }

}
cout<<count2<<endl;
return 0;
}



Measured memory_bytes: 256
/*
ID: Barry Wang
LANG: C++11
TASK: 
*/
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define revsort(b,e) sort(b,e),reverse(b,e)
#define X first
#define Y second
#define Chtolly return 0
/*---define types---*/
typedef long long ll;
typedef list<int> li;
typedef queue<int> qi;
typedef deque<int> dqi;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef unsigned int uint;
/*---define variables---*/
const int inf=(1<<29);
int n;
int h[1000005],a[1000005];
ll dp[200005],bit[200005]; 
/*---define function---*/

inline void upd(int x,ll v){
	for(int i=x+1;i<=200005;i+=(i&-i)){
		bit[i]=max(bit[i],v);
	}
}

inline ll ask(int x){
	ll res=0;
	for(int i=x;i;i-=(i&-i)){
		res=max(res,bit[i]);
	}
	return res;
}

/*---main code---*/
int main(){
	for(int i=0;i<=200005;++i){
		dp[i]=-2e15;
		bit[i]=-2e15;
	}
	cin>>n;
	for(int i=0;i<n;++i){
		cin>>h[i];
	}
	for(int i=0;i<n;++i){
		cin>>a[i];
	}
	dp[0]=0;
	upd(0,0);
	for(int i=0;i<n;++i){
		dp[h[i]]=max(dp[h[i]],ask(h[i])+a[i]);
		upd(h[i],dp[h[i]]);
	}
	cout<<ask(n+1)<<'\n';
	return 0;
}


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

int main(){
  int n;cin>>n;
  int ac=0;
  int wa=0;
  int tle=0;
  int re=0;
  for(int i=0;i<n;i++){
    string s;cin>>s;
    if(s=="AC")ac++;
    if(s=="WA")wa++;
    if(s=="TLE")tle++;
    if(s=="RE")re++;
  }
  cout<<"AC x "<<ac<<endl;
  cout<<"WA x "<<wa<<endl;
  cout<<"TLE x "<<tle<<endl;
  cout<<"RE x "<<re<<endl;
}


Measured memory_bytes: 3624
N, X = map(int, input().split())

ARR = list(map(int, input().split()))


def calculate(n, x, arr):
    result = 0
    for i in range(1, n):
        sSum = arr[i - 1] + arr[i]
        if sSum <= x:
            continue

        diff = sSum - x

        if diff <= arr[i]:
            arr[i] -= diff
            result += diff
        else:
            result += diff
            arr[i] = 0

    print(result)


calculate(N, X, ARR)

Measured memory_bytes: 19896
import numpy as np
h, w = map(int, input().split())
a = np.array([list(input()) for i in range(h)])

new_a= np.empty((0,len(a[0])), dtype='<U1')
for i in a:
    if "#" in i:
        new_a = np.append(new_a, [i], axis=0)
a = new_a.T
new_a= np.empty((0,len(a[0])), dtype='<U1')
for i in a:
    if "#" in i:
        new_a = np.append(new_a, [i], axis=0)
a = new_a.T
for i in a:
    print("".join(i))

Measured memory_bytes: 27276
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*
cout<<fixed<<setprecision(20);
cin.tie(0);
ios::sync_with_stdio(false);
*/
const llint mod=1000000007;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,j,n;cin>>n;
	int guki=-1;
	vector<llint>zx(n);
	vector<llint>zy(n);
	for(i=0;i<n;i++){
		cin>>zx[i]>>zy[i];
		int ik=abs(zx[i]+zy[i])%2;
		if(guki==-1){guki=ik;}
		if(guki!=ik){cout<<-1<<endl;return 0;}
	}
	if(guki==0){cout<<"33\n1 ";}
	else{cout<<"32\n";}
	for(j=31;j>=0;j--){cout<<(1LL<<j)<<" ";}
	cout<<endl;
	for(i=0;i<n;i++){
		if(guki==0){cout<<'L';zx[i]++;}
		//奇数
		llint x=zx[i],y=zy[i];
		for(j=31;j>=0;j--){
			if(x+y>0&&x-y>0){cout<<'R';x-=(1LL<<j);}
			else if(x+y>0&&x-y<0){cout<<'U';y-=(1LL<<j);}
			else if(x+y<0&&x-y>0){cout<<'D';y+=(1LL<<j);}
			else if(x+y<0&&x-y<0){cout<<'L';x+=(1LL<<j);}
			else{cout<<'X';}//ばぐ！
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    string s; cin >> s;
    int ans = 1;
    rep(i,2){
        if(s[i] == 'R' && s[i+1] == 'R') ans++;
    }
    if(s == "SSS") ans = 0;
    cout << ans << endl;
}



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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<bool> vb;

const int MAXN = 3001;

int matrix[MAXN][MAXN];
string s, t;
vc ans;

int accum(int x, int y){
	if(x<0 || y<0) return 1;
	
	if(matrix[x][y]) return matrix[x][y];
	
	if(s[x]==t[y]) return matrix[x][y] = 1+accum(x-1,y-1);
	
	return matrix[x][y] = max(accum(x-1,y), accum(x,y-1));
}

void substring(int x, int y){
	if(x<0 || y<0) return;
	
	if(s[x] == t[y]){
		ans.push_back(s[x]);
		substring(x-1,y-1);
		return;
	}
	
	if(accum(x-1,y) > accum(x,y-1))
		substring(x-1,y);
	else
		substring(x,y-1);
}

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

    cin >> s >> t;
    
    memset(matrix, 0, sizeof(matrix));
    
    substring(s.size()-1, t.size()-1);
    
    for(int i=ans.size()-1; i>=0; i--)
    	cout << ans[i];
    cout << '\n';

    return 0;
}



Measured memory_bytes: 35712
// https://atcoder.jp/contests/abc091/tasks/abc091_b
#include <bits/stdc++.h>
using namespace std;

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

int main() {
  int N, M;
  string S;
  cin >> N;

  map<string, int> mp;
  rep(i, N) {
    cin >> S;
    mp[S]++;
  }

  cin >> M;
  rep(i, M) {
    cin >> S;
    mp[S]--;
  }
  int ans = 0;
  for (auto i : mp) ans = max(ans, i.second);

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(){
    int q;
    std::cin >> q;
    long v[200000] = {0};
    int size = 0;
    for (int i = 0; i < q; i++){
        int com;
        std::cin >> com;
        // insert
        if (com == 0){
            long x;
            std::cin >> x;
            v[size++] = x;
        }
        if (com == 1){
            int y;
            std::cin >> y;
            std::cout << v[y] << std::endl;
        }
        if (com == 2){
            v[size--] = 0;
        }
    }
}


Measured memory_bytes: 4644
#include<iostream>
#define PI 3.141592653589
using namespace std;
 
int main(){
    int n;
    cin >>n;
    int a[100];
    for ( int i = 0; i < n; i++ ){
        cin>>a[i];
    }
 
     
    for ( int i = 0; i < n; i++ ){
        if (i!=0){cout << " ";}
        cout << a[n-i-1];
    }
    cout << endl;
     
    return 0;
}

Measured memory_bytes: 3068
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let mut v: Vec<u64> = (0..n)
        .map(|_| {
            let number: u64 = read();
            number
        })
        .collect();
    let mut count: u64 = 0;
    let mut m: usize = 0;
    let mut g: Vec<usize> = vec![];
    let mut g_number = n;
    while g_number >= 1 {
        g_number /= 2;
        g.push(g_number);
        m += 1;
    }
    println!("{}", m);
    for (index, number) in g.iter().enumerate() {
        if index != (m - 1) {
            print!("{} ", number);
        } else {
            println!("{}", number);
        }
    }
    for index in 0..m {
        let g = g[index];
        for index_i in g..n {
            let v_value: u64 = v[index_i];
            let mut j: i64 = (index_i - g) as i64;
            while j >= 0 && v[j as usize] > v_value {
                v[(j as usize) + g] = v[j as usize];
                j -= g as i64;
                count += 1;
            }
            v[(j + (g as i64)) as usize] = v_value;
        }
    }

    println!("{}", count);
    for number in v {
        println!("{}", number);
    }
}



Measured memory_bytes: 13224
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

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

	Int N;
	cin >> N;

	if (N == 1) {
		cout << "Hello World" << "\n";
	}
	else {
		Int a, b;
		cin >> a >> b;
			cout << a + b << "\n";
	}
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }

int main()
{
   int a, b, c;
   cin >> a >> b >> c;
   cout << max(a, (max(b, c))) * 9 + a + b + c << endl;
   return 0;
}



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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int N, M;
    cin>>N>>M;
    vector<int> H(N);
    vvi G(N);
    REP(i, 0, N) cin >> H[i];
    REP(i, 0, M){
        int A, B;
        cin >> A >> B;
        A--; B--;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    int count = 0;
    REP(i, 0, N){
        bool isGood = true;
        for(auto x: G[i]){
            if(H[x] < H[i]) continue;
            else isGood = false;
        }
        if(isGood){
            count++;
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 8728
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())





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

	int n;
	vector<tuple<int, int, int>> t;

	cin >> n;
	rep(i,n) {
		int a, b;
		cin >> a >> b;
		t.emplace_back(b, a, b);
	}
	sort(all(t));
	long long s = 0;

	bool ok = true;
	rep(i,n) {
		int c, a, b;
		tie(c, a, b) = t[i];
		s += a;
		if (s > b) {
			ok = false;
			break;
		}
	}


	cout << (ok ? "Yes" : "No") << endl;


	return 0;
}

Measured memory_bytes: 4980
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp33 {
    class Program {
        static void Main(string[] args) {
            string S = Console.ReadLine();

            int date_num = int.Parse(string.Concat(S[0], S[1], S[2], S[3], S[5], S[6], S[8], S[9]));

            if (date_num <= 20190430) {
                Console.WriteLine("Heisei");
            } else {
                Console.WriteLine("TBD");
            }
        }
    }
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> cnt(n), b(n);
    int res = 0;
    for(int i = 0; i < m; i++){
        int p;
        cin >> p, p--;
        string c;
        cin >> c;
        if(c == "AC"){
            if(b[p] == 0){
                b[p] = 1;
                res += cnt[p];
            }
        }
        if(c == "WA"){
            cnt[p]++;
        } 
    }
    cout << accumulate(begin(b), end(b), 0) << " " << res << endl;
    return 0;
}

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

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int main(void){
  int32 N;
  cin >> N;
  bool ok = 0;
  REP(i, N){
    char c;
    cin >> c;
    if(c == 'Y')
      ok = 1;
  }
  if(ok)
    cout << "Four" << endl;
   else
    cout << "Three" << endl;
}

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

int main() {
  int N;
  cin >> N;
  long long ans = 0;
  long long wer = 1;
  int count = 0;
  while(count < N - 1){
    long long tmp = wer;
    wer += ans;
    ans = tmp;
    count++;
  }
  cout << ans * 2 + wer << endl;
}


Measured memory_bytes: 256