akhauriyash/Code-Regression huggingface dataset:
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), ", ", cout) << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, string sep = " ", ostream &os = cout)
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), ", ", os) << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, L);
    AIN(ll, A, L);
    vi acc(L + 1);
    REP(i, L)
    {
        acc[i + 1] = acc[i] + A[i];
    }
    ll x = 0;
    ll y = 0;
    ll z = 0;
    ll ans = INF;
    REP1(i, L)
    {
        ll a = A[i - 1];
        if (a == 0)
        {
            x = min(x + 2, acc[i]);
            y = min(y + 1, acc[i]);
            z = min({z + 2, y, acc[i]});
        }
        else if (a & 1)
        {
            x = min(x + 1, acc[i]);
            z = min(y, z + 1);
        }
        else
        {
            y = min(y + 1, x);
        }
        CH(min, ans, z + acc[L] - acc[i]);
    }
    OUT(ans);
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mod 1000000007

void exgcd(int a, int b, int &x, int &y);

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

int c;

int main(){
    int a,b; cin >> a >> b;
    int x,y;
    
    exgcd(a,b,x,y);
    cout << x << " " << y << endl;
    return 0;
}

void exgcd(int a, int b, int &x, int &y){
    if(b == 0){
        x = 1; y = 0;
        return;
    }
    exgcd(b, a%b, y, x);
    y -= a/b * x;

}


Measured memory_bytes: 3088
def main():
    n = int(input())

    ans = 'No'
    for i in range(1, 10):
        q, mod = divmod(n, i)
        if mod == 0 and 1 <= q <= 9:
            ans = 'Yes'
            break
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                //????????¨??????????????????
                string[] s = Console.ReadLine().Split(' ');
                int high = int.Parse(s[0]);
                int width = int.Parse(s[1]);


                //????????¨????????¨??????0???????????????????????????????????????
                if ((high == 0) && (width) == 0) break;


                for (int i = 0; i < high; i++)
                {
                    for (int j = 0; j < width; j++)
                    {
                        if ((i % 2 == 0) && (j % 2 == 0))
                            Console.Write("#");
                        else if ((i % 2 == 1) && (j % 2 == 1))
                            Console.Write("#");
                        else
                            Console.Write(".");
                    }
                    Console.Write("\n");
                }

                Console.Write("\n");

            }
        }
    }
}

Measured memory_bytes: 5300
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int x,maxi=0;
    cin>>x;
    for(int i=1;i*i<=x;i++){
        for(int j=2;j<10;j++){
            int hoge=(int)pow(i,j);
            if(hoge<=x)maxi=max(maxi,hoge);
        }
    }
    cout<<maxi<<endl;
}

Measured memory_bytes: 512
package main

import "fmt"

func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func main() {
	var n int
	fmt.Scan(&n)
	as := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&as[i])
	}
	left := make([]int, n)
	right := make([]int, n)
	left[0] = 0
	right[n-1] = 0
	for i := 1; i < n; i++ {
		left[i] = gcd(left[i-1], as[i-1])
	}
	for i := n - 2; i >= 0; i-- {
		right[i] = gcd(right[i+1], as[i+1])
	}
	m := 1
	for i := 0; i < n ; i ++ {
		mm := gcd(left[i], right[i])
		if mm > m {
			m = mm
		}
	}
	fmt.Println(m)
}


Measured memory_bytes: 5504
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>
#include <cassert>
#include <functional>
#include <set>
#include <deque>
#include <list>
using namespace std;
using ll = long long;


int main(){
    int H,W; cin >> H >> W;
    int sx,sy;
    int gx,gy;
    cin >> sy >> sx;
    cin >> gy >> gx;
    sy--; sx--; gy--; gx--;
    string S;
    int iii=10101010;
    vector<vector<int> > c(H,vector<int>(W,iii));
    bool f=false;
    for(int i=0;i<H;i++){
        cin >> S;
        for(int j=0;j<W;j++){
            if(S[j]=='#') c[i][j]=-1;
        }
    }
    queue<pair<int,int>> q;
    q.push(make_pair(sy,sx));
    c[sy][sx]=0;
    while(!q.empty()){
        pair<int,int> now = q.front(); q.pop();
        int y=now.first, x=now.second;
        int n=c[y][x];
        for(int i=-2;i<=2;i++){
            for(int j=-2;j<=2;j++){
                int dy = y+i;
                int dx = x+j;
                int ttt=0;
                if(dy<0 || dx<0 || dy>=H || dx>=W) continue;
                int nn=n;
                int dd=c[dy][dx];
                if(abs(i)>1 || abs(j)>1){
                    nn++;
                }else if(abs(i)==1 && abs(j)==1){
                    nn++;
                }
                if(dd==-1){
                    continue;
                }else if(dd>nn){
                    c[dy][dx] = nn;
                    q.push(make_pair(dy,dx));
                }else{
                    continue;
                }   
            }
        }
        
    }
    if(c[gy][gx]!=iii){
        cout << c[gy][gx] << endl;
    }else{
        cout << -1 << endl;
    }
    return 0;
}


Measured memory_bytes: 7628
#include <iostream>
#include <vector>
#include <map>
using namespace std;
#define MOD 1000000007

vector<long long> fact_num, fact_den;
vector<long long> pow2, pow3;
map<pair<long long, long long>, long long> dp;

long long bipow(long long n, int m) {
    if (m == 0) return 1;
    if (m % 2 == 0) {
        n = (n * n) % MOD;
        return bipow(n, m / 2) % MOD;
    } else
        return (n * bipow(n, m - 1)) % MOD;
}

void set_table(int N, vector<long long> &fact_num, vector<long long> &fact_den){
    fact_num.resize(N+1, 0);
    fact_den.resize(N+1, 0);
    vector<long long> fact_denpow(N+1, 0);

    fact_num[0] = 1;
    for(int i=1; i<=N; i++) fact_num[i] = (fact_num[i-1] * i) % MOD;

    for(int i=0; i<=N; i++) fact_denpow[i] = bipow(i, MOD-2);
    fact_den[0] = 1;
    for(int i=1; i<=N; i++) fact_den[i] = (fact_den[i-1] * fact_denpow[i]) % MOD;
}

long long comb(const vector<long long> &fact_num, const vector<long long> &fact_den, int m, int n){
    return ((fact_num[m] * fact_den[n]) % MOD * fact_den[m-n]) % MOD;
}

long long func2(long long n, long long k){
    if(k < 0) return 0;

    if(dp.find(make_pair(n, k)) != dp.end())
        return dp[make_pair(n, k)];

    long long tmp = (2 * func2(n-1, k-1))%MOD;
    tmp += comb(fact_num, fact_den, n-1, k);
    tmp %= MOD;
    dp[make_pair(n, k)] = tmp;
    return tmp;
}

long long func(long long L, long long R, long long n){
    long long ret = pow2[n];
    ret += MOD - func2(n, L-1);
    ret %= MOD;
    ret += MOD - func2(n, n-R-1);
    ret %= MOD;
    return ret;
}

int main(){
    long long N, M, K;
    cin >> N >> M >> K;

    set_table(N+M+K, fact_num, fact_den);

    pow2.resize(N+M+K+1, 0);
    pow2[0] = 1;
    for(int i=1; i<=N+M+K; i++)
        pow2[i] = (2*pow2[i-1])%MOD;

    pow3.resize(N+M+K+1, 0);
    pow3[0] = 1;
    for(int i=1; i<=N+M+K; i++)
        pow3[i] = (3*pow3[i-1])%MOD;

    long long ans = 0;
    for(int i=N; i<=N+M+K; i++){
        long long tmp = pow3[N+M+K-i];

        tmp *= comb(fact_num, fact_den, i-1, N-1);
        tmp %= MOD;

        tmp *= func(max(0LL, i-N-K), min(M, i-N), i-N);
        tmp %= MOD;

        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;

	return 0;
}

Measured memory_bytes: 65928
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans

  
'''
p = 10 ** 9 + 7
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p
'''


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

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

#hpList = [[] for i in range(n)]

ans = 10**10

for i in range(101):
    now = 0
    for j in range(n):
        now += (a[j]-i)*(a[j]-i)
    if(ans>now):
        ans = now
print(ans)
    































Measured memory_bytes: 66028
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <math.h>
#include <iomanip>
using namespace std;
#define Would
#define you
const int INF = 999999999;
const int MOD = 1e9 + 7;

int main() {
	int a, b, c, k[10005];
	cin >> a >> b >> c;
	for (int i = 0; i < c; ++i) {
		cin >> k[i];
	}
	vector<int>v;
	for (int i = 1; i <= c; ++i) {
		for (int j = 0; j < k[i - 1]; ++j) {
			v.push_back(i);
		}
	}
	for (int i = 0; i < a; ++i) {
		if (i % 2 == 0) {
			for (int j = b * i; j < b*i + b; ++j) { cout << v[j] << " "; }
		}
		else {
			for (int j = b * i + b - 1; j >= b * i; --j) { cout << v[j] << " "; }
		}
		cout << endl;
	}
}


Measured memory_bytes: 384
N = int(input())
testimony = [[None for _ in range(N)] for _ in range(N)]
person = [None] * N

for i in range(N):
    person[i] = int(input()) #i番目のpersonの証言の数
    for _ in range(person[i]):
        j, good_or_bad = map(int, input().split())
        j -= 1
        testimony[i][j] = good_or_bad
        #i番目の人がj番目の人のことをgood_or_badって思ってるよーってこと。

ans = 0
for i in range(1, 1<<N):
    which_person = [None] * N
    for j in range(N): #j番目の人を見てる。
        which_person[j] = i>>j & 1
    ok = True
    for j in range(N):
        if(which_person[j]): #j番目の人が正直者である時のみ、可否を見れば良い。
            for k in range(N):
                #これ以降でj番目の人が正しいこと言ってるのか否かを調べてる。
                if testimony[j][k] == None: 
                    continue
                if testimony[j][k] != which_person[k]: #which_personってのは、全探索で仮定しているパターンに過ぎない
                    ok = False
    if ok:
        ans = max(ans, which_person.count(1))
print(ans)

Measured memory_bytes: 3064
package main

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

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func vi(n int, args ...int) []int {
	res := make([]int, n)
	if len(args) == 0 {
		return res
	}
	v := args[0]
	if v == 0 {
		return res
	}
	for i := 0; i < n; i++ {
		res[i] = v
	}
	return res
}

func vvi(n int, args ...int) [][]int {
	res := make([][]int, n)
	m := n
	if len(args) > 0 {
		m = args[0]
	}
	v := 0
	if len(args) > 1 {
		v = args[1]
	}
	for i := 0; i < n; i++ {
		res[i] = vi(m, v)
	}
	return res
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()
	n := readInt64()
	m := readInt64()

	if n == 1 && m == 1 {
		println(1)
		return
	}
	if n == 1 {
		println(m - 2)
		return
	}
	if m == 1 {
		println(n - 2)
		return
	}
	if n < 3 || m < 3 {
		println(0)
		return
	}

	println((n - 2) * (m - 2))
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5+5;
typedef long long ll;
const int inf = 1e9;

int n,k;
ll li[N],ans;

int main(){
  ios::sync_with_stdio(false);
  // freopen("input.txt","r",stdin);
  cin>>n>>k;
  for(int i = 1;i <= n;i++) cin>>li[i];
  if(n-k <= 0){
    cout<<"0"<<endl;
  }
  else{
    sort(li+1,li+n+1,less<int>());
    for(int i = 1;i <= n-k;i++){
      ans += li[i];
    }
    cout<<ans<<endl;
  }
  return 0;
}




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

#define rep( i, n ) for( int i = 0; i < ( n ); i++ )
#define PI 3.14159265
typedef long long ll;

int main( void ) {
    
    double x1,y1,x2,y2;
    scanf( "%lf%lf%lf%lf", &x1, &y1, &x2, &y2 );
    double dis = sqrt( pow( ( x2 - x1 ), 2 ) + pow( ( y2 - y1 ), 2 ) );
    printf( "%.8lf", dis );

    return 0;
}



Measured memory_bytes: 3212
/*
      author : nishi5451
      created: 11.08.2020 20:52:22
*/

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


int main(){
    int a,b;
    cin >> a >> b;
    int ans = a*b-a-b+1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
inf = 10**9+7
mod = 10**9+7
n = int(input())
rc = [list(map(int, input().split())) for i in range(n)]
dp = [[inf for j in range(n)]for i in range(n)]
for i in range(n):
    dp[i][i] = 0
for k in range(1,n):
    for i in range(0,n-k):
        for j in range(k):
            dp[i][i+k] = min(dp[i][i+k], dp[i][i+j] + dp[i+j+1][i+k] + rc[i][0]*rc[i+j][1]*rc[i+k][1])
print(dp[0][n-1])


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

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	int x0, y0, x1, y1; cin >> x0 >> y0 >> x1 >> y1;
	int X1 = x1 - x0, Y1 = y1 - y0;
	int q; cin >> q;
	while (q--) {
		int x2, y2; cin >> x2 >> y2;
		int X2 = x2 - x0, Y2 = y2 - y0;
		long long cross = X1*Y2 - Y1*X2;
		if (cross > 0) { cout << "COUNTER_CLOCKWISE" << endl; continue; }
		if (cross < 0) { cout << "CLOCKWISE" << endl; continue; }
		//??????????????§cross == 0 ?????????????¢????
		long long dot = X1*X2 + Y1*Y2;
		if (dot < 0) { cout << "ONLINE_BACK" << endl; continue; }
		//???????????§????????????ONLINE_FRONT???ON_SEGMENT
		//???????????????????¨????????????¨?????????????????????????????????????????§???????????±???????????????
		long long dis1 = X1/hypot(X1,Y1) * X1 + Y1/hypot(X1,Y1)*Y1, dis2 = X2/hypot(X2,Y2)*X2 + Y2/hypot(X2,Y2)*Y2;
		if (dis1 < dis2) { cout << "ONLINE_FRONT" << endl; continue; }
		cout << "ON_SEGMENT" << endl;
	}
}

Measured memory_bytes: 3204
#include <iostream>
#include <cassert>
#include <limits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <array>
#include <map>
#include <set>
#include <deque>
#include <list>
#include <sstream>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cstring>
#include <bitset>
#include <stack>
#include <queue>

#define MOD (1e9 + 7);
#define PI (3.14159265358979323846)

using ll = int64_t;
using ull = uint64_t;

using namespace std;

[[maybe_unused]] static auto __x = [](){ios_base::sync_with_stdio(0); cin.tie(0);};

int main() {
    int a;
    string s;
    cin >> a >> s;
    if (a < 3200) {
        cout << "red";
    }
    else {
        cout << s;
    }
}


Measured memory_bytes: 256
bingo = []
for _ in range(3):
    bingo.append(list(map(int, input().split())))

N = int(input())

for _ in range(N):
    v = int(input())
    for j in range(3):
        for k in range(3):
            if v in bingo[j]:
                id = bingo[j].index(v)
                bingo[j][id] = 0

def judge(l):
    for i in range(3):
        if l[i][0] + l[i][1] + l[i][2] == 0: #横
            return print("Yes")

        if l[0][i] + l[1][i] + l[2][i] == 0: #縦
            return print("Yes")

    if l[0][0] + l[1][1] + l[2][2] == 0 or l[2][0] + l[1][1] + l[0][2] == 0:
        return print("Yes")

    return print("No")

judge(bingo)

Measured memory_bytes: 3064
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<bits/stdc++.h>
#include<stack>
#include<queue>
#include<list>
#include<vector>
#include<bitset>
#include<unordered_map> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
// #include "boost/algorithm/string.hpp"
#define fio ios_base::sync_with_stdio(false)
#define mod 998244353
#define mod1 mod
#define mod2 1000000007
#define li long long int
#define ll li
#define readi(x) scanf("%d",&x)
#define  reads(x)  scanf("%s", x)
#define readl(x) scanf("%I64d",&x)
#define rep(i,n) for(i=0;i<n;i++)
#define revp(i,n) for(i=(n-1);i>=0;i--)
#define myrep1(i,a,b) for(i=a;i<=b;i++)
#define myrep2(i,a,b) for(i=b;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define MAXN 1000000000010000005
#define MINN -1000000000000000000
#define INTMAX 1000001000
#define pii pair<ll,ll> 
#define pdd pair<double,double>
#define pic pair<int,char>
#define N 200105
#define lgn 20
#define ddouble long double
#define minus minu
#define PI 2*acos(0)
#define lgn 20
 
 
// #define INTMAX 200000000 
 
// using namespace boost;
// #define si short int
 
using namespace std;
using namespace __gnu_pbds;             
typedef priority_queue<pii, vector<pii > > max_pq;
typedef priority_queue<pii, vector<pii> , greater<pii>  > min_pq;
ll toint(const string &s) {stringstream ss; ss << s; ll x; ss >> x; return x;}
string tostring ( ll number ){stringstream ss; ss<< number; return ss.str();}
 
// using namespace __gnu_pbds;         
// typedef priority_queue<pair<ll,char> , vector<pair<ll , char> > > max_pq;
// typedef priority_queue<pii , vector<pii > ,greater<pii > > min_pq;
typedef tree<pair<string,string> , null_type, less<pair<string,string> >, rb_tree_tag, tree_order_statistics_node_update> OST;
// typedef priority_queue<pair < ll , pair < pii , ll > >  , vector<pair < ll , pair < pii , ll > >  > ,greater<pair < ll , pair < pii , ll > >  > > min_pq;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << std::endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif
#define nn 2000005
ll ar[ N ];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    ll x,n;
    cin >> x >> n;
    ll vl = INT_MAX;
    ll kaun = -1;
    set < ll > s;
    for ( ll i = 0; i <= 200; i ++){
        s.insert(i);
    }
    for ( ll i =1; i <= n; i ++){
        cin >> ar[i];
        if ( s.find(ar[i]) != s.end() ){
            s.erase(ar[i]);
        }
    }
    for ( auto it : s){
        if ( abs(it-x) < vl ){
            vl = abs(it-x);
            kaun = it;
        }
    }
    cout << kaun;
}

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

using namespace std;

int a[100000], d[100000], cnt[100000], c[100000], sum[100000];
vector<int> ve[100000];

bool u[100000];

int main()
{
    int n;
    cin >> n;
    for (int i = 1; i < n; i++){
        cin >> a[i];
        a[i]--;
        u[a[i]] = 1;
        cnt[a[i]]++;
        c[a[i]]++;
    }

    queue<int> q;
    for (int i = 0; i < n; i++)
        if (!u[i]){
            q.push(i);
            d[i] = 0;
        }

    while (!q.empty()){
        int v = q.front();
        q.pop();

        sort(ve[v].begin(), ve[v].end());
        int it = 1;
        for (int i = (int)ve[v].size() - 1; i >= 0; i--)
            d[v] = max(d[v], it + ve[v][i]), it++;

        cnt[a[v]]--;

        if (v != 0){
            ve[a[v]].push_back(d[v]);

            if (cnt[a[v]] == 0)
                q.push(a[v]);
        }
    }

    cout << d[0] << '\n';
    return 0;
}


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

int main() {
    int n, a, b;
    cin >> n >> a >> b;
    long sum;
    long sum_soms = 0;
    string s;
    for (int i = 1; i < n + 1; i++) {
        s = to_string(i);
        sum = 0;
        for (int j = 0; j < s.size(); j++) {
            sum += s[j] - '0';
        }
        if (sum >= a && sum <= b) sum_soms += i;
    }
    cout << sum_soms << endl;
}

Measured memory_bytes: 3700
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 inputSec = Integer.parseInt(br.readLine());

	    int h = inputSec / 3600;
        int m = (inputSec % 3600) / 60;
        int s = (inputSec % 3600) % 60;

	    System.out.println(h + ":" + m + ":" + s);

	}
}

Measured memory_bytes: 24180
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//V,P(大文字)使用不可

const ll INF=1e18;

signed main(){
    int n;
    cin>>n;
    V<ll> u(3),l(n);
    rep(i,3) cin>>u[i];
    rep(i,n) cin>>l[i];
    int a=1;
    rep(i,n) a*=4;
    ll ans=INF;
    for(int i=0;i<a;i++){
        int b=i;
        string s;
        V<V<ll>> use(3);
        for(int j=0;j<n;j++){
            s+=to_string(b%4);
            b/=4;
        }
        set<int> st;
        for(int j=0;j<n;j++){
            if(s[j]!='3'){
                int v=s[j]-'0';
                st.insert(v);
                use[v].push_back(l[j]);
            }
        }
        if(st.size()==3){
            ll cnt=0;
            rep(j,3){
                ll c=0;
                for(ll cc:use[j]) c+=cc;
                cnt+=abs(c-u[j])+10*(use[j].size()-1);
            }
            chmin(ans,cnt);
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main(){
  int N;
  map<string, int> m;
  cin >> N;
  map<string, int>::iterator iter;
  for(int i = 0; i < N; i++){
    string s;
    cin >> s;
    iter = m.find(s);
    if(iter != m.end()){
        continue;
    }
    else{
    	m[s] = i;
    }
  }
  cout << m.size() <<endl;
  return 0;
}
    
  

Measured memory_bytes: 19200
fun main(args: Array<String>) {
  val (a, b, x) = readLine()!!.split(" ").map { it.toLong() }
  println(f(b, x) - f(a - 1, x))
}

fun f(x: Long, n: Long) = if (x == -1L) {
  0
} else {
  x / n + 1
}

Measured memory_bytes: 37748
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int a,b,c;
    cin >> a >> b >> c;
    bool result=false;
    if(a+b==c){
        result=true;
    }else if(a+c==b){
        result=true;
    }else if(b+c==a){
        result=true;
    }
    if(result){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll n;
  cin >> n;
  for (ll i = sqrt(n); i >= 1; i--) {
    if (n % i == 0) {
      ll m = max(i, n / i), ans = 0, dec = 1;
      while (m >= dec) {
        ans++;
        dec *= 10;
      }
      cout << ans;
      return 0;
    }
  }
  return 0;
}


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

int main(){
    ll a,b;
    cin >> a >> b;
    cout << a / __gcd(a,b) * b << endl;
}

Measured memory_bytes: 256
str = input()
N = int(str.split()[0])
X = int(str.split()[1])

str = input()
L = []
for i in range(N) :
	L.append(int(str.split()[i]))

D = 0
i = 0
while(D <= X) :
	if (i == len(L)) :
		if (D <= X):
			i = N + 1
		break
	D = D + L[i]
	i = i + 1


print(i)


Measured memory_bytes: 3064
//This code is written by Anubhav Srivastava(anubhavsrivastavawebpage.wordpress.com)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,v1;
    cin >> n>>k;
    ll c=(n/k)+1;
    cout << min(n%k, abs((c*k)-n)); 
    return 0;
}


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

int main(){
  int A, B;
  cin >> A >> B;
  int a = 0, b = 0, c = 0, d = 0;
  int count = 0;
  
  for (int i = A; i <= B; i++ ){
    a = ( i / 10000 ) % 10;
    b = ( i / 1000 ) % 10;
    c = ( i / 10 ) % 10;
    d = ( i / 1 ) % 10;
    
    if (a == d && b == c){
      count += 1;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template<class T> bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template<class T> bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

struct node {
    bool root;
    int child;
    int h;
    node():root(1),child(-1) {}
};
signed main() {
    int n,k;
    cin>>n>>k;
    vector<node> g(n);
    REP(i,n) {
        int a;
        cin>>a;
        g[i].child=a-1;
        if(a-1>0) g[a-1].root=0;
    }
    unordered_set<int> ans;
    REP(i,n) {
        if(g[i].child==-1) ans.insert(i);
        else if(g[i].root) {
            int cur=i;
            int d=k;
            while(g[cur].child!=-1 && d>0) {
                ans.insert(cur);
                g[cur].h=d;
                cur=g[cur].child;
                d--;
                if(g[cur].h>=d) break;
            }
        }
    }
    cout<<SZ(ans)<<endl;
    return 0;
}

Measured memory_bytes: 9316
N,K = map(int, input().split())
X = [int(x) for x in input().split()]

List = []
for j in range(N-K+1):
    if X[j]<=0 and X[j+K-1]>=0:
        List.append(X[j+K-1]-X[j]+min(abs(X[j]),X[j+K-1]))
    else:
        List.append(max(abs(X[j]),abs(X[j+K-1])))

print(min(List))

Measured memory_bytes: 14384
#pragma GCC optimize("O3")
//#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx2")
#define io_init cin.tie(0);ios::sync_with_stdio(0);cout<<setprecision(10)
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

// 001
// 110
// 011

// 100
int main() {
	ll N, K;
	cin >> N >> K;
	vector<ll> cnt(64, 0);
	vector<ll> A(N);
	for (int i = 0; i < N; i++) {
		ll tmp;
		cin >> tmp;
		A[i] = tmp;
		for (int j = 0; j < 63; j++) {
			cnt[j] += (((1LL << j) & tmp) != 0);
		}
	}
	ll m = log2(K);
	ll ans = 0;
	ll a = 0;
	bool flag = true;
	for (int i = m; i >= 0; i--) {
		//cout << cnt[i] << endl;
		
		if (cnt[i] >= N - cnt[i]) {
			if ((K & (1LL << i)) != 0)flag = false;
		}
		else {
			if (flag && (K & (1LL << i)) == 0)continue;
			a += (1LL << i);
		}
	}
	for (int i = 0; i < N; i++) {
		ans += a ^ A[i];
	}
	//cout << a << endl;
	cout << ans << endl;
}


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

using namespace std;

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

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

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    string t = "";
    rep (i, s.size()) {
        if (s[i] == 'e') {
            t += "esare";
            i += 4;
        } else if (s[i] == 'm') {
            t += "maerd";
            i += 4;
        } else {
            if (i + 2 < s.size()) {
                if (s[i + 2] == 'm') {
                    t += "remaerd";
                    i += 6;
                } else {
                    t += "resare";
                    i += 5;
                }
            }
        }
    }
    cout << ((s == t) ? "YES" : "NO") << endl;

    
    return 0;
}



Measured memory_bytes: 592
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let s: Vec<char> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.trim().chars().collect()
    };

    let N = s.len();
    let ans = (0..26).map(|k| {
        let c = (('a' as u8) + (k as u8)) as char;
        let mut dp = s.clone();
        let mut res = 10000;
        for i in 0..N {
            if dp.iter().all(|&x| x == c) { res = i; break; }
            for j in 0..(N - 1 - i) {
                dp[j] = if dp[j + 1] == c { c } else { dp[j] };
            }
            for j in (N - 1 - i)..N {
                dp[j] = c;
            }
        }
        res
    }).min().unwrap();

    println!("{}", ans);
}

Measured memory_bytes: 4476
import java.util.Scanner;

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

        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int C = scanner.nextInt();
        int D = scanner.nextInt();

        int count = 0;
        while (A > 0 && C > 0) {
            if (count % 2 == 0) {
                C = C - B;
            } else {
                A = A - D;
            }
            count++;
        }

        if (A <= 0) {
            System.out.println("No");
        } else {
            System.out.println("Yes");
        }
    }
}


Measured memory_bytes: 35768
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N;
  cin >> N;
  int ans = -1, ng = -1, ok = N;
  string s, t;
  cout << 0 << endl;
  fflush(stdout);
  cin >> t;
  if(t == "Vacant"){
    cout << 0 << endl;
    ans = 0;
  }
  vector<string> T;
  if(t == "Male"){
    T = {"Male","Female"};
  }
  if(t == "Female"){
    T = {"Female","Male"};
  }
  while(ans < 0){
    int m = (ok + ng)/2;
    cout << m << endl;
    fflush(stdout);
    cin >> t;
    if(t == "Vacant"){
      ans = m;
      continue;
    }
    if(T[m%2] == t){
      ng = m;
    }else{
      ok = m;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 852
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

long long int my_gcd(long long int c, long long int d)
{
    if (c < d) {
        c ^= d;
        d ^= c;
        c ^= d;
    }
    return d ? my_gcd(d, c % d) : c;
}

long long int my_lcm(long long int c, long long int d)
{
    return c * d / my_gcd(d, c);
}

int main()
{
    long long int a, b, c, d, cd, ans;
    long long int a_b_num, c_num, d_num, cd_num;
    cin >> a >> b >> c >> d;
    cd = my_lcm(c, d);
    a_b_num = b - a + 1;
    if (a % c == 0) c_num = b/c - a/c + 1; 
    else c_num = b/c - a/c; 
    if (a % d == 0) d_num = b/d - a/d + 1; 
    else d_num = b/d - a/d; 
    if (a % cd == 0) cd_num = b/cd - a/cd + 1; 
    else cd_num = b/cd - a/cd; 

//    cout << a_b_num << endl;
//    cout << c_num << endl;
//    cout << d_num << endl;
//    cout << cd_num << endl;
    ans = a_b_num - c_num - d_num + cd_num;
    cout <<  ans << endl;
}


Measured memory_bytes: 256
s = input()
cnt = len(s) - 1
bitlist = []
sums = 0
for i  in range(2**cnt):
    op = [True] * cnt 
    for j in range(cnt):
        if ((i >> j) & 1):
            op[cnt - 1 - j] = False
    bitlist.append(op)
ans = []           
for i in range(2**cnt):
    now = 0
    for j in range(cnt):
        if bitlist[i][j]:
            ans.append(int(s[now:(j+1)]))
            now = j + 1
    ans.append(int(s[now:(cnt + 1)]))
    sums += sum(ans)
    ans=[]
print(sums)

Measured memory_bytes: 3064
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
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;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//円周率
const double PI = 3.14159265358979323846;

int main() {
	int N; cin >> N;
	vector<ll> a(N); rep(i, N)cin >> a[i];

	vector<ll> b(8);
	int cnt = 0;
	rep(i, N) {
		if (a[i] >= 1 && a[i] <= 399) b[0] = 1;
		else if (a[i] <= 799) b[1] = 1;
		else if (a[i] <= 1199) b[2] = 1;
		else if (a[i] <= 1599) b[3] = 1;
		else if (a[i] <= 1999) b[4] = 1;
		else if (a[i] <= 2399) b[5] = 1;
		else if (a[i] <= 2799) b[6] = 1;
		else if (a[i] <= 3199) b[7] = 1;
		else cnt++;
	}

	int ans = 0;
	rep(i, 8) ans += b[i];

	if(ans != 0)cout << ans << ' ' << ans + cnt << endl;
	else cout << 1 << ' ' << ans + cnt << endl;
}

Measured memory_bytes: 256
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
A.reverse()
if N % 2:
	B = [i for i in range(2,N,2)]*2
	B.sort()
	B.reverse()
	B.append(0)
else:
	B = [i for i in range(1,N,2)]*2
	B.sort()
	B.reverse()
if A == B:
	ans = 2**(N//2)
else:
	ans = 0
print(ans%(10**9+7))



Measured memory_bytes: 14008
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

struct Node {
	int key;
	Node *next, *prev;
};

Node *nil;  //??????????????????

Node* listSearch(int key) {
	Node *cur = nil->next;  //??????????¬????????´????????????????
	while (cur != nil && cur->key != key) {
		cur = cur->next;
	}
	return cur;
}

void init() {
	nil = (Node *)malloc(sizeof(Node));
	nil->next = nil;
	nil->prev = nil;
}

void PrintList() {
	Node *cur = nil->next;
	int isf = 0;
	while (1) {
		if (cur == nil) break;
		if (isf++ > 0) printf(" ");
		printf("%d", cur->key);
		cur = cur->next;
	}
	printf("\n");
}

void deleteNode(Node *t) {
	if (t == nil) return; // t ??????????????´?????????????????????
	t->prev->next = t->next;
	t->next->prev = t->prev;
	free(t);
}


void deleteFirst() {
	deleteNode(nil->next);
}


void deleteLast() {
	deleteNode(nil->prev);
}

void deleteKey(int key) {
	//????´¢????????????????????????
	deleteNode(listSearch(key));
}

void insert(int key) {
	Node *x = (Node *)malloc(sizeof(Node));
	x->key = key;
	//???????????´??????????´??????????
	x->next = nil->next;
	nil->next->prev = x;
	nil->next = x;
	x->prev = nil;
}

int main() {
	int key, n, i;
	int size = 0;
	char com[20];
	int np = 0, nd = 0;
	scanf("%d", &n);
	init();
	for (i = 0; i < n; i++) {
		scanf("%s%d", com, &key);
		if (com[0] == 'i') { insert(key); np++; size++; }
		else if (com[0] == 'd') {
			if (strlen(com) > 6) {
				if (com[6] == 'F') deleteFirst();
				else if (com[6] == 'L') deleteLast();
			}
			else {
				deleteKey(key);
			}
			size--;
		}
	}

	PrintList();

	return 0;
}

Measured memory_bytes: 33820
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():

    n,p=map(int,input().split())
    A=list(map(int,input().split()))
    even=0
    odd=0
    for i in range(n):
        if A[i]%2==0:
            even+=1

    odd=n-even
    if odd==0:
        print(2**n if p==0 else 0)
    else:
        print((2**even)*2**(odd-1))



resolve()

Measured memory_bytes: 38256
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))

n, u, v = na()
u -= 1; v -= 1
g = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = na()
    a -= 1; b -= 1
    g[a].append(b)
    g[b].append(a)

def dfs(v):
    dist = [-1] * n
    stack = [v]
    dist[v] = 0
    while stack:
        v = stack.pop()
        dw = dist[v] + 1
        for w in g[v]:
            if dist[w] == -1:
                dist[w] = dw
                stack.append(w)
    return dist

dist_v = dfs(v)
dist_u = dfs(u)
ans = 0
for rv, ru in zip(dist_v, dist_u):
    if rv > ru:
        ans = max(ans, rv-1)
print(ans)



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

using namespace std;

bool cmp(char a , char b)
{
    return b<a;
}

int strkkk(char *a,char *b)
{
    int la=strlen(a),lb=strlen(b);
    int k=min(la,lb);
    for(int i=0;i<k;i++)
    {
        if(a[i]>b[i])
            return 1;
        else if(a[i]<b[i])
            return 0;
    }
    if(la>lb)
        return 1;
    else return 0;

}

int main()
{
    char a[200],b[200];
    int i;
    cin>>a>>b;
    int la=strlen(a);
    int lb=strlen(b);
    sort(a,a+la);
    sort(b,b+lb,cmp);
    ///cout<<a<<'\n'<<b<<'\n';
    if(strkkk(b,a))
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;


}

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

using namespace std;

const int nmax = 2e4 + 10;

int n, i;
int p[nmax], r[nmax];

int main()
{
   // freopen("input.in","r",stdin);
   // freopen("output.out","w",stdout);

    scanf("%d", &n);
    for (i = 1; i <= n; ++i)
        scanf("%d", &p[i]),
        r[p[i]] = i;

    for (i = 1; i <= n; ++i)
        printf("%d ", 30000 * i);
    printf("\n");

    for (i = 1; i <= n; ++i)
        printf("%d ", 30000 * (n - i) + r[i]);
    printf("\n");

    return 0;
}


Measured memory_bytes: 768
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<28));
const ll linf = (1LL<<58);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    for(int i=0; i<s.size(); i++)
    {
        if(i%2==0) cout << s[i];
    }
    return 0;
}


Measured memory_bytes: 592
#include<iostream>
using namespace std;
int main()
{    
    int A1, A2, A3,sum;
    cin >> A1 >> A2 >> A3;
     sum = A1+A2+A3;
    if(sum>=22)
    {
        cout << "bust";
    }
   else{
     cout << "win";
   }
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner cin = new Scanner(System.in);
        
        int n = 0;
        int m = 0;
        ArrayList<Integer> x = new ArrayList<Integer>();
        
        for(int i = 0; cin.hasNext(); i++){
	        String line = cin.nextLine();
	        
	        if(i == 0) {
	            String[] nm = line.split(" ", 0);
	            n = Integer.parseInt(nm[0]);
	            m = Integer.parseInt(nm[1]);
	            
	        } else if(i == 1) {
	            String[] _x = line.split(" ", 0);
	            
	            for(int j = 0; j < _x.length; j++) {
	                x.add(Integer.parseInt(_x[j]));
	                
	            }
	            
	        } else {
	            
	        }
	        
        }
        
        if(n >= m) {
            System.out.println(0);
            return;
        }
        
        x.sort(Comparator.naturalOrder());
        
        ArrayList<Integer> d = new ArrayList<Integer>();
        
        for(int i = 1; i < x.size(); i++) {
            d.add(x.get(i) - x.get(i - 1));
            
        }
        
        ArrayList<Integer> _d = (ArrayList<Integer>)d.clone();
        int pmasu = -1;
        int cmasu = 0;
        int res = 0;
        
        _d.sort(Comparator.reverseOrder());
        
        for(int i = 0; i < n; i++) {
            cmasu = d.indexOf(_d.get(i));
            res += x.get(cmasu) - x.get(pmasu  + 1);
            pmasu = cmasu;
            
        }
        
        res += x.get(x.size() - 1) - x.get(pmasu);
        
        System.out.println(res);
        
    }
    
}


Measured memory_bytes: 50852
''' ===========================================
from collections import deque
    appendleft() = push_front(), append = push_back()
    popfleft() = pop_front(), pop() = pop_back()
import heapq #heappush(trgt, val) heappop(trgt) trgt[0] __lt__<
=========================================== '''
##======================================python3
import sys
import collections
input = sys.stdin.readline().rstrip
from sys import stdin #read(), readline()
sys.setrecursionlimit(10**6)
INF = 1<<50
MINI = 100005

class gv:
    input = None;
    
def build():
    gv.str = input()

def solve():
    slen = len(gv.str)
    if (slen&1) == 1:
        print("No")
        return
    
    for i in range(0,slen,2):
        if (gv.str[i:i+2] == "hi") :
            pass
        else :
            print("No")
            return
    
    print("Yes")
    
    

if __name__ == '__main__':
    build()
    solve()



Measured memory_bytes: 3316
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    NI = lambda : int(sys.stdin.readline())

    K = NI()
    ans = 0
    m = 0
    while True:
        m = (m * 10 + 7) % K
        ans += 1
        if m == 0 or ans > K: break
    if ans <= K:
        print(ans)
    else:
        print(-1)


if __name__ == '__main__':
    main()

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

const int maxn = 110000;

int a[maxn];
int nxt[maxn][20];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n, l, q; cin >> n;
	for(int i = 1; i <= n; ++ i) cin >> a[i];
	cin >> l;
	for(int i = 1; i <= n; ++ i) {
		int nx = upper_bound(a + i, a + n + 1, a[i] + l) - a;
		nxt[i][0] = nx - 1;
	}
	for(int j = 1; j < 20; ++ j) for(int i = 1; i <= n; ++ i)
		nxt[i][j] = nxt[nxt[i][j - 1]][j - 1];
	cin >> q;
	while(q --) {
		int a, b; cin >> a >> b;
		if(a > b) swap(a, b);
		int ans = 0;
		while(a != b) {
			int j = 0, f = 0;
			for(j = 0; j < 20; ++ j) {
				if(nxt[a][j] >= b) {
					if(j == 0) {
						ans ++;
						f = 1;
						break;
					} else {
						-- j;
						a = nxt[a][j];
						ans += 1 << j;
						break;
					}
				}
			}
			if(f) break;
		}
		cout << ans << "\n";
	}
	return 0;
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c;
  cin>>a>>b>>c;
  if(a== b && b == c && a % 2 != 1 ) 
    cout<<"-1";
  else{
    int count=0;
    while(a % 2 ==0 && b % 2 ==0 && c % 2 ==0){
   int d=b/2+c/2,e=c/2+a/2,f=a/2+b/2;
 	a=d;
  	b=e;
  	c=f;
  
  count++;
 	 }
cout<<count;
	}
}


Measured memory_bytes: 3556
N, M = map(int, input().split())

A = map(int, input().split())

# キー：数、値：枚数
ansDict = {}

# 最初の数を辞書に入れる
for Ai in A:
    if Ai in ansDict.keys():
        ansDict[Ai] += 1
    else:
        ansDict.setdefault(Ai,1)

# B:枚数、C:値
for i in range(M):
    B, C = map(int,input().split())
    if C in ansDict.keys():
        ansDict[C] += B
    else:
        ansDict.setdefault(C, B)

# 使用予定の値
ansKeys = list(ansDict.keys())
ansKeys.sort(reverse=True)
# 最終的な解答
ans = 0
# 現在何枚書き換えたか
cards = 0

# ※ 初期状態もansDictの中に突っ込んだため、書き換え忘れのカードはないはず
for num in ansKeys:
    if cards >= N:
        break
    else:
        if N >= cards + ansDict[num]:   # 問題なく現在の数を書き込める
            ans += ansDict[num] * num
        else:                           # 書き込めるカード数に限りがある
            ans += (N - cards) * num
        cards += ansDict[num]

print(ans)

Measured memory_bytes: 32060