akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

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

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

void solve() {
    ll a, b, c, d, e, f, g;
    sc(a, b, c, d, e, f, g);
    ll ans = 2 * b + 4 * ((a / 2) + (d / 2) + (e / 2));
    if(min({a, d, e}) >= 1) {
        a--, d--, e--;
        ans = max(ans, 2 * b + 6 + 4 * (a / 2 + d / 2 + e / 2));
    }
    cout << ans / 2;
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 3604
#include<stdio.h>
int main(void)
{
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if((x-r>=0)&&(y-r>=0)&&(x+r<=W)&&(y+r<=H)){
		printf("Yes\n");
	}else{
		printf("No\n");
	}

	return 0;
}



Measured memory_bytes: 2128
package main

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

const (
	initialBufSize = 1024
	maxBufSize     = 1e6
)

var (
	scanner = bufio.NewScanner(os.Stdin)
)

const (
	Rock     byte = 'r'
	Scissors byte = 's'
	Paper    byte = 'p'
)

func main() {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, initialBufSize), maxBufSize)
	n, k, r, s, p := scanInt(), scanInt(), scanInt(), scanInt(), scanInt()
	point := make(map[byte]int, 3)
	point[Rock] = r
	point[Scissors] = s
	point[Paper] = p

	t := []byte(scanText())
	selected := make([]byte, n)
	ans := 0
	for i := 0; i < n; i++ {
		prev := (i - k)
		rsp := win(t[i])
		if prev < 0 || selected[prev] != rsp {
			ans += point[rsp]
			selected[i] = rsp
			continue
		}
	}

	fmt.Println(ans)
}

func win(rsp byte) (w byte) {
	switch rsp {
	case Rock:
		w = Paper
	case Scissors:
		w = Rock
	case Paper:
		w = Scissors
	}
	return
}

func scanInt() int {
	i, _ := strconv.Atoi(scanText())
	return i
}

func scanInts(size int) []int {
	ints := make([]int, size)
	for i := 0; i < size; i++ {
		ints[i] = scanInt()
	}
	return ints
}

func scanFloat64() float64 {
	f, _ := strconv.ParseFloat(scanText(), 64)
	return f
}

func scanFloat64s(size int) []float64 {
	f := make([]float64, size)
	for i := 0; i < size; i++ {
		f[i] = scanFloat64()
	}
	return f
}

func scanText() string {
	scanner.Scan()
	return scanner.Text()
}

func scanTexts(size int) []string {
	s := make([]string, size)
	for i := 0; i < size; i++ {
		s[i] = scanText()
	}
	return s
}

func abs(n int) int {
	return int(math.Abs(float64(n)))
}

func pow(x, y int) int {
	return int(math.Pow(float64(x), float64(y)))
}

func min(n []int) (min, idx int) {
	min = math.MaxInt64
	for i := 0; i < len(n); i++ {
		if n[i] < min {
			min = n[i]
			idx = i
		}
	}
	return
}

func max(n []int) (max, idx int) {
	max = math.MinInt64
	for i := 0; i < len(n); i++ {
		if n[i] > max {
			max = n[i]
			idx = i
		}
	}
	return
}


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

int main()
{
  char c;
  cin >> c;
  if (c >= 'A' && c <= 'Z') {
    cout << "A" << endl;
  }
  else {
    cout << "a" << endl;
  }
  return 0;
}


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

int main() {
    
 
    
    vector<int> S(3);
    cin>>S.at(0)>>S.at(1)>>S.at(2);
    sort(S.begin(),S.end());
    cout<<S.at(0)<<" "<<S.at(1)<<" "<<S.at(2)<<endl;
}



Measured memory_bytes: 3148
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		sa = br.readLine().split(" ");
		int[] b = new int[n];
		for (int i = 0; i < n; i++) {
			b[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		long suma = 0;
		long sumb = 0;
		long sumab = 0;
		long sumba = 0;
		for (int i = 0; i < n; i++) {
			suma += a[i];
			sumb += b[i];
			if (a[i] > b[i]) {
				sumab += a[i] - b[i];
			} else {
				sumba += (b[i] - a[i] + 1) / 2;
			}
		}

		long d = sumb - suma;
		if (sumab <= d && sumba <= d) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 28116
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,from,n) for(int i = from; i < n; i++)
#define mreps(i,from,n) for(int i = from; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
typedef long long ll;
typedef pair<ll, ll> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
ll MOD = 1000000007;

ll comb[55][30]={-1};

ll comb_rec(ll a, ll b)
{
	if(a/2 < b)return comb_rec(a,a-b);
	if(b==0)return 1;
	if(comb[a][b]>0)return comb[a][b];
	return comb[a][b]=comb_rec(a-1,b)+comb_rec(a-1,b-1);
}

void solve()
{
	int n,p; cin >> n >> p;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	ll odd = 0,even=0;
	rep(i,n)if(a[i]%2)odd++;else even++;
	ll ans=0,ev=0;
	for(ll k = 0;k <= even; k++)ev+=comb_rec(even,k);
	ll i;
	if(p) i = 1;
	else i = 0;
	for (i; i <= odd; i+=2)
	{
		ans+=ev*comb_rec(odd,i);
	}
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 256
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let a: i8 = s.next().unwrap().parse().unwrap();
	let b: i8 = s.next().unwrap().parse().unwrap();
	println!("{}", a ^ b);
}


Measured memory_bytes: 4352
from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
from fractions import Fraction
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

for _ in range(II()):
    if II()&1:
        print("first")
        exit()
print("second")

Measured memory_bytes: 10408
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int a,b;
bool f[4];
int main() {
	scanf("%d%d",&a,&b);
	f[a]=f[b]=true;
	if (!f[1]) puts("1");
	else if (!f[2]) puts("2");
	else puts("3");
	return 0;
}

Measured memory_bytes: 256
use v6;

sub ask($n) {
  say $n;
  my $s = get;
  exit if $s eq 'Vacant';
  $s
}

sub has-vac($diff, $same) {
  $diff %% 2 ?? !$same !! $same;
}

my $n = +get;

my $zero = ask 0;

my $half = ask($n div 2);

my ($l, $r, $ls);

if has-vac($n div 2, $zero eq $half) {
  $l = 0;
  $r = $n div 2;
  $ls = $zero;
}
else {
  $l = $n div 2;
  $r = $n;
  $ls = $half;
}

while ($r - $l) > 1 {
  my $m = ($l + $r) div 2;
  my $ans = ask $m;
  if has-vac($m - $l, $ans eq $ls) {
    $r = $m;
  }
  else {
    $l = $m;
    $ls = $ans;
  }
}


Measured memory_bytes: 57552
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repa(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define _GLIBCXX_DEBUG

int main(){
  
  int a, b, c;
  cin >> a >> b >> c;
  if(a == b && b == c)
    cout << 1 << endl;
  else if(a == b || b == c || c == a)
    cout << 2 << endl;
  else
    cout << 3 << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    string s;
    cin >> s;
    int len = s.size();
    vector<int> n(len);
    rep(i, len) n.at(len - i - 1) = s.at(i) - '0';
    n.push_back(0);
    len++;
    
    const int INF = 1000000000;
    //dp[i][0] i桁目以下がn以上の場合の枚数の最小値
    //dp[i][1] i桁目以下がn未満の場合の枚数の最小値
    vector<vector<int>> dp(len + 1, vector<int>(2, INF));
    dp[0][0] = 0;
    rep(i, len) rep(a, 10) {
        if (a >= n[i]) chmin(dp[i + 1][0], dp[i][0] + a + (a - n[i]));
        if (a >= n[i] + 1) chmin(dp[i + 1][0], dp[i][1] + a + (a - 1 - n[i])); 
        if (a < n[i]) chmin(dp[i + 1][1], dp[i][0] + a + (a + 10 - n[i]));
        if (a <= n[i]) chmin(dp[i + 1][1], dp[i][1] + a + (a + 9 - n[i]));
    }
    cout << dp[len][0] << endl;
}

Measured memory_bytes: 61376
n, m, *a = map(int, open(0).read().split())

min_count = 1 / (4 * m) * sum(a)

max_choice = 0
for x in a:
    if min_count <= x:
        max_choice = max_choice + 1

if max_choice >= m:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
long long n;
void solve()
{
    long long i,a[n];
    for (i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    if (a[n/2]!=a[n/2-1]) cout<<a[n/2]-a[n/2-1];
    else cout<<0;
    cout<<endl;
}
int main()
{
    while(cin>>n)
        solve();
}

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

int main() {
    int A, B, M;
    cin >> A >> B >> M;
    vector<int>a(A);
    for (int i = 0; i < A; ++i) {
        cin >> a[i];
    }
    vector<int>b(B);
    for (int i = 0; i < B; ++i) {
        cin >> b[i];
    }
    int ans = INT_MAX;
    int x, y, c;
    for (int i = 0; i < M; ++i) {
        cin >> x >> y >> c;
        x--; y--;
        ans = min(ans, a[x] + b[y] - c);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    ans = min(ans, a[0] + b[0]);
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>

using namespace std;

int n, m, k;
char str[2][2];

int main(){
	scanf("%d%d%d", &n, &m, &k);
	str[0][0] = 'R', str[0][1] = 'G';
	str[1][0] = 'B', str[1][1] = 'Y';
	
	for (int i = 1; i <= n; i++){
		for (int j = 1; j <= m; j++){
			int x = (i + j + m - 2) / k % 2, y = (i - j + m) / k % 2;
			printf("%c", str[x][y]);
		}
		printf("\n");
	}	
	
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define lPair pair<ll,ll>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

vector<int> places[200200];
ll dp[200200];
void add(ll &a, ll b) { a+=b; if(a >= MOD) a -= MOD;}
int main(){
    int N; cin >> N;
    vector<int> c(N);
    for(int i = 0; i < N; i++) cin >> c[i];
    for(int i = 0; i < 200200; i++) places[i].clear();
    for(int i = 0; i < N; i++) places[c[i]].push_back(i);

    dp[0] = 1;
    for(int i = 1; i <= N; i++){
        add(dp[i],dp[i-1]);
        int color = c[i-1];
        int it = lower_bound(places[color].begin(),places[color].end(),i-1) - places[color].begin();
        if(it > 0){
            int j = places[color][it-1]; //c[j] = c[i]となるj
            if((i-1) - j > 1) add(dp[i],dp[j+1]);
        }
    }
    cout << dp[N] << endl;
}

Measured memory_bytes: 13568
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep2(i, m, n) for(int i=int(m); i<int(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(a) a.begin(), a.end()
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVVld = vector<VVld>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
const int INF = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS = 1e-10;
const int MOD = int(1e9)+7;
template<typename T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} return false;}
template<typename T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} return false;}


template<typename T>
struct BIT {
  int n; vector<T> d;
  BIT(int n=0) : n(n), d(n+1) {}
  void add(int i, T a=1) {
    for (i++; i <= n; i += i & -i) chmax(d[i], a);
  }
  // sum [0, i)
  T sum(int i) {
    if (i == 0) return 0;
    T x = 0;
    for (; i > 0; i -= i & -i) chmax(x, d[i]);
    return x;
  }
};


int main() {
  int n; cin >> n;
  V h(n);
  Vll a(n);
  rep(i, n) cin >> h[i];
  rep(i, n) cin >> a[i];

  BIT<ll> dp(n+1);

  rep(i, n) dp.add(h[i], dp.sum(h[i]) + a[i]);
  
  ll ans = dp.sum(n+1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 7224
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll n,sum;
int main(){
	cin>>n;
	for(ll i=1; i<=n; i++){
		if(i%3!=0 && i%5!=0)
			sum+=i;
	}
	cout<<sum;
	return 0;
}



Measured memory_bytes: 3624
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>
#include<bitset>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define EPS 1e-9
 
using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> Pii;
struct edge{int from, to; ll cost;};

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

    int A,B;
    cin >> A >> B;
    int d[A+1][B+1], f[101][101], dmax = 0;
    reppp(i, 1, A+1) reppp(j, 1, B+1){
        cin >> d[i][j];
        dmax = max(dmax, d[i][j]);
    }

    repp(a, dmax+1) repp(b, dmax+1){
        int m = 0;
        reppp(x, 1, A+1) reppp(y, 1, B+1){
            m = max(m, d[x][y] - x*a - y*b);
        }
        f[a][b] = max(0, m);
    }

    reppp(x, 1, A+1) reppp(y, 1, B+1){
        int shortest = INT_MAX;
        repp(a, dmax+1) repp(b, dmax+1){
            shortest = min(shortest, x*a + y*b + f[a][b]);
        }
        if(d[x][y] != shortest){
            cout << "Impossible" << endl;
            return 0;
        }
    }

    printf("Possible\n%d %d\n", (dmax+1)*2, (dmax+1)*(dmax+1) + 2*dmax);
    reppp(n, 1, dmax+1) printf("%d %d X\n", n, n+1);
    reppp(n, dmax+2, 2*dmax+2) printf("%d %d Y\n", n, n+1);
    repp(a, dmax+1) repp(b, dmax+1) printf("%d %d %d\n", a+1, 2*dmax+2-b, f[a][b]);
    printf("1 %d\n", 2*dmax+2);
    return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize("O3")

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long       ll;
typedef long double     ld;
typedef pair<int, int>  Pii;
typedef pair<ll, ll>    Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define eb emplace_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (n); ++(i))
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; --(i))
#define For(i, a, b)    for(int i = (a); (i) < (b) ; ++(i))
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

bool isPrime(int n){
    if(n < 2) return false; else if(n == 2) return true; else if(n%2 == 0) return false;
    double sqrtNum = sqrt(n); for(int i = 3;i <= sqrtNum; i += 2) if(n%i == 0) return false;
    return true;
    }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };

/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int n, m; cin >> n >> m;
    cout << (n > m ? "No" : "Yes") << endl;

return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n,k,q;
cin>>n>>k>>q;
vector<int> seikaisha(q);
vector<int> point(n);

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

for(int i=0;i<n;i++){
	point[i]=k-q;
}
for(int i=0;i<q;i++){
  int num = seikaisha[i];
	point[num-1] +=1;
}

for(int i=0;i<n;i++){
	if(point[i]>0){
		cout<<"Yes"<<endl;
		}else{
		cout<<"No"<<endl;
		}
}
  return 0;
}

Measured memory_bytes: 1408
#include <stdio.h>

int main() {
  int a[100],n,i,flag,count,change;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&a[i]);
  flag = 1;
  count = 0;

  while(flag) {
    flag = 0;
    for(i=n-1;i>0;i--) {
      if(a[i] < a[i-1]) {
	change = a[i];
	a[i] = a[i-1];
	a[i-1] = change;
	flag = 1;
	count++;
      }
    }
  }
  for(i=0;i<n;i++) {
    printf("%d",a[i]);
    if(i != n-1) printf(" ");
  }
  printf("\n%d\n",count);
  
  return 0;
}

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

using namespace std;

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

  string abc[3];
  std::cin >> abc[0] >> abc[1] >> abc[2];

  int ans = 0;
  for(int idx = 0; idx < n; idx++){
    if(abc[0].at(idx) == abc[1].at(idx) && abc[1].at(idx) == abc[2].at(idx)){
      continue;
    }
    if(abc[0].at(idx) == abc[1].at(idx) || abc[1].at(idx) == abc[2].at(idx) || abc[0].at(idx) == abc[2].at(idx)){
      ans += 1;
      continue;
    }
    if(abc[0].at(idx) != abc[1].at(idx) && abc[1].at(idx) != abc[2].at(idx) && abc[0].at(idx) != abc[2].at(idx)){
      ans += 2;
      continue;
    }
  }

  std::cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 888
#pragma GCC optimize "-O3"
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define NumberOfOnes __builtin_popcount
#define LSOne(S) (S & (-S))
#define ll long long
#define two pair<int,int>
#define twoll pair<ll,ll>
#define four pair<two,two>
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define y1 y1922
#define INF 1000000000000000000
#define P 1000000007
#define lmax 1000000000
#define nn 1000003
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define f first
#define s second
#define vi vector<int>
#define vll vector<ll>
#define vtwo vector<two>
#define ALL(container) (container).begin(), (container).end()
#define sz(container) (int)(container.size())
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define mid(a,b) (a+b>>1)
#define minN 0
#define maxN 10000000
#define na(x) ((x)<P?(x):(x)-P)
#define ab(a) (-(a)<(a)?(a):-(a))
#define FAST std::ios::sync_with_stdio(false)
#define xRand mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rnd rng
#define IT iterator
typedef
tree<
  int,// aq pair<int,int> shegidzlia
  null_type,
  less/*_equal*/<int>,// aqac
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;
// '_equal' mashin ginda roca multiset gchirdeba
template<class key, class value,class cmp = std::less<key>>
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
ordered_map<int, int> my_map;
inline int rin(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
inline int bin(){
	int x=0;char ch=getchar();
	while (ch<'0'||ch>'9') ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x;
}
int n,m,a,b;
int c,x;
vi dp,dp1;
int main(){FAST;xRand;
cin>>n>>m;
for(int i=0;i<(1<<n)+3;i++){
	dp.pb(lmax);
}
dp[0]=0;
while(m--){
	cin>>a>>b;
	x=0;
	while(b--){
		cin>>c;
		x|=(1<<(c-1));		
	}
	dp1=dp;
	for(int i=0;i<(1<<n);i++){
		if(dp[i]!=lmax){
			dp1[i|x]=min(dp1[i|x],dp[i]+a);
		}
	}
	dp=dp1;
}
if(dp[(1<<n)-1]!=lmax){
	cout<<dp[(1<<n)-1]<<endl;
	return 0;
}
cout<<-1<<endl;

}
/*

                   *         *
                  * *       * *
                 *   *     *   *
                *     *   *     *
                 *   *   * *   *
                  *   *   *   *
                   *   * *   *
                     *  *   *
					   *  *


*/



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <ctype.h>
#include <algorithm>
using namespace std;

int main(int argc, char *argv[])
{
    string w;
    string s;
    int count = 0;
    cin >> w;
    transform(w.begin(), w.end(), w.begin(), ::tolower);
    while (cin >> s && s != "END_OF_TEXT")
    {
        transform(s.begin(), s.end(), s.begin(), ::tolower);
        if (s == w)
            count++;
    }
    cout << count << endl;

    return 0;
}


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

fn main() {
    let a: i32 = read();
    let b: i32 = read();
    let c: i32 = read();
    let x = b + c;

    if x > a {
        println!("{}", x - a);
    } else {
        println!("{}", 0);
    }
}

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


Measured memory_bytes: 4352
import java.util.*

fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map{it.toInt()}
    val ps = Array(N) {
        val (A, B) = readLine()!!.split(" ").map{it.toLong()}
        Pair(A, B)
    }

    ps.sortWith(Comparator{ a, b -> if (a.first != b.first) (a.first - b.first).toInt() else (b.second - a.second).toInt()})

    val Q = PriorityQueue<Long>(N, Comparator{ a, b -> b.compareTo(a)})
    var p = 0
    var res = 0L

    for (t in M downTo 0) {
        while (p < ps.size && M - ps[p].first >= t) {
            Q.add(ps[p].second)
            p++
        }
        if (Q.isNotEmpty()) {
            res += Q.poll()
        }
    }

    println(res)
}


Measured memory_bytes: 65516
Scanf.scanf "%d" (fun n ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    Array.sort compare a;

    let rec check v1 v2 lp rp sum =
        if lp > rp then sum else
            let q = [| abs (v1 - a.(lp)), 0;
                       abs (v2 - a.(lp)), 1;
                       abs (v1 - a.(rp)), 2;
                       abs (v2 - a.(rp)), 3 |]
            in
            Array.sort compare q;
            match q.(3) with
            | v, 0 -> check a.(lp) v2     (lp + 1) rp       (sum + v)
            | v, 1 -> check v1     a.(lp) (lp + 1) rp       (sum + v)
            | v, 2 -> check a.(rp) v2     lp       (rp - 1) (sum + v)
            | v, _ -> check v1     a.(rp) lp       (rp - 1) (sum + v)
    in
    max (check a.(0) a.(0) 1 (n - 1) 0) (check a.(n - 1) a.(n - 1) 0 (n - 2) 0) |> Printf.printf "%d\n"
)

Measured memory_bytes: 6720
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

string s, t, u;
ll a, b;

int main() {
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;
	if (s == u) {
		cout << a - 1 << " " << b << endl;
	}
	else {
		cout << a << " " << b - 1 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <typename T>
struct edge {
    int from, to;
    T cost;

    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}

    explicit operator int() const {return to;}
};

template <typename T>
vector<T> bellman_ford(int s, int V,vector<edge<T> > &G){
    vector<T> d(V, INF<T>);
    d[s] = 0;
    for (int i = 0; i < V - 1; ++i) {
        for (auto &&e : G) {
            if (d[e.from] == INF<T>) continue;
            if(d[e.to] == INF<T>) d[e.to] = d[e.from] + e.cost;
            else d[e.to] = max(d[e.to], d[e.from] + e.cost);
        }
    }
    vector<T> d2 = d;
    for (int i = 0; i < V - 1; ++i) {
        for (auto &&e : G) {
            if (d[e.from] == INF<T>) continue;
            if(d[e.to] == INF<T>) d[e.to] = d[e.from] + e.cost;
            else d[e.to] = max(d[e.to], d[e.from] + e.cost);
        }
    }
    if(d[V-1] != d2[V-1]) return vector<T> ();
    else return d;
}

int main() {
    int n, m, p;
    cin >> n >> m >> p;
    vector<edge<ll>> G;
    for (int i = 0; i < m; ++i) {
        int a, b; ll c;
        cin >> a >> b >> c;
        a--; b--; c = c-p;
        G.emplace_back(a, b, c);
    }
    auto ans = bellman_ford(0, n, G);
    if(ans.empty()) puts("-1");
    else {
        cout << max(0LL, ans.back()) << "\n";
    }
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>
#include <queue>

using namespace std;

class adjacency_list
{
public:
	adjacency_list(size_t n)
		: g(n)
	{}

	void add_edge(int src, int dst, long long weight)
	{
		g[src].push_back({ dst, weight });
	}

	long long prim_minimum_spanning_tree() const
	{
		const int n = g.size();
		long long ans = 0;
		vector<bool> visited(n, false);
		priority_queue<edge> q;

		q.push({ 0, 0 });
		while (!q.empty()) {
			auto e = q.top();
			q.pop();
			if (visited[e.dst]) {
				continue;
			}
			visited[e.dst] = true;
			ans += e.weight;
			for (auto &f : g[e.dst]) {
				if (!visited[f.dst]) {
					q.push(f);
				}
			}
		}
		return ans;
	}
private:

	struct edge
	{
		int dst;
		long long weight;

		bool operator<(const edge &other) const
		{
			return tie(other.weight, dst) < tie(weight, other.dst);
		}
	};

private:
	vector<vector<edge>> g;
};

int main()
{
	int N;
	cin >> N;
	adjacency_list g(N);
	vector<tuple<int, int, int>> v(N);  // (id, x, y)
	for (int i = 0; i < N; ++i) {
		int x, y;
		cin >> x >> y;
		v[i] = tie(i, x, y);
	}
	// sort by x
	sort(v.begin(), v.end(), [](const auto &a, const auto &b) {
		return get<1>(a) < get<1>(b);
	});
	for (int i = 0; i < N; ++i) {
		if (0 < i) {
			int a = get<0>(v[i - 1]);
			int b = get<0>(v[i]);
			int w = abs(get<1>(v[i - 1]) - get<1>(v[i]));
			g.add_edge(a, b, w);
			g.add_edge(b, a, w);
		}
		if (i + 1 < N) {
			int a = get<0>(v[i]);
			int b = get<0>(v[i + 1]);
			int w = abs(get<1>(v[i]) - get<1>(v[i + 1]));
			g.add_edge(a, b, w);
			g.add_edge(b, a, w);
		}
	}

	// sort by y
	sort(v.begin(), v.end(), [](const auto &a, const auto &b) {
		return get<2>(a) < get<2>(b);
	});
	for (int i = 0; i < N; ++i) {
		if (0 < i) {
			int a = get<0>(v[i - 1]);
			int b = get<0>(v[i]);
			int w = abs(get<2>(v[i - 1]) - get<2>(v[i]));
			g.add_edge(a, b, w);
			g.add_edge(b, a, w);
		}
		if (i + 1 < N) {
			int a = get<0>(v[i]);
			int b = get<0>(v[i + 1]);
			int w = abs(get<2>(v[i]) - get<2>(v[i + 1]));
			g.add_edge(a, b, w);
			g.add_edge(b, a, w);
		}
	}
	
	cout << g.prim_minimum_spanning_tree() << endl;
}


Measured memory_bytes: 25716
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
    int N,K;
    string S;
    cin >> N >> S >> K;
    
    for(int i=0;i<N;i++){
        if(S[K-1] == S[i]){
        }else{
            S[i] = '*';
        }
    }
        cout << S << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<int,int> P;
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
const ll mod=1000000007;
//ios_base::sync_with_stdio(false);
//cin.tie(NULL);
ll gcd(ll a,ll b) {return b ? gcd(b,a%b):a;}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++)cin>>a[i];
    ll ans=0;
    int right=0;
    ll tmp=0,sum=0;
    for(int left=0;left<n;left++){
        while(right<n&&sum+a[right]==(tmp^a[right])){
            sum+=a[right];
            tmp^=a[right];
            right++;
        }
        ans+=(right-left);
        if(left==right)right++;
        sum-=a[left];
        tmp^=a[left];
    }
    cout<<ans<<endl;
}




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

int main()
{
    int a, b ;
    while(cin >> a >> b)
    {
        int ans ;
        ans = max(a*2-1, b*2-1) ;
        ans = max(ans, a+b) ;
        cout << ans << '\n' ;
    }
    return 0 ;
}


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

using namespace std;

int main () {

    string S;
    cin >> S;

    if(S == "abc") {
        cout << "Yes" << endl;
        return 0;
    }
    if(S == "acb") {
        cout << "Yes" << endl;
        return 0;
    }
    if(S == "bac") {
        cout << "Yes" << endl;
        return 0;
    }
    if(S == "bca") {
        cout << "Yes" << endl;
        return 0;
    }
    if(S == "cab") {
        cout << "Yes" << endl;
        return 0;
    }
    if(S == "cba") {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define eps LDBL_EPSILON
#define moder INF
#define int long long
#define double long double
#define ll long long
#define INF LLONG_MAX/3
#define P pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
#define ggr getchar();getchar();return 0
using namespace std;
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&b==c)puts("Yes");
	else puts("No");
	ggr;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;

int main()
{
	int k;
	cin >> k;
	printf("%d", (k / 2) * (k - k / 2));
}

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

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

int main(void){
    int i, n, p;
    int count = 0;
    
    scanf("%d\n", &n);
    
    for(i = 0; i < n; i++) {
        scanf("%d\n", &p);
        if(isPrime(p)) {
            count++;
        }
    }
    printf("%d\n", count);
    return 0;
}



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

using namespace std;

void Turn(int i, int j, int m, int n,int *a)
{
	int t = a[i];
	a[i] = a[j];
	a[j] = a[m];
	a[m] = a[n];
	a[n] = t;
}


int main() {
	int a[6] = { 0 };
	string s;

	for (int i = 0; i != 6; ++i)
	{
		cin >> a[i];
	}
	cin >> s;

	for (int i = 0; i != s.size(); ++i)
	{
		switch (s[i])
		{
		case 'E': for (int j = 0; j != 3; ++j) Turn(0, 2, 5, 3, a); break;
		case 'W': Turn(0, 2, 5, 3, a); break;
		case 'N': for(int j = 0; j != 3; ++j)Turn(0, 4, 5, 1, a); break;
		case 'S': Turn(0, 4, 5, 1, a); break;
		}
	}
	
	cout << a[0]<<endl;

	return 0;
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
#define loop(n, i) for(int i=0;i<n;i++)
#define loop1(n, i) for(int i=1;i<=n;i++)
#define rloop(n, i) for(int i=n;i;i++)
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;

struct ModInt {
    ll v;
    static unsigned M;
    ModInt() : v(0) {}
    ModInt(ll x) : v((x % M + M) % M) {}

    ModInt& operator+=(const ModInt& r) {
        v = (v + r.v) % M;
        return *this;
    }
    ModInt& operator-=(const ModInt& r) {
        v = (v - r.v + M) % M;
        return *this;
    }
    ModInt& operator*=(const ModInt& r) {
        v = (v * r.v) % M;
        return *this;
    }
    ModInt& operator/=(const ModInt& r) {
        auto s = r.pow(ModInt::M - 2);
        v = (v * s.v) % M;
        return *this;
    }
    ModInt operator-() const { return (M - v % M); }

    friend ModInt operator+(ModInt l, const ModInt& r) { return l += r; }
    friend ModInt operator-(ModInt l, const ModInt& r) { return l -= r; }
    friend ModInt operator*(ModInt l, const ModInt& r) { return l *= r; }
    friend ModInt operator/(ModInt l, const ModInt& r) { return l /= r; }
    friend bool operator==(ModInt l, const ModInt& r) { return l.v == r.v; }
    friend bool operator!=(ModInt l, const ModInt& r) { return !(l == r); }

    ModInt pow(ll n) const {
        ModInt base = *this, ans = 1;
        while (n) {
            if (n & 1) ans *= base;
            base *= base;
            n /= 2;
        }
        return ans;
    }
};
unsigned ModInt::M;
ostream& operator<<(ostream& o, const ModInt& r) {
    o << r.v;
    return o;
}

ModInt fact[100000] = {};
ModInt ifact[100000] = {};
void calc_fact(int m) {
    fact[0] = 1;
    for (int i = 1; i <= m; i++) {
        fact[i] = i * fact[i - 1];
    }
    for (int i = 0; i <= m; i++) {
        ifact[i] = fact[i].pow(ModInt::M - 2).v;
    }
}

ModInt comb(int n, int a) {
    return fact[n] * ifact[a] * ifact[n - a];
}

int main() {
    int p; cin >> p;
    ModInt::M = p;
    calc_fact(p + 10);
    V<int> A(p);
    loop (p, i) {
        cin >> A[i];
    }

    V<ModInt> B(p);
    loop (p, i) {
        if (A[i] == 0) continue;
        ModInt mi = 1;
        
        B[0] += 1;
        for (int j = p - 1; j >= 0; j--) {
            B[j] -= comb(p - 1, j) * mi;
            mi *= -i;
        };
    }

    loop (p - 1, i) {
        cout << B[i] << " ";
    }
    cout << B[p - 1] << endl;
    return 0;
}



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

/** defines and macros */
#define ll long long
#define ull unsigned long long
#define loop(n) for(int i = 0; i < n; i++)
#define loop1(n) for(int i = 1; i <= n; i++)
#define all(v) (v.begin(), v.end())
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vvi vector<vi>
#define vvpii vector<vii>
#define PB push_back

#define fw(fileName) freopen(fileName, "w", stdout)
#define fr(fileName) freopen(fileName, "r", stdin)
#define fc(stream) fclose(stream);

#define faster_IO_stream ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

/*To compile and run

	g++ -o main main.cpp && ./main

*/

/*
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣀⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣀⡀⠄⠄⠄⠄⠄⣰⣷⡀⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⣀⣀⣀⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⢠⣿⣿⣷⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠤⠒⠛⠛⠛⠛⠻⠷⣦⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢀⣤⣤⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣡⡤⠐⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⢀⣶⣿⣿⠿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⢠⣿⠟⠉⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠘⠁⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⣾⣿⡿⣽⡿⢹⣿⣿⣟⣿⢻⠇⢀⢹⣿⢿⣿⣿⣿⣿⣿⣦⣙⢿⣿⢷⣈⠻⢿⣟⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢿⡿⠁⡿⠁⢸⣿⣿⢹⡇⢸⠄⠈⠄⠻⣏⠻⣿⡿⣿⣿⣿⣌⠛⢿⡌⠙⢧⣀⠙⢳⡹⢻⣿⣿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠘⡇⠄⡇⢠⣼⣿⣿⠈⡇⠘⠤⠤⠤⠤⢜⣢⣘⡻⢮⡛⢿⣿⣷⣬⡤⠤⠤⠤⠥⠤⠥⢬⣿⣧⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠘⢿⡏⠛⠄⠄⠄⠄⠄⠄⠄⠄⠄⠙⣿⣿⣿⡿⠋⠉⠛⠉⠄⠄⠄⠄⠄⠄⠄⢹⡿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡟⠁⠈⢳⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠱⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⡜⠁⠄⠄⠈⢇⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠑⠦⢄⣀⣀⣀⣀⣀⠴⠊⠄⠄⠄⠄⠄⠄⠑⠤⢀⣀⣀⣀⡀⠠⠔⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣶⣦⣄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣤⣶⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣶⣄⣀⣀⣀⣀⣤⣾⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠙⢿⣿⣿⣿⡟⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⠟⠋⠁⠄⠄⠄⠄⠄⠄⠄⠄⠉⠛⠿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
 */

int main() {
	faster_IO_stream

	string s;
	cin >> s;

	ull res = 0;
	for(int i = 0; i < (int) s.length(); i++) res += s[i] - '0';

	cout << (res % 9 ? "No\n" : "Yes\n");

	return 0;
}


Measured memory_bytes: 3672
#include <iostream>
#include <vector>
using namespace std;
using pint = pair<int,int>;

int N;
vector<vector<pint>> v;

bool judge(int bit) {
    for (int i = 0; i < N; i++) {
        if ( !(bit & (1 << i)) ) continue;

        for (pint xy : v[i]) {
            int x = xy.first; // xが
            int y = xy.second; // y = 1:正直, y = 0:不親切

            if (y == 1 && !(bit & (1 << x))) return false;
            if (y == 0 && (bit & (1 << x))) return false;
        }
    }

    return true;
}


int main()
{
    cin >> N;
    v.resize(N);
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        v[i].resize(A);
        for (int j = 0; j < A; j++) {
            cin >> v[i][j].first >> v[i][j].second;
            --v[i][j].first;
        }
    }


    int res = 0;

    for (int bit = 0; bit < (1 << N); ++bit) {
        if (judge(bit)) {
            int count = 0;
            for (int i = 0; i < N; i++) {
                if (bit & (1 << i)) ++count;
            }
            res = max(res, count);
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3


n, k = list(map(int, input().split()))
h = [int(input()) for _ in range(n)]

h.sort(reverse=True)

ans = 10**10
for i in range(0, n-k+1):
    max_ = h[i]
    min_ = h[i+k-1]
    ans = min(ans, max_-min_)
print(ans)


Measured memory_bytes: 7384
#include<bits/stdc++.h>
#define N 1234567
using namespace std;
typedef long long ll;
int main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll sm=0;
    sm+=min(k,a);
    k-=min(k,a); //cout<<"S "<<sm<<endl;
    //sm+=min(k,b);
    k-=min(k,b);
    sm-=min(k,c);
    cout<<sm<<endl; //main();
    return 0;
}


Measured memory_bytes: 3600
import collections
import math

def c2(x):
  c = math.factorial(x) // (math.factorial(x-2)*2)
  return c

n = int(input())

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

adic = collections.Counter(a)

cnt = 0

for i in adic:
  num = adic[i]
  if num > 1:
    cnt += c2(num)

for i in a:
  num = adic[i]
  if num == 1:
    print(cnt)
  else:
    print(cnt - (num-1))

Measured memory_bytes: 33904
#include<stdio.h>
#include<string.h>

int main()
{
	char s[205], temp1[205], temp2[205];
	int m, h;

	while (1)
	{
		scanf("%s", s);
		if (!strcmp(s, "-"))
			break;
		scanf("%d", &m);
		for (int i = 0; i < m; i++)
		{
			scanf("%d", &h);
			strcpy(temp1, s + h);
			s[h] = '\0';
			strcpy(temp2, s);
			sprintf(s, "%s%s", temp1, temp2);
		}
		printf("%s\n", s);
	}
	return 0;
}


Measured memory_bytes: 2104
import sys
input = sys.stdin.readline
import bisect
S = input()
E = {S[i]:[] for i in range(len(S)-1)}
for i in range(len(S)-1):
  E[S[i]].append(i)
T = input()
a = len(S)-1
ans=0
now = -1
for i in range(len(T)-1):
  if not T[i] in E.keys():
    print(-1)
    exit()
  s=E[T[i]]
  b= bisect.bisect_right(s,now)
  #print(s,b,now)
  if b==len(s):
    ans+=s[0]+1+a-1-now
    now=s[0]
  else:
    ans+=s[b]-now
    now=s[b]
print(ans)


Measured memory_bytes: 45808
#include <iostream>

using namespace std;

int main(){
  int m;
  unsigned long long int money;
  unsigned long long int initial;
  unsigned long long int max;
  unsigned long long int risi;
  unsigned int nensu;
  unsigned int n;
  int fukuri;
  double nenri;
  unsigned long long int tesuryo;
  
  cin >> m;
  for(int i=0; i<m; i++){
    cin >> initial;
    cin >> nensu;
    cin >> n;
    max = 0;
    for(unsigned int j=0; j<n; j++){
      money = initial;
      risi = 0;
      cin >> fukuri >> nenri >> tesuryo;
      if(fukuri){
	for(unsigned int k=0; k<nensu; k++){
	  risi = money * nenri;
	  money = money + risi - tesuryo;
	}
      }else{
	for(unsigned int k=0; k<nensu; k++){
	  risi += money * nenri;
	  money += -tesuryo;
	}
	money += risi;
      }
      if(max < money){
	max = money;
      }
    }
    cout << max << endl;
  }

  return 0;
}

Measured memory_bytes: 1232
# coding:utf-8

n = int(input())
town_list = [int(x) for x in input().split(' ')]
saver_list = [int(x) for x in input().split(' ')] + [0]

count = 0

for i, town in enumerate(town_list):
    if town_list[i] >= saver_list[i]:
        count += saver_list[i]
    else:
        count += town_list[i]
        if not i+1 == len(saver_list):
            count += min(town_list[i+1], saver_list[i] - town_list[i])
            town_list[i+1] = max(town_list[i+1] - (saver_list[i] - town_list[i]), 0)

print(count)

Measured memory_bytes: 18624
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;

typedef long long int ll;
typedef long double ld;

int main(){
    while(true){
        ll h,w;
        cin >> h >> w;
        if(h==0 && w==0){
            break;
        }
        for (int i=0;i<h;++i){
            for (int j=0;j<w;++j){
                if (i%2==0 && j%2==0){
                    cout << "#";
                }else if (i%2==1 && j%2==1){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
    }
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
//Remove below header file if c++ version greater than 14
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;

#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)

struct greaterr
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};

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

ll lcm(ll a, ll b) {
	return a /gcd(a, b) *b;
}
typedef pair<int,int> pii;
const int mod = 1e9+7;

ll xorr(ll n){

    if(n%4==0)
        return n;

    else if(n%4==1)
        return 1;

    else if(n%4==2)
        return n+1;

    else
        return 0;



}


int main() {

   int n;
   cin>>n;

   vector<int> v(n);

   fo(i,n)
      cin>>v[i];

    vector<int> left(n+1,0),right(n+1,0);

    fo(i,n)
    {
        left[i+1] = __gcd(left[i],v[i]);
        right[i+1] = __gcd(right[i],v[n-i-1]);
    }

    int maxx = INT_MIN;

    fo(i,n)
    maxx = max(maxx,__gcd(left[i],right[n-i-1]));
  // cout<<left[i]<<" "<<right[i]<<endl;

    cout<<maxx;





















    return 0;

      }


Measured memory_bytes: 1408