akhauriyash/Code-Regression huggingface dataset:
// AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second
#define FOR(i,N) for(auto i=0; i<N; ++i)
#define FORREV(i,N,_cnt) for(auto i=N-1,cnt=_cnt; cnt > 0; --i, --cnt)
#define ALL(x) x.begin(), x.end()

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T& a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T& a, const T& b) { if (b > a) a = b; }
/* clang-format on */

template <class T>
struct UnionFind
{
	vector<T> data;
	UnionFind(T size) : data(size, -1) {}
	bool unionSet(T x, T y)
	{
		x = root(x); y = root(y);
		if (x != y)
		{
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(T x, T y)
	{
		return root(x) == root(y);
	}
	T root(T x)
	{
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	T size(T x)
	{
		return -data[root(x)];
	}
};

int main() {
#ifdef DEBUG
	ifstream ifs("in.txt");
	cin.rdbuf(ifs.rdbuf());
#endif
	ll N; cin >> N;
	set< pair< ll, ll> > XclassSet; // x座標、クラス
	set< pair< ll, ll> > YclassSet; // y座標、クラス
	UnionFind<ll> UF(N);
	priority_queue< tuple<ll,ll,ll> , vector< tuple<ll,ll,ll> >, greater< tuple<ll,ll,ll>> > Q; // 距離、class1, class2
	FOR(i, N)
	{
		ll x, y; cin >> x >> y;
		XclassSet.insert(make_pair(x, i));
		YclassSet.insert(make_pair(y, i));
	} // 隣接したX, 隣接したYの距離をpriority_queueにつっこむ。
	for (auto it = XclassSet.begin(); next(it) != XclassSet.end(); ++it) {
		ll dist = abs(it->first - next(it)->first);
		Q.push(tie(dist, it->second, next(it)->second));
	}
	for (auto it = YclassSet.begin(); next(it) != YclassSet.end(); ++it) {
		ll dist = abs(it->first - next(it)->first);
		Q.push(tie(dist, it->second, next(it)->second));
	}
	ll NoRemainClass = N - 1; // これがゼロになるまで。
	ll ans = 0;
	while (NoRemainClass != 0) {		
		ll dist, cls1, cls2;
		tie(dist, cls1, cls2) = Q.top(); Q.pop();
		if (UF.unionSet(cls1, cls2)) {
			NoRemainClass -= 1;
			ans += dist;
		}
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
  
  int N,K,sum = 0;
  cin >> N >> K;
  
  for(int i = 0;i < N;i++){
    int x;
    cin >> x;
    
    sum += min(x,K-x);
    
  }
  
    cout << sum*2 << endl;
  
}

  
 

  

  

 
  
  
  
 



Measured memory_bytes: 384
#include <stdio.h>
#include <string.h>
  
  
int main(void) {
    long int n, i = 2, ins[1000000], cou = 0, f = 0;
    long long int as;
       
    scanf("%ld", &n);
    as = n;
     
    while(i*i <= n){
        if(n % i == 0){
            n /= i;
            if(f == 0){
                ins[cou] = i;
                cou++;
                f = 1;
            }
        }
        else{
            f = 0;
            i++;
        }
    }
    if(n != 1) {
        f = 0;
        for(i = 0; cou > i; i++){
            if(ins[i] == n)
                f = 1;
        }
        if(!f){
            ins[cou] = n;
            cou++;
        }
    }
     
    for(i = 0; cou > i; i++){
        as = (as / ins[i]) * (ins[i]-1);
    }
    printf("%ld\n", as);    
    return 0;
}

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

int main(){
    map <int, int> penal, verd;
    int n, m;
    cin >> n >> m;
    while(m--){
        int p; cin >> p;
        string verdict;
        cin >> verdict;
        if(verdict == "WA"){
            if(!verd[p]){
                penal[p]++;
            }
        }
        else verd[p] = 1;
    }
    int score = 0, penalty = 0;
    for(auto it = penal.begin(); it != penal.end(); it++) if(verd[it->first]) penalty += it->second;
    for(auto it = verd.begin(); it != verd.end(); it++) score += it->second;
    cout << score << " " << penalty << endl;

}

Measured memory_bytes: 6144
N=int(input())
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
ans=1
for _ in range(N):
    t=int(input())
    ans=lcm(ans,t)
print(ans)


Measured memory_bytes: 2940
from fractions import gcd
import sys
sys.setrecursionlimit(4100000)

def ols(): return input()
def oli(): return map(int, input().split())
def olai(): return list(map(int, input().split()))
def olas(): return list(input().split())
def mlai(L): return [int(input()) for _ in range(L)]
def mlas(L): return [input() for _ in range(L)]

def ar(a, b, c=-1, d=-1, INIT=0):
    if(c==-1): return [[INIT]*b for _ in range(a)]
    if(d==-1): return [[[INIT]*c for _ in range(b)] for __ in range(a)]
    return [[[[INIT]*d for _ in range(c)] for __ in range(b)] for ___ in range(a)]

def lcm(a, b): return (a*b)//gcd(a, b)
#MOD
"""
P = 10**9 + 7
N = 700000 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2, N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]

def comb(a, b):
    if a<b: return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P
"""

l, = oli()
print((l/3)**3)


Measured memory_bytes: 64364
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define fd(i,a,b)for(int i=b,_e=a;i>=_e;--i)
#define ll long long
#define NO return printf("-1"),0
using namespace std;
const int N=1e5+5;
int n,b[N][2],bs,sz[N];
ll w[N],su;
vector<int>e[N];
unordered_map<ll,int>A;
void find(int x,int len){
	su+=len;
	for(int i:e[x])find(i,len+1);
}
int main(){
	ios::sync_with_stdio(0);
	cin>>n;
	fo(i,1,n)cin>>w[i],A[w[i]]=i,sz[i]=1;
	sort(w+1,w+n+1);
	fd(i,2,n){
		int x=A[w[i]],y;
		if(sz[x]*2>=n)NO;
		y=A[w[i]-n+sz[x]*2];
		if(!y)NO;
		++bs;b[bs][0]=x;b[bs][1]=y;
		sz[y]+=sz[x];
		e[y].push_back(x);
	}
	find(A[w[1]],0);
	if(su!=w[1])NO;
	fo(i,1,bs)printf("%d %d\n",b[i][0],b[i][1]);
}

Measured memory_bytes: 14500
#include<cstdio>
#include<algorithm>
using namespace std;
#define N 187
int f[N][N][N],g[N][N][N],n,m,is[N],f2[N][N][N],g2[N][N][N];
char s[N][N];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)scanf("%s",s[i]+1);
	for(int i=1;i<=n;i++)
	for(int j=i;j<=n;j++)
	{
		for(int k=1;k<=m;k++){is[k]=s[i][k]=='.';for(int l=i;l<=j;l++)if(s[l][k]!=s[i][k])is[k]=-1;}
		for(int k=1;k<=m;k++)
		{
			if(is[k]==-1)f[i][j][k]=k-1;
			else if(f[i][j][k-1]>=k)f[i][j][k]=f[i][j][k-1];
			else{f[i][j][k]=k;while(f[i][j][k]<m&&is[f[i][j][k]+1]==is[k])f[i][j][k]++;}
		}
	}
	for(int i=1;i<=m;i++)
	for(int j=i;j<=m;j++)
	{
		for(int k=1;k<=n;k++){is[k]=s[k][i]=='.';for(int l=i;l<=j;l++)if(s[k][l]!=s[k][i])is[k]=-1;}
		for(int k=1;k<=n;k++)
		{
			if(is[k]==-1)g[i][j][k]=k-1;
			else if(g[i][j][k-1]>=k)g[i][j][k]=g[i][j][k-1];
			else{g[i][j][k]=k;while(g[i][j][k]<n&&is[g[i][j][k]+1]==is[k])g[i][j][k]++;}
		}
	}
	if(f[1][n][1]==m){printf("0\n");return 0;}
	for(int i=1;i<=18;i++)
	{
		for(int j=1;j<=n;j++)
		for(int k=j;k<=n;k++)
		for(int l=1;l<=m;l++)
		{
			int t=f[j][k][f[j][k][l]==m?m:f[j][k][l]+1];
			if(f2[j][k][l]<t)f2[j][k][l]=t;
			if(g2[l][t][j]<k)g2[l][t][j]=k;
		}
		for(int j=1;j<=m;j++)
		for(int k=j;k<=m;k++)
		for(int l=1;l<=n;l++)
		{
			int t=g[j][k][g[j][k][l]==n?n:g[j][k][l]+1];
			if(g2[j][k][l]<t)g2[j][k][l]=t;
			if(f2[l][t][j]<k)f2[l][t][j]=k;
		}
		for(int j=1;j<=n;j++)
		for(int k=n;k>=j;k--)
		for(int l=1;l<=m;l++)
		f2[j][k][l]=max(max(f2[j][k][l],f2[j][k+1][l]),max(f2[j-1][k][l],f2[j][k][l-1]));
		for(int j=1;j<=m;j++)
		for(int k=m;k>=j;k--)
		for(int l=1;l<=n;l++)
		g2[j][k][l]=max(max(g2[j][k][l],g2[j][k+1][l]),max(g2[j-1][k][l],g2[j][k][l-1]));
		for(int j=1;j<=n;j++)
		for(int k=j;k<=n;k++)
		for(int l=1;l<=m;l++)
		f[j][k][l]=f2[j][k][l],f2[j][k][l]=0;
		for(int j=1;j<=m;j++)
		for(int k=j;k<=m;k++)
		for(int l=1;l<=n;l++)
		g[j][k][l]=g2[j][k][l],g2[j][k][l]=0;
		if(f[1][n][1]==m){printf("%d\n",i);return 0;}
	}
}//

Measured memory_bytes: 100480
from enum import Enum
import sys
import math

#0:中央,1:南,2:東,3:西,4:北,5:裏側
class Dice():

    def __init__(self):
        self.number = [i for i in range(6)]
        self.work = [i for i in range(6)]
        self.order = 'NNNNWNNNWNNNENNNENNNWNNN'

    def setNumber(self,n0,n1,n2,n3,n4,n5):
        self.number[0] = n0
        self.number[1] = n1
        self.number[2] = n2
        self.number[3] = n3
        self.number[4] = n4
        self.number[5] = n5

    def roll(self,loc):
        for i in range(6):
            self.work[i] = self.number[i]

        if loc == 'E':
            self.setNumber(self.work[3],self.work[1],self.work[0],self.work[5],self.work[4],self.work[2])
        elif loc == 'N':
            self.setNumber(self.work[1],self.work[5],self.work[2],self.work[3],self.work[0],self.work[4])
        elif loc == 'S':
            self.setNumber(self.work[4],self.work[0],self.work[2],self.work[3],self.work[5],self.work[1])
        elif loc == 'W':
            self.setNumber(self.work[2],self.work[1],self.work[5],self.work[0],self.work[4],self.work[3])

    def query(self,top_num,front_num):
        self.save_data = [i for i in range(6)]
        for i in range(len(self.number)):
            self.save_data[i] = self.number[i]
        ret =-1

        for i in range(len(self.order)):
            self.roll(self.order[i])
            if self.number[0] == top_num and self.number[1] == front_num:
                ret = self.number[2]
                break
        for i in range(len(self.number)):
            self.number[i] = self.save_data[i]

        return ret;

dice = Dice()
table = list(map(int,input().split()))
dice.setNumber(table[0],table[1],table[2],table[3],table[4],table[5])

num_query = int(input())
for loop in range(num_query):
    top_num,front_num = map(int,input().split())
    print("%d"%(dice.query(top_num,front_num)))
    



Measured memory_bytes: 6392
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int sz = 2e5+5;
//ll int arr[sz]={0},arr1[sz]={0},arr2[sz]={0};
char arr[205][205];
int arr1[205][205] = {0};
bool visited[205][205];
int prime[10005]= {0};
//vector <ll int> vec,vec1,vec2, edge, node;
//vector<pair<int, int>> vec[100],vec1;
vector <pair <int,int>> st;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
    string s;
    cin>>s;

    ll int k = 0;

    for(int i=0;i<s.size();i++)
    {
        k+=s[i]-'0';
    }

    if(k%9==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}


Measured memory_bytes: 3748
#include <bits/stdc++.h>
#define sz(x) int(x.size())
#define in(x) freopen(x, "r", stdin)
#define out(x) freopen(x, "w", stdout)
#define N 5 * 100500
#define oo ll(1e16)
#define ft first
#define sd second
#define pb push_back
#define ppb pop_back
#define el '\n'
#define elf endl
#define base ll(1e9 + 7)
using namespace std;
typedef long long ll;
typedef long double ld;

int n, m, h[N], mx[N], res;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

//    in("input.txt");

    cin >> n >> m;
    for (int i = 0; i < n; i++)
        cin >> h[i];

    for (int i = 0; i < m; i++) {
        int v, u; cin >> v >> u;
        v--; u--;

        mx[v] = max(mx[v], h[u]);
        mx[u] = max(mx[u], h[v]);
    }

    for (int i = 0; i < n; i++)
        if (h[i] > mx[i])
            res++;

    cout << res;
}


Measured memory_bytes: 4476
package main

import (
	"bufio"
	"fmt"
	"os"
)

var n int
var alpha = "abcdefghijklmnopqrstuvwxyz"
var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func main() {
	defer w.Flush()
	fmt.Fscan(r, &n)
	dfs("", 0)
}

func dfs(s string, mx int) {
	if len(s) == n {
		fmt.Fprintln(w, s)
		return
	}

	for i := 0; i < mx+1; i++ {
		t := s + string(alpha[i])
		dfs(t, max(i+1, mx))
	}
	return
}

// Utility
func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


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

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

    int N;
    cin >> N;
    string S;
    cin >> S;
    int Q;
    cin >> Q;
    vector<int> k(Q);
    REP(i, Q) cin >> k[i];

    for (int l : k) {
        ll D = 0, M = 0, tmp = 0, ans = 0;
        REP(i, N) {
            if (i >= l) {
                if (S[i-l] == 'D') {
                    tmp -= M;
                    D--;
                }
                if (S[i-l] == 'M') M--;
            }
            if (S[i] == 'D') D++;
            if (S[i] == 'M') {
                M++;
                tmp += D;
            }
            if (S[i] == 'C') ans += tmp;
        }
        cout << ans << '\n';
    }
}

Measured memory_bytes: 1948
#include <stdio.h>

int main(void) {
	int t[20][20];
	int i, j;
	int x, y, q;
	char c;
	int no_c = 0;
	int qmax = 0;
	int O = 5;
	for(i=0;i<20;i++) {
		for(j=0;j<20;j++) {
			t[i][j] = 0;
		}
	}
	
	while(scanf("%d%c%d%c%d\n", &x, &c, &y, &c, &q) == 5) {
		if(q == 1) {
			t[O+x][O+y]++;
			t[O+x-1][O+y]++;
			t[O+x+1][O+y]++;
			t[O+x][O+y-1]++;
			t[O+x][O+y+1]++;
		} else if(q == 2) {
			for(i=O+x-1;i<=O+x+1;i++) {
				for(j=O+y-1;j<=O+y+1;j++) {
					t[i][j]++;
				}
			}
		} else if(q == 3) {
			for(i=O+x-1;i<=O+x+1;i++) {
				for(j=O+y-1;j<=O+y+1;j++) {
					t[i][j]++;
				}
			}
			t[O+x-2][O+y]++;
			t[O+x+2][O+y]++;
			t[O+x][O+y-2]++;
			t[O+x][O+y+2]++;
		}
	}
	
	for(i=O;i<O+10;i++) {
		for(j=O;j<O+10;j++) {
			if(t[i][j] == 0) {
				no_c++;
			}
			if(qmax < t[i][j]) qmax = t[i][j];
		}
	}
	
	printf("%d\n%d\n", no_c, qmax);
	
	return 0;
}

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

ll ans = 0;
ll n, m, k;


int main(){
    ll n;
    cin >> n;

    ll ans=0;

    for(ll i=1;i<=n;i++){
        ll h=n/i;
        ans += h * (h + 1) * i / 2;

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

Measured memory_bytes: 3600
#include<iostream>
using namespace std;
int main()
{
    // 整数の入力
    int a;
    cin >> a;
    
    // 文字列の入力
    string s;
    cin >> s;
    string s2;
    
    s2 = a >= 3200 ? s : "red";
    // 出力
    cout << s2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define repk(i,m,n) for(ll i=m;i<n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define F first
#define S second
typedef long long ll;
typedef long double ld;
using namespace std;
const int MOD=1e9+7;
ll sum[200005]={0};
int main()
{
    ll n,k,temp,maxx=0;
    cin>>n>>k;
    rep1(i,n)
    {
        cin>>temp;
        sum[i]=sum[i-1]+temp;
    }
    rep(i,n-k+1)
    {
        maxx=max(maxx,sum[i+k]-sum[i]);
    }
    maxx+=k;
    cout<<maxx/2;
    if(maxx%2==1) cout<<".5";
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define ss second
#define ff first
#define INF 3000000000000001
#define ll_max 9000000000000000001
#define mod 1000000007
#define PI 3.14159265358979323846L
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
typedef vector<pair<ll,ll> > vll;
typedef vector<pair<int,int> > vii ;
typedef pair<ll,ll> pll;
const ll N = 100001;
const ll M = 1;

int main()
{
    fast;
    int _ = 1;
    //cin >> _;
    while(_--)
    {
        ll n, m = 0, x = 0, y = 0, ans = 0;
        cin >> n;
        x = 1;
        while(n)
        {
            ans += x;
            n = n >> 1;
            x = x * 2;
        }
        cout << ans << "\n";
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define LINF 1e18
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
//typedef tuple<ll, ll, ll> T;

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


int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M;
    cin>>N>>M;

    int L=0,R=N+1;
    REP(i,M){
        int l,r;
        cin>>l>>r;
        L=max(L,l);
        R=min(R,r);
    }
    if(L>R) cout<<0<<endl;
    else cout<<R-L+1<<endl;
}


Measured memory_bytes: 256
N, K = map(int, input().split())
A = []
B = []
C = [2*N+i+K for i in range(N)]
s = 2 * K + 3 * N // 2 + (1 if N % 2 == 0 else 0)
for i in range((N+1)//2):
    A.append(K+i*2)
    B.append(s-K-i-(2 if N % 2 == 0 else 0))
for i in range(N//2):
    A.append(K+1+i*2)
    B.append(s-K-i+N//2-(2 if N % 2 == 0 else 0))

for i in range(N):
    if A[i] + B[i] > C[i]:
        print(-1)
        break
else:
    for i in range(N):
        print(A[i], B[i], C[i])

Measured memory_bytes: 52152
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::cmp::{min, max};
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!{
        n: usize, S: [chars; n],
    }
    let (mut m, mut a, mut r, mut c, mut h):(i64, i64, i64, i64, i64) = (0, 0, 0, 0, 0);
    for i in 0..n{
        if S[i][0] == 'M'{
            m+=1;
        }
        else if S[i][0] == 'A'{
            a+=1;
        }
        else if S[i][0] == 'R'{
            r+=1;
        }
        else if S[i][0] == 'C'{
            c+=1;
        }
        else if S[i][0] == 'H'{
            h+=1;
        }
    }
    let D = [m, a, r, c, h];
    let mut ans:i64 = 0;
    let P = [0,0,0,0,0,0,1,1,1,2];
    let Q = [1,1,1,2,2,3,2,2,3,3];
    let R = [2,3,4,3,4,4,3,4,4,4];
    for i in 0..10{
        ans += D[P[i]] * D[Q[i]] * D[R[i]]; 
    }
    puts!("{}\n", ans);
}
fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

Measured memory_bytes: 16636
package main

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

func main() {
	_ = nextInt()
	K := nextInt()
	S := nextString()
	for i, s := range S {
		ss := string(s)
		if i+1 == K {
			fmt.Print(strings.ToLower(ss))
			continue
		}

		fmt.Printf(ss)
	}

	fmt.Println()
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

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

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>

int main()
{
	char a,b,c,d,e,x,f,g,h,i,j,k,l,y,m,n,o,p,q;
	scanf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",&a,&b,&c,&d,&e,&x,&f,&g,&h,&i,&j,&k,&l,&y,&m,&n,&o,&p,&q);
	printf("%c%c%c%c%c %c%c%c%c%c%c%c %c%c%c%c%c\n",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q);
	return 0; 
}

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

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

  vector<ll> s(n+1);
  rep(i, n) s[i+1]=s[i]+a[i];
  map<ll, ll> b;
  rep(i, n+1) b[s[i]]++;
  ll res=0;
  for (auto it : b) {
    ll num=it.second;
    res+=num*(num-1)/2;
  }
  cout<<res<<endl;
}


Measured memory_bytes: 15872
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <cmath>

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

int main()
{
        int A, B, C, D;
        cin >> A >> B >> C >> D;
        int start = max(A, C);
        int end = min(B, D);
        if (end <= start)
                cout << 0 << endl;
        else
                cout << end - start << endl;

        return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(1000000)

N = int(input())
X, Y = [], []

tree = {key+1: [] for key in range(N)}  # 木構造はノードをキーにする辞書にしておく
# 必要なのは、あるノードを指定したときに、隣り合うノードと、コスト
#[(隣のノード, コスト)]の順で格納する

for n in range(N - 1):
    a, b, c = list(map(int, input().split()))
    tree[a].append((b, c))
    tree[b].append((a, c))  # 方向に依存しない格納

# for n in tree.keys():
#     tree[n] = list(set(tree[n]))  # 重複を削除
# こいつが原因ではない

Q, K = list(map(int, input().split()))

cost = {}  # Kがkeyに行くまでにかかるコストの辞書


def dfs(v, p, d):
    """
    深さ優先探索
    再帰的に処理する
    args:
        v: 現在の頂点
        p: vの親(訪問元)
        d: 現在の距離
    """
    cost[v] = d
    for i, co in tree[v]:
        if i == p:
            continue
        dfs(i, v, d + co)


dfs(K, -1, 0)

# print(cost)
ans = []
for q in range(Q):
    x, y = list(map(int, input().split()))
    ans.append(cost[x] + cost[y])

for a in ans:
    print(a)


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

int main() {

  int n;
  cin >> n;
  if(n == 0) cout << 1 << endl;
  else if(n == 1) cout << 2 <<endl;
  else if(n == 2) cout << 1 <<endl;
  else cout << 0<<endl;
  return 0;
} 

Measured memory_bytes: 1164
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  

#pragma warning(disable:4996)  
#pragma comment(linker, "/STACK:336777216")  
using namespace std;

#define mp make_pair  
#define Fi first  
#define Se second  
#define pb(x) push_back(x)  
#define szz(x) ((int)(x).size())  
#define rep(i, n) for(int i=0;i<n;i++)  
#define all(x) (x).begin(), (x).end()  
#define ldb ldouble  

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 17;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;

int main() {
	int a, b;
	scanf("%d %d", &a, &b);

	int v = b - a;
	return !printf("%d\n", v*(v + 1) / 2 - b);
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>


using namespace std;
#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<n;++i)
#define FOR(i, a, b) for(int i=a;i<b;++i)
#define RREP(i, n) for(int i=n-1;i>=0;--i)
#define RFOR(i, a, b) for(int i=b-1;i>=a;--i)

#define all(x) begin(x),end(x)
#define dump(x) cerr<<#x<<" = "<<(x)<<endl
#define debug(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

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

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


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

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "[";
    REP(i, SZ(v)) {
        if (i) os << ", ";
        os << v[i];
    }
    return os << "]";
}

template<class T1, class T2>
ostream &operator<<(ostream &os, const map<T1, T2> &mp) {
    os << "[";
    for (auto it = mp.begin(); it != mp.end(); ++it) {
        if (it != mp.begin()) {
            os << ", ";
        }
        os << *it;
    }
    return os << "]";
}

// edit

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

}

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

void solve() {
    ll x;
    cin >> x;

    ll tapu = lcm(360, x);
    ll ans = tapu / x;
    cout << ans << endl;

}


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    solve();

    return 0;
}


Measured memory_bytes: 3152
#include <iostream>
#include <cstdio>
#include <vector>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    string a;
    cin >> a;
    
    int k = a.size();
    
    for(int i = 0; i < k; i++){
        cout << 'x';
    }
    

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	String s=sc.next();
	String[] arr=s.split("");
	if(arr[2].equals(arr[3]) && arr[4].equals(arr[5]))
	{
		System.out.println("Yes");
	}
	else
	{
		System.out.println("No");
	}
}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
  int k, x;
  cin >> k >> x;

  int left = max(x - k + 1, -1000000);
  int right = min(x + k - 1, 1000000);
  
  for (int i = left; i <= right; i++) {
    if (i == right)
    cout << i << endl;
    else
    cout << i << " ";
  }
}

Measured memory_bytes: 256
#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 ll long long int
#define ld long double
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]

typedef vector< int > vi;
typedef vector<long long> lvi;
typedef vector< vector<int> > vvi;
typedef vector< vector<long long> > lvvi;
typedef pair< int,int > ii;
typedef pair< long long,long long > lii;
typedef vector<pair<int,int>> vii;
typedef vector<pair<long long,long long>> lvii;
typedef vector<vector<pair<int,int>>> vvii;
typedef vector<vector<pair<long long,long long>>> lvvii;
typedef vector<bool> vb;

// #ifdef ONLINE_JUDGE 
// #define endl '\n'
// #endif
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#ifdef ONLINE_JUDGE
	#define error(args...) 0
#else
	#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#endif
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr <<"[ "<< *it << " = " << a << " ]"<< endl;
	err(++it, args...);
}

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
const long long mod = 1e9 + 7;
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

long long mos() { return 0LL; }
template<typename T, typename... Args>
T mos(T a, Args... args) { return ((a + mos(args...))%mod + mod)%mod; }

long long mop() { return 1LL; }
template<typename T, typename... Args>
T mop(T a, Args... args) { return (a*mop(args...))%mod; }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------



signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;
	ll d1 = v*t;
	ll d2 = abs(a-b)+w*t;
	if(d1>=d2)
	{
		cout<<"YES"<<endl;
	}
	else cout<<"NO"<<endl;
	return 0;
}	


// WA
// 1. overflow
// 2. re-initialize global variables for every test case.
// 3. edge cases like n=1

// Run time error
// 1. division by zero.
// 2. array bounds.

// TLE
// 1. uncomment that #define endl '\n' line

Measured memory_bytes: 3608
//In the name of He
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
const bool DEBUG = false;
#define cerr if(DEBUG)cerr
using namespace std;

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

const long long maxn = 3e5 + 5 + 1;
const long long INF = 4e18 ;
const long long M = 1e9 + 7;
const int lg = 21;

int a,b,n;

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n >> a >> b;
	if (((b-a-1)%2 == 0)){
		cout << "Borys";
	}
	else if(((b-a-1)%2 == 1)){
		cout << "Alice";
	}
	else{
		cout << "Draw";
	}
	return 0;
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	long long a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	int c1 = 0, c2 = 0, c4 = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] % 4 == 0) c4++;
		else if (a[i] % 2 == 0) c2++;
		else c1++;
	}
	if (c1 > c4+1) {
		cout << "No" << '\n';
		return 0;
	}
	if (c1 == c4+1 && c2 > 0) {
		cout << "No" << '\n';
		return 0;	
	}
	cout << "Yes" << '\n';
	return 0;
}

Measured memory_bytes: 4388
#include <iostream>
#include <vector>
#include <queue>
#include <string>
using namespace std;

int h, w;
typedef pair<int, int> P;
vector<string> S;


int bfs(int** d0,int** d1) {
	
	queue<P> Q;

	Q.push(P(0, 0));
	d0[0][0] = 0;

	while (Q.size()) {
		P n = Q.front(); Q.pop();
		for(int dx =-1;dx<=1;dx++)
			for(int dy =-1;dy<= 1;dy++)
				if (dx != dy && dx != -dy) {
					int nx = n.first + dx; int ny = n.second + dy;
					if (0 <= nx && nx < w && 0 <= ny && ny < h && S[ny][nx] != '#' && d0[ny][nx] == -1) {
						d0[ny][nx] = d0[n.second][n.first] + 1;
						Q.push(P(nx, ny));
					}
				}
	}

	return d0[h - 1][w - 1];
}

void min_search(int** d0, int** d1, int x) {

	queue<P> Q1;

	int gy = h - 1; int gx = w - 1;

	Q1.push(P(gx, gy));
	d1[gy][gx] = 1;

	while (Q1.size()) {
		P p = Q1.front(); Q1.pop();

		for (int dx = -1; dx <= 1; dx++) {
			for (int dy = -1; dy <= 1; dy++) {
				if (dx != dy && dx != -dy) {
					int nx = p.first + dx; int ny = p.second + dy;
					if (0 <= nx && nx < w && 0 <= ny && ny < h && d0[ny][nx] == x - 1 && 0 < x) {
						Q1.push(P(nx, ny));
						d1[ny][nx] = 1;
						x--;
					}
				}
			}
		}
	}

}

int main() {
	cin >> h >> w;

	S.resize(h);

	for (int i = 0; i < h; i++)
		cin >> S[i];

	int** d0 = new int*[h]; //d0 for first d1 minimum root
	int** d1 = new int*[h];
	for (int i = 0; i < h; i++) {
		d0[i] = new int[w];
		d1[i] = new int[w];
	}

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			d0[i][j] = -1;
			d1[i][j] = -1;
		}	
	}

	int x = bfs(d0, d1);
    if (x >= 0)
		;
	else if(x == -1) {
		cout << -1;
		return 0;
	}
	min_search(d0, d1, x);

	int c = 0;

	for (int i = 0; i < h; i++)
		for (int j = 0; j < w; j++)
			if (S[i][j] != '#' && d1[i][j] != 1)
				c++;

	cout << c << endl;

}

Measured memory_bytes: 3608
# coding: utf-8
# Your code here!
import bisect
N,M,X=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
for i in A:
    if i<=X:
        cnt+=1
    else:
        break

if (M/2)>=cnt:
    print(cnt)
else:
    print(M-cnt)

Measured memory_bytes: 38256
import sys
#import time
#import copy
#from collections import deque, Counter, defaultdict
#from fractions import gcd
#import bisect
#import itertools
#input = sys.stdin.readline
sys.setrecursionlimit(10**6)

def ri():
    return list(map(int, input().split()))
def rs():
    return list(input().strip())

n = str(input())
lst = n[-1]

if lst == ("2"):
    print("hon")
if lst == ("4"):
    print("hon")
if lst == ("5"):
    print("hon")
if lst == ("7"):
    print("hon")
if lst == ("9"):
    print("hon")

if lst =="3":
    print("bon")
if lst =="0":
    print("pon")
    
if lst =="1":
    print("pon")
    
if lst =="6":
    print("pon")
    
if lst =="8":
    print("pon")

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

namespace test
{
    class MainClass
    {
        public static void Main(string[] args)
        {

            //問題155
            //Console.WriteLine("test");

            string s = Console.ReadLine();

            int ans = 0;

            //if (s[0] == s[1])

            if (s[1] == 'R')
            {
                if (s[0] == 'R' && s[2] == 'R')
                {
                    ans = 3;
                }
                else if (s[0] == 'R' || s[2] == 'R')
                {
                    ans = 2;
                }

                else
                {
                    ans = 1;
                }

                
            }
            else if (s[0] == 'R' || s[2] == 'R')
            {
                ans = 1;
            }

            Console.WriteLine(ans);
        }

    }





    
}


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

int main(){
    ll x;
    cin>>x; //1000000000
    bool flag = false;
    int MIN=-5000;
    int MAX=5000;
    for(ll i=MIN;i<MAX;i++){
        for(ll j=MIN;j<MAX;j++){
            if((i*i*i*i*i - j*j*j*j*j) == x){
                cout<<i<<" "<<j<<endl;
                flag = true;
                break;
            }
        }
        if(flag==true){
            break;
        }
    }

}


Measured memory_bytes: 3636
package main

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

func main() {
        scanner := bufio.NewScanner(os.Stdin)
        scanner.Scan()
        n, _ := strconv.Atoi(scanner.Text())
        maxv := -2000000000000
        scanner.Scan()
        minv, _ := strconv.Atoi(scanner.Text())
        for i := 1; i < n; i++ {
                scanner.Scan()
                current, _ := strconv.Atoi(scanner.Text())
                maxv = max(maxv, current-minv)
                minv = min(minv, current)
        }
        fmt.Println(maxv)
}

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

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


Measured memory_bytes: 4092
//
// Created by Myabu on 2020/01/07.
//

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <math.h>
#include <stack>
#include <queue>
#include <cstdio>
#include <numeric>

using namespace std;


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

    for (int i = 0; i < n.length(); ++i) {
        if(n[i] == '1'){
            n[i] = '9';
        }else{
            n[i] = '1';
        }
    }


    cout<<n<<endl;


    return 0;
}

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

int main(){
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int res;
  
  int time = h2*60 + m2 - (h1*60+m1);
  
  cout << time - k << endl;
}

Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include<cstring>
#include<string>
#include<stack>
#include<math.h>
#include<stdlib.h>
using namespace std;
#define int long long
typedef pair<int, int> pii;
typedef pair<int, pii > piii;
typedef pair<double, double> pdd;
typedef pair<int, char> pic;
typedef priority_queue<pii, vector<pii>, greater<pii> > RPQ;
#define mk make_pair
#define INF (1 << 30)
#define INFL (1ll << 60ll)
#define mod 1000000007

pii t[6];

signed main(){
    for(int i = 0; i < 6; i++){
        int a,b;
        cin >> a >> b;
        if(a < b)swap(a, b);
        t[i] = mk(a, b);
    }
    sort(t, t + 6);
    bool flag = false;
    if(t[0] != t[1]){
        flag = true;
    }
    if(t[2] != t[3]){
        flag = true;
    }
    if(t[4] != t[5]){
        flag = true;
    }

    if(flag){
        cout << "no" << endl;
        return 0;
    }

    if(t[0].first == t[2].first){
        if((t[0].second == t[4].first && t[2].second == t[4].second) || (t[0].second == t[4].second && t[2].second == t[4].first)){
            flag = true;
        }
    }
    if(t[0].first == t[2].second){
        if((t[0].second == t[4].first && t[2].first == t[4].second) || (t[0].second == t[4].second && t[2].first == t[4].first)){
            flag = true;
        }
    }
    if(t[0].second == t[2].first){
        if((t[0].first == t[4].first && t[2].second == t[4].second) || (t[0].first == t[4].second && t[2].second == t[4].first)){
            flag = true;
        }
    }
    if(t[0].second == t[2].second){
        if((t[0].first == t[4].first && t[2].first == t[4].second) || (t[0].first == t[4].second && t[2].first == t[4].first)){
            flag = true;
        }
    }
    if(!flag){
        cout << "no" << endl;
    }
    else {
        cout << "yes" << endl;
    }

    return 0;
}

/*

*/


Measured memory_bytes: 3124
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        //コード
    	Scanner sc = new Scanner(System.in);
    	long N = sc.nextLong();
    	long K = sc.nextLong();

    	long a = N%K;

    	long b = K - a;

    	if(a<=b){
    	   	System.out.println(a);
    	} else {
    		System.out.println(b);
    	}



    }
}

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

const int MOD = (int)1e9+7;

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

	long long ans=0;
	for(int i=0;i<N-1;i++){
		ans+=min(A*(X.at(i+1)-X.at(i)),B);
	}
	cout << ans << endl;
	
	return 0;
}


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


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string input;
    bool easy = true;
    
    cin >> input;
    
    for(int i = 0; i < input.size(); i++){
        if((i + 1) % 2 == 0 && input[i] == 'R'){
            easy = false;
            break;
        }
        else if((i + 1) % 2 != 0 && input[i] == 'L'){
            easy = false;
            break;
        }
    }
    
    easy ? cout << "Yes" : cout << "No";
    
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N; cin >> N;
  vector<int> p(N), q(N);
  for(int i = 0; i < N; i++) cin >> p[i], q[i] = p[i];
  sort(q.begin(), q.end());
  int s = 0;
  for(int i = 0; i < N; i++) if(p[i] != q[i]) s++;
  cout << ((s > 2) ? "NO" : "YES") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lp3(i,a,b) for(int i=a;i<b;i++)
#define lp2(i,n) for(int i=0;i<n;i++)
#define ll long long
#define W 1000000007
using namespace std;

int main(){
	string j="Yes";
	int a,b;
	cin>>a>>b;
	if(a%2==0||b%2==0)j="No";
	cout<<j<<endl;
	return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    if ((a*b)%2 == 0) cout << "Even" << endl;
    else cout << "Odd" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int d;
    scanf("%d", &d);
    switch(d)
    {
        case 25:
            printf("Christmas");
            break;
        case 24:
            printf("Christmas Eve");
            break;
        case 23:
            printf("Christmas Eve Eve");
            break;
        case 22:
            printf("Christmas Eve Eve Eve");
            break;
    }
    return 0;
}


Measured memory_bytes: 128
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using multiInt = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
#pragma endregion

int main()
{
  init_main();

  int n, k;
  cin >> n >> k;
  bool b[110] = {};
  rep(i, k)
  {
    int d;
    cin >> d;
    rep(j, d)
    {
      int a;
      cin >> a;
      a--;
      b[a] = true;
    }
  }

  int cnt = 0;
  rep(i, n)
  {
    if (!b[i])
      cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
int main(){
	int n;
    ll a[100000];
   	priority_queue<pii,vector<pii>,greater<pii> > q;
   	scanf("%d",&n);
   	for(int i=0;i<n;i++) scanf("%lld",a+i);
   	sort(a,a+n);
   	for(int i=0;i<n;i++) q.push(pii(a[i],i));
   	while(true){
   		ll v = q.top().second;
   		ll sz = q.top().first;
   		q.pop();
   		if(q.empty()){
   			printf("%lld\n",n-v);
   			break;
   		}
   		ll u = q.top().second;
   		ll sy = q.top().first;
   		q.pop();
   		if(sz*2<sy){
   			q.push(pii(sz+sy,u));
   		}else{
   			q.push(pii(sz+sy,min(v,u)));
   		}
   	}
   	return 0;
}


Measured memory_bytes: 3188
//JOI2010-2011本選問４歩くサンタクロース(Walking Santa)
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
int main(){

	long long sum = 0LL, osum = 0LL;
	long long f1, f2, f3, w, h, L, HL, temp, oxy[2][2], *LXY[2], ox, oy, max = 0, dx, dy;
	vector<long long> XY[2];
	scanf("%lld %lld",&w, &h);
	scanf("%lld",&L);
	for(f1 = 0; f1 < 2; f1++)
		LXY[f1] = new long long [L];
	//100k
	for(f1 = 0; f1 < L; f1++){
		scanf("%lld %lld",&LXY[0][f1], &LXY[1][f1]);
		XY[0].push_back(LXY[0][f1]);
		XY[1].push_back(LXY[1][f1]);
	}
	//1m
	sort( XY[0].begin(), XY[0].end() );
	sort( XY[1].begin(), XY[1].end() );
	HL = (L + 1) / 2;
	//x軸での最小値の点、y軸での最小値の点を探す
	//200k
	if(L == 1){
		printf("0\n");
		printf("%lld %lld\n",LXY[0][0],LXY[1][0]);
	}
	else{
		for(f1 = 0; f1 < 2; f1++){
			oxy[0][f1] = XY[f1][HL-1];
			oxy[1][f1] = XY[f1][HL];
		}
		dx = (oxy[0][0] == oxy[1][0]) ? 1 : 2;
		dy = (oxy[0][1] == oxy[1][1]) ? 1 : 2;
		//400k
		for(f2 = 0; f2 < dx; f2++){
			for(f3 = 0; f3 < dy; f3++){
				sum = 0LL;
				max = 0LL;
				for(f1 = 0; f1 < L; f1++){
					temp = (long long)abs(LXY[0][f1] - oxy[f2][0]) + abs(LXY[1][f1] - oxy[f3][1]);
					sum += temp;
					if(max < temp)
						max = temp;
				}
				sum *= 2;
				sum -= max;
				if(osum == 0 || osum > sum){
					osum = sum;
					ox = oxy[f2][0];
					oy = oxy[f3][1];
				}
			}
		}
		printf("%lld\n", osum);
		printf("%lld %lld\n", ox, oy);
	}
	return 0;
}

Measured memory_bytes: 4484