akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

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 namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  ll n;
  cin>>n;
  vector<ll> d(n);
  rep(i,n) cin>>d[i];

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

  if(n%2==0){

    ll a=d[ n/2 -1 ];
    ll b=d[ n/2  ];

    cout << b-a << endl;    

  }
  else{
    cout << 0 << endl;
  }

  return 0;

}


Measured memory_bytes: 1024
n, k, q = gets.split.map(&:to_i)
ans = Array.new(n)
q.times {
  a = gets.to_i - 1
  ans[a] = ans[a].nil? ? 1 : ans[a] + 1
}
ans.each { |a| puts (k - 1 * (q - (a || 0))).positive? ? 'Yes' : 'No' }


Measured memory_bytes: 3836
n, k = map(int, input().split())
nums = [0]*10**5
total = 0
for i in range(n):
  a, b = map(int, input().split())
  nums[a-1] += b

for i in range(len(nums)):
  total += nums[i]
  if total >= k:
    print(i+1)
    break

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

struct Union_Find
{
    vector <int> parent;
    Union_Find(int N) : parent(N)
    {
        for(int i = 0; i < N; i++) parent[i] = i;
    }
    int root(int n)
    {
        if (parent[n]==n) return n;
        else
        {
            return root(parent[n]);
        }
    }

    void unite(int i,int j)
    {
        int rx,ry;
        rx=root(i);
        ry=root(j);
        if (rx==ry) return;
        else
        {
            int k;
            if (rx<ry)
            {
                parent[ry]=rx;
                return;
            }
            else
            {
                parent[rx]=ry;
                return;
            }
        }
    }
    bool same(int i, int j)
    {
        if (root(i)==root(j)) return true;
        else return false;
    }
};

int main()
{
	int n,q;cin >> n >>q;
	int query,x,y;
	Union_Find solve(n);
	for (int i=0;i<q;i++)
	{
		cin >> query >> x >>y;
		if (!query)
		{
			solve.unite(x,y);
		}
		else
		{
			cout << solve.same(x,y) << endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3136
#include <stdio.h>

int		main(void)
{
	int x;
	int y;

	while (1)
	{
		scanf("%d %d", &x, &y);
		if (x == 0 && y == 0)
			break;
		if (y < x)
			printf("%d %d\n", y , x);
		else
			printf("%d %d\n", x , y);
	}
	return (0);
}



Measured memory_bytes: 2036
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string O,E;cin>>O>>E;
  string ans="";
  for(int i=0; i<E.size(); i++){
    ans+=O[i];
    ans+=E[i];
  }
  if(O.size()-E.size()==1)ans+=O[O.size()-1];
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
#define pp pop_back

const int P = 1000000007;

using namespace std;



int main(){

	ll n, k;
	cin >> n >> k;
	if(k >= n) cout << min(n, abs(n-k)) << endl;
	else cout << min(n%k, k-(n%k)) << endl;

	return 0;
}


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

int N, M;
vector<int> adj[100005];
int dp[100005];

int rec(int node)
{
    if (dp[node] != -1)
        return dp[node];

    int n = adj[node].size();
    if (n == 0)
        return dp[node] = 0;

    dp[node] = 0;
    for (int i = 0; i < n; i++)
    {
        dp[node] = max(dp[node], rec(adj[node][i]) + 1);
    }
    return dp[node];
}

int main()
{
    cin >> N >> M;
    for (int i = 0; i < M; i++)
    {
        int x, y;
        cin >> x >> y;
        adj[x].push_back(y);
    }
    for (int i = 0; i <= N; i++)
        dp[i] = -1;

    for (int i = 1; i <= N; i++)
        dp[i] = rec(i);

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

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

int main() {
  int a,b;
  cin >> a >> b;

  int c = a;
  int d = b;
  for(int i=1;i<a;i++){
    d = d + (b * pow(10,i));
  }
  for(int i=1;i<b;i++){
    c = c + (a * pow(10,i));
  }
  
  string e,f;
  e = to_string(c);
  f = to_string(d);
  if(c>d){
    cout << e << endl;
  }else{
    cout << f << endl;
  }
}

Measured memory_bytes: 512
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

using i8 = ::std::int_least8_t;
using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u8 = ::std::uint_least8_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;
using isize = ::std::ptrdiff_t;
using usize = ::std::size_t;

class rep {
	const usize f, l;

public:
	class itr {
		friend rep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	rep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(f); }
	itr end() const noexcept { return itr(l); }
};
class revrep {
	const usize f, l;

public:
	class itr {
		friend revrep;
		usize i;
		itr(usize x) noexcept : i(x) {}

	public:
		void operator++() noexcept { --i; }
		usize operator*() const noexcept { return i; }
		bool operator!=(const itr x) const noexcept { return i != x.i; }
	};
	revrep(usize first, usize last) noexcept : f(first), l(last) {}
	itr begin() const noexcept { return itr(l - 1); }
	itr end() const noexcept { return itr(f - 1); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}
template <class T> using vec_alias = ::std::vector<T>;
template <class T> auto md_vec(usize n, const T &value) {
	return ::std::vector<T>(n, value);
}
template <class... Args> auto md_vec(usize n, Args... args) {
	return ::std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> const T &as_const(const T &v) noexcept { return v; }

#include <algorithm>
#include <iostream>
#include <utility>

int main() {
	u32 n, a, b;
	::std::cin >> n >> a >> b;
	if (n == 1) {
		::std::cout << "Hello World" << ::std::endl;
	}
	else {
		::std::cout << a + b << ::std::endl;
	}
	return 0;
}


Measured memory_bytes: 256
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
l_m = min(l)

if (n/l_m)%1 == 0:
    print(4+int(n/l_m))
else:
    print(5+int(n/l_m))


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
int n;
int qp(int x,int y)
{
	if(y==0)
		return 1;
	if(y==1)
		return x;
	int ans=qp(x,y/2)*qp(x,y/2)%mod;
	if(y&1)
		ans=ans*x%mod;
	return ans;
}
signed main()
{
	scanf("%lld",&n);
	cout<<((qp(10,n)+qp(8,n))%mod-qp(9,n)*2%mod+mod*2)%mod;
	return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
int main(){
  long N;
  std::cin >> N;
  std::vector<long> A(N+1, 0);
  for(long i = 1; i <= N; ++i){
    std::cin >> A[i];
  }
  std::vector<std::vector<long>> DP(N+1, std::vector<long>(3, 0));
  DP[1][2] = A[1];
  DP[2][2] = std::max(A[1], A[2]);
  if(N == 2){
    std::cout << DP[2][2] << std::endl;
    return 0;
  }
  DP[3][1] = std::max(DP[2][2], A[3]);
  DP[3][2] = A[1] + A[3];
  if(N == 3){
    std::cout << DP[3][1] << std::endl;
    return 0;
  }
  DP[4][1] = std::max(DP[3][1], A[4]);
  DP[4][2] = std::max(DP[3][2], DP[2][2] + A[4]);
  if(N == 4){
    std::cout << DP[4][2] << std::endl;
    return 0;
  }
  for(long i = 5; i <= N; ++i){
    if(i&1){
      DP[i][0] = std::max(DP[i-1][1], DP[i-2][0] + A[i]);
      DP[i][1] = std::max(DP[i-1][2], DP[i-2][1] + A[i]);
      DP[i][2] = DP[i-2][2] + A[i];
    }
    else{
      DP[i][0] = std::max(DP[i-1][0], DP[i-2][0] + A[i]);
      DP[i][1] = std::max(DP[i-1][1], DP[i-2][1] + A[i]);
      DP[i][2] = std::max(DP[i-1][2], DP[i-2][2] + A[i]);
    }
  }
  if(N&1){
    std::cout << DP[N][1] << std::endl;
  }
  else{
    std::cout << DP[N][2] << std::endl;
  }
  return 0;
}


Measured memory_bytes: 15668
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {a[i]=sc.nextInt();}
        int n=sc.nextInt();
        int d[] = new int[n];
        int ans=0,c=0;
        for(int i=0; i<n; i++) {
            if(sc.nextInt() == i+1)c++;
            else {ans += (c+1)/2; c=0;}
        }
        
        ans += (c+1)/2;

        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 35184
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int a[105];
  int minj;
  int co=0;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    minj=i;
    for(int j=i;j<n;j++){
      if(a[j]<a[minj])
	minj=j;
    }
    if(i!=minj){
      swap(a[i],a[minj]);
      co++;
    }
  }
  for(int i=0;i<n;i++){
    cout << a[i];
    if(i+1!=n)cout << " ";
  }
  cout << endl;
  cout << co << endl;
  return 0;
}

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

const int MAXN = 3.1e5;
const int MAXM = 1.1e5;
const int S = 1 << 17;

int seg[2*S];
void update(int i) {
  for (int a = S+i; a; a /= 2) {
    seg[a] ++;
  }
}
int query(int l, int r) {
  int ans = 0;
  for (int a = S+l, b = S+r; a < b; a /= 2, b /= 2) {
    if (a & 1) ans += seg[a++];
    if (b & 1) ans += seg[--b];
  }
  return ans;
}

int N, M;
vector<int> facs[MAXM];
vector<int> rights[MAXM];
long long ans[MAXM];

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> N >> M;
  for (int i = 0; i < N; i++) {
    int l, r; cin >> l >> r;
    rights[l].push_back(r);
  }
  for (int d = 1; d <= M; d++) {
    for (int v = d; v <= M; v += d) facs[v].push_back(d);
  }
  for (int v = 1; v <= M; v++) {
    for (int r : rights[v]) update(r);
    for (int d : facs[v]) ans[d] += query(v, min(M+1, v+d));
  }
  for (int d = 1; d <= M; d++) cout << ans[d] << '\n';
}

Measured memory_bytes: 18304
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll a7=1000000007;
ll inf=1000000000000000;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
 
ll min(ll a,ll b){
    if(a<b)return a;
    return b;
}
ll max(ll a,ll b){
    if(a>b)return a;
    return b;
}

ll hpow(ll x,ll y){
	ll a=x;
  	ll ans=1;
  	while(y>0){
		if(y%2==1){
			ans=(ans*a)%998244353;
        }
      	a=(a*a)%998244353;
      	y=y/2;
    }
  	return ans;
}
	

 ll counter[1000000];
int main(){
    ll n;cin>>n;
  	ll d[n];
  cin>>d[0];
  ll ans=1;
  ll ha;
  ll maxi=-1;
  if(d[0]!=0){
	cout<<0<<endl;
  }else{
    counter[0]=1;
    ha=1;
  	rep(i,1,n-1){
		cin>>d[i];
      	maxi=max(maxi,d[i]);
        counter[d[i]]++;
    }
  	if(counter[0]>1){
		cout<<0<<endl;
    }else{
      	rep(i,1,maxi){
            if(counter[i]==0){
              ans=0;
            }
			ans=(ans*hpow(ha,counter[i]))%998244353;
          	ha=counter[i];
        }
    	cout<<ans%998244353<<endl;
    }
 }
  
    return 0;
}

Measured memory_bytes: 1792
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.ascii;


void main()
{
  auto a = readln.chomp.to!int;
  auto s = readln.chomp;

  if (a >= 3200) {
    writeln(s);
  } else {
    writeln("red");
  }
}


Measured memory_bytes: 256
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N int

func main() {
	sc.Split(bufio.ScanWords)

	N = nextInt()
	a := make([]int, N)
	max := -1
	for i := 0; i < N; i++ {
		a[i] = nextInt()
		max = maxInt(max, a[i])
	}

	ans := 0
	for i := 0; i < N; i++ {
		ans += (a[i] - 1)
	}

	fmt.Println(ans)
}


Measured memory_bytes: 1828
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int MOD = 2019;
bool has[MOD];

int main(){
    fastIO;
    int l, r;
    cin >> l >> r;
    for(int i = l ; i <= min(l + MOD, r); i ++ ){
        has[i % MOD] = true;
    }
    int res = MOD;
    for(int i = 0 ; i < MOD; i ++ ){
        for(int j = i + 1; j < MOD; j ++ ){
            if(has[i] && has[j]){
                res = min(res, (i * j) % MOD);
            }
        }
    }
    cout << res;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] h = new int[n];
        for(int i=0;i<n;i++){
            h[i] = sc.nextInt();
        }
        int count = 1;
        loop: for(int i=1;i<n;i++){
            for(int j=0;j<i;j++){
                if(h[j]>h[i]){
                    continue loop;
                }
            }
            count++;
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 23124
h,n= map(int,input().split())
ab=[[] for _ in range(n)]
for i in range(n):
    ab[i] = list( map(int,input().split()) )


ab.sort(key=lambda x:x[1],reverse=True)


dp=[0]*h
for i in range(n):
    for j in range(min(h,ab[i][0]) ):
        dp[j] = ab[i][1]

for i in range(1,h):
#    print(i,[ (j,i-j-1) for j in range(0,i//2+1) ])
    if dp[i]==0:
        dp[i] = min( dp[j]+dp[i-j-1] for j in range(0,i//2+1)) 
    else:
        dp[i] = min(dp[i] , min( dp[j]+dp[i-j-1] for j in range(0,i//2+1)) )

print(dp[-1])

Measured memory_bytes: 43484
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
ll fir[1000001],sec[1000010],n;
int main()
{
	n=read();n=(1<<n);
	for(register int i=0;i<n;++i) fir[i]=read();
	for(register int i=1;i<=n;i<<=1)
	{
		for(register int j=0;j<n;++j)
		{
			if(j&i)
			{
				ll a1=fir[j^i];ll a2=sec[j^i];
				if(a1>fir[j]){sec[j]=max(fir[j],a2);fir[j]=a1;}
				else sec[j]=max(a1,sec[j]);
			}
		}
	}
	ll a=0,d=0;
	for(register int j=1;j<n;++j)
	{
		if(a+d<fir[j]+sec[j]) a=fir[j],d=sec[j];
		cout<<a+d<<"\n";
	}
	return 0;
}


Measured memory_bytes: 11264
import java.util.*;


class Main{
	public static void main(String args[]){
		
		Scanner sc=new Scanner(System.in);
		
		int k=sc.nextInt();
		int n=sc.nextInt();
		
		if(n==1){
			System.out.println(k);
			System.exit(0);
		}
		
		int a[]=new int[n];
		
		for(int i=0;i<n;i++){
			a[i]=sc.nextInt();
		}
		
		int max=0;
		for(int i=1;i<n;i++){
			if(i==n-1){
				if(max<k-a[i]+a[0])max=k-a[i]+a[0];
			}
			if(max<a[i]-a[i-1])max=a[i]-a[i-1];
		}
		
		System.out.println(k-max);
		
		
	}
}
	




Measured memory_bytes: 65256
//a
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		if(N==25) System.out.println("Christmas");

		else if(N==24)System.out.println("Christmas Eve");

		else if(N==23) System.out.println("Christmas Eve Eve");

		else if(N==22)  System.out.println("Christmas Eve Eve Eve");

	}

}


Measured memory_bytes: 21716
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	int A, B;
	cin >> A >> B;

	if(A==2 || B==2)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;

int n;
vector<int> w;
vector<bool> seen;
vector<int> a;
vector<int> t;
int min_w = MAX;

int calc_cycle(int s) {
  seen[s] = true;
  int cycle_min_w = w[s];
  int cycle_len = 1;
  int next =  t[w[s]];
  int cycle_sum = w[s];
  if (next == s) return 0;
  while (!seen[next]) {
    seen[next] = true;
    cycle_min_w = min(cycle_min_w, w[next]);
    cycle_len ++;
    cycle_sum += w[next];
    next = t[w[next]];
  }
  return min(cycle_sum + (cycle_len - 2) * cycle_min_w, cycle_sum + cycle_min_w + (cycle_len + 1) * min_w);
}

int main() {
  cin >> n;
  w.resize(n);
  seen.resize(n, false);
  t.resize(MAX);
  for (int i = 0; i < n; i++) {
    cin >> w[i];
    min_w = min(min_w, w[i]);
  }

  a = w;
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    t[a[i]] = i;
  }

  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (seen[i]) continue;
    ans += calc_cycle(i);
  }
  cout << ans << endl;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)

#define CHMIN(a, b) (a) = min((a), (b))
#define CHMAX(a, b) (a) = max((a), (b))

#define DEBUG(x) cout << #x << ": " << (x) << endl
#define PRINT(x) cout << x << endl
#define all(x) x.begin(),x.end()


// ll Euclid(ll A,ll B){
//     ll r=-1;
//     if(A<B){
//         swap(A,B);
//     }
    
//     while(r!=0){
//         r = A%B;
//         A = B;
//         B = r;
//     }

//     return A; GCDの実装の方が綺麗
// }

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

int main() {
    int N;
    ll X;

    cin >> N >> X;

    vl x(N);
    vl dist(N);

    REP(i,N){
        cin >> x[i];
        dist[i] = abs(X-x[i]);
    }

    //input end

    ll D;  //距離の最大公約数を求めれば良い？

    D = dist[0];
    REP(i,N){
        D = GCD(D,dist[i]);
    }

    cout << D << endl;



}



Measured memory_bytes: 1792
//
//  main.cpp
//  2
//
//  Created by RISHAV SINGH MEHTA on 01/12/19.
//  Copyright © 2019 RISHAV SINGH MEHTA. All rights reserved.
//

#include <iostream>
#define ll long long
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    ll int n,i,j,k,l=0;
    cin>>n;bool h=false;
    for (i=1; i<=n; i++) {
        k=i*(1.08);
        if (k == n) {
            l=i;
            h=true;
            break;
        }
        
    }
    if (h == true) {
        cout<<l<<endl;
    }else{
        cout<<":("<<endl;
    }
    return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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



int n, k, a[202020];
int dp[202020];
void solve(){
	cin >> n >> k;
	i64 sum = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		sum += a[i];
	}
	sort(a,a+n);
	
	int l = 0, r = a[n-1];
	while(r-l > 1){
		int c = (l+r)/2;
		int cnt = 0;
		int ma = 0;
		for(int i = 0; i < n; i++){
			cnt += (a[i]+c-1)/c -1;
		}
		if(cnt <= k){
			r = c;
		}
		else{
			l = c;
		}
	}
	cout << r << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 4396
package main

import "fmt"

var n, m int

type edge struct {
	a, b int
}

var graph [][]int
var seen []bool

func main() {
	fmt.Scan(&n, &m)
	edges := make([]edge, m)
	for i := 0; i < m; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		a--
		b--
		edges[i].a = a
		edges[i].b = b
	}
	ans := 0
	for i := 0; i < m; i++ {
		// 辺iを除いたグラフを作って、全ての頂点を辿れるかチェック
		graph = make([][]int, n)
		seen = make([]bool, n)
		for j := 0; j < m; j++ {
			if i != j {
				graph[edges[j].a] = append(graph[edges[j].a], edges[j].b)
				graph[edges[j].b] = append(graph[edges[j].b], edges[j].a)
			}
		}
		seen[0] = true
        if !dfs(0) {
			ans++
		}
	}
	fmt.Println(ans)
}

func dfs(v int) bool { // 深さ優先探索 - 全ての頂点を訪れることができればtrueを返す
	seen[v] = true
	visited := 0
	for i := 0; i < len(seen); i++ {
		if seen[i] {
			visited++
		}
	}
	if visited == len(seen) {
		return true
	}
	for i := 0; i < len(graph[v]); i++ {
		if seen[graph[v][i]] {
			continue
		}
		if dfs(graph[v][i]) {
			return true
		}
	}
	return false
}


Measured memory_bytes: 640
module Point = struct

  type t = { x : float; y : float }

  let make x y = { x; y }

  let equal_p a b = abs_float (a.x -. b.x) < 1e-10 && abs_float (a.y -. b.y) < 1e-10

  let sum a b = { x = a.x +. b.x; y = a.y +. b.y }

  let diff a b = { x = a.x -. b.x; y = a.y -. b.y }

  let multi p k = { x = p.x *. k; y = p.y *. k }

  let div p k = { x = p.x /. k; y = p.y /. k }

  let norm p = p.x *. p.x +. p.y *. p.y

  let abs p = norm p |> sqrt

  let dot a b = a.x *. b.x +. a.y *. b.y

  let cross a b = a.x *. b.y -. a.y *. b.x

  let project p1 p2 p =
    let base = diff p2 p1 in
    dot (diff p p1) base /. norm base |> multi base |> sum p1

  let reflect p1 p2 p = multi (diff (project p1 p2 p) p) 2. |> sum p

  let orthogonal_p (p0, p1) (p2, p3) = dot (diff p0 p1) (diff p2 p3) = 0.

  let parallel_p (p0, p1) (p2, p3) = cross (diff p0 p1) (diff p2 p3) = 0.

  let ccw p0 p1 p2 =
    let eps = 1e-10 in
    let a = diff p1 p0 in
    let b = diff p2 p0 in
    let c = cross a b in
    if c > eps then 1 (* COUNTER_CLOCKWISE *)
    else if c < (-. eps) then (-1) (* CLOCKWISE *)
    else if dot a b < (-. eps) then 2 (* ONLINE_BACK *)
    else if norm a < norm b then (-2) (* ONLINE_FRONT *)
    else 0 (* ON_SEGMENT *)

  let intersect_p (p0, p1) (p2, p3) =
    ccw p0 p1 p2 * ccw p0 p1 p3 <= 0 && ccw p2 p3 p0 * ccw p2 p3 p1 <= 0

  let cross_point (p0, p1) (p2, p3) =
    let base = diff p3 p2 in
    let d1 = diff p0 p2 |> cross base |> abs_float in
    let d2 = diff p1 p2 |> cross base |> abs_float in
    d1 /. (d1 +. d2) |> multi (diff p1 p0) |> sum p0

  let distance s t =
    if intersect_p s t then 0.
    else
      let p2p a b = diff a b |> abs in
      let l2p (p0, p1) p =
        cross (diff p1 p0) (diff p p0) /. p2p p1 p0 |> abs_float in
      let s2p s p =
        let (p0, p1) = s in
        if dot (diff p1 p0) (diff p p0) < 0. then p2p p p0
        else if dot (diff p0 p1) (diff p p1) < 0. then p2p p p1
        else l2p s p in
      let (p0, p1) = s in
      let (p2, p3) = t in
      min (min (s2p s p2) (s2p s p3)) (min (s2p t p0) (s2p t p1))

end

module IO = struct

  (* @since 4.04.0 *)
  let split_on_char sep s =
    let open String in
    let r = ref [] in
    let j = ref (length s) in
    for i = length s - 1 downto 0 do
      if get s i = sep then begin
        r := sub s (i + 1) (!j - i - 1) :: !r;
        j := i
      end
    done;
    sub s 0 !j :: !r

  let read_fs () = read_line () |> split_on_char ' ' |> List.map float_of_string

end

open Point

let () =
  let q = read_int () in
  for _ = 0 to q - 1 do
    match IO.read_fs () with
    | x0 :: y0 :: x1 :: y1 :: x2 :: y2 :: x3 :: y3 :: _ ->
      let s = (make x0 y0, make x1 y1) in
      let t = (make x2 y2, make x3 y3) in
      distance s t |> Printf.printf "%.10f\n"
    | _ -> assert false
  done

Measured memory_bytes: 3888
S = input()

flg = True

if S[0] != 'A':
    flg = False

cnt = 0

for i in range(2, len(S) - 1):
    if S[i] == 'C':
        cnt += 1

if cnt != 1:
    flg = False

cnt = 0

for i in range(len(S)):
    if 'A' <= S[i] <= 'Z':
        cnt += 1

if cnt != 2:
    flg = False

print("AC" if flg else "WA")


Measured memory_bytes: 3060
def solve(data, m)
  return 0 if m == 0
  cands = []
  [-1, 1].each do |a|
    [-1, 1].each do |b|
      [-1, 1].each do |c|
        o = []
        data.each do |x, y, z|
          o << a*x + b*y + c*z
        end
        cands << o.sort[-m..-1].inject(:+)
      end
    end
  end
  cands.max
end

def solve_naive(data, m)
  data.combination(m).map do |v|
    a = b = c = 0
    v.each do |x,y,z|
      a += x
      b += y
      c += z
    end
    a.abs + b.abs + c.abs
  end.max
end

if $stdin.tty?
  m = 0
  n = 3
  #data = n.times.map{3.times.map{rand(-10000000000..10000000000)}}
  1000.times do
    data = n.times.map{3.times.map{rand(-1..1)}}
    a = solve(data, m)
    b = solve_naive(data, m)
    puts [a, b]*"\t"+"     \r"
    if a != b
      p data
      raise
    end
  end
  exit
end

n, m = gets.split.map(&:to_i)
data = n.times.map{ gets.split.map(&:to_i) }

p solve(data, m)

Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

int k;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> k;
    vector <int> dist(k, (int)1e9);
    dist[1] = 1;
    deque <int> bfs;
    bfs.push_back(1);
    while(bfs.size()){
        int cur = bfs.front();
        bfs.pop_front();
        if(dist[cur] + 1 < dist[(cur + 1) % k]){
            dist[(cur + 1) % k] = dist[cur] + 1;
            bfs.push_back((cur + 1) % k);
        }
        if(dist[cur] < dist[10 * cur % k]){
            dist[10 * cur % k] = dist[cur];
            bfs.push_back(10 * cur % k);
        }
    }
    cout << dist[0] << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  string s;
  cin >> s;
  s.at(5) = ' ';
    s.at(13) = ' ';
    
  for(int i = 0; i < 19; i++){
  cout << s.at(i);
  }
  
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 100005;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,l;
    cin >> n >> l;
    ll cnt = 0;
    vector<P> apple;
    rep(i,n){
        if (l+i >= 0) apple.push_back(P(l+i,1));
        else apple.push_back(P(abs(l+i),-1));
        cnt += l+i;
    }
    SORT(apple);
    PRINT(cnt-apple[0].first*apple[1].second);
}




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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	int n,k; cin >> n >> k;
	int d[11] = {0};
    rep(i, k){
        int a;
        cin >> a;
        d[a] = 1;
    }
    
    while(1){
        bool flag = false;
        int a=n;
        while(1){
            if(a == 0)break;
            if(d[a % 10] == 1){
                flag = true;
                break;
            }
            a /= 10;
        }
        if(!flag){
            cout << n << endl;
            break;
        }
        n++;
    }

	return 0;
}


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

typedef long long ll;
const int MOD = 1000000007;

int main(){
  int K, X;
  cin >> K >> X;
  if(500 * K >= X){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

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

    char k = n[n.length()-1];
    if(k=='2'||k=='4'||k=='5'||k=='7'||k=='9')
        cout<<"hon"<<endl;
    else if(k=='3')
        cout<<"bon"<<endl;
    else
        cout<<"pon"<<endl;

    return 0;
}





Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) < (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n) - 1; (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

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

ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b;
}

ll fac(ll n){
    ll t = 1;
    rep1(i, n + 1)t *= i;
    return t;
}

int main()
{
    ll n,a,cnt = 0,ans = 1;
    cin >> n;
    vector<ll> p(n,0);
    rep0(i, n){
        cin >> a;
        ++p[a];
    }
    if(n%2 == 1) {
        --p[0];
    }
    rep0(i, n){
        if(p[i] != 0 && p[i] != 2){
            cout << 0 << endl;
            return 0;
        }else if(p[i] == 2){
            ++cnt;
        }
    }
    rep0(i, cnt){
        ans *= 2;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define MOD 1000000007

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100000;

int par[MAX_N];
int rank[MAX_N];

void initial(int n){		//?????????
	for(int i=0;i<n;i++){
		par[i] = i;
		rank[i] = 0;
	}
}

int find(int x){		//??¨??????????±???????
	if(par[x] == x){
		return x;
	}else{
		return par[x] = find(par[x]);
	}
}

void unite(int x,int y){
	x = find(x);
	y = find(y);
	if(x == y) return;
	if(rank[x] < rank[y]){
		par[x] = y;
	}else{
		par[y] = x;
		if(rank[x] == rank[y])
			rank[x]++;
	}
}

bool same(int x,int y){
	return find(x) == find(y);
}

int main()
{
	int n,m,q;
	int a,b;
	cin >> n;
	cin >> m;
	initial(n);
	for(int i=0;i<m;i++){
		cin >> a;
		cin >> b;
		unite(a,b);
	}
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> a;
		cin >> b;
		if(same(a,b)){
			cout << "yes\n";
		}else{
			cout << "no\n";
		}
	}
}

Measured memory_bytes: 3844
import sys
inputs = sys.stdin.readlines()

from itertools import groupby
S = inputs[0].strip()
K = int(inputs[1])

if len(set(S)) == 1:
    print(K*len(S) // 2)
else:
    counts = [len(list(g)) for k, g in groupby(S)]
    if S[0] == S[-1] and counts[0] % 2 == counts[-1] % 2 == 1:
        t = 1
        counts[0] += counts.pop()
    else:
        t = 0
    print(K*sum(map(lambda x: x//2, counts)) - t)

Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<vector>
#include<functional>
#include<string.h>
#include<set>

const int MAXN = 1e5;
const int MAX_E = 5e5;
const long long INF = ((long long)1<<62) - 1;
struct Edge
{
	int vx;
	long long w;

	bool operator < (const Edge& e) {
		return w < e.w;
	}
};

struct NodeInfo {
	int vx;
	long long *d;

	bool operator < (const NodeInfo& node) {
		return (*d) < *(node.d);
	}
};

std::vector<Edge> graph[MAXN];
long long dist[MAXN];
int pre_vx[MAXN];
int visit[MAXN];
int V, E, r;

void init() {
	int n = V;
	while (n--) {
		dist[n] = INF;
	}
	memset(pre_vx, -1, sizeof(pre_vx));
	memset(visit, 0, sizeof(pre_vx));
}

void input() {
	scanf("%d%d%d", &V, &E, &r);
	for (int i = 0; i < E; i++) {
		int s, t, w;
		scanf("%d%d%d", &s, &t, &w);
		graph[s].push_back({ t, w });
	}
}

void dij_sp() {
	dist[r] = 0;
	std::priority_queue< std::pair<long long, int >, std::vector< std::pair<long long, int> >,
		std::greater< std::pair<long long, int> > > pq;
	pq.push(std::make_pair(0, r));
	while (!pq.empty()) {
		int u = pq.top().second;
		pq.pop();
		if (visit[u]) { continue; }
		if (dist[u] == INF) { return; }
		for (std::vector<Edge>::iterator it = graph[u].begin(); it != graph[u].end(); it++) {
			int v = it->vx;
			if (visit[v]) { continue; }
			if (dist[v] > dist[u] + it->w) {
				dist[v] = dist[u] + it->w;
				pq.push(std::make_pair(dist[v], v));
			}
		}
		//mark visited
		visit[u] = 1;
	}
}

void output() {
	for (int i = 0; i < V; i++) {
		if (i == r) {
			printf("0\n");
		}
		else {
			if (dist[i] == INF) {
				printf("INF\n");
			}
			else {
				printf("%lld\n", dist[i]);
			}
		}
	}
}

/**
*http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A
*/
int main() {
	input();
	init();
	dij_sp();
	output();
	return 0;
}


Measured memory_bytes: 19820
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
const long long INFLL = 1LL << 60;
const int INFINT = 1 << 30;
const long long MOD = 1e9 + 7;

template <class T> void vecout(T V) {
    auto t = V.begin();
    while(t != V.end()) {
        cout << *t++;
        if(t != V.end()) cout << " ";
    }
    cout << endl;
};

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

    int n, q, c, b, e;
    cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    cin >> q;
    rep(i, q) {
        cin >> c >> b >> e;
        if(c == 0)
            cout << *min_element(v.begin() + b, v.begin() + e) << "\n";
        else
            cout << *max_element(v.begin() + b, v.begin() + e) << "\n";
    }
}



Measured memory_bytes: 3228
#include <stdio.h>
#define max(x,y) ((x)>(y)?(x):(y))
#define min(x,y) ((x)<(y)?(x):(y))
#define FOR(i,m,n) for(i=m;i<n;i++)

void show(int a[])
{
//	for (int i = 0; i < 10; i++)
//		printf("%d ", a[i]);
//	printf("\n");
}

void quicksort(int a[], int left, int right)
{

	int p;	//中央値
	int L = left, R = right;		//ループ中で変化するleft、right
	int temp;
	p = a[(left + right) / 2];

	while (1)
	{
		while (a[L] < p) L++; while (a[R] > p)
			R--;
		
		if (L >= R)
			break;

		temp = a[R];
		a[R] = a[L];
		a[L] = temp;

		L++;
		R--;
	}

	show(a);

	if (left < L - 1) quicksort(a, left, L - 1); if (right > R + 1)
		quicksort(a, R + 1, right); 
	
}

int main(void)
{
	int a,b,c[100010],i,d[100010];
	long long x=0;
	scanf("%d %d",&a,&b);
//	if(a>=b){
//		a=3;
//	}
	for(i=0;i<b;i++){
		scanf("%d",&c[i]);
	}
	quicksort(c,0,b-1);
	for(i=0;i<b-1;i++){
		d[i]=c[b-i-1]-c[b-i-2];
	}
	quicksort(d,0,b-2);
	for(i=0;i<b-a;i++){
		x=x+d[i];
	}
	if(a>=b){
		printf("%d\n",0);
	}else{
		printf("%lld\n",x);
	}
	return 0;
}

Measured memory_bytes: 896
#include<cstdio>
#include<iostream>
using namespace std;
int mi[200010];
int n,m,a,b;
const int mod=1000000007;
int ans=0;
int fast_pow(int a,int x)
{
	int ans=1;
	for (int i=x;i;i>>=1,a=1ll*a*a%mod)
		if (i&1) ans=1ll*ans*a%mod;
	return ans;
}
int C(int n,int m)
{
	return ((1ll*mi[m]*fast_pow(mi[n],mod-2))%mod*1ll*fast_pow(mi[m-n],mod-2))%mod;
}
int main()
{
	scanf("%d%d%d%d",&n,&m,&a,&b);
	mi[0]=1;
	for (int i=1;i<=n+m;i++)
	{
		mi[i]=1ll*mi[i-1]*i%mod;
	}
	ans=C(n-1,n+m-2);
	for (int i=n-a+1;i<=n;i++)
	{
		int t=1ll*C(i-1,b+i-2)*C(n-i+1-1,m-b+1+n-i+1-3)%mod;
	//	cout<<i-1<<" "<<b+i-2<<" "<<n-i<<" "<<m+n-b-i<<" "<<t<<endl;
		ans=(1ll*ans+mod-t)%mod;
	}
	printf("%d",ans);
} 

Measured memory_bytes: 1024
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N = int(input())
S = []
for i in range(N):
    s = input().rstrip()
    S.append(sorted(s))

#print(S)

base = S.pop()
ans = []
for i in range(len(base)):
    expect = base[i]
    for j in S:
        if expect in j:
            continue
        else:
            expect = False
            break
    else:
        ans.append(expect)
        for j in range(len(S)):
            x = S[j].index(expect)
            S[j].pop(x)

print(''.join(ans))

Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;


int main(){
    int n;
    cin >> n;
    int ans = 0;
    while(n > 0){
        int cnt = 0;
        int t = n;
        while (t > 0){
            cnt += 1;
            t /= 10;
        }
        if (cnt % 2 == 1) ans += 1;
        n -= 1;
    }
    cout << ans;
}


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

int main(){
    ll A,B,C;
    cin >> A >> B >> C;
    if(A == B && B == C)
        cout << "Yes" << "\n";
    else 
        cout << "No" << "\n";
    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#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++)
using namespace std;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) cout << "bust";
  else cout << "win" << endl;
}


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

using namespace std;

typedef long long ll;

int chk(ll W, ll H, ll x, ll y){
	if(W & 1) return 0;
	if(H & 1) return 0;

	if(W / 2 == x && H / 2 == y) {
		return 1;
	}else{
		return 0;
	}

}

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

	ll W, H, x, y;
	cin >> W >> H >> x >> y;

	double area = 1.0 * W * H / 2;
	int amb = chk(W, H, x, y);
	cout << fixed << setprecision(11);
	cout << area << " " << amb << endl;

}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9


	int main() {
		int zero = 0, one = 0, type = 0, ans = 0;
		string s;
		cin >> s;
		char a[100001];
		/*for (int i = 0; i < s.size(); i++) {
		a[i] = s[i];
		}*/
		//s[s.size()] = 99;
		for (int i = 0; i < s.size(); i++) {
			if (s[i] == '0') { zero++; }
			else { one++;  }
		}
		ans += min(zero, one) * 2;

		

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

Measured memory_bytes: 512
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;

template< typename flow_t >
struct FordFulkerson {
  struct edge {
    int to;
    flow_t cap;
    int rev;
    bool isrev;
  };

  vector< vector< edge > > graph;
  vector< int > used;
  const flow_t INF;
  int timestamp;

  FordFulkerson(int n) : INF(numeric_limits< flow_t >::max()), timestamp(0) {
    graph.resize(n);
    used.assign(n, -1);
  }

  void add_edge(int from, int to, flow_t cap) {
//  	printf("(from, to) = (%d, %d)\n", from, to);
    graph[from].emplace_back((edge) {to, cap, (int) graph[to].size(), false});
    graph[to].emplace_back((edge) {from, 0, (int) graph[from].size() - 1, true});
  }

  flow_t dfs(int idx, const int t, flow_t flow) {
    if(idx == t) return flow;
    used[idx] = timestamp;
    for(auto &e : graph[idx]) {
      if(e.cap > 0 && used[e.to] != timestamp) {
        flow_t d = dfs(e.to, t, min(flow, e.cap));
        if(d > 0) {
          e.cap -= d;
          graph[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }

  flow_t max_flow(int s, int t) {
    flow_t flow = 0;
    for(flow_t f; (f = dfs(s, t, INF)) > 0; timestamp++) {
      flow += f;
    }
    return flow;
  }

  void output() {
    for(int i = 0; i < graph.size(); i++) {
      for(auto &e : graph[i]) {
        if(e.isrev) continue;
        auto &rev_e = graph[e.to][e.rev];
        cout << i << "->" << e.to << " (flow: " << rev_e.cap << "/" << e.cap + rev_e.cap << ")" << endl;
      }
    }
  }
};

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

int main(){
	while(1){
		int M, N, i, j;
		scanf("%d%d", &M, &N);
		if(N == 0 && M == 0){
			return 0;
		}
		vector<int> b(M), r(N);
		for(i = 0; i < M; i++){
			scanf("%d", &b[i]);
		}
		for(i = 0; i < N; i++){
			scanf("%d", &r[i]);
		}
		FordFulkerson<int> g(N + M + 2);
		for(i = 1; i <= M; i++){
			g.add_edge(0, i, 1);
		}
		for(i = M + 1; i <= M + N; i++){
			g.add_edge(i, M + N + 1, 1);
		}
		for(i = 0; i < M; i++){
			for(j = 0; j < N; j++){
				if(gcd(b[i], r[j]) > 1){
					g.add_edge(1 + i, M + 1 + j, 1);
				}
			}
		}
		printf("%d\n", g.max_flow(0, N + M + 1));
	}
}


Measured memory_bytes: 8808
import math


times = input().split()
zahyou = [] 
count = 0

for i in range(int(times[0])):
  list = input().split()
  zahyou.append(list)
  
for i in range(int(times[0])-1):
  for k in range(i+1,int(times[0])):
    result = 0
    for j in range(int(times[1])):
       point1 = zahyou[i][j]
       point2 = zahyou[k][j]
       result += (int(point1) - int(point2))**2
  
    result2 = str(math.sqrt(result)).split(".")
    if result == int(result2[0])**2:
      count += 1
    
print(count)

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

int main(){
  int h, n;
  long long int tmp;
  cin >> h >> n;
  for(int i=0;i<n;i++){
    cin >> tmp;
    h-=tmp;
  }

  if(h>0)cout << "No" << endl;
  else cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define VI vector<int>
#define VVI vector<vector<int>>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
#define INF 1e9
#define All(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;

ll mpow(ll a,ll n){
  ll res=1;
  while(n>0){
    if(n&1)res=res*a;
    a=a*a;
    n>>=1;
  }
  return res;
}

int main() {
  ll X;
  cin >> X;
  vector<ll> k;
  ll max_a = 1e11;
  int m = 0;
  while (1) {
    ll a = mpow(m, 5);
    if(a==X){
      cout << m <<" "<< 0 << endl;
      return 0;
    }
    k.push_back(a);
    if (k[m] > max_a) {
      break;
    }
    m++;
  }
  for (int i = 0; i < (int)k.size(); i++) {
    for (int j = 0; j < (int)k.size(); j++) {
      if (k[i] - k[j] == X) {
        cout << i << " " << j << endl;
        return 0;
      } else if (k[i] + k[j] == X) {
        cout << i << " " << (j*-1) << endl;
        return 0;
      }
    }
  }

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

int n, m, in, xx, yy;
int maxa = -1000;
int minb = 1000;


int main() {
  //  freopen("a.in", "r", stdin);
  //  freopen("a.out", "w", stdout);
  scanf("%d%d", &n, &m);
  scanf("%d%d", &xx, &yy);
  for(int i = 1; i <= n; i++)
    scanf("%d", &in), maxa = max(maxa, in);
  for(int i = 1; i <= m; i++)
    scanf("%d", &in), minb = min(minb, in);
  bool flag = false;
  if(xx >= minb) flag = true;
  if(maxa >= minb) flag = true;
  if(xx >= yy) flag = true;
  if(maxa >= yy) flag = true;
  if(flag) puts("War");
  else puts("No War");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	while(1){
		cin>>n>>k;
		if(n==0)	return 0;
		bool a[n+1];
		for(int i=0;i<=n;i++)	a[i]=false;
		int input;
		for(int i=0;i<k;i++){
			cin>>input;
			a[input]=true;
		}
		if(!a[0]){
			int ans=0,cnt=0;
			for(int i=1;i<=n;i++){
				if(a[i])	cnt++;
				else{
					ans=max(ans,cnt);
					cnt=0;
				}
			}
			cout<<max(ans,cnt)<<endl;
			continue;
		}
		int cnt=0;
		vector<int> data;
		for(int i=1;i<=n;i++){
			if(a[i])	cnt++;
			else{
				data.push_back(cnt);
				cnt=0;
			}
		}
		data.push_back(cnt);
		int ans=0;
		for(int i=1;i<(int)data.size();i++){
			ans=max(ans,data[i-1]+data[i]+1);
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1440