akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline void fastio () {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
}

#define whats(x) cerr << #x << " = " << (x) << "\n"; 

using LL = long long;
using LD = long double;

const LL INF = LLONG_MAX;
const LL MOD = static_cast<LL>(1e9+7);
const LL N = 1e6+1;

int main() {
	fastio();

	LL n;
	cin >> n;

	vector<LL> a(n);

	vector<LL> mp(N);
	for (auto &e : a) {
		cin >> e;
		mp[e]++;
	}

	LL ans = 0;
	for (LL i = 0; i < n; ++i) {
		LL x = a[i];
		LL cnt = 0;
		for (LL j = 2; j*j <= x && cnt == 0; ++j) {
			if (x % j == 0) {
				cnt += mp[j];
				if (j*j != x) {
					cnt += mp[x/j];
				}
			}
		}
		if (x == 1) {
			cnt += mp[x]-1;
		}
		else {
			cnt += mp[1];
			cnt += mp[x]-1;
		}
		if (cnt == 0) {
			ans++;
		}
	}

	cout << ans << "\n";

}

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

int n;
long w[110];
long v[110];

long dp[110][100100];

long dfs ( int pos, int left ) {
    if ( ~dp[pos][left] ) return dp[pos][left];
    if ( pos == n ) return 0;
    long rec = 0;
    if ( left >= w[pos] ) {
        rec = dfs ( pos+1, left-w[pos] ) + v[pos];
    }
    return dp[pos][left] = max ( rec, dfs ( pos+1, left ) );
}

signed main ( ) {

    ios::sync_with_stdio(0);
    cin.tie(0);

    int W;
    cin >> n >> W;
    for ( int i = 0; i < n; i++ ) {
        cin >> w[i] >> v[i];
    }

    memset(dp, -1, sizeof(dp));

    cout << dfs ( 0, W ) << endl;

    return 0;
}

Measured memory_bytes: 86272
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long a = Integer.parseInt(sc.next());
    long b = Integer.parseInt(sc.next());
	long tmp;
    long g = 1;
    long ans = 0;
    
    if (a < b) {
      tmp = a;
      a = b;
      b = tmp;
    }
    g = gcd(a, b);
    
    ans = a*b/g;
    
    System.out.println(ans);
    
  }
  
  public static long gcd(long a, long b) {
    if (b == 0) {
      return a;
    } else {
      return gcd(b,a%b);
    }
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>

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

using namespace std;

const int max_n = 200000;
const int prime = 1e9 + 7;
vector<queue<int> > y(max_n);

int main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> x(n);
    FOR (i, n){
        cin >> x[i];
        x[i]--;
        y[x[i]].push(i);
    }
    vector<long long> dp(n, 0);
    dp[0] = 1;
    FOR (i, n){
        int a = y[x[i]].front();
        y[x[i]].pop();
        if (i + 1 < n)
            dp[i + 1] = (dp[i + 1] + dp[i]) % prime;
        if (!y[x[i]].empty()){
            int b = y[x[i]].front();
            if (b != i + 1)
                dp[b] = (dp[b] + dp[i]) % prime;
        }
    }
    cout << dp[n - 1] << endl;
}


Measured memory_bytes: 137856
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		int count = 0;
		
		for (int i=0; i< 3; i++) {
			if (S.charAt(i) == T.charAt(i)) {
				count++;
			}
		}
		
		
		System.out.println(count);
		
		
	}

}


Measured memory_bytes: 21460
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let s = scan.chars();
    let t = scan.chars();
    let sp = s.iter().map(|c| if *c == 'A' {1} else {2}).collect::<Vec<_>>();
    let tp = t.iter().map(|c| if *c == 'A' {1} else {2}).collect::<Vec<_>>();
    let cums = Cum::new(&sp);
    let cumt = Cum::new(&tp);
    let q = scan.read::<usize>();
    for _ in 0..q {
        let r1 = scan.read::<usize>()-1 .. scan.read::<usize>();
        let r2 = scan.read::<usize>()-1 .. scan.read::<usize>();
        println!("{}", if cums.sum(r1) % 3 == cumt.sum(r2) % 3 {
            "YES"
        } else {"NO"});
    }
}

use std::ops::Range;

#[derive(Debug)]
#[allow(dead_code)]
struct Cum {
    s: Vec<i64>,
}


#[allow(dead_code)]
impl Cum {
    fn new(a: &Vec<i64>) -> Cum {
        let mut s = vec![0; a.len() + 1];
        for i in 0..a.len() {
            s[i + 1] = s[i] + a[i];
        }
        Cum { s: s }
    }
    /// [l,r)
    fn sum(&self, range: Range<usize>) -> i64 {
        self.s[range.end] - self.s[range.start]
    }
}


// region template
#[allow(dead_code)]
fn iu(i: i64) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> i64 { i as i64 }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 8700
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define rep(i,a,b) for(uint32 i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define ALL(x) (x).begin(),(x).end()
#define C(x) std::cout << #x << " : " << x << std::endl
#define scanf scanf_s

using int32 = std::int_fast32_t;
using int64 = std::int_fast64_t;
using uint32 = std::uint_fast32_t;
using uint64 = std::uint_fast64_t;

template<typename T>
class hashmap64 {
	std::vector<std::pair<uint64, T>> map;
	uint64 mask, temp, count;
	uint64 hash64(uint64 key) {
		key = ~key;
		key ^= key << 13;
		key ^= key >> 19;
		return key ^ (key << 17);
	}
public:
	hashmap64() :map(8192, std::make_pair(~static_cast<std::uint_fast64_t>(0), T())) {
		mask = 8191; count = 0;
	}
	hashmap64(size_t s) {
		s |= s << 1;
		s |= s >> 2;
		s |= s >> 4;
		s |= s >> 8;
		s |= s >> 16;
		s |= s >> 32;
		mask = s;
		count = 0;
		map.resize(s + 1, std::make_pair(~static_cast<std::uint_fast64_t>(0), T()));
	}
	T &operator[](uint64 suf) {
		temp = mask&hash64(suf);
		while (map[temp].first != suf) {
			temp = mask&(temp + 1);
		}
		return map[temp].second;
	}
	void insert(uint64 key, const T &value) {
		temp = mask&hash64(key);
		while (~map[temp].first) {
			if (map[temp].first == key) {
				map[temp].second = value;
				return;
			}
			temp = mask&(temp + 1);
		}
		map[temp] = std::make_pair(key, value);
		++count;
		if ((count << 1) > mask) {
			std::pair<uint64, T> mkey;
			uint64 t = mask;
			mask = mask << 1 | 1;
			map.resize(mask + 1, std::make_pair(~static_cast<std::uint_fast64_t>(0), T()));
			while (~map[t].first) {
				--t;
			}
			while (++t <= (mask >> 1)) {
				mkey = map[t];
				map[t].first = ~static_cast<std::uint_fast64_t>(0);
				temp = mask&hash64(mkey.first);
				while (~map[temp].first) {
					temp = mask&(temp + 1);
				}
				map[temp] = mkey;
			}
			for (t = 0;t <= mask >> 1;++t) {
				if (~map[t].first) {
					mkey = map[t];
					map[t].first = ~static_cast<std::uint_fast64_t>(0);
					temp = mask&hash64(mkey.first);
					while (~map[temp].first) {
						temp = mask&(temp + 1);
					}
					map[temp] = mkey;
				}
			}
		}
		return;
	}
	bool find(uint64 key) {
		temp = mask&hash64(key);
		while (~map[temp].first) {
			if (map[temp].first == key) {
				return true;
			}
			temp = mask&(temp + 1);
		}
		return false;
	}
	bool empty(void) {
		return !count;
	}
	size_t size(void) {
		return count;
	}
};

int main(void) {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	hashmap64<uint32> map(100000);
	uint32 n;
	std::cin >> n;
	int64 a, sum = 1e15;
	uint32 ans = 0;
	map.insert(sum, 0);
	rep(i, 0, n) {
		std::cin >> a;
		sum += a;
		if (map.find(sum)) {
			ans = std::max(ans, i + 1 - map[sum]);
		}
		else {
			map.insert(sum, i + 1);
		}
	}
	std::cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 15156
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.Arrays;
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;
        InputReader    in                      = new InputReader(inputStream);
        PrintWriter      out                    = new PrintWriter(outputStream);
        Task                 solver               = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
    	public void solve(int testNumber, InputReader in, PrintWriter out) {
    		int N = in.nextInt();
    		int K = in.nextInt();
    		int ans = 1;
    		if(N % K == 0) {
    			ans = 0;
    		}
    		out.println(ans);
    	}
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 22868
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
 
 
#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000
 
using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
typedef string::const_iterator State;
 
int dy[5] = { 0,0,1,-1,0 };
int dx[5] = { 1,-1,0,0 ,0 };
 
 
int main(void) {
	
	int a, b;
 
	cin >> a >> b;
	cout << a * b - a - b +1<< endl;
 
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define SIZ 1400
int m[SIZ+1][SIZ];
long long st[SIZ];
char z[9999999];
int get(){
	static int input_count=0;
	int r=0;
	for(;'0'<=z[input_count]&&z[input_count]<='9';)r=r*10+z[input_count++]-'0';
	input_count++;
	return r;
}
int main(){
	fread(z,1,sizeof(z),stdin);
	int i,j,k,y=get(),x=get(),r,ptr;
	for(j=0;j<y;j++)for(r=i=0;i<x;m[j][i]=r,i++){
		int t=get();
		r=t==0?r+1:0;
	}
	for(r=i=0;i<x;i++)for(ptr=j=0;j<=y;j++){
		int left=j;
		for(;ptr && st[ptr-1]>>32>m[j][i];){
			int l=st[ptr-1]&0xffffffff,h=st[ptr-1]>>32;
			ptr--;
			if(r<(j-l)*h)r=(j-l)*h;
			left=l;
		}
		st[ptr++]=((long long)m[j][i]<<32)|left;
	}

	printf("%d\n",r);
	return 0;
}

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

using namespace std;

constexpr char endl('\n');



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

    int64_t n, k;
    cin >> n >> k;

    cout << std::min(n % k, k - (n % k)) << ::endl;
    

    return 0;
}


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

from collections import Counter

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    la = rli()
    da = Counter()
    for a in la:
        da[a] += 1

    # 全て0
    if 0 in da and da[0] == n:
        print("Yes")
        return
    # それ以外は、個数が3の倍数でないとダメ
    if n % 3 != 0:
        print("No")
        return

    # 0: n/3個、x: 2*n/3個
    if len(da) == 2:
        if 0 in da and da[0] == n / 3:
            print("Yes")
            return

    # x, y, z: n/3個
    if len(da) == 3:
        x, y, z = da.keys()
        if (x ^ y == z) and da[x] == n/3 and da[y] == n/3:
            print("Yes")
            return

    # それ以外
    print("No")


if __name__ == '__main__':
    main()


Measured memory_bytes: 14460
import java.io.*;
import java.util.*;

class Main{
	
		public static ArrayList<String> remove_sentence (String a){
			ArrayList<String> b = new ArrayList<String>();
			
			String[] strAry = a.split(" ");
			strAry[strAry.length-1] = strAry[strAry.length-1].replaceAll("\\.","");
			for(int i=0;i<strAry.length;i++){
				if(strAry[i].length() == 3 || strAry[i].length() == 4) b.add(strAry[i]);
			}
			
			return b;
		}
		
		public static String change_word (String str,int n){
			String res = "";
			int a;
			char[] a_c = str.toCharArray();
			char buf;
			
			for(int i=0;i<a_c.length;i++){
				a = (int)a_c[i];
				if( (a + n) > 122){
						a = a  + n - 26;
						a_c[i] = (char)a;
				}
				else {
					a = a  + n;
					a_c[i] = (char)a;
				}
			}
			
			res = String.valueOf(a_c);
			return res;
		}
		
		public static void print_sentence (String str,int n){
			int a;
			String res;
			
			ArrayList<Character> str_c = new ArrayList<Character>();
			
			for(int j=0;j<str.length();j++){
					str_c.add(str.charAt(j));
				}
				for(int j=0;j<str_c.size() ;j++){
					a = (int)str_c.get(j);
					if(97 <= a && a <= 122){
						if( (a + n) > 122){
							a = a  + n - 26;
							str_c.set(j,(char)a);
						}
						else {
							a = a  + n;
							str_c.set(j,(char)a);
						}
					}
				}
				
			for(int i=0;i<str_c.size();i++){
				System.out.print(str_c.get(i));
			}
			System.out.print("\n");
		}
		
		public static int check_sentence (ArrayList<String> a){
			
			String b;
			int count = 0;

			ArrayList<String> target = new ArrayList<String>();
			target.add("the");
			target.add("this");
			target.add("that");
			
			for(int i=0;i<a.size();i++){
				for(int j=1;j<26;j++){
					for(int k=0;k<target.size();k++){
						b = change_word(a.get(i),j);
						if(b.equals(target.get(k))){ count = j; break;}
					}
					if(count != 0) break;
				}
				if(count != 0){
					break;
				}
			}
			return count;
		}
		
		public static ArrayList<Integer> dec_cae (ArrayList<String> a){
			ArrayList<String> rem_str = new ArrayList<String>();
			ArrayList<Integer> res = new ArrayList<Integer>();	
			
			for(int i=0;i<a.size();i++){
				rem_str = remove_sentence(a.get(i));
				res.add(check_sentence(rem_str));
			}
			return res;
		}
		
		public static void main(String args[]) throws IOException{
			String str;

			ArrayList<String> inp = new ArrayList<String>();
			ArrayList<Integer> count = new ArrayList<Integer>();

			Scanner scan = new Scanner(System.in);

			scan.useDelimiter("\n");

			
			while(scan.hasNext()){
				str = scan.next();
				inp.add(str);
			}
			count = (dec_cae(inp));
			for(int i=0;i<count.size();i++){
				print_sentence(inp.get(i),count.get(i));
			}
	}
}

Measured memory_bytes: 0
K = int(input())
if K%2==0 or K%5==0:
  print(-1)
if K%7 == 0:
  L = K//7*9
else:
  L = 9*K
j = 1
for i in range(9*(10**6)):
  j = 10*j % L
  if j == 1:
    print(i+1)
    break

Measured memory_bytes: 9172
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 2100100100;
const int MOD = 1e9 + 7;

ll N, M, K, Q, Z, W;
string S;

int main() {
    cin >> N >> Z >> W;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A.at(i);
    }

    ll a = abs(A[N - 1] - W);
    if (N == 1) {
        cout << a << endl;
        return 0;
    }

    ll b = abs(A[N - 1] - A[N - 2]);
    if (a <= b) {
        cout << b << endl;
    } else {
        cout << a << endl;
    }

    return 0;
}


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

using namespace std;

#define N 2010
#define ll long long
#define RG register

inline int read(){
    RG int x=0,o=1; RG char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=((x<<3)+(x<<1))+ch-'0',ch=getchar();
    return x*o;
}

int main(){
	int n=read(),K=read();
	if(n>=K*2-1) puts("YES"); else puts("NO");
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int mod=1000000007;
typedef long long ll;
string a,b;
int x[52];
int main()
{
    int n;
    //printf("%lld\n",(ll)3*2*3*1*2*2*2*3*1*2*3*3*3*3*3*1*2*1*2*2*2*2*2*1*2*2*2*2*2*2*2*3*1*2*3*1%1000000007);
    while(scanf("%d",&n)!=EOF)
    {
        cin>>a>>b;
        ll sum=1;
        int i=0,k=0;

        while(i<n)
        {
            if(a[i]==a[i+1])
            {


                if(i==0)
                {
                    sum*=6;
                }
                else
                    if(x[k-1]==1)
                {
                    sum*=2;
                }
                else
                {
                    sum*=3;
                }
                x[k++]=2;
                i+=2;

                //printf("2===%d\n",sum);
            }
            else
            {

                if(i==0)
                {
                    sum*=3;
                }
                else if(x[k-1]==1)
                {
                    sum*=2;
                }
                else sum*=1;
                x[k++]=1;
                i+=1;
                //printf("1===%d\n",sum);
            }
            sum=sum%mod;
        }
        printf("%lld\n",sum);
    }
    return 0;
}
/*
Rvvtt d W IyyPP QFFZZssffEEkk aSS D K q c ibb e Y r h A l jCCGG JppHH n
3*2*3*1*2*2*2*3*1*2*3*3*3*3*3*1*2*1*2*2*2*2*2*1*2*2*2*2*2*2*2*3*1*2*3*1
RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

int main() {
 ll Q,H,S,D,N;
  in(Q>>H>>S>>D>>N);
  ll a2 = minn(min(D,S*2),H*4,Q*8);
  ll a1 = minn(S,H*2,Q*4);
ll  ans = a2*(N/2)+(N%2)*a1;
  out(ans);
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    int N, R;

    cin >> N >> R;

    if(N >= 10){
        cout << R << endl;
    }

    else{
        cout << R+100*(10-N) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).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 (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


class UnionFind
{
public:
  UnionFind(int n)//0~n-1までitemを初期化
  {
    parent=vector<int>(n,-1);//親なら-size
  }
  int root(int a)
  {
    if(parent[a]<0)return a;
    return parent[a]=root(parent[a]);
  }
  int size(int a)
  {
    return -parent[root(a)];
  }
  bool connect(int a,int b)
  {
    int A=root(a);
    int B=root(b);
    if(A==B)return false;
    if(size(A)>size(B))swap(A,B);
    parent[B]+=parent[A];
    parent[A]=B;
    return true;
  }
private:
  vector<int> parent;

};
struct edge
{
  int to;
  int from;
  int cost;
};
struct city
{
  int num;
  int x;
  int y;
};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout<<setprecision(10);
  int n;
  cin>>n;
  UnionFind uni(n+1);
  vector<city> town(n);
  rep(i,n)
  {
    city nc;
    nc.num=i+1;
    cin>>nc.x>>nc.y;
    town[i]=nc;
  }
  sort(all(town),[](city a,city b){return a.x<b.x;});
  vector<edge> edges;
  rep(i,n-1)
  {
    edge ne;
    ne.cost=town[i+1].x-town[i].x;
    ne.to=town[i+1].num;
    ne.from=town[i].num;

    edges.push_back(ne);

  }
  sort(all(town),[](city a,city b){return a.y<b.y;});
  rep(i,n-1)
  {
    edge ne;
    ne.cost=town[i+1].y-town[i].y;
    ne.to=town[i+1].num;
    ne.from=town[i].num;

    edges.push_back(ne);

  }
  sort(all(edges),[](edge a,edge b){return a.cost<b.cost;});
  int res=0;
  rep(i,edges.size())
  {
    if(uni.connect(edges[i].to,edges[i].from))res+=edges[i].cost;
  }
  cout<<res<<endl;
  return 0;

}


Measured memory_bytes: 6388
# ABC043C - いっしょ / Be Together (ARC059C)
# exhaustive search
def main():
    # find the min cost to rewrite all to i (min(A) <= i <= max(A))
    N = int(input())
    A = tuple(map(int, input().split()))
    ans = []
    for i in range(min(A), max(A) + 1):
        cnt = sum((i - a) ** 2 for a in A)
        ans += [cnt]
    print(min(ans))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
import sys
from bisect import bisect_left, bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *L = map(int, read().split())

    L.sort()

    ans = 0
    for i in range(N):
        a = L[i]
        for j in range(i + 1, N):
            b = L[j]
            left = bisect_left(L, b, lo=j + 1)
            right = bisect_left(L, a + b, lo=j + 1)
            ans += right - left

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 74252
#include <string.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <queue>
#define MAXN 700010
#define inf 0x3f3f3f3f

using namespace std;
int a[MAXN];
int tr[MAXN<<2];
#define lson rt<<1,l,m
#define rson rt<<1|1,m+1,r

void push_up(int rt)
{
    tr[rt]=max(tr[rt<<1],tr[rt<<1|1]);
}

void build(int rt,int l,int r)
{
    if (l==r) {
        tr[rt]=a[l];
        return;
    }
    int m=(l+r)>>1;
    build(lson);
    build(rson);
    push_up(rt);
}

void update(int rt,int l,int r,int x,int y)
{
    if (l==r) {
        tr[rt]=y;
        return;
    }
    int m=(l+r)>>1;
    if (x<=m) update(lson,x,y);
    else update(rson,x,y);
    push_up(rt);
}

int query(int rt,int l,int r,int L,int R)
{
    if (L<=l&&r<=R) {
        return tr[rt];
    }
    int m=(l+r)>>1;
    int X=0,Y=0;
    if (L<=m) X=query(lson,L,R);
    if (m<R) Y=query(rson,L,R);
    return max(X,Y);
}


int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    build(1,1,600010);
    int ans =1;
    for(int i=0; i<n; i++){
        scanf("%d",&a[i]);
        a[i]++;
        int l = (a[i]-k <= 0)?1:a[i]-k;
        int r = a[i]+k ;
        int t = query(1,1,600010,l,r);
      //  printf("now l:%d  r:%d \n",l,r);
   //     printf("now t:%d\n",t);
        update(1,1,600010,a[i],t+1);
        ans = max(ans, t+1);
    //    printf("ans:%d\n",ans);
    }
    printf("%d\n",ans);

    return 0;
}


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

int main() {
  int N,K,i,hp=0;
  string S;
  cin >> N >> K >> S;

  for(i=0; i<N; i++)
    if(S[i]=='R') {
      if(i!=N-1 && S[i+1]=='R')
        hp++;
    } else if(i!=0 && S[i-1]=='L')
        hp++;
  cout << min(N-1, hp+2*K) << endl;
}

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

using namespace std;

typedef long long ll;

int main() {
    int a, b, q;
    cin >> a >> b >> q;
    ll s[a], t[b];
    for (int i = 0; i < a; i++) {
        cin >> s[i];
    }
    sort(s, s+a);
    for (int i = 0; i < b; i++) {
        cin >> t[i];
    }
    sort(t, t+b);

    while (q--) {
        ll x;
        cin >> x;

        int s1 = lower_bound(s, s+a, x) - s;
        int t1 = lower_bound(t, t+b, x) - t;

        ll ans = 2e10;

        if (s1 != a && t1 != b) {
            ans = min(ans, max(s[s1], t[t1]) - x);
        }

        if (s1 != 0 && t1 != b) {
            ll d1 = x - s[s1-1];
            ll d2 = t[t1] - x;
            ans = min(ans, d1 + d2 + min(d1, d2));
        }

        if (s1 != a && t1 != 0) {
            ll d1 = x - t[t1-1];
            ll d2 = s[s1] - x;
            ans = min(ans, d1 + d2 + min(d1, d2));
        }

        if (s1 != 0 && t1 != 0) {
            ans = min(ans, x - min(s[s1-1], t[t1-1]));
        }

        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;
#define MOD 1000000007
#define EPS 10e-8

int main(){
    double N,D,l;
    double kyori=0.0;
    int count=0;
    int k;
    cin >> N >> D;
    ll p[11][11];
    rep(i,N){
        rep(j,D){
            cin >> p[i][j] ;
        }
    }
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            l=0.0;
            k=0;
            for(int t=0;t<D;t++){
                l+=abs((p[i][t]-p[j][t])*(p[i][t]-p[j][t]));
            }
            l=sqrt(l);
            k=(int)l;
            if(abs(l-k)<0.000001){
                count++;
            }
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 888
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
int main(void)
{
    int A, B;
    cin >> A >> B;
    int C = B - A - 1;
    int D = C * (C + 1) / 2;
    cout << D - A;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).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 (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep (i, n) cin >> a[i];
    rep (i, n) {
        ll b;
        cin >> b;
        a[i] -= b;
    }
    ll husoku = 0;
    int ans = 0;
    rep (i, n) {
        if (a[i] < 0) {
            husoku -= a[i];
            ans++;
        }
    }
    sort(all(a), [](ll a, ll b) {return a > b;});
    rep (i, n) {
        if (husoku > 0 && a[i] > 0) {
            ans++;
            husoku -= a[i];
        } else break;
    }
    if (husoku <= 0) cout << ans << "\n";
    else cout << "-1\n";
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define N 200005
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
ll powermodm(ll x,ll n,ll M){ll result=1;while(n>0){if(n % 2 ==1)result=(result * x)%M;x=(x*x)%M;n=n/2;}return result;}
ll power(ll _a,ll _b){ll _r=1;while(_b){if(_b%2==1)_r=(_r*_a);_b/=2;_a=(_a*_a);}return _r;}
ll gcd(ll a,ll b){while(a&&b)a>b?a%=b:b%=a;return a+b;}
ll lcm(ll a,ll b){return (max(a,b)/gcd(a,b))*min(a,b);}


int main() 
{ 
    fast;
    ll n,m;
    cin>>n>>m;
    ll dp[n+1][m+1];
    string s[n];
    ll mod=1e9 + 7;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
    }
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            dp[i][j]=0;
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(i==1 && j==1)
            {
                dp[i][j]=1;
            }
            else
            {
                if(s[i-1][j-1]=='.')
                {
                    dp[i][j]=(dp[i-1][j] + dp[i][j-1])%mod;
                }
            }
        }
    }
    cout<<dp[n][m];
    return 0;
} 

Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,M;
  cin >> N >> M;
  vector<int> H(N);
  for(int i=0;i<N;i++)  cin >> H.at(i);
  vector<vector<int>> graph(N);
  for(int i=0;i<M;i++){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    graph.at(a).pb(b);
    graph.at(b).pb(a);
  }

  int ans=0;
  for(int i=0;i<N;i++){
    bool flag=true;
    for(int j=0;j<sz(graph.at(i));j++){
      int nv=graph.at(i).at(j);
      if(H.at(i)<=H.at(nv)){
        flag=false;
        break;
      }
    }
    if(flag)  ans++;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 8744
#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>;

int main(){
	string S;
	cin>>S;
	while(1){
		S.erase(S.size()-1);
		if(S.size()%2==0){
			if(S.substr(0,S.size()/2)==S.substr(S.size()/2,S.size()-1)){
				cout<<S.size();
				return 0;
			}
		}
	}
	//cout<<sqrt(10);
return 0;}

/*compile
g++ code.cpp
./a.out
run*/

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <set>

using namespace std;
using ll = long long;

typedef pair<ll, ll> P;

const int MOD = 1000000007;
const ll INF = 1LL << 60;


// LRUD
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
// const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
// const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

vector<vector<int> > vvi;
vector<vector<vector<int> > > vvvi;

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

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }


int main(int argc, char**argv){
    int x, a;
    cin >> x >> a;
    if (x < a) cout << 0 << endl;
    else cout << 10 << endl;


    return 0;
}





















Measured memory_bytes: 256
def solve(string):
    n, x = map(int, string.split(" "))
    t = ["P"]
    for _ in range(10):
        t.append("B{}P{}B".format(t[-1], t[-1]))
    l, p = [1], [1]
    for _ in range(n):
        l.append(2 * l[-1] + 3)
        p.append(2 * p[-1] + 1)

    def rec(i, x):
        if i <= 10:
            return t[i][:x].count("P")
        if x > l[i - 1] + 2:
            return p[i - 1] + 1 + rec(i - 1, x - l[i - 1] - 2)
        elif x == l[i - 1] + 2:
            return p[i - 1] + 1
        else:
            return rec(i - 1, x - 1)

    return str(rec(n, x))


if __name__ == '__main__':
    print(solve(input()))


Measured memory_bytes: 3064
from itertools import accumulate,chain
n,*s=open(0).read().split()
t=[2*i.count("(")-len(i) for i in s]
st=[[min(accumulate(s_,lambda a,b: a+(1 if b=="(" else -1),initial=0)),t_] for s_,t_ in zip(s,t)]
now=0
for c in chain(sorted([x for x in st if x[1]>=0])[::-1],sorted([x for x in st if x[1]<0],key=lambda z:z[1]-z[0])[::-1]):
    if now+c[0]<0:
        print("No");break
    now+=c[1]
else:
    print("No" if now else "Yes")

Measured memory_bytes: 128056
#include<bits/stdc++.h>
#define endl "\n" 
using namespace std;
#define debug(x) cout<<"The value of "<<#x<<" is "<<x<<endl;
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    cin.sync_with_stdio(0); cin.tie(0); 
    int x;
    cin>>x;
    int ans=0;
    int full=x/500;
    ans+=full*1000;
    x-=full*500;
    ans+=(x/5)*5;
    cout<<ans<<endl; 
}


Measured memory_bytes: 3620
import numpy as np
N, K = map(int, input().split())
a = np.array(list(map(int, input().split())))
a = (a + 1) / 2
total = 0
maxi = 0
for i in range(0, N):
    total += a[i]
    if i >= K - 1:
        maxi = max(maxi, total)
        total -= a[i-(K-1)]
print('{:.12f}'.format(maxi))


Measured memory_bytes: 33968
# frozen_string_literal: true

def cin
  gets.split.map(&:to_i)
end

N, M = cin

ac = pena = 0
misses = Array.new(N + 1, 0)

M.times do
  p, s = gets.split
  p = p.to_i

  next if misses[p] == -1

  if s == 'WA'
    misses[p] += 1
  elsif s == 'AC'
    ac += 1
    pena += misses[p]
    misses[p] = -1
  end
end

puts "#{ac} #{pena}"


Measured memory_bytes: 2556
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int n,k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n){
        cin >> p[i];
    }
    ll ans = 0;
    ll sum = 0;
    queue<int> q;
    rep(i,n){
        while (q.size() >= k) {
            sum -= q.front();
            q.pop();
        }
        sum += p[i] + 1;
        q.push(p[i] + 1);
        if (q.size() == k) {
            ans = max(ans,sum);
        }
    }
    double ansd = ans;
    ansd /= 2;
    printf("%.10f\n",ansd);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
#define per(i,a,b) for(ll i =a ;i >= b;i--)
using namespace std;


int main(int argc, char const *argv[])
{
	//ifstream cin("input.txt");
	int n;
	cin>>n;
	ll ans = 1, in,flag = 0;
	const ll t = 1e18;

	rep(i,0,n-1){
		cin>>in;		
		if(in == 0){
			cout<<0;
			return 0;
		}
		if(in <= 1000000000000000000/ans)
			ans *= in;
		else
		{
			flag = 1;
		}
	}
	if(flag)
		cout<<"-1";
	else
		cout<<ans;
	

}

Measured memory_bytes: 3560
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

void ModInv(int n, vector<ll> &inv, int mod){
    inv[0]=0; inv[1]=1;
    for(int i=2;i<=n;i++) inv[i]=mod-((mod/i)*inv[mod%i]%mod);
}

void FacInv(int n,vector<ll> inv,vector<ll> &fac,vector<ll> &facInv,int mod){
    fac[0]=facInv[0]=1;
    rep1(i,n){
        fac[i]=(fac[i-1]*i)%mod;
        facInv[i]=(facInv[i-1]*inv[i])%mod;
    }
}

ll CombIMod(int n,int k,int mod,const vector<ll> &inv,const vector<ll> &fac,const vector<ll> &facInv){
    if(n==0&&k==0) return 1;
    if(n<=0||k<0||k>n) return 0;
    if(k==0) return 1;
    return (((fac[n]*facInv[k])%mod)*facInv[n-k])%mod;
}

ll powMod(ll x,ll n,ll mod){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, M;
    cin>>N>>M;
    
    vector<ll> inv(N+1);
    vector<ll> fac(N+1);
    vector<ll> facInv(N+1);
    ModInv(N,inv,M);
    FacInv(N,inv,fac,facInv,M);
    
    vector<ll> ways(N+1,0);
    vector<vector<ll>> ways2(N+1,vector<ll>(N+1,0));
    ways2[0][0]=1;
    rep1(i,N){
        rep(j,N+1){
            if(j>i){
                ways2[i][j]=0;
            }else if(j==0||j==i){
                ways2[i][j]=1;
            }else{
                ways2[i][j]=(((j+1)*ways2[i-1][j])%M+ways2[i-1][j-1])%M;
            }
        }
    }
    
    rep(i,N+1){
        rep(j,i+1){
            ways[i]+=ways2[i][j]*powMod(2,(ll)(N-i)*j,M);
            ways[i]%=M;
        }
        ways[i]*=powMod(2,powMod(2,N-i,M-1),M);
        ways[i]%=M;
    }
    
    ll ans=0;
    rep(i,N+1){
        ll val=(CombIMod(N,i,M,inv,fac,facInv)*ways[i])%M;
        
        if(i%2==0) ans=(ans+val)%M;
        else ans=(ans-val+M)%M;
    }
    cout1(ans);
}

Measured memory_bytes: 70784
class dice:
    def __init__(self,label):
        self.top, self.front, self.right, self.left, self.rear, self.bottom \
                = label
 
    def roll(self,op):
        if   op=='N': self.top, self.front, self.bottom, self.rear = \
                                self.front, self.bottom, self.rear , self.top
        elif op=='E': self.top, self.left , self.bottom, self.right = \
                                self.left , self.bottom, self.right, self.top
        elif op=='W': self.top, self.right, self.bottom, self.left = \
                                self.right, self.bottom, self.left , self.top
        elif op=='S': self.top, self.rear , self.bottom, self.front = \
                                self.rear , self.bottom, self.front, self.top
 
    def print_top(self): print(self.top)
    def print_right(self): print(self.right)
 
    def get_label(self):
        return [self.top, self.front, self.right, self.left, self.rear, self.bottom]
  
label = list(map(int,input().split()))
d0 = dice(label)
d1 = list(map(int,input().split()))
for op in 'EEENEEENEEESEEESEEENEEEN':
    if d0.get_label() == d1:
        print('Yes')
        break
    d0.roll(op)
else:
    print('No')

Measured memory_bytes: 7788
#include <bits/stdc++.h>
using namespace std;
int main(){
	string S,T;
    int n=0;
    cin>>S>>T;
    for(int i=0;i<S.size();i++){
    	if(S.at(i)==T.at(i)){
        n=0;
        continue;
        }else{
        n=1;
        break;
        }
    }
  if(n==0&&T.size()==S.size()+1){
  	cout<<"Yes"<<endl;
  }else{
  	cout<<"No"<<endl;
  }
}

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

using namespace std;

using ll = long long;
using ld = long double;

using pll = pair<ll, ll>;
using vll = vector<ll>;
using vpll = vector<pll>;
using gr = vector<vll>;
using wgr = vector<vpll>;

#define pb push_back
#define FOR(i, m, n) for (ll i(m); i < n; i++)
#define REP(i, n) FOR(i, 0, n)
#define F(n) REP(i, n)
#define FF(n) REP(j, n)
struct d_ {
    template<typename T> d_ & operator ,(const T & x) { cerr << ' ' <<  x; return *this;}
    template<typename T> d_ & operator ,(const vector<T> & x) { for(auto x: x) cerr << ' ' <<  x; return *this;}
} d_t;
#define dbg(args ...) { d_t,"|",__LINE__,"|",":",args,"\n"; }
#define EPS (1e-10)
#define INF (1LL<<61)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define all(x) begin(x),end(x)
#define IN(n) ll n;cin >> n;
#define x first
#define y second

int main(void) {
    ios_base::sync_with_stdio(false);
    string s; cin >> s;
    ll n; n = s.size()+1;
    vll d(n);
    ll i = 0;
    while(1) {
        if(i==n-1) break;
        d[i]=0;
        while(i<n-1 && s[i]=='<') { i++; d[i]=d[i-1]+1; }
        while(i<n-1 && s[i]=='>') { i++; }
        ll cur = i-1;
        while(cur >=0 && s[cur]=='>') {
            d[cur] = max(d[cur+1]+1, d[cur]);
            cur--;
        }
    }
    ll ret = 0;
    F(n) ret += d[i];
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 4764
#include <stdio.h>
#include <math.h>

int isPrime(int x){
  int i;
  if(x==2) return 1;

  if(x<2 || x%2==0) return 0;

  i=3;
  while(i<= sqrt(x)){
    if(x%i==0){
      return 0;
    }
    i=i+2;
  }
  return 1;
}

int main(){
  int n,i,x,count=0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%d",&x);
    if(isPrime(x)) count++;
  }

  printf("%d\n",count);
}

  



Measured memory_bytes: 2068
#include <iostream>

using namespace std;

const int N = 1e5 + 7;

int d[N][3];

int abs(int val) {
    return max(val, -val);
}

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


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
vector<int>e[N];
int n,a,b,i,j,dad[N],f[20][N],ff[20][N],sz[N],dfn[N],xb,mx[N];
void dfs(int u,int fa){
	dad[u]=f[0][u]=fa;dfn[++xb]=u;ff[0][u]=u;mx[u]=max(u,mx[fa]);
	for(int v:e[u])if(v!=fa)dfs(v,u);
}
int main(){
	scanf("%d",&n);
	for(i=1;i<n;++i)scanf("%d%d",&a,&b),e[a].push_back(b),e[b].push_back(a);
	dfs(1,0);
	for(i=1;i<20;++i)for(j=1;j<=n;++j)f[i][j]=f[i-1][f[i-1][j]],ff[i][j]=max(ff[i-1][j],ff[i-1][f[i-1][j]]);
	for(i=2;i<=n;++i){
		a=i;
		int z=0;
		for(j=19;j>=0;--j)if(f[j][a]>1 && max(z,ff[j][a])<mx[dad[f[j][a]]])
			z=max(z,ff[j][a]),a=f[j][a];
		++sz[a];
	}
	for(i=2;i<=n;++i)sz[dfn[i]]+=sz[dad[dfn[i]]];
	for(i=2;i<=n;++i)printf("%d ",sz[i]);puts("");
	return 0;
}

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

int main(){
  int sum[2] = {0};

  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 4; j++){
      int x;
      cin >> x;
      sum[i] += x;
    }
  }

  cout << max(sum[0], sum[1]) << endl;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;



int main(){
    int N;
    cin >> N;
    if(N==3){
        cout << "2 5 63\n";
        return 0;
    }
    vector<int> c6,c3,c2,ans;
    for(int i=2;i<=30000;i+=2){
        if(i%3==0) c6.pb(i);
        else c2.pb(i);
    }
    for(int i=3;i<=30000;i+=3){
        if(i%2) c3.pb(i);
    }
    int a=0,b=0,c=1,t=0;
    if(N%2){
        while(N-1!=t){
            if(a+b==15000){
                ans.pb(c6[c]);
                c++;
            }
            else if(t%4==0||t%4==1||b==5000){
                ans.pb(c2[a]);
                a++;
            }
            else{
                ans.pb(c3[b]);
                b++;
            }
            t++;
        }
        if(N%2){
            ans.pb(c6[0]);
        }
    }
    else{
        c=0;
        while(N!=t){
            if(a+b==15000){
                ans.pb(c6[c]);
                c++;
            }
            else if(t%4==0||t%4==1||b==5000){
                ans.pb(c2[a]);
                a++;
            }
            else{
                ans.pb(c3[b]);
                b++;
            }
            t++;
        }
    }
    sort(ALL(ans));
    for(int i=0;i<N;i++){
        cout << ans[i] << (i==N-1?"\n":" ");
    }
    return 0;
}

Measured memory_bytes: 640
#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>;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int minv, maxv;
	cin >> minv >> maxv;
	if (minv <= 0 && maxv >= 0)
	{
		cout << "Zero" << endl;
		return (0);
	}
	if (maxv < 0 && (maxv - minv) % 2 == 0)
	{
		cout << "Negative" << endl;
		return (0);
	}
	cout << "Positive" << endl;
}


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

int main(){
  int D;
  std::cin >> D;

  int i = 25 - D;
  std::string c = "Christmas";
  for(int k = 0 ; k <i ; k++){
    c += " Eve";
  }

  std::cout<<c<<std::endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

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

        for(int i=0;i<n;i++){
            int a = sc.nextInt();
            if(a%2==0){
                if(a%3==0||a%5==0)continue;
                else{
                    System.out.println("DENIED");
                    return;
                }
            }
        }
        System.out.println("APPROVED");
    }

}




Measured memory_bytes: 22996