akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int N;
  cin>>N;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin>>S[i];
  }
  
  vector<long long> header(5,0);
  for(int i=0;i<N;i++){
    switch (S[i][0]){
      case 'M': header[0]++;
      break;
      case 'A': header[1]++;
      break;
      case 'R': header[2]++;
      break;
      case 'C': header[3]++;
      break;
      case 'H': header[4]++;
      break;
      default : break;
    }
  }

  long long sum=0;
  for(int i=0;i<=2;i++){
    for(int j=i+1;j<=3;j++){
      for(int k=j+1;k<5;k++){
        sum+=header[i]*header[j]*header[k];
      }
    }
  }
  cout<<sum;
}


Measured memory_bytes: 6144
def insertion_sort(A):
    print " ".join(map(str, A))
    for i in range(1, len(A)):
        key = A[i]
        # insert A[i] into the sorted sequience A[0,...,j-1]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print " ".join(map(str, A))

N = int(raw_input())
A = map(int, raw_input().split(" "))
insertion_sort(A)


Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using namespace std;

int main(){
  int n;cin>>n;
  int a,sum=0;
  for(int i=1;i<=n;i++){
    cin>>a;
    if(i%2==0)continue;
    if(a%2==1)sum++;
  }
  cout<<sum;
}

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

int main() {
	char b;
	cin >> b;

	if (b == 'A') {
		cout << 'T' << endl;
		return 0;
	}
	if (b == 'T') {
		cout << 'A' << endl;
		return 0;
	}
	if (b == 'G') {
		cout << 'C' << endl;
		return 0;
	}
	if (b == 'C') {
		cout << 'G' << endl;
		return 0;
	}


	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var av = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var bw = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var t = long.Parse(Console.ReadLine());

        Console.WriteLine((av[1] - bw[1]) * t >= Abs(av[0] - bw[0]) ? "YES" : "NO");
    }
}

Measured memory_bytes: 28252
MOD = 10 ** 9 + 7
table_len = 500010

fac = [1, 1]
for i in range(2, table_len):
    fac.append(fac[-1] * i % MOD)
    
finv = [0] * table_len
finv[-1] = pow(fac[-1], MOD - 2, MOD)
for i in range(table_len-1, -1, -1):
    finv[i-1] = finv[i] * i % MOD

def comb(n, k):
    return fac[n] * finv[k] * finv[n-k] % MOD

def perm(n, k):
    return fac[n] * finv[n-k] % MOD

N, M = map(int, input().split())

print(sum( ((-1)**k * comb(N, k) * perm(M, k) * perm(M-k, N-k)**2 % MOD ) for k in range(N+1)) % MOD)


Measured memory_bytes: 48496
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const ll INF = 1e15;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  vector<ll> arr(N + 1, 0);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &a[i]);
    arr[i + 1] += arr[i] + a[i];
  }

  vector<vector<ll>> dp(N + 1, vector<ll>(N + 1, 0));

  for (int len = 2; len <= N; ++len)
  {
    for (int l = 0; l + len <= N; ++l)
    {
      int r = l + len;
      dp[l][r] = INF;
      for (int k = l + 1; k < r; ++k)
      {
        dp[l][r] = min(dp[l][r], dp[l][k] + dp[k][r] + arr[r] - arr[l]);
      }
    }
  }
  cout << dp[0][N] << endl;

  return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int N, coor[105];
	while (cin >> N)
	{
		for (int i = 0; i < N; i++)
			cin >> coor[i];
		sort(coor, coor + N);
		int ans = coor[N - 1] - coor[0];
		cout << ans << endl;
	}
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
n = int(input())
m  = [0]*5
for i in range(n):
    s = input()
    if s[0] == 'M':
        m[0] += 1
    elif s[0] == 'A':
        m[1] += 1
    elif s[0] == 'R':
        m[2] += 1
    elif s[0] == 'C':
        m[3] += 1
    elif s[0] == 'H':
        m[4] += 1
ans = m[0]*m[1]*m[2]
ans += m[0]*m[1]*m[3]
ans += m[0]*m[1]*m[4]
ans += m[0]*m[2]*m[3]
ans += m[0]*m[2]*m[4]
ans += m[0]*m[3]*m[4]
ans += m[1]*m[2]*m[3]
ans += m[1]*m[2]*m[4]
ans += m[1]*m[3]*m[4]
ans += m[2]*m[3]*m[4]
print(ans)


Measured memory_bytes: 3064
#include<stdio.h>

int main(){
  int a,b,c,d;

  
  scanf("%d %d",&a,&b);
  
  if(a<b){
    c=a;
    a=b;
    b=c;
  }

  d=a%b;
  while(d!=0){
    a=b;
    b=d;
    d=a%b;
  }

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

  return 0;
}




Measured memory_bytes: 2072
#include <bits/stdc++.h>
#include <algorithm>
#include <climits>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <math.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define str string
#define deb_arr(arr,n) for(ll i=0;i<(n);i++){ cout << (arr)[i] << " ";}
#define in_arr0(arr,n) for(ll i=0;i<(n);i++){ cin >> (arr)[i]; }
#define in_arr1(arr,n) for(ll i=1;i<=(n);i++){ cin >> (arr)[i];}
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> pbds;
#define vll vector<ll> 
#define fr(n) for(i=0;i<(n);i++)
#define fr1(n) for(i=1;i<=(n);i++)
#define pll pair<ll,ll>
#define f first
#define s second
#define vpll vector<pll>
#define ump unordered_map
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define IN(a,b) ((a).find(b)!=(a).end())
#define pb push_back
#define mkp make_pair
#define PI M_PI
#define INF 1e18
#define deb(x) if(ON) cout << #x <<" : " << x << endl
#define fast ios_base::sync_with_stdio(false)
#define io cin.tie(NULL),cout.tie(NULL)
#define ON !false
ll dx[]={0,-1,0,1};
ll dy[]={1,0,-1,0};
const ll mod=1e9+7;
inline ll add(ll a,ll b){
    return  ((a%mod)+(b%mod)+mod)%mod;
}
inline ll mul(ll a,ll b){
    return ((a%mod)*(b%mod)+mod)%mod;
}
void pause(ll id){
    cout << "Waiting " << id << endl;
    cin >> id;
}

const int mxn=1e5+10;


void init(){

    return ;
}


signed main(){
    fast;
    io;
    if(!true){
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    }
    init();
    ll i,j;
    str s,t;
    cin >> s >> t;
    bool flag=true;
    flag=flag && (s==(t.substr(0,s.size()))) && t.size() == s.size()+1;
    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
   
    return 0;
}


Measured memory_bytes: 3652
n, k = (int(i) for i in input().split())

def Base_10_to_n(X, n):
    if (int(X / n)):
        return Base_10_to_n(int(X / n), n) + str(X % n)
    return str(X % n)
ans = Base_10_to_n(n, k)
print(len(ans))

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

int main(){
    int a,b,h,m;
    double pi = M_PI;
    cin >> a >> b >> h >> m;
    double theta_t = 2 * pi * (60 * h + m)/720;
    double theta_m = 2 * pi * m / 60;
    double tx,ty,mx,my;
    tx = a * cos(theta_t);
    ty = a * sin(theta_t);
    mx = b * cos(theta_m);
    my = b * sin(theta_m);
    //cout << tx <<" " <<  ty <<" "<< mx <<" "<< my << endl;
    double d2 = (tx - mx)*(tx-mx) + (ty - my) * (ty - my);
    double d = sqrt(d2);
    printf("%21.20lf",d);
}

Measured memory_bytes: 4124
N,M=map(int,input().split())
lights=[]
for _ in range(M):
    number=list(map(int,input().split()))
    lights.append(number[1:])
p=list(map(int,input().split()))
switches=[n for n in range(1,N+1)]
kouho=[]
n=len(switches)
for i in range(2**n):
    switch=[]
    for j in range(n):
        if ((i>>j)&1):
            switch.append(switches[j])
    kouho.append(switch)
del kouho[0]
ans=0
for kou in kouho:
    numbers=[0 for _ in range(M)]
    for k in kou:
        for n in range(M):
            if k in lights[n]:
                numbers[n]+=1
    for n in range(M):
        numbers[n]=numbers[n]%2
    if numbers==p:
        ans+=1
if p ==[0 for _ in range(M)]:
    ans+=1
print(ans)


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

int main(){
  int N;
  cin >> N;
  vector<int > B(N);
  rep(i,N-1) cin >> B.at(i);
  int ans = 0;
  ans += B.at(0);
  for(int i = 1; i < N-1; i++){
    ans += min(B.at(i-1),B.at(i));
  }
  ans += B.at(N-2);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.math.BigDecimal;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		double B = sc.nextDouble();

		BigDecimal Ab = BigDecimal.valueOf(A);
		BigDecimal Bb = BigDecimal.valueOf(B);

		BigDecimal res = Ab.multiply(Bb);
		res = res.setScale(0, BigDecimal.ROUND_DOWN);
		System.out.println(res);
	}
}

Measured memory_bytes: 37660
def gcd(a, b):
    if not a:
        # a が ゼロ ならば b
        return b
    if not b:
        # b が ゼロ ならば a
        return a
    while b:
        a, b = b, a % b
    return a


def main():
    N, *A = map(int, open(0).read().split())
    L = [0] * N
    R = L[:]
    R.append(0)
    for i in range(N - 1):
        L[i + 1] = gcd(L[i], A[i])
    for i in range(N - 1, -1, -1):
        R[i] = gcd(R[i + 1], A[i])
    print(max(gcd(L[i], R[i + 1]) for i in range(N)))
    return


main()


Measured memory_bytes: 14412
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
#if DEBUG
    printfn "debuged"
#endif

    let scanner = Scanner()
    let k = scanner.NextI32()
    let n = scanner.NextI32()
    let arrA = scanner.ArrayI32(n)

    let mx = Array.max arrA
    mx * 2 - 1 - k
    |> max 0
    |> printfn "%i"

    0


Measured memory_bytes: 14168
#include <iostream>
#include <string>
#include <utility>

using namespace std;

template <class T>
class mlist {
	private:
		typedef struct elm_ {
			struct elm_* next;
			struct elm_* prev;
			T value;
		} elm;
		elm* sentinel;
	public:
		mlist() {
			sentinel = new elm;
			sentinel->next = sentinel;
			sentinel->prev = sentinel;
		}
		void insert(T e) {
			elm* ne = new elm;
			ne->value = e;
			ne->next = sentinel->next;
			ne->prev = sentinel;
			ne->prev->next = ne;
			ne->next->prev = ne;
		}
		void delete_x(T e) {
			elm* cur = sentinel->next;
			while(cur != sentinel && cur->value != e) {
				cur = cur->next;
			}
			if(cur != sentinel) {
				cur->next->prev = cur->prev;
				cur->prev->next = cur->next;
				delete cur;
			}
		}
		void delete_f() {
			if(sentinel->next != sentinel) {
				elm* ne = sentinel->next;
				ne->next->prev = ne->prev;
				ne->prev->next = ne->next;
				delete ne;
			}
		}
		void delete_l() {
			if(sentinel->prev != sentinel) {
				elm* pe = sentinel->prev;
				pe->next->prev = pe->prev;
				pe->prev->next = pe->next;
				delete pe;
			}
		}
		void dump() {
			elm* cur = sentinel->next;
			while(cur != sentinel) {
				cout << cur->value;
				cur = cur->next;
				if(cur != sentinel) cout << " ";
			}
			cout << endl;
		}
};

int main () {
	int n;
	cin >> n;
	string cmd;
	int param;
	mlist<int> l;
	for(int i = 0;i < n;i++) {
		cin >> cmd;
		if(cmd == "insert") {
			cin >> param;
			l.insert(param);
		} else if(cmd == "delete") {
			cin >> param;
			l.delete_x(param);
		} else if(cmd == "deleteLast") {
			l.delete_l();
		} else if(cmd == "deleteFirst") {
			l.delete_f();
		} else {
			throw "Undefined command";
		}
	}
	l.dump();
}



Measured memory_bytes: 34448
n=int(input())
a1=list(map(int,input().split()))
a2=list(map(int,input().split()))
for i in range(1,n):
    a1[i]=a1[i]+a1[i-1]
    a2[n-1-i]=a2[n-1-i]+a2[n-i]
ans=0
for i in range(n):
    ans=max(ans,a1[i]+a2[i])
print(ans)

Measured memory_bytes: 38384
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toInt() }
    var ans = 0.0
    for (i in 0 until n) {
        val b = a[i]
        ans += 1.0 / b
    }
    println(1.0 / ans)
}


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

int main() {
	int w, n, a, b, c[31], i, d;
	char e;
	cin >> w >> n;
	for (i = 1; i <= w; i++) {
		c[i] = i;
	}
	for (i = 0; i < n; i++) {
		cin >> a >> e >> b;
		d = c[a];
		c[a] = c[b];
		c[b] = d;
	}
	for (i = 1; i <= w; i++) {
		cout << c[i] << endl;
	}
}

Measured memory_bytes: 1160
let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let xs = Array.init n (fun _ -> Scanf.scanf "%d " (fun x -> x)) in
  let ys = Array.init n (fun i -> xs.(i)) in
  Array.sort compare ys;
  Array.iter (fun x ->
    Printf.printf "%d\n" @@
      if x < ys.(n / 2) then ys.(n / 2)
      else ys.(n / 2 - 1)) xs

Measured memory_bytes: 8320
storeNum, canNum = input().split()
storeNum = int(storeNum)
canNum = int(canNum)
costs = [0] * storeNum
maxCanNumbers = [0] * storeNum

for i in range(storeNum):
    costs[i], maxCanNumbers[i] = input().split()
    costs[i] = int(costs[i])
    maxCanNumbers[i] = int(maxCanNumbers[i])

currentStoreHasMoreCans = False
totalPrice = 0

costs, maxCanNumbers = (list(x) for x in zip(*sorted(zip(costs, maxCanNumbers))))

for i in range(storeNum):
    if canNum >= maxCanNumbers[i]:
        totalPrice = totalPrice + costs[i] * maxCanNumbers[i]
        canNum = canNum - maxCanNumbers[i]
        if canNum is 0:
            break
    else:
        totalPrice = totalPrice + costs[i] * canNum
        canNum = 0    
        break

print(totalPrice)

Measured memory_bytes: 26692
def solve():
    w = input()
    word_dict = {}
    for word in w:
        if word in word_dict:
            word_dict[word] += 1
        else:
            word_dict[word] = 1
    
    ret = all(count%2 == 0 for count in word_dict.values())
    print('Yes' if ret else 'No')
    
solve()

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

#define DB(x) cerr << #x << " = " << (x) << " "
#define ENDL cerr << "\n"
#define FOR(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define DBA(x, a, b) { cerr << #x << " = "; for (int _ = (a); _ <= (b); _++) cerr << x[_] << ' '; ENDL }
#define DBS(x) { cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl; }

using namespace std;

template<typename T, typename U> static void rmin(T &x, U y) {
  if (y < x) x = y;
}
template<typename T, typename U> static void rmax(T &x, U y) {
  if (x < y) x = y;
}

#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define mid ((left + right) >> 1)
#define lson rt << 1, left, mid
#define rson rt << 1 | 1, mid + 1, right

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
int a[N];

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    int pt = i;
    while (pt < n && a[pt] == a[i]) pt++;
    cnt += (pt - i) / 2;
    i = pt - 1;
  }
  cout << cnt << endl;
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 0x3f3f3f3f
const int N=1e5+5;
char s[10];
int main()
{
    ios::sync_with_stdio(false);
    scanf("%s",s);
    if(s[1]=='B') printf("ARC\n");
    else if(s[1]=='R') printf("ABC\n");
    return 0;
}

Measured memory_bytes: 3776
#include<stdio.h>
#define N 8

int a[N][N]={0};

void update(int y,int x){
	int i,j;
	/*横*/
	for(i=0;i<N;i++){
		if(i!=x)a[y][i]=2;
	}
	/*縦*/
	for(i=0;i<N;i++){
		if(i!=y)a[i][x]=2;
	}
	/*右上*/
	i=y-1; j=x+1;
	while(i>=0 && j<8){
		a[i--][j++]=2;
	}
	/*左上*/
	i=y-1; j=x-1;
	while(i>=0 && j>=0){
		a[i--][j--]=2;
	}
	/*左下*/
	i=y+1; j=x-1;
	while(i<8 && j>=0){
		a[i++][j--]=2;
	}
	/*右下*/
	i=y+1; j=x+1;
	while(i<8 && j<8){
		a[i++][j++]=2;
	}
	
	return;

}

void printboard(){
	int i,j;
	
	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			if(a[i][j]==1)printf("Q");
			else printf(".");
		}
		printf("\n");
	}

	return;	
}


int check(int y,int x){
	int i,j;
	
	/*横*/
	for(i=0;i<N;i++){
		if(i!=x && a[y][i]==1)return 0;
	}
	/*縦*/
	for(i=0;i<N;i++){
		if(i!=y && a[i][x]==1)return 0;
	}
	/*右上*/
	i=y-1; j=x+1;
	while(i>=0 && j<8){
		if(a[i--][j++]==1)return 0;
	}
	/*左上*/
	i=y-1; j=x-1;
	while(i>=0 && j>=0){
		if(a[i--][j--]==1)return 0;
	}
	/*左下*/
	i=y+1; j=x-1;
	while(i<8 && j>=0){
		if(a[i++][j--]==1)return 0;
	}
	/*右下*/
	i=y+1; j=x+1;
	while(i<8 && j<8){
		if(a[i++][j++]==1)return 0;
	}
	
	return 1;
	
}


int Get_Solution(int d){
	int i;
	
	for(i=0;i<N;i++){
		if(a[d][i]==1){
			if(!Get_Solution(d+1))return 0;
		}
	}
	
	

	if(d==N){
		printboard();
		return 1;
	}
	
	else {
		for(i=0;i<N;i++){
			if(a[d][i]==0 && check(d,i)){
				a[d][i]=1;
				if(!Get_Solution(d+1)){
					a[d][i]=0;
				}
			}
		}
	}
	
	
	return 0;

}

int main(){
	int n,i,j;
	int x,y;
	int d=0;
	
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d %d",&y,&x);
		a[y][x]=1;
		update(y,x);
	}
	
	i=Get_Solution(d);

	return 0;
}


Measured memory_bytes: 2104
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.next()
    val b = sc.next()
    println(problem086b(a, b))
}

fun problem086b(a: String, b: String): String {
    val num = (a + b).toInt()
    for (i in 1 until num) {
        if (num / i == i && num % i == 0) {
            return "Yes"
        }
    }
    return "No"
}

Measured memory_bytes: 31136
#include<stdio.h>
int main(){
	int n,a[15],b[15],i,j,f,ans;
	while(scanf("%d",&n)!=EOF){
		if(n==0)break;
		ans=0;
		for(i=0;i<n;i++)scanf("%d",&a[i]);
		while(1){
			f=n;
			for(i=0;i<n;i++){
				b[i]=0;
				for(j=0;j<n;j++){
					if(a[j]==a[i])b[i]++;
				}
				if(a[i]!=b[i])f--;
			}
			if(f==n)break;
			ans++;
			for(i=0;i<n;i++)a[i]=b[i];
		}
		printf("%d\n",ans);
		for(i=0;i<n;i++)printf("%d%s",b[i],(i!=n-1)?" ":"\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
const double EPS = 1e-10;
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
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; }
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}
void solve(long long N, std::vector<std::string> S){
    string arr[4] = {"AC", "WA", "TLE", "RE"};
    int ans[4] = {0, 0, 0, 0};
    rep(i, N){
        rep(j, 4){
            if(arr[j] == S[i]){
                ans[j]++;
            }
        }
    }
    rep(i, 4){
        cout<<arr[i]<<" x "<<ans[i]<<endl;
    }

}
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<std::string> S(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> S[i];
    }
    solve(N, std::move(S));
    return 0;
}


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

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    map<string,int> mp;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << "AC" << " x " << mp["AC"] << endl;
    cout << "WA" << " x " << mp["WA"] << endl;
    cout << "TLE" << " x " << mp["TLE"] << endl;
    cout << "RE" << " x " << mp["RE"] << endl;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define Mod(n) n % 1000000007
const int dx[8] = {1, 0, -1, 0, -1, 1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};

void solve()
{
    int N;
    cin >> N;
    set<int> s;
    int tmp;
    for(int i = 0;i < N;i++)
    {
        cin >> tmp;
        s.insert(tmp);
    }
    cout << (s.size() == N ? "YES\n" : "NO\n");
}

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


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define N 1000005
#define ll long long int 	
#define MP make_pair
#define pb push_back
#define ppb pop_back
#define sp " "
#define endl "\n"
#define fi first
#define se second
#define ii pair<int,int>
#define lli pair<ll,ll>
#define fast cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(false)
#define fast2 freopen ("kmp.gir","r",stdin);freopen ("kmp.cik","w",stdout);
#define mod 1000000009
#define fs(x,y) for(int i=1;i<=y;i++) cin>>x[i]
#define fo(i,x,y) for(int i=x;i<=y;i++)
using namespace std;

ll n,m,ar[N],sum,a,b;

int main()
{
	fast;
	cin>>n>>a>>b;
	cout<<min(a*n,b);



}



/*     cd onedrive\desktop\kod
cls


*/

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;

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

int fuct(int n){
    int res = 0;
    while(n % 2 == 0){
        n /= 2;
        res++;
    }
    return res;
}

int main(){
    int n;
    cin >> n;
    int mx = 0;
    int ans = 1;
    for (int i = 1; i <= n; i++){
        if (mx < fuct(i)){
            mx = fuct(i);
            ans = i;
        }
    }
    cout << ans << endl;
}

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

void count(char []);
void print(void);

int ary[4];

int main(void) {
    char buf[3];
    while(~scanf("%*d%*c%s", buf)) {
        count(buf);
    }
    print();
    return 0;
}

void count(char buf[]) {
    if(~-strlen(buf)) {
        ary[2]++;
    } else {
        switch(strcmp(buf, "B")) {
          case -1:
            ary[0]++;
            break;
          case 0:
            ary[1]++;
            break;
          case 1:
            ary[3]++;
            break;
        }
    }
}

void print(void) {
    int i;
    for(i = 0; i < 4; i++) {
        printf("%d\n", ary[i]);
    }
}

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


int main(){
  int n,a,b,c;
  cin >> n ;

  vector<int> dpa(n,0);
  vector<int> dpb(n,0);
  vector<int> dpc(n,0);
  
    cin >> dpa.at(0) >> dpb.at(0) >>dpc.at(0) ;

  for(int i=1;i<n;i++){
   cin >> a >> b >> c;
   dpa.at(i)=max(dpb.at(i-1),dpc.at(i-1))+a;
   dpb.at(i)=max(dpa.at(i-1),dpc.at(i-1))+b;
   dpc.at(i)=max(dpb.at(i-1),dpa.at(i-1))+c;
  }
  cout << max(max(dpa.at(n-1),dpb.at(n-1)),dpc.at(n-1)) <<endl;
  return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define vpll vector < pair<long long,long long> >
#define fill(a,val)  memset(a,val, sizeof (a))
#define sort_unique(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(cont) cont.begin(), cont.end()
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MAX   1e9
#define MIN  -1e9
typedef map<int,int> mpi;
typedef set<int> seti;
typedef multiset<int> mseti;
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i, n)    for(long long int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define repn(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define trav(a, x) for(auto& a : x)
struct Interval {int start, end;};
bool compare(Interval i1, Interval i2) {return (i1.start < i2.start);}
ll dp[100005][3];
int main()
{
    ll n;
    cin>>n;
    fill(dp,0);
    ll a[n],b[n],c[n];
    rep(i,n)
    cin>>a[i]>>b[i]>>c[i];
    dp[0][0]=a[0];dp[0][1]=b[0];dp[0][2]=c[0];
    repA(i,1,n-1)
    {
        dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i]);
        dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i]);
        dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i]);
    }
    cout<<max3(dp[n-1][0],dp[n-1][1],dp[n-1][2]);
    return 0;
}


Measured memory_bytes: 4992
#include<stdio.h>
int main()
{
int N,A,B,C,D,hoge=0,sushi=0;
scanf("%d %d %d %d %d",&N,&A,&B,&C,&D);
if(N%A!=0){
hoge=N/A;
hoge=hoge+1;
}else{
hoge=N/A;
}
if(N%C!=0){
sushi=N/C;
sushi=sushi+1;
}else{
sushi=N/C;
}
B=hoge*B;
D=sushi*D;
if(B<=D){
printf("%d\n",B);
}else if(D<=B){
printf("%d\n",D);
}
return(0);
}


Measured memory_bytes: 2740
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
#define fst first
#define snd second
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000003;

int main(){
    ll n; cin >> n;
    if(n%2 == 0){
        prtl((n-2)*n/2);
        rep(i, 1, n+1){
            rep(j, i+1, n+1){
                if(i+j == n+1){
                    continue;
                }else{
                    prt(i); prt(" "); prtl(j);
                }
            }
        }
    }else{
        prtl((n-1)*(n-1)/2);
        rep(i, 1, n){
            rep(j, i+1, n+1){
                if(i+j == n){
                    continue;
                }else{
                    prt(i); prt(" "); prtl(j);
                }
            }
        }
    }
}


Measured memory_bytes: 3624
N = gets.to_i
os = {}
es = {}
gets.split.map(&:to_i).each_with_index{ |a,i|
  if i%2 == 0
    es[a] = (es[a] || 0) + 1
  else
    os[a] = (os[a] || 0) + 1
  end
}
ke = es.keys.sort_by{ |a| -es[a] }
ko = os.keys.sort_by{ |a| -os[a] }
if ke[0] == ko[0]
  p N - [((es[ke[1]] || 0) + os[ko[0]]), ((os[ko[1]] || 0) + es[ke[0]])].max
else
  p N - es[ke[0]] - os[ko[0]]
end


Measured memory_bytes: 16888
#include <stdio.h>

int count(int turi);

int main(void)
{
	int n;
	int ans;
	
	while (1){
		
		scanf("%d", &n);
		
		if (n == 0){
			return (0);
		}
		n = 1000 - n;
		
		ans = count(n);
		
		printf("%d\n", ans);
	}
}

int count(int turi)
{
	int i = 5;
	int koin[6] = {1, 5, 10, 50, 100, 500};
	int count = 0;
	
	while (1){
		if (turi == 0){
			return (count);
		}
		else if (turi >= koin[i]){
			turi -= koin[i];
			count++;
		}
		else {
			i--;
		}
	}
}

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

//#pragma GCC optimize("O3,Ofast,no-stack-protector,unroll-loops,fast-math")

//#define int long long
typedef pair <int, int> pii;
const int maxn = 101;
string s[maxn];
int dp[maxn][maxn];

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	for (int i = n - 1; i >= 0; i--) {
		for (int j = m - 1; j >= 0; j--) {
			if (s[i][j] == '.') {
			if (i == n - 1 && j == m- 1)
				dp[i][j] = 0;
			else if (i == n - 1)
				dp[i][j] = dp[i][j + 1];
			else if (j == m - 1)
				dp[i][j] = dp[i + 1][j];
			else
				dp[i][j] = min(dp[i + 1][j], dp[i][j + 1]);
			}
			else {
				if (i == n - 1 && j == m - 1) {
					dp[i][j] = 1;
				}
				else if (i == n - 1) {
					dp[i][j] = dp[i][j + 1] + (s[i][j + 1] == '.');
				}
				else if (j == m - 1) {
					dp[i][j] = dp[i + 1][j] + (s[i + 1][j] == '.');
				}
				else
					dp[i][j] = min(dp[i + 1][j] + (s[i + 1][j] == '.'), dp[i][j + 1] + (s[i][j + 1] == '.'));
			}
		}
	}
	cout << dp[0][0];
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
int main(){
	ll n; cin>>n; ll a[n];
	rep(i,n) cin>>a[i];
	ll cs=0,ans=0;
	for(int i=n-2;i>=0;i--)
		if(a[i]>=a[i+1]) cs++,ans=max(ans,cs);
		else cs=0;
	
	cout<<ans;
}


Measured memory_bytes: 4412
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
int main(){
	fast;
	ll n,ans=1;
	cin>>n;
	string s1,s2,s;
	cin>>s1>>s2;
	for(int i=0;i<s1.length();i++)
	{
		if(s1[i]==s2[i])
			s+='X';
		else
			s+='Y',i++;
	}
	if(s[0]=='X')
		ans=3;
	else
		ans=6;
	for(int i=1;i<s.length();i++)
		if(s[i]=='X'&&s[i-1]=='X')
			ans=(ans*2)%mod;
		else if(s[i]=='X'&&s[i-1]=='Y')
			ans=ans;
		else if(s[i]=='Y'&&s[i-1]=='X')
			ans=(ans*2)%mod;
		else if(s[i]=='Y'&&s[i-1]=='Y')
			ans=(ans*3)%mod;
	cout<<ans%mod;
	return 0;
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
vi d1 = {1, 0, -1, 0}, d2 = {0, 1, 0, -1};
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  ll n, m;
  cin >> n >> m;
  if (n == 1 && m == 1) cout << 1 << endl;
  else if (n == 1) cout << m - 2 << endl;
  else if (m == 1) cout << n - 2 << endl;
  else cout << n * m - 2 * (n + m) + 4 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a<b){
if(b<c){
printf("Yes\n");
}else{
printf("No\n");
}}else{
printf("No\n");
}
return 0;
}

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

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define all(a) a.begin(),a.end()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)

typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int inf = 1e9;

struct Segtree {
	int n;
	vpii dat;

	void init(int n_) {
		n = 1;

		while (n < n_) n *= 2;

		dat.resize(2 * n);

		for (int i = 0; i < 2 * n - 1; ++i) dat[i] = pii(0, -inf);
	}

	void update(int a, int x) {
		int idx = a;
		a += n - 1;

		dat[a].fst += x;
		dat[a].scd = -idx;

		while (a > 0) {
			a = (a - 1) / 2;
			dat[a] = max(dat[a * 2 + 1], dat[a * 2 + 2]);
		}
	}

	pii get_max() {
		return dat[0];
	}
};

typedef pair<int, pair<int, int> > Query;

int res[100010];

signed main()
{
	omajinai;

	int N, R, L; cin >> N >> R >> L;

	Segtree seg;
	seg.init(N);

	vector<Query> queries(R);

	rep(i, R) {
		int d, t, x;
		cin >> d >> t >> x;

		-- d;

		queries[i] = Query(t, pii(d, x));
	}

	queries.PB(Query(L, pii(0, 0)));
	
	sort(all(queries));

	rep(i, R) {
		Query query = queries[i];
		Query next_query = queries[i + 1];

		seg.update(query.scd.fst, query.scd.scd);

		if (query.fst != next_query.fst) {
			res[-seg.get_max().scd] += next_query.fst - query.fst;
		}
	}

	int ma = -1;
	int ans = -1;

	rep(i, N) {
		if (ma < res[i]) {
			ma = res[i];
			ans = i;
		}
	}

	cout << ans + 1 << endl;
}

Measured memory_bytes: 19616
import math
ret=0
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
  for j in range(n):
    x,y=l[i]
    z,q=l[j]
    ret+=math.sqrt((z-x)**2+(y-q)**2)
print(ret/n)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const int MAX = 2e6+5;
const int mod = 1e9+7;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod/i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
 
}
long long COM(int n, int k){
    if(n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

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

    ll ans = 0;

    for(int d=1; d<N; ++d){
        ans += d*(N-d)*M%mod*M%mod*COM(N*M-2, K-2)%mod;
        ans %= mod;
    }

    for(int d=1; d<M; ++d){
        ans += d*(M-d)*N%mod*N%mod*COM(N*M-2, K-2)%mod;
        ans %= mod;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 47104
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();
            int[] roads = new int[n + 1];
            for (int i = 0; i < m; ++i) {
                roads[in.nextInt()]++;
                roads[in.nextInt()]++;
            }
            for (int i = 1; i <= n; ++i) out.println(roads[i]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

void solve(){
    int n, m; cin >> n >> m;
    vector<int> p(m), ks;
    REP(i, m){
        int k;
        cin >> k;
        int bit = 0;
        REP(i, k){
            int swind;
            cin >> swind;
            bit |= (1 << (swind-1));
        }
        ks.pb(bit);
    }
    REP(i, m){
        cin >> p[i];
    }

    int res = 0;
    for(int bit=0; bit<(1<<n); bit++){
        bool flag = true;
        REP(i, m){
            int cnt = __builtin_popcount(bit&ks[i]);
            if(cnt%2 == p[i]){
                continue;
            }
            else{
                flag = false;
                break;
            }
        }
        if(flag) res++;
    }
    cout << res << endl;
}

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

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int N;
  cin >> N;

  for (int i = 1; i <= 9; i++) {
    if (100*(i-1) + 10*(i-1) + (i-1) < N &&
        N <= 100*i + 10*i + i) {
      cout << 100*i + 10*i + i << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
int max(int a,int b){
	return a>b?a:b;
}
const int Maxn=15;
const int Maxm=200;
const int Inf=0x3f3f3f3f;
int f[Maxn+5][1<<Maxn|5];
int n,m;
int mp[Maxn+5][Maxn+5];
int val[1<<Maxn|5];
int main(){
	scanf("%d%d",&n,&m);
	int all_sum=0;
	for(int i=1;i<=m;i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		mp[u][v]=mp[v][u]=w;
		all_sum+=w;
	}
	for(int mask=1;mask<(1<<n);mask++){
		for(int i=1;i<=n;i++){
			if(((mask>>(i-1))&1)==0){
				continue;
			}
			int last_mask=mask^(1<<(i-1));
			val[mask]=val[last_mask];
			for(int j=1;j<=n;j++){
				if(((last_mask>>(j-1))&1)==0){
					continue;
				}
				if(mp[i][j]==0){
					continue;
				}
				val[mask]+=mp[i][j];
			}
			break;
		}
	}
	memset(f,-0x3f,sizeof f);
	f[1][1]=0;
	for(int mask=2;mask<(1<<n);mask++){
		if((mask&1)==0){
			continue;
		}
		for(int i=1;i<=n;i++){
			if(((mask>>(i-1))&1)==0){
				continue;
			}
			int last_mask=(mask^(1<<(i-1)));
			for(int j=1;j<=n;j++){
				if(((last_mask>>(j-1))&1)==0){
					continue;
				}
				if(mp[i][j]==0){
					continue;
				}
				f[i][mask]=max(f[i][mask],f[j][last_mask]+mp[i][j]);
			}
			for(int nmask=last_mask;nmask;nmask=(nmask-1)&last_mask){
				if(f[i][(last_mask^nmask)|(1<<(i-1))]<0){
					continue;
				}
				f[i][mask]=max(f[i][mask],f[i][(last_mask^nmask)|(1<<(i-1))]+val[nmask|(1<<(i-1))]);
			}
		}
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++){
		ans=max(ans,f[n][i]);
	}
	printf("%d\n",all_sum-ans);
	return 0;
}


Measured memory_bytes: 4384
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <fstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s, r;
    char c;
    bool b = 0;
    int q, t, f;
    cin >> s >> q;
    while (q--) {
        cin >> t;
        if (t == 1) {
            b = !b;
        } else {
            cin >> f >> c;
            if (!b) {
                if (f == 1) r += c;
                else s += c;
            } else {
                if (f == 1) s += c;
                else r += c;
            }
        }
    }
    if (!b) {
        reverse(r.begin(), r.end());
        cout << r + s;
    } else {
        reverse(s.begin(), s.end());
        cout << s + r;
    }
}


Measured memory_bytes: 4084
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

vector<int> G[1 << 14];

void solve() {
	int n; cin >> n;
	vector<int> e(n,0);
	rep(i, n - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
		e[a]++; e[b]++;
	}
	vector<int> c(n);
	rep(i, n)cin >> c[i];
	vector<int> ans(n);
	sort(c.begin(), c.end());
	queue<int> q;
	rep(i, n) {
		if (e[i] == 1) {
			q.push(i);
		}
	}
	int loc = 0;
	while (!q.empty()) {
		int id = q.front(); q.pop();
		ans[id] = c[loc]; loc++;
		rep(j, G[id].size()) {
			int to = G[id][j];
			e[to]--;
			if (e[to] == 1) {
				q.push(to);
			}
		}
	}
	ll sum = 0;
	rep(i, n) {
		rep(j, G[i].size()) {
			int to = G[i][j];
			sum += min(ans[i], ans[to]);
		}
	}
	cout << sum / 2 << endl;
	rep(i, n) {
		if (i > 0)cout << " ";
		cout << ans[i];
	}
	cout << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#define MOD 1000000007
using namespace std;

int main(){
	int N;
	cin >> N;

	char S1[N], S2[N];
	for (int i=0; i<N; i++) {
		cin >> S1[i];
	}
	for (int i=0; i<N; i++) {
		cin >> S2[i];
	}

	long long ans = 1;
	
	int useColor = 3;
	bool beforeI = true;
	for (int col=0; col<N; col++) {
		if (S1[col] == S2[col]) {
			if (beforeI) {
				ans *= useColor;
				ans %= MOD;
			} else {
				ans *= 1;
			}

			useColor = 2;
			beforeI = true;
		} else {
			if (beforeI) {
				ans *= useColor * (useColor - 1);
			} else {
				ans *= 3;
			}
			ans %= MOD;

			useColor = 2;
			beforeI = false;
			col++;
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
import           Control.Monad
import           Control.Monad.State
import qualified Data.ByteString.Char8       as B
import           Data.Char
import qualified Data.Vector.Unboxed         as U

readInt :: StateT B.ByteString Maybe Int
readInt = StateT $ B.readInt . B.dropWhile isSpace

main :: IO ()
main = do
  Just (n, q) <- evalStateT (liftM2 (,) readInt readInt) <$> B.getLine
  s <- U.fromListN n <$> getLine
  let sol = solve s
  forM_ [1 .. q] $ \_ -> do
    Just (l, r) <- evalStateT (liftM2 (,) readInt readInt) <$> B.getLine
    print $ sol U.! r - sol U.! l

solve :: U.Vector Char -> U.Vector Int
solve s = (0 `U.cons`)
  $ U.scanl (+) 0
  $ U.map (\x -> if x == ('A', 'C') then 1 else 0)
  $ U.zip s (U.drop 1 (s `U.snoc` '_'))


Measured memory_bytes: 6524
// https://atcoder.jp/contests/abc158/tasks/abc158_d

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;
template <typename T>
inline bool chmax(T& a, T b);
template <typename T>
inline bool chmin(T& a, T b);
void print_ints(vector<ll> v);
template <typename T>
void drop(T a);

const ll INF = 1e18;

void solve() {
  string S;
  cin >> S;

  ll Q;
  cin >> Q;

  deque<char> q;
  rep(i, S.size()) { q.push_back(S[i]); }

  bool reversed = false;

  rep(i, Q) {
    ll type;
    cin >> type;

    if (type == 1) {
      reversed = !reversed;
    } else if (type == 2) {
      ll f;
      char c;
      cin >> f >> c;

      if (f == 1 && !reversed || f == 2 && reversed) {
        q.push_front(c);
      } else {
        q.push_back(c);
      }
    }
  }

  ll size = q.size();

  if (reversed) {
    rep(i, size) {
      cout << q.back();
      q.pop_back();
    }
  } else {
    rep(i, size) {
      cout << q.front();
      q.pop_front();
    }
  }

  cout << endl;
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

template <typename T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

void print_ints(vector<ll> v) {
  rep(i, v.size()) {
    if (i > 0) {
      cout << " ";
    }

    cout << v[i];
  }

  cout << endl;
}

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}


Measured memory_bytes: 976
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const double PI = acos(-1);  

// struct UnionFind{
//     vector<int> par;
//     UnionFind(int n): par(n, -1){}
//     int root(int x){
//       if(par[x]<0) return x;
//       return par[x] = root(par[x]);
//     }

//     bool same(int a, int b){
//       return root(a)==root(b);
//     }

//     void unite(int x, int y){
//       int a=root(x), b=root(y);
//       if(a==b) return;
//       par[a] = b;
//     }

// };

vector<vector<ll>> g;
vector<ll> h;





int main(){
  int n, m; cin >> n >> m;
  g.resize(n); h.resize(n);
  //UnionFind  tree(n);
  for(int i=0; i<n; i++)  cin >> h.at(i);
  for(int i=0; i<m; i++){
    int a, b; cin >> a >> b;
    a--;  b--;
    g[a].push_back(b);
    g[b].push_back(a);
    //tree.unite(a, b);
    
  }
  // set<int> st;
  // for(int i=0; i<n; i++){
  //   st.insert(tree.root(i));
  //   cout << tree.root(i) << endl;
  // }
  vector<bool> seen(n, true);
  int cnt=0;
  for(int i=0; i<n; i++){
    bool flag=true;
    for(auto nv: g[i]){
      if(h[nv]<h[i]) continue;
      flag = false;
    }
    if(flag) cnt += 1;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 9772