akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))   //最大値を求める
#define MIN(x) *min_element(ALL(x))   //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

  	// 入力部
    int D, d, i, j, u, minus;
    cin >> D;
    vector<int> c(26, 0);
    vector<vector<int>> s(D, vector<int>(26));
    vector<int> t(D, 0);
    vector<int> last(26, 0);
    for (i = 0; i < 26; i++)
    {
        cin >> c[i];
    }
    for (i = 0; i < D; i++)
    {
        for (j = 0; j < 26; j++)
        {
            cin >> s[i][j];
        }
    }
    for (i = 0; i < D; i++)
    {
        cin >> t[i];
        t[i]--;
    }

    // 処理部
    u = 0;
    for (d = 0; d < D; d++)
    {
        last[t[d]] = d+1;
        u += s[d][t[d]];
        minus = 0;
        for(i = 0; i < 26; i++){
            minus += c[i] * ((d+1) - (last[i]));
        }
        u -= minus;
        cout << u << endl;
    }
}

Measured memory_bytes: 3208
#include<iostream>
#include<algorithm>
#include<functional>
#include <string>
#include<iomanip>
#include<cstdio>
#include<math.h>
#include<stack>
#include<queue>
#include<cstring>
#include<vector>
typedef long long int ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define EREP(i,n) for(int i=(n-1);i>=0;--i)
#define D(n,retu) REP(i,n){cin>>retu[i];}
#define mod 1000000007
#define MIN -93193111451418101
#define INF 931931114518101
using namespace std;
typedef pair<ll, ll>P;
template<typename T>
void fill_all(T& arr, const T& v) {
	arr = v;
}
template<typename T, typename ARR>
void fill_all(ARR& arr, const T& v) {
	for (auto& i : arr) { fill_all(i, v); }
}
#define MAX_NUM 50
long long comb[MAX_NUM + 1][MAX_NUM + 1];

ll par[100000], depth[100000];
static void calc_comb()
{
	for (uint32_t i = 0; i <= MAX_NUM; i++) {
		for (uint32_t j = 0; j <= i; j++) {
			if ((j == 0) || (i == j)) {
				comb[i][j] = 1;
			}
			else {
				comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
			}
		}
	}
}
#define yo 100001
//------------------変数-----------------------//
string str;
//-------------------関数----------------------//

int main() {
	ll x[100001] = {}, n, a, b; cin >> n >> a >> b;
	REP(i, n) { cin >> x[i]; }
	ll izryt = b;
	b = b / a;
	ll cnt = 0;
	REP(i, n - 1) {
		if (x[i + 1] - x[i] > b) { cnt += izryt; }
		else {
			cnt += (x[i + 1] - x[i])*a;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		final int N = scanner.nextInt();
		int sum = 0;
		int sum2 = 0;
		int x;
		for (int i = 0; i < N; i++) {

			x = scanner.nextInt();
			sum += x;
			sum2 += x * x;
		}

		int p = (int) Math.round((double) sum / N);

		System.out.println(sum2 + N * p * p - 2 * p * sum);

	}

}


Measured memory_bytes: 23764
package main

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

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

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
    buf := make([]byte, 0, 1000000)
    for {
        l, p, e := rdr.ReadLine()
        if e != nil {
            panic(e)
        }
        buf = append(buf, l...)
        if !p {
            break
        }
    }
    return string(buf)
}

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
    sc.Scan()
    return sc.Text()
}


func main(){
	var N int
	var S,T,R string
	fmt.Scan(&N)
	fmt.Scan(&S)
	fmt.Scan(&T)
	R=""

	for i:=0;i<N;i++{
		R+=string(S[i])
		R+=string(T[i])
	}
	fmt.Println(R)

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define MP make_pair
typedef long long ll;
const int mod=1e9+7;
const int M=1e6+6;
const int inf=0x3f3f3f3f;
const ll INF=1e18;
void pn(){
    cout<<"NO"<<'\n';
}
void py(){
    cout<<"YES"<<'\n';
}
int main(){
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll ans=-INF;
    if(a<=0&&b>=0||c<=0&&d>=0)
        ans=0;
    ans=max(ans,a*c);
    ans=max(ans,a*d);
    ans=max(ans,b*c);
    ans=max(ans,b*d);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3552
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int h = vs[0];
			int w = vs[1];
			int k = vs[2];

			int[,] c = new int[w, 3];
			for (int i = 0; i < 1 << w - 1; i++) {
				bool f = true;
				int t = i;
				for (int j = 0; j < w - 2; j++) {
					if (t % 4 == 3) {
						f = false;
						break;
					}
					t >>= 1;
				}
				if (f) {
					//System.Diagnostics.Debug.WriteLine($"{Convert.ToString(i, 2).PadLeft(w - 1, '0')}");
					t = i << 1;
					for (int j = 0; j < w; j++) {
						int t2 = t % 4;
						if (t2 == 1) {
							c[j, 0]++;  // c[x, 0] x-1 -> x
						} else if (t2 == 0) {
							c[j, 1]++;  // c[x, 1] x   -> x
						} else if (t2 == 2) {
							c[j, 2]++;  // c[x, 2] x+1 -> x
						}
						t >>= 1;
					}
				}
			}

			long[,] dp = new long[w, h + 1];
			dp[k - 1, 0] = 1;
			for (int i = 1; i <= h; i++) {
				for (int j = 0; j < w; j++) {
					if (j > 0) {
						dp[j, i] += dp[j - 1, i - 1] * c[j, 0] % mod;
					}
					dp[j, i] += dp[j, i - 1] * c[j, 1] % mod;
					if (j < w - 1) {
						dp[j, i] += dp[j + 1, i - 1] * c[j, 2] % mod;
					}
					dp[j, i] %= mod;
				}
			}
			//for (int i = 0; i <= h; i++) {
			//	for (int j = 0; j < w; j++) {
			//		System.Diagnostics.Debug.Write($"{dp[j, i]} ");
			//	}
			//	System.Diagnostics.Debug.WriteLine($"");
			//}
			Console.WriteLine(dp[0, h]);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
string f(char c, int j) {
	string ret;
	for (int i = 0; i < j; i++)
	ret += c;
	return ret;
}
int main() {
	int sx, sy, tx, ty; cin >> sx >> sy >> tx >> ty;
	int x = tx - sx, y = ty - sy;
	cout << f('R', x) << f('U', y) << f('L', x) << f('D', y + 1) << f('R', x + 1) << f('U', y + 1) << "LU" << f('L', x + 1) << f('D', y + 1) << "R\n";
	char c; cin >> c;
}

Measured memory_bytes: 256
//----------ACCIDENTAL COMPETITIVE PROGRAMMER---------------------

#include<bits/stdc++.h>

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
*/
using namespace std;

#define LL long long
#define LD long double
#define PB push_back
#define MP make_pair


const LL MOD = (1e9) + 7 ;
const LD EPS = 0.0000001 ;

const int N = 100000 + 50;
vector<int> graph[N];
LL dp[N][2];

void dfs (int node, int pa)
{
	dp[node][0] = 1;
	dp[node][1] = 1;
	for (auto to : graph[node]){
		if (to == pa)
			continue;
		dfs(to, node);
	}
	// 0 is white and 1 is black
	for (auto it : graph[node]){
	    if (pa == it)
	        continue;
		dp[node][0] = dp[node][0] * (dp[it][0] + dp[it][1]);
		dp[node][0] %= MOD;
		dp[node][1] = dp[node][1] * dp[it][0];
		dp[node][1] %= MOD;
	}
//	cout << node << " " << dp[node][0] << " " << dp[node][1] << endl;
}

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

    int n; cin >> n;
    for (int i = 1; i < n; i++){
    	int u, v; cin >> u >> v;
    	graph[u].PB(v);
    	graph[v].PB(u);
    }

    dfs(1, 0);
    cout << (dp[1][0] + dp[1][1]) % MOD << endl;

	return 0;
}

Measured memory_bytes: 14208
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(150000)

def gdp(n, dp, G):
    if dp[n]!=-1:
        return dp[n]

    if G[n]==[]:
        dp[n]=0
        return 0

    for i in G[n]:
        ll=gdp(i, dp, G)
        if dp[n]<ll+1:
            dp[n]=ll+1

    return dp[n]

def solve(N: int, M: int, x: "List[int]", y: "List[int]"):
    G=[[] for _ in range(N)]
    for i in range(M):
        G[x[i]-1].append(y[i]-1)

    dp=[-1]*N

    print(max(gdp(i, dp, G) for i in range(N)))

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    x = [int()] * (M)  # type: "List[int]"
    y = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, M, x, y)

if __name__ == '__main__':
    main()


Measured memory_bytes: 66992
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                                 \
  ifstream in("atcoder-problems/caddi2018_a.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

map<ll, ll> factorization(ll N) {
  map<ll, ll> ret;
  ll fact = 2;
  while(fact <= sqrt(N)) {
    if (N % fact == 0) {
      ret[fact]++;
      N /= fact;
    } else {
      fact++;
    }
  }
  if (N != 0) ret[N]++;
  return ret;
}

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  ll N, P;
  cin >> N >> P;
  if (N == 1) {
    cout << P << endl;
    return 0;
  };

  map<ll, ll> fact = factorization(P);
  ll ans = 1;
  for (auto kv : fact) {
    if (kv.second >= N) {
      ans *= pow(kv.first, kv.second / N);
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
int main(){
    const ll p = 1000000007;
    vector<char> block;
	int N;SCD(N);
	getchar();
	string s1,_;
	getline(cin,s1);
	
	REP(i,N-1){
	    if (s1[i] == s1[i+1]){
	        i++;
	        block.PB('X');
	    }else{
	        block.PB('Y');
	    }	    
	}
	
	if (s1[N-2] != s1[N-1]) block.PB('Y');
    
    ll ans;
    if (block[0] == 'X') ans = 6;
    else ans = 3;

    FOR(i,1,block.size()){
        if ((block[i-1] == 'X') and (block[i] == 'X')){
            ans = (ans * 3) % p;
        }else if ((block[i-1] == 'Y') and (block[i] == 'X')){
            ans = (ans * 2) % p;
        }else if ((block[i-1] == 'Y') and (block[i] == 'Y')){
            ans = (ans * 2) % p;
        }
        
    }
    
    PRINTD(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PL = pair<long long, long long>;
using Pxy = pair<double, double>;
using T = tuple<int, int, bool>;
const int INF = 1001001007;
const int MOD = 1000000007;
//const int MOD = 998244353;
const ll inf = 1e18;
template <typename AT>
void printvec(vector<AT> &ar){
    rep(i,ar.size()-1) cout << ar[i] << " ";
    cout << ar[ar.size()-1] << endl;
}
template <typename Q>
void printvvec(vector<vector<Q>> &ar){
    rep(i,ar.size()){
        rep(j,ar[0].size()-1) cout << ar[i][j] << " ";
        cout << ar[i][ar[0].size()-1] << endl;
    }
}
template <typename S>
bool range(S a, S b, S x){
    return (a <= x && x < b);
}

int main() {
    int h, w; cin >> h >> w;
    int a, b; cin >> a >> b;
    vector<vector<int>> ar(h, vector<int>(w,0));
    if (a == 0 && b == 0){}
    else if (a == 0){
        rep(i,b) rep(j,w) ar[i][j] = 1;
    }
    else if (b == 0){
        rep(i,h) rep(j,a) ar[i][j] = 1;
    }
    else {
        rep(i,b) rep(j,a) ar[i][j] = 1;
        repp(i,h,b) repp(j,w,a) ar[i][j] = 1;
    }
    rep(i,h){
        rep(j,w) cout << ar[i][j];
        cout << endl;
    }
}

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

int main(){
  int n,t,h,m,f=0,ansr[1000];
  int ansh=0,ansm=0,anst;
  int afh,afm;
  char p;
  string str[1000],ans[1000],s;
  cin>>n>>t;
  cin>>h>>p>>m>>str[0];
  for(int i=1;i<n;i++){
    cin>>h>>p>>m>>str[i]>>afh>>p>>afm>>s;
    ansh=afh-h,ansm=afm-m;
       anst=ansh*60+ansm;
       if(anst>=t) ans[f]=str[i],ansr[f]=anst,f++;
  }
  if(f==0) cout<<"0"<<endl;
  else{
    cout<<f<<endl;
 for(int i=0;i<f;i++) cout<<ans[i]<<" "<<ansr[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

using T = tuple<double, double, double>;

int f(char c) {
    if (c < 'A') return (c - '0');
    else return (c - 'a') + 10;
}

int main() {
    string name[8] = { "black", "blue", "lime", "aqua", "red", "fuchsia", "yellow", "white" };
    T color[8];
    color[0] = T(0, 0, 0);
    color[1] = T(0, 0, 255);
    color[2] = T(0, 255, 0);
    color[3] = T(0, 255, 255);
    color[4] = T(255, 0, 0);
    color[5] = T(255, 0, 255);
    color[6] = T(255, 255, 0);
    color[7] = T(255, 255, 255);
    string s;
    while (cin >> s && s != "0") {
        double r = 0, g = 0, b = 0;
        r = 16 * f(s[1]) + f(s[2]);
        g = 16 * f(s[3]) + f(s[4]);
        b = 16 * f(s[5]) + f(s[6]);

        string ans;
        double mind = 1001001;
        for (int i = 0; i < 8; i++) {
            double t = pow(get<0>(color[i]) - r, 2) + pow(get<1>(color[i]) - g, 2) + pow(get<2>(color[i]) - b, 2);
            double diff = sqrt(t);
            if (mind > diff) {
                mind = diff;
                ans = name[i];
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3012
#include<iostream>
//#include<bits/stdc++.h>
#include<cmath>
#include<string>
#include<cstdio>
#include<cstring>
#include<queue>
#define pq priority_queue
#define Pi acos(-1.0)
using namespace std;
#define MOD 1000000007
int main()
{
    int a,b;
    cin>>a>>b;
    if(a==b)
        printf("Draw\n");
    else
    {
        if(a==1 || b==1)
        {
            if(a==1)
                printf("Alice\n");
            else
                printf("Bob\n");
        }
        else
        {
            if(a>b)
                printf("Alice\n");
            else
                printf("Bob\n");
        }
    }
    return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : e.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<vector>
#include<string>
#include<cmath>
using namespace std;
typedef long long ll;


ll PowMod(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = PowMod(N, P/2, M);
        return t*t % M;
    }
    return N * PowMod(N, P-1, M);
}
int main() {
	string s;cin>>s;
	ll ans=0;
	ll def=pow(10,9)+7;
	ll num=0;
//	for(int i=s.size()-1;i>=0;i--){
//		ll add=0;
//		if(s[i]=='0'){
//		}else{
//			if(i==0){
//			add=PowMod(3,s.size()-i-1,def);
//			}else{
//				add=2*PowMod(3,s.size()-i-1,def);
//			}
//			num+=PowMod(2,s.size()-i,def);
//		}
//		ans+=add;
//		ans%=def;
//	}
//	ans+=2;


	ll count=0;
	ll mul=1;
	for(int i=0;i<s.size();i++){
		ll add=0;
		if(s[i]=='0'){
		}else{
			if(i==0){
				add=PowMod(3,s.size()-i-1,def);
			}else{
				add=mul*PowMod(3,s.size()-i-1,def);
			}
			mul*=2;
			mul%=def;
		}
		ans+=add;
		ans%=def;
	}
	ans+=mul;

	cout<<(ans)%def<<endl;
	return 0;
}


Measured memory_bytes: 512
using namespace std;
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <assert.h>
#include <functional>

typedef long long ll;



int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    long long k;
    cin >> k;
    long long nm = 1;
    long long  md = 7;
    if (k == 1 || k==7) {
        cout << 1 << endl;
        return 0;
    }
    while (true) {
        if ((md%k == 7%k && nm > 1) || nm > 1000100) {
            cout << -1 << endl;
            break;
        }
        if (md == 0) {
            cout << nm << endl;
                break;
        }
        nm++;
        md *= 10;
        md += 7;
        md %= k;
    }
}

Measured memory_bytes: 3192
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int r = n%10;
	if(r == 0 || r == 1 || r == 6 || r == 8) cout << "pon" << endl;
	else if(r == 3) cout << "bon" << endl;
	else cout << "hon" << endl;
	return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ

int main(){
	long long a,b;scanf("%lld%lld",&a,&b);
	double left=0;
	double right=3;
	for(int i=0;i<40;i++){
		double M=(left+right)/2;
		long long tmp=0;
		for(int j=1;j<=a-2;j++){
			double cur=sin(PI*2/a*j);
			int rem=a-j;
			int L=0;
			int R=rem/2+1;
			while(L+1<R){
				int mid=(L+R)/2;
				double val=cur+sin(PI*2/a*mid)+sin(PI*2/a*(rem-mid));
				if(val<M){
					L=mid;
				}else R=mid;
			}
			// printf("%f %d: %d %d %d\n",M,j,L,R,rem);
			tmp+=L*2;
			if(L==rem/2&&rem%2==0)tmp--;
		}
		// printf("%f: %lld\n",M,tmp);
		tmp=tmp*a/3;
		if(b<=tmp){
			right=M;
		}else left=M;
	}
	printf("%.12f\n",left/2);
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

int main(){
    string S,T;
    cin>>S>>T;
    int N = S.length();
    int M = T.length();
    vector<vector<int>> dp(N+1, vector<int>(M+1,0));
    vector<vector<pair<int,int>>> prev(N+1, vector<pair<int,int>>(M+1, pair<int,int>(-1,-1)));
    for(int i = 1;i < N+1;i++){
        for(int j = 1;j < M+1;j++){
            if(S[i-1] != T[j-1] || dp[i][j-1] != dp[i-1][j-1] || dp[i-1][j] != dp[i-1][j-1]){
                if(dp[i][j-1] > dp[i-1][j]){
                    dp[i][j] = dp[i][j-1];
                    prev[i][j] = pair<int,int>(i,j-1);
                }else{
                    dp[i][j] = dp[i-1][j];
                    prev[i][j] = pair<int,int>(i-1,j);
                }
            }else{
                dp[i][j] = dp[i-1][j-1]+1;
                prev[i][j] = pair<int,int>(-2,-2);
            }
        }
    }

    pair<int,int> to = pair<int,int>(N,M);
    string res = "";
    while(to != pair<int,int>(-1,-1)){
        pair<int,int> p = prev[to.first][to.second];
        if(p == pair<int,int>(-2,-2)){
            res += S[to.first-1];
            to = pair<int,int>(to.first-1, to.second-1);
        }else{
            to = p;
        }
    }
    reverse(res.begin(),res.end());
    cout<<res<<endl;
}

Measured memory_bytes: 106112
#include<iostream>

using namespace std;

int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0; i<n; i++) cin>>a[i];
    int count=0;
    int minj;
    for(int i=0; i<n; i++){
        minj=i;
        for(int j=i; j<n; j++){
            if(a[j]<a[minj]){
                minj=j;
            }
        }
        if(i!=minj){
            swap(a[i],a[minj]);
        	count++;
        }       
    }
    for(int i=0; i<n; i++){
        cout<<a[i]<<" \n"[i==n-1];
    }
    cout<<count<<endl;
    return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <list>
#include <numeric>
#include <math.h>
#include <cstdlib>
#include <queue>
#include <iterator>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <stack>
#include <memory>
#include <deque>
#include <string_view>
#include <random>
#include <chrono>
#include <cstring>

using namespace std;

static int my_speed_up = []() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }();
using ll = long long; using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T> using vv = vector<vector<T>>;
template<class T> using vvv = vector<vector<vector<T>>>;
template<class T> using vvvv = vector<vector<vector<vector<T>>>>;
#define for_b(i, b) for (int i = 0; i < int(b); ++i)
#define for_ab(i, a, b) for (int i = a; i < int(b); ++i)
#define what_is(x) cout << #x << " = " << x << endl;
#define what_are(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl;
#define pad(x) for_b(i, x) cout << "  ";
#define show_1d(___x) cout << #___x << " = "; for (auto& ___num : ___x) cout << ___num << ", "; cout << endl;
#define show_2d(___x) cout << #___x << endl; for (auto& ___row : ___x) { for (auto ___num : ___row) cout << ___num << ", "; cout << endl; }
#define show_3d(___x) cout << #___x << endl; for (auto& ___row : ___x) { for (auto& ___row2 : ___row) { for (auto ___num : ___row2) cout << ___num << ", "; cout << endl; }cout << endl; }

vv<int> d4 = {{1,0},{-1,0},{0,1},{0,-1}};
vv<int> d8 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
bool is_valid_pos(const vv<int>& tb, int x, int y) {
    return x >= 0 && x < tb.size() && y >= 0 && y < tb[0].size();
}


bool get_factors(unordered_set<int>& factors, int num)
{
    for (int i = 2; i <= sqrt(num); ++i) 
    {  
        if (num % i == 0)
        {
            if (factors.find(i) != factors.end()) return false;
            factors.insert(i);
        }
        while (num % i == 0)  
            num = num / i;  
    }  
    if (num > 2)
    {
        if (factors.find(num) != factors.end()) return false;
        factors.insert(num);
    }
    return true;
}

int main()
{
    int N;
    cin >> N;
    
    v<int> tb(N);
    for_b(i,N)
        cin >> tb[i];
        
    bool is_pairwise = true;
    unordered_set<int> factors;
    if (is_pairwise)
    for (auto num : tb)
    {
        if (num > 1)
        if (!get_factors(factors, num))
        {
            is_pairwise = false;
            break;
        }
    }
    if (is_pairwise)
    {
        cout << "pairwise coprime" << endl;
        return 0;
    }
    
    int cur_gcd = tb[0];
    for (auto num : tb)
    {
        cur_gcd = gcd(cur_gcd, num);
        if (cur_gcd == 1)
            break;
    }
        
    if (cur_gcd == 1)
        cout << "setwise coprime" << endl;
    else
        cout << "not coprime" << endl;
    
    return 0;
}


Measured memory_bytes: 7116
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
ll n,d;
cin >> n>>d;
ll t[n][d] = {};
rep(i, n)rep(j,d){
    cin >> t[i][j];
}
vector<ll> v;
for (ll i = 0; i < n-1; i++)for (ll j = i+1; j < n; j++)
{
    ll dis=0;
    rep(k,d){
        dis+=(t[i][k]-t[j][k])*(t[i][k]-t[j][k]);
    }
    v.push_back(dis);
}
rep(i,v.size()){
    double a;
    a=sqrt(v[i]);
    if((int)a*a==(int)v[i])ans++;
}


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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define eps 1e-6
#define ll long long
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define int long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define fi first
#define se second
#define endl "\n"
#define pii pair<int,int>
#define fi first
#define se second
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll Max(ll a,ll b){return a>=b?a:b;}
ll Min(ll a,ll b){return a<=b?a:b;}
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res,t;res=1;t=a%c;while(b){if(b&1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
using namespace std;
//head file

int main()
{
    int n,x,t;
    cin>>n>>x>>t;
    int dex=n/x;
    if(n%x!=0)
    {
        dex++;
        cout<<dex*t;
    }
    else
    cout<<dex*t;
}


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

void solve() {
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(n * a, b) << "\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t = 1;
    while(t--) {
        solve();
    }
}


Measured memory_bytes: 3572
'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = Number(arr[0]);
  const b = arr[1].split(' ').map(x => Number(x));
  let sum = 0;

  for (let i = 0; i < b.length; i ++) {
    for (let j = 0; j < b.length; j ++) {
      if (i === j) {
        continue;
      }
      sum += b[i] * b[j];
    }
  }
  
  console.log(sum / 2);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
//#include <list>
#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;

//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1

int main() {
    string s;
    int q;
    bool rev=false;
    int tmp_qs;
    int tmp_fs;
    char tmp_cs;
    deque<char> head;
    deque<char> tail;
    cin >> s;
    cin >> q;
    for(int i=0; i<q; i++){
        cin >> tmp_qs;
        if(tmp_qs==1){
            rev=!rev;
        }else{
            cin >> tmp_fs >> tmp_cs;
            if(tmp_fs==1){
                if(rev){
                    tail.emplace_back(tmp_cs);
                }else{
                    head.emplace_front(tmp_cs);
                }
            }else{
                if(rev){
                    head.emplace_front(tmp_cs);
                }else{
                    tail.emplace_back(tmp_cs);
                }                
            }

        }
    }

    string answer;
    for(auto c : head){
        answer += c;
    }
    for(auto c : s){
        answer += c;
    }
    for(auto c : tail){
        answer += c;
    }
    if(rev){
        reverse(answer.begin(), answer.end());
    }
    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    vector<int> vec={0,2,0,1,0,1,0,0,1,0,1,0};
    int x,y;
    cin>>x>>y;
    cout<<(vec[x-1]==vec[y-1] ? "Yes" : "No")<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

const int N = 2e5+10, mod = 998244353;
int n,f[N],pw[N];
char s[N];
poly v;

inline int Mod(int x){
	return x>=mod?x-mod:x;
}

char t[N];
inline bool cmp(char *s,char *t){
	For(i,1,n) if (s[i]!=t[i]){
		if (s[i]<t[i]) return 1;
			else return 0;
	}
	return 1;
}
inline int calc(int d){
	int ans=0;
	For(i,1,d) if (s[i]==1) ans=Mod(ans+pw[d-i]);
	For(i,1,n/d)
		For(j,1,d) t[(i-1)*d+j]=(i&1)?s[j]:s[j]^1;
	if (cmp(t,s)) ans=Mod(ans+1);
	return ans;
}

int main(){
	scanf("%d%s",&n,s+1);
	For(i,1,n) s[i]-='0';
	For(i,1,n) if (n%i==0&&(n/i)%2==1) v.pb(i);
	pw[0]=1;
	For(i,1,n) pw[i]=1ll*pw[i-1]*2%mod;
	int ans=0;
	FOR(i,0,siz(v)){
		f[i]=calc(v[i]);
		FOR(j,0,i) if (v[i]%v[j]==0) f[i]=Mod(f[i]+mod-f[j]);
		ans=(ans+2ll*f[i]*v[i])%mod;
	}
	printf("%d\n",ans);
}

Measured memory_bytes: 4948
#include <bits/stdc++.h>    //vectorを使う
#include <string>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) a.begin(),a.end()

int main(void){
    int a,b,t;
    int c;
    cin >> a >> b >>t;
    cout << b*(t/a) << endl;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  string S;
  cin >> S;
  const char* s = S.c_str();

  bool f = true;
  for (size_t i = 0; i < S.size(); i++) {
    if (i % 2 == 0) {
      if (s[i] == 'L') {
        f = false;
        break;
      }
    } else {
      if (s[i] == 'R') {
        f = false;
        break;
      }
    }
  }

  if (f) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


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

const int mod = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	vector<int> nums(n);
	for (int i = 0; i < n; i++) cin >> nums[i];

	vector<vector<long long>> dp(n, vector<long long>(n, 0));

	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < n; j++) {
			if (i > j) continue;
			if (i == j) dp[i][j] = nums[i];
			else {
				dp[i][j] = max(nums[i] - (i + 1 < n ? dp[i + 1][j] : 0), nums[j] - (j - 1 >= 0 ? dp[i][j - 1] : 0 ));
			}
		}
	}

	cout << dp[0][n - 1];
}


Measured memory_bytes: 70656
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}
const ll INF = 1LL << 60;

int main() {
    ll n; cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    map<ll, ll> cnt;
    rep(i, n) {
        if(cnt.count(a[i])) cnt[a[i]]++;
        else cnt[a[i]] = 1;
    }

    ll can = 0;
    rep(i, n+1) can += cnt[i] * (cnt[i] - 1) / 2;

    rep(i, n) {
        ll ans = can;
        ll except = cnt[a[i]];
        ans -= except * (except - 1) / 2;
        if(except > 1) ans += (except - 1) * (except - 2) / 2;
        cout << ans << endl;
    } 
}

Measured memory_bytes: 16640
B='{:041b}'.format
n,k,*a=map(int,open(0).read().split())
if not k:
  print(sum(a))
  exit()
l=[0]*41
for i in a:
  for j,t in enumerate(B(i)):
    if int(t):l[j]+=1
dp=[[0,-1]for i in range(41)]
for i,f in enumerate(map(int,B(k))):
  if not i:continue
  v0,v1=(n-l[i])*pow(2,40-i),l[i]*pow(2,40-i)
  if f:
    dp[i][0]=dp[i-1][0]+v0
    if dp[i-1][1]>=0:
      dp[i][1]=max(dp[i-1][0]+v1,dp[i-1][1]+max(v0,v1))
    else:
      dp[i][1]=dp[i-1][0]+v1
  else:
    dp[i][0]=dp[i-1][0]+v1
    if dp[i-1][1]>=0:
      dp[i][1]=dp[i-1][1]+max(v0,v1)
print(max(dp[-1]))

Measured memory_bytes: 14148
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define int long long
#define For(i,x,y) for(int i = x; i <= y; ++i)
#define FOR For
#define rev_For(i,x,y) for(int i = x; i >= y; --i)
#define REV_FOR rev_For
#define ll long long
#define Size(v) ((int)v.size())
#define _section "\n--------------------\n"
#define fi first
#define se second
#define pb push_back
using namespace std;
// using namespace __gnu_pbds;


int n, k;
const int nax = 2e5 + 5;
int a[nax];
int dp[nax][70];

void input() {
	cin >> n >> k;
	FOR (i, 1, n) cin >> a[i];	
	FOR (i, 0, n) {
		FOR (j, 0, 59) dp[i][j] = -1;
	}
}

void solve() {
	for (int i = 1; i <= n; ++i) dp[i][0] = a[i];

	for (int j = 1; j <= 60; ++j) {
		for (int i = 1; i <= n; ++i) {
			if (dp[i][j - 1] != -1) {
				dp[i][j] = dp[dp[i][j -1]][j - 1];
			}
		}
	}

	int pos = 1;

	for (int i = 59; i >= 0; --i) {
		if (k >= (1LL << i)) {
			k -= (1LL << i);
			pos = dp[pos][i];
		}
	}

	cout << pos;
}

signed main() {
#ifdef _DEBUG
	// freopen("INPUT.inp", "r", stdin);
	//freopen("OUTPUT.out", "w", stdout);
	clock_t start, end;
	start = clock();
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//------------------------------------------------------------------------------------
//----------------------------------MAIN PROGRAM--------------------------------------
	int t = 1;
	while (t--) {
		input();
		solve();
	}
//--------------------------------------END-------------------------------------------
//------------------------------------------------------------------------------------
#ifdef _DEBUG
	end = clock();
	cerr << "\n----------\nTime Elapsed: " << fixed << double(end - start) / double(CLOCKS_PER_SEC) << setprecision(6) << '\n';
#endif
	return 0;
}

Measured memory_bytes: 114572
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


int a, b;

void solve()
{
    cin >> a >> b; nout(a*b);
}

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

Measured memory_bytes: 3652
import sys
import itertools
# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
N = int(input())
A = [input() for _ in range(N)]
M = int(input())
B = [input() for _ in range(M)]

cnt_a = Counter(A)
cnt_b = Counter(B)

ans = 0
for k, v in cnt_a.items():
    val = v - cnt_b[k]
    ans = max(ans, val)
print(ans)


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

class Main{
  private:
  	
  public:
int n;
};
int main()
{
  //cout << n <<endl;
  vector<int> list(4);
  for(int i =0 ; i < 4; i++){
    cin >> list.at(i);
  }
  bool b;
  b = (count(list.begin(), list.end(), 1) == 1 && count(list.begin(), list.end(), 7) == 1
       && count(list.begin(), list.end(), 9) == 1 && count(list.begin(), list.end(), 4) == 1);
  string s;
  s = b? "YES" : "NO";
  cout << s;
}

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

using namespace std;

#define int int64_t
#define all(x) begin(x), end(x)
#define rall(x) x.rbegin(), x.rend()


void fail() {
    cout << -1 << endl;
    exit(0);
}

signed main() {
    //freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    int v[n];
    map<int, int> cnt[2];
    for(int i = 0; i < n; i++) {
        cin >> v[i];
        cnt[i % 2][v[i]]++;
    }
    vector<pair<int, int>> mx[2] = {{{0, -2}}, {{0, -1}}};
    for(auto it: cnt[0]) {
        mx[0].emplace_back(it.second, it.first);
    }
    for(auto it: cnt[1]) {
        mx[1].emplace_back(it.second, it.first);
    }
    sort(all(mx[0]), greater<pair<int, int>>());
    sort(all(mx[1]), greater<pair<int, int>>());
    if(mx[0][0].second == mx[1][0].second) {
        cout << n - max(mx[0][0].first + mx[1][1].first, mx[0][1].first + mx[1][0].first) << endl;
    } else {
        cout << n - (mx[0][0].first + mx[1][0].first) << endl;
    }
    
}


Measured memory_bytes: 9592
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    long n = scan.nextLong();
    String g = n+"";
    int k = g.length();
    long ret = 0;
    ArrayList<String> c = new ArrayList<String>();
    ArrayList<String> b = new ArrayList<String>();
    ArrayList<String> a = new ArrayList<String>();
    a = find(k,c,b);
    for (String t : a){
      long gg = Long.parseLong(t);
      if (gg <= n){
        ret += 1;
      }
    }
    System.out.println(ret);
  }

  static boolean check(String a){
    int a3 = 0;
    int a5 = 0;
    int a7 = 0;
    for (int i=0;i<a.length();i++){
      if (a.charAt(i) == '3') {
        a3 += 1;
      }
      if (a.charAt(i) == '5') {
        a5 += 1;
      }
      if (a.charAt(i) == '7') {
        a7 += 1;
      }
    }
    if ((a3 == 0) || (a5 == 0) || (a7 == 0)){
      return false;
    }
    return true;
  }

  static ArrayList<String> find(int n, ArrayList<String> b, ArrayList<String> c){
    if (b.size() == n){
      String cc = concate(b);
      if (check(cc) == true){
        c.add(cc);
      }
      return c;
    }

    String cc = concate(b);
    if (check(cc) == true){
      c.add(cc);
    }

    String [] app = new String[]{"3","5","7"};
    for (int i=0;i<3;i++){
      b.add(app[i]);
      c = find(n,b,c);
      b.remove(b.size()-1);
    }
    return c;

  }

  static String concate(ArrayList<String> a){
    String ret = "";
    for (String g : a){
      ret += g;
    }
    return ret;
  }
}


Measured memory_bytes: 56092
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> cnt(m, 0);
  for(int i = 0; i < n; i++){
    int k;
    cin >> k;
    for(int j = 0; j < k; j++){
      int a;
      cin >> a;
      cnt[a-1]++;
    }
  }
  int res = 0;
  for(int i = 0; i < m; i++)
    if(cnt[i] == n) res++;
  cout << res << endl;
  return 0;
}

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

int main() {
  char b;
  cin >> b;
  
  if(b == 'A') {
    cout << "T" << endl;
  }
  else if(b == 'T') {
    cout << "A" << endl;
  }
  else if(b == 'G') {
    cout << "C" << endl;
  }
  else if(b == 'C') {
    cout << "G" << endl;
  }
}


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

int main()
{
    int a,b;
    cin >> a >> b;
    F(i,1,4){
        if(i!=a && i!=b){
            cout << i << endl;
            break;
        }
    }
    return 0;
}

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

#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>

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

using namespace std;
using namespace boost;

template<class T>
class IdMaker{
public:
  std::map<T,int> _m;
  int getId(const T &v){
    if(_m.find(v) == _m.end()){
      int next = _m.size();
      return _m[v] = next;
    }
    return _m[v];
  }
  int size() { return _m.size(); }
};

int main(){
  int n, m, cap;

  ios_base::sync_with_stdio(false);

  while(cin >> n >> m >> cap, n + m + cap){
    IdMaker<string> idm;
    vector<vector<pair<int, int> > > edge(2 * n);
    string buff;
    int src, dst;

    cin >> buff; src = idm.getId(buff);
    cin >> buff; dst = idm.getId(buff);

    REP(i,n){
      string a, b;
      int l;
      cin >> a >> b >> l;

      int aa = idm.getId(a);
      int bb = idm.getId(b);

      edge[aa].push_back(make_pair(bb, l));
      edge[bb].push_back(make_pair(aa, l));
    }

    edge.resize(idm.size());

    vector<bool> gas(edge.size(), false);

    REP(i,m){
      cin >> buff;
      gas[idm.getId(buff)] = true;
    }

    cap *= 10;
    vector<vector<int> > memo(edge.size(), vector<int>(cap + 1, INT_MAX));
    typedef boost::tuple<int, int, int> data;
    const int distance = 0;
    const int liter    = 1;
    const int pos      = 2;
    priority_queue<data, vector<data>, greater<data> > pq;
    pq.push(make_tuple(0, cap, src));

    while(pq.size()){
      data d = pq.top(); pq.pop();

      int dd = d.get<distance>();
      int lt = d.get<liter>();
      int pp = d.get<pos>();

      if(memo[pp][lt] < dd) continue;
      memo[pp][lt] = dd;

      if(pp == dst){
        cout << dd << endl;
        pq.push(make_tuple(0, 0, 0)); // dammy
        break;
      }

      REP(i, edge[pp].size()){
        int next = edge[pp][i].first;
        int len  = edge[pp][i].second;
        int llt  = lt - len;

        if(llt >= 0){
          if(gas[next]) llt = cap;
          if(memo[next][llt] > dd + len){
            memo[next][llt] = dd + len;
            pq.push(make_tuple(dd + len, llt, next));
          }
        }
      }
    }

    if(pq.empty()){
      cout << "-1" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 0
#[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 ) * } };
}
#[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 , usize1 ) => { read_value ! ( $ next , usize ) - 1 };
    ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) };
}

#[allow(unused_macros)]
macro_rules! vec_md {
    ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) };
    ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] };
    ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] };
}

#[allow(unused_macros)]
macro_rules! chmax {
    ( $ x : expr , $ y : expr ) => { if $ x < $ y { $ x = $ y ; true } else { false } };
}

fn main() {
    input! {
        s: chars,
        t: chars
    }

    let mut dp = vec_md![0u64;s.len()+1;t.len()+1];

    for i in 0..dp.len() {
        for j in 0..dp[0].len() {
            if i < s.len() && j < t.len() && s[i] == t[j] && i+1<dp.len() && j+1<dp[0].len() {
                chmax!(dp[i+1][j+1], dp[i][j] + 1);
            }
            if i+1<dp.len() {chmax!(dp[i+1][j], dp[i][j]);}
            if j+1<dp[0].len() {chmax!(dp[i][j+1], dp[i][j]);}
        }
    }

    let mut ret = vec![];
    let mut i = s.len();
    let mut j = t.len();
    while i > 0 && j > 0 {
        if dp[i-1][j] == dp[i][j] {
            i -= 1;
        } else if dp[i][j-1] == dp[i][j] {
            j -= 1;
        } else {
            i -= 1;
            j -= 1;
            ret.push(s[i]);
        }
    }
    ret.reverse();

    println!("{}", ret.into_iter() .collect::<String>());
}

Measured memory_bytes: 90364