akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vll = vector<long long>;
using vpi = vector<pair<int, int>>;
using pii = pair<int, int>;
using pll = pair<long long, long long>;

#define F first
#define S second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define F0R(i, a) for (int i = 0; i < (a); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)

const char nl = '\n';
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

double state[301][301][301];

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

    int n; cin >> n;
    vi a(n);
    F0R (i, n) cin >> a[i];
    array<int, 3> count{0};
    F0R (i, n) if (a[i] < 3) count[a[i]]++;
    int c3 = n - count[0] - count[1] - count[2];
    F0R (i, n + 1) F0R (j, n + 1) F0R (k, n + 1) state[i][j][k] = -1;

    state[n][0][0] = 0;
    queue<array<int, 3>> q;
    q.push({n, 0, 0});
    const int NXT[3][4] = {{-1, 1, 0, 0}, {0, -1, 1, 0}, {0, 0, -1, 1}};
    while (!q.empty()) {
        auto cur = q.front(); q.pop();
        if (cur == count) break;
        F0R (i, 3) {
            auto next = cur;
            F0R (j, 3) next[j] += NXT[i][j];
            bool good = true;
            F0R (j, 3) good &= next[j] >= 0;
            if (!good) continue;
            int n3 = n - next[0] - next[1] - next[2];
            if (n3 > c3 || 
                next[2] > (c3 + count[2]) || next[1] > (c3 + count[2] + count[1])) continue;
            if (state[next[0]][next[1]][next[2]] != -1) continue;

            double val = 1;
            F0R (j, 3) {
                if ((j < 2 && next[j + 1] == 0) || (j == 2 && n3 == 0)) continue;
                auto tmp = next;
                F0R (k, 3) tmp[k] -= NXT[j][k];
                if (tmp[0] < 0 || tmp[1] < 0 || tmp[2] < 0) continue;
                double look = state[tmp[0]][tmp[1]][tmp[2]];
                if (look != -1) {
                    double coeff = j == 2 ? n3 : next[j + 1];
                    val += look * coeff / n;
                }
            }
            state[next[0]][next[1]][next[2]] = val * ((double)n / (n - next[0]));
            q.push(next);
        }
    }
    cout << fixed << setprecision(9) << state[count[0]][count[1]][count[2]] << endl;

    return 0;
}


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

int main() {
  int k, s;
  int count = 0;
  cin >> k >> s;
  for (int x = 0; x <= k; x++) {
    for (int y = 0; y <= k; y++) {
      int z = s - x - y;
      if (0 <= z && z <= k) {
        count++;
      }
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
# /usr/bin/python
# -*- coding: utf-8 -*-
import heapq
import sys


def main():
  N,M = map(int, input().split())
  An = list(map(int, sys.stdin.readline().rstrip().split()))
  BCn = [[0,0] for _ in range(M)]
  for i in range(M):
    BCn[i] = list(map(int, input().split()))
  BCn = sorted(BCn,key=lambda x:-x[1])

  heap_q = []
  for a in An:
    heapq.heappush(heap_q,a)

  for b,c in BCn:
    a = heapq.heappop(heap_q)
    if a >= c:
      heapq.heappush(heap_q,a)
      return sum(heap_q)
    else:
      heapq.heappush(heap_q,c)
      for _ in range(b-1):
        a = heapq.heappop(heap_q)
        if a < c:
          heapq.heappush(heap_q,c)
        else:
          heapq.heappush(heap_q,a)
          break 
  return sum(heap_q)

if __name__ == "__main__":
  print(main())

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

// vector<vector<uint64_t> > v(n+1, vector<uint64_t>(n+1, 0))
// v[n][k]に組み合わせ数が入る。
void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// フェルマーの小定理
// mod. m での a の逆元 a^{-1} を計算する
int64_t modinv(int64_t a, int64_t m) {
    int64_t b = m, u = 1, v = 0;
    while (b) {
        int64_t t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;
signed main() {
  int64_t k,n;
  cin >> k >>  n;

  int64_t a[n] = {0};
  
  int64_t maxDist = -1;
  for(int64_t i=0;i<n;i++){
    cin >> a[i];
    if(i==0) continue;
    else if(i==1) maxDist = a[i]-a[i-1];
    else if(maxDist<a[i]-a[i-1]) maxDist = a[i]-a[i-1];
  }
  if(a[0]+k-a[n-1]>maxDist) maxDist = a[0]+k-a[n-1];
  
  cout << k-maxDist << endl;
  return 0;
}



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


long gcd(int A,int B,int C){
    int a = A; int b = B;
    int tmp;
    long r;

    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
 
    /* ユークリッドの互除法 */
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
        //cout << r << endl;
    }

    a = b;
    b = C;
    
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
 
    /* ユークリッドの互除法 */
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

int main(){

    int K;
    cin >> K;

    long count = 0;

    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                count += gcd(i,j,k);
                //cout << count << endl;
            }
        }
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;//998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template<class _T> static void getint(_T& a) {
	if (sizeof(_T) > sizeof(int)) {
		scanf("%lld", &a);
	}
	else {
		scanf("%d", &a);
	}
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	std::string orgs;
	get(orgs);

	LLONG ans = strtoll(orgs.c_str(), 0, 10);
	int len = orgs.length();
	for (int bit = 1; bit < (1 << (len - 1)); bit++) {
		int bfr = -1;
		for (int i = 0; i < len; i++) {
			if (bit & (0x1 << i)) {
				char num[12] = { 0 };
				
				for (int pos = 0; pos < (i - bfr); pos++) {
					num[pos] = orgs[len - (i + 1) + pos];
				}

				ans += strtoll(num, 0, 10);
				bfr = i;
			}
		}
		if (bfr < 0) bfr = 0;
		char num[12] = { 0 };

		for (int pos = 0; pos < (len - (bfr + 1)); pos++) {
			num[pos] = orgs[pos];
		}

		ans += strtoll(num, 0, 10);

	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 3720
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

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

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)
	b := make([]int, n)
	for i := range b {
		b[i] = -1
	}

	ans := 0
	for i := range a {
		a[i] = nextInt()
	}
	debugf("a: %v\n", a)
	for i := range a {
		j := sort.Search(ans, func(k int) bool { return b[k] < a[i] })
		if b[j] == -1 {
			b[j] = a[i]
			ans++
		} else if b[j] < a[i] {
			b[j] = a[i]
		}
		debugf("b: %v\n", b)
		/*
		for j := range b {
			if b[j] == -1 {
				b[j] = a[i]
				ans++
				break
			} else if b[j] < a[i] {
				b[j] = a[i]
				break
			}
		}
		*/
	}

	_, _ = fmt.Fprintf(writer, "%d", ans)
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 5504
/* -------------------------------- Template -------------------------------- */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = std::min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = std::max(a, b); }

// template<typename T> constexpr T inf = [](){ assert(false); };
// template<> constexpr int inf<int> = 1e9;
// template<> constexpr ll inf<ll> = 1e18;
// template<> constexpr ld inf<ld> = 1e30;

struct yes_no : std::numpunct<char> {
  string_type do_truename()  const { return "Yes"; }
  string_type do_falsename() const { return "No"; }
};

void solve();

int main() {
  std::locale loc(std::locale(), new yes_no);
  std::cout << std::boolalpha << std::setprecision(12) << std::fixed;
  std::cout.imbue(loc);
  solve();
  return 0;
}

using namespace std;

/* -------------------------------- Library -------------------------------- */

/* ---------------------------------- Main ---------------------------------- */

void solve() {
  string s;
  cin >> s;
  cout << (s.size() % 2 != (s.front() == s.back()) ? "First" : "Second") << endl;
  return;
}


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

using namespace std;

template<typename T>
bool chmax(T &a,const T &b);
template<typename T>
bool chmin(T &a,const T &b);
long long modpow(long long n,long long p,long long mod);

long long inf=1000000007;

int main(){
	long long m,n;
	cin>>m>>n;
	cout<<modpow(m,n,inf)<<endl;

	return 0;
}

long long modpow(long long n,long long p,long long mod){
	if(p==0) return 1;
	if(p%2==0){
		long long a=modpow(n,p/2,mod);
		return a*a%mod;
	}
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}

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

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



Measured memory_bytes: 3100
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

H, A = get_ints

puts (H / A) + ((H % A != 0) ? 1 : 0)


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

using namespace std;


int main(){
    int len_array;
    scanf("%d",&len_array);
    vector<tuple<int, int, char, long, string> > tuple_array(len_array);
    int value, weight; 
    char type_;
    long d;
    char cc[20]; 
    
    for(int i = 0;i < len_array;i++){
        scanf("%d %d %c %ld %s",&value, &weight, &type_, &d, cc),
        get<0>(tuple_array[i]) = value;
        get<1>(tuple_array[i]) = weight;
        get<2>(tuple_array[i]) = type_;
        get<3>(tuple_array[i]) = d;
        get<4>(tuple_array[i]) = cc;
    }
    sort(tuple_array.begin(),tuple_array.end());

     for(int i = 0;i < len_array;i++){
        string temp  = get<4>(tuple_array[i]);
        printf("%d %d %c %ld %s\n", get<0>(tuple_array[i]),
                                  get<1>(tuple_array[i]),
                                  get<2>(tuple_array[i]),
                                  get<3>(tuple_array[i]),
                                  temp.c_str());
    }

    return 0;   
}


Measured memory_bytes: 11128
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

bool isOk(string &str) {
	int num = str[0];
	for (int i = 1; i < (int)str.size(); i++) {
		if (num != str[i]) {
			return false;
		}
	}

	return true;
}

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

	int n;
	cin >> n;

	for (int i = n; i <= 999; i++) {
		string str = to_string(i);

		if (isOk(str)) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=1000000;
  int n=s.size();
  for(int i=0;i<n-1;i++){
    if(s[i]!=s[i+1]){
      int t=max(i+1,n-(i+1));
      ans=min(ans,t);
    }
  }
  if(ans==1000000)cout<<s.size()<<endl;
  else cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, m;
    cin >> n >> m;
    vp ba(m);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        ba[i] = P(b, a);
    }
    sort(ba.begin(), ba.end());

    int now = 0;
    int ans = 0;
    rep(i, m) {
        if (i == 0) {
            now = ba[i].fi - 1;
            ans++;
        } else {
            if (ba[i].se <= now && now < ba[i].fi) continue;
            else {
                now = ba[i].fi - 1;
                ans++;
            }
        }
    }
    cout << ans << endl;
}

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

int main() {

    int n;

    cin >> n;

    long long int a;

    int two_count = 0,four_count = 0;

    for(int i=0; i<n; i++){
        cin >> a;
        if(a % 2 == 0 && a % 4 == 0){
            four_count++;
        }
        else if(a % 2 == 0 && a % 4 != 0){
            two_count++;
        }
    }

    two_count /= 2;

    string ans = "No";

    if(four_count + two_count >= n/2){
        ans = "Yes";
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define INF 100000

using namespace std;

typedef long long ll;
typedef pair<int, int> P;


 

int main()
{
	ios_base::sync_with_stdio(0);
	int n; cin >> n;

	int diff = INF;
	int ans = 0;			

	if (n < 10 ){
		ans = n;
	}else
	if (n < 100 ){
		for (int i = 1; i < 10; i++ ){
			int cur = 10*i + i;
			if (abs (cur - n ) < diff ){
				diff = abs(cur - n );
				ans = cur;
			} // end if
		} // end for
	}else{
		for (int i = 1; i < 10; i++ ){
			for (int j = 0; j < 10; j++ ){
				int cur = (n < 1000 ? 100*i + 10*j + i : 1000*i + 100*j + 10*j + i );
				if (abs (cur - n ) < diff ){
					diff = abs(cur - n );
					ans = cur;
				} // end if
			} // end for
		} // end for
	} // end if
	cout << ans << endl;
	 
	return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define pb push_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define REP(i,n) for(int i = 0;i < (n);i++)
#define FOR(i,a,b) for(int i = (a);i <= (b);i++)
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

template <class T = int> T in() { T x; cin >> x; return (x); }
template <class T = int> void out(T x) { cout << (x) << endl; }

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value


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

	for (int i = 0; i < S.size(); i++) {
		if (S.size() == 2) {
			cout << S[i];
		}
		else {
			cout << S[S.size() - i - 1];
		}
	}

	cout << endl;

	return;

}

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();

	return 0;

}

Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
  
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        int ans = 0;
        
        int i = Math.min(a, b);
        int count = 0;
        
        while(true) {
            if (i <= 0) {
                break;
            }
            if (a % i == 0 && b % i == 0) {
                //System.out.println(i);
                count++;
            }
            if (count == k) {
                ans = i;
                break;
            }
            i--;
        }
        
        //System.out.println("---");
        System.out.println(ans);
    }

}

Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
const ll MOD = 1e9+7;
/*int dfs(vector<int> &T, vector<int> &C, int i, int sum, int g, int count){
   
}*/

int main(){
  int i, n;
  cin >> n;
  deque<int> A;
  int a;
  rep(i, n){
    cin >> a;
    if(i%2==0) A.push_front(a);
    else A.push_back(a);
  }
  if(n%2==0) reverse(A.begin(), A.end());
  rep(i, n) cout << A[i] << " ";
  cout << endl; 

}



Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
int bj=0;
char s;
int main(){
	while(cin>>s){
		if(s=='C') bj=1;
		if(bj==1 && s=='F') {
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,b) for(int i=0;i<b;i++)
using namespace std;
string s[50];
int n,m;
signed main() {
    cin>>n;
    rep(i,n)cin>>s[i];
    rep(j,26) {
        m = 100;
        rep(i, n)m = min(m, (int) count(begin(s[i]), end(s[i]),(char)j+97));
        rep(i, m) cout <<(char)(j+97);
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define I64 "%I64d"
#define RAN(v)v.begin(),v.end()
#define pb push_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
template<class T>
inline void upd1(T&a,T b){a>b?a=b:0;}
template<class T>
inline void upd2(T&a,T b){a<b?a=b:0;}
struct ano{
	operator ll(){
		ll x=0,y=0,c=getchar();
		while(c<48)
			y=c==45,c=getchar();
		while(c>47)
			x=x*10+c-48,c=getchar();
		return y?-x:x;
	}
}buf;
int main(){
	ll n=buf;
	for(int i=1;i<=3500;++i)
		for(int j=1;j<=3500;++j){
			ll a=n*i*j,b=4*i*j-n*(i+j);
			if(b>0&&a%b==0)
				return!printf("%d %d %lld\n",i,j,a/b);
		}
}

Measured memory_bytes: 764
h,w=map(int, input().split())
S=["."*(w+2)]
S+=["."+input()+"." for _ in range(h)]
S+=["."*(w+2)]
# print(S)
for i in range(1, h+1):
    l=""
    for j in range(1, w+1):
        if S[i][j]=="#":
            l+="#"
        else:
            # l+=str(sum(t[max(0, j-1):min(w, j+2)].count("#")for t in S[max(0,i-1):min(h, i+2)]))
            l+=str(sum([S[i+n][j+m]=="#" for n in range(-1, 2) for m in range(-1, 2)]))
    print(l)

Measured memory_bytes: 3064
inpl = lambda: list(map(int,input().split()))
N = int(input())
A = inpl()
if N == 0:
    if A[0] == 1:
        print(1)
    else:
        print(-1)
    exit()
elif A[0] > 0:
    print(-1)
    exit()

RG1 = [None]*N
d = u = 1
for i in range(N):
    d = max(0, d - A[i+1])
    u = max(0, 2*u - A[i+1])
    RG1[i] = (d,u)

RG2 = [None]*N
d = u = 0
for i in range(N-1,-1,-1):
    RG2[i] = (d,u)
    d = (d+A[i+1]+1)//2
    u = u + A[i+1]

RG3 = [ (max(RG1[i][0],RG2[i][0]), min(RG1[i][1],RG2[i][1])) 
        for i in range(N)]

ans = 1 + sum(A)
for i in range(N):
    if RG3[i][0] > RG3[i][1]:
        print(-1)
        exit()
    else:
        ans += RG3[i][1]
print(ans)


Measured memory_bytes: 714244
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int H = sc.nextInt();
        
        int[][] a = new int[2][N];

        int max = 0;
        for(int i = 0; i < N; i++){
            a[0][i] = sc.nextInt();
            a[1][i] = sc.nextInt();
            max = Math.max(max, a[0][i]);
        }
        sc.close();

        List<Integer> list = new ArrayList<>();
        long sum = 0;
        for(int i = 0; i < N; i++){
            if(max < a[1][i])
                sum += a[1][i];
            list.add(a[1][i]);
        }

        Collections.sort(list, Collections.reverseOrder());
        int count = 0;
        if(H > sum){
            if((H-sum)%max == 0)
                count += (H-sum)/max;
            else
                count += (H-sum)/max+1;
            H -= count*max;
        }
        int i = 0;
        while(H>0){
            H -= list.get(i);
            i++;
            count++;
        }
        System.out.println(count);
    }
}

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

int main()
{
    int n;
    int a[100];
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = n - 1; i > 0; i--)
    {
        cout << a[i] << " ";
    }
    cout << a[0] << endl;

    return 0;
}


Measured memory_bytes: 3112
from collections import deque


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

for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    to[a].append(b)
    to[b].append(a)
    

def main():
    dist = [-1] * N
    dist[0] = 0
    que = deque([0])
    
    while que:
        v = que.popleft()
        for nv in to[v]:
            if dist[nv] == -1:
                dist[nv] = dist[v] + 1
                que.append(nv)
                
    print('POSSIBLE' if dist[N - 1] == 2 else 'IMPOSSIBLE')
    
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 115032
#include<stdio.h>

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

	scanf("%d%d%d%d", &a, &b, &c, &k);

	for (int i = 0; i < k; i++) {
		flag = 0;

		if ((b > a) == 0) {
			b *= 2;
		}
		else if ((c > b) == 0) {
			c *= 2;
		}

		if (c > b && b > a) {
			puts("Yes");
			return 0;
		}
	}

	puts("No");

	return 0;
}


Measured memory_bytes: 1644
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

global current_time
global visited,go_time,back_time
global G


def dfs(node_id):
    global current_time #書かないとローカル変数扱いされる
    go_time[node_id] = current_time
    current_time += 1

    for next_node in G[node_id]:

        if visited[next_node] == True:
            continue
        visited[next_node] = True
        dfs(next_node)

    back_time[node_id] = current_time
    current_time += 1


V = int(input())

G = [[] for i in range(V)]

visited = [False]*V

go_time = [0]*V
back_time = [0]*V

for loop in range(V):
    node_id,num,*tmp_adj = list(map(int,input().split()))
    node_id -= 1
    for i in range(num):
        G[node_id].append(tmp_adj[i]-1)

current_time = 1;

for i in range(V):
    if visited[i] == True:
        continue
    visited[i] = True
    dfs(i)

for i in range(V):
    print("%d %d %d"%(i+1,go_time[i],back_time[i]))






Measured memory_bytes: 6416
#include<stdio.h>

int main(void){
    int N, i, sum = 0;
    int c[20], v[20];
    scanf("%d", &N);

    for(i=0;i<N;i++){
        scanf("%d", &v[i]);
    }
    for(i=0;i<N;i++){
        scanf("%d", &c[i]);
        if(c[i]<v[i]){
            sum+=v[i]-c[i];
        }
    }
    printf("%d", sum);

    return 0;
    
}

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

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

typedef long long ll;
typedef pair<int, int> ii;

int main() {

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

	double sum = 0;
	rep(i, n){
		sum += a[i];
	}
	int ave = (int)round(sum / n);

	ll ans = 0;
	rep(i, n) ans += ((ave - a[i]) * (ave - a[i]));

	cout << ans << endl;

	return 0;
}


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


namespace Sample
{
  class Sample
  {
    static void Main()
    {
            var list = new List<int>();
     int number = int.Parse(Console.ReadLine());
      var p = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
      int count = 0;
      int count1 = 0;
      foreach(int n in p){
      if(n%2 == 0){
     list.Add(n);
      		}
      }
      foreach(int z in list){
        count1++;
      if(z%3 == 0||z%5 == 0)
      count++;
      }
      
      if(count == count1){
      Console.Write("APPROVED");
      
      }else{
            Console.Write("DENIED");

      
      }
      
     
      
      
		}
	}
}

Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
int ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
ll nod(ll F) { return log10(F) + 1; }
//**定義場所**//
//gcd, isPrime, eratos, modinv, bitSearch, dfs, bfs, dijkstra, UnionFind//
ll i, j, k, l, m, n; ll N, M, K, H, W, L; string S;
ll MOD = 1000000007; ll ans = 0; ll INF = 9999999999999;
vl flag, color; vll path; vl A, T;
//***********//
int main() {
	cin >> N;
	vl P(N);
	for (i = 0; i < N; i++) {
		cin >> P[i];
	}
	ll best = INF;
	for (i = 0; i < N; i++) {
		if (P[i] <= best) {
			best = P[i];
			ans++;
		}
	}
	cout << ans;
}


Measured memory_bytes: 1792
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 04/12/20 22:29:53
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

template <typename T, T MOD>
class modint {
 private:
  T val_;

 public:
  constexpr modint() : val_(0) {}
  constexpr modint(T v) : val_(v%MOD) {}
  constexpr modint& operator=(T v) { val_ = v%MOD; return *this; }

  constexpr T val() const { return val_; }
  constexpr modint operator+(modint x) const { return (val() + x.val())%MOD; }
  constexpr modint operator+=(modint x) { return *this = *this + x; }
  constexpr modint operator++() { return *this += 1; }
  constexpr modint operator++(int) { modint c = *this; ++(*this); return c; }
  constexpr modint operator-(modint x) const { return (val() + MOD - x.val())%MOD; }
  constexpr modint operator-=(modint x) { return *this = *this - x; }
  constexpr modint operator--() { return *this -= 1; }
  constexpr modint operator--(int) { modint c = *this; --(*this); return c; }
  constexpr modint operator*(modint x) const { return (val() * x.val())%MOD; }
  constexpr modint operator*=(modint x) { return *this = *this * x; }
  friend constexpr modint pow(modint x, T p) {
    modint t = 1;
    modint u = x;
    while (p) {
      if (p & 1)
        t *= u;
      u *= u;
      p >>= 1;
    }
    return t;
  }
  constexpr modint operator/(modint x) const { return *this * pow(modint{x}, MOD-2); }
  constexpr modint operator/=(modint x) { return *this = *this / x; }

  constexpr bool operator==(modint x) const { return val() == x.val(); }
  constexpr bool operator!=(modint x) const { return val() != x.val(); }
  constexpr bool operator<(modint x) const { return val() < x.val(); };
  constexpr bool operator<=(modint x) const { return val() <= x.val(); };
  constexpr bool operator>(modint x) const { return val() > x.val(); };
  constexpr bool operator>=(modint x) const { return val() >= x.val(); };

  friend std::ostream& operator<<(std::ostream& os, const modint& x) {
    return os << x.val();
  }
  friend std::istream& operator>>(std::istream& is, modint& x) {
    return is >> x.val_;
  }

};

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

  using mint = modint<ll, (ll)1e9+7>;
  int n,k; cin>>n>>k;

  mint ans = 0;
  vector<mint> dp(k+1);
  for (int i = k; i >= 1; i--) {
    dp[i] = pow(mint(k/i), n);
    for (int j = i+i; j <= k; j+=i) {
      dp[i] -= dp[j];
    }
    ans += dp[i]*i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3992
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;


int main()
{
	double n,k;
	double ans=0;
	cin>>n>>k;
	for(double i=1;i<n+1;i+=1)
	{
		if(i>=k)
		{
			ans+=(1.0f/n);
			continue;
		}
		int tmp=i;
		int cnt=0;
		while(tmp<k)
		{
			tmp*=2;
			cnt++;
		}
		ans+=(1.0f/n)*(double)pow(0.5f,cnt);
	}
	cout<<fixed<<setprecision(12)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

Q = I()

from heapq import heapify,heappop,heappush

s,t = 0,0  # |x-a|たちの和の最小値、bたちの和
left,right = [],[]  # aたちの中で中間値より小さいもの、大きいもの
heapify(left)
heapify(right)
l,r = 0,0  # left,right の長さ
for i in range(Q):
    A = LI()
    if A[0] == 2:
        if l == r:
            x = -heappop(left)
            heappush(left,-x)
        else:
            x = heappop(right)
            heappush(right,x)
        print(*[x,s+t])
    else:
        c,a,b = A
        t += b
        if l == r:
            if l == 0:
                heappush(right,a)
            else:
                x = -heappop(left)
                y = heappop(right)
                if a >= x:
                    heappush(left,-x)
                    heappush(right,y)
                    heappush(right,a)
                    if a >= y:
                        s += a-y
                else:
                    heappush(left,-a)
                    heappush(right,x)
                    heappush(right,y)
                    s += x-a
            r += 1
        else:
            if l == 0:
                y = heappop(right)
                s += abs(y-a)
                if a < y:
                    heappush(left,-a)
                    heappush(right,y)
                else:
                    heappush(left,-y)
                    heappush(right,a)
            else:
                x = -heappop(left)
                y = heappop(right)
                s += abs(y-a)
                if a < y:
                    heappush(left,-x)
                    heappush(left,-a)
                    heappush(right,y)
                else:
                    heappush(left,-x)
                    heappush(left,-y)
                    heappush(right,a)
            l += 1


Measured memory_bytes: 92264
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
typedef long long ll;
typedef vector<vector<ll>> vvl;
typedef vector<ll> vl;
typedef vector<vector<char>> vvc;
typedef vector<char> vc;
typedef pair<ll,ll> pll;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
  return x+y-max(x,y);
}


int main() {
  int n;cin >> n;
  cout << "Christmas";
  rep(i,25-n)cout << " Eve";
  cout << endl;
}

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

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

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

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

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

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

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

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

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

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

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

#[allow(dead_code)]
fn chmin<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x > y && {
        *x = y;
        true
    }
}

#[allow(dead_code)]
fn chmax<T>(x: &mut T, y: T) -> bool
where
    T: PartialOrd + Copy,
{
    *x < y && {
        *x = y;
        true
    }
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, VecDeque};

fn main() {
    input! {
        n:usize
    }
    let ans = 3 * (n * n);
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, x, n) for(int i = n - 1 - x; i >= 0; i--)

const int MAX_N = 1000; // nの最大値
const int MAX_W = 5000; // Wの最大値

int main() {
    int K,A,B;
    cin >> K >> A >> B;
    for(int i = K; i <= B; i += K) {
        if (A <= i) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG";
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
using namespace std;

int N;
vector<int> A;
void solve() {
	cin >> N;
	A.clear();
	A.resize(N);
	for (int n = 0; n < N; n++)cin >> A[n];
	bool flag = false;
	for (int n = 0; n < N; n++) {
		if (A[n] % 2 == 1) {
			flag = true;
			break;
		}
	}
	if (flag)cout << "first" << endl;
	else cout << "second" << endl;
	return;
}

//////////////////////////////
//////////////////////////////

int main() {
#ifdef DEBUGTIME
	for (int time = 0; time < DEBUGTIME; time++) {
		solve();
		cout << "####################" << endl;
	}
#else
	solve();
#endif
	return 0;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(){
    int a, b;
    scanf("%d %d", &a ,&b);
    while(!(a==0&&b==0)){
        for(int i=0; i<a; i++){
            for(int j=0; j<b; j++){
                if((i+j)%2==0)
                printf("#");
                else printf(".");
            }
            puts("");
        }
        printf("\n");
         scanf("%d %d", &a ,&b);
    }
    
}


Measured memory_bytes: 2048
import java.util.*;

public class Main {
	static int goal;

	static ArrayList<Integer> list = new ArrayList<>();
	static int[] cache;

	// static int[] result;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		goal = sc.nextInt();
		// result = new int[goal + 1];
		// Arrays.fill(result, -1);
		int c = sc.nextInt();
		for (int i = 0; i < c; i++) {
			list.add(sc.nextInt());
		}
		cache = new int[goal + 1];
		Collections.sort(list, Collections.reverseOrder());
		System.out.println(compute(goal));

	}

	public static int compute(int value) {
		if (cache[value] != 0) {
			return cache[value];
		}
		HashSet<Integer> set = new HashSet<Integer>();
		for (int e : list) {
			if (e == value) {
				cache[value] = 1;
				return 1;
			}
			if (e < value) {
				int coins = 1;
				coins += compute(value - e);
				set.add(coins);

			}
		}
		int result = Integer.MAX_VALUE;
		for (int e : set) {
			if (e < result) {
				result = e;
			}
		}
		cache[value] = result;
		return result;

	}

}

Measured memory_bytes: 61216
#!/usr/local/bin/python3
# https://atcoder.jp/contests/agc014/tasks/agc014_a
# int(input())
# input().split()
# map(int, input().split())
# list(map(int, input().split()))

S = input()
if S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")


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

int main(){
  int N;
  cin >> N;
  
  int num[4];
  for(int i=0;i<4;++i){
    num[i] = N % 10;
    N /= 10;
  }
  
  if(num[0] == num[1] and num[1] == num[2]) cout << "Yes" << endl;
  else if(num[1] == num[2] and num[2] == num[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 9223372036854775807
#define MOD 1000000007
#define PI 3.1415926535

ll cal(ll a,ll b){
    return pow(a, 5) - pow(b, 5);
}

int main(void){

    ll x;
    cin >> x;

    for (ll i = -1000ll; i <= 1000ll;i++){
        for (ll j = -1000ll; j <= 1000ll;j++){
            ll c = cal(i, j);
            if(x == c){
                cout << i << " " << j << endl;
                return 0;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 4040
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <algorithm>
#include <unordered_map>

#define rep(i, a, b) for (ll i = a; i < b; i++)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef unordered_map<string, ll> u_map;

// input
void input() {}
template <class Head, class... Tail>
void input(Head &&a, Tail &&... b)
{
    cin >> a;
    input(forward<Tail>(b)...);
}

template <class V>
void input(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &i) { input(i); });
}

// output
template <class V>
void output(vector<V> &v)
{
    for_each(v.begin(), v.end(), [](auto &x) { cout << x << " "; });
    cout << endl;
}

// math functions
ll mpow(ll a, ll n, ll p)
{
    ll x = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            x = a * x % p;
        }
        a = a * a % p;
        n >>= 1;
    }

    return x;
}

ll mfact(ll n, ll p)
{
    ll res = 1;
    for (ll i = 2; i <= n; i++)
    {
        res = res * i % p;
    }
    return res;
}

ll mcomb(ll n, ll r, ll p)
{
    if (n == 0 && r == 0)
    {
        return 1;
    }
    if (n < r || n < 0 || r < 0)
    {
        return 0;
    }

    ll a = mfact(n, p);
    ll b = mfact(n - r, p);
    ll c = mfact(r, p);
    return (((a * mpow(b, p - 2, p)) % p) * mpow(c, p - 2, p)) % p;
}

ll gcd(ll a, ll b)
{
    if (a < b)
    {
        a ^= b;
        b ^= a;
        a ^= b;
    }
    return b ? gcd(b, a % b) : a;
}

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

int main()
{
    ll m1, d1, m2, d2;
    input(m1, d1, m2, d2);
    cout << (m1 != m2 ? 1 : 0) << endl;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
v=list(map(int,input().split()))
a=[]
b=[]
A=[]
B=[]
for i in range(n):
    if i%2==0:
        a.append(v[i])
        A.append([0,0])
    else:
        b.append(v[i])
        B.append([0,0])
a.sort()
b.sort()

A[0][1]=a[0]
B[0][1]=b[0]

x=a[0]
y=0
for j in range(len(a)):
  if a[j]==x:
    A[y][0]+=1
  else:
    x=a[j]
    y+=1
    A[y][1]=x
    A[y][0]+=1
    
w=b[0]  
z=0
for k in range(len(b)):
  if b[k]==w:
    B[z][0]+=1
   
  else:
    w=b[k]
    z+=1
    B[z][1]=w
    B[z][0]+=1 
    
A=sorted(A,key=lambda x:x[0],reverse=True) 
B=sorted(B,key=lambda x:x[0],reverse=True)  
if A[0][1]==B[0][1]:
    print(min(n-A[0][0]-B[1][0],n-A[1][0]-B[0][0]))
elif n-A[0][0]-B[0][0]==0 and A[0][1]==B[0][1]:
    print(int(n/2))
else:
    print(n-A[0][0]-B[0][0])  
    




Measured memory_bytes: 20640
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define fastio ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mod 1000000007
#define vll vector<ll>
#define inf 1e9 +7
#define pll pair<ll,ll>
#define ff first 
#define ss second 
#define PI acos(-1)
#define prm 998244353
#define endl '\n'
using namespace std;

int main()
{
    fastio; 
    ll T=1;
    //cin>>T; 
    while(T--)
    {
    	ll n;
    	cin>>n;
    	
    	ll a[n];
    	for(ll i=0;i<n;i++)cin>>a[i];
    	ll dif=0;
    	for(ll i=0;i+1<n;i++)
    	{
    		if(a[i]>a[i+1])
    		{
    			dif+=(a[i]-a[i+1]);
    			a[i+1]=a[i];
			}
		}
		cout<<dif<<endl;
    }
}



Measured memory_bytes: 5164
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;

int main(){
	LL n;
	cin>>n;
	LL ans=0;
	FOR(i,1,1000002){
		if(n%i==0){
			LL m=n/i-1;
			if(m<=0)continue;
			if(n/m==n%m)ans+=m;
		}
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
int main(){
	int a,b[100]={},c=0;
	std::cin>>a;
	for(int i=0;i<a;i++){
		std::cin>>b[i];
	}
	for(int i=0;i<a;i++){
		if(b[i]!=0){
			for(int j=i+1;j<a;j++){
				if(b[i]==b[j]){
					c+=1;
					b[j]=0;
				}
			}
		}
	}
	std::cout<<a-c<<std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <cstdio>

using namespace std;



int main(){
	int n;

	cin >> n;
	while(n--){
		int a;
		bool p = true;
		int b = 0, c = 0;
		for(int i = 0; i < 10; i++){
			cin >> a;
			if(p){
				if(a > b){
					b = a;
				}else if(a > c){
					c = a;
				}else{
					p = false;
				}
			}
		}
		
		if(p){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <istream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
//#include <unordered_map>
#include <cstring>
#include <string.h>
#include <iomanip>
#include <queue>
#include <stack>
#include <list>
#include <sstream>
//#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld;

#define ALL(V) V.begin(), V.end()
#define SZ(V) (int)V.size()
#define pb push_back
#define mp make_pair
#define f first
#define s second

#define fopen freopen("substrcmp.in", "r", stdin); freopen("substrcmp.out","w", stdout)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define FILL(A,value) memset(A,value,sizeof(A))
#define IOSFAST ios::sync_with_stdio(false); cin.tie(0)

const ll MOD = 1000LL * 1000 * 1000 + 7;
const int INF = 1e9;
const ll base = 1e18;
const int MAX = 1000;
const double EPS = 1e-9;
const double PI = acos(-1.);
int was[2000202];
int q[10000200];
int aa = 1000100;
int main()
{
	int n,m,k;
	cin >> n >> m >> k;
	bool flag = false;
	FOR(i,0,n+1)
	{
		FOR(j,0,m+1)
		{
			int x = m*i+(n-i)*j-j*i;
			if (x == k)
			{
				cout << "Yes";
				return 0;
			}
		}
	}
	cout << "No";


	return 0;
}


Measured memory_bytes: 256