akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
using namespace std;

int main() {
  int N,x,child[110],i,count=0;

  cin >> N >> x;
  for (i=0; i<N; i++) cin  >> child[i];

  sort(child, child + N);

  for (i=0; i<N; i++) {
    if (x >= child[i]) {
    x -= child[i];
    count++;
  }
  }

  if (N == count && x > 0) count--;

  cout << count << endl;
}

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

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

  int max_v;
  long long comb[N+1][K+1] = {};
  if (N-K+1 > K-1) max_v = N-K+1;
  else max_v = K-1;
  for (int i=0; i<=N; i++) comb[i][0] = 1;
  for (int i=1; i<=max_v; i++) {
    for (int j=1; j<=K; j++) {
      comb[i][j] = (comb[i-1][j-1] + comb[i-1][j]) % MOD;
    }
  }

  long long ans;
  for (int i=1; i<=K; i++) {
    // red : N-K-i+1個の球とi個の仕切りを並べる
    // (N-K+1)C_i
    // blue : K-i個の球とi-1個の仕切りを並べる
    // (K-1)C_(i-1)
    ans = (comb[N-K+1][i] * comb[K-1][i-1]) % MOD;
    cout << ans << endl;
  }
}


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

typedef long long ll;
const int N = 2e5;
vector<ll> tree(4 * N, 0);

void update(int l, int r, int idx, ll val, int node)
{
	if (l == r)
	{
		tree[node] = val;
	}
	else
	{
		int m = l + (r - l) / 2;
		if (idx >= l && idx <= m)
		{
			update(l, m, idx, val, 2 * node);
		}
		else
		{
			update(m + 1, r, idx, val, 2 * node + 1);
		}
		tree[node] = max(tree[2 * node], tree[2 * node + 1]);
	}
}

ll query(int l, int r, int ql, int qr, int node)
{
	if (ql <= l && qr >= r)
	{
		return tree[node];
	}
	if (ql > r || qr < l)
	{
		return 0;
	}
	int m = l + (r - l) / 2;
	return max(query(l, m, ql, qr, 2 * node), query(m + 1, r, ql, qr, 2 * node + 1));
}

int main()
{
	ios_base::sync_with_stdio(false);

	int n;
	cin >> n;
	vector<ll> h(n), a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> h[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	ll answer = 0;
	for (int i = 0; i < n; i++)
	{
		ll temp = query(1, n, 1, h[i] - 1, 1) + a[i];
		answer = max(answer, temp);
		update(1, n, h[i], temp, 1);
	}
	cout << answer;

	return 0;
}

Measured memory_bytes: 12756
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
import std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
long binarySearch(long min, long max, bool delegate(long) f){
	if(!f(min)) return min - 1; if(f(max)) return max;
	long mid; while(max - min > 1){ mid = min + (max - min) / 2; if(f(mid)) min = mid; else max = mid; } return min;
	}

bool check(long x){
	writeln("? ", x);
	stdout.flush;
	return (readln.chomp == "Y");
	}

void main(){
	int x;
	if(check(10_000_000_000)) x = 0; // 10...0 の形である
/*	else if(check(20_000_000_000)) x = 1; // 1で始まるかまたは20...0の形である
	else if(check(30_000_000_000)) x = 2; // 2で始まるかまたは30...0の形である
	else if(check(40_000_000_000)) x = 3; // 3で始まるかまたは40...0の形である
	else if(check(50_000_000_000)) x = 4; // 4で始まるかまたは50...0の形である
	else if(check(60_000_000_000)) x = 5; // 5で始まるかまたは60...0の形である
	else if(check(70_000_000_000)) x = 6; // 6で始まるかまたは70...0の形である
	else if(check(80_000_000_000)) x = 7; // 7で始まるかまたは80...0の形である
	else if(check(90_000_000_000)) x = 8; // 8で始まるかまたは90...0の形である
*/	else x = 9;
	
	long ans;
	if(x != 0){
		long a, b; 
		if(!check(10)) a = 2, b = 9; // 1桁(2 ～ 9)である
		else if(!check(100)) a = 11, b = 99; // 2桁(11 ～ 99)である
		else if(!check(1_000)) a = 101, b = 999; // 3桁(101 ～ 999)である
		else if(!check(10_000)) a = 1001, b = 9999; // 4桁(1001 ～ 9999)である
		else if(!check(100_000)) a = 10001, b = 99999; // 5桁(10001 ～ 99999)である
		else if(!check(1_000_000)) a = 100001, b = 999999; // 6桁(100001 ～ 999999)である
		else if(!check(10_000_000)) a = 1000001, b = 9999999; // 7桁(1000001 ～ 9999999)である
		else if(!check(100_000_000)) a = 10000001, b = 99999999; // 8桁(10000001 ～ 99999999)である
		else if(!check(1_000_000_000)) a = 100000001, b = 999999999; // 9桁(100000001 ～ 999999999)である
		// else はありえない
		
		ans = binarySearch(a - 1, b, x => !check((x.to!string ~ x.to!string).to!long)) + 1;
		}
	else{
		if(check(9)) ans = 1;
		else if(check(99)) ans = 10;
		else if(check(999)) ans = 100;
		else if(check(9999)) ans = 1000;
		else if(check(99999)) ans = 10000;
		else if(check(999999)) ans = 100000;
		else if(check(9999999)) ans = 1000000;
		else if(check(99999999)) ans = 10000000;
		else if(check(999999999)) ans = 100000000;
		else ans = 1000000000;
		
		}
	
	writeln("! ", ans);
	}


/*

10_000_000_000
20_000_000_000
30_000_000_000
40_000_000_000
50_000_000_000
60_000_000_000
70_000_000_000
80_000_000_000
90_000_000_000
と比較することで最初の１字を決める

次に
1
10
100
1_000
10_000
100_000
1_000_000
10_000_000
100_000_000
1_000_000_000
と比較することで桁数を決める

桁数が決まれば(たとえば5桁)
10000_10000～99999_99999
の形で繰り返すものと比較することで二分法

*/

Measured memory_bytes: 596
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <limits>
using namespace std;
using llong = long long;

//===
template<class T>
struct Edge {
    int src, to;
    T cost;

    Edge (int to, T cost):
        src(-1), to(to), cost(cost) {};
    Edge (int src, int to, T cost):
        src(src), to(to), cost(cost) {};

    operator int() const {
        return to;
    };
};

template <class T>
using WeightedGraph = vector<vector<Edge<T>>>;
using UnWeightedGraph = vector<vector<int> >;
//===

//===
// require graph/basic.cpp
// #inlcude <limits>

// when g has negative cycle, it returns empty vector<>
// time: O(|E||V|)
template<class T>
vector<T> bellman_ford(WeightedGraph<T> &g, int from) {

    const T INF = numeric_limits<T>::max();
    const int V = g.size();
    vector<T> min_cost(g.size(), INF);

    min_cost[from] = 0;
    for (int k = 0; k < V; k++) {
        for (int i = 0; i < V; i++) {
            for (auto &e:g[i]) {
                if (min_cost[i] == INF) break;
                if (min_cost[i] + e.cost < min_cost[e.to]) {
                    
                    min_cost[e.to] = min_cost[i] + e.cost;
                    if (k == V - 1) return vector<T>();
                }
            }
        }
    }

    return min_cost;
};

// when some negative cycles is into from->to path has, it returns empty vector<T>
template<class T>
vector<T> bellman_ford(WeightedGraph<T> &g, int from, int to) {
    
    const T INF = numeric_limits<T>::max();
    const int V = g.size();
    vector<T> min_cost(g.size(), INF);
    vector<bool> used(g.size(), 0);
    vector<bool> reach(g.size(), 0);

    auto dfs = [&](auto &&f, int u) -> bool {
                   if (used[u]) return reach[u];
                   used[u] = true;
                   for (int v:g[u]) reach[u] = reach[u] | f(f, v);
                   return reach[u];
               };

    reach[to] = true;
    for (int i = 0; i < V; i++) dfs(dfs, i);
    
    min_cost[from] = 0;
    for (int k = 0; k <= V; k++) {
        for (int i = 0; i < V; i++) {
            for (auto &e:g[i]) {
                if (min_cost[i] == INF) break;
                if (min_cost[i] + e.cost < min_cost[e.to]) {
                    
                    min_cost[e.to] = min_cost[i] + e.cost;
                    if (k == V && reach[i]) return vector<T>();
                }
            }
        }
    }

    return min_cost;
};
//===

llong n, m, p;
llong a, b, c;
WeightedGraph<llong> g;

int main() {
    cin >> n >> m >> p;
    g.resize(n + 1);

    for (int i = 0; i < m; i++) {
        cin >> a >> b >> c;
        g[a].emplace_back(b, p - c);
        //g[b].emplace_back(a, p - c);
    }

    auto cost = bellman_ford(g, 1, n);

    if (cost.empty()) {
        cout << -1 << endl;
    }
    else {
        cout << max(0ll, -cost[n]) << endl;
    }

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <array>
#include <vector>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int R, C, N;
int xn1[100001];
int yn1[100001];
int xn2[100001];
int yn2[100001];
bool check = true;
vector<P> ps;
stack<ll> st;

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

    cin >> R >> C >> N;

    for(int i = 0; i < N; ++i){
        cin >> xn1[i] >> yn1[i] >> xn2[i] >> yn2[i];
    }

    for(int i = 0; i < N; ++i){
        int d1 = 0;
        int d2 = 0;
        if((xn1[i] == 0 || xn1[i] == R || yn1[i] == 0 || yn1[i] == C) &&
        (xn2[i] == 0 || xn2[i] == R || yn2[i] == 0 || yn2[i] == C)){
            if(yn1[i] == 0){
                d1 = xn1[i];
            }
            else if(xn1[i] == R){
                d1 = R + yn1[i];
            }
            else if(yn1[i] == C){
                d1 = R + C + R - xn1[i];
            }
            else {
                d1 = R + C + R + C - yn1[i];
            }
            if(yn2[i] == 0){
                d2 = xn2[i];
            }
            else if(xn2[i] == R){
                d2 = R + yn2[i];
            }
            else if(yn2[i] == C){
                d2 = R + C + R - xn2[i];
            }
            else {
                d2 = R + C + R + C - yn2[i];
            }
            if(d1 > d2){
                swap(d1, d2);
            }
            ps.push_back(P(d1, i));
            ps.push_back(P(d2, i + N));
        }
    }
    sort(ps.begin(), ps.end());

    for(size_t i = 0; i < ps.size(); ++i){
        if(ps[i].second >= N){
            if(st.size() > 0 && st.top() + N == ps[i].second){
                st.pop();
            }
            else {
                cout << "NO" << endl;
                return 0;
            }
        }
        else {
            st.push(ps[i].second);
        }
    }
    cout << "YES" << endl;
    return 0;

    return 0;
}

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

typedef long long llong;

template <class T>
T greatestCommonDivisor(T a, T b) {
	return b ? greatestCommonDivisor(b, a%b) : a;
}

void solve() {
	llong N, X; cin >> N >> X; // 訪れる都市の数, 初期地点の座標
	vector<llong> x(N); // 訪れる都市の座標たち
	rep(i, N) {
		scanf("%lld", &x[i]);
		x[i] -= X;
	}
	llong res = abs(x[0]);
	rep(i, N) res = greatestCommonDivisor(res, abs(x[i]));
	cout << res << endl;
}

int main(void) {
	solve();

	return 0;
}

Measured memory_bytes: 1024
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

K = In.int()
S = In.str()

if len(S)<=K:
    Out.str(S)
else:
    Out.str(S[0:K] + "...")

######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Measured memory_bytes: 68088
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

/// Rearranges elements in the slice
/// to the next lexicographically larger permutation.
pub fn next_perm<T: Ord>(xs: &mut [T]) -> bool {
    // `xs[i + 1..]` : desc but
    // `xs[i..]` : not desc.
    let i = match (0..xs.len())
        .rev()
        .filter(|&i| i + 1 < xs.len() && xs[i] < xs[i + 1])
        .next()
    {
        None => return false,
        Some(i) => i,
    };

    // `xs[k]` : The next greater elem in `xs[i..]`.
    let k = (i + 1..xs.len())
        .rev()
        .filter(|&k| xs[i] < xs[k])
        .next()
        .unwrap();

    // E.g. 2431 -> 3421 -> 3124 (where i = 0, k = 2).
    xs.swap(i, k);
    xs[i + 1..].reverse();

    true
}

fn distance((px, py): (i64, i64), (qx, qy): (i64, i64)) -> f64 {
    (((qx - px) * (qx - px) + (qy - py) * (qy - py)) as f64).sqrt()
}

fn main() {
    let N = read!(usize);
    let T = read![i64, i64; N];

    let mut route = (0..N).collect::<Vec<_>>();

    let mut sum = 0.0;
    let mut count = 0_i64;
    loop {
        for w in route.windows(2) {
            sum += distance(T[w[0]], T[w[1]]);
        }
        count += 1;

        if !next_perm(&mut route) {
            break;
        }
    }

    println!("{}", sum / count as f64)
}


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

long long N;
int counter;

void func(long long i,int use){
  if(i > N) return;
  if(use == 0b111) ++counter;

  func(i * 10 + 7, use | 0b001);
  func(i * 10 + 5, use | 0b010);
  func(i * 10 + 3, use | 0b100);


}

int main() {
  cin >> N;
  func(0,0);
  cout << counter << endl;



}



Measured memory_bytes: 256
S = [0] * 3
for i in range(3):
    S[i] = list(map(int, input().split()))

# print(S)
yoko = []
for s in S:
    yoko.append(set(s))

tate = []
for i in range(3):
    tate.append({S[0][i], S[1][i], S[2][i]})
# print(tate)

naname = [{S[0][0], S[1][1], S[2][2]}, {S[0][2], S[1][1], S[2][0]}]

N = int(input())
B_set = {int(input()) for i in range(N)}

for y in yoko:
    if y < B_set:
        print("Yes")
        exit()

for y in tate:
    if y < B_set:
        print("Yes")
        exit()

for y in naname:
    if y < B_set:
        print("Yes")
        exit()

print("No")

Measured memory_bytes: 38460
import java.util.*;


public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long posFirst = Long.parseLong(sc.next());
		long numStep = Long.parseLong(sc.next());
		long lenStep = Long.parseLong(sc.next());
		long result = 0;

		posFirst = Math.abs(posFirst);

		// while(posFirst >= 0){
		// 	if(numStep == 0) break;

		// 	posFirst -= lenStep;
		// 	numStep--;
		// }
		long numStepTmp = posFirst / lenStep;
		
		if(numStepTmp > numStep){
			posFirst = posFirst - lenStep * numStep;
			System.out.println(Math.abs(posFirst));
			return;
		}

		numStep -= numStepTmp;
		posFirst = posFirst % lenStep;

		if(numStep % 2 == 1){
			posFirst = Math.abs(posFirst) - lenStep;
		}

		System.out.println(Math.abs(posFirst));
		// System.out.println(numStep);
	}
}


Measured memory_bytes: 35660
#include <iostream>
#include <algorithm>
#include <array>

using namespace std;

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

int main(){
    while(1){
        array<int,8> a;
        rep(i,8) cin>>a[i];
        if(!cin) break;
        int g=1<<30;
        array<int,8> capa = {1,4,1,4,1,2,1,2}, ans;
        rep(i,8){
            rotate(capa.begin(), capa.begin()+1, capa.end());
            int min=0;
            rep(j,8) min+=max(0,a[j]-capa[j]);
            if(min<g||(min==g&&lexicographical_compare(all(capa),all(ans)))){
                ans=capa;
                g=min;
            }
        }
        rep(i,8) cout<<ans[i]<<((i==7)?'\n':' ');
    }
}

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


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


       int i=0;

        if(s[i+2]==s[i+3] && s[i+4]==s[i+5] ){

            cout<<"Yes"<<endl;
        }else{
          cout<<"No"<<endl;
        }




       return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define IFOR(i, m, n) for(int i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
const ll INF = 1e18;
/* テンプレートここまで */

int main() {
  ll r,g,b; cin >> r >> g >> b;
  if((10*g+b)%4==0) cout << "YES" << endl;
  else cout << "NO" << endl;
}


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

typedef long long ll;

int main() {
    int N, T, c, t, ans = 1e9;
    cin >> N >> T;
    rep(i, N) {
        cin >> c >> t;
        if (t <= T) ans = min(ans, c);
    }
    if (ans == 1e9) cout << "TLE\n";
    else cout << ans << "\n";
}

Measured memory_bytes: 256
r, c = map(int, input().split())

sum_row = []

for i in range(c + 1):
    sum_row.append(0)

for i in range(r):
    tmp_row = tuple(map(int, input().split()))
    tmp_row_sum = sum(tmp_row)
    tmp_row += tmp_row_sum,
    print(" ".join(map(str, tmp_row)))
    for j in range(c + 1):
        sum_row[j] += tmp_row[j]

print(" ".join(map(str, sum_row)))

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

 int main()
 {
      int a,b,i,y,x,sum;
      cin>>a>>b;
      sum=(a+b)/2;
      a=a%2;
      b=b%2;
      if(a==b)
      {
          cout<<sum<<endl;
      }
      else
      {
          cout<<"IMPOSSIBLE"<<endl;
      }
 }


Measured memory_bytes: 256
//----->|try=0; while(!success) try++;|<------
//----->|Belief Yourself,Respect Yourself|<----
//----->|Be Proud Of Yourself,You're Doing Your best|<-----
#include<bits/stdc++.h>
using namespace std;
#define uniq(x)  x.erase(unique(x.begin(),x.end()), x.end()) //Unique value find from vector
#define upper(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Upper value search;
#define lower(arr,n,fixed) upper_bound(arr,arr+n,fixed)-arr  //Lower value search;
#define max3(a,b,c) max(max(a,b),c)//maximum value find three value;
#define min3(a,b,c) min(min(a,b),c)//minimum value find three value;
#define PI acos(-1.0)//PI Calculation
#define LL long long
#define AND(a,b) ((a) & (b))
#define OR(a,b) ((a)|(b))
#define XOR(a,b) ((a) ^ (b))
#define mp make_pair
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define MX 1000005
#define MOD 1000000007
template<typename T> T POW(T b,T p)          //Pow calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b);
        b=(b*b);
        p>>=1;
    }
    return r;
}

template<typename T> T BigMod(T b,T p,T m) //BigMod Calculation
{
    T r=1;
    while(p)
    {
        if(p&1)r=(r*b)%m;
        b=(b*b)%m;
        p>>=1;
    }
    return r;
}

//||--------------------------->||Main_Code_Start_Here||<---------------------------------||
int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    stack<char>a,b,c;
    string s1,s2,s3;
    while(cin>>s1>>s2>>s3)
    {
        for(int i=s1.size()-1; i>=0; i--) a.push(s1[i]);
        for(int i=s2.size()-1; i>=0; i--) b.push(s2[i]);
        for(int i=s3.size()-1; i>=0; i--) c.push(s3[i]);
        char ch='a';
        char ans;
        while(true)
        {
            if(ch=='a')//checking a stack;
            {
                if(a.empty())
                {
                    ans='A';
                    break;
                }

                else
                {
                    ch=a.top();
                    a.pop();
                }
            }



            else if(ch=='b')//checking b stack;
            {
                if(b.empty())
                {
                    ans='B';
                    break;
                }
                else
                {
                    ch=b.top();
                    b.pop();
                }
            }

            else//checking c stack;
            {

                if(c.empty())
                {
                    ans='C';
                    break;
                }
                else
                {
                    ch=c.top();
                    c.pop();
                }

            }

        }
        cout<<ans<<endl;

    }
}




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

int main(){
    int n;cin>>n;
    vector<string> s(3);
    rep(i,3)cin>>s[i];
    
    int ans = 0;
    
    rep(i,n){
        if(s[0][i]==s[1][i] && s[0][i]==s[2][i])continue;
        if(s[0][i]==s[1][i] || s[0][i]==s[2][i] || s[2][i]==s[1][i])
            ans += 1;
        else
            ans += 2;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3580
#ifdef LOCAL111
#else
	#define NDEBUG
#endif
#include <bits/stdc++.h>
const int INF = 1e8;
using namespace std;

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RBP(i,a) for(auto& i : a)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#else
	#define DEBUG(x) true
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
#define rangej(a,b,c) ((a) <= (c) and (c) < (b))
#define rrangej(b,c) rangej(0,b,c)
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

typedef pair<int,int> P;
typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<LL,LL> LP;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);	
}

int main()
{
	ios_init();
	int n;
	cin >> n;
	n *= 2;
	vector<int> l(n);
	REP(i,n) cin >> l[i];
	sort(ALL(l));
	int ans = 0;
	REP(i,n/2) ans += l[i*2];
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
const input = require('fs').readFileSync('/dev/stdin', 'UTF-8')

function main (input) {
  const list = input.split(' ').map(v => v * 1);
  const min1 = Math.min.apply(null, list);
  const list2 = list.filter(v => v !== min1);
  const a = list[0],
        b = list[1],
  	   	c = list[2];
  const min2 = a === b && b === c ? min1 : Math.min.apply(null, list2);
  
  console.log(min1 + min2)
}

main(input);

Measured memory_bytes: 21192
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define REP(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<Int, Int>;
template <class T> inline bool chmax(T& a, const T& b) {
    if (a >= b) return false;
    a = b;
    return true;
}
template <class T> inline bool chmin(T& a, const T& b) {
    if (a <= b) return false;
    a = b;
    return true;
}
struct SetupIO {
    SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }
} setup_io;

// template <template <class, class...> class TT, class... Args>
// ostream& operator<<(ostream& out, TT<Args...> const& cont) {
//     for (auto&& elem : cont) out << elem << " ";
//     return out;
// }
// template <class T> ostream& operator<<(ostream& out, const vector<vector<T>>& vs) {
//     for (auto&& v : vs) cout << v << endl;
//     return out;
// }
// template <class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> const& val) {
//     return (out << "{" << val.first << " " << val.second << "}");
// }

void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) {
    cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...);
}
#ifdef _MY_DEBUG
#define dump(...)                                                                                                    \
    cerr << "/* " << #__VA_ARGS__ << " [" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), \
        cerr << "*/\n\n";
#else
#define dump(...)
#endif

/**
 *    author:  knshnb
 *    created: CREATED_TIMESTAMP
 **/

signed main() {
    Int n;
    cin >> n;
    string s;
    cin >> s;
    for (auto& c : s) c = 'A' + (c - 'A' + n) % 26;
    cout << s << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline

S = input().rstrip()
gx, gy = map(int, input().split())
L = len(S)

XY = [[], []]
d = 0
c = 0
begin = True
for s in S:
    if begin and s == "F":
        gx -= 1
    elif s == 'T':
        begin = False
        if c > 0:
            XY[d].append(c)
        d ^= 1
        c = 0
    else:
        c += 1
if c > 0:
    XY[d].append(c)

XY[0].append(abs(gx))
XY[1].append(abs(gy))

ans = True
for X in XY:
    G = sum(X)
    if G%2 != 0:
        ans = False
        break
    G //= 2
    ok = False
    W = len(X)
    dp = [False]*(G+1)
    dp[0] = True
    for i, x in enumerate(X):
        for g in reversed(range(G+1)):
            if g >= x:
                dp[g] = dp[g-x] or dp[g]
        if dp[G]:
            ok = True
            break
    ans = ok and ans
print("Yes" if ans else "No")

Measured memory_bytes: 43996
#include<bits/stdc++.h>
using ll = int_fast64_t;
#define REP(i,b,e) for(ll i=b; i<e; i++)
const int MOD = 1e9+7;

int n, a[100000], cnt[3] = {};

int main(){
	scanf("%d", &n);
	REP(i, 0, n) scanf("%d", &a[i]);
	ll ans = 1;
	REP(i, 0, n){
		int pat = 0, pos = -1;
		REP(j, 0, 3) if(cnt[j]==a[i]) pat++, pos=j;
		if(pos>=0) cnt[pos]++;
		ans = ans * pat % MOD;
	}
	printf("%ld\n", ans);
	return 0;
}



Measured memory_bytes: 4220
S = input()
N = len(S)

# 先頭を0にするか1にするかで全てがきまる！！！！
count1 = 0
for i in range(N - 1):
    if S[0] == '0':
        if (i + 1) % 2 == 1 and S[i + 1] != '1':
            count1 += 1
        elif (i + 1) % 2 == 1 and S[i + 1] != '0':
            continue
        elif (i + 1) % 2 == 0 and S[i + 1] != '1':
            continue
        elif (i + 1) % 2 == 0 and S[i + 1] != '0':
            count1 += 1
    else:
        if (i + 1) % 2 == 1 and S[i + 1] != '0':
            count1 += 1
        elif (i + 1) % 2 == 1 and S[i + 1] != '1':
            continue
        elif (i + 1) % 2 == 0 and S[i + 1] != '0':
            continue
        elif (i + 1) % 2 == 0 and S[i + 1] != '1':
            count1 += 1

print(count1)



Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
using namespace std;

typedef long long ll;
typedef double db;
typedef long double ldb;

template<class T> inline void checkmin(T &a,const T &b){if(b<a) a=b;}
template<class T> inline void checkmax(T &a,const T &b){if(b>a) a=b;}

const int inf=1e9+10;
const int maxn=310;

db dp[maxn][maxn][maxn];
int n,cnt[5],w[maxn];

int main(){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&w[i]);
		cnt[w[i]]++;
	}
	for(int i=0;i<=n;i++){
		for(int j=0;i+j<=n;j++){
			for(int k=0;k+i+j<=n;k++){
				if(i==0&&j==0&&k==0) continue;
				db t1=0.0,t2=0.0,t3=0.0;
				if(i) t1=dp[i-1][j+1][k]*i;
				if(j) t2=dp[i][j-1][k+1]*j;
				if(k) t3=dp[i][j][k-1]*k;
				dp[i][j][k]=(t1+t2+t3+n)/(i+j+k);
			}
		}
	}
	printf("%.17f\n",dp[cnt[3]][cnt[2]][cnt[1]]);
	return 0;
}


Measured memory_bytes: 225536
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
#define pb push_back
const ll mod=1000000007;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

vec primefactorization(ll N){
  ll i=2;
  vec res;
  while(i*i<=N){
    while(!(N%i)){
      res.pb(i);
      N/=i;
    }
    i++;
  }
  if(N^1)res.pb(N);
  return res;
}

int main(){
  startupcpp();
  ll t,N,ans=0;
  cin>>N;
  map<ll,ll> lcmlist;
  while(N--){
    map<ll,ll> mp;
    cin>>t;
    vec v=primefactorization(t);
    for(auto x:v)mp[x]++;
    for(auto x:mp)chmax(lcmlist[x.first],x.second);
    //ans=sum(1/a_i);
    ans+=modinv(t);
  }
  ans%=mod;
  //ans*=lcm(all(a_i));
  for(auto x:lcmlist){
    ans=ans*modpow(x.first,x.second)%mod;
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 896
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=1000000+10,inf=0x3f3f3f;

vector<int>v[N];
bool f;
int co[N];
void dfs(int u,int fa,int ok)
{
    co[u]=ok;
    int p=ok^1;
    for(int i=0;i<v[u].size()&&!f;i++)
    {
        if(v[u][i]==fa)continue;
        if(!co[v[u][i]])dfs(v[u][i],u,p);
        else
        {
            if(co[v[u][i]]!=p)
            {
                f=1;
                return ;
            }
        }
    }
}
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        v[a].pb(b);
        v[b].pb(a);
    }
    f=0;
    dfs(1,-1,0);
    if(f)printf("%lld\n",(ll)n*(n-1)/2-m);
    else
    {
        int ans1=0,ans2=0;
        for(int i=1;i<=n;i++)
        {
            if(co[i]==0)ans1++;
            else ans2++;
        }
        printf("%lld\n",(ll)ans1*ans2-m);
    }
    return 0;
}


Measured memory_bytes: 6656
#include<stdio.h>
#include<math.h>
int main(void)
{
	double xa,xb,ya,yb,len;
	scanf("%lf %lf %lf %lf",&xa,&ya,&xb,&yb);
	len=sqrt((xb-xa)*(xb-xa)+(yb-ya)*(yb-ya));
	printf("%lf\n",len);
	return 0;   
}

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

#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	TEST(freopen("input.txt", "r", stdin));
	TEST(freopen("output.txt", "w", stdout));
	TEST(freopen("debug.txt", "w", stderr));
	int N, K;
	cin>>N>>K;
	cout<<(K<=(N+1)/2 ? "YES\n":"NO\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

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



int main() {

	string S;
	cin >> S;
	ll N = S.size();

	string ans = "No";

	rep(i, N - 1) {
		if (S[i] == 'A'&&S[i + 1] == 'C') { ans = "Yes"; }
	}

	cout << ans;
	
	

	system("PAUSE");
}


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


int main(){
    int C[9] = {};
    rep(i,9){
        cin >> C[i];
    }
    bool flag = false;
    rep(i,101){
        int b1 = C[0*3+0] - i;
        int b2 = C[0*3+1] - i;
        int b3 = C[0*3+2] - i;
        int a2 = C[1*3+0] - b1;
        int a3 = C[2*3+0] - b1;
        if(a2 == C[1*3+1] - b2 && a2 == C[1*3+2] - b3 &&
            a3 == C[2*3+1] - b2 && a3 == C[2*3+2] - b3){
            flag = true;
            break;
        }
    }

    cout <<  (flag ? "Yes" : "No") << endl;
}


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

ll i,j;
ll n,goal_weight;
ll w[105],v[105];
ll dp[105][100005];

ll fun(ll count,ll current_weight)
{
    if(count==n)
    return 0;
    
    if(dp[count][current_weight]!=-1)
    {
        return dp[count][current_weight];
    }

    ll ans=fun(count+1,current_weight);

    if(w[count]+current_weight<=goal_weight)
    {
        ans=max(ans,fun(count+1,current_weight+w[count])+v[count]);
    }

    return dp[count][current_weight]=ans;


}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    cin>>n>>goal_weight;

    memset(dp,-1,sizeof dp);

    for(i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    }

    cout<<fun(0,0)<<endl;
}


Measured memory_bytes: 85640
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(kbrni,v.size())cout<<" "<<v[kbrni];cout<<endl
#define sset(s) cout<<#s<<":";each(kbrni,s)cout<<" "<<kbrni;cout<<endl
#define smap(m) cout<<#m<<":";each(kbrni,m)cout<<" {"<<kbrni.first<<":"<<kbrni.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<P> vp;

const int MAX_N = 100005;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll a,b,c;
    cin >> a >> b >> c;
    if(a % 2 == 0 || b % 2 == 0 || c % 2 == 0){
        cout << "0\n";
    }else{
        cout << min(a*b,min(b*c,a*c)) << endl;
    }
    return 0;
}


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

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

int main() {
  vector<int> d(110);
  int N = 0;
  int tmp = 0;
  int count = 0;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> d.at(i);
  sort(d.rbegin(), d.rend()); 
  // rep(i,N) cout << d.at(i) << endl;
  for(int i =0; i < N; i++){
    if(i == 0){
      tmp = d.at(i);
      count += 1;
      // cout << tmp;
    }
    else if(tmp > d.at(i)){
      tmp = d.at(i);
      count += 1;
    }
  }
   cout << count << endl;
}

Measured memory_bytes: 256
# Anti-Division

A, B, C, D = map(int, input().split())


# 最大公約数
def gcd(C, D):
    while D != 0:
        C, D = D, C % D
    return C


w = B // C
x = B // D
y = (A - 1) // C
z = (A - 1) // D
a = B // (C * D // gcd(C, D))
b = (A - 1) // ((C * D) // gcd(C, D))

ans = (B - A + 1) - ((w - y) + (x - z) - (a - b))
print(ans)

Measured memory_bytes: 3444
i = int(input())
i = i % 10

if i == 2 or i == 4 or i == 5 or i == 7 or i == 9:
    print("hon")
elif i == 0 or i == 1 or i == 6 or i == 8:
    print("pon")
else:
    print("bon")

Measured memory_bytes: 9108
/* ex3_2
   moka223711 */

#include <stdio.h>

int main(void){
	int N, K, i = 1;
	scanf("%d %d", &N, &K);

	// NがK^i以上のとき、K進法はi桁で表せる
	// NをKで割り続けて何回割れるかをiでカウントする
	while(N >= K){
		N /= K;
		i++;
	}

	printf("%d", i);

	return 0;
}


Measured memory_bytes: 128
N, K = list(map(int,input().split()))
S = input()
ans = 0
for i in range(1, N):
    if S[i] == "R" and S[i - 1] == "R":  ans += 1
for i in range(1, N):
    if S[i] == "L" and S[i - 1] == "L":  ans += 1
ans = min(ans + 2 * K, N - 1)
print(ans)

Measured memory_bytes: 67576
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> //fixed << setprecision(10)

using namespace std;

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

typedef long long ll;
typedef vector<int> vi;

int main()
{
  ll n, k;
  cin >> n >> k;
  ll ans = n % k;
  if (ans > abs(ans - k))
  {
    ans = abs(ans - k);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

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

  ll dp[N+1];
  dp[0] = 2LL;
  dp[1] = 1LL;
  for(int i=2;i<=N;i++){
    dp[i] = dp[i-1] + dp[i-2];
  }

  cout << dp[N] << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

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


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,M,K,A[234567],B,res=0;
string S,T,U;

int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    for(long long int i = 0; i < N; i++){
        cin>>A[i];
        while(A[i]%2==0){
            res++;
            A[i]/=2;
        }
    }
    cout<<res<<endl;
}    


Measured memory_bytes: 384
-- modules to import --
import Data.ByteString.Char8
import Data.Maybe
import Prelude

-- functions for this task --

read_Integer     = Prelude.fst . Data.Maybe.fromJust . Data.ByteString.Char8.readInteger
read_ListInteger = Prelude.map read_Integer . Data.ByteString.Char8.words

get_Integer     = read_Integer     <$> Data.ByteString.Char8.getLine
get_ListInteger = read_ListInteger <$> Data.ByteString.Char8.getLine

task_A :: [Integer] -> ByteString
task_A [a, b] = Data.ByteString.Char8.pack $ if (Prelude.even $ a * b) then "Even" else "Odd"

-- main process is below --

main :: IO ()
main = do

        -- STEP.01
        -- read out the given string
        [a, b] <- get_ListInteger

        -- STEP.02
        -- output the answer of this task
        Data.ByteString.Char8.putStrLn $ task_A $ [a, b]

-- End of this source code --

Measured memory_bytes: 380
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
/*-------------------------------------------*/

int A, B;
int d[20][20];

int N, M;
int cost[101][101];

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

    cin >> A >> B;
    FOR(x, 1, A + 1) FOR(y, 1, B + 1) cin >> d[x][y];

    N = 202;
    M = 10401;

    rep(i, 101) rep(j, 101) FOR(x, 1, A + 1) FOR(y, 1, B + 1)
        chmax(cost[i][j], d[x][y] - i * x - j * y);

    FOR(x, 1, A + 1) FOR(y, 1, B + 1) {
        int mn = 1 << 30;
        rep(i, 101) rep(j, 101) chmin(mn, x * i + y * j + cost[i][j]);
        if(mn != d[x][y]) {
            cout << "Impossible\n";
            return 0;
        }
    }

    cout << "Possible\n";

    cout << N << " " << M << "\n";

    rep(i, 100) cout << i + 1 << " " << i + 2 << " X\n";
    rep(j, 100) cout << j + 102 << " " << j + 103 << " Y\n";

    rep(i, 101) rep(j, 101) cout << i + 1 << " " << N - j << " " << cost[i][j]
                                 << "\n";

    cout << "1 " << N << "\n";

    return 0;
}

Measured memory_bytes: 3688
using System;
using System.Globalization;

namespace ITP_4_B{
    public class Program{
        public static void Main(string[] args){
            string temp = Console.ReadLine();
            double r = Double.Parse(temp);

            Console.WriteLine(output(r*r*Math.PI)+" "+output(2*r*Math.PI));

        }
        private static string output(double value){
            return value.ToString("F6",CultureInfo.InvariantCulture);
        }
    }
}

Measured memory_bytes: 9216
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set> 
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue> 
using namespace std;
int main() 
{int a;
 cin>>a;
 int b[a];
 for (int i=0;i<a;i++)
 cin>>b[i];
 sort (b,b+a);
 int sum=0;
 for (int i=0;i<a-1;i++)
 sum+=b[i];
 sum+=b[a-1]/2;
 cout<<sum<<endl; 
 system("pause");
 return 0;  }

Measured memory_bytes: 504
n = gets.to_i
array = gets.chomp.split(" ").map(&:to_i)
target = 1

array.each_with_index do |number, idx|
  if number != target
    array[idx] = nil
  else
    target += 1
  end
end

puts n - array.compact.length if target != 1
puts "-1" if target == 1

Measured memory_bytes: 18052
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") // wonderful

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






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

    int n; cin >> n;
    string s1, s2; cin >> s1 >> s2;


    string res = "";
    int i = 0;
    while (n--) {
    	res += s1[i];
    	res += s2[i];
    	i++;
    }

    cout << res;
    return 0;
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H, W;
        int i, j;
        while (true) {
            H = sc.nextInt();
            W = sc.nextInt();
            if (H == 0 && W == 0) {
                break;
            }
            for (j = 0; j < H; j++) {
                for (i = 0; i < W; i++) {
                    if (j == 0 || j == H - 1) {
                        System.out.printf("#");
                    } else if (i == 0 || i == W - 1) {
                        System.out.printf("#");
                    } else {
                        System.out.printf(".");
                    }
                }System.out.printf("\n");
            }
            System.out.printf("\n");

        }
    }
}



Measured memory_bytes: 62072