akhauriyash/Code-Regression huggingface dataset:
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int>pii;
const ll mod = 998244353;
long double PI = acosl(-1);
const ll infl = 1e18;
const int inf = 2e9;
const int nmax = 2e5+5;
const int MAXLG = log2(nmax)+1;
//mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
//typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ost;


struct segtree{
    long long inf = 1e18;
    long long tr[4*nmax], lz[4*nmax];

    void propagate(int u, int st, int en) {
        if (!lz[u]) return;
        tr[u] = max(tr[u], lz[u]);
        if (st!=en) {
            lz[2*u] = max(lz[2*u], lz[u]);
            lz[2*u+1] = max(lz[2*u+1], lz[u]);
        }
        lz[u] = 0;
    }

    void update(int u, int st, int en, int l, int r, long long x) {
        propagate(u, st, en);
        if (r<st || en<l)  return;
        else if (l<=st && en<=r) {
            lz[u] = x;
            propagate(u, st, en);
        }
        else {
            int mid = (st+en)/2;
            update(2*u, st, mid, l, r, x);
            update(2*u+1, mid+1, en, l, r, x);
            tr[u] = max(tr[2*u], tr[2*u+1]);
        }
    }

    long long query(int u, int st, int en, int l, int r) {
        propagate(u, st, en);
        if (r<st || en<l)  return -inf;
        else if (l<=st && en<=r) return tr[u];
        else {
            int mid = (st+en)/2;
            return max(query(2*u, st, mid, l, r), query(2*u+1, mid+1, en, l, r));
        }
    }
};


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

    segtree sg1, sg2;
    int n,q;
    cin>>n>>q;
    ll kala = 1LL*(n-2)*(n-2);
    while(q--){
        int typ, x;
        cin>>typ>>x;
        if(typ==1){
            int boro = sg1.query(1,1,n, x,x);
            kala -= n-2 - boro;
            sg2.update(1,1,n, 1,n-boro, n-x);
        }
        else{
            int boro = sg2.query(1,1,n, x,x);
            kala -= n-2 - boro;
            sg1.update(1,1,n, 1,n-boro, n-x);
        }
    }
    cout<<kala<<endl;

}
/*
*/


Measured memory_bytes: 18264
#include <iostream>
#include <vector>

template <typename T>
using Vec = std::vector<T>;

int main() {
	int h, w, k;
	std::cin >> h >> w >> k;

	Vec<Vec<int>> sbr(h, Vec<int>());
	for (int i = 0; i < h; ++i) {
		for (int j = 0; j < w; ++j) {
			char c;
			std::cin >> c;

			if (c == '#')
				sbr[i].push_back(j);
		}
	}

	Vec<Vec<int>> group(h, Vec<int>(w));
	
	int id = 0;
	for (int i = 0; i < h; ++i) {
		if (sbr[i].empty())
			continue;

		int sx = 0;
		for (int j = 0; j < sbr[i].size(); ++j) {
			++id;
			while (sx <= sbr[i][j]) {
				group[i][sx] = id;
				++sx;
			}
		}
		while (sx < w) {
			group[i][sx] = id;
			++sx;
		}
	}

	for (int i = 1; i < h; ++i)
		for (int j = 0; j < w; ++j)
			if (group[i][j] == 0)
				group[i][j] = group[i - 1][j];

	for (int i = h - 1; i >= 0; --i)
		for (int j = 0; j < w; ++j)
			if (group[i][j] == 0)
				group[i][j] = group[i + 1][j];

	for (auto&& vec : group) {
		std::cout << vec[0];

		for (int i = 1; i < vec.size(); ++i)
			std::cout << " " << vec[i];

		std::cout << std::endl;
	}
}

Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
int main()
{
    int a,b,c,m;
    cin>>a>>b>>c;
    if (a>b)
        m=a;
    else m=b;
    if (c>m)
    m=c;
    if ((3*m-a-b-c)%2==0)
    cout<<((3*m-a-b-c)/2);
    else
    cout<<((3*m+3-a-b-c)/2);   
  
 system("pause");
 return 0;
}
    

Measured memory_bytes: 504
# coding: utf-8
S=input()
T=input()

if len(S)+1==len(T):
    flg=True
else:
    flg=False

for i in range(len(S)):
    if S[i]!=T[i]:
        flg=False
        

if flg:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 9048
import scala.annotation.tailrec
import scala.collection.mutable
object Main extends App {
  import scala.io.StdIn._

  val Array(r, c) = readLine.trim.split(' ').map(_.toInt)
  val state = Array.fill(r){readLine.trim.toCharArray}
  val start = (0 until r).flatMap(y ⇒ (0 until c).find(x ⇒ state(y)(x) == 'S').map(x ⇒ Coordinate(x, y))).head
  val goal = (0 until r).flatMap(y ⇒ (0 until c).find(x ⇒ state(y)(x) == 'G').map(x ⇒ Coordinate(x, y))).head
  val minStep = Array.fill(r){Array.fill(c){Int.MaxValue}}.wrap
  minStep(start) = 0
  val queue = mutable.PriorityQueue[(Coordinate, Int)]((start, 0))(Ordering.by[(Coordinate, Int), Int](_._2).reverse)
  while (queue.nonEmpty) {
    val (current, cost) = queue.dequeue()
    if (minStep(current) == cost) {
      for (direction ← Direction.all.map(_.asCoordinate)) if (state.isDefinedAt(current + direction)) {
        if (state(current + direction) != '#' && state(current + direction) != 'x') {
          if (state(current + direction) == 'o') {
            if (minStep(current + direction) > minStep(current) + 1) {
              minStep(current + direction) = minStep(current) + 1
              queue.enqueue((current + direction, minStep(current + direction)))
            }
          }else {
            if (minStep(current + direction) > minStep(current) + 2) {
              minStep(current + direction) = minStep(current) + 2
              queue.enqueue((current + direction, minStep(current + direction)))
            }
          }
        }
        val line = (0 until 3).scanLeft(current){case (c, _) ⇒ c + direction}.tail.takeWhile(c ⇒ state.isDefinedAt(c) && state(c) != '#').zipWithIndex
        for ((next, distance) ← line) {
          if (minStep(next) > minStep(current) + 3 + distance) {
            minStep(next) = minStep(current) + 3 + distance
            queue.enqueue((next, minStep(next)))
          }
        }
      }
    }
  }
  println(minStep(goal))


  implicit class Wrap[T](val array: Array[Array[T]]) extends AnyVal {
    def apply(coordinate: Coordinate): T = array(coordinate.y)(coordinate.x)
    def update(coordinate: Coordinate, value: T): Unit = array(coordinate.y)(coordinate.x) = value
    def isDefinedAt(coordinate: Coordinate): Boolean = array.indices.contains(coordinate.y) && array(coordinate.y).indices.contains(coordinate.x)
    def wrap: Wrap[T] = this
  }
}

case class Coordinate(x: Int, y: Int) {
  def +(that: Coordinate): Coordinate = Coordinate(x + that.x, y + that.y)
}
sealed trait Direction {
  def asCoordinate: Coordinate
}
object Direction {
  def all: List[Direction] = List(Up, Right, Down, Left)
}
object Up extends Direction {
  override def asCoordinate: Coordinate = Coordinate(0, -1)
}
object Right extends Direction {
  override def asCoordinate: Coordinate = Coordinate(1, 0)
}
object Down extends Direction {
  override def asCoordinate: Coordinate = Coordinate(0, 1)
}
object Left extends Direction {
  override def asCoordinate: Coordinate = Coordinate(-1, 0)
}


Measured memory_bytes: 54568
#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(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

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

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 * b / gcd(a, b);
}





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

ll size(ll N) {
	if (N == 0) { return 1; }
	return 3 + 2 * size(N - 1);
}

ll pat(ll N) {
	if (N == 0) { return 1; }
	return 1 + 2 * pat(N - 1);
}

ll ans(ll N, ll x) {

	if (N == 0) { return 1; }

	ll K = size(N - 1);
	ll P = pat(N - 1);

	if (x <= 1) { return 0; }
	if (1 < x&&x <= 1 + K) { return ans(N - 1, x - 1); }
	if (x == K + 2) { return P+1; }
	if (K + 2 < x&&x <= 2 * K + 2) { return P + 1 + ans(N - 1, x - K - 2); }
	if (x == 2 * K + 3) { return 2 * P + 1; }
}


int main() {
	ll N, x;
	cin >> N >> x;
	cout << ans(N, x);
	
	system("PAUSE");

}


Measured memory_bytes: 504
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef unsigned long long int ll;
#define INF LLONG_MAX

int main(){

    fastio ;

    ll n;
    vector<vector<ll>> dp(405 , vector<ll>(405));
    vector<ll> a(405);
    vector<ll> prefix(405);

    cin >> n;
    for(ll i = 1; i <= n; i++) {
        cin >> a[i];
        if(i != 1) prefix[i] = prefix[i-1]+a[i];
        else prefix[i] = a[i];
    }
    // OPTIMAL SUB-PROBLEM :

    // dp[i][j] = minimum cost required to change from i...j

    // BASE CASE :

    for(ll i = 0 ; i <= n; i++) dp[i][i] = 0;

    // RECURSIVE RELATION :

    for(ll s = 1; s <= n-1; s++){
        for(ll i = 1; i <= n-s; i++){
            ll j = i+s;
            dp[i][j] = INF;

            for(ll l = i; l <= j-1; l++){
                dp[i][j] = min(dp[i][j] , dp[i][l] + dp[l+1][j] + prefix[j]-prefix[i-1]);
            }
        }
    }

    // OPTIMAL SOLUTION :

     cout << dp[1][n];

}

Measured memory_bytes: 1536
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt(); 
        if(30<=x){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

class Monmo {
    
}


Measured memory_bytes: 35712
#include <bits/stdc++.h>
using namespace std;
#include<chrono>
#define ll long long
#define ld long double
#define eb emplace_back
#define pb push_back
#define mt make_tuple
#define tc  ll t; cin>>t; while(t--)
#define io ios::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
#define F first
#define S second
#define vi vector<ll>
#define pii pair<ll,ll>
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define vii vector<pair<ll,ll>>
ll gcd(ll n,ll m)
{
    if(n==0)
            return m;
    return gcd(m%n,n);
}
bool ifprime(ll n)
{
if(n==1)
return false;
    ll i;
for(i=2;i*i<=n;i++)
{
if(n%i==0)
return false;
 
}
return true;
}
void disp(vi v)
{
    for(auto u:v)
    cout<<u<<" ";
    cout<<"\n";
}
void remleadzero(vector<int> &v)
{
    vector<int> u;
    int i=0;
    while(v[i]==0)
        i++;
    while(i<v.size())
    {
        u.push_back(v[i]);
        i++;
    }
    v=u;
}
#define mod 1000000007LL
/*
void myscanf(long long *n)
{
    register long long c=getchar_unlocked();
    *n=0;
    for(;(c<48 ||c>57);c=getchar_unlocked())
        ;
    for(;(c>47 && c<58);c=getchar_unlocked())
    {
        *n=(*n<<1)+(*n<<3)+(c&15);
    }
 
}
void fastscan(long long &number)
{
    bool negative = false;
    register long long c;
 
    number = 0;
 
    c = getchar_unlocked();
    if (c=='-')
    {
 
        negative = true;
 
        c = getchar_unlocked();
    }
 
 
    for (; (c>47 && c<58); c=getchar_unlocked())
        number = number *10 + c - 48;
 
 
    if (negative)
        number *= -1;
}
*/
ll fast_expo(ll n,ll m, ll md)
{
    ll a=1;
    while(m>0)
    {
        if(m&1) a=(a*n)%md;
        n=(n*n)%md;
        m/=2;
    }
    return a%md;
}
long long sqroot(long long n){
    long double N = n;
    N = sqrtl(N);
    long long sq = N-2;
    sq = max(sq,0LL);
    while(sq*sq<n){
        sq++;
    } 
    if((sq*sq)==n)
        return sq;
    return -1;
}

int main()
{
    io;
    int h,a;
    cin>>h>>a;
    cout<<(h+a-1)/a;
    return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
cnt=0
while True:
  f=False
  for i in range(len(a)):
    if a[i]%2==0:
      a[i]//=2
    else:
      f=True
      break
  if f:
    break
  cnt+=1
print(cnt)
      
    

Measured memory_bytes: 9080
package main

import "fmt"

import "sort"

func main() {
	var n int
	fmt.Scan(&n)
	v := make([]float64, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&v[i])
	}
	sort.Float64s(v)

	var ans float64
	ans = (v[0] + v[1]) / 2

	if n == 2 {
		fmt.Println(ans)
		return
	}
	for i := 2; i < n; i++ {
		ans = (ans + v[i]) / 2
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repi(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
int main() {
  int n;
  cin>>n;
  vector<int> a(n),b(n);
  rep(i,n){
    cin>>a[i];
    b[i]=a[i];
  }
  sort(a.begin(),a.end());
  rep(i,n){
    if(b[i]==a[n-1]) cout<<a[n-2]<<endl;
    else cout<<a[n-1]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ll N, x;
  cin >> N >> x;
  vector<ll> a(N);
  for (int i = 0; i < N; i++)
    cin >> a[i];

  ll cnt = 0;
  for (int i = 0; i < N; i++) {
    if (i == 0) continue;
    ll sum = a[i - 1] + a[i];
    if (sum <= x) continue;
    ll diff1 = max(0LL, a[i] - x);
    ll diff2 = max(0LL, a[i - 1] - x);
    cnt += diff1;
    cnt += diff2;
    a[i] -= diff1;
    a[i - 1] -= diff2;
    sum = a[i - 1] + a[i];

    ll diff = abs(sum - x);
    cnt += diff;
    a[i] -= diff;
    // if (a[i - 1] <= a[i]) {
    //  a[i] -= diff;
    //} else {
    //  a[i - 1] -= diff;
    //}
  }
  cout << cnt << endl;
}

Measured memory_bytes: 1024
A,B,K=list(map(int, input().split()))
a=min(A+K-1,B)
b=max(A,B-K+1)
L=list(range(A,a+1)) + list(range(b,B+1))
L=list(set(L))
L.sort()
for _ in range(len(L)):
  print(L[_])

Measured memory_bytes: 62368
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
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; }
 
struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


 
void solve(){
    string a[10];
    rep(i,3)cin>>a[i];
    rep(i,3)cout<<a[i][0];
    cout<<endl;
}
 
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
     
    ll Q=1;
    // cin>>Q;
    rep(_,Q){
 
        solve();
 
    }
   
 
 
    return 0;
}

Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
if N&1:
    print(0); exit()

def func(x):
    # x以下の偶数で5の因数をいくつ持つか
    x //= 2
    ret = 0
    while x >= 5:
        ret += x // 5
        x //= 5
    return ret

answer = func(N)
print(answer)
# 16

Measured memory_bytes: 3064
#include <iostream>
#include <vector>

int N, M;
std::vector<int> city;

int main(void){
    int a, b;

    std::cin >> N >> M;
    city.resize(N,0);

    for(int i=0; i<M; ++i){
        std::cin >> a >> b;
        ++city[a-1];
        ++city[b-1];
    }
    for(int i=0; i<N; ++i){
        std::cout << city[i] << std::endl;
    }
}



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

using namespace std;

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

	std::vector<int> V(N);
	for (auto& v : V)
	{
		cin >> v;
	}


	std::vector<int> C(N);
	for (auto& c : C)
	{
		cin >> c;
	}

	int Max = 0;

	for (int i = 0; i < N; i++)
	{
		int s = V[i] - C[i];
		if (s >= 0)
		{
			Max += s;
		}
	}

	cout << Max;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    double[] indegrients = new double[n];
    for(int i = 0; i < n; i++){
      indegrients[i] = Integer.parseInt(sc.next());
    }
    Arrays.sort(indegrients);
    for(int i = 0; i < n - 1; i++){
      indegrients[i + 1] = (indegrients[i] + indegrients[i + 1]) / 2.0;
    }
    System.out.println(indegrients[n - 1]);
  }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,s,e) for(int i=s;i<e;i++)
#define endl '\n'
int main(){
    int R,G,B,K;cin>>R>>G>>B>>K;
    int q=100,r=100;
    for(int i=0;i<=K;i++){
        if(R<G*(1<<i)){
            q=i;
            break;
        }
    }
    for(int i=0;i<=K;i++){
        if(G*(1<<q)<B*(1<<i)){
            r=i;
            break;
        }
    }
    if(q+r<=K)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int tarous=0,hanakos=0;
    for(int i=0;i<n;i++){
        string tarou,hanako;
        cin>>tarou>>hanako;
        if(tarou>hanako){
            tarous+=3;
        }else if(tarou<hanako){
            hanakos+=3;
        }else{
            tarous++;
            hanakos++;
        }
    }
    cout<<tarous<<' '<<hanakos<<endl;
    return 0;
}


Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=100001,INF=1<<30;

int main(){
    
    int H,W,N;cin>>H>>W>>N;
    vector<int> S[W];
    for(int i=0;i<N;i++){
        int a,b;cin>>a>>b;
        a--;b--;
        S[b].push_back(a);
    }
    
    for(int i=0;i<W;i++){
        sort(all(S[i]));
    }
    
    vector<int> from(W);
    from[0]=0;
    
    for(int j=1;j<W;j++){
        if(S[j].size()==0){
            from[j]=from[j-1]+1;
        }else if(!binary_search(all(S[j]),from[j-1]+1)){
            from[j]=from[j-1]+1;
        }else{
            for(int i=0;i<S[j].size();i++){
                int a=S[j][i];
                if(a>=from[j-1]&&!binary_search(all(S[j]),a+1)){
                    from[j]=a+1;
                    break;
                }
                if(i==S[j].size()-1){
                    if(a==H-1){
                        from[j]=H;
                    }else{
                        from[j]=from[j-1]+1;
                    }
                }
            }
        }
    }
    
    int ans=H;
    
    for(int j=0;j<W;j++){
        for(int i=0;i<S[j].size();i++){
            int a=S[j][i];
            if(from[j]<=a-1) ans=min(ans,a);
        }
    }
    
    cout<<ans<<endl;
    
    
    
}




Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
void YESNO(bool), YesNo(bool);
template <class T1, class T2>
bool chmin(T1 &l, const T2 &r);
template <class T1, class T2>
bool chmax(T1 &l, const T2 &r);
template <class T1, class T2>
void vadd(vector<T1> &v, T2 x);

#define int long long int

void solve(long long X, long long Y, long long Z)
{
  swap(X, Y);
  swap(X, Z);
  cout << X << " " << Y << " " << Z << endl;
}

signed main()
{
  long long X;
  scanf("%lld", &X);
  long long Y;
  scanf("%lld", &Y);
  long long Z;
  scanf("%lld", &Z);
  solve(X, Y, Z);
  return 0;
}

// -- lib
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }

template <class T1, class T2>
bool chmin(T1 &l, const T2 &r)
{
  return (l > r) ? (l = r, true) : false;
}

template <class T1, class T2>
bool chmax(T1 &l, const T2 &r)
{
  return (l < r) ? (l = r, true) : false;
}

template <class T1, class T2>
void vadd(vector<T1> &v, T2 x)
{
  for (auto &s : v)
    s += T2(x);
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
  long long int N,T;
  cin >> N >> T;
  vector<long long int>ti(N);
  for(int i=0; i < N; i++)
    cin >> ti[i];
  long long int sum=0;
  for(int i=1; i < N; i++){
    if(ti[i]-ti[i-1] >= T){
      sum += T;
    }else{
      sum += -ti[i-1] + ti[i];
    }
  }
  cout << sum+T << endl;
  return 0;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

unsigned long xor128(){
    static unsigned long x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned long t;
    t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

int n, k;
vector<vector<int> > card;
vector<bool> seq;

bool check()
{
    for(int i=0; i<k; ++i){
        int sum = 0;
        for(int j=0; j<n/2; ++j){
            if(seq[card[i][j]])
                ++ sum;
        }
        if(sum < n / 8 || sum > n / 8 * 3)
            return false;
    }
    return true;
}

int main()
{
    cin >> n >> k;

    card.assign(k, vector<int>(n/2));
    for(int i=0; i<k; ++i){
        for(int j=0; j<n/2; ++j){
            cin >> card[i][j];
            -- card[i][j];
        }
    }

    for(;;){
        seq.resize(n);
        for(int i=0; i<n; ++i)
            seq[i] = xor128() % 2;

        if(check()){
            for(int i=0; i<n; ++i)
                cout << (seq[i]? 1:0);
            cout << endl;
            return 0;
        }
    }
}

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

int main(void){
    ll n;
    cin >> n;
    vector<ll> cnt(n+1);
    ll res = 0;
    rep1(i,n){
        rep1(j,n){
            if (i*j > n) break;
            cnt[i*j]++;
        }
        res += i * cnt[i];
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 81396
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#define fo(i,j,k) for(int i=j;i<=k;++i)
using namespace std;
const int N=1e5+10;
typedef pair<int,int> pr;
typedef multiset<int>::iterator it;

queue<pr> q;
map<pr,int> mp;
multiset<int> b[N];

int f[N];

int find(int x){return !f[x]?x:f[x]=find(f[x]);}

void link(int x,int y){b[x].insert(y),b[y].insert(x);}

pr mkpr(int x,int y){
    if(x>y) swap(x,y);
    return make_pair(x,y);
}

int main() {
    int n;
    scanf("%d",&n);
    fo(i,1,n*2-2){
        int x,y;
        scanf("%d %d",&x,&y);
        link(x,y);
        pr t=mkpr(x,y);
        ++mp[t];
        if(mp[t]==2) q.push(t);
    }
    fo(ch,2,n){
        if(q.empty()) return puts("NO"),0;
        int x=0,y=0;
        for(;x==y;x=find(q.front().first),y=find(q.front().second),q.pop());
        if(b[x].size()>b[y].size()) swap(x,y);
        f[x]=y;
        for(it i=b[x].begin();i!=b[x].end();i++){
            int v=find(*i);
            b[v].erase(b[v].find(x));
            if(v==y) continue;
            link(v,y);
            pr t=mkpr(v,y);
            ++mp[t];
            if(mp[t]==2) q.push(t);
        }
    }
    puts("YES");
}


Measured memory_bytes: 44544
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int a = vs[0];
			int b = vs[1];
			if (a % 2 == 0 || b % 2 == 0) {
				Console.WriteLine("No");
			} else {
				Console.WriteLine("Yes");
			}


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <cstring>
#define N 2005
using namespace std;

int M = 1e9 + 7;
int n, m, ans, a[N], b[N], s[N][N], k[N];
void f(int p, int q) {
	int i,j;
	for (i = 0; i < p; i++) {
		for (j =0; j < q; j++) {
			s[p][q] += s[i][j];
		}
	}
}
int main()
{
	int i, j, t;
	cin >> n >> m;
	for (i = 1; i <= n; i++) scanf ("%d", &a[i]);
	for (i = 1; i <= m; i++) scanf ("%d", &b[i]);
	for (i = 0; i <= m; i++) s[0][i] = 1;
	for (i = 1; i <= n; i++) {
		s[i][0] = 1;
		k[0] = 0;
		for (j = 1; j <= m; j++) {
			if (a[i] == b[j]) {
				t = s[i - 1][j - 1];
			} else t = 0;
			k[j] = (k[j - 1] + t) % M;
			s[i][j] = (s[i - 1][j] + k[j]) % M;
			ans = (ans + t) % M;
		}
	}
	cout << (ans + 1) % M << endl;
    return 0;
}


Measured memory_bytes: 16000
import java.util.Scanner;
import java.util.Arrays;


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

    for(int i = 0;i < N;i++){
      H[i] = sc.nextInt();
    }
    Arrays.sort(H);

    long S = 0;
    for(int i = 0;i < N-K;i++){
      S += H[i];
    }
    System.out.println(S);
  }

}


Measured memory_bytes: 63912
# https://beta.atcoder.jp/contests/abc054/tasks/abc054_b


def solve():
    n, m = map(int, input().split())
    img = []
    tmp = []

    for _ in range(n):
        img.append(list(map(str, input().split())))

    for _ in range(m):
        tmp.append(list(map(str, input().split())))

    loops = n - m + 1
    for loop in range(loops):
        for row in range(loops):
            match = True
            for col in range(m):
                if img[col+loop][0][row:row+m] != tmp[col][0]:
                    match = False
            if match:
                print('Yes')
                return
    print('No')


if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
// * It's time to PLAY !
 
#include <bits/stdc++.h>
 
using namespace std;
 
#ifdef EXILE
#include "prettyprint.hpp"
#define debug(args) cerr << #args << " = " << args << endl;
#else
#define debug(args) 20040119
#endif
 
#define fastio ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define int long long
void OPEN(string str)
{
    freopen((str + ".inp").c_str(), "r", stdin);
    freopen((str + ".out").c_str(), "w", stdout);
}
 
void PLAY()
{
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        a[i] -= i + 1;
    }
    int ans = 0;
    sort(a, a + n);
    for (int i = 0; i < n; ++i)
    {
        ans += abs(a[i] - a[n / 2]);
    }
    cout << ans;
}
 
signed main()
{
    fastio;
    PLAY();
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;cin>>a>>b>>c;
  if(a==b){
    cout<<c<<endl;
  }
  else if(b==c){
    cout<<a<<endl;
  }
  else{
    cout<<b<<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n[1000000+5];
    scanf("%d", &n[1]);
    int i=2;
    while(1){
        if(n[i-1]%2==0){
            n[i]=n[i-1]/2;
        }else{
            n[i]=3*n[i-1]+1;
        }
        for(int j=1; j<i; j++){
            if(n[i]==n[j]){
                printf("%d\n", i);
                return 0;
            }
        }
        i++;
    }
}


Measured memory_bytes: 1716
#include <iostream>
#include<bits/stdc++.h>
#define rep(k,i,n) for(int i=k;i<n;++i)
using namespace std;
int main(void){
    // Your code here!
    int N;
    cin>>N;
    int v[N];
    rep(0,i,N)cin>>v[i];
    sort(v,v+N,greater<int>());
    double sum=0;
    rep(0,i,N){
        if(i!=N-1)sum+=1.0*v[i]/pow(2,i+1);
        else sum+=1.0*v[N-1]/pow(2,N-1);
    }
    cout<<setprecision(10)<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;

int main()
{
   FAST/**/
   
   string s,t;
   cin>>s>>t;
   t.pop_back();
   if(s!=t)
        cout<<"No\n";
   else cout<<"Yes\n";        
   
   return 0;        
}  
  
   

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
int calc(int d) {
  if (d == 0) {
    return 1;
  } else {
    bitset<30> b(d);
    return calc(d % b.count()) + 1;
  }
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  bitset<2 * (int) pow(10, 5)> b(s);
  int a = b.count(), a1 = a - 1, a2 = a + 1;
//  cout << "a:" << a << ":" << a1 << ":" << a2 << endl;
  int b1 = 0, b2 = 0, c = 1;
  vector<int> v1(n), v2(n);
  v1[0] = 1, v2[0] = 1;
  if (b.test(0)) {
    b1 = 1;
    b2 = 1;
  }
  rep(i,n-1)
  {
    if (a > 1)
      v1[i + 1] = v1[i] * 2 % a1;
    v2[i + 1] = v2[i] * 2 % a2;
    if (b.test(i + 1)) {
      if (a > 1)
        b1 = (b1 + v1[i + 1]) % a1;
      b2 = (b2 + v2[i + 1]) % a2;
    }
  }
//  cout << "b:" << b1 << ":" << b2 << endl;
//  rep(i,n)
//    cout << " " << v2[i];
//  cout << endl;
  for (int i = n - 1; i >= 0; i--) {
    if (b.test(i)) {
      if (a > 1) {
        int d = (b1 + a1 - v1[i]) % a1;
        if (d == 0) {
          cout << 1 << endl;
        } else {
          cout << calc(d)<< endl;
        }
      } else
        cout << 0 << endl;
    } else {
      int d = (b2 + a2 + v2[i]) % a2;
      if (d == 0) {
        cout << 1 << endl;
      } else {
        cout << calc(d)<< endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 5252
S = list(input())
l = len(S)
ans = 0
for i in range(1 << (l-1)):
    A = str(S[0])
    for j in range(l-1):
        if (i >> j) & 1 == 1:
            A += '+'
        A += S[j+1]
    ans += eval(A)
print(ans)


Measured memory_bytes: 39024
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<numeric>
using namespace std;

int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    cout<<a[0]+a[1]<<endl;
    return 0;

}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N, M;
  cin >> N >> M;
  vector<int> x(M), y(M);
  REP(i, M)
  {
    cin >> x[i] >> y[i];
    x[i]--, y[i]--;
  }
  vector<int> ball(N);
  vector<bool> red(N);
  REP(i, N)
  {
    ball[i] = 1;
    red[i] = false;
  }
  red[0] = true;
  REP(i, M)
  {
    if (red[x[i]])
      red[y[i]] = true;
    ball[x[i]]--;
    ball[y[i]]++;
    if (ball[x[i]] == 0)
      red[x[i]] = false;
  }
  int ans = 0;
  REP(i, N)
  ans += red[i];
  cout << ans << endl;
  return 0;
}

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

using ll = long long;
using pii = pair<int, int>;

#define vt          vector
#define sz(x)       (int)(x).size()
#define all(x)      (x).begin(), (x).end()
#define rall(x)     (x).rbegin(), (x).rend()
#define fi          first
#define se          second

signed main() {
    ios::sync_with_stdio(0), cin.tie(0);

    int n;
    cin >> n;
    vt<int> a(n);
    for (int &i : a) cin >> i;
    vt<int> sorta(a);
    sort(all(sorta));

    for (int i = 0; i < n; i++) {
        if (a[i] < sorta[n / 2]) cout << sorta[n / 2];
        else cout << sorta[n / 2 - 1];
        cout << '\n';
    }
}


Measured memory_bytes: 4776
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

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

A = str(input())
N = len(A)

d = defaultdict(int)

dp = [0]*N
dp[0] = 1
d[A[0]] = 1
for i in range(1,N):
    dp[i] = dp[i-1]+i-d[A[i]]
    d[A[i]] += 1

print(dp[-1])

Measured memory_bytes: 42716
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <bitset>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

#define maxN 411
#define maxM 100011

int n, m, i, j, ans;
int x[maxM], y[maxM];

bool good[maxN];
bitset<maxN> need[maxN];

void pre(int node) {
    int i;

    good[node] = true;
    need[node].reset(); need[node][node] = 1;

    for (i = m; i > 0; i--) {
        if (need[node][x[i]] && need[node][y[i]]) {
            good[node] = false;
            return;
        }

        if (!need[node][x[i]] && !need[node][y[i]])
            continue;

        need[node][x[i]] = 1;
        need[node][y[i]] = 1;
    }
}

int main()
{
  //  freopen("test.in","r",stdin);

    scanf("%d%d", &n, &m);
    for (i = 1; i <= m; i++)
        scanf("%d%d", &x[i], &y[i]);

    for (i = 1; i <= n; i++)
        pre(i);

    for (i = 1; i <= n; i++)
        for (j = i + 1; j <= n; j++)
            if (good[i] && good[j])
                if ((need[i] & need[j]) == need[0])
                    ans++;

    cout << ans;


    return 0;
}


Measured memory_bytes: 1152
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
int sum[2010][2010] = {};
int tate[2010][2010] = {};
int yoko[2010][2010] = {};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N,M,Q;
    cin >> N >> M >> Q;
    string S[2010];
    rep(i,0,N) cin >> S[i];
    rep(i,0,N){
        rep(j,0,M){
            if(S[i][j] == '1'){
                sum[i+1][j+1]++;
            }
        }
    }
    rep(i,0,N+1){
        rep(j,0,M+1){
            sum[i+1][j] += sum[i][j];
        }
    }
    rep(j,0,M+1){
        rep(i,0,N+1){
            sum[i][j+1] += sum[i][j];
        }
    }
    rep(i,0,N){
        rep(j,0,M-1){
            if(S[i][j] == '1' &&  S[i][j+1] == '1'){
                tate[i+1][j+1]++;
            }
        }
    }
    rep(j,0,M){
        rep(i,0,N-1){
            if(S[i][j] == '1' && S[i+1][j] == '1'){
                yoko[i+1][j+1]++;
            }
        }
    }
    rep(i,0,N+1){
        rep(j,0,M+1){
            tate[i+1][j] += tate[i][j];
        }
    }
    rep(j,0,M+1){
        rep(i,0,N+1){
            tate[i][j+1] += tate[i][j];
        }
    }
    rep(i,0,N+1){
        rep(j,0,M+1){
            yoko[i+1][j] += yoko[i][j];
        }
    }
    rep(j,0,M+1){
        rep(i,0,N+1){
            yoko[i][j+1] += yoko[i][j];
        }
    }
    while(Q--){
        ll x1,y1,x2,y2;
        cin >> x1 >> y1 >> x2 >> y2;
        x1--; y1--; x2--; y2--;
        ll ans = sum[x2+1][y2+1] - sum[x2+1][y1] - sum[x1][y2+1] + sum[x1][y1];
        ans -= tate[x2+1][y2] - tate[x2+1][y1] - tate[x1][y2] + tate[x1][y1];
        ans -= yoko[x2][y2+1] - yoko[x2][y1] - yoko[x1][y2+1] + yoko[x1][y1];
        print(ans);
    }
}

Measured memory_bytes: 53376
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

x,y = inpl()
res = 0
if x == 3 :
    res += 100000
if x == 2 :
    res += 200000
if x == 1 :
    res += 300000
if y == 3 :
    res += 100000
if y == 2 :
    res += 200000
if y == 1 :
    res += 300000
if x == 1 and y == 1:
    res += 400000
print(res)

Measured memory_bytes: 64620
(* Vicfred
 * https://atcoder.jp/contests/abc079/tasks/abc079_b
 * math
 * *)
let n = read_int()
let rec lucas i a b = if i >= n then a else lucas (i + 1) b (a + b)
let main = lucas 0 2 1 |> Printf.printf "%d\n"



Measured memory_bytes: 3724
/****************************
/////  Shubham Singhal
/////  LNMIIT
*****************************/
#include <bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define eb emplace_back
#define lwr lower_bound
#define upr upper_bound
#define pq priority_queue
#define umap unordered_map
#define rep(i,n) for(i=0; i<n;i++)
#define repp(i,a,n) for(i=a; i<n;i++)
#define precise(x) cout<<fixed<<setprecision(x)
#define all(x) x.begin(),x.end()
#define lcm(a,b) (a*b)/__gcd(a,b)
#define prn(x) cout<<x<<"\n"
#define prn2(x, y) cout<<x<<" "<<y<<"\n"
#define prn3(x, y, z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define prn4(x, y, z, a) cout<<x<<" "<<y<<" "<<z<<" "<<a<<"\n"
#define prnv(x) for(auto i:x) cout<<i<<" "; cout<<"\n"
#define MOD 1000000007
#define MAX 300005
using namespace std;
 
typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd; 
typedef vector<int> vi;
typedef vector<long> vl;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<pil> vpil;
typedef vector<pli> vpli;
typedef vector<pll> vpll;
const long long INF64 = 1e18;
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
void doc()
{
   	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
void fast()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
}
int main()
{
	fast();
	ll n;
	cin>>n;
	string s;
	umap<string,ll> m;
	while(n--)
	{
		cin>>s;
		m[s]++;
	}
	cout<<m.size();
}

Measured memory_bytes: 17648
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	int N;
	cin >> N;
	vector<ll> v(N * 3);
	for (int i = 0; i < N * 3; i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	ll res = 0;
	for (int i = N; i < N * 3; i += 2) {
		res += v[i];
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int a = 0, b = 0, a_sum[11] = { 0 }, b_sum[11] = { 0 };
	for (int i = 0; i < 10; i++) {
		cin >> a;
		a_sum[i] = a;
	}
	for (int j = 0; j < 10; j++) {
		cin >> a;
		b_sum[j] = a;
	}
	a = 0;
	sort(a_sum, a_sum + 10);
	sort(b_sum, b_sum + 10);
	/*for (int i = 0; i < 10; i++) {
		cout << a_sum[i] << "," << b_sum[i] << endl;
	}*/
	for (int i = 9; i >6; i--) {
		a += a_sum[i];
		b += b_sum[i];
	}
	cout << a << " " << b << endl;
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define ins insert
#define mk make_pair
#define fr first
#define sc second
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s,t;
    cin>>s>>t;
    if(s.size()+1==t.size())
    {
    for(ll i=0;i<s.size();i++)
    {
        if(s[i]!=t[i])
        {
            cout<<"No";
            return 0;
        }
    }
    cout<<"Yes";
    }
    else cout<<"No";
    
}

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

using namespace std;

int main(){
    int N,L; cin>>N>>L;
	if(L>0){
      printf("%d",((2*L+N)*(N-1))/2);
    }else if(L+N-1<0){
    	printf("%d",((2*L+N-2)*(N-1)/2));
    }else{
      printf("%d",((2*L+N-1)*(N))/2);
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
 using namespace std; 
int main() { 
int a, b, r; char op; 
while (true) { 
cin >> a >> op >> b;
 switch (op) { case '+': r = a + b; break;
 case '-': r = a - b; break; case '*': r = a * b; break; case '/': r = a / b; break; } if (op == '?') { break; } cout << r << endl; } return 0; } 


Measured memory_bytes: 3096
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{

int a ;
cin >> a ;

cout << 1110 - a << endl;

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int (i) = (int)(a);(x);++(i))
#define repr(i, a, n) for(int (i) = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, a, n) &((x)[a]), &((x)[n])
#define ADD(a, b) ((((a)%MOD)+((b)%MOD))%MOD)
#define MUL(a, b) ((((a)%MOD)*((b)%MOD))%MOD)
#define CEIL(x) ((int)ceil(((double)x)))
#define UNIQUE(x) (x).erase(unique(ALL((x))), (x).end())
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define fcout cout << fixed << setprecision(10)
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using VLL = std::vector<llint>;
using MCI = std::map<char, int>;
using namespace std;


struct UF {
	VI par;

	UF(){}
	UF(int n){
		par.resize(n, 0);
		iota(ALL(par), 0);
	}
	int root(int x){
		if(par[x] == x) return x;
		return par[x] = root(par[x]);
	}
	bool same(int x, int y){
		return root(x) == root(y);
	}
	void unite(int x, int y){
		x = root(x);
		y = root(y);
		if(x == y) return;
		par[x] = y;
	}
};


int N, K, L;
VI g[2][200010];
bool u[2][200010];
UF uf[2];
map<PII, int> ans;


void dfs(bool t, int v, int r){
	u[t][v] = true;
	uf[t].unite(v, r);
	for(int n : g[t][v])
		if(!u[t][n]) dfs(t, n, r);
}


void makeUF(){
	rep(t, 0, 2)
		rep(i, 0, N)
		if(!u[t][i]) dfs(t, i, i);
}


void solve(){
	rep(i, 0, N) ans[{ uf[0].par[i], uf[1].par[i] }]++;
	rep(i, 0, N){
		cout << ans[{ uf[0].par[i], uf[1].par[i] }];
		if(i != N-1) cout << ' ';
	}
	cout << endl;
}


signed main(){
	cin >> N >> K >> L;
	uf[0] = uf[1] = UF(N);
	rep(i, 0, K){
		int p, q;
		cin >> p >> q, p--, q--;
		g[0][p].pb(q);
		g[0][q].pb(p);
	}
	rep(i, 0, L){
		int r, s;
		cin >> r >> s, r--, s--;
		g[1][r].pb(s);
		g[1][s].pb(r);
	}

	makeUF();

	solve();

	return 0;
}

Measured memory_bytes: 28288
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		long[] A = new long[N+1];
		long[] dis = new long[N+1];
		long cc = 0,dd = 0;
		for( int i=1; i<=N; i++ ){
			cc++;
			A[i] = sc.nextLong();
			dis[i] = A[i]-cc;
		}
		Arrays.sort(dis);
		long ans1 = 0,ans2 = 0;
		long b1 = dis[N/2],b2 = dis[N/2+1];			
			for( int i=1; i<=N; i++ ){
				dd++;
				ans1 += Math.abs( A[i]-(b1+dd) );
				ans2 += Math.abs( A[i]-(b2+dd) );
			}						
		System.out.println(Math.min(ans1,ans2));
	}
}


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

int main()
{
  int n ;
  int64_t Y ;
  cin >> n >> Y ;
  int x = -1 ;  //t_thou
  int y = -1 ;  //f_thou
  int z = -1 ;  //thou

  bool answer = false ;
  for(int i = 0 ; i <= n ; i++)
  {
    
    for(int j = 0 ; j <= n ; j++)
    {
      if(answer)
      {
        break;
      }
      if(i * 10000 + j * 5000 + (n - i - j) * 1000 == Y)
      {
        if(n - i - j < 0)
        {
          continue ;
        }
        x = i ;
        y = j;
        z = n - i - j ;
        answer = true ;
        break ;
      }
    }
  }

  if(answer)
  {
    cout << x << " " << y << " " << z << endl ;
  }
  else
  {
    cout << x << " " << y << " " << z << endl;
  }
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define gor(A, B, E) for(int A = B; A <= E; ++A)
#define dor(A, B, E) for(int A = B; A >= E; --A)
#ifndef ONLINE_JUDGE
#define dbg(x) std::cout<<#x<<'='<<x<<std::endl
#else
#define dbg(x) 
#endif
typedef long long ll;
namespace IO {
const int ch_top=4e7;char ch[ch_top],*now_r=ch-1,*now_w=ch-1;
template <typename T>inline void read(T & v){
    register char ch;register T f=1,x=0;
    do{ch=getchar();if(ch=='-') f=-1;}while(!isdigit(ch));
    do{x=x*10+ch-'0';ch=getchar();}while(isdigit(ch));v=x*f;}
template <typename T>inline void write(T x,char ch_end='\n'){
    static char st[20];static T top;T m=x;x=abs(x);while(st[++top]='0'+x%10,x/=10);
    if(m<0)st[++top]='-';while(*++now_w=st[top],--top);*++now_w=ch_end;}
} // namespace IO
const int N = 1e6+1, INF=0x7fffffff, MOD=1e9+7;
namespace Problem {
int n, k, a[100002], ms;


void init(){
    using namespace IO;
    read(n), read(k);
}

void solve() {
    init();
    if(n==k) IO::write(1);
    else IO::write(int(ceil((n-1)/double(k-1))));
}
} // namespace Problem

int main()
{
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
    Problem::solve();
    fwrite(IO::ch, 1, IO::now_w - IO::ch, stdout);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main() {
  ll a;
  cin>>a;
  ll b=1;
  ll c=1;
  ll d=2;
  for(ll i=0;i<a;i++){
    b=b*10;
    c=c*8;
    d=d*9;
    b=b%1000000007;
    c=c%1000000007;
    d=d%1000000007;
  }
  ll e=b+c-d;
  
  if(b+c-d>=0){
    cout<<(b+c-d)%1000000007<<endl;
    return 0;
  }
  
  else{
    while(e<0){
      e+=1000000007;
    }
  }
  cout<<e<<endl;
  return 0;
}

Measured memory_bytes: 3628
words={}
for word in raw_input().rstrip().split():
    words.setdefault(word, 0)
    words[word]+=1

wl=sorted(words.items(),key=lambda x : x[1],reverse=True)
print wl[0][0],
wl=sorted(words.items(),key=lambda x : len(x[0]),reverse=True)
print wl[0][0]

Measured memory_bytes: 4224