akhauriyash/Code-Regression huggingface dataset:
import math

N = int(input())

position_list = [0]*N
for i in range(N):
    position_list[i] = list(map(int , input().split()))

ans = 0

for i in range(N):
    for j in range(N):
        if i != j:
            x_distance = position_list[i][0] - position_list[j][0]
            y_distance = position_list[i][1] - position_list[j][1]
            ans += math.sqrt(x_distance**2 + y_distance**2)

print(ans/N)




    



Measured memory_bytes: 62236
let rec seq a b = if a > b then [] else a :: seq (a+1) b
let it x = int_of_char x - 48
let () = Scanf.scanf "%s" @@ fun s ->
  let n = String.length s in
  seq 0 (n-3)
  |> List.map (fun i -> abs (100 * it s.[i] + 10 * it s.[i+1] + it s.[i+2] - 753))
  |> List.fold_left min 100000
  |> Printf.printf "%d\n"


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


class UnionFindTree():
    def __init__(self, N):
        self.N = N
        self.__parent_of = [None] * N
        self.__rank_of = [0] * N
        self.__size = [1] * N

    def root(self, value):
        if self.__parent_of[value] is None:
            return value
        else:
            self.__parent_of[value] = self.root(self.__parent_of[value])
            return self.__parent_of[value]

    def unite(self, a, b):
        r1 = self.root(a)
        r2 = self.root(b)
        if r1 != r2:
            if self.__rank_of[r1] < self.__rank_of[r2]:
                self.__parent_of[r1] = r2
                self.__size[r2] += self.__size[r1]
            else:
                self.__parent_of[r2] = r1
                self.__size[r1] += self.__size[r2]
                if self.__rank_of[r1] == self.__rank_of[r2]:
                    self.__rank_of[r1] += 1

    def is_same(self, a, b):
        return self.root(a) == self.root(b)

    def size(self, a):
        return self.__size[self.root(a)]

    def groups(self):
        groups = {}
        for k in range(self.N):
            r = self.root(k)
            if r not in groups:
                groups[r] = []
            groups[r].append(k)
        return [groups[x] for x in groups]


def main():
    N, M = map(int, input().split())
    uft = UnionFindTree(N)
    speakers = [[] for _ in range(M)]
    for i in range(N):
        langs = list(map(int, input().split()))
        for l in langs[1:]:
            speakers[l-1].append(i)
    for i in range(M):
        for j in range(1, len(speakers[i])):
            uft.unite(speakers[i][j-1], speakers[i][j])
    if len(uft.groups()) == 1:
        print("YES")
    else:
        print("NO")


if __name__ == "__main__":
    main()


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

using namespace std;

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

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


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

    int N, M;
    cin >> N >> M;
    
    vector<ll> x(N), y(N), z(N);

    for(int i = 0; i < N; i++){
        cin >> x[i] >> y[i] >> z[i];
    }

    ll ans = 0;
    for(int bit = 0; bit < (1 << 3); ++bit){
        
        vector<ll> flip_value(N);
        for(int i = 0; i < N; i++){
            flip_value[i] = 0;
            if(bit & (1 << 0)){
                flip_value[i] += x[i];
            }else{
                flip_value[i] -= x[i];
            }

            if(bit & (1 << 1)){
                flip_value[i] += y[i];
            }else{
                flip_value[i] -= y[i];
            }

            if(bit & (1 << 2)){
                flip_value[i] += z[i];
            }else{
                flip_value[i] -= z[i];
            }
        }

        sort(flip_value.begin(), flip_value.end(), greater<ll>());

        ll tmp_ans = 0;
        for(int i = 0; i < M; i++){
            tmp_ans += flip_value[i];
        }
        chmax(ans, tmp_ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void) {
	int n, k;
	int c = 0;
	int tall[100000];
	scanf("%d%d", &n, &k);
	for (int i = 0; i < n; i++) {
		scanf("%d", &tall[i]);
		if (tall[i] >= k) {
			c = c + 1;
		}
	}
	printf("%d", c);
	return 0;
}


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

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> VECLL;
typedef vector<P> VECP;
typedef priority_queue<P,VECP,greater<P> > PQP;
typedef priority_queue<ll, VECLL, greater<ll> > PQll;

#define rep(i,a,n) for(ll i = a;i < n;i++)   
#define rrep(i,a,n) for(ll i = n; i >= a;i--)
#define index_check(i,n) if(i > n-1 || i < 0) continue; 
#define LINF (ll)1e18
#define INF (int)1e9
#define fs first
#define sc second


int main(){
    ll l,r,d;
    cin >> l >> r >> d;
    cout << r/d - (l-1)/d << endl;
    return 0;
}

Measured memory_bytes: 3564
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
using namespace std;
typedef long long ll;

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    if (A == B && B != C) cout << "Yes" << endl;
    else if (B == C && C != A) cout << "Yes" << endl;
    else if (C == A && A != B) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;
use std::cmp::{min, max};
use std::rc::Rc;
use std::mem::swap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin_lock = stdin.lock();
    let s = stdin_lock
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}

static DX: &'static [i32] = &[0, 0, 1, -1];
static DY: &'static [i32] = &[1, -1, 0, 0];


fn main() {
    let x: Vec<i32> = (0..3).map(|_| read::<i32>()).collect();

    let m = x.iter().max().unwrap();

    let mut ans = 0;
    let mut cnt = 0;

    for n in x.iter() {
        ans += (m - n) / 2;

        if (m - n) % 2 != 0 {
            cnt += 1;
        }
    }

    ans += cnt / 2;

    if cnt % 2 != 0 {
        ans += (x.len() as i32 + 1) / 2;
    }

    println!("{}", ans);
}

Measured memory_bytes: 4352
n, k = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

DP = [False] * (k + 1)

for i in range(1, k+1):
    DP[i] = not all(DP[i-a] for a in A if i - a >= 0)

print('First' if DP[k] else 'Second')

Measured memory_bytes: 45532
#!/usr/bin/env python3
n = int(input())
s = [input() for _ in range(n)]
s.sort()
#print(s)
max_cnt = 0
dup_str = 1
cnt = 1
ans = [""] * n
for i in range(n-1):
    if s[i+1] == s[i]: cnt +=1
    else:
        if cnt > max_cnt:
            #print(i,s[i])
            max_cnt = cnt
            ans[0] = s[i] 
            dup_str = 1
        elif cnt == max_cnt:
            ans[dup_str] = s[i]
            dup_str += 1
        cnt = 1
    if i == n-2:
        if cnt > max_cnt:
            max_cnt = cnt
            ans[0] = s[i] 
        elif cnt == max_cnt:
            ans[dup_str] = s[i]
            dup_str += 1
        if max_cnt == 1 and cnt == 1:
            ans[n-1] = s[n-1]
            dup_str = n
#print(ans)
for i in range(dup_str):
    print(ans[i])




Measured memory_bytes: 20168
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

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

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int h, w; cin >> h >> w;
  vector<vector<char> > s(h, vector<char>(w));
  int ans = 0;
  REP(i, h) REP(j, w) {
    cin >> s[i][j];
    if (s[i][j] == '.') ++ans;
  }

  vector<vector<int> > dist(h, vector<int>(w, -1));
  dist[0][0] = 1;
  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));
  while (que.size() > 0) {
    pair<int, int> p = que.front(); que.pop();
    REP(i, 4) {
      int y = p.first + dy[i], x = p.second + dx[i];
      if (y>=0 && y<h && x>=0 && x<w) {
        if (s[y][x] == '.' && dist[y][x] == -1) {
          dist[y][x] = dist[p.first][p.second] + 1;
          que.push(make_pair(y, x));
        }
      }
    }
  }
  cout << ((dist[h-1][w-1] == -1)? -1 : ans-dist[h-1][w-1]) << "\n";
  return 0;
}


Measured memory_bytes: 256
array = []
while True:
    n = input()
    if n == "0 0":
        break
    array.append(n.split())
for i in range(len(array)):
    for i2 in range(int(array[i][0])):
        for i3 in range(int(array[i][1])):
            if i3 == int(array[i][1])-1:
                print("#")
            else:
                print("#",end="")
    print("")

Measured memory_bytes: 8884
parseInt(x) = parse(Int, x)
parseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)

function main()
  n = readline() |> parseInt
  s=Array{String}(n)
  for i in 1:n
    s[i]=readline() |> strip
  end

  x=zeros(Int,n)
  for i in 1:n
    x[i]=map(collect(s[i])) do c
      10^(Int(c)-Int('a'))
    end|>sum
  end
  sort!(x)
  y=0
  prev=x[1]
  z=1
  for i in 2:n
    if prev==x[i]
      z+=1
    else
      y+=z*(z-1)÷2
      prev=x[i]
      z=1
    end
  end
  y+=z*(z-1)÷ 2

  println(y)
end

main()


Measured memory_bytes: 167684
import sys
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17

n = int(input())
ans = 0
ans = n // 500 * 1000
n %= 500
ans += n // 5 * 5
print(ans)


Measured memory_bytes: 38388
#include <bits/stdc++.h>
#define REP(i,n) for (long i=0;i<(n);i++)
#define FOR(i,a,b) for (long i=(a);i<(b);i++)
#define RREP(i,n) for(long i=n;i>=0;i--)
#define RFOR(i,a,b) for(long i=(a);i>(b);i--)
#define dump1d_arr(array) REP(i,array.size()) cerr << #array << "[" << (i) << "] ==> " << (array[i]) << endl;
#define dump2d_arr(array) REP(i,array.size()) REP(j,array[i].size()) cerr << #array << "[" << (i) << "]" << "[" << (j) << "] ==> " << (array[i][j]) << endl;
#define dump(x)  cerr << #x << " => " << (x) << endl;
#define CLR(vec) { REP(i,vec.size()) vec[i] = 0; } 
#define llINF (long long) 9223372036854775807
#define loINF (long) 2147483647
#define shINF (short) 32767
#define SORT(c) sort((c).begin(),(c).end())
#define MIN(vec) *min_element(vec.begin(), vec.end());
#define MAX(vec) *max_element(vec.begin(), vec.end());
#define UNIQ(vec) vec.erase(unique(vec.begin(), vec.end()),vec.end());
#define IN(n,m)  (!(m.find(n) == m.end()))
#define TO_INT(vec,s) REP(i,s.length()){vec.push_back(s[i] - ‘0’);}
#define ENUM_v(vec) for (auto e : vec)
#define dump_MAP(m) for(auto itr = m.begin(); itr != m.end(); ++itr) { cerr << itr->first << " --> "  << itr->second << endl; }

using namespace std;
typedef vector<long> VI;
typedef vector<VI> VVI;
// to:次の頂点,cap:辺の重み,rev:逆辺のindex
struct edge {long to,cap,rev;};
class Ford_fulkerson {
private:
	vector<vector<edge>> E;
	vector<bool> used;
	size_t V;
public:
	Ford_fulkerson() : V(0) { }

	Ford_fulkerson(size_t v) :
		E(v,vector<edge>(0)),used(v,false),V(v){ }

	size_t size() { return V;}

	void add_edge(long from,long to,long cap){
		E[from].push_back({to,cap,(long)E[to].size()});
		E[to].push_back({from,0,(long)E[from].size()-1});
	}

	long dfs(long node,long goal,long flow){
		if (node == goal) return flow;
		used[node] = true;
		REP(i,E[node].size()){
			edge* e = &E[node][i];
			if (!used[e->to] && e->cap != 0){
				long d = dfs(e->to,goal,min(flow,e->cap));
				if (d != 0) {
					e->cap -= d;
					E[e->to][e->rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	long max_flow(long start,long goal){
		long ans = 0;
		while (1){
			REP(i,used.size()) used[i] = false;
			long f = dfs(start,goal,2147483647);
			if (f == 0) return ans;
			ans += f;
		}
	}
};

// 入力例
int main(void){
	long N;
	cin >> N;
	Ford_fulkerson ff((2*N)+2);
	VI a(N,0),b(N,0),c(N,0),d(N,0);
	REP(i,N) cin >> a[i] >> b[i];
	REP(i,N) {
		cin >> c[i] >> d[i];
		REP(j,N){
			if (a[j] < c[i] && b[j] < d[i]) ff.add_edge(i,N+j,1);
		}
	}

	REP(i,N) {
		ff.add_edge(2*N,i,1);
		ff.add_edge(N+i,2*N+1,1);
	}

	cout << ff.max_flow(2*N,2*N+1) << endl;

	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>

int main(){
	
	int d,n,temp=1;
	fscanf(stdin, "%d %d", &d, &n);
	switch(d){
		case 2:
			temp *= 100;
		case 1:
			temp *= 100;
	}
	if(n==100){
		n += 1;
	}
	printf("%d\n", n*temp);
	return 0;
}

Measured memory_bytes: 128
pub fn main() {
    use std::collections::BinaryHeap;
    use std::collections::VecDeque;
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let nda = s
        .split_whitespace()
        .map(|w| w.parse().unwrap())
        .collect::<Vec<i64>>();
    let n = nda[0];
    let d = nda[1];
    let a = nda[2];
    let mut heap = BinaryHeap::with_capacity(n as usize);
    for _ in 0..n {
        s.clear();
        std::io::stdin().read_line(&mut s).unwrap();
        let xh = s
            .split_whitespace()
            .map(|w| w.parse().unwrap())
            .collect::<Vec<i64>>();
        heap.push((xh[0], xh[1]));
    }
    let mut count = 0;
    let mut damage = 0;
    let mut queue: VecDeque<(i64, i64)> = VecDeque::new();
    while !heap.is_empty() {
        if queue.is_empty() || heap.peek().unwrap().0 >= queue.front().unwrap().0 {
            let (x, h) = heap.pop().unwrap();
            if h > damage {
                let q = (h - damage + a - 1) / a;
                count += q;
                damage += q * a;
                queue.push_back((x - 2 * d, q * a));
            }
        } else {
            let (_, h) = queue.pop_front().unwrap();
            damage -= h;
        }
    }
    println!("{}", count);
}

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

using namespace std;

const int INF = 1 << 30;

struct edge
{
  int to, cost;
};

int main()
{
  int N, M, D[50], E[50];
  int dp[50][50][1 << 10];

  while(scanf("%d %d", &N, &M), N) {
    vector< edge > gg[50], rg[50];
    D[0] = E[0] = D[N - 1] = 0, E[N - 1] = 1000;
    int comp[1001] = {}, rev[50];
    for(int i = 1; i < N - 1; i++) {
      scanf("%d %d", &D[i], &E[i]);
    }
    for(int i = 0; i < N; i++) {
      rev[i] = comp[E[i]]++;
    }

    for(int i = 0; i < M; i++) {
      int a, b, c;
      scanf("%d %d %d", &a, &b, &c);
      --a, --b;
      if(E[a] <= E[b]) gg[a].emplace_back((edge) {b, c});
      if(E[b] <= E[a]) rg[b].emplace_back((edge) {a, c});
    }

    using T = tuple< int, int, int, int >;
    priority_queue< T, vector< T >, greater< >> que;
    fill_n(**dp, 50 * 50 * (1 << 10), INF);
    dp[0][0][0] = 0;
    que.emplace(0, 0, 0, 0);

    auto push = [&](int latte, int malta, int beet, int cost)
    {
      if(cost < dp[latte][malta][beet]) {
        dp[latte][malta][beet] = cost;
        que.emplace(cost, latte, malta, beet);
      }
    };

    bool reach = false;

    while(!que.empty()) {
      int latte, malta, beet, cost;
      tie(cost, latte, malta, beet) = que.top();
      que.pop();
      if(latte == N - 1 && malta == N - 1) {
        printf("%d\n", cost);
        reach = true;
        break;
      }
      for(auto &e : gg[latte]) {
        if(E[e.to] < E[malta]) {
          push(e.to, malta, beet, cost + e.cost + D[e.to]);
        } else if(E[e.to] == E[malta] || E[latte] == E[e.to]) {
          if((beet >> rev[e.to]) & 1) push(e.to, malta, beet, cost + e.cost);
          else push(e.to, malta, beet | (1 << rev[e.to]), cost + e.cost + D[e.to]);
        } else {
          push(e.to, malta, 1 << rev[e.to], cost + e.cost + D[e.to]);
        }
      }

      for(auto &e : rg[malta]) {
        if(E[e.to] < E[latte]) {
          push(latte, e.to, beet, cost + e.cost + D[e.to]);
        } else if(E[e.to] == E[latte] || E[malta] == E[e.to]) {
          if((beet >> rev[e.to]) & 1) push(latte, e.to, beet, cost + e.cost);
          else push(latte, e.to, beet | (1 << rev[e.to]), cost + e.cost + D[e.to]);
        } else {
          push(latte, e.to, 1 << rev[e.to], cost + e.cost + D[e.to]);
        }
      }
    }

    if(!reach) puts("-1");
  }

}

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

int acard[200];
int bcard[200];
int n,m,k;

void inicard()
{
	for(int i=0;i<2*n;i++){
		acard[i] = i+1;
	}
}

void copycard()
{
	for(int i=0;i<2*n;i++){
		acard[i] = bcard[i];
	}
}

void cut()
{
	for(int i=0;i<2*n-k;i++){
		bcard[i] = acard[k+i];
	}
	for(int j=2*n-k;j<2*n;j++){
		bcard[j] = acard[k-2*n+j];
	}
	copycard();
}

void rif()
{
	for(int i=0;i<n;i++){
		bcard[2*i] = acard[i];
	}
	for(int i=0;i<n;i++){
		bcard[2*i+1] = acard[n+i];
	}
	copycard();
}

void showcard()
{
	for(int i=0;i<2*n;i++){
		cout << acard[i] << endl;
	}
}

int main()
{
	cin >> n;
	inicard();
	cin >> m;
	for(int i=0;i<m;i++){
		cin >> k;
		if(k==0){
			rif();
		}else{
			cut();
		}
	}
	showcard();
	return 0;
}

Measured memory_bytes: 0
<?php
    $num = array_map('intval',str_split(trim(fgets(STDIN))));
    // var_dump($num);
    
    $a = end($num);
    
    // echo $a."\n";
    if($a==3){
        echo "bon\n";
    }elseif($a==0 || $a==1 || $a==6 || $a==8){
        echo "pon\n";
    }else{
        echo "hon\n";
    }
    
    
    
    
    
?>

Measured memory_bytes: 16056
#include <stdio.h>

void sort(int *a){
	int i,j,tmp;

	for(i = 0;i < 4;i++){
		for(j = i+1;j < 5;j++){
			if(a[i] > a[j]){
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			}
		}
	}
}

int isstraight(int *a){
	int i,flag;

	if(a[0] == 1 && a[1] == 10){
		flag = 1;
		for(i = 1;i < 4;i++){
			if(a[i]+1 != a[i+1]){
				flag = 0;
				break;
			}
		}
		if(flag){
			return 1;
		}
	}

	flag = 1;
	for(i = 0;i < 4;i++){
		if(a[i]+1 != a[i+1]){
			flag = 0;
			break;
		}
	}

	if(flag){
		return 1;
	}else{
		return 0;
	}
}

int yaku(int *a){
	int i,tmp,data,cnt;

	i = 0;
	data = 0;
	while(i < 5){
		tmp = a[i];
		i++;
		cnt = 1;
		data *= 10;
		while(1){
			if(i == 5){
				break;
			}else if(tmp != a[i]){
				break;
			}
			i++;
			cnt++;
		}
		data += cnt;
	}

	return data;
}

int check(int *a){
	int data;

	if(isstraight(a)){
		return 5;
	}

	data = yaku(a);

	if(data == 1112 || data == 1121 || data == 1211 || data == 2111){
		return 2;
	}else if(data == 122 || data == 212 || data == 221){
		return 3;
	}else if(data == 113 || data == 131 || data == 311){
		return 4;
	}else if(data == 23 || data == 32){
		return 6;
	}else if(data == 14 || data == 41){
		return 7;
	}else{
		return 1;
	}
}

int main(){
	int card[5];

	while(scanf("%d,%d,%d,%d,%d",&card[0],&card[1],&card[2],&card[3],&card[4]) != EOF){
		sort(card);
		switch(check(card)){
			case 1:
				printf("null\n");
				break;
			case 2:
				printf("one pair\n");
				break;
			case 3:
				printf("two pair\n");
				break;
			case 4:
				printf("three card\n");
				break;
			case 5:
				printf("straight\n");
				break;
			case 6:
				printf("full house\n");
				break;
			case 7:
				printf("four card\n");
				break;
		}
	}

	return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#pragma GCC optimize "Ofast,omit-frame-pointer,inline"
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;



int main() {

	string s;
	cin >> s;
	cout << s[0] << s[1] << s[2] << endl;



}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
int main(){
  int X,Y,Z,s;
  cin >> X >> Y >> Z;
  s=X;
  X=Y;
  Y=s;
  
  s=Z;
  Z=X;
  X=s;
  cout <<X << " "<< Y << " "<< Z<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define mid ((x + y) / 2)
#define left (ind * 2)
#define right (ind * 2 + 1)
#define mp make_pair
#define timer ((double)clock() / CLOCKS_PER_SEC)
#define endl "\n"
#define spc " "
#define d1(x) cerr<<#x<<":"<<x<<endl
#define d2(x, y) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<endl
#define d3(x, y, z) cerr<<#x<<":"<<x<<" "<<#y<<":"<<y<<" "<<#z<<":"<<z<<endl
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define double long double
using namespace std;

typedef long long int lli;
typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef pair<double, double> dd;

const int N = (int)(1e6 + 5);
const int LOG = (int)(20);

double f(double n, double a, double d) {
	if(n == 0)
		return 0;
	double a_new = (4 * a + 5 * d + a * (2 * n - 2)) / (2 * n);
	double a_d_new = (2 * (a + 3 * d) + 3 * a + 6 * d + (a + d) * (2 * n - 3)) / (2 * n);
	double ball_dis = a + d * (2 * n - 1) / 2;

	return ball_dis + f(n - 1, a_new, a_d_new - a_new);
}

double n, a, d;

int main() {
	fast_io();
	// freopen("inp.in", "r", stdin);
	
	cin >> n >> a >> d;
	cout << fixed << setprecision(9) << f(n, a, d);
}

Measured memory_bytes: 15872
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort(reverse=True)

alice_sum = 0
bob_sum = 0
for i in range(n):
    if i % 2 == 0:
        alice_sum += a_list[i]
    else:
        bob_sum += a_list[i]

print(alice_sum - bob_sum)


Measured memory_bytes: 3060
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String X = sc.next();
        String Y = sc.next();
        char x = X.charAt(0);
        char y = Y.charAt(0);
        sc.close();
        
        if(x < y) {
            System.out.println("<");
        }else if(x > y) {
            System.out.println(">");
        }else{
            System.out.println("=");
        }
    }
}

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

using namespace std;

int jamil[69][69];
int ha;

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


	for(int i=0;i<10;i++)
        for(int j=0;j<10;j++)
            cin>>jamil[i][j];


	for(int k=0;k<10;k++)
        {for(int i=0;i<10;i++)
            {for(int j=0;j<10;j++)
                {jamil[i][j]=min(jamil[i][k]+jamil[k][j],jamil[i][j]);}}}

	for(int i=0;i<n;i++)
        {for(int j=0;j<m;j++)
            {int x;cin>>x;
                if(x==-1)continue;
                else {ha+=jamil[x][1];}}}

	cout<<ha;

return 0;
}
//  LoL


Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
void solve() {
	int n; cin >> n;
	vector<int> a(n), ans(n);
	vector<bool> push_flg(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		a[i]--;
		ans[i] = 0;
		push_flg[i] = false;
	}
	ans[0] = 1;
	int idx = a[0];
	int cnt = 0;
	while(!push_flg[idx]) {
		cnt++;
		if (idx == 1) {
			cout << cnt << endl;
			return;
		}
		push_flg[idx] = true;
		ans[idx] = 0;
		ans[a[idx]] = 1;
		idx = a[idx];
	}
	cout << -1 << endl;
	return;
}
int main() {
	solve();
	return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();
        if(s.equals(u)) a--;
        if(t.equals(u)) b--;
        System.out.println(a + " " + b);
        sc.close();

    }

}


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

using namespace std;
typedef long long LL;

const int MAXN = 2E5 + 5;

LL n, q, type, x;
LL ans;

struct Node {
    int lson, rson;
    int l, r, mi, lazy;
} tr[MAXN * 8];

int root1, root2;

void update(int id) { tr[id].mi = min(tr[tr[id].lson].mi, tr[tr[id].rson].mi); }

void pushdown(int id) {
    if (tr[id].lazy != n) {
        tr[tr[id].lson].mi = min(tr[tr[id].lson].mi, tr[id].lazy);
        tr[tr[id].lson].lazy = min(tr[tr[id].lson].lazy, tr[id].lazy);
        tr[tr[id].rson].mi = min(tr[tr[id].rson].mi, tr[id].lazy);
        tr[tr[id].rson].lazy = min(tr[tr[id].rson].lazy, tr[id].lazy);
        tr[id].lazy = n;
    }
}

void build(int& id, int l, int r) {
    static int tot;
    id = ++tot;
    tr[id].l = l, tr[id].r = r;
    tr[id].lazy = n;
    if (l == r) {
        tr[id].mi = n;
        return;
    }
    int mid = l + r >> 1;
    build(tr[id].lson, l, mid);
    build(tr[id].rson, mid + 1, r);
    update(id);
}

void modify(int id, int l, int r, int val) {
    if (tr[id].mi < val) return;
    if (tr[id].l == l && tr[id].r == r) {
        tr[id].mi = min(tr[id].mi, val);
        tr[id].lazy = min(tr[id].lazy, val);
        return;
    }
    pushdown(id);
    int mid = tr[id].l + tr[id].r >> 1;
    if (r <= mid)
        modify(tr[id].lson, l, r, val);
    else if (l > mid)
        modify(tr[id].rson, l, r, val);
    else {
        modify(tr[id].lson, l, mid, val);
        modify(tr[id].rson, mid + 1, r, val);
    }
    update(id);
}

int query(int id, int x) {
    if (tr[id].l == x && tr[id].r == x) {
        return tr[id].mi;
    }
    pushdown(id);
    int mid = tr[id].l + tr[id].r >> 1;
    if (x <= mid)
        return query(tr[id].lson, x);
    else
        return query(tr[id].rson, x);
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin >> n >> q;
    ans = (n - 2) * (n - 2);
    build(root1, 1, n);
    build(root2, 1, n);
    for (int i = 1; i <= q; i++) {
        cin >> type >> x;
        if (type == 1) {
            int now = query(root1, x);

            ans -= now - 2;
            modify(root2, 2, now - 1, x);
        } else {
            int now = query(root2, x);

            ans -= now - 2;
            modify(root1, 2, now - 1, x);
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 22444
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<s32>
#define p32 pair<int,int>
#define p64 pair<ll,ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream& operator<<(ostream& out, const pair<T,U>& p){
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename ...Args>
void print_container(const ContainerType<ValueType, Args...>& c){
	cout << "{ ";
	for(const auto& v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

const int N = 6e4;

int main()
{
	FASTIO;
	int n;
	cin >> n;
	for(int i = 0;i < N;i++){
		if(floor(1.08 * i) == n){
			cout << i << ln;
			return 0;
		}
	}
	cout << ":(" << ln;
	return 0;
}


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

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long> vll;
typedef pair<int, int> pi;
typedef pair<long long, long long> pll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpll;

#define F first
#define S second
#define PB push_back
#define MP make_pair

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

    for (int i = 0; i < m; i++) {
        cin >> a;
        n -= a;
    }

    cout << max(-1, n) << endl;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
		using namespace std;
		
		typedef long long ll;
		#define pi 3.14159265 
		#define EPS 1e-8
		
		#define mod 1000000007
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"

		const ll INF=(ll)2e18;
		
		long long binpow(long long a, long long b, long long m) {
		a %= m;
		long long res = 1;
		while (b > 0) {
			if (b & 1)
				res = res * a % m;
			a = a * a % m;
			b >>= 1;
		}
		return res;
		}
		
		
		int main()
		{
			 ios_base::sync_with_stdio(false);
			 cin.tie(NULL);
			
			ll n,k;
			cin>>n>>k;
			n=n%k;
			cout<<min(k-n,n);
		}


Measured memory_bytes: 256
while True:
  n = int(input())
  if n == 0:
    break
  a = 0
  b = 0
  for _ in range(n):
    s1,s2 = map(int,input().split())
    if s1 > s2:
      a += (s1 + s2)
    elif s2 > s1:
      b += (s1 + s2)
    else:
      a += s1
      b += s2
  print(a,b)



Measured memory_bytes: 5612
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

int main()
{
    int n;
    int a[110];
    cin >> n;
    REP(i, n)
    cin >> a[i];

    sort(a, a + n);
    cout << a[n - 1] - a[0] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

const int MAX = 100001;
const int MOD = 1000000007;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

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

  int x, y;
  cin >> x >> y;

  int ans = x + y / 2;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <cstdio>

using namespace std;

int main(){
    int q;
    scanf("%d",&q);
    vector<long long int> vi;
    while(q--){
        long long x,k;
        scanf("%lld",&x);
        if(x == 2) {
            if(!vi.empty())
                vi.pop_back();
        }
        else if(x == 1){
            scanf("%lld",&k);
            if(!vi.empty())
                printf("%lld\n",vi[k]);
        }
        else{
            scanf("%lld",&k);
            vi.push_back(k);
        }
    }
    
}


Measured memory_bytes: 4512
#include <iostream>
using namespace std;
int main(){
    int n;cin>>n;
    int odd=0;
    int even=0;
    for(int i=0;i<n;i++){
        int num;
        cin>>num;
        if(num%2)odd++;
        else even++;
    }
    if(odd%2){
        cout<<"NO";
    }
    else{
        cout<<"YES";
    }
    
    return 0;
}

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

#define int long long
#define pb push_back
#define ub upper_bound
#define lb upper_bound
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>

using ll = long long;
const ll INF = LLONG_MAX/4 - 100;
ll mod = 1e9 + 7;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;

class fact {
public:
    int fmod = 1e9+7;
    vector<int> fac, inv;
    fact (int n, int Mod = 1e9+7) {
        fmod = Mod;
        fac = vector<int>(n,0);
        inv = vector<int>(n,0);
        fac[0] = 1; for (int i = 1; i < n; i++) fac[i] = fac[i-1] * i % fmod;
        for (int i = 0;i < n;i++) inv[i] = fact::POW(fac[i],fmod-2);
    }
    ll nCr(ll n, ll r) {return (fac[n] * inv[r] % fmod) * inv[n-r] % fmod;}
    ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%fmod;}a = a * a%fmod; b >>= 1;}return c;}
};

template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++)cout<<a[i]<<" ";cout<<endl;}
void EMP(int x) {cout<<"!!!"<<x<<"!!!"<<endl;}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1; while (b > 0) {if (b & 1) {c = a * c%mod;}a = a * a%mod; b >>= 1;}return c;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool isSqrt(ll a) {return pow(sqrt(a),2) == a ? 1 : 0;}
void YesNo(bool a) {if (a) cout << "Yes"; else cout << "No"; cout << endl;}
void yesno(bool a) {if (a) cout << "yes"; else cout << "no"; cout << endl;}
void YESNO(bool a) {if (a) cout << "YES"; else cout << "NO"; cout << endl;}

vector<int> koho = {0,1};
int dp[110000];
int nxt[110000];

void solve() {
    int n; cin >> n;
    FOR (i,1,21) {
        if (pow(6,i) < 100000) {
            koho.pb(pow(6,i));
        }
        if (pow(9,i) < 100000) {
            koho.pb(pow(9,i));
        }
    }
    dp[0] = 1;
    REP (i,110000) {
        REP (j,110000) {
            for (auto&& A : koho) {
                if (j + A >= 110000) continue;
                if (dp[j]) nxt[j+A] = 1;
            }
        }
        if (nxt[n]) {
            cout << i + 1 << endl;
            return;
        }
        REP (j,110000) {
            dp[j] = nxt[j];
        }
    }
}

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


Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,K;
  int sum;
  cin >> N;
  cin >> K;
  for(int i = 1;i<=N;i++){
	int x;
    cin >> x;
    if(x > abs(K-x)){
      sum += 2*abs(K-x);
    }else{
      sum += 2*x;
    }
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#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 (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
 

vector <int > H;
int N; 
string S;

int main()
{
  cin >> N >> S;
  int ans = 1;
  int before = S[0];
  FOR(i,1,N){
    if(S[i] == before) continue;
    ans++;
    before = S[i];
  }
  cout << ans;
}


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

int main(){
    ll A,B,Q;
    cin >> A >> B >> Q;
    vector<ll> shrine(A + 2);
    vector<ll> temple(B + 2);
    vector<ll> x(Q);
    rep(i,A){
        cin >> shrine[i + 1];
    }
    shrine[0] = -10000000000000;
    shrine[A + 1] = 10000000000000;
    rep(i,B){
        cin >> temple[i + 1];
    }
    temple[0] = -10000000000000;
    temple[B + 1] = 10000000000000;
    rep(i,Q){
        cin >> x[i];
    }
    rep(i,Q){
        ll ans = 10000000000000;
        vector<ll>::iterator itr1 = lower_bound(all(shrine), x[i]);
        ll s1 = *itr1;
        ll s2 = shrine[itr1 - shrine.begin() - 1];
        ll ans1 = abs(x[i] - s1);
        ll ans2 = abs(x[i] - s1);
        ll ans3 = abs(x[i] - s2);
        ll ans4 = abs(x[i] - s2);
        vector<ll>::iterator itr2 = lower_bound(all(temple), s1);
        vector<ll>::iterator itr3 = lower_bound(all(temple), s2);
        ll s3 = *itr2;
        ll s4 = temple[itr2 - temple.begin() - 1];
        ll s5 = *itr3;
        ll s6 = temple[itr3 - temple.begin() - 1];
        ans1 += abs(s1 - s3);
        ans2 += abs(s1 - s4);
        ans3 += abs(s2 - s5);
        ans4 += abs(s2 - s6);
        
        ans = min(ans, min(ans1, min(ans2, min(ans3, ans4))));
        
        vector<ll>::iterator itr5 = lower_bound(all(temple), x[i]);
        ll s7 = *itr5;
        ll s8 = temple[itr5 - temple.begin() - 1];
        ll ans5 = abs(x[i] - s7);
        ll ans6 = abs(x[i] - s7);
        ll ans7 = abs(x[i] - s8);
        ll ans8 = abs(x[i] - s8);
        vector<ll>::iterator itr6 = lower_bound(all(shrine), s7);
        vector<ll>::iterator itr7 = lower_bound(all(shrine), s8);
        ll s9 = *itr6;
        ll s10 = shrine[itr6 - shrine.begin() - 1];
        ll s11 = *itr7;
        ll s12 = shrine[itr7 - shrine.begin() - 1];
        ans5 += abs(s7 - s9);
        ans6 += abs(s7 - s10);
        ans7 += abs(s8 - s11);
        ans8 += abs(s8 - s12);
        
        ans = min(ans, min(ans5, min(ans6, min(ans7, ans8))));
        
        cout << ans << endl;
    }
}


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

int main(){
  int n,k,d,s,ans;
  cin >> n >> k;
  vector<int> sunuke(n);
  for(int i=0;i<k;i++){
    cin >> d;
    for(int j=0;j<d;j++){
      cin >> s;
      sunuke.at(s-1)++;
    }
  }
  
  sort(sunuke.begin(),sunuke.end());
  for(int i=0;i<n;i++){
    if(sunuke.at(i) >0){
      ans = i;
      break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
using namespace std;

int main(void) {
	int x,a,b;

	cin >> x, cin >> a, cin >> b;

	x = x - a;
	x = x % b;
	cout << x;

	return 0;
}

Measured memory_bytes: 256
/*
    ||S|A|M|R|A|T||
    Author:codingsamrat
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define int long long 
#define ld long double
#define INF LONG_MAX
#define pb push_back
#define gcd __gcd
#define f(i,a,b) for(int i=a;i<b;i++)
#define fe(i,a,b) for(int i=a;i<=b;i++)
#define vii vector<int>
#define vll vector<long long>
typedef long long  ll;

ll bpow(ll a, ll b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

int32_t main()
{	ios_base::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
//	#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
//    #endif
	ll test=1;
//	cin>>test;
	while(test--)
	{
	ll n,l;
	cin>>n>>l;
	string s[n];
	f(i,0,n)
	{
		cin>>s[i];
	}
	sort(s,s+n);
	string final="";
	f(i,0,n)
	final+=s[i];
	
	//sort(final.begin(),final.end());
	cout<<final;
		
	}
     
return 0;

}


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

ll MOD=ll(1e9)+7;

int main(){

  ll N,K;
  cin>>N>>K;
  
  ll A[N];
  rep(i,N){
    cin>>A[i];
  }
  ll count=0;
  ll count2=0;
  
  rep(i,N-1){
  for(int j=i+1;j<N;j++){

      if( A[i]>A[j] )count++;

      if( A[j]>A[i] )count2++;
               
    }
  }

  if(K==1){cout<<count<<endl;return 0;}
  ll ans=(K*(K+1)/2%MOD*count+(K-1)*K/2%MOD*count2%MOD)%MOD;
 
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<set>
#include<string>

using namespace std;

string message[] = {"Opened by ","Closed by "};
int cnt;
int main() {
    int n,m;
    set<string> data;
    cin>>n;
    for(int i=0;i<n;i++) {
        string ss; cin>>ss;
        data.insert(ss);
    }

    cin>>m;
    for(int i=0;i<m;i++) {
        string ss; cin>>ss;
        if(data.find(ss) == data.end()) {
            cout<<"Unknown "<<ss<<endl;
        }
        else {
            cout<<message[cnt%2]<<ss<<endl;
            cnt++;
        }
    }

    return 0;
}

Measured memory_bytes: 1240
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>

using namespace std;

#define INF 1e+9
#define mp make_pair
#define pb push_back
#define fi first
#define fs first
#define se second
#define i64 long long
#define li long long
#define lint long long
#define pii pair<int, int>
#define vi vector<int>

#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define fore(i, b, e) for (int i = (int)b; i <= (int)e; i++)

int main() {
#ifdef LOCAL
    freopen("inp", "r", stdin);
    //freopen("outp", "w", stdout);
#else
    // freopen(TASKNAME ".in", "r", stdin);
    // freopen(TASKNAME ".out", "w", stdout);
#endif
    int n;
    scanf("%d", &n);
    int ans = 0;
    forn(i, n) {
        int x;
        scanf("%d", &x);
        while(x % 2 == 0) {
            x /= 2;
            ans++;
        }
    }
    printf("%d", ans);
}



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

namespace ConsoleApp36 {
    class Program {
        static void Main(string[] args) {
            var X = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToArray();
            int N = X[0];
            int K = X[1];

            int[] l = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToArray();
            //lをソートする
            Array.Sort(l);
            Array.Reverse(l);

            int ans = 0;

            for (int i = 0; i < K; i++) {
                ans += l[i];
            }

            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13780
using System;
using System.Text;

namespace AOJ.Volume0
{
    public class Orthogonal
    {
        public static int Main()
        {
            var output = new StringBuilder();
            while (true)
            {
                string tmp = Console.ReadLine();
                if (string.IsNullOrEmpty(tmp)) { break; }

                var input = tmp.Split(' ');
                decimal xa = decimal.Parse(input[0]);
                decimal ya = decimal.Parse(input[1]);
                decimal xb = decimal.Parse(input[2]);
                decimal yb = decimal.Parse(input[3]);
                decimal xc = decimal.Parse(input[4]);
                decimal yc = decimal.Parse(input[5]);
                decimal xd = decimal.Parse(input[6]);
                decimal yd = decimal.Parse(input[7]);

                // 2?????????????????????(0,0)???????????????(x1, y1)??¨(x2, y2)??§??´?????????
                decimal x1 = xb - xa;
                decimal y1 = yb - ya;
                decimal x2 = xd - xc;
                decimal y2 = yd - yc;

                // ??????????±???????
                decimal n = (x1 * x2) + (y1 * y2);
                if(n == 0.0m) { output.AppendLine("YES"); }
                else { output.AppendLine("NO"); }
            }

            Console.Write(output);
            return 0;
        }
    }
}

Measured memory_bytes: 9288
#include <iostream>
#include <vector>
#include<string>
#include<cstdio>
#include <algorithm>
#include<complex>
#include<map>
using namespace std;

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


int main() {
	int n;
	map<int, int> a;
	while (cin>>n)
	{
		int cnt = 0;
		for(int i=1;i<=n;i++) {
			cin >> a[i];
		}
		for(int i=1;i<=n;i++) {
			if (i == a[a[i]])cnt++;
		}
		cout << cnt/2 << endl;
	}
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <complex>
#include <regex>
#include <cassert>
#include <random>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
//#define P pair<ll, ll>

using ld = double;
using P = complex<ld>;
using G = vector<P>;
const ld pi = acos(-1);
const ld eps = 1e-10;
const ld inf = 1e12;

ld cross(const P & a, const P & b) { return a.real() * b.imag() - a.imag() * b.real(); }
ld dot(const P & a, const P & b) { return a.real() * b.real() + a.imag() * b.imag(); }

using C = pair<ld, P>;
#define rad first
#define pnt second

C smallest_enclosing_disc(vector<P> ps) {
	auto c3 = [](const P& a, const P& b, const P& c) {
		ld A = norm(b - c);
		ld B = norm(c - a);
		ld C = norm(a - b);
		ld S = abs(cross(b - a, c - a));
		P p = (A * (B + C - A) * a + B * (C + A - B) * b + C * (A + B - C) * c) / (4 * S * S);
		ld r = abs(p - a);
		return make_pair(r, p);
	};

	auto c2 = [](const P& a, const P& b) {
		P c = (a + b) / (ld)2;
		ld r = abs(a - c);
		return make_pair(r, c);
	};

	auto in_circle = [](const P& a, const C& c) {
		return norm(a - c.pnt) <= c.rad * c.rad + eps;
	};

	int n = ps.size();
	random_shuffle(ps.begin(), ps.end());
	C c = c2(ps[0], ps[1]);
	for (int i = 2; i < n; ++i) {
		if (!in_circle(ps[i], c)) {
			c = c2(ps[0], ps[i]);
			for (int j = 1; j < i; ++j) {
				if (!in_circle(ps[j], c)) {
					c = c2(ps[j], ps[i]);
					for (int k = 0; k < j; ++k) {
						if (!in_circle(ps[k], c)) {
							c = c3(ps[i], ps[j], ps[k]);
						}
					}
				}
			}
		}
	}
	return c;
}
int main() {
	ll n;
	cin >> n;
	vector<P> s(n);
	REP(i, n) {
		ll a, b;
		cin >> a >> b;
		s[i] = P(a, b);
	}
	cout << fixed << setprecision(10) << smallest_enclosing_disc(s).rad << endl;

}


Measured memory_bytes: 256
def solve():
    r1, c1, r2, c2 = map(int, input().split())

    MOD = 10**9+7
    n = r2+c2+2
    fac = [1]*(n+1)
    rev = [1]*(n+1)
    
    for i in range(1,n+1):
      fac[i] = i*fac[i-1]%MOD
      rev[i] = pow(fac[i], MOD-2, MOD)
    
    comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%MOD

    def f(r, c):
        return comb(r+c+2, c+1)

    ans = f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)
    ans %= MOD

    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 69744
#include<bits/stdc++.h>
using namespace std;
int main(){
  char a[101],b[101];
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  for(int k=0;k<n;k++){
    cout<<a[k]<<b[k];
  }
  cout<<endl;
}

Measured memory_bytes: 256