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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

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

struct UnionFind
{
	vector<ll> par, wei;
	UnionFind(ll n)
	{
		init(n);
	}

	void init(ll n)
	{
		par.assign(n, -1);
		wei.assign(n, 0);
	}

	ll root(ll x)
	{
		if (par[x] < 0) return x;
		else
		{
			ll r = root(par[x]);
			wei[x] += wei[par[x]];
			return par[x] = r;
		}
	}
	
	ll weight(ll x)
	{
		root(x);
		return wei[x];
	}

	ll merge(ll x, ll y, ll w)
	{
		w += weight(x);
		w -= weight(y);

		x = root(x);
		y = root(y);
		if (x == y) return false;

		if (rank(x) < rank(y)) swap(x, y), w *= -1;
		// rank(x) > rank(y)
		par[x] += par[y];
		par[y] = x;

		wei[y] = w;
		return true;
	}

	ll diff(ll x, ll y)
	{
		return weight(y) - weight(x);
	}

	ll issame(ll x, ll y)
	{
		return root(x) == root(y);
	}

	ll rank(ll x)
	{
		return -par[root(x)];
	}
};

int main(int argc, char **argv)
{
	ll N, M; cin >> N >> M;
	UnionFind uf(N);

	REP(i, M)
	{
		ll l, r, d; cin >> l >> r >> d;
		--l, --r;
		if (uf.issame(l, r))
		{
			if (uf.diff(l, r) != d)
			{
				std::cout << "No" << std::endl;
				return 0;
			}
		}
		else
		{
			uf.merge(l, r, d);
		}
	}

	std::cout << "Yes" << std::endl;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
ll made()
{
	char s0;
	ll ans=0;
	s0=getchar();
	while(s0>='0'&&s0<='9')
	{
		ans=ans*10;
		ans+=s0-'0';
		s0=getchar();
	}
	return ans;
}
int main()
{
	ll a1=made();
	ll a2=made();
	int count=1;
	while(2*a1<=a2)
	{
		count++;
		a1=a1*2;
	}
	printf("%d\n",count);
}

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

int main(){
    char a,b;
    cin>>a>>b;
    if(a=='H'){
        if(b=='H'){
            cout<<'H'<<endl;
        }else{
            cout<<'D'<<endl;
        }
    }else{
        if(b=='H'){
            cout<<'D'<<endl;
        }else{
            cout<<'H'<<endl;
        }
    }
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars, Usize1};
use proconio::{fastout, input};
#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        s: [(Usize1, char); m]
    }
    let mut ans = vec!['_'; n];
    for &(s, c) in s.iter() {
        if ans[s] != '_' && ans[s] != c {
            println!("-1");
            return;
        }
        ans[s] = c;
    }
    if ans[0] == '0' && n != 1 {
        println!("-1");
        return;
    }
    if ans[0] == '_' && n != 1 {
        ans[0] = '1';
    }
    for &c in ans.iter() {
        if c == '_' {
            print!("0");
        } else {
            print!("{}", c);
        }
    }
}


Measured memory_bytes: 2196
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdio>
using namespace std;

#define int long long
#define INF 1e18

signed main() {
    int n; cin >> n;
    vector<int> d(n); for(int i = 0; i < n; i++) cin >> d[i];
    int cnt = 1;

    sort(d.begin(), d.end(), greater<int>());

    for(int i = 0; i < n - 1; i++) {
        if(d[i] > d[i + 1]) cnt++;
    }

    cout << cnt << endl;
}


Measured memory_bytes: 256
from collections import Counter
from collections import deque
import math
import bisect
import sys
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


h,n=mp()
magic=[lmp() for i in range(n)]
dp=[float("inf")]*(h+1)
dp[0]=0
for i in range(h):
    for k in range(n):
        ni=min(i+magic[k][0],h)
        dp[ni]=min(dp[ni],dp[i]+magic[k][1])
print(dp[-1])

Measured memory_bytes: 43100
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
int main()
{
    fastio();
   
    ll n,a,b,ans=0;
    cin>>n>>a>>b;
    if((b-a)%2==0)
    {
        ans = (b-a)/2;
        
    }
    else
    {
        if((a-1)<(n-b))
        {
            ans=a;
            b=b-a;
            ans += (b-1)/2;
        }
        else
        {
            ans= (n-b+1);
            ans+= (b-a-1)/2;
        }
    }
    cout<<ans<<endl;
}

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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const int N = 3e5+5;

ll n,result;
ll a[N];
vector<int> v[N];
map<P, int> mp;
// unsigned short c[N][N];
// pair<int, P> p[N];

ll mod(ll a, ll m) {
    return (a % m + m) % m;
}

// a*b/m
ll mul(ll a, ll b, ll m) {
    a = mod(a, m); b = mod(b, m);
    if (b == 0) return 0;
    ll res = mul(mod(a + a, m), b>>1, m);
    if (b & 1) res = mod(res + a, m);
    return res;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COMB(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main () {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  COMBinit();
  cin >> n;
  ll al = COMB(n,2);
  rep(i,n) cin >> a[i];
  rep(j,61) {
    int c = 0;
    rep(i,n) {
      if((a[i] >> j) & 1) c++;
    }
    ll d = c >= 2 ?  COMB(c,2) : 0;
    ll e = n-c >= 2 ? COMB(n-c, 2) : 0;
    result = (result + mul(al - d - e , (ll) pow(2,j), MOD)) % MOD;
  }
  cout << result << endl;
}


Measured memory_bytes: 21632
def magic(n):
    c=1
    x=n/2
    y=x+1
    while 1:
        A[y][x]=c
        if c==n*n:break
        while 1:
            x,y=(x+1)%n,(y+1)%n
            if A[y][x]==0:break
            x,y=(x-1)%n,(y+1)%n
            if A[y][x]==0:break
        c+=1
    return
while 1:
    n=input()
    if n==0:break
    N=range(n)
    A=[[0]*n for i in N]
    magic(n)
    for i in N:
        print "".join(["%4d"%(A[i][j])for j in N])

Measured memory_bytes: 4248
{-# LANGUAGE PartialTypeSignatures #-}
module Main (main) where

import qualified Data.ByteString.Char8 as C8
import Data.Bool
import qualified Data.Char as C
import qualified Data.List as L

main :: IO ()
main = readInts >>= output . solve

solve :: [Int] -> _
solve = null . filter (=='7') . show . head

output :: _ -> IO ()
output = print . bool Yes No

data YesNo = Yes | No
  deriving Show

-- utils
readInts :: IO [Int]
readInts = L.unfoldr (C8.readInt . C8.dropWhile C.isSpace) <$> C8.getLine


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

int main(){
 string S,T;
 cin >> S ;
 cin >> T;
 int t=0;
 for(int i=0;i<S.size();i++){
     if(S.at(i)!=T.at(i)){
         S.at(i)=T.at(i);
         t++;
     }
else if(S.at(i)==T.at(i)){
    continue;
}
 }
 cout << t << endl;
}

Measured memory_bytes: 3916
s = input()
k = int(input())

diff = k - len(s)
if len(s) < k:
    k -= diff
else:
    diff = 0

l = []
for a in range(len(s) - k + 1):
    subsByK = s[a:a + k]
    # print(subsByK)
    for b in range(k):
        for c in range(b + 1, k + 1):
            # print(b,c)
            subs = subsByK[b:c]
            l.append(subs)

print(sorted(set(l))[k - 1 + diff])

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;

#define INF (1LL << 60)
#define MOD 1000000007

#define REP(i,m,n) for(ll (i)=(m),i_len=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back
#define mp make_pair

int main()
{
    ll N, K, Q;
    cin >> N >> K >> Q;
    ll a;
    vec C(N, 0);
    REP(i,0,Q) {
        cin >> a;
        ++C[a-1];
    }

    REP(i,0,N) {
        if(K - (Q - C[i]) > 0) PR("Yes");
        else PR("No");
    }

    return 0;
}

/*



*/

Measured memory_bytes: 1408
N = int(input())
As = list(map(int, input().split()))

cnt = 0
m = 0
for a in As:
  if a < 0:
    cnt += 1
    
if cnt % 2 == 0:
  print(sum(map(abs, As)))
else:
  print(sum(map(abs, As))-2*min(map(abs, As)))

Measured memory_bytes: 85276
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        FastReader in = new FastReader();
        FastWriter out = new FastWriter();
        int n = in.nextInt();
        out.pl(n*n);
        out.close();
    } 
}
class FastReader{ 
    BufferedReader br; 
    StringTokenizer st; 
    public FastReader() { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    String next(){ 
        while (st == null || !st.hasMoreElements()) { 
            try{ 
                st = new StringTokenizer(br.readLine()); 
            }catch (IOException  e){ 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    int nextInt(){ 
        return Integer.parseInt(next()); 
    } 
    long nextLong(){ 
        return Long.parseLong(next()); 
    } 
    double nextDouble(){ 
      return Double.parseDouble(next()); 
    } 
    String nextLine(){ 
        String str = ""; 
        try{ 
            str = br.readLine(); 
        } 
        catch (IOException e){ 
            e.printStackTrace(); 
        } 
        return str; 
    } 
}
class FastWriter{
    PrintWriter out;
    FastWriter(){
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	out.flush();
    }
    void pl(Object o){
        out.write(o.toString());
	    out.write("\n");
        out.flush();
    }
    void pl(){
        out.write("\n");
    }
    void p(Object o){
        out.write(o.toString());
    }
    void close(){
        out.flush();
        out.close();
    }  
}


Measured memory_bytes: 32992
/*********************************************************************************\
*  _________  _      _  ________  _       _       __       ________               *
* |___   ___|| |    | ||  ______|| |     | |     /  \     |  ____  |              *
*     | |    | |    | || |______ | |_____| |    / /\ \    | |____| |              *
*     | |    | |    | ||______  ||  _____  |   / /__\ \   |  __  __|              *
*     | |    | |____| | ______| || |     | |  / ______ \  | |  \ \                *
*     |_|    |________||________||_|     |_| /_/      \_\ |_|   \_\               *
*  ________       __      ________  _    __       __       ________               *
* |  ______|     /  \    |  ____  || |  / /      /  \     |  ____  |              *
* | |______     / /\ \   | |____| || |_/ /      / /\ \    | |____| |              *
* |______  |   / /__\ \  |  __  __||  __ \     / /__\ \   |  __  __|              *
*  ______| |  / ______ \ | |  \ \  | |  \ \   / ______ \  | |  \ \                *
* |________| /_/      \_\|_|   \_\ |_|   \_\ /_/      \_\ |_|   \_\               *
*                                                                                 *
*                                                                                 *
*   Department of Computer Science & Engineering                                  *
*   Student ID : 18CSE035                                                         *
*   Bangabnadhu Sheikh Mujibur Rahman Science & Technology University,Gopalgonj.  *
*                                                                                 *
\*********************************************************************************/
 
//Now Write to Code ___________________________
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int N,K,cnt = 0;

	cin >> N >> K;
	while(N != 0)
	{
       N = N/K;
       cnt++;
	}

    cout << cnt << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

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

  ll a, b, n;
  cin >> a >> b >> n;

  if (n >= b) {
    cout << floor((a * (b - 1) / b)) << endl;
  } else {
    cout << floor((a * n / b)) << endl;
  }

  return 0;
}


Measured memory_bytes: 3696
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>
//#include <bits/stdc++.h>
template<typename T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}
using namespace std;
#define ALL(X) X.begin(),X.end()
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=2147483647;
const ll LLMAX=9223372036854775807;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll H1,M1,H2,M2,K;
    cin>>H1>>M1>>H2>>M2>>K;
    
    ll time=0;
    if(H1<=H2){
        time=(H2-H1)*60;
    }else{
        time=(H2+24-H1)*60;
    }
    
    time+=M2-M1;
    
    cout<<time-K<<endl;
    
    return 0;
}


Measured memory_bytes: 3612
#include <iostream>
using namespace std;
int main()
{
	int a, b, c, d,x,y;
	cin >> a >> b >> c >> d;
	x = c - a;
	y = d - b;
	cout << c - y <<" "<< d + x <<" "<< a - y <<" "<< b + x<<"\n";
	return 0;
}

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

int pow( int x, int y)
{
	int r = x;

	for(int i = 1; i < y; i++)
		r*=x;

	return r;
}

int main()
{
	int n;
	int dp[31];

	memset( dp, 0, sizeof(dp) );
	dp[1] = 1;
	dp[2] = 2;
	for(int i = 3; i <=30; i++)
	{
		if( i % 2 == 1 )
			dp[i] = dp[i-1] + pow(3, (i-1)/2);
		else if( i % 2 == 0 )
			dp[i] = dp[i-2] + 2*pow(3, (i-2)/2);
	}

	while( ~scanf("%d", &n) )
	{
		std::cout << dp[n] <<std::endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
from sys import stdin,stdout
M=10**9+7
n=int(stdin.readline())
# a,b,c,d=list(map(int,stdin.readline().split()))
# pp=int(pow(10,n-2))
# ans=(pp*n*(n-1))
ans=(10**n)-2*(9**n)+(8**n)
print(ans%M)

Measured memory_bytes: 11108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
const int INF=1e9+5;
const int N=2e3+5;
const int mod=998244353;

int n;

void dfs(string& s,int maxx){
	if((int)s.size()==n){
		cout<<s<<endl;
		return;
	}
	for(int i=0;i<maxx;++i){
		s+=(char)('a'+i);
		dfs(s,maxx);
		s.pop_back();
	}
	s.push_back('a'+maxx);
	dfs(s,maxx+1);
	s.pop_back();
}
		

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin>>n;
	string s="";
	dfs(s,0);
	return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T> std::ostream& operator << (std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  return os;
}

template<class T, class S> std::ostream& operator << (std::ostream& os, std::vector< std::pair<T, S> > vp)
{
  ll i = 0;
  for (auto p : vp){os << " [" << i++ << "]" << p.first << " " << p.second; if (i % 10 == 0) os << std::endl;}
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H head) { std::cout << head << std::endl; }
template<typename H, typename... T> void print(H head, T... tail){ std::cout << head << " ", print(tail...); }

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

  ll N, K;
  std::cin >> N >> K;
  std::vector< ll > vx(N, 0LL);
  for (ll i = 0; i < N; i++) {
    std::cin >> vx[i];
  }

  ll sum = 0LL;
  for (ll i = 0; i < N; i++) {
    if (std::abs(vx[i]) < std::abs(vx[i] - K)) {
      sum += std::abs(vx[i]) * 2;
    } else {
      sum += std::abs(vx[i] - K) * 2;
    }
  }

  print(sum);
  return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	int a[n];
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) {
		for (int j = i; j < n; j++) {
			swap(a[i], a[j]);
			bool ok = true;
			for (int k = 1; k < n; k++) {
				if (a[k] > a[k - 1]) continue;
				ok = false;
				break;
			}
			if (ok) {
				cout << "YES" << endl;
				return 0;
			}
			swap(a[i], a[j]);
		}	
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
////////////////////////////////////////////
///                                      ///
///        Template ver. 1.2. rapel      ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define F first
#define S second
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define endl '\n'
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

void hora(int tc) {
	int n;
	cin>>n;
	string a, b;
	cin>>a>>b;
	for(int i = 0;i < n;i++) cout<<a[i]<<b[i];
	cout<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

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

static const double eps = 1e-8;

int path[26][26];
int visited[26];
bool isConnect;

int dfs(int src,int* visited){
	visited[src] = 1;
	int res = 1;
	for(int i=0;i<26;i++){
		if(path[src][i] && visited[i] == 0){
			res += dfs(i,visited);
		}
	}
	return res;
}

int main(){
	int n;
	
	while(~scanf("%d",&n)){
		if(n==0) break;
		memset(path,0,sizeof(path));
		memset(visited,0,sizeof(visited));
		set<int> src;
		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			//if(*str.begin()-'a' != *(str.end()-1)-'a'){
				path[*str.begin()-'a'][*(str.end()-1)-'a']++;
			//}

			src.insert(*(str.end()-1)-'a');
			src.insert(*str.begin()-'a');
		}
				

		if(src.size() != dfs(*src.begin(),visited)){
			printf("NG\n");
			continue;
		}

		bool isok=true;

		for(set<int>::iterator it = src.begin(); it != src.end(); it++){
			int out=0;
			for(int j=0;j<26;j++){
				out += path[*it][j];
			}

			int in=0;
			for(int j=0;j<26;j++){
				in += path[j][*it];
			}

			if(out != in) isok = false;
		}

		printf("%s\n",isok ? "OK" : "NG");
	}
}

Measured memory_bytes: 932
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define iFOR(idx, from, upto) for (int  idx = from; idx < upto; ++idx)
#define lFOR(idx, from, upto) for (long idx = from; idx < upto; ++idx)

#define ll long long

using namespace std;

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

    int retval = (n * (n - 1) / 2) + (m * (m - 1) / 2);

    cout << retval << endl;

    // code here
    return 0;
}


Measured memory_bytes: 256
import bisect
n=int(input())
a=list(map(int,input().split()))
s=[0]
for i in range(n):
  s.append(s[i]+a[i])
x=s[n]//2
idex = bisect.bisect_left(s,x)
ans=min(abs(s[n]-2*s[idex-1]),abs(s[n]-2*s[idex]))
#print("s=",s,"idex=",idex,"s[n]",s[n],"s[idex-1]",s[idex-1])
print(ans)

Measured memory_bytes: 99916
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<map>
using namespace std;

int main(void)
{
	int N, M;
	cin >> N >> M;

	vector<int> A(N);
	for (int i = 0; i < A.size(); i++)
	{
		cin >> A[i];
	}

	vector<int> imos(N+1, 0);
	for (int i = 0; i < N; i++)
	{
		imos[i+1] = (imos[i] + A[i]) % M;
	}

	long long ret = 0;
	map<int, long long> cnt;
	for (int i = 0; i < imos.size(); i++)
	{
		ret += cnt[imos[i]];
		cnt[imos[i]]++;
	}

	cout << ret << endl;

	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define FORR(I,A,B) for(ll I = (B-1); I >= (A); --I)
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define REV(x) (reverse(x.begin(),x.end())) //reverse
const ll INF=1e18+7;
const ll MOD=1e9+7;

ll calc(ll m,ll n,ll mod){
	if(n==1)return m;
	ll ans = calc(m,n/2,mod);
	ans = ans*ans % mod;
	if(n&1)ans *= m;
	return ans%mod;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n,m;
	cin >> m >> n;
	cout << calc(m,n,MOD) << endl;
}


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

int main() {
    string S;
    cin >> S;
    if (S == "SSS" ) {
        cout << 0 << endl;
        }
    else if (S == "SRS" || S == "RSS" || S == "SSR" || S == "RSR") {
        cout << 1 << endl;
    }
    else if (S == "RRS" || S == "SRR" ) {
        cout << 2 << endl;
    }
    else if (S == "RRR" ) {
        cout << 3 << endl;
    }
    
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
const int MAXN = 200005;

int n, a[MAXN];

int main(){
	int i; LL sum = 0LL, tot = 0LL, ans = 1e18;
	scanf("%d", &n);
	for(i = 1; i <= n; ++ i)
		scanf("%d", &a[i]), sum += a[i];
	for(i = 1; i < n; ++ i){
		tot += a[i];
		if(abs(tot - (sum - tot)) < ans)
			ans = abs(tot - (sum - tot));
	} cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
// C - Traveling Plan

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int A[100002];

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

	for (int i=1; i<=N; i++) {
		cin >> A[i];
	}
	A[N+1] = 0;

	int S = 0;
	for (int i=1; i<=N+1; i++) {
		S += abs(A[i] - A[i-1]);
	}

	vector<int> ans;
	for (int i=1; i<=N; i++) {
		int T = S;
		T -= abs(A[i] - A[i-1]);
		T -= abs(A[i+1] - A[i]);
		T += abs(A[i+1] - A[i-1]);
		ans.push_back(T);
	}

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

	return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  set<int> st;
  for(int i = 0; i < N; i++) {
    int d;
    cin >> d;
    st.insert(d);
  }
  
  cout << st.size() << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll GCD(ll x,ll y){
	if(y==0){
		return x;
	}
	GCD(y,x%y);
}
ll cal(ll num,ll x,ll y,ll z){
	return num-num/x-num/y+num/z;
}
int main() {
	ll l,r,a,b;
	cin>>l>>r>>a>>b;
	ll gcd=GCD(max(a,b),min(a,b));
	ll lcm=a/gcd*b;
	ll ans1=cal(l-1,a,b,lcm);
	ll ans2=cal(r,a,b,lcm);
	cout << ans2-ans1;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) prllf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

ll gcd(ll x, ll y) {
    if(y == 0) {
        return x;
    }
    return gcd(y, x%y);
}

class Monoid {
public:
    // 単位元
    ll unit;

    Monoid() {
        // 単位元
        unit = 0;
    }
    
    // 演算関数
    ll calc(ll a, ll b) {
        return gcd(a, b); 
    }
};
 
class SegmentTree {
public:
    ll n;  // セグメント木の葉の要素数
    vector<ll> tree;  // セグメント木
    Monoid mono;  // モノイド
    
    SegmentTree(vector<ll> &v) {
        n = 1 << (ll)ceil(log2(v.size()));
        tree = vector<ll>(n << 1);
        for(ll i = 0; i < v.size(); i++) {
            update(i, v[i]);
        }
        for(ll i = v.size(); i < n; i++) {
            update(i, mono.unit);
        }
    }
    
    // k番目の値(0-index)をxに変更
    void update(ll k, ll x) {
        k += n;
        tree[k] = x;
        for(k = k >> 1; k > 0; k >>= 1){
            tree[k] = mono.calc(tree[k << 1 | 0], tree[k << 1 | 1]);
        }
    }
    
    // [l, r)(0-index)で演算をする
    ll query(ll l, ll r) {
        ll res = mono.unit;
        l += n;
        r += n;
        while(l < r) {
            if(l & 1) {
                res = mono.calc(res, tree[l++]);
            }
            if(r & 1) {
                res = mono.calc(res, tree[--r]);
            }
            l >>= 1;
            r >>= 1;
        }
        return res;
    }

    ll operator[](ll k) {
        // st[i]で添字iの要素の値を返す
        if(k - n >= 0 || k < 0) {
            return -INF;
        }
        return tree[tree.size()-n+k];
    }
    
    void show() {
        ll ret = 2;
        for(ll i = 1; i < 2*n; i++) {
            cout << tree[i] << " ";
            if(i == ret - 1) {
                cout << endl;
                ret <<= 1;
            }
        }
        cout << endl;
    }
};

int main() {
    ll n;
    cin >> n;
    
    vl v(n);
    rep(i, n) {
        cin >> v[i];
    }

    ll ans = 0;
    SegmentTree seg(v);
    rep(i, n) {
        ll now = seg[i];
        seg.update(i, 0);
        chmax(ans, seg.query(0, n));
        seg.update(i, now);
    }
    
    out(ans);
    re0;
}

Measured memory_bytes: 3072
using System;

class Program
{
  public static void Main(string[] args)
  {
    int i = 0;
    while(true)
    {
      i++;
      string read = Console.ReadLine();
      int num = int.Parse(read);
      if(num == 0) break;
      Console.WriteLine("Case {0}: {1}",i,num);
    }
  }
}

Measured memory_bytes: 9220
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(void){
    string s;
    string tmp;

    cin >> s;

    tmp=s;

    reverse(s.begin(),s.end());

    if(s==tmp)cout << "Yes" << endl;
    else cout << "No" << endl;    

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>

using namespace std;

int main() {
  int n = 0, a = 0, b = 0;
  cin >> n >> a >> b;
  string s = "";
  cin >> s;
  int aa = 0, bb = 0;
  for (int i=0; i<n; i++) {
    if (s.at(i) == 'a') {
      if (aa < a + b) {
        cout << "Yes" << endl;
        aa++;
      } else {
        cout << "No" << endl;
      }
    } else if (s.at(i) == 'b') {
      if (aa < a + b && bb < b) {
        cout << "Yes" << endl;
        aa++; bb++;
      } else {
        cout << "No" << endl;
      }
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
  


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

int main(){
  int N, n = 1, counter, ans = 0;
  cin >> N;
  while(n <= N){
    counter = 1;
    for(int i = 1; i < n/2; i++){
      if(n % i == 0)  counter++;
    }
    if(counter == 8)  ans ++;
    n += 2;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
s=input()
ans=[0]*(len(s)+1)
i=1
now="R"
cnt=1
col=[]
while i<len(s):
    if s[i]==now:
        cnt+=1
    else:
        col.append(cnt)
        if now=="R":now="L"
        else:now="R"
        cnt=1
    i+=1
col.append(cnt)
import math
k=0
for i in range(0,len(col),2):
    ans[k+col[i]]=math.ceil(col[i]/2)+math.floor(col[i+1]/2)
    ans[k+col[i]+1]=math.ceil(col[i+1]/2)+math.floor(col[i]/2)
    k+=col[i]+col[i+1]

ans.pop(0)
print(*ans)

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

int GetGCD(int a, int b){
   if(b==0) return a;

   return GetGCD(b, a%b);
}

int main(){
   int N, K;
   std::cin >> N >> K;
   std::vector<int> A(N);
   for(int i=0; i<N; ++i){
      std::cin >> A[i];
      if(A[i]==K){
	 std::cout << "POSSIBLE" << std::endl;
	 return 0;
      }
   }

   std::sort(A.begin(),A.end());
   if(K>=A[A.size()-1]){
      std::cout << "IMPOSSIBLE" << std::endl;
      return 0;
   }

   int gcd = A[0];
   for(int i=1; i<N; ++i){
      gcd = GetGCD(A[i],gcd);
   }
   if(gcd==1){
      std::cout << "POSSIBLE" << std::endl;
   }else{
      if(K%gcd==0)
	 std::cout << "POSSIBLE" << std::endl;
      else
	 std::cout << "IMPOSSIBLE" << std::endl;
   }
   return 0;

}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int k,a,b;
int main()
{
	cin>>k>>a>>b;
	bool ok=false;
	for(int i=a;i<=b;i++)
	{
		if(i%k==0)
		{
			ok=true;
		}
	}
	if(ok)
	{
		cout<<"OK"<<endl;
	}
	else
	{
		cout<<"NG"<<endl;
	}
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
 
int main(){
  int A,B,K;
  cin>>A>>B>>K;
  if(K<=(B-A)/2){
    for(int i=A;i<A+K;i++){
      cout<<i<<endl;
    }
    for(int i=B-K+1;i<=B;i++){
      cout<<i<<endl;
    }
  }
  if(K>(B-A)/2){
    for(int i=A;i<=B;i++){
      cout<<i<<endl;
    }
  }
}

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

using namespace std;
using ll = long long;
template <typename T> T In() {
    T t;
    cin >> t;
    return t;
}
template <typename T> vector<vector<T>> Vec2(int i, int j, T ini = 0) {
    vector<vector<T>> vec(i, vector<T>(j, ini));
    return move(vec);
}
template <typename T>
vector<vector<vector<T>>> Vec3(int i, int j, int k, T ini = 0) {
    vector<vector<vector<T>>> vec(i, vector<vector<T>>(j, vector<T>(k, ini)));
    return move(vec);
}

int main() {
    auto S = In<string>();
    bool ok = true;
    for(int i = 1; i <= S.length(); i++) {
        char c = S[i - 1];
        if(i % 2 == 1) {
            if(c != 'R' && c != 'U' && c != 'D') {
                ok = false;
            }
        } else {
            if(c != 'L' && c != 'U' && c != 'D') {
                ok = false;
            }
        }
    }
    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 400005
#define LL long long
using namespace std;
int n,m,a[N],f[N]; LL ans;
struct edge{
	int x,y,z;
	edge(int _x=0,int _y=0,int _z=0){ x=_x,y=_y,z=_z;}
}G[N];
int find(int x){ return f[x] ? f[x]=find(f[x]) : x;}
bool cmp(edge p,edge q){ return p.z<q.z;}
int main()
{
	int i,fx,fy;
	scanf("%d %d",&n,&m);
	memset(a,127,sizeof(a));
	for(i=1;i<=m;i++){
		scanf("%d %d %d",&G[i].x,&G[i].y,&G[i].z);
		G[i].x++,G[i].y++;
		a[G[i].x]=min(a[G[i].x],G[i].z+1);
		a[G[i].y]=min(a[G[i].y],G[i].z+2);
	  }
	for(i=2;i<=2*n;i++)
		a[i]=min(a[i],a[i-1]+2);
	for(i=1;i<=n;i++)
		G[++m]=edge(i,i%n+1,min(a[i],a[i+n]));
	sort(G+1,G+m+1,cmp);
	for(i=1;i<=m;i++){
		fx=find(G[i].x);
		fy=find(G[i].y);
		if(fx!=fy)
			f[fx]=fy,ans+=G[i].z;
	  }
	cout<<ans;
	return 0;
}


Measured memory_bytes: 11008
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
ll MOD = 1000000007;
ll INF =1<<30;



int main(){
   int A,B,m;
   cin >> A>>B>>m;
   vector<int>a(A),b(B);
   rep(i,A) cin >> a[i];
   rep(i,B) cin >> b[i];
   int ma = 220000;
   rep(i,m){
       int x,y,c;
       cin >> x>>y>>c;
       x--,y--;
       ma = min (ma,a[x]+b[y]-c);
   }
   int mia = 110000,mib= 110000;
   rep(i,A) mia = min(mia,a[i]);
   rep(i,B) mib = min (mib,b[i]);
   cout << min(ma,mia+mib) <<endl;
}

Measured memory_bytes: 3952
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>

#define INF 1e09

using std::cin;
using std::cout;
using std::endl;
using std::setprecision;
using std::fixed;
using std::pair;
using std::make_pair;
using std::min;
using std::max;
using std::string;
using std::vector;
using std::list;
using std::map;
using std::set; // insert erase find count
using std::queue;
using std::priority_queue;
using std::stack;

typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, pair<int, int> > PIII;

#define MAX 1e05+1

int main(void) {
    int n;
    cin >> n;
    int start;
    int end;
    VI table(MAX + 1, 0);

    for (int i = 0; i < n; i++) {
        cin >> start >> end;
        start--;
        end--;
        for (int j = start; j <= end; j++) {
            table[j]++;
        }
    }
    /*
    for (int i = 0; i < 10; i++) {
        cout << i << ", " << table[i] << endl;
    }
    */
    for (int i = MAX; i >= 0; i--) {
        if (i <= table[i]) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 3080
#include <iostream>

using namespace std;

int main(){
  int e,ee,m,x,y,z;
  while (true){
    cin >> e;
    if (!e)
      break;
    x = 0;
    y = 0;
    z = 0;
    m = e;
    while(e>=z*z*z){
      ee = e;
      ee -= z*z*z;
      y = 0;
      while(ee>=y*y)
	y++;
      y--;
      ee -= y*y;
      x = ee;
      if (m>x+y+z)
	m = x+y+z;
      z++;
    }
    z--;
    cout << m << endl;
  }
  return 0;
}

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

int main() {
	  
    int a,b,c;
    cin>>a>>b>>c;
    
    int antidotes = a+b;
    
    int ans = 0;
    
    if(antidotes>=c)
        ans+=c;
        else
        {
            ans+=antidotes+1;
        }
    ans+=b;
    
    cout<<ans;
	return 0;
}


Measured memory_bytes: 256
package main

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

var (
	X, A, B int
)

func readVariables() {
	X, A, B = nextInt(), nextInt(), nextInt()
}

func main() {
	readVariables()
	var answer string
	if B <= A {
		answer = "delicious"
	} else if B <= A+X {
		answer = "safe"
	} else {
		answer = "dangerous"
	}
	fmt.Println(answer)
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}


Measured memory_bytes: 640
import math
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n=I()
ds=LI()
#print(ds)
D=sum(ds)
def sqr(x):
    return x*x
dds=[]
for d in ds:
    dds.append(d*d)
#print(dds)
sigma=sum(dds)
ans=(D*D-sigma)/2
print(int(ans))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NM = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            var N = NM[0]; var M = NM[1];
            var A = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);

            var items = new PriorityQueue<long>(false);
            long amount = 0;
            for (int i = 0; i < N; i++)
            {
                amount += A[i];
                items.Push(A[i]);
            }

            for (int i = 0; i < M; i++)
            {
                var item = items.Pop();
                var discount = item / 2;
                amount -= item - discount;
                items.Push(discount);
            }
            Console.WriteLine(amount);
        }
    }


    class PriorityQueue<T> where T : IComparable<T>
    {
        private List<T> nodes;
        private Boolean isAsc;

        public PriorityQueue(Boolean _isAsc)
        {
            this.nodes = new List<T>();
            this.isAsc = _isAsc;
        }

        public int Count()
        {
            return this.nodes.Count;
        }
        public T Pop()
        {
            T returnNode = this.nodes[0];
            this.nodes[0] = this.nodes[nodes.Count - 1];
            this.nodes.RemoveAt(nodes.Count - 1);
            int root = 0;
            while (root * 2 + 1 < this.nodes.Count)
            {
                int child = root * 2 + 1;
                if (child + 1 < this.nodes.Count && compare(this.nodes[child + 1], this.nodes[child]) > 0) child += 1;
                if (compare(this.nodes[child], this.nodes[root]) > 0)
                {
                    swap(child, root);
                    root = child;
                }
                else
                {
                    break;
                }
            }
            return returnNode;
        }
        public T Top()
        {
            return this.nodes[0];
        }
        public void Push(T t)
        {
            this.nodes.Add(t);
            var addPosition = nodes.Count - 1;
            while (addPosition > 0)
            {
                var parent = (int)(addPosition - 1) / 2;
                if (compare(nodes[addPosition], nodes[parent]) > 0)
                {
                    swap(addPosition, parent);
                    addPosition = parent;
                }
                else
                {
                    break;
                }
            }
        }
        private int compare(T x, T y)
        {
            return this.isAsc ? y.CompareTo(x) : x.CompareTo(y);
        }
        private void swap(int x, int y)
        {
            T temp = nodes[x];
            nodes[x] = nodes[y];
            nodes[y] = temp;
        }
    }
}


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

int main(){

  string  str1,str2;

  cin >> str1 >>str2;
  
  str1=str1+str1;


  if(str1.find(str2) != -1){
    cout << "Yes" << endl;
      }
  else{
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 3204
from collections import Counter
from fractions import gcd
a, b = map(int, input().split())
n = int(max(a, b)**(1/2)) + 1

g = gcd(a, b)
cnt = Counter()
m = 2
while m*m<= g:
    while g % m == 0:
        g //= m
        cnt[m] += 1
    m += 1
if g > 1:
    cnt[g] += 1

print(len(cnt) + 1)


Measured memory_bytes: 5028
import Foundation

extension String {
    
    func toStrList() -> [String] {
        return self.map{String($0)}
    }
    
    func toIntList() -> [Int] {
        return self.map{Int(String($0))!}
    }
    
    func toSepDoubleList() -> [Double]{
        return self.split(separator: " ").map{Double($0)!}
    }

    func toSepIntList() -> [Int] {
        return self.split(separator: " ").map{Int($0)!}
    }

    func toSepStrList() -> [String] {
        return self.split(separator: " ").map{String($0)}
    }
    
    func zFill(n:Int) -> String {
        return String(format: "%0\(n)d", Int(self)!)
    }
    
    func count(c:Character) -> Int{
        var result = 0

        for e in self{
            if e == c{
                result += 1
            }
        }
        return result
    }

    func counter() -> Dictionary<Character, Int>{
        var result:[Character:Int] = [:]
        
        for c in self{
            guard let _ = result.index(forKey: c) else {
                result[c] = 1
                continue
            }
            result[c]! += 1
        }
        return result
    }
}

extension Int {
    func toBin() -> String {
        return String(self, radix: 2)
    }
    
    func toNBin(_ radix:Int) -> String{
        return String(self, radix: radix)
    }
    
    func toD() -> Double {
        return Double(self)
    }
}

extension Double {
    func toI() -> Int {
        return Int(self)
    }
}

extension Array where Element: Equatable{
    func count(n:Self.Element) -> Int{
        var result = 0
        for e in self{
            if e == n{
                result += 1
            }
        }
        return result
    }
}

func pow(_ base:Int,_ exp:Int) -> Int{
    let d = pow(base.toD(), exp.toD())
    return Int(d)
}

func distance(p1:CGPoint, p2:CGPoint) -> Double {
    let diffp = CGPoint(x:p1.x - p2.x, y:p1.y - p2.y)
    return Double(sqrt(diffp.x*diffp.x + diffp.y * diffp.y))
}

func distance(p1:[Double], p2:[Double]) -> Double{
    let diff = [p1[0] - p2[0], p1[1] - p2[1]]
    return sqrt(diff[0] * diff[0] + diff[1] * diff[1])
    
}

func lotate(theta:Double, point:[Double]) -> [Double] {
    let matrix = [
        [cos(theta), -sin(theta)],
        [sin(theta), cos(theta)]
    ]
    let x = point[0]
    let y = point[1]
    
    let rx = matrix[0][0]*x + matrix[0][1]*y
    let ry = matrix[1][0]*x + matrix[1][1]*y
    
    return [rx, ry]
}


func abc168c() -> Double {
    let ABHM = readLine()!.toSepDoubleList()
    let Mprob = ABHM[3] / 60
    let Hprob = (ABHM[2] / 12.0) + ((1/12) * Mprob)
    let Apoint = lotate(theta: 2.0*Double.pi*Hprob, point: [0, ABHM[0]])
    let Bpoint = lotate(theta: 2.0*Double.pi*Mprob, point: [0, ABHM[1]])
    return distance(p1: Apoint, p2: Bpoint)
}


print(abc168c())



Measured memory_bytes: 13840
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
	int n,n_temp[52];
	char c_temp[53],s[14],h[14],c[14],d[14];
	cin >> n;
	
	for(int i = 0;i < n;i++){
		cin >> c_temp[i] >> n_temp[i];
		
		switch(c_temp[i]){
			case 'S': s[n_temp[i] - 1] = 'S'; break;
			case 'H': h[n_temp[i] - 1] = 'H'; break;
		    case 'C': c[n_temp[i] - 1] = 'C'; break;
		    case 'D': d[n_temp[i] - 1] = 'D'; break;
		   }
		  }
			
	for(int i = 0;i < 13;i++){
		if(s[i] != 'S') cout << "S "<< i + 1 << endl;
	}
	
	for(int i = 0;i < 13;i++){
		if(h[i] != 'H') cout << "H " << i + 1 << endl;
	}
	
	for(int i = 0;i < 13;i++){
		if(c[i] != 'C') cout << "C " << i + 1 << endl;
		}
	
	for(int i = 0;i < 13;i++){
		if(d[i] != 'D') cout << "D " << i + 1 << endl;
		}
		
		return 0;			
}

Measured memory_bytes: 3096
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        long ans = 0L;
        for (int i = 0; i < k; i++) {
            ans += a[i];
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 38968
#include<stdio.h>
int main(void){
  int a, b, k, i, j = 0;

  scanf("%d %d %d", &a, &b, &k);
  for(i = a; j < k; i--){
    if(a % i == 0 && b % i == 0) j++;
  }
  printf("%d\n", i+1);
  return 0;
}



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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

ll gcd(ll x,ll y){
  if(x%y==0) return y;
  
  return gcd(y,x%y);
}

ll lcm(ll x,ll y){
  return x*y/gcd(x,y);
}

int main(void){
  ll a,b; cin >> a >> b;

  cout << lcm(a,b) << endl;
  
  return 0;
}


Measured memory_bytes: 3520