akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
typedef struct Dice{int t,s,e,w,n,b;}dice;
void koro(dice *d,char *h);
void koro_to_ewn(dice *di_kijun,dice *di_tmp);
int check(dice *di_kijun,dice *di_check);
int hante=0;

int main(void){
    dice di_kijun,di,di_tmp;
    int i,dice[7];

    for(i=0;i<6;i++)scanf("%d",&dice[i]);
    di_kijun.t=dice[0];di_kijun.s=dice[1];di_kijun.e=dice[2];di_kijun.w=dice[3];di_kijun.n=dice[4];di_kijun.b=dice[5];
	
	for(i=0;i<6;i++)scanf("%d",&dice[i]);
    di.t=dice[0];di.s=dice[1];di.e=dice[2];di.w=dice[3];di.n=dice[4];di.b=dice[5];

	while(1){
		if(di.t==di_kijun.t){
			di_tmp=di;
			if(check(&di_kijun,&di_tmp)) break;
			koro_to_ewn(&di_kijun,&di_tmp);
		}
		if(hante) break;
		if(di.s==di_kijun.t){
			di_tmp=di;
			koro(&di_tmp,"N");
			if(check(&di_kijun,&di_tmp)) break;
			koro_to_ewn(&di_kijun,&di_tmp);
		}
		if(hante) break;
		if(di.e==di_kijun.t){
			di_tmp=di;
			koro(&di_tmp,"W");
			if(check(&di_kijun,&di_tmp)) break;
			koro_to_ewn(&di_kijun,&di_tmp);
		}
		if(hante) break;
		if(di.w==di_kijun.t){
			di_tmp=di;
			koro(&di_tmp,"E");
			if(check(&di_kijun,&di_tmp)) break;
			koro_to_ewn(&di_kijun,&di_tmp);
		}
		if(hante) break;
		if(di.n==di_kijun.t){
			di_tmp=di;
			koro(&di_tmp,"S");
			if(check(&di_kijun,&di_tmp)) break;
			koro_to_ewn(&di_kijun,&di_tmp);
		}
		if(hante) break;
		if(di.b==di_kijun.t){
			di_tmp=di;
			koro(&di_tmp,"S");koro(&di_tmp,"S");
			if(check(&di_kijun,&di_tmp)) break;
			koro_to_ewn(&di_kijun,&di_tmp);
		}
		break;
	}
	printf("%s\n",hante?"Yes":"No");
    return 0;
}


void koro(dice *d,char *h){
    dice dbuf;
    dbuf.t=d->t;dbuf.s=d->s;dbuf.e=d->e;dbuf.w=d->w;dbuf.n=d->n;dbuf.b=d->b;
    switch(*h){
        case 'S':
            d->t=dbuf.n;
            d->s=dbuf.t;
            d->e=dbuf.e;
            d->w=dbuf.w;
            d->n=dbuf.b;
            d->b=dbuf.s;
            break;
        case 'E':
            d->t=dbuf.w;
            d->s=dbuf.s;
            d->e=dbuf.t;
            d->w=dbuf.b;
            d->n=dbuf.n;
            d->b=dbuf.e;
            break;
        case 'W':
            d->t=dbuf.e;
            d->s=dbuf.s;
            d->e=dbuf.b;
            d->w=dbuf.t;
            d->n=dbuf.n;
            d->b=dbuf.w;
            break;
        case 'N':
            d->t=dbuf.s;
            d->s=dbuf.b;
            d->e=dbuf.e;
            d->w=dbuf.w;
            d->n=dbuf.t;
            d->b=dbuf.n;
            break;
    }
}

void koro_to_ewn(dice *di_kijun,dice *di_tmp){
	do{
	if(di_tmp->e==di_kijun->s){koro(di_tmp,"W");koro(di_tmp,"S");koro(di_tmp,"E");}
	if(check(di_kijun,di_tmp)) break;
	if(di_tmp->w==di_kijun->s){koro(di_tmp,"E");koro(di_tmp,"S");koro(di_tmp,"W");}		
	if(check(di_kijun,di_tmp)) break;
	if(di_tmp->n==di_kijun->s){koro(di_tmp,"S");koro(di_tmp,"S");koro(di_tmp,"E");koro(di_tmp,"E");} 
	if(check(di_kijun,di_tmp)) break;
	}while(0);
}

int check(dice *di_kijun,dice *di_check){
	if (di_kijun->t==di_check->t && di_kijun->s==di_check->s && di_kijun->e==di_check->e &&
		di_kijun->w==di_check->w && di_kijun->n==di_check->n && di_kijun->b==di_check->b){
		hante=1;
		return 1;
	}
	else
		return 0;
}

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

int main()
{
  int a, b, c, k;
  int output = 0;

  cin >> a >> b >> c >> k;

  if (k < a) {
    cout << k << endl;
  } else if (k < a + b) {
    cout << a << endl;
  } else {
    cout << 2 * a + b - k << endl;
  }

  return 0;
}


Measured memory_bytes: 3620
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from bisect import bisect_right

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
if a[0] <= 0 and a[-1] >= 0:
    print(sum(map(lambda x: abs(int(x)), a)))
    idx = bisect_right(a, 0)
    idx -= 1 if idx == n else 0
    x = a[0]
    y = a[idx]
    for aa in a[1:idx]:
        print(y, aa)
        y -= aa
    for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
    print(y, x)
else:
    if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
    x = a[0]
    y = a[-1]
    for aa in a[1:-1]:
        print(x, aa)
        x -= aa
    if a[0] < 0:
        y, x = x, y
    print(y, x)


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

int	main() {
	string S, T;
	cin >>S >>T;
	vector<int> A(27, 0);
	vector<int> B(27, 0);
	for (int i=0; i<S.size(); i++) {
		int s=S.at(i)-'a'+1;
		int t=T.at(i)-'a'+1;
		if (0==A.at(s)) {
			A.at(s) = t;
		} else if (A.at(s) == t) {
			continue;
		} else {
			cout <<"No" <<endl;
			return 0;
		}
		if (0==B.at(t)) {
			B.at(t) = s;
		} else if (B.at(t) == s) {
			continue;
		} else {
			cout <<"No" <<endl;
			return 0;
		}
	}
	cout <<"Yes" <<endl;
	return 0;
}


Measured memory_bytes: 776
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int A, B;
    cin >> A >> B;
    if (B % A == 0) cout << A + B << endl;
    else cout << B - A << endl;
    return 0;
}


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

const int MOD=1e9+7;
const int MAX_N=1e5+1;
int N;
vector<int> g[MAX_N];
ll dp[MAX_N][2];

ll dfs(int node, int parent)
{
    dp[node][0]=dp[node][1]=1;
    for(int i=0; i<g[node].size();++i){
        int next=g[node][i];
        if(next == parent) continue;
        dfs(next, node);
        dp[node][0] = (dp[node][0] * ((dp[next][0] + dp[next][1])%MOD))%MOD;
        dp[node][1] = (dp[node][1] * dp[next][0])%MOD;
    }
}

void solve()
{
	memset(dp, -1, sizeof(dp));
    dfs(1, -1);
    ll ans = (dp[1][0]+dp[1][1])%MOD;
    cout << ans << endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=0;i<N-1;++i){
	    int x,y;
		cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
	}
	solve();
	return 0;
}

Measured memory_bytes: 14208
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main()
{
    int n, k;
    M mp;
    V v;
    cin >> n >> k;

    for (int i = 1; i <= n; i++)
    {
        if (mp[i % k] == 0)
        {
            v.push_back(i % k);
        }
        mp[i % k]++;
    }

    ll ans = 0;
    for (int i = 0; i < v.size(); i++)
    {
        if ((v[i] * 2) % k != 0)
            continue;

        ll a = mp[v[i]];

        ans += a * a * a;
    }

    cout << ans << endl;

    return 0;
}

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

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long K, long long Q, std::vector<long long> A){
    vector<ll> ans_cnt(N);
    for (int i = 0; i < Q; i++)
        ans_cnt[A[i]]++;
    // for (auto x:ans_cnt){
    //     cout << x << " ";
    // }
    for(auto x:ans_cnt){
        if(K - (Q - x) > 0)
            cout << YES << endl;
        else
            cout << NO << endl;
    }
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> A(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&A[i]);
        A[i]--;
    }
    solve(N, K, Q, std::move(A));
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	int N; cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	vector<int> num(1e6+1);
	num[1] = 1;
	for (int i = 2; i <= 1e6; i++) {
		if (num[i] == 0) {
			num[i] = i;
			for (int j = 2; i * j <= 1e6; j++) {
				if (num[i * j] == 0)
					num[i * j] = i;
			}
		}
	}
	map<int, int> cnt;
	for (int i = 0; i < N; i++) {
		map<int, int> mul;
		while (a[i] != 1) {
			mul[num[a[i]]]++;
			if (mul[num[a[i]]] == 1)cnt[num[a[i]]]++;
			a[i] /= num[a[i]];
		}
	}

	int ty = 0;
	for (auto y : cnt) {
		if (y.second == N) {
			ty = 2;
			break;
		}
		else if (y.second >= 2) {
			ty = 1;
		}
		
	}

	if (ty == 0)cout << "pairwise coprime" << endl;
	if (ty == 1)cout << "setwise coprime" << endl;
	if (ty == 2)cout << "not coprime" << endl;
}


Measured memory_bytes: 14804
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

s = str(input())
K = I()
n = len(s)

a = set()
for i in range(n):
    for j in range(i+1,min(i+6,n+1)):
        a.add(s[i:j])

a = list(a)
a.sort()
print(a[K-1])

Measured memory_bytes: 39920
package main

import (
	"fmt"
)

func main() {
	var a, b, c int
	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)

	if (a + b + c) >= 22 {
		fmt.Println("bust")
	} else {
		fmt.Println("win")
	}
}

func ScanNums(len int) (nums []int) {
	var num int
	for i := 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) RFOR(i, n, 0)
#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const ll INF = 1e18;
const ll inf = 1e9;


void solve()
{
  ll A;
  scanf("%lld",&A);
  ll B;
  scanf("%lld",&B);
  cout << (A-1)*(B-1) << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
#include <utility>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;

int main() {
    long long l, r, ans,m;
    cin >> l >> r;
    m = 10000000000;
    for (long long i = l; i <= r; i++) {
        for (long long j = i+1; j <= r; j++) {
            ans = (i * j) % 2019;
            
            m = min(ans, m);
            if (ans == 0) {
                cout << m << endl;
                return 0;
            }
        }
    }
    cout << m << endl;

}





Measured memory_bytes: 256
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)
mod=10**9+7

n=int(input())
a=list(map(int,input().split()))
l=a[0]
for i in range(1,n):
  l=lcm(l,a[i])
l%=mod

ans=0
for i in range(n):
  ans+=l*pow(a[i],mod-2,mod)
  ans%=mod
print(ans)


Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,H,W,A,B,x=0;cin>>N>>H>>W;
  for(int i=0;i<N;i++){
    cin>>A>>B;
    if(H<=A&&W<=B)x++;
  }
  cout<<x<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>
#include <assert.h>
#include <unordered_set>
#include <random>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)


















int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), c(n + 1);
    REP(i, n){
        cin >> a[i];
        c[a[i]]++;
    }
    vector<ll> d(n + 1);
    REP(i, n + 1){
        d[c[i]]++;
    }
    vector<ll> r1(n + 1), r2(n + 1);
    for(ll i = 1; i <= n; i++){
        r1[i] += r1[i - 1];
        r1[i] += i * d[i];
        r2[i] += r2[i - 1];
        r2[i] += d[i];
    }
    auto f = [&](ll x){
        return (r1[x] + x * (r2[n] - r2[x])) / x;
    };
    ll ans = n;
    REP(i, n){
        while(ans > 0 && i + 1 > f(ans)) ans--;
        cout << ans << endl;
    }
}

Measured memory_bytes: 12544
#include <stdio.h>
#include <ctype.h>

int main()
{
    char ch;
    
    while(1)
    {
        scanf("%c", &ch);
        
        if(isupper(ch) == 0)
        {
            ch = toupper(ch);
            printf("%c", ch);
        }
        else if(islower(ch) == 0)
        {
            ch = tolower(ch);
            printf("%c", ch);
        }
        else
        {
            printf("%c", ch);
        }
        
        if(ch == '\n') break;
    }
    return 0;
}

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


int main() {
  int K,N, i,j;
  cin >> N >> K ;
  int ball_X[N];
  int dist=0;
  for(i=0;i<N;i++){cin >> ball_X[i];}
  for(i=0;i<N;i++){
    if(abs(K-ball_X[i])<abs(ball_X[i]))dist+=(abs(K-ball_X[i])*2);
      else dist+=(abs(ball_X[i])*2);
  }
  cout<<dist<<endl;
}


Measured memory_bytes: 256
/*
Single Source Shortest Path II (AOJ)(https://onlinejudge.u-aizu.ac.jp/problems/GRL_1_B)
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cmath>
#include <complex>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <iomanip>
using namespace std;

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define rep(n, i) Rep(0, n-1, i)
#define ENJYU std::ios::sync_with_stdio(false);std::cin.tie(0);

const int MAX_V = 1024;
const int MAX_E = 2048;
const int INF = 1<<29;

struct edge {int from, to, cost;};

edge es[MAX_E];

int dis[MAX_V];
int V, E;

//ゴールに続く負の閉路が存在すればtrueを返す
bool bellmanford(int s) {
	rep(V, v) dis[v] = INF;
	dis[s] = 0LL;
	rep(V, i) {
		rep(E, e) {
			edge ne = es[e];
			//始点から到達できてない点に隣接してる点へは緩和を行わない
			if (dis[ne.from] != INF && dis[ne.to] > dis[ne.from] + ne.cost) {
				dis[ne.to] = dis[ne.from] + ne.cost;
				//V回目の更新があれば負の閉路が存在
				if (i == V-1) return true;
			}
		}
	}
	return false;
}

void solve(void){
	int r;
	cin >> V >> E >> r;
	rep(E, i)
	{
		int s, t, d;
		cin >> s >> t >> d;
		es[i] = edge{s, t, d};
	}

	if (bellmanford(r))
	{
		cout << "NEGATIVE CYCLE" << endl;
		return;
	}

	rep(V, i)
	{
		if (dis[i] == INF)
		{
			cout << "INF" << endl;
		}
		else
		{
			cout << dis[i] << endl;
		}
	}

}

int main(void){
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}



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

namespace abc140_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            List<int> b = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            List<int> a = new List<int>();

            for (int index = 1; index < n - 1; index++)
            {
                int b_d = b[index - 1];
                int b_u = b[index];


                int ai = 0;
                if (b_d <= b_u)
                {
                    ai = b_d;
                }
                else
                {
                    ai = b_u;
                }

                a.Add(ai);
            }

            a.Add(b[0]);
            a.Add(b[n-2]);

            Console.WriteLine(a.Sum());
        }
    }
}


Measured memory_bytes: 13396
#pragma region
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n, m; cin >> n >> m;
	if (n == m)cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename T> 
struct BIT{
  Int n;
  vector<T> bit;
  //1-indexed
  BIT():n(-1){}
  BIT(Int n_,T d):n(n_),bit(n_+1,d){}
  
  T sum(Int i){
    T s=bit[0];
    assert(i);
    for(Int x=i;x<=n;x+=(x&-x))
      s+=bit[x];
    return s;
  }
  void add(Int i,T a){
    for(Int x=i;x>0;x-=(x&-x))
      bit[x]+=a;
  }
  T sum0(Int i){
    return sum(i+1);
  }
  void add0(Int i,T a){
    add(i+1,a);
  }
};

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> x(n),v(n);
  for(Int i=0;i<n;i++) cin>>x[i]>>v[i];
  {
    using P = pair<Int, Int>;
    vector<P> vp;
    for(Int i=0;i<n;i++) vp.emplace_back(x[i],v[i]);
    sort(vp.begin(),vp.end());
    for(Int i=0;i<n;i++) tie(x[i],v[i])=vp[i];
  }
  
  map<Int, Int> m;
  {
    vector<Int> b(v);
    sort(b.begin(),b.end());
    for(Int i=0;i<n;i++) m[b[i]]=i;
  }
  
  vector<Int> ls(n),rs(n);
  for(Int i=0,t=0;i<n;i++){
    chmax(t,v[i]);
    rs[i]=t;
  }
  for(Int i=n-1,t=v[n-1];i>=0;i--){
    chmin(t,v[i]);
    ls[i]=t;
  }

  const Int MOD = 1e9+7;
  auto add=[&](Int &a,Int b){a+=b;a%=MOD;};
  
  vector<Int> dp(n+1,0);
  dp[0]=1;
  BIT<Int> bit(n+10,0);

  Int p=-1;
  for(Int i=0;i<n;i++){
    Int l=m[ls[i]],r=m[rs[i]];
    while(p<r) p++,bit.add0(p,dp[p]);
    add(dp[r+1],dp[r+1]);
    add(dp[r+1],bit.sum0(l));
    
    //for(int j=0;j<=n;j++) cout<<dp[j]<<" ";
    //cout<<endl;
    //cout<<l<<" "<<r<<endl;
  }
  cout<<dp[n]<<endl;
  return 0;
}


Measured memory_bytes: 22184
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = [(1+p)/2 for p in P]
L = [0]*(N+1)
for i in range(N):
  L[i+1] = L[i]+P[i]
print(max(L[i+K]-L[i] for i in range(N-K+1)))

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

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

  cout << *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end()) << "\n";
}

Measured memory_bytes: 256
n,m=map(int,input().split())

p=[]
q=[]

for i in range(m):
    l,r=map(int,input().split())
    p.append(l)
    q.append(r)

p1=max(p)
q1=min(q)

if q1>=p1:
    print(q1-p1+1)
else:
    print(0)


Measured memory_bytes: 10996
#pragma region Macros
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

ll gcd(ll x, ll y) {
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}

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

  ll x, y;
  REP(i, 50) {
    if (cin >> x >> y) {
      ll d = gcd(x, y);
      cout << d << ' ' << x * y / d << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#define ll long long
#define double long double

using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    //poison -> antidote -> poison...
    int tot_antidote = a + b;
    if (a + b >= c - 1) {
        //eat everything
        cout << b + c;
        return 0;
    }
    int antidote_eaten = 0;
    int poison_eaten = 0;
    bool last_was_poison = false;
    while (tot_antidote > 0) {
        if (!last_was_poison) {
            c--;
            poison_eaten++;
            last_was_poison = true;
        } else {
            tot_antidote--;
            antidote_eaten++;
            last_was_poison = false;
        }
    }
    cout << min(antidote_eaten, b) + poison_eaten + 1;
}

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

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;

    int dx = tx - sx;
    int dy = ty - sy;

    string y1(dy, 'U');
    string x1(dx, 'R');
    string y2(dy, 'D');
    string x2(dx, 'L');
    string xa(1, 'L');
    string y3(dy+1, 'U');
    string x3(dx+1, 'R');
    string ya(1, 'D');
    string xb(1, 'R');
    string y4(dy+1, 'D');
    string x4(dx+1, 'L');
    string yb(1, 'U');
    string ans = y1 + x1 + y2 + x2 + xa + y3 + x3 + ya + xb + y4 + x4 + yb;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <string.h>
#include <stdio.h>
char s[100000];
int main(void){
    char a;
    int ans=0,i;
    scanf("%s",s);
    int len=strlen(s);
    //端に最小で何個おけば良いか
    a=s[0];
    for(i=1;i<len;i++){
        if(a!=s[i]){
            ans++;
            a=s[i];
        }
    }
    printf("%d\n",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = 3.141592654;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw	 "\n"
#define mod 1000000007

ll w,e;
int main(void)
{
	CIN;
	ll tc,l,k=0,sum=0,x=0,y,z=0,m=1,n=0,ans=0,cnt=0;
	string s;
	cin>>s;
	for(ll i=0;i<s.size();i++){
		if(s[i]=='E')e=1;
		else if(s[i]=='S')k=1;
		else if(s[i]=='W')w=1;
		else n=1;
	}
	if((n^k)|| (e^w))cout<<"No";
	else cout<<"Yes";
	
}

Measured memory_bytes: 3588
# Set given variables
inputVec = input().split(' ')
s_x = int(inputVec[0])
s_y = int(inputVec[1])
t_x = int(inputVec[2])
t_y = int(inputVec[3])

# Calculate difference
d_x = t_x - s_x
d_y = t_y - s_y

# move 1
result = 'R' * d_x + 'U' * d_y

# move 2
result += 'L' * d_x + 'D' * d_y

# move 3
result += 'D' + 'R' * (d_x + 1) + 'U' * (d_y + 1) + 'L'

# move 4
result += 'U' + 'L' * (d_x + 1) + 'D' * (d_y + 1) + 'R'

print(result)

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

const int MAX = 2e5 + 111;

ll n;

int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int a = 1; a <= 3500; ++a) {
        for (int b = a; b <= 3500; ++b) {
                ll l = n * 1LL * a * 1LL * b;
                ll r = 4 * 1LL * a * b - n * a - n * b;
                if (r > 0 && (l % r) == 0) {
                    cout << a << " " << b << " " << l / r << "\n";
                    return 0;
                }
        }
    }
    assert(false);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <array>
#include <math.h>
#include <numeric>
#include <sstream>
typedef long long ll;
using namespace std;

ll digit_count(ll num) {
    int c = 0;
    while(num > 0) {
        c++;
        num/=10;
    }
    return c;
}

int main(int argc, char const *argv[]) {
    ll n;
    cin >> n;
    ll A = 0;
    for (ll i = 1; i*i <= n; ++i) if (n%i == 0) A = max(A, i);
    ll B = n/A;
    int ans = max(digit_count(A), digit_count(B));
    cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SORT(x) sort(all(x));
#define DSORT(x) sort(all(x), greater<>());
#define PI 3.14159265358979323846264338327950288
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
using namespace std;
bool prime(int n){for(int i=2;i<=sqrt(n);i++){if(n%i==0){return 0;}}return 1;}
void normal(int &a) {a=a%mod;(a<0)&&(a=a+mod);}
int Add(int a,int b) {a=a%mod,b=b%mod; normal(a),normal(b); return (a+b)%mod; }
int Sub(int a,int b) {a=a%mod,b=b%mod; normal(a),normal(b); a=a-b; normal(a); return a; }
int Mul(int a,int b) {a=a%mod,b=b%mod; normal(a),normal(b); return (a*b)%mod;}
int Pow(int n,int x){int res=1; while(x){ if(x&1) res=Mul(res,n); n=Mul(n,n); x=x>>1;} return res;} 
int modInverse(int n){return Pow(n,mod-2);}
int Div(int a,int b) { return Mul(a, modInverse(b));}
const int E3 = 1e3 + 7;
const int E4 = 1e4 + 7;
const int E5 = 1e5 + 7;
const int E6 = 1e6 + 7;
const int E9 = 1e9 + 7;


int n;
signed main(){
    fio;
    vector<ll> v1;
    for(int i=0;i<2;i++){
    	ll x;
    	cin>>x;
    	v1.pb(x);
	}
	vector<ll> v2;
    for(int i=0;i<2;i++){
    	ll x;
    	cin>>x;
    	v2.pb(x);
	}
	SORT(v1);
	SORT(v2);
	
	ll t1=v1[0]*v2[0];
	ll t2=v1[1]*v2[1];
	ll t3=v1[0]*v2[1];
	ll t4=v1[1]*v2[0];
	cout<<max4(t1,t2,t3,t4);
    return 0;
}



Measured memory_bytes: 3672
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	int k = 0;
	for (int i = 0; i < n; i++) {
		string ss = s.substr(n - 1 - i, i + 1);
		string tt = t.substr(0, i + 1);
		if (ss == tt) k = i + 1;
	}
	cout << 2 * n - k << endl;
	return 0;	
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}



int main(){
  int N ,R;
  cin >> N >> R;
  int x=0;
  if(N >= 10) cout <<  R;
  else cout << R+100*(10-N);
}

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

int main() {
  string ans,O,E;
  cin >> O >> E;

  for(int i=0;i<E.size();i++) {
    ans.push_back(O[i]);
    ans.push_back(E[i]);
  }
  if(O.size()>E.size()) ans.push_back(O.at(O.size()-1));

  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int dp[100009];

int main(){
  int n;
  int h[100009];
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  for(int i=1;i<n;i++){
    if(i-2>=0){
      dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    }
    else if(i-1>=0){
      dp[i]=dp[i-1]+abs(h[i]-h[i-1]);
    }
  }
  cout<<dp[n-1]<<endl;
  return(0);
}


Measured memory_bytes: 1024
#include<algorithm>
#include<bitset>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<unordered_map>
#include<utility>
#include<vector>

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;

template<typename T>
bool chmax(T& a, T b){
    if(a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
bool chmin(T& a, T b){
    if(b < a){
        a = b;
        return true;
    }
    return false;
}

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

    std::vector<int> d(n);
    for(int i = 0 ; i < n ; ++i){
        std::cin >> d[i];
    }
    d.emplace_back(0);
    std::sort(d.begin(), d.end());

    std::deque<int> deq;
    for(int i = 0 ; i < n + 1 ; ++i){
        if(i & 1){
            deq.push_back(d[i]);
        }else{
            deq.push_front(-d[i]);
        }
    }

    int ans = abs(deq[0] + 24 - deq[n]);
    for(int i = 0 ; i < n ; ++i){
        chmin(ans, deq[i + 1] - deq[i]);
    }

    std::cout << ans << std::endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr int INF = 2e9;
constexpr int mod = 1e9+7;

int main() {
  int n, m;
  cin >> n >> m;
  vector<P> key;
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    int cur = 0;
    rep(j,b) {
      int c;
      cin >> c; c--;
      cur |= (1 << c);
    }
    key.emplace_back(make_pair(a, cur));
  }

  vector<int> dp(1 << n, INF);
  dp[0] = 0;

  for (int bit = 0; bit < (1 << n); bit++) {
    for (int i = 0; i < m; i++) {
      dp[bit | key[i].second] = min(dp[bit | key[i].second], dp[bit] + key[i].first);
    }
  }
  cout << (dp[(1 << n) - 1] == INF ? -1 : dp[(1 << n) - 1]) << endl;
  return 0;
} 


Measured memory_bytes: 3668
#include <stdio.h>
#define max(a,b) (a > b ? a : b)
#define min(a,b) (a < b ? a : b)

int main(void) {
	int n, i;
	long long a, max = 0, min = 1000000000;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++) {
		scanf("%lld", &a);
		max = max(a, max);
		min = min(a, min);
	}
	
	printf("%lld", max - min);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the kth largest element.(0-based)

#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define pi pair<ll,ll>
#define all(X) X.begin(),X.end()

// for pair comparison function(ascending order) use return (i1.ff < i2.ff);

/* string operations :
   str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
   str.substr (x) : returns a substring str[x],... end of string
   str.find(qtr) : returns the first occurenece of qtr in str.
   builtin functions :
   __builtin_popcount(n) : no. of set bits in n.
   __builtin_parity(n) : parity of no. of set bits
   __builtin_clz(n) : no. of leading zeros before 1
   __builtin_ctz(n) : no of zeros from last to first occurrence of 1
*/

const int M = (1<<20)+5;
const int md = 1e9+7;

ll pwr(ll a,ll n,ll m)
{
	ll p=1;
	while(n>0)
	{
		if(n%2==1)
			p=(p*a)%m;
		a=(a*a)%m;
		n=n/2;
	}
	return p;
}

ll binlen(ll a)
{
	ll v = 0;
	for(ll i=0;i<61;++i)
	{
		v += (1ll<<i);
		if(a<=v) return i;
	}
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll a,b,c,k,x = 0;
	cin >> a >> b >> c >> k;

	if(k>0)
	{
		x += min(k,a);
		k -= min(k,a);
	}
	if(k>0)
	{
		k -= min(k,b);
	}
	if(k>0)
	{
		x -= min(k,c);
	}

	cout << x << endl;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
	int data[5];
	for(int i=0;i<5;i++)
		cin >> data[i];
	sort(data,data+5,greater<int>());
	for(int i=0;i<5;i++)
		cout << data[i] << (i==4?"\n":" ");
	
}

Measured memory_bytes: 0
// Template Headers {{{
#include <bits/stdc++.h>
using namespace std;

using pii = pair<int, int>; using vpii = vector<pii>;
using vi = vector<int>; using vvi = vector<vi>;
using ll = long long;
using pll = pair<ll, ll>; using vpll = vector<pll>;
using vll = vector<long long>; using vvll = vector<vll>;
template <class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T> istream &operator>>(istream &, vector<T> &);
template <class T> ostream &operator<<(ostream &, const vector<T> &);
template <class T, class U> istream &operator>>(istream &, pair<T, U> &);
template <class T, class U> ostream &operator<<(ostream &, const pair<T, U> &);
template <class T> struct Inf { static constexpr T inf() { return std::numeric_limits<T>::has_infinity ? std::numeric_limits<T>::infinity() : std::numeric_limits<T>::max(); } };
template <> struct Inf<int> { static constexpr int inf() { return 0x3f3f3f3f; } };
template <> struct Inf<long long> { static constexpr long long inf() { return 0x3f3f3f3f3f3f3f3fLL; } };
constexpr int INF = Inf<int>::inf(); constexpr ll BINF = Inf<ll>::inf();
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// }}}
// Preprocessing & "Global" variables {{{
struct Solver {
	Solver() {}
	int solve();
};
// }}}

int Solver::solve() {
	string s; cin >> s;
	string t = "AKIHABARA";
	int n = s.size(), m = t.size();
	int j = 0;
	for (int i = 0; i < m; i++) {
		if (j >= n || s[j] != t[i]) {
			if (t[i] != 'A') return cout << "NO" << endl, 0;
		} else {
			j++;
		}
	}
	cout << (j == n ? "YES" : "NO") << endl;
	return 0;
}

// Template Main {{{
int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	Solver solver;
	#ifdef JUDGE_MULTI_CASE
		int t; cin >> t; for (int i = 1; i <= t; i++)
	#endif
	solver.solve();
	// cout << "Case #" << i << ": ", solver.solve();
	return 0;
}

template <class T> istream &operator>>(istream &is, vector<T> &v) {
	for (auto it=v.begin();it!=v.end();++it) is >> *it;
	return is;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
	for (auto it=v.begin();it!=v.end();) os << *it, os << " \n"[++it==v.end()];
	return os;
}

template <class T, class U> istream &operator>>(istream &is, pair<T, U> &p) {
	return is >> p.first >> p.second;
}

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

// vim: fdm=marker


Measured memory_bytes: 3600
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

template<typename T>
string to_string(const vector<T>& vc, int w) {
	if(vc.empty()) return "";
	if(w + 1 == vc.size()) return to_string(vc[w]);
	return to_string(vc[w]) + "," + to_string(vc, w + 1);
}

template<typename T>
string to_string(const vector<T>& vc) {
	return "{" + to_string(vc, 0) + "}";
}

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int x;
	cin >> x;
	x ^= 1;
	cout << x << '\n';
}



Measured memory_bytes: 3644
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  ll n,k; cin >> n >> k;
  vector<ll> h(n);
  rep(i,n) cin >> h[i];
  sorti(h);
  ll res = 10e12+1;
  for (int i = 0; i <= n - k; ++i) {
    ll tmp = h[i+k-1] - h[i];
    res = min(res,tmp);
  }
  cout << res << endl;
}


Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    {
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = s[0];
            int a = s[1];
            int b = s[2];

            int ans = 0;
            for (int i = 1; i <= n; i++)
            {
                int sums = Sums(i);
                if (a <= sums && sums <= b)
                {
                    ans += i;
                }
            }
            WriteLine(ans);
        }

        static int Sums(int i)
        {
            if (i == 0) return 0;
            return i % 10 + Sums(i / 10);
        }
    }
}


Measured memory_bytes: 13396
H,W,A,B=map(int,input().split())
matrix=[[0]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        if (i<B and j<A) or (i>=B and j>=A):
            pass
        elif (i<B and j>=A) or (i>=B and j<A):
            matrix[i][j]=1
        else:
            pass
for i in range(H):
    if i==0:
        pass
    else:
        print()
    for j in range(W):
        print(matrix[i][j],end="")

        


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

int main() {
    int N;
    vector<int> b(110);
    cin >> N;
    for(int i = 0; i < N-1; i++){
        cin >> b.at(i);
    }
    int MaxSum = 0;
    MaxSum += b.at(0);
    MaxSum += b.at(N-2);

    for(int j = 0; j < N-2; j++){
        MaxSum += min(b.at(j), b.at(j+1));
    }
    cout << MaxSum << endl;
    return 0;
}


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

int main() {
  int K;
  cin >> K;
  vector<int64_t>vec;
  vec = {1,2,3,4,5,6,7,8,9};
  for(int j = 0; j < 50000; j++){
    if(vec.at(j) % 10 == 0){
      vec.push_back(10 * vec.at(j));
      vec.push_back(10 * vec.at(j) + 1);
    }
    else if(vec.at(j) % 10 == 9){
      vec.push_back(10 * vec.at(j) + 8);
      vec.push_back(10 * vec.at(j) + 9);
    }
    else if(vec.at(j) % 10 == 1){
      vec.push_back(10 * vec.at(j));
      vec.push_back(10 * vec.at(j) + 1);
      vec.push_back(10 * vec.at(j) + 2);
    }
    else if(vec.at(j) % 10 == 2){
      vec.push_back(10 * vec.at(j) + 1);
      vec.push_back(10 * vec.at(j) + 2);
      vec.push_back(10 * vec.at(j) + 3);
    }
     else if(vec.at(j) % 10 == 3){
      vec.push_back(10 * vec.at(j) + 2);
      vec.push_back(10 * vec.at(j) + 3);
      vec.push_back(10 * vec.at(j) + 4);
    }
     else if(vec.at(j) % 10 == 4){
      vec.push_back(10 * vec.at(j) + 3);
      vec.push_back(10 * vec.at(j) + 4);
      vec.push_back(10 * vec.at(j) + 5);
    }
     else if(vec.at(j) % 10 == 5){
      vec.push_back(10 * vec.at(j) + 4);
      vec.push_back(10 * vec.at(j) + 5);
      vec.push_back(10 * vec.at(j) + 6);
    }
    else if(vec.at(j) % 10 == 6){
      vec.push_back(10 * vec.at(j) + 5);
      vec.push_back(10 * vec.at(j) + 6);
      vec.push_back(10 * vec.at(j) + 7);
    }
    else if(vec.at(j) % 10 == 7){
      vec.push_back(10 * vec.at(j) + 6);
      vec.push_back(10 * vec.at(j) + 7);
      vec.push_back(10 * vec.at(j) + 8);
    }
    else if(vec.at(j) % 10 == 8){
      vec.push_back(10 * vec.at(j) + 7);
      vec.push_back(10 * vec.at(j) + 8);
      vec.push_back(10 * vec.at(j) + 9);
    }
  }
sort(vec.begin(), vec.end());
  
  cout << vec.at(K-1) << endl;
  


    
}



Measured memory_bytes: 1524
using System;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            string[] ST = Console.ReadLine().Split();
            for(int x = 0;x < N;x++)
            {
                Console.Write(ST[0].Substring(x, 1));
                Console.Write(ST[1].Substring(x, 1));
            }
        }
    }
}


Measured memory_bytes: 27508
#include <stdio.h>

int main(){
  int n, m, a, i;
  scanf("%d %d", &n, &m);
  n++;
  int dng[n];
  for(i = 0; i < n; i++){
    dng[i] = 0;
  }
  for(i = 0; i < m; i++){
    scanf("%d", &a);
    dng[a] = 1;
  }
  int ans[n];
  ans[0] = 1;
  ans[1] = !dng[1];
  for(i = 2; i < n; i++){
    if(!dng[i]){
      ans[i] = (ans[i - 1] + ans[i - 2]) % 1000000007;
    }else{
      ans[i] = 0;
    }
  }
  printf("%d\n", ans[n - 1]);
  return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;


public class Main{
  public static void main(String[] args){
  Scanner sc = new Scanner(System.in);
  int count = 0;
  int wcount = 0;
  //ArrayList<String> list = new ArrayList<String>();
  String[] array = new String[4];

  array = sc.next().split("");
  //for(int i=0; i<4; i++){
    //System.out.println(array[i]);
  //}
  ArrayList<String> list = new ArrayList<String>(Arrays.asList(array));

  for(int i=0; i<4; i++){
    for(int j=0;j<4; j++){
      if(array[i].equals(array[j])){
        count += 1;
        //System.out.println(count);
      }
    }
    if(count==2){
      wcount += 1;
    }
    count = 0;
  }
  //System.out.println(wcount);
  if(wcount == 4){
    System.out.println("Yes");
  }else{
    System.out.println("No");
  }

}
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int X,A,B;
    cin >>X>>A>>B;
    if(A>=B) cout << "delicious"<<endl;
    else if(B-A<=X) cout <<"safe" <<endl;
    else cout<<"dangerous"<<endl;



}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
     int S;
     int h,m,s;
     scanf("%d",&S);
     h = S / (60*60);
     m = ( S % (60*60))/60;
     s = S % 60;

     printf("%d:%d:%d\n",h,m,s);
     return 0;
}

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

int isPrime(int);

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

    scanf("%d",&n);

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

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

    return 0;
}

int isPrime(int num){
    if(num == 2)return 1;
    
    if(num <= 1 || num % 2 == 0)return -1;

    for(int i = 3;i <= sqrt(num);i += 2)if(num % i == 0)return -1;

    return 1;
}


Measured memory_bytes: 2056
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <iomanip>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	cin >> s;
	int n = s.length();
	int ans = 0;
	for (int i = 1; i < n; i++) {
		if (s[i] != s[i - 1])ans++;
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 512
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

A,B,N = nm()
q = min(B-1,N)
print(A*q // B)


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

int main(){
  int x;
  cin >> x;
  
  int max = 0, x2 = sqrt(x);
  for (int i=1 ; i<=x2; i++){
    for (int j=2 ; j<=x+1 ; j++){
      if (max < pow(i, j))
        max = pow(i, j);
      if (pow(i, j+1) > x)
        break;
    }
  }
  
  cout << max << endl;
}

Measured memory_bytes: 4024
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << "\n"; }

template <class T> void chmin(T &a, T b) {
  if (a > b)
    a = b;
}

template <class T> void chmax(T &a, T b) {
  if (a < b)
    a = b;
}


#line 2 "abc169_e.cpp"

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

  int n;
  cin >> n;
  vi a(n), b(n);
  REP(i, n) { cin >> a[i] >> b[i]; }
  sort(ALL(a));
  sort(ALL(b));

  if (n % 2 == 0) {
    int m = n / 2;
    int range1 = (a[m] + a[m - 1]);
    int range2 = (b[m] + b[m - 1]);
    cout << range2 - range1 + 1 << endl;

  } else {
    cout << b[n / 2] - a[n / 2] + 1 << endl;
  }
}


Measured memory_bytes: 4784
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        a: i64,
        b: i64,
    }
    let ans = if b<0 {
        if (b-a+1)%2==0 {
            "Positive"
        }else{
            "Negative"
        }
    }else if a> 0 {
        "Positive"
    }else{
        "Zero"
    };
    println!("{}", ans);
}

Measured memory_bytes: 4352
import math
n=int(input())
m=math.sqrt(n)
m=math.floor(m)+1
li=[]
for i in range(1,m):
    a=i+n/i
    li.append(a)
li=[li[i] for i in range(m-1) if li[i].is_integer()]
print(int(min(li))-2)


Measured memory_bytes: 34712
#include<bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define rep(i,n) for(int i=0; i<(n); ++i)
#define per(i,n) for(int i=n-1;i>=0;++i)
#define rep1(i,n) for(int i=1; i<=n; ++i)
#define per1(i,n) for(int i=n; i>=1; ++i)
#define debug cout << "line : " << __LINE__ << " debug" << endl
#define Dcout(N) cout << setprecision(20) << N << endl
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ) //被り削除
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define INF 1e8
#define MOD 1000000007
typedef long long ll;



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

      ll n,m; cin >> n >> m;
      vector<ll> h(n);
      rep(i,n) cin >> h[i];
      vector<ll> cnt(n);
      rep(i,m){
          int a,b; cin >> a >> b;
          a--;
          b--;
          if(h[a]<=h[b]) cnt[a] = 1;
          if(h[a]>=h[b]) cnt[b] = 1;
      }
      int ans = 0;
      rep(i,n){
          if(cnt[i]!=1) ans++;
      }

      cout << ans << endl;

      return 0;
}


Measured memory_bytes: 4784