akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll f(ll n) {
	if (n < 10) return n;
	else {
		return n % 10 + f(n / 10);
	}
}

double g(ll n) {
	return 1.0*n / f(n);
}

int main() {
	ll K;  cin >> K;
	vector<ll> sunuke;
	ll base = 1;
	for (ll i = 0; i < 15; i++) {
		for (ll j = 1; j <= 150; j++) {
			sunuke.push_back(base*(j + 1) - 1);
		}
		base *= 10;
	}
	sort(sunuke.begin(), sunuke.end());
	sunuke.erase(unique(sunuke.begin(), sunuke.end()), sunuke.end());

	for (ll i = 0; i < (ll)sunuke.size(); i++) {
		for (ll j = i + 1; j < (ll)sunuke.size(); j++) {
			if (g(sunuke[i]) > g(sunuke[j])) {
				sunuke.erase(sunuke.begin() + i);
				i--;
				break;
			}
		}
	}

	for (ll i = 0; i < K; i++) {
		cout << sunuke[i] << endl;
	}
}


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

int main(){
  ll n,k;
  cin >> n >> k;
  if(n<n-k){
    printf("%lld",n);
    return 0;
  }
  ll d = n%k;
  d = min(d,abs(d-k));
  printf("%lld",d);
  return 0;
}

Measured memory_bytes: 3676
import java.util.*;

public class Main {

  class MaxFlow {
        class Edge {
            public final int to, rev;
            public long cap;
 
            public Edge(int to, int rev, long cap) {
                this.to = to;
                this.rev = rev;
                this.cap = cap;
            }
        }
 
        int v;
        List<Edge> G[];
        boolean used[];
 
        public MaxFlow(int v) {
            this.v = v;
            G = new List[v];
            for (int i = 0; i < v; ++i) {
                G[i] = new ArrayList<>();
            }
            used = new boolean[v];
        }
 
        public void add_edge(int from, int to, long cap) {
            G[from].add(new Edge(to, G[to].size(), cap));
            G[to].add(new Edge(from, G[from].size() - 1, 0));
        }
 
        long dfs(int v, int t, long f) {
            if (v == t) return f;
            used[v] = true;
            for (Edge e : G[v]) {
                if (!used[e.to] && e.cap > 0) {
                    long d = dfs(e.to, t, Math.min(f, e.cap));
                    if (d > 0) {
                        e.cap -= d;
                        G[e.to].get(e.rev).cap += d;
                        return d;
                    }
                }
            }
            return 0;
        }
 
        public long max_flow(int s, int t) {
            long flow = 0;
            while (true) {
                Arrays.fill(used, false);
                long f = dfs(s, t, Long.MAX_VALUE);
                if (f == 0) return flow;
                flow += f;
            }
        }
    }
 
    long solve(int n, long[] a) {
        MaxFlow flow = new MaxFlow(n + 2);
        for (int i = 0; i < n; ++i) {
            if (a[i] > 0) {
                flow.add_edge(i, n + 1, a[i]);
            } else {
                flow.add_edge(n, i, -a[i]);
            }
            for (int j = (i + 1) * 2; j <= n; j += i + 1) {
                flow.add_edge(i, j - 1, Long.MAX_VALUE / 2);
            }
        }
        long x = 0;
        for (long i : a) if (i > 0) x += i;
        return x - flow.max_flow(n, n + 1);
    }
 
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long[] a = new long[N];
        for(int i = 0; i < N; i++) {
          a[i] = sc.nextLong();
        }
        long ans = new Main().solve(N, a);
        System.out.println(ans);
    }
}

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

// typedef
// -----------------------------------------------------------------------------
typedef long long ll;
typedef long double ld;

// container util
// -----------------------------------------------------------------------------
#define ALL(c)  (c).begin(),(c).end()
#define SZ(c) ((ll)(c).size())
#define MAX(c) *max_element(ALL(c))
#define MIN(c) *min_element(ALL(c))
#define SORT(c) sort((c).begin(),(c).end())

// repetition
// -----------------------------------------------------------------------------
#define FOR(i, a, b) for(ll i= (a); i < (ll)(b); ++i)
#define REP(i, n) FOR(i, 0, n)

// constant
// -----------------------------------------------------------------------------
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1.0);

// debug
// -----------------------------------------------------------------------------
#define DUMP(x)  cerr << #x << " = " << (x) << endl


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    vector<int> v(3); cin >> v[0] >> v[1] >> v[2];
    SORT(v);
    if ((v[0] == v[1] & v[1] != v[2]) | (v[0] != v[1] & v[1] == v[2])) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
}

Measured memory_bytes: 3636
def resolve():
    # nCk = n! / n!(n-k)! のテーブル作成
    def COMinit(n, MOD):
        fact = [1, 1]
        fact_inv = [1, 1]
        inv = [0, 1]
        for i in range(2, n + 1):
            fact.append((fact[-1] * i) % MOD)
            inv.append((-inv[MOD % i] * (MOD // i)) % MOD)
            fact_inv.append((fact_inv[-1] * inv[i]) % MOD)
        return fact, fact_inv

    # 二項係数計算
    def Combination(n, k, MOD=998244353):
        # fac, finv = COMinit(n, MOD)
        if n < k: return 0
        if n < 0 or k < 0: return 0
        ret = fac[n] * (finv[k] * finv[n - k] % MOD) % MOD
        return ret

    MOD = 998244353
    N, M, K = map(int, input().split())

    # テーブルを作成し、K回使いまわす
    fac, finv = COMinit(N-1, MOD)
    m_mod = [1]
    for _ in range(N):
        m_mod.append(m_mod[-1] * (M - 1) % MOD)

    ans = 0
    for k in range(K+1):
        cmb = Combination(N-1, k)
        ans += (M%MOD) * (m_mod[N-k-1]%MOD) * cmb
        ans %= MOD

    print(ans)

if __name__ == "__main__":
    resolve()

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1e9 + 7
#define INF 1 << 28
#define INFL 1 << 61
#define EPS (1e-10)

using namespace std;

typedef long long ll;

class UnionFind {
  vector<int> parent;
  vector<int> rank;
  vector<int> size;

public:
  UnionFind(int n) {
    this->parent = vector<int>(n);
    this->size = vector<int>(n);
    this->rank = vector<int>(n);

    for (int i = 0; i < n; i++) {
      this->parent[i] = i;
      this->rank[i] = 0;
      this->size[i] = 1;
    }
  }

  int findRoot(int x) {
    if (this->parent[x] == x) {
      return x;
    }

    this->parent[x] = this->findRoot(this->parent[x]);
    return this->parent[x];
  }

  bool sameRoot(int x, int y) { return this->findRoot(x) == this->findRoot(y); }

  void unite(int x, int y) {
    x = this->findRoot(x);
    y = this->findRoot(y);
    if (x == y) {
      return;
    }

    if (rank[x] < rank[y]) {
      this->parent[x] = y;
      this->size[y] += this->size[x];
    } else {
      this->parent[y] = x;
      if (rank[x] == rank[y]) {
        rank[x]++;
      }

      this->size[x] += this->size[y];
    }
  }

  ll getSize(int x) { return this->size[findRoot(x)]; }
};

int main() {
  long n, m;
  cin >> n >> m;

  vector<int> a(m), b(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }

  UnionFind uf(n);
  vector<ll> ans(m);
  ans[m - 1] = n * (n - 1) / 2;
  for (int i = m - 2; i >= 0; i--) {
    if (uf.sameRoot(a[i + 1], b[i + 1])) {
      ans[i] = ans[i + 1];
    } else {
      ans[i] = ans[i + 1] - (ll)uf.getSize(a[i + 1]) * uf.getSize(b[i + 1]);
    }

    uf.unite(a[i + 1], b[i + 1]);
  }

  for (ll n : ans) {
    cout << n << endl;
  }
}


Measured memory_bytes: 4096
#include<stdio.h>
int abs(int n)
{
	if (n < 0)
		n *= -1;
	return n;
}
int main()
{
	int n, l;
	scanf("%d %d", &n, &l);
	int ans = 0, min = 2000000;
	int i;
	for (i = 0; i < n; i++)
	{
		ans += l + i;
		if (abs(min) > abs(l + i))
			min = l + i;
	}
	printf("%d\n", ans - min);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a),i##formax=(b);i<i##formax;i++)
#define FORR(i,a,b) for(int i=(a),i##formax=(b);i>=i##formax;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pcnt __builtin_popcount
#define sz(x) (int)(x).size()
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)
#define show(x) cout<<#x<<" = "<<x<<endl;
#define all(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))
#define bitComb(a,n,k) for(int a##x,a##y,a=(1<<k)-1;a<(1<<n);a##x=a&-a,a##y=a+a##x,a=(((a&~a##y)/a##x)>>1)|a##y)
#define uniq(v) sort(all(v));v.erase(unique(all(v)), v.end())
#define bit(n) (1LL<<(n))
#define randInt(l,r) (uniform_int_distribution<ll>(l,r)(rnd))
#define randDouble(l,r) (uniform_real_distribution<double>(l,r)(rnd))
#define dout(d) printf("%.12f\n",d)

typedef long long ll;
typedef __int128_t lll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T>using V=vector<T>;
template<class T>using VV=V<V<T>>;
template<class T,class Y>ostream& operator<<(ostream& o,const pair<T,Y>& p){return o<<"("<<p.fi<<", "<<p.se<<")";}
template<typename A,size_t N,typename T>void Fill(A (&array)[N],const T&v){fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0;return gcd(a,b,x,y);}
ll modInv(ll a,ll m){lll x,y;gcd(a,m,x,y);return (x%m+m)%m;}
ll modPow(lll a,lll n,ll m){if(!a)return a;lll p=1;for(;n>0;n>>=1,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
bool isPrime(ll n){if(n<2||n%2==0)return n==2;lll t=n-1,d=t/(t&-t);for(lll a:{2,325,9375,28178,450775,9780504,1795265022})if(a%n){for(t=d,a=modPow(a,t,n);t!=n-1&&a!=1&&a!=n-1;a=a*a%n,t=t*2%n);if(a!=n-1&&t%2==0)return 0;}return 1;}
const int IINF = 1e9+6;
const ll LINF = 1e18;
const int MOD = 1e9+7;
const double PI = acos(-1);
const double EPS = 1e-10;
static random_device rd;
static mt19937 rnd(rd());

const int N = 1e5;
int a[3];
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  FOR(i, 0, 3) cin >> a[i];
  sort(a, a+3);
  cout << ((a[0] == a[2]) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

int N;
ll A, B;

int main() {
	scanf("%d", &N);
	if(N == 1) {
		printf("Hello World\n");
		return 0;
	}
	else {
		scanf("%lld %lld", &A, &B);
		printf("%lld\n", A + B);
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  int n, q, num, m;
  int A[2001]={1};
    cin>>n;
  for(int i=0; i<n; i++){
    cin>>num;
    for(int j=2000-num; j>=0; j--){
      if(A[j])
        A[j+num] = 1;
    }
  }

    cin>>q;
  for(int i=0; i<q; i++){
    cin>>m;
    if(A[m])
      cout<<"yes"<<endl;
    else
      cout<<"no"<<endl;
  }

  return 0;
}


Measured memory_bytes: 3120
let () =
    let main () =
        let n = int_of_string (read_line ()) in
        let s, t = Scanf.scanf "%s %s" (fun s t -> s, t) in
        let rec loop i acc =
            if i = n then acc else loop (i + 1)
            (Printf.sprintf "%s%c%c" acc s.[i] t.[i])
        in
        loop 0 "" |> print_endline
    in
    main ()

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
import numpy

# スペース区切りの整数の入力
N,M,C = map(int, input().split())
B_list = [int(e) for e in input().split()]
A_list = []
ans=0

for i in range(N):
  A_list.append([int(e) for e in input().split()])
  
for i in range(N):
  calc_result = 0
  for j in range(M):
    calc_result = calc_result + A_list[i][j] * B_list[j]
  
  if calc_result + C > 0:
    ans = ans+1

print(ans)

Measured memory_bytes: 12432
N,M,X = map(int,input().split())
A = list(map(int,input().split()))
min = 0
max = 0
for i in range(M):
  if A[i] < X:
    min += 1
  else:
    max += 1
if min < max:
  print(min)
else:
  print(max)

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

int main(){ 
  int n;
  cin >> n;
  vector<pair<ll, int>> a(n);
  rep(i,n) {
    cin >> a[i].first;
    a[i].second = i;
  }

  sort(a.begin(), a.end(), greater<pair<ll, int>>());

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

  for (int len = n; len >= 1; len--) {
    for (int l = 0; l <= n - len; l++) {
      int r = l + len;
      ll prev = dp[l][r], cost = a[n - len].first;
      int j = a[n - len].second;
      dp[l + 1][r] = max(dp[l + 1][r], prev + cost * abs(l - j));
      dp[l][r - 1] = max(dp[l][r - 1], prev + cost * abs(r - 1 - j));
    }
  }

  ll res = 0;

  for (int i = 0; i <= n; i++) res = max(res, dp[i][i]);
  cout << res << endl;
  return 0;
} 

Measured memory_bytes: 34684
import java.io._
import scala.io.StdIn.{readInt, readLine}

object Main {
  val out:BufferedWriter =
    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512)
  var count = 0
  class Node(var key:Int, var left:Node = null, var right:Node = null) { }

  def getNodeToInsert(node:Node,keyNode:Node):Node =
    if(node.key > keyNode.key) {
      if(node.left == null) node
      else getNodeToInsert(node.left,keyNode)
    } else {
      if(node.right == null) node
      else getNodeToInsert(node.right,keyNode)
    }

  def insert(tree:Node, keyNode:Node) = {
    val target = getNodeToInsert(tree,keyNode)
    if(keyNode.key < target.key) target.left = keyNode
    else target.right = keyNode
  }

  def inOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      inOrder(tree.left)
      out.write(" ")
      out.write(tree.key.toString)
      if(count<50) count += 1
      else { out.flush; count = 0 }
      inOrder(tree.right)
    }

  def preOrder(tree:Node):Unit =
    if(tree == null) return
    else {
      out.write(" ")
      out.write(tree.key.toString)
      if(count<100) count += 1
      else {
        out.flush
        count = 0
      }
      preOrder(tree.left)
      preOrder(tree.right)
    }

  def main(args:Array[String]) = {
    val n = readInt
    val tree = new Node(-1)

    for(i<-0 until n) {
      val s = readLine.split(" ")
      s(0) match {
        case "insert" =>
          if(tree.key == -1) tree.key = s(1).toInt
          else insert(tree, new Node(s(1).toInt))
        case _ => {
          inOrder(tree)
          out.write("\n")
          out.flush()
          preOrder(tree)
          out.write("\n")
          out.flush()
        }
      }
    }
  }
}

Measured memory_bytes: 296432
// Author: πα

#include <bits/stdc++.h>
using namespace std;
#define long int64_t

int main()
{
    string s;
    cin >> s;
    bool f = (s[0] == s[1] or s[1] == s[2] or s[2] == s[3]);
    cout << (f ? "Bad" : "Good");
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _2000
{
    public class Program

    {
        public static void Main(string[] args)
        {
            const int FIELD_SIZE = 21;

            while (true)
            {

                int n = ReadInt();
                if (n == 0) break;

                int[,] field = new int[FIELD_SIZE, FIELD_SIZE];
                for (int i = 0 ; i < n ; i++)
                {
                    int[] line = ReadIntAr();
                    field[line[0], line[1]] = 1;
                }

                int obtainedJewels = 0;
                int x = 10;
                int y = 10;
                int m = ReadInt();
                for (int i = 0 ; i < m ; i++)
                {
                    string[] line = ReadStAr();
                    for (int j = 0 ; j < int.Parse(line[1]) ; j++)
                    {
                        switch (line[0])
                        {
                            case "N": y++; break;
                            case "E": x++; break;
                            case "S": y--; break;
                            case "W": x--; break;
                        }
                        if (field[x, y] == 1)
                        {
                            obtainedJewels++;
                            field[x, y] = 0;
                        }
                    }
                }
                Console.WriteLine(obtainedJewels == n ? "Yes" : "No");

            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }
        static string WriteAr(int[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(double[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }
        static string WriteAr(long[] array, string sep = " ") { return String.Join(sep, array.Select(x => x.ToString()).ToArray()); }

    }

}



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

int dp[101][10001];
int v[100], w[100];
int main() {
	int N, W; scanf("%d%d", &N, &W);
	rep(i, N)scanf("%d%d", &v[i], &w[i]);
	rep(i, N)rep(j, W + 1) {
		if (w[i] > j)dp[i + 1][j] = dp[i][j];
		else dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
	}
	printf("%d\n", dp[N][W]);
}

Measured memory_bytes: 7120
import math
import fractions

A, B = map(int,input().split())
gcd = fractions.gcd(A,B)
N = int(math.ceil(math.sqrt(gcd)))
cd = []

for i in range(1,N):
    if A%i==0 and B%i==0:
        cd.append(i)
        cd.append(gcd//i)
if N==1:
    cd.append(N)

ans=0
cd.sort()


for i in range(len(cd)):
    tr=1
    for j in range(1,i):
        if cd[i]%cd[j]==0:
            tr=0
            break
    if tr==1:
        ans+=1

print(ans)

Measured memory_bytes: 66264
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;


void main()
{
  auto s = readln.chomp;
  bool[char] ch;
  foreach (e; s) {
    ch[e] = false;
  }

  bool f;
  foreach (c; 'a'..'z'+1) {
    auto t = c.to!char;
    if (ch.get(t, true)) {
      writeln(t);
      f = true;
      break;
    }
  }

  if (!f) {
    writeln("None");
  }
}


Measured memory_bytes: 2556
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);
		 String s = scn.next();
		   if(s.charAt(0)=='A'){
			   if(s.charAt(1)=='B' || s.charAt(2)=='B'){
				   System.out.println("Yes");
			   }else{
				   System.out.println("No");
			   }
		   }else{
			   if(s.charAt(1)=='A' || s.charAt(2)=='A'){
				   System.out.println("Yes");
			   }else{
				   System.out.println("No");
			   }
		   }
		 

	}

}

Measured memory_bytes: 25172
'use strict'

const main = (input) => {
    const anw = input.split('\n')[0].split('').map(i => {
        if(i == '1') return '9'
        return '1' 
    }).join('')
    console.log(anw)
}

main(require('fs').readFileSync('/dev/stdin', 'utf-8'))

Measured memory_bytes: 7372
#include<iostream>
#include <stdio.h>
using namespace std;
int n;
int main(){
	cin>>n;
	for(int i=1;i<n+1;i++){
		if(i%3==0||i%10==3||i%100<40&&i%100>=30||i%1000>=300&&i%1000<400||i>=3000&&i<4000){
		cout<<" "<<i;}}
	cout<<endl;
	return 0;}


Measured memory_bytes: 1164
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

D, G = map(int, input().split())
P = []
C = []
for i in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

ans = INF
for i in range(1 << D):
    score = 0
    count = 0
    for j in range(D):
        if ((i >> j) & 1):
            score += (j+1)*P[j]*100+C[j]
            count += P[j]
        else:
            basic = j

    remain = G-score
    if remain <= 0:
        ans = min(ans, count)
        continue

#    print(remain, count, ans)

    # まだ残ってる場合、もっとも高いやつから
    if (remain - ( (P[basic]-1)*(basic+1)*100)) > 0:
        # 全部使っても駄目
        continue

    p = P[basic]
    while p > 1 and remain > 0:
        remain -= (basic+1)*100
        p -= 1
        count += 1

    if remain <= 0:
        ans = min(ans, count)

print(ans)

Measured memory_bytes: 3064
#include<stdio.h>

int main(){

	int a[6],b,c;
	
	scanf("%d %d %d %d %d",&a[0],&a[1],&a[2],&a[3],&a[4]);
	for(b=0;b<=3;b++){
		for(c=b;c<=4;c++){
			if(a[b]<=a[c])a[5]=a[b],a[b]=a[c],a[c]=a[5];
		}
	}
	printf("%d %d %d %d %d\n",a[0],a[1],a[2],a[3],a[4]);
        return 0;
}

Measured memory_bytes: 0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner();
        PrintWriter pw = new PrintWriter(System.out);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        if (a <= 5) {
            System.out.println(0);
        } else if (a >= 6
                && a <= 12) {
            System.out.println(b / 2);
        } else {
            System.out.println(b);
        }
    }

    static class Scanner {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        int spaces = 0;

        public String nextLine() throws IOException {
            if (spaces-- > 0) {
                return "";
            } else if (st.hasMoreTokens()) {
                return new StringBuilder(st.nextToken("\n")).toString();
            }
            return br.readLine();
        }

        public String next() throws IOException {
            spaces = 0;
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public boolean hasNext() throws IOException {
            while (!st.hasMoreTokens()) {
                String line = br.readLine();
                if (line == null) {
                    return false;
                }
                if (line.equals("")) {
                    spaces = Math.max(spaces, 0) + 1;
                }
                st = new StringTokenizer(line);
            }
            return true;
        }
    }
}


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

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 205;

int n, k, P, fac[N], inv[N];

int qpow(int a, int b) {
	int s = 1;
	for (; b; b >>= 1) {
		if (b & 1) {
			s = 1ll * s * a % P;
		}
		a = 1ll * a * a % P;
	}
	return s;
}

void init(int n) {
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) {
		fac[i] = 1ll * fac[i - 1] * i % P;
	}
	inv[n] = qpow(fac[n], P - 2);
	for (int i = n; i; --i) {
		inv[i - 1] = 1ll * inv[i] * i % P;
	}
}

int f[N][N];

int calc(int k, int l, int m) {
	for (int i = 1; i <= k; ++i) {
		int sum = 0;
		for (int j = l; j >= 0; --j) {
			sum = i > 1 ? (sum + f[i - 1][j]) % P : 1;
			if (i - 1 + j <= m && k - i + l - j <= m) {
				f[i][j] = sum;
			} else {
				f[i][j] = 0;
			}
		}
		f[1][0] = 0;
	}
	return f[k][0];
}

int solve(int n, int m) {
	if (n == 1) {
		return 1;
	}
	int ans = 0;
	for (int i = 2; i < n; ++i) {
		ans = (ans + calc(i, n - i, m)) % P;
	}
	return 1ll * ans * fac[n - 1] % P;
}

int main() {
	read(n), read(k), read(P);
	init(n);
	int ans = 0;
	for (int i = 0; i <= k; ++i) {
		ans = (ans + 1ll * fac[n] * inv[n - i] % P * solve(n - i, k - i)) % P;
	}
	// debug("%d\n", calc(4, 3, 3));
	print(ans);
}


Measured memory_bytes: 3812
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <climits>
#include <memory>
#include <sstream>
#include <iomanip>

using namespace std;

int main() {
	int n;
	cin >> n;
	bool f = false;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		if (a % 2 == 1) {
			f = true;
		}
	}

	if (f)cout << "first" << endl;
	else cout << "second" << endl;

	return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    s = input()
    ans = 0
    w = 0
    for i in range(len(s)):
        if s[i] == "W":
            ans += i-w
            w += 1
    print(ans)
    return

#B
def B():
    n = I()
    a = LI()
    f = defaultdict(lambda : 0)
    a.sort(key = lambda x:-x)
    ans = 0
    m = 32
    k = [1<<i for i in range(m)]
    for i in a:
        for j in k:
            i_ = j-i
            if i_ <= 0:continue
            if f[i_]:
                f[i_] -= 1
                ans += 1
                break
        else:
            f[i] += 1
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == "__main__":
    B()


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


public class Contest
{
	public static void Main()
	{

/*
		int n = a[0];
		int[][] e = new int[n][];
		for(int i=0; i<n; i++) MyRead.Array(out e[i]);

		int[] a;
		MyRead.Array(out a);

        long a,b,c,d,e,f;
        MyRead.Multi(out a, out b, out c, out d, out e, out f);
*/

        int l,r;
		MyRead.Multi(out l, out r);

		int ans = 0;
		if((int)l/2019 == (int)r/2019){
			l %= 2019;
			r %= 2019;
			ans = 2018;
			for(int k=l; k<r; k++){
				for(int h=k+1; h<=r; h++){
					int t = (k*h)%2019;
					if(t<ans) ans = t;
				}
			}


		} 



		Console.WriteLine(ans);
	}

}

public static class MyRead
{
	private static bool eq<T, U>() => typeof(T).Equals(typeof(U));
	private static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
	private static T cv<T>(string s) => eq<T, int>()    ? ct<T, int>(int.Parse(s))
	                                  : eq<T, long>()   ? ct<T, long>(long.Parse(s))
	                                  : eq<T, double>() ? ct<T, double>(double.Parse(s))
	                                  : eq<T, char>()   ? ct<T, char>(s[0])
	                                                    : ct<T, string>(s);
	public static string[] Array<T>(out T[] a) {		
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 												
		a = System.Array.ConvertAll(ar, new Converter<string,T>(cv<T>));
		return ar;
	}										
	public static string[] Multi<T>(out T a) {
		var ar = Console.ReadLine().Split(new char[] {' '}, StringSplitOptions.RemoveEmptyEntries); 
		a = cv<T>(ar[0]);
		return ar;
	}
	public static string[] Multi<T, U>(out T a, out U b) {
		var ar = Multi<T>(out a); 
        b = cv<U>(ar[1]);
		return ar;
	}
	public static string[] Multi<T, U, V>(out T a, out U b, out V c) {
		var ar = Multi<T, U>(out a, out b); 
        c = cv<V>(ar[2]);
		return ar;
	}
	public static string[] Multi<T, U, V, W>(out T a, out U b, out V c, out W d) {
		var ar = Multi<T, U, V>(out a, out b, out c); 
        d = cv<W>(ar[3]);
		return ar;
	}
	public static string[] Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e) {
		var ar = Multi<T, U, V, W>(out a, out b, out c, out d); 
        e = cv<X>(ar[4]);
		return ar;
	}
	public static string[] Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f) {
		var ar = Multi<T, U, V, W, X>(out a, out b, out c, out d, out e); 
        f = cv<Y>(ar[5]);
		return ar;
	}
}




Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define ull unsigned long long
using namespace std;
int gcd(int x,int y)
{
    while(x!=y)
    {
        if(x>y) x=x-y;
        else
            y=y-x;
    }
    return x;
}
int main()
{
    ull a,b,c,d,ans=0;
    cin>>a>>b>>c>>d;
    ull ansc,ansd,anscd;
    ansc=b/c-(a-1)/c;
    ansd=b/d-(a-1)/d;
    anscd=b/(c*d/gcd(c,d))-(a-1)/(c*d/gcd(c,d));
    cout<<b-a+1-ansc-ansd+anscd;
    return 0;
}



Measured memory_bytes: 256
n, m = map(int, input().split())
ss = [set(list(map(int, input().split()))[1:]) for _ in range(m)]
ps = list(map(int, input().split()))

ans = 0
for bits in range(2 ** n):
    ons = set()
    for shift in range(n):
        if (bits >> shift) & 1 > 0:
            ons.add(shift + 1)

    ok = True
    for i in range(m):
        c = [s in ons for s in ss[i]].count(True)
        if c % 2 != ps[i]:
            ok = False
            break
    if ok:
        ans += 1

print(ans)


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

int main(){
  int n,k; cin>>n >>k;
  long long ans=INT_MAX;
  vector<long long> h(n);
  for(int i=0;i<n;i++)cin>>h[i];
  sort(h.begin(),h.end());
  for(int i=0;i<n-k+1;i++){
    long long dif=h[i+k-1]-h[i];
    ans=min(ans,dif);
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void)
{
	int a,b,c;
	scanf("%d %d",&a,&b);
	if(a<b){
		c=b-a;
	}
	else if(a>b){
		c=a-b;
	}
	else{
		c=0;
	}
	printf("%d\n",c);	
	
	return 0;
}


Measured memory_bytes: 2112
#include <bits/stdc++.h>
using namespace std;
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
 
 int mod=1000000007;
 long long fast_exp(long long a,long long n,long long mod1)
    {
     
      if (n==0)return 1;
      else if (n==1)return a;
      if (n%2==0)return fast_exp((a*a)%mod1,n/2,mod1);
      else return (a*fast_exp((a*a)%mod1,n/2,mod1))%mod1;
    }
void solve()
{
    long long n,k;
    cin >> n >> k;
    long long dp[100001];
    for (int c=k;c>=1;c--)
        {
        long long  total=fast_exp(k/c,n,mod);
            for (int c1=2*c;c1<=k;c1+=c)
                total=(total-dp[c1]+mod)%mod;
            dp[c]=total;
        }
        long long total=0; 
        for (int c=1;c<=k;c++)
            (total+=1LL*c*dp[c])%=mod;
        cout << total << endl;

        

}
    


    
 

int main()
{
    fast_io;
    int t;
   // cin >> t;
t=1;
    for (int tt=1;tt<=t;tt++)
    {
       // cout << "Case #" << tt << ": " ;    
        solve();
        
 
    }
 
    
    return 0;
}
 


Measured memory_bytes: 4400
n = int(raw_input())
w = []

for i in range(n):
    tmp = raw_input()
    w.append(tmp)
    

flag = 0
for i in range(n):
    kensa = w[i]
    for j in range(n):
        if(j==i):
            continue
        if(kensa == w[j]):
            flag = 1

for i in range(n):
    if(i==0):
        continue
    if(w[i-1][-1] != w[i][0]):
        flag = 1
            

if(flag==1):
    print "No"
else:
    print "Yes"


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

char result;

void battle(char x, string a, string b, string c){
  switch(x){
    case 'a':
      if(a.size()==0){
        result='A';
      }else{
        battle(a[0],a.substr(1),b,c);
      }
      break;
    case 'b':
      if(b.size()==0){
        result='B';
      }else{
        battle(b[0],a,b.substr(1),c);
      }
      break;
    case 'c':
      if(c.size()==0){
        result='C';
      }else{
        battle(c[0],a,b,c.substr(1));
      }
      break;
  }
}

int main(){
  string sa,sb,sc; cin >>sa>>sb>>sc;
  battle('a',sa,sb,sc);
  cout << result << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll N; cin >> N;
  vector<ll> A(N);
  for(ll i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  vector<ll> One(0), Two(0);
  map<ll, ll> one, two;
  for(ll i = 0; i < N; i++) {
    ll X = A.at(i);
    ll o = i - X, t = i + X;
    if(one.count(o)) one.at(o)++;
    else {
      one[o] = 1; One.push_back(o);
    }
    if(two.count(t)) two.at(t)++;
    else {
      two[t] = 1; Two.push_back(t);
    }
  }
  ll cnt = 0;
  for(ll i = 0; i < (ll)One.size(); i++) {
    ll x = One.at(i);
    if(!two.count(x)) continue;
    cnt += one.at(x) * two.at(x);
  }
  cout << cnt << endl;
}

Measured memory_bytes: 30808
(* O(n) *)
let f () = Scanf.scanf " %d" @@ (+) 0
let n = f ()
let a_ss = Array.init 2 @@ fun _ -> Array.init n @@ fun _ -> f ()
let cs = [|ref 0; ref 0|]
let accs = Array.init 2 @@ fun _ -> Array.make (n + 1) 0
let ans = ref 0
let _ =
  for i = 0 to n - 1 do
    for j = 0 to 1 do
      cs.(j) := !(cs.(j)) + a_ss.(j).(i);
      accs.(j).(i + 1) <- !(cs.(j));
    done
  done;
  for i = 0 to n - 1 do
    ans := max !ans @@ accs.(0).(i + 1) - accs.(0).(0) + accs.(1).(n) - accs.(1).(i)
  done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 512
#include <stdio.h>

int main(void)
{

  int A,B,C;

  scanf("%d %d %d", &A, &B, &C);

  if (A == B) {
    printf("%d\n", C); }

  else if (A == C) {
    printf("%d\n", B); }

  else {
    printf("%d\n", A); }

  return (0);
}


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

#define ipr pair<int, int>
#define pb push_back
#define ff first
#define ss second
#define fr(i, j, k) for (int i = j; i < k; i++)
#define rf(i, j, k) for (int i = j; i >= k; i--)
#define ll unsigned long long
#define int long long
#define ld long double
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mp make_pair
#define cnt_ones(x) __builtin_popcountll(x)

#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

const int Maxn = (int)1e6;
const ld pi = acos(-1);
const int mod = (int)1e9 + 7;
const int inf = (int)1e18;

template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
    fr(i, 0, (int)A.size()) out << A[i] << " ";
    return out;
}


int32_t main() {IOS 
    int n;  cin>>n;
    vector<int> A(n);   fr(i,0,n)   cin>>A[i];
    sort(rall(A));
    // reverse(rall(A));
    // cout << A << endl;
    int ans = 0;
    int i=0;
    fr(j,1,n){
        ans += A[j/2];
        //cout << A[j/2] << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4772
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq 
from itertools import *
import math
import random
import re
import string
import sys

S = input()
T = ''
for ch in S:
    if ch == '1':
        T += '9'
    else:
        T += '1'
print(T)

        



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

int main() {
    char c;
    cin >> c;
    
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    }else {
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,sum[100005],ans,cnt;
char s[11];
map<string,int> m;
int cmp(char x,char y){return x<y;}
int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%s",s);
		sort(s,s+10,cmp);
		if(m.count(s))ans+=sum[m[s]];
		else m[s]=++cnt;
		sum[m[s]]++;
	}
	printf("%lld",ans);
}


Measured memory_bytes: 11916
import math

x, k ,d = map(int,input().split())

if abs(x) - abs(k*d) > 0: #届かない場合
    if x > 0:
        print(abs(x - k*d))
    else:
        print(abs(x + k*d))
else: #往復ステップを始める場合
    r = math.floor(abs(x)/d)
    if x > 0:
        p = x - r*d
        if (k - r) % 2 == 0:
            print(abs(p))
        else:
            print(abs(p-d))
    elif x < 0:
        p = x + r*d
        if (k - r) % 2 == 0:
            print(abs(p))
        else:
            print(abs(p+d))
    else:
        if k % 2 == 0:
            print(0)
        else:
            print(abs(d))

Measured memory_bytes: 9224
while gets
  y,m,d=$_.split.map(&:to_i)
  num=(y.to_s+format("%02d",m)+format("%02d",d)).to_i
  if num < 18680908 then puts "pre-meiji"
  else
    case
    when num < 19120730 then era = "meiji "+(y-1867).to_s
    when num < 19261225 then era = "taisho "+(y-1911).to_s
    when num < 19890108 then era = "showa "+(y-1925).to_s
    else era = "heisei "+(y-1988).to_s
    end
    puts "#{era} #{m} #{d}"
  end
end

Measured memory_bytes: 8608
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<cstring>
using namespace std;
#define maxn 1000010
#define llg long long 
#define yyj(a) freopen(a".in","r",stdin),freopen(a".out","w",stdout);
llg n,m,len1,len2;
char s[maxn];
inline int getint()
{
       int w=0,q=0; char c=getchar();
       while((c<'0' || c>'9') && c!='-') c=getchar(); if(c=='-') q=1,c=getchar(); 
       while (c>='0' && c<='9') w=w*10+c-'0', c=getchar(); return q ? -w : w;
}

struct node{llg v;};
struct SEG
{
	
	node val[maxn];
	llg totpo;
	void init() {memset(val,0,sizeof(val)); totpo=0;}

	void update(llg o,llg lc,llg rc)
	{
		if (val[lc].v==0 || val[rc].v==0) val[o].v=val[lc].v+val[rc].v;
		else if (val[lc].v!=val[rc].v) val[o].v=0;
		else val[o].v=val[lc].v%2+1;
	}

	node he(node x,node y)
	{
		if (x.v==0 || y.v==0) x.v=x.v+y.v;
		else if (x.v!=y.v) x.v=0;
		else x.v=x.v%2+1;
		return x;
	}

	void build(llg o,llg l,llg r)
	{
		if (l==r)
		{
			totpo++;
			if (s[totpo]=='A') val[o].v=1;else val[o].v=2;
			return ;
		}
		llg lc=o<<1,rc=o<<1|1,mid=(l+r)>>1;
		build(lc,l,mid); build(rc,mid+1,r);
		update(o,lc,rc);
	}

	node ask(llg o,llg l,llg r,llg L,llg R)
	{
		if (l>=L && r<=R)
		{
			return val[o];
		}
		node ans;
		ans.v=0;
		
		llg lc=o<<1,rc=o<<1|1,mid=(l+r)>>1;
		if (L<=mid) ans=he(ans,ask(lc,l,mid,L,R));
		if (R>mid) ans=he(ans,ask(rc,mid+1,r,L,R));
		return ans;
	}
}d1,d2;

int main()
{
	//yyj("C");
	scanf("%s",s+1);
	d1.init(),d2.init();
	len1=strlen(s+1);
	d1.build(1,1,strlen(s+1));
	scanf("%s",s+1);
	len2=strlen(s+1);
	d2.build(1,1,strlen(s+1));
	llg q;
	cin>>q;
	for (llg i=1;i<=q;i++)
	{
		llg l=getint(),r=getint();
		node v1=d1.ask(1,1,len1,l,r);
		l=getint(),r=getint();
		node v2=d2.ask(1,1,len2,l,r);
		if (v1.v==v2.v) puts("YES"); else puts("NO");
	}
	return 0;
}


Measured memory_bytes: 16896
#include<stdio.h>
#include<string.h>
int main()
{ char code[4];
 scanf("%s",&code);
 if(code[0]==code[1]||code[2]==code[1]||code[2]==code[3]) {
     printf("Bad");
   }
 else {
   printf("Good");       
   }
    
    
}


Measured memory_bytes: 1724
#include <iostream>
using namespace std;
int main(){
	int a;
	int c1=0, c2=0, c3=0, c4=0;
	for (int i = 0; i < 6; i++) {
		cin >> a;
		if (a == 1)c1++;
		if (a == 2)c2++;
		if (a == 3)c3++;
		if (a == 4)c4++;
	}
	if (c1==3||c2==3||c3==3||c4==3) {
		cout << "NO" << endl;
	}
	else {
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
using System;

namespace A___Add_Sub_Mul
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var a=int.Parse(input[0]);
            var b=int.Parse(input[1]);
            var max = a + b;
            max = Math.Max(max, a - b);
            max = Math.Max(max, a * b);
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < (int)(x); i++)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a,b; cin >> a >> b;
    cout << a*b/2 << endl;
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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


bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

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

    // 
    int N; 
    cin >> N;

    vector<ll> ans;

    for(int i = 3; i <= 55555; i = i + 2){

        if(IsPrime(i)){
            if(i % 5 == 1){
                ans.push_back(i);
            }
        }

        if(ans.size() == N) break;
    }

    for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << endl;
    }

    
    return 0;
}



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

#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define gcd(x,y) __gcd((x),(y))

#ifndef ONLINE_JUDGE
  #define db(x) cerr << #x << " == " << x << endl
  #define dbs(x) cerr << x << endl
  #define _ << ", " <<
#else
  #define db(x) ((void)0)
  #define dbs(x) ((void)0)
#endif

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;

const ld EPS = 1e-9, PI = acos(-1.);
const int INF = 0x3f3f3f3f, MOD = 1e9+7;
const int N = 1e5+5;

ll x, y;

int main() {
  scanf("%lld%lld", &x, &y);
  if (x%y == 0) return printf("-1\n"), 0;

  ll k = 2;
  while ((k*x)%y == 0) k++;
  printf("%lld\n", k*x);

  return 0;
}


Measured memory_bytes: 256
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main() {
	int a = 0, b = 0, c = 0, d = 0, cpt1 = 0, cpt2 = 0;
	scanf("%d", &a);
	scanf("%d", &b);
	scanf("%d", &c);
	scanf("%d", &d);
	if(a > b)
	{
		cpt1 = b;
	}
	else
	{
		cpt1 = a;
	}
	if(c > d)
	{
		cpt2 = d;
	}
	else
	{
		cpt2 = c;
	}
	printf("%d\n", cpt1+cpt2);
    return 0;
}

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

int N, Q;
string S;
int L[100010];
int R[100010];
int X[100010];

int main(){
  cin >> N >> Q >> S;
  rep(i, Q){
    cin >> L[i] >> R[i];
    L[i]--;
    R[i]--;
  }

  int cnt = 0;
  repi(i, 0, S.size()-1){
    string s = S.substr(i, i+2);
    if (s[0]=='A' and s[1]=='C') cnt ++;
    X[i+1] = cnt;
  }

  // rep(j, N) cout << X[j] << endl;
  // return 0;
  rep(i, Q){
    cout << X[R[i]] - X[L[i]] << endl;
  }
}


Measured memory_bytes: 4856
#include<bits/stdc++.h>
using namespace std;
int a[1007];

int main(void)
{
	int n, i, j, tmp, maxi = -1, dig; bool flag;
	scanf("%d", &n);
	for (i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (i = 1; i < n; i++) {
		for (j = i+1; j <= n; j++) {
			tmp = a[i] * a[j];
			flag = 1;
			dig = tmp % 10;
			while (1) {
				tmp /= 10;
				if (!tmp) break;
				if (tmp%10!=dig-1) flag = 0;
				dig = tmp % 10;
			}
			if (flag) {
				maxi = max(maxi, a[i]*a[j]);
			}
		}
	}
	
	printf("%d\n", maxi);
	
	
	return 0;
}

Measured memory_bytes: 3220
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader buff = null;
		buff = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(buff.readLine());
		String[] box = buff.readLine().split(" ");
		int[] num_box = new int[box.length];
		int count = 0;
		for(int i = 0; i < n; ++i){
			num_box[i] = Integer.parseInt(box[i]);
		}
		while(true){
			boolean flag = true;
			for(int i = 0; i < n; ++i){
				if(num_box[i] % 2 == 0){
					num_box[i] /= 2;
				} else {
					flag = false;
					break;
				}
			}

			if(flag == false){
				break;
			} else {
				count++;
			}
		}

		System.out.println(count);
	}

	static long f() {
		long ans = 0;


		return ans;
	}
}

Measured memory_bytes: 23252