akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Q_Flowers solver = new Q_Flowers();
        solver.solve(1, in, out);
        out.close();
    }

    static class Q_Flowers {
        private void setMax(long[] tree, int i, long value) {
            i += tree.length / 2;
            tree[i] = value;
            for (; i > 1; i >>= 1)
                tree[i >> 1] = Math.max(tree[i], tree[i ^ 1]);
        }

        private long getMax(long[] tree, int l, int r) {
            long res = Long.MIN_VALUE;
            for (l += tree.length / 2, r += tree.length / 2; l <= r; l = (l + 1) >> 1, r = (r - 1) >> 1) {
                res = Math.max(res, tree[l]);
                res = Math.max(res, tree[r]);
            }
            return res;
        }

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.ni();
            int[] h = in.na(n);
            int[] a = in.na(n);
            long[] tree = new long[2 * n + 2];
            for (int i = 0; i < n; i++) {
                long best = getMax(tree, 0, h[i] - 1);
                setMax(tree, h[i], a[i] + best);
            }
            out.println(getMax(tree, 0, n));
        }

    }

    static class FastScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public FastScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String ns() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(ns());
        }

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

    }
}



Measured memory_bytes: 67688
n=int(input())
a=list(map(int,input().split()))
y=0
z=1
ans=0
for i in range(n-2):
    y+=1
    z=i
    for x in range(y,n-1):
        z+=1
        for w in range(z,n):
            if a[i]!=a[x] and a[i]!=a[w] and a[w]!=a[x]:
                if a[i]+a[x]>a[w] and a[w]+a[x]>a[i] and a[i]+a[w]>a[x]:
                    ans+=1
                    
print(ans)


Measured memory_bytes: 9044
N = int(input())
xyss = []
for i in range(N):
    A = int(input())
    xys = []
    for j in range(A):
        x, y = map(int, input().split())
        xys.append((x-1, y))
    xyss.append(xys)

ans = 0
for S in range(2**N):
    numHonest = 0
    isOK = True
    for i in range(N):  # 人i
        if (S>>i)&1 == 0:
            continue

        numHonest += 1
        xys = xyss[i]
        A = len(xys)
        for x, y in xys:  # 証言j
            if (S>>x)&1 != y:
                isOK = False
                break
        if not isOK:
            break

    if isOK:
        ans = max(ans, numHonest)

print(ans)


Measured memory_bytes: 43376
#include <stdio.h>
int main(){

  int a, b, c, d, e, f, g, h, i, j;
  scanf("%d", &a);
  scanf("%d", &b);
  scanf("%d", &c);
  scanf("%d", &d);
  scanf("%d", &e);
  scanf("%d", &f);
  scanf("%d", &g);
  scanf("%d", &h);
  scanf("%d", &i);
  scanf("%d", &j);
 printf("%d\n", a+b+c+d+e+f+g+h+i+j);

 return 0;
}

Measured memory_bytes: 596
from string import ascii_lowercase
import sys


def input():
    return sys.stdin.readline().strip()


class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0] * (n + 1)
        self.k_init = 2 ** (self.n - 1).bit_length()

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.data[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.n:
            self.data[i] += x
            i += i & -i


n = int(input())
s = input()
q = int(input())

bits = {c: BIT(n) for c in ascii_lowercase}
[bits[c].add(i, 1) for i, c in enumerate(s, 1)]
queries = (input().split() for _ in range(q))

ans = []
for q_type, *q in queries:
    if q_type == '1':
        iq = int(q[0])
        cq = q[1]
        for c in ascii_lowercase:
            if bits[c].sum(iq) - bits[c].sum(iq - 1) == 1:
                bits[c].add(iq, -1)
                break
        bits[cq].add(iq, 1)
    else:
        l, r = map(int, q)
        cnt = 0
        for c in ascii_lowercase:
            if bits[c].sum(r) - bits[c].sum(l - 1) > 0:
                cnt += 1
        ans.append(cnt)
[print(i) for i in ans]

Measured memory_bytes: 176500
//agrawal117
//chahatagrawal117
#include<bits/stdc++.h>
#define endl '\n'
#define mod 1000000007
typedef long long int ll;
using namespace std;
#define MAX 100005
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n; cin>>n;
    ll arr[n+3];
    for(int i=1;i<=n;i++) cin>>arr[i];
    ll dp[n+2][2];
    dp[n+1][0]=dp[n+1][1]=0;
    dp[n][0]=0;
    dp[n][1]=0;
    dp[n-1][1]=arr[n-1];
    dp[n-1][0]=arr[n];
    for(int i=n-2;i>=1;i--)
    {
        int idx=n-i+1;
        if(idx%2==1){
            dp[i][1]=arr[i]+max(dp[i+2][0],dp[i+2][1]);
            dp[i][1]=max(dp[i][1],arr[i]+max(dp[i+3][0],dp[i+3][1]));
            dp[i][0]=max(dp[i+1][0],dp[i+1][1]);
        }
        else{
            dp[i][1]=arr[i]+max(dp[i+1][0],max(dp[i+2][0],dp[i+2][1]));
            dp[i][0]=arr[i+1]+dp[i+2][0];
        }
        // cout<<i<<" --> ";
        // cout<<dp[i][1]<<" "<<dp[i][0]<<endl;
    }
    cout<<max(dp[1][0],dp[1][1])<<endl;
}


Measured memory_bytes: 8240
#include  <bits/stdc++.h>
using namespace std;
static int fast_io = []() { std::ios::sync_with_stdio(false); cin.tie(nullptr); return 0; }();
int main(){
  string s;
  cin>>s;
  int acount=0,bcount=0;
  
  for(auto x:s){
    if(x=='A'){
      acount++;
    }
    else 
      bcount++;
  }
  if(acount>0&&bcount>0){
    cout<<"Yes"<<"\n";  
  }
  else{
    cout<<"No"<<"\n";  
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    int P, Q, R = 0;
    cin >> P;
    cin >> Q;
    cin >> R;

    int a, b, c;
    a = P + Q;
    b = Q + R;
    c = R + P;
    if (a <= b && a <= c) {
        cout << a << endl;
    }
    if (b < a && b <= c) {
        cout << b << endl;
    }
    if (c < a && c < b) {
        cout << c << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<ll,ll> pint;

ll dp[100003];
const int max_n=1000001;
bool is_prime[max_n];
int prime[max_n];
int sieve(int n){
    int p=0;
    rep(i,n+1) is_prime[i]=true;
    is_prime[0]=is_prime[1]=false;
    FOR(i,2,n+1){
        if(is_prime[i]){
            prime[p++]=i;
            for(int j=2*i;j<=n;j+=i) is_prime[j]=false;
        }
    }
    return p;
}
int q[100001];
const int mod=1000000007;
int main(){
    int n;
    cin>>n;
    sieve(1000000);
    dp[0]=1;
    rep(i,n) cin>>q[i];
    rep(i,n){
        if(i+2<=n&&is_prime[q[i]]&&(i+2==n||q[i+2]>q[i])){
            dp[i+2]+=dp[i];
            dp[i+2]%=mod;
        }
        if(is_prime[q[i]]&&(i+1==n||q[i+1]>q[i])){
            dp[i+1]+=dp[i];
            dp[i+1]%=mod;
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 5544
package main

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

func main() {
	s := IOInitialize()
	A := Int(s)
	B := Int(s)
	if (A*B)%2 == 0 {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
	}
}

func IOInitialize() *bufio.Scanner {
	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)
	return s
}

func Int(s *bufio.Scanner) int {
	if !s.Scan() {
		panic("scan error")
	}

	value, err := strconv.Atoi(s.Text())
	if err != nil {
		panic("text to int error")
	}
	return value
}

func String(s *bufio.Scanner) string {
	if !s.Scan() {
		panic("scan error")
	}

	return s.Text()
}

func scanNums(s *bufio.Scanner, len int) (nums []int) {
	for i := 0; i < len; i++ {
		num := Int(s)
		nums = append(nums, num)
	}
	return
}

func scanstrings(s *bufio.Scanner, len int) (strs []string) {
	for i := 0; i < len; i++ {
		str := String(s)
		strs = append(strs, str)
	}
	return
}


Measured memory_bytes: 640
import sys

def LI(): return([int(x) for x in sys.stdin.readline().split()])
def LI_(): return([int(x)-1 for x in sys.stdin.readline().split()])

def main():
    N,M = LI()
    keys = []
    for _ in range(M):
        a,b = LI()
        C = LI_()
        key_bit = 0
        for c in C:
            key_bit += (1 << c)
        keys.append([a,key_bit])

    dp = [[10**10] * (1 << N) for _ in range(M+1)]
    dp[0][0] = 0
    for i in range(0,M):
        for key_bit in range(1 << N):
            dp[i+1][key_bit] = min(dp[i][key_bit],dp[i+1][key_bit])
            dp[i+1][key_bit|keys[i][1]] = min(dp[i+1][key_bit|keys[i][1]],dp[i][key_bit]+keys[i][0])
    if(dp[M][(1<<N)-1] == 10**10):
        return(-1)
    return(dp[M][(1<<N)-1])


if __name__ == "__main__":
    print(main())


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

int main(){
    string S;
    cin >> S;
    bool b1,b2;
    b1 = true;
    b2 = true;
    rep(i,S.size()){
        if((i+1)%2==0){
            if(S[i]=='R') b1=false;
        }else{
            if(S[i]=='L') b2=false;
        }
    }
    bool b = b1 && b2;
    if(b) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>

namespace program
{
    int main();
    typedef long long llong;
    const double PI = acos(-1.0); // M_PI;
    const int INF = 0x3f3f3f3f;
    const llong INFLL = ((llong) INF << 32) + INF;

    #define REP(i, a, b) for (int i = a, T##i = b; i <  T##i; ++i)
    #define FOR(i, a, b) for (int i = a, T##i = b; i <= T##i; ++i)

    #define ALL(v) v.begin(), v.end()
    #define LLA(v) v.rbegin(), v.rend()
    #define SZ(v) ((int) v.size())
    #define MP(a, b) std::make_pair(a, b)
    #define PB push_back
    #define X first
    #define Y second

    #define MSET(a, x, n) memset(a, x, sizeof(a[0]) * n)
    #define BIT(s, i) (((s) >> (i)) & 1)
    #define ADD1(a) ((a) & 1)
    #define MUL2(a) ((a) << 1)
    #define DIV2(a) ((a) >> 1)
    #define MUL_POW2(a, p) ((a) << (p))
    #define DIV_POW2(a, p) ((a) >> (p))

    template<class T> T SQR(const T& x) { return x * x; }
    template<class T> T CUBE(const T& x) { return x * x * x; }
}

int main(int argc, char const *argv[])
{
#ifdef LOCAL
    freopen("data.in", "r", stdin);
    // freopen("data.out", "w", stdout);
#endif // LOCAL
    return program::main();
}

/**
 * Author  : plus7wist
 * Language: c++
 */

namespace program
{
    int main()
    {
        int n, a, b;
        scanf("%d %d %d", &n, &a, &b);
        int cnt = 0;
        FOR(i, 1, n) {
            int t;
            scanf("%d", &t);
            cnt += (t < a || t >= b);
        }
        printf("%d\n", cnt);
        return 0;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rg register
#define us unsigned
#define ll long long
#define ui <int>
#define pi <int, int>
#define tmpl template <typename typ>
#define oprt operator
#define sp putchar(32)
#define el putchar(10)
#define flin(x) freopen(x, "r", stdin)
#define flout(x) freopen(x, "w", stdout)
#define flio(x) flin(x".in"), flout(x".out")
#define ms(a, b) memset(a, b, sizeof(a))
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define itrt iterator
using namespace std;
tmpl inline bool up(typ &x, const typ &y) { return x < y ? x = y, 1 : 0; }
tmpl inline bool dn(typ &x, const typ &y) { return y < x ? x = y, 1 : 0; }
tmpl inline bool inrange(const typ &x, const typ &l, const typ &r) { return !(x < l) && !(r < x); }
namespace orh {
inline void useios() { ios_base::sync_with_stdio(false); cin.tie(0); }
inline char rc() { rg char ch; while (!isgraph(ch = getchar())); return ch; }
tmpl typ ri() {
	rg typ x = 0; rg bool neg = false; rg char ch;
	while (!inrange(ch = getchar(), '0', '9')) neg |= ch == '-';
	do x = (x << 1) + (x << 3) + (ch ^ 48); while (inrange(ch = getchar(), '0', '9'));
	return neg ? -x : x;
}
tmpl typ ru() {
	rg typ x = 0; rg char ch;
	while (!inrange(ch = getchar(), '0', '9'));
	do x = (x << 1) + (x << 3) + (ch ^ 48); while (inrange(ch = getchar(), '0', '9'));
	return x;
}
tmpl void wi(rg typ x) {
	if (x < 0) { putchar('-'); x = -x; }
	static int sta[42]; rg int top = 0; rg typ t;
	do t = x / 10, sta[top++] = x - (t << 1) - (t << 3), x = t; while (x);
	while (top) putchar(sta[--top] ^ 48);
}
tmpl void wu(rg typ x) {
	static int sta[42]; rg int top = 0; rg typ t;
	do t = x / 10, sta[top++] = x - (t << 1) - (t << 3), x = t; while (x);
	while (top) putchar(sta[--top] ^ 48);
}
}

const int maxn = 105;
int n, m, s;

signed main() {
	orh::useios();
	
	cin >> n >> m >> s;
	up(n, m);
	if (s % n == 0) cout << s / n << endl;
	else cout << s / n + 1 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;

int main(){

int a,b,c,d,e,vetor[5],j, menor=9,soma=0,k;
float vetor2[5];
for (int i=0; i<5;i++){
    cin >> vetor[i];

    if (vetor[i]%10<menor and vetor[i]%10!=0){j=i;menor=vetor[i]%10;}
}
k=vetor[j];
vetor[j]=0;
for(int i=0;i<5;i++){

    vetor2[i]=(float)vetor[i]/10;
    vetor2[i]=ceil(vetor2[i]);
    vetor2[i]=vetor2[i]*10;

}

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

    soma+=vetor2[i];
}

cout << soma + k<<endl;

return 0;
}



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

#define MAXN 100004

int dp[MAXN];
int arr[MAXN];

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#ifdef _DEBUG
  freopen("/Users/huogenx/Desktop/__RUN__/input.txt", "r", stdin);
#endif
  int N, K; cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
  }
  fill(dp, dp+MAXN, 1e9);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    for (int j = 1; j <= K; j++) {
      dp[i+j] = min(dp[i+j], dp[i]+abs(arr[i]-arr[i+j]));
    }
  }
  cout << dp[N-1] << "\n";
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,X;
int L[10101];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>X;
	
	int ret=1;
	int cur=0;
	FOR(i,N) {
		cin>>L[i];
		cur+=L[i];
		if(cur<=X) ret++;
	}
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define x first
#define y second

int main()
{
	ll n, s=0;
	cin >> n;
	for(int i=1; ;++i){
        s += i;
        if(s >= n){
            cout << i << endl;
            return 0;
        }
	}
    return 0;
}


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

int main() {
  string S;
  cin >> S;
  int price = 700;
  
  for(int i = 0; i < 3; i++) {
    if(S.at(i) == 'o') {
      price += 100;
    }
  }
  
  cout << price << endl;
}

Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, X = MAP()
m = [INT() for _ in range(N)]

print(N + (X-sum(m))//min(m))

Measured memory_bytes: 5204
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
h_list = list(map(int, input().split()))
ten_list = [1] * n
for i in range(0, m):
    a, b = map(int, input().split())
    if h_list[a - 1] <= h_list[b - 1]:
        ten_list[a - 1] = 0
    if h_list[a - 1] >= h_list[b - 1]:
        ten_list[b - 1] = 0
print(sum(ten_list))


Measured memory_bytes: 20088
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
#include<set>
#include<queue>
#include<cstdlib>
#include<algorithm>

using namespace std;
#define pb push_back
#define mp make_pair
#define ls(x) (x << 1)
#define rs(x) (x<<1|1)
#define SZ(x) (int)(x).size()

typedef long long LL;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<LL, LL> pll;

const double eps = 1e-10;
const double PI = acos(-1.0);
//const double PI = 3.14159265358979323846264338327950288419716939937510
int dcmp(const double &x) { if (fabs(x) < eps) return 0; return x < 0 ? -1 : 1; }
const int MOD = 1e9 + 7;
const int INF = 2e9;
const double INF_d = 1e64;

template<class T>
T qmod(T a, T b){ T ret = 1; while (b){ if (b & 1) ret *= a; b >>= 1; a *= a; } return ret; }
template<class T>
T gcd(T a, T b){ return !b ? a : gcd(b, a % b); }
template<class T>
T ex_gcd(T a, T b, T &x, T &y){
    if (!b){ x = 1, y = 0; return a; }
    T t, ret;
    ret = ex_gcd(b, a % b, x, y);
    t = x, x = y, y = t - a / b * y;
    return ret;
}
template<class T>
T inv(T t, T p){ return t == 1 ? 1 : (p - p / t) * inv(p % t, p) % p; }
// head

const int N = 1e5 + 7;
int n, q, a[N], cnt, vis[N];
LL res, k;

void solve(){
    res = 0;
    int l, r;
    LL sum;
    l = r = sum = 0;
    while (r < n){
        while (sum <= k && r < n){
            res += (LL)(r - l);
            sum += (LL)a[r++];
        }
        if (sum <= k) break;
        while (sum > k && l < r){
            sum -= (LL)a[l++];
        }
    }
    if (sum <= k) res += (LL)(r - l);
    printf("%lld\n", res);
}

int main(){
    scanf("%d%d", &n, &q);
    for (int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    for (int i = 0; i < q; i++){
        scanf("%lld", &k);
        solve();
    }
    return 0;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

int main(){
  int n,m;
  cin >> n >> m;
  int a,b;
  multiset<int> s;
  rep(i,m){
    cin >> a >> b;
    a--;b--;
    s.insert(a);
    s.insert(b);
  }
  rep(i,n) cout << s.count(i) << endl;
  return 0;

}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"a < b"<<endl;
     }
    else if(a>b){
        cout<<"a > b"<<endl;
    }
    else if(a==b){
        cout<<"a == b"<<endl;
    } 
    return 0; 
}


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




    int main(){
        string s;
        std::cin >> s;
        bool ok = true;
        rep(i, s.size()){
            if (i % 2 == 0 && s[i] == 'L')
            {
                ok = false;
            }
            if (i % 2 == 1 && s[i] == 'R')
            {
                ok = false;
            }
        }
        if(ok)
        {
            std::cout << "Yes" << "\n";
        }
        else{
            std::cout << "No" << "\n";
        }
        return 0;
    }


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	vector<int>m(3);
	m.at(0) = a * 10 + b + c;
	m.at(1) = a + b * 10 + c;
	m.at(2) = a + b + c * 10;
	cout<<max(m.at(0), max(m.at(1), m.at(2)));
}

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

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

  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());

  for (int j = 0; j < N; j++) {
    if (B == 0 || B > d[j]) {
      B = d[j];
      S++;
    }
  }

  cout << S << endl;
}

Measured memory_bytes: 256
ac={}
wa={}
ans1=0
ans2=0
N,M=input().split(" ")
for i in range(int(M)):
    num,sa=input().split(" ")
    if sa=='AC':
        if num in ac:
            continue
        else:
            ans1+=1
            ac[num]=1
            if num in wa:
                ans2+=wa[num]
    else:
        if num in wa:
            wa[num]+=1
        else:
            wa[num]=1
print(ans1,ans2)


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Two Colors Card Game
            var s = GetCards();
            var t = GetCards();

            int max = 0;

            foreach(var card in s.Keys)
            {
                int money = s[card];

                if (t.ContainsKey(card))
                {
                    money -= t[card];
                }

                max = Math.Max(max, money);
            }

            Console.WriteLine(max);
        }

        static Dictionary<string,int> GetCards()
        {
            int N = int.Parse(Console.ReadLine());
            var cards = new Dictionary<string, int>();

            for(int i = 0; i < N; i++)
            {
                var s = Console.ReadLine();

                if (cards.ContainsKey(s))
                {
                    cards[s]++;
                }
                else
                {
                    cards.Add(s, 1);
                }
            }

            return cards;
        }
    }
}

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

#define pb push_back
#define vi vector < int >
#define ii pair < int, int >
#define vii vector < pair < int, int > >
#define vvi vector < vector < int > >
#define ll long long
#define x first
#define y second
#define mp make_pair
#define FOR( i, lo, hi ) for( int i = (lo);i < (hi);i++ )
#define DFOR( i, hi, lo ) for( int i = (hi);i >= (lo);i-- )
#define pqueue priority_queue

using namespace std;

const long long int MOD = 1e9 + 7;

ll REM( ll a )
{
	a %= MOD;
	if ( a < 0 ) a += MOD;
	return a;
}

ll ADD( ll a, ll b )
{
	return REM( REM( a ) + REM( b ) );
}

ll SUB( ll a, ll b )
{
	return REM( REM( a ) - REM( b ) );
}

ll MUL( ll a, ll b )
{
	return REM( REM( a ) * REM( b ) );
}

ll POT( ll n, ll k )
{
	if ( k == 0 ) return 1;

	ll ret = POT( n, k / 2 );
	ret = MUL( ret, ret );

	if ( k % 2 ) return MUL( ret, n );
	return ret;
}

ll DIV( ll a, ll b )
{
   return MUL( a, POT( b, MOD - 2 ) );
}

bool isPrime( ll x )
{
   if ( x == 1 )
	   return 0;
	for ( ll i = 2;i <= sqrt( x ); i++ )
		if ( x % i == 0 )
		   return 0;
	return 1;
}

const int MAXN = 2e5 + 10;

int n;
vi p, q;

int main()
{
   ios_base::sync_with_stdio( false );
   cin.tie( 0 );
   
	cin >> n;
	vi v;
	FOR( i, 0, n )
	{
		int x;cin >> x;p.pb( x );
		v.pb( i + 1 );
	}
	FOR( i, 0, n )
	{
		int x;cin >> x;q.pb( x );
	}

	int a, b, i = 0;
	do
	{
		if ( v == p ) 
			a = i;
		if ( v == q )
			b = i;
		i++;
	} while ( next_permutation( v.begin(), v.end() ) ); 

	cout << abs( a - b ) << "\n";
   return 0;
}


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

using namespace std;

int n, t[100], m, p, x;
int sum = 0, ans[100];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
		sum += t[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> p >> x;
		ans[i] = sum - (t[p - 1] - x);
	}
	for (int i = 0; i < m; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

using P = pair<int, int>;
string s;
int cnt[26];
P f(char c) {
    auto ret = P(-1, -1);
    rep(i, s.size() - 1) {
        if (s[i] == c and s[i + 1] == c) {
            ret = P(i, i + 1);
        }
    }
    rep(i, s.size() - 2) {
        if (s[i] == c and s[i + 2] == c) {
            ret = P(i, i + 2);
        }
    }
    return ret;
}
int main() {
    cin >> s;
    rep(i, 26) {
        auto ans = f(i + 'a');
        if (ans.first != -1) {
            printf("%d %d\n", ans.first + 1, ans.second + 1);
            return 0;
        }
    }
    cout << "-1 -1" << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

class Main{
	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		long N = scanner.nextLong();
		long M = scanner.nextLong();

		long ans = 1;
		for(long i = 100000000;i >= 1;i--){
			if(M % i == 0 && (M / i) >= N ){
				ans = Math.max(ans, i);

			}

		}
		if(N == 1){
			System.out.println(M);

		}else{
			System.out.println(ans);
		}
	}




}

class Pair implements Comparable{
	int from;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}



Measured memory_bytes: 23892
use std::io;

fn gets() -> String {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok();
    buf
}

fn main() {
    let line = gets();
    let a = line.trim().parse::<i32>().unwrap();
    let line = gets();
    let b = line.trim().parse::<i32>().unwrap();
    let line = gets();
    let h = line.trim().parse::<i32>().unwrap();
    println!("{}", (a + b) * h / 2);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0; i<(n); ++i)
#define REPR(i,n,m) for (int i=(n); i>=(m); --i)
using namespace std;
using LL = long long;
using LD = long double;
using PLL = pair<long long, long long>;
using PLD = pair<long double, long double>;
using VLL = vector<long long>;
using VLD = vector<long double>;
using VPLD = vector<PLD>;

const int INF = numeric_limits<int>::max();

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

    LL n; cin >> n;
    // cout << n << endl;
    //VLL d(1000000000, 0);
    /*REP(i,n)
    {
        LL tmp;
        cin >> tmp;
        d[tmp] += 1;
    }*/
    map<LL, LL> mp;
    REP(i,n)
    {
        LL tmp;
        cin >> tmp;
        mp[tmp] += 1;
    }

    LL m; cin >> m;
    VLL t(m);
    REP(i,m)
    {
        LL tmp;
        cin >> tmp;
        if (mp[tmp]>=1) {
            mp[tmp] -= 1;
        } else {
            cout << "NO" << endl;
            return 0;
        }
        
    }

    cout << "YES" << endl;    

    return 0;
}


Measured memory_bytes: 17200
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;

int main(){
    int n, k, ans = 0, tmp;
    cin >> n >> k;
    rep(i, n){
        cin >> tmp;
        if(tmp >= k) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX(x,y)	((x)>(y)?(x):(y))
#define MAX3(x,y,z)	((x)>(MAX(y,z)) ? (x):(MAX(y,z)))

int main(){
  int a, b, c, k, sum1=0, sum2=0;
  scanf("%d%d%d%d", &a, &b, &c, &k);
  sum1 = MAX3(a,b,c);
  sum2 = (a+b+c) - sum1;
  while(k>0){
    sum1 *= 2;
    k--;
  }
  printf("%d", sum1+sum2);
  return 0;
}


Measured memory_bytes: 1736
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, K = iim()

    okasi = set()
    for i in range(K):
        input()
        for i in iim():
            okasi.add(i)

    print(N-len(okasi))

if __name__ == "__main__":
    resolve()


Measured memory_bytes: 9176
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0,i<n,i++)
int main(){
long long y,t;cin>>t>>y;
long long an;
if(t==1||y==1){an=1;}
else{
if(t%2==0){if(y%2==0){an=t*y/2;}
else{an=t*y/2;}}
else{if(y%2==0){an=t*y/2;}
else{an=t*y/2+1;}
}}
cout<<an<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
   int n;
   cin>>n;
   vector<int>pp;
   int a[n],b[n];
   for(int i=0;i<n;i++)
   {
   	cin>>a[i];
   }
    for(int i=0;i<n;i++)
   {
   	cin>>b[i];
   }
 pp.resize(n);
   for(int i=0;i<n;i++)
   {
   	pp.push_back(a[i]-b[i]);
   }
   int ans=0;
   sort(pp.begin(),pp.end(),greater<int>());
  for(int i=0;i<pp.size();i++)
  {
  	if(pp[i]<0){
  		break;
  	}
  	else{ans+=pp[i];
  	}
  }
  cout<<ans;
}
	

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

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

int n;
cin>>n;
int ans;
if(n&1==0)ans=n/2-1;
else ans=(n+1)/2-1;
cout<<ans<<endl;
return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	if (a >= b){
		printf("No\n");
	}
	else if (b >= c){
		printf("No\n");
	}
	else{
		printf("Yes\n");
	}
	return 0;
}

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

int main() {
    using namespace std;
    int n;
    cin >> n;
    vector<int>x(n);
    for(int i=0; i<n; i++)cin>>x[i];

    int ans=1'000'000'000; //'
    for(int i=1; i<=100; i++){
        // int sum = accumulate(x.begin(),x.end(),[](int acc, int j){
        //     return acc + (i-j)*(i-j);
        // });
        int sum =0;
        for(int j=0; j<n; j++) sum += (i-x[j])*(i-x[j]);

        ans = min(ans, sum);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
const int N=1e5+5,M=8*N;
int n,pa,pb,d,i,g[N];long long ans;
struct arr{int x,y,id;}a[N];
bool operator < (arr A,arr B){
	return A.x<B.x||A.x==B.x&&A.y<B.y;
}
int read(){
	char c=getchar();int k=0;for (;c<48||c>57;c=getchar());
	for (;c>47&&c<58;c=getchar()) k=(k<<3)+(k<<1)+c-48;return k;
}
int et,he[N];struct edge{int l,to;}e[M];
void line(int x,int y){
	e[++et].l=he[x];he[x]=et;e[et].to=y;
	e[++et].l=he[y];he[y]=et;e[et].to=x;
}
void work(int k){
	int i,j,l,r;sort(a+1,a+n+1);
	for (i=j=l=r=1;i<=n;i++){
		for (;a[l].x<a[i].x-d||
			a[l].x==a[i].x-d&&a[l].y<a[i].y-k;l++);
		for (;a[r].x<a[i].x-d||
			a[r].x==a[i].x-d&&a[r].y<=a[i].y+k;r++);
		g[a[i].id]+=r-l;j=max(j,l);if (j>=r) continue;
		for (line(a[i].id,a[j].id);j+1<r;j++)
			line(a[j].id,a[j+1].id);
	}
}
bool vis[N];
void dfs(int x){
	vis[x]=1;ans+=g[x];
	for (int i=he[x];i;i=e[i].l)
		if (!vis[e[i].to]) dfs(e[i].to);
}
int main(){
	n=read();pa=read();pb=read();
	for (i=1;i<=n;i++){
		int x=read(),y=read();
		a[i]=(arr){x+y,x-y,i};
	}
	d=max(abs(a[pa].x-a[pb].x),abs(a[pa].y-a[pb].y));
	work(d);
	for (i=1;i<=n;i++) swap(a[i].x,a[i].y);
	work(d-1);dfs(pa);
	printf("%lld",ans);
}

Measured memory_bytes: 9984
//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;
//use std::collections::VecDeque;
//use std::collections::BinaryHeap;

//use std::cmp::*;

fn main() {
    input! {
        r: u64,
    }

    println!("{}", r * r);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
        #define rep1(i,n) for(int i=1;i<(int)(n);++i)

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

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

    #define int long long

    using namespace std;

    signed main()
    {
        string x;
        int n=0,m=0,i;
      	cin>>n>>m;
        cin>>x;
      m--;
        i=(int)x[m];
      i+=32;
      x[m]=i;
        cout<<x<<endl;
        return 0;
    }


Measured memory_bytes: 256
#include <stdio.h>

int main(){

    int i=0;
    int x[10000];


    do{
        scanf("%d",&x[i]);
        
        if(x[i] == 0){
            break;
        }

        i++;

    }while(i < 10000);

    i = 0;
    do{
        if(x[i] != 0){
            printf("Case %d: %d\n",i+1,x[i]);
        }else{
            break;
        }

        i++;

    }while(i < 10000);

    return 0;
}

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

int main() {
  int N, ans = 0;
  cin >> N;
  vector<int> item(N);
  
  for (int i = 0; i < N; i++) cin >> item.at(i);
  for (int j = 0; j < N; j++) {
    for (int k = j+1; k <N; k++) ans += item[j]*item[k];
  }
  
  cout << ans << endl;;
}

Measured memory_bytes: 3608
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<string>
#include<cassert>
using namespace std;
#define N 4
#define N2 16
#define LIMIT 100

static const int dx[4] = { 0,-1,0,1 };
static const int dy[4] = { 1,0,-1,0 };
static const char dir[4] = { 'r','u','l','d' };
int MDT[N2][N2];

struct Puzzle { int f[N2], space, MD; };

Puzzle state;
int limit;
int path[LIMIT];

int getAllMD(Puzzle pz) {
	int sum = 0;
	for (int i = 0; i < N2; i++) {
		if (pz.f[i] == N2)continue;
		sum += MDT[i][pz.f[i] - 1];
	}
	return sum;
}

bool isSolved() {
	for (int i = 0; i < N2; i++)if (state.f[i] != i + 1)return false;
	return true;
}

bool dfs(int depth, int prev) {
	if (state.MD == 0)return true;
	if (depth + state.MD > limit)return false;

	int sx = state.space / N;
	int sy = state.space%N;
	Puzzle tmp;

	for (int r = 0; r < 4; r++) {
		int tx = sx + dx[r];
		int ty = sy + dy[r];
		if (tx < 0 || ty < 0 || tx >= N || ty >= N)continue;
		if (max(prev, r) - min(prev, r) == 2)continue;
		tmp = state;
		state.MD -= MDT[tx*N + ty][state.f[tx*N + ty] - 1];
		state.MD += MDT[sx*N + sy][state.f[tx*N + ty] - 1];
		swap(state.f[tx*N + ty], state.f[sx*N + sy]);
		state.space = tx*N + ty;
		if (dfs(depth + 1, r)) { path[depth] = r; return true; }
		state = tmp;
	}
	return false;
}

string iterative_deeping(Puzzle in) {
	in.MD = getAllMD(in);

	for (limit = in.MD; limit <= LIMIT; limit++) {
		state = in;
		if (dfs(0, -100)) {
			string ans = "";
			for (int i = 0; i < limit; i++)ans += dir[path[i]];
			return ans;
		}
	}
	return "unsolvable";
}

int main() {
	for (int i = 0; i < N2; i++)
		for (int j = 0; j < N2; j++)
			MDT[i][j] = abs(i / N - j / N) + abs(i%N - j%N);

	Puzzle in;

	for (int i = 0; i < N2; i++) {
		cin >> in.f[i];
		if (in.f[i] == 0) {
			in.f[i] = N2;
			in.space = i;
		}
	}
	string ans = iterative_deeping(in);
	cout << ans.size() << endl;

	return 0;
}


Measured memory_bytes: 3220
#include <iostream>
#include <vector>

using namespace std;

int N;
bool Find;
vector<int> res,sign;

void dfs(int ind) {
	if (Find) {
		return;
	}
	if (ind == N-1) {
		if ((res[0] == res[ind]*sign[ind]*res[ind-1]) && (res[1] == res[0]*sign[0]*res[ind])) {
			for (int i = 0; i < N; ++i) {
				if (res[i] > 0) {
					cout << "S";
				}
				else {
					cout << "W";
				}
			}
			cout << endl;
			Find = true;
		}
		return;
	}
	if (ind < 2) {
		res[ind] = 1;
		if (ind == 1) {
			res[ind+1] = sign[ind]*res[ind-1];
		}
		dfs(ind+1);
		res[ind] = -1;
		if (ind == 1) {
			res[ind+1] = -sign[ind]*res[ind-1];
		}
		dfs(ind+1);
	}
	else {
		res[ind+1] = res[ind]*sign[ind]*res[ind-1];
		dfs(ind+1);
	}
}


int main(void) {
	cin >> N;
	sign = vector<int>(N);
	for (int i = 0; i < N; ++i) {
		char c;
		cin >> c;
		if (c == 'o') {
			sign[i] = 1;
		}
		else {
			sign[i] = -1;
		}
	}
	res = vector<int>(N);
	Find = false;
	dfs(0);
	if (!Find) {
		cout << -1 << endl;
	}
	return 0;
}


Measured memory_bytes: 1152
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
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 (a > b) {a = b; return 1;} return 0; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) (q ? "Yes" : "No")
#define YES(q) (q ? "YES" : "NO")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(dumpall_i, (q).size()) { cerr << q[dumpall_i] << (dumpall_i == (q).size() - 1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }

// gcc拡張マクロ
#define gcd __gcd
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
using  ll = long long;
using ull = unsigned long long;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll m, k; cin >> m >> k;

    if (k >= (1LL << m)) {
        cout << -1 << endl;
        return 0;
    }

    if (m == 1) {
        if (k == 0) {
            cout << "0 0 1 1" << endl;
        } else {
            cout << -1 << endl;
        }
    } else {
        ll rng = 1LL << m;
        REP(i, rng) if (i != k) cout << i << " ";
        cout << k << " ";
        REP(i, rng) if (rng - i - 1 != k) cout << (rng - i - 1) << " ";
        cout << k << endl;
    }
    
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
int main(){
  ll n;
  cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  ll ans=0;
  ll right=0;
  ll sum=0;
  rep(left,n){
    while(right<n && (sum^v[right])==(sum+v[right])){
      sum+=v[right];
      right++;
    }
    ans+=right-left;
    if(left==right) right++;
    else sum-=v[left];
  }
  cout<<ans<<endl;
}

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

bool primes[1000000+1];

void Sieve() {
    for(int i = 2; i < 1000000; i++) {
      primes[i] = true;
    }
    /* 素数でない整数を false にする */;
    primes[1] = false;
    for(int i = 2; i <= 1000; i++) {
        if(primes[i]) {
            int p = i;
            for(int j = p + p; j <= 1000000; j+=p) {
                primes[j] = false;
            }
        }
    }
}

bool IsPrime(int n) {
	return primes[n];
}

int main(void){
    int n;
	Sieve();
	while(cin >> n) {
	    int count = 0;
	    for(int i = 2; i <= n; i++) {
		    if(IsPrime(i)) {
            count += 1;
		    }
	    }
	    cout << count << endl;
	}
	return 0;
}



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

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	#ifdef LOCAL
//		freopen("in1.txt", "r", stdin);
//		freopen("in1.txt", "w", stdout);
	#endif
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	while (1) {
		c -= b;
		if (c<=0) {
			cout << "Yes\n";
			break;
		}
		a -= d;
		if (a<=0) {
			cout << "No\n";
			break;
		}
	}
}

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long i64;

int sum(i64 n) {
  if(n < 10) return n;
  return n % 10 + sum(n / 10);
}

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

  string s;
  cin >> s;

  if(s.size() < 26) {
    vector<bool> used(26, false); 
    rep(i, 0, s.size()) {
      used[s[i] - 'a'] = true;
    }
    rep(i, 0, 26) {
      if(!used[i]) {
        char c = 'a' + i;
        cout << s << c << endl;
        return 0;
      }
    }
  }

  string t = s;
  if(!next_permutation(all(s))) {
    cout << -1 << endl;
    return 0;
  }

  rep(i, 0, 26) {
    if(t[i] == s[i]) cout << t[i];
    else {
      cout << s[i];
      break;
    }
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
    int a, b, c, t;
    scanf("%d %d %d", &a, &b, &c);
    if(a > b) {
        t = a;
        a = b;
        b = t; 
    }
    if(b > c) {
        t = b;
        b = c;
        c = t; 
    }
    if(a > b) {
        t = a;
        a = b;
        b = t; 
    }
    printf("%d %d %d\n", a, b, c);
    
    return 0;
}

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

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

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

def main():
    n = I()
    a = LI_()
    b = LI()
    c = LI()
    r = 0
    for i in range(n):
        r += b[a[i]]
        if i < n-1:
            if a[i] + 1 == a[i+1]:
                r += c[a[i]]

    return r


print(main())



Measured memory_bytes: 5840
n=int(input())
a=list(map(int,input().split()))
a.sort()
dp=[0]*(a[-1]+1)

for i in a :
    dp[i]+=1

for i in a :
    if dp[i] :
        for j in range(i*2,a[-1]+1,i) :
            dp[j]=0

print(dp.count(1))


Measured memory_bytes: 32340
#include <iostream>
#include <stdio.h>
#include <cmath>

typedef long long ll;

#define debug(x) cerr << #x << ": " << x << "\n";
#define rep(i,n) for(int i=0; i<n; i++)

using namespace std;

int main(){
  double A, B, H, M;
  cin >> A >> B >> H >> M;

  if(H==0) H = 12;
  const double PI=3.14159265358979323846;  
  double deg = abs(30 * H - 6 * M + M / 2) * PI / 180;

  printf("%.10f", sqrt(A*A + B*B - 2*A*B*cos(deg)));
}

Measured memory_bytes: 4224
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
int main()
{
    ll a,b;
    while(~scanf("%lld%lld",&a,&b)){
        ll c,d,e;
        c=a+b;
        d=a-b;
        e=a*b;
        printf("%lld\n",max(max(c,d),e));
    }
    return 0;
}


Measured memory_bytes: 128
o,x,b;
main(a){
  for(scanf("%d");~scanf("%s",&a);o==3?o=b=x=!printf("%d\n",x):0)
      for(a%=6,a-5?b=b*2+1,x+=b/8,b&=7:o++;!a&b;b/=2)x++;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
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 1e9+7
#define LINF (long long)4e18


int main(){
  int N,M;
  cin >> N >> M;
  vector<int> L(M),R(M);
  rep(i,M)cin >> L[i] >> R[i];
  sort(L.begin(),L.end(),greater<int>());
  sort(R.begin(),R.end());
  int ans = 0;
  if(R[0] >= L[0])ans = R[0] - L[0] + 1;
  cout << ans << endl;
 
  

}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
using namespace std;
bool dp[2001];

int main(){
	int n, m, t;
	scanf("%d", &n);
	for(int i = 0;i < n;i++){
		scanf("%d", &t);
		for(int j = 2000;j >= 0;j--)if(dp[j])dp[j+t] = true;
		dp[t] = true;
	}
	scanf("%d", &m);
	while(m--){
		cin >> t;
		cout << (dp[t] ? "yes" : "no") << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3156