akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;

int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  i32 A, B, C;
  cin >> A >> B >> C;
  
  bool b = true;
  if(A == 5) {
    if((B == 5 && C == 7) || (B == 7 && C == 5)) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  } else if(A == 7) {
    if(B == 5 && C == 5) {
      cout << "YES" << endl;
    } else {
      cout << "NO" << endl;
    }
  } else
    cout << "NO" << endl;
  
  return 0;
}


Measured memory_bytes: 256
#input
N, K = map(int,input().split())
H = input().split()

#cast
for i in range(N):
  H[i] = int(H[i])

#sort
H.sort(reverse = True)

#calculate
ans = 0

if N > K:
  for i in range(K,N):
    ans += H[i]

print(ans)

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

namespace _20180502_pra
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split(' ');
            int b = int.Parse(a[0]);
            int c = int.Parse(a[1]);

            int count = 0;

            for(int i = b; i <= c; i++)
            {
                string d = Convert.ToString(i);
                char[] n = d.ToCharArray();
                Array.Reverse(n);

                string m = new string(n);

               
                if (d == m)
                {
                    count++;
                }
               
            }

            Console.WriteLine(count);

            

        }
    }
}

Measured memory_bytes: 15308
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solveA();
		// new Main().solveB();
		// new Main().solveC();
		// new Main().solveD();
	}

	private void solveA() {
		Scanner scanner = null;
		int first = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			first = scanner.nextInt();

			switch (first) {
			case 1:
				System.out.println("Hello World");
				break;
			case 2:
				int numA = scanner.nextInt();
				int numB = scanner.nextInt();
				System.out.println(numA + numB);

				break;
			default:
				break;
			}

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveB() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveC() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}

	private void solveD() {
		Scanner scanner = null;
		int lineAB = 0;
		int lineBC = 0;
		int lineCA = 0;

		try {
			scanner = new Scanner(System.in);
			lineAB = scanner.nextInt();

			System.out.println("");

		} finally {
			if (scanner != null) {
				scanner.close();
			}
		}
	}
}

Measured memory_bytes: 22740
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
//#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int>
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >
#define vpl vector< pair<ll,ll> >
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define cd complex<double>
#define PI 4*atan(1)
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

int main()
{
	FAST;
	ll h, a;
	cin >> h >> a;
	ll ans = h/a;
	if(h % a != 0)
		ans++;
	cout << ans;
}


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


typedef long long ll;

using namespace std;


const ll mod=1000000007;

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

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

int main(){

    int N;
    cin>>N;

    map<int,int> m;

    for(int n=1;n<=N;n++){
        int p=n;
       for(int i=2;i*i<=n;i++){
           int count=0;
           if(p%i!=0)continue;
           while(p%i==0){
              
               ++count;
                p/=i;
           }
           m[i]+=count;
           //cout<<i<<":"<<count<<endl;
       }
       if(p!=1)++m[p];
         //cout<<p<<":"<<1<<endl;
    }

    vector<int> vec(6,0);
    for(map<int,int>::iterator itr=m.begin();itr!=m.end();++itr){
       // cout<<itr->first<<":"<<itr->second<<endl;
        if(itr->second>=74){
            ++vec[0];
        }else if(itr->second>=24){
            ++vec[1];
        }else if(itr->second>=14){
            ++vec[2];
        }else if(itr->second>=4){
            ++vec[3];
        }else if(itr->second>=2){
            ++vec[4];
        }else{
            ++vec[5];
        }
       
    }
     //cout<<vec[0]<<":"<<vec[1]<<":"<<vec[2]<<":"<<vec[3]<<":"<<vec[4]<<endl;
        int ans=(vec[0]+vec[1])*(vec[0]+vec[1]+vec[2]+vec[3]+vec[4]-1);
            ans+=(vec[0]+vec[1]+vec[2])*(vec[0]+vec[1]+vec[2]+vec[3]-1);
            ans+=(vec[0]+vec[1]+vec[2]+vec[3])*(vec[0]+vec[1]+vec[2]+vec[3]-1)/2*(vec[0]+vec[1]+vec[2]+vec[3]+vec[4]-2);
            ans+=vec[0];
        cout<<ans<<endl;
   

    
    
}




Measured memory_bytes: 3620
def selection_sort(A):
    count = 0
    for i in range(len(A)):
        min_value = A[i]
        min_value_index = i
        # print('- i:', i, 'A[i]', A[i], '-')
        for j in range(i, len(A)):
            # print('j:', j, 'A[j]:', A[j])
            
            if A[j] < min_value:
                min_value = A[j]
                min_value_index = j
        # print('min_value', min_value, 'min_value_index', min_value_index)
        if i != min_value_index:
            count += 1
            A[i], A[min_value_index] = A[min_value_index], A[i]
            # print('swap!', A)
        
    return count

n = int(input())
A = list(map(int, input().split()))
count = selection_sort(A)
print(*A)
print(count)


Measured memory_bytes: 5608
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const long long  mod = 1000000007;


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

  int n = sz(s)+1;
  vector<int> a(n);
  rep(i, n-1){
    if(s[i] == '<') a[i+1] = max(a[i+1], a[i]+1);
  }
  for(int i = n-1; i >=0; i--){
    if(s[i] == '>') a[i] = max(a[i], a[i+1]+1);
  }

  ll ans = 0;
  for(auto i : a){
    ans += i;
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 5864
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
ans=0
for i in range(N):
  A=list(map(int,input().split()))
  ans += 1 if sum([A[k]*B[k] for k in range(M)])+C > 0 else 0
print(ans)

Measured memory_bytes: 3064
#include <cmath>
#include <cstdio>
#include <algorithm>
typedef long long ll;

int T;
ll a,b;

int main()
{
	for(scanf("%d",&T);T--;)
	{
		scanf("%lld%lld",&a,&b);
		if(a>b)std::swap(a,b);
		ll s=a*b,c=sqrt(s),Ans;
		if(c*c==s)Ans=(c-1)*2-(a<c);
		else Ans=c*2-(c*(c+1)>=s)-(a<=c);
		printf("%lld\n",Ans);
	}
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3

import sys
# import math
# from string import ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    # inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    a = ii()
    b = ii()
    h = ii()
    print((a + b) * h // 2)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int a,b; 
int main()
{
	cin>>a>>b;
	for(int i=1;i<=10000;++i)
	{
		int x=i*8/100,y=i*10/100;
		if(x==a&&y==b)
		{
			cout<<i;
			return 0;
		}
	}
	cout<<-1; 
	return 0;
}

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

using namespace std;

typedef unsigned long long ull;

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

    int a, b, c;
    cin >> a >> b >> c;
    int s1 = a*10 + b + c;
    int s2 = a + b*10+c;
    int s3 = c * 10 + b + a;

    cout << max(max(s1, s2), s3);
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
int a[5];
  int k;
  for(int i=0;i<5;i++){
	scanf("%d",&a[i]);
  }
  scanf("%d",&k);
  int c=0;
  for(int i=0;i<4;i++){
	for(int j=i+1;j<5;j++){
	if(a[j]-a[i]>k)c++;
    }
  }
  if(c>0)printf(":(");
  else printf("Yay!");
  return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
<url:https://abc061.contest.atcoder.jp/tasks/abc061_c>
問題文============================================================
 空の配列が 1 つあります。
 この配列に、整数を配列に挿入する操作を N 回行います。
 i(1≦i≦N) 回目の操作では、配列に整数 ai を bi 個挿入します。
 N 回の挿入操作後の配列の中で、K 番目に小さい数を求めてください。
 例えば、配列が {1,2,2,3,3,3} の時、4 番目に小さい数は 3 となります。
 
=================================================================

解説=============================================================
シミュレーション
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    ll N,K; cin >> N >> K;
    vector<pii> ab(N);
    for(auto &in:ab) cin >> in.first >> in.second;
    sort(ab.begin(),ab.end());
    for(int i = 0; i < N;i++){
        if(ab[i].second < K){
            K -= ab[i].second;
        }else{
            cout << ab[i].first << endl;
            break;
        }
    }
	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define int long long
#define sqr(x) ((x)*(x))
#define mp make_pair
#define uint unsigned
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
	int x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
	}
	write(a); puts("");
}
inline int rnd(int x){
	return rand()%x;
}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=100005,mod=1000000007;
int n,m,k,cnt,ti,dfn[N],low[N],have[N],iscut[N],bccno[N];
vector<int> G[N],bcc[N];
stack<PI> S;
void dfs(int u,int fa){  
    low[u]=dfn[u]=++ti;  
    int child=0;  
    for(unsigned i=0;i<G[u].size();i++){  
        int v =G[u][i];  
        PI e=mp(u,v);  
        if(!dfn[v]){  
            S.push(e); child++; 
            dfs(v,u);
            low[u]=min(low[u],low[v]);  
            if(low[v]>=dfn[u]){  
                iscut[u]=true;  
                cnt++; bcc[cnt].clear();  
                while(1){
                    PI x = S.top(); S.pop();  
                    if(bccno[x.first]!=cnt){
                        bcc[cnt].push_back(x.first);
                        bccno[x.first]=cnt;
                    }
                    if(bccno[x.second]!=cnt){  
                        bcc[cnt].push_back(x.second);
                        bccno[x.second]=cnt;
                    }
                    have[cnt]++;
                    if(x.first==u&&x.second==v)break;  
                }
			}
		}
        else if(dfn[v]<dfn[u]&&v!=fa){  
                S.push(e);
                low[u]=min(low[u],dfn[v]);  
        }
    }
    if(fa==0&&child==1)iscut[u]=0;
}
inline int ksm(ll a,int b){
	int ans=1;
	for(;b;b>>=1){
		if(b&1)ans=ans*a%mod;
		a=a*a%mod;
	}
	return ans;
}
inline int c(int a,int b){
	ll ans=1;
	for(int i=a;i>a-b;i--)ans=ans*i%mod;
	for(int i=1;i<=b;i++)ans=ans*ksm(i,mod-2)%mod;
	return ans;
}
signed main(){
	n=read(); m=read(); k=read();
	for(int i=1;i<=m;i++){
		int s=read(),t=read();
		G[s].push_back(t); G[t].push_back(s);
	}
	for(int i=1;i<=n;i++)if(!dfn[i])dfs(i,0);
	ll ans=1;
	for(int i=1;i<=cnt;i++){
		//cout<<have[i]<<" SZBAKKING "<<bcc[i].size()<<endl;
		//for(unsigned j=0;j<bcc[i].size();j++)cout<<bcc[i][j]<<" "; puts("");
		if(have[i]==1)ans=ans*k%mod;
		else if(have[i]==bcc[i].size()){
			ll sum=0;
			for(int j=1;j<=have[i];j++)sum=(sum+ksm(k,__gcd(j,have[i])))%mod;
			sum=sum*ksm(have[i],mod-2)%mod;
			ans=ans*sum%mod;
		}else{
			ans=ans*c(have[i]+k-1,k-1)%mod;
		}
		//cout<<ans<<" "<<c(have[i]+k-1,k-1)<<endl;
	}
	cout<<ans<<endl;
}
/*
11 12 5
3 1
8 2
4 9
5 4
1 6
2 9
8 3
10 8
4 10
8 6
11 7
1 8

*/

Measured memory_bytes: 8448
N = int(input())
A = []
B = []
for _ in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
A.sort()
B.sort(reverse=True)
#print(A,B)
if N % 2 == 1:
    x = (N+1) // 2
    ans = B[x-1] - A[x-1] + 1
else:
    x = N // 2
    ans = (B[x-1] + B[x]) - (A[x] + A[x-1]) + 1
print(ans)

Measured memory_bytes: 25536
/*
    Ujjawal Pabreja
*/
#include <bits/stdc++.h> 
#include <functional> 
using namespace std;
using ll = long long;
using ld = long double;
#define speed_cubing    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define rep(i,a)        for(ll i = 0 ; i < a ; i++)
#define repe(i,a,b)     for(ll i = a ; i < b ; i++)
#define bac(i,a)        for(ll i = a ; i >= 0 ; i--)
#define bace(i,a,b)     for(ll i = a ; i >= b ; i--)
#define pb              push_back
#define mp              make_pair
#define in              insert
#define ff              first
#define ss              second
#define vv              vector
#define vll             vector <ll>
#define pll             pair <ll,ll>
#define vpll            vector <pll>
#define umap            unordered_map
#define uset            unordered_set
#define mset            multiset
#define pqueue          priority_queue
#define setbit(x)       __builtin_popcountll(x)
#define init(c,a)       memset(c,a,sizeof(c))
#define all(c)          c.begin(),c.end()
#define sz(c)           (ll)c.size()
#define lb              lower_bound
#define ub              upper_bound
#define maxe            *max_element
#define mine            *min_element
#define gcd(a,b)        __gcd(a,b)
#define rev             reverse
#define Y				"YES"
#define N 				"NO"
#define nl              "\n"
#define debug(x)        cout << #x << " : " << x << nl;
const ll inf = 1e18;  
const ll mod = 1e9 + 7;
const ll MOD = 998244353;
const ll MAX = 2e5 + 1;

// ====== int_1024t begins ======
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
// ====== int_1024t ends ======

// ====== pbds begins ======
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, 
//         tree_order_statistics_node_update> 
//         pbds; 
// ====== pbds ends ======

// ====== Useful functions begin ======
inline ll add(ll a,ll b) {return ((a%mod)+(b%mod))%mod;}
inline ll sub(ll a,ll b) {return ((a%mod)-(b%mod)+mod)%mod;}
inline ll mul(ll a,ll b) {return ((a%mod)*(b%mod))%mod;}
ll pwr(ll x,ll n){
    if(!n) return 1;
    if(n&1) return mul(x, pwr(mul(x,x),(n-1)/2));
    else return pwr(mul(x,x),n/2);
}
ll modinv(ll n){ 
    return pwr(n,mod - 2); 
}
// ====== Useful functions end ======
 
// ====== Variables begin ======

// ====== Variables end ======
void speed_solve(){
    ll n;
    cin >> n;
    ll a[n];
    rep(i,n) cin >> a[i];
    sort(a,a + n);
    ll tot = 0;
    repe(i,n/2, n){
        tot += (2 * a[i]);
    }
    tot -= a[n - 1];
    if(n&1){
        tot -= a[n / 2];
    }
    cout << tot;
}

int main(){
    speed_cubing;
    ll test_cases = 1;
    // cin >> test_cases;
    rep(i,test_cases){
        // cout << "Case #" << i + 1 << ": ";
        speed_solve();
    }
    return 0;
}

Measured memory_bytes: 5216
import java.io.*;
import java.util.*;
public class Main{


public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	int N=sc.nextInt();
	String pron[]=new String[10];
	pron[0]="pon";
	pron[1]="pon";
	pron[2]="hon";
	pron[3]="bon";
	pron[4]="hon";
	pron[5]="hon";
	pron[6]="pon";
	pron[7]="hon";
	pron[8]="pon";
	pron[9]="hon";
	System.out.println(pron[N%10]);
	
		
}

}


Measured memory_bytes: 35696
MOD = 10 ** 9 + 7
S = input()

dp = [0] * 13
dp[0] = 1

for s in S:
  prev = [x for x in dp]
  dp = [0] * 13
  if s == '?':
    add = range(10)
  else:
    add = [int(s)]
  for i in range(13):
    for x in add:
      dp[(10*i+x)%13] += prev[i]
  dp = [x % MOD for x in dp]
  
print(dp[5])


Measured memory_bytes: 43740
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int R, G, B, N;
  cin >> R >> G >> B >> N;
  int c = 0;

  for(int i = 0; R*i <= N; i++){
    for(int j = 0; R*i+G*j<=N; j++){
      if((N-R*i-G*j)%B==0) c++;
    }
  }

  cout << c << endl;

}

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

int main(){
    int A, B, C, N, M ,K;
    int sum = 0;
    int t = 0;
    string s, s1;
    cin >> N;

    vector<int> L(N);
    for(int i = 0; i < N; i++){
        cin >> L.at(i);
    }

    for(int i = 0; i < N; i++){
        t = max(t,L.at(i));
        sum += L.at(i);
        if(t == L.at(i)) K = i;
    }
    if(L.at(K) < sum-L.at(K)) cout << "Yes" << endl;
    else cout << "No" << endl;



//    vector<int> X();

//    for(int i = 0; i < ; i++){}
//    for(int j = 0; j < ; j++){}

//    cout <<  << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;


#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define each(it,c) for(__typeof(c.begin()) it=c.begin(); it!=c.end(); it++)
#define INF 1<<30
#define mp make_pair
#define pb push_back

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pair<int, int> > vp;
typedef map<int,int> mpii;
typedef priority_queue<int, vi, greater<int> > pqi;

typedef long long ll;


int main(){
	int n; cin>>n;
	vi a; a.resize(2*n);
	rep(i,2*n) cin>>a[i];
	sort(all(a));
	int cnt = 0;
	rep(i,n) cnt+=a[2*i];
	cout<<cnt<<endl;
	return 0;
}

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

using namespace std;

int k, t;
int a[501];

int main(){
	scanf("%d%d", &k, &t);
	for (int i = 1; i <= t; i++) scanf("%d", &a[i]);
	int ma = a[1];
	for (int i = 1; i <= t; i++) if (ma < a[i]) ma = a[i];

	int u = k - ma;
	if (u + 1 >= ma) puts("0");
	else printf("%d\n", ma - (u + 1));
}


Measured memory_bytes: 384
from sys import stdin
import bisect
def main():
    #入力
    readline=stdin.readline
    s=readline().strip()
    n=len(s)
    t=readline().strip()

    d=dict()
    for i in range(len(s)):
        if s[i] not in d:
            d[s[i]]=[i]
        else:
            d[s[i]].append(i)
        
    j=-1
    cnt=0
    ans=0
    for i in range(len(t)):
        if t[i] not in d:
            print(-1)
            break
        k=bisect.bisect_right(d[t[i]],j)
        if k<len(d[t[i]]):
            j=d[t[i]][k]
        else:
            cnt+=1
            j=d[t[i]][0]
        ans=j+cnt*n
    else:
        print(ans+1)

if __name__=="__main__":
    main()

Measured memory_bytes: 7668
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1L << 50;
enum mod = 10L^^9 + 7;

void main() {
    int n;
    scan(n);
    auto h = readln.split.to!(int[]);
    auto a = readln.split.to!(int[]);

    auto sg = SegmentTree!(long, max, 0)(n + 1);

    long ans;

    foreach (i ; 0 .. n) {
        long t = a[i] + sg.query(0, h[i]);
        ans = max(ans, t);
        sg.assign(h[i], t);
    }

    writeln(ans);
}



struct SegmentTree(T, alias op, T initValue = 0) {
    import std.functional : binaryFun;

    alias f = binaryFun!(op);

    T[] _data;
    int _treeSize, _lineSize = 1;

    // 配列の要素数 n だけ与えて初期化
    this(int n) {
        while (_lineSize < n) {
            _lineSize *= 2;
        }
        _treeSize = 2 * _lineSize - 1;
        _data = new T[](_treeSize);
        _data[] = initValue;
    }

    // 配列 a を与えて初期化
    this(T[] a) {
        auto n = a.length;
        while (_lineSize < n) {
            _lineSize *= 2;
        }
        _treeSize = 2 * _lineSize - 1;
        _data = new T[](_treeSize);
        _data[] = initValue;

        _data[_lineSize - 1 .. _lineSize - 1 + n] = a[];

        foreach_reverse (i; 0 .. _lineSize - 1) {
            _data[i] = f(_data[2 * i + 1], _data[2 * i + 2]);
        }
    }

    // a[i] = x
    void assign(int i, T x) {
        i += _lineSize - 1;
        _data[i] = x;

        while (i > 0) {
            i = (i - 1) / 2;
            _data[i] = f(_data[2 * i + 1], _data[2 * i + 2]);
        }
    }

    // a[i] = f(a[i], x)
    void act(int i, T x) {
        i += _lineSize - 1;
        _data[i] = f(_data[i], x);

        while (i > 0) {
            i = (i - 1) / 2;
            _data[i] = f(_data[2 * i + 1], _data[2 * i + 2]);
        }
    }

    alias add = act;

    // 要求区間 [a, b) に対して、対象区間 [l, r) の値を返す
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r == -1) {
            r = _lineSize;
        }
        if (a >= b) { // 要求区間が空である場合
            return initValue;
        }
        if (b <= l || r <= a) { // 要求区間が対象区間外の場合
            return initValue;
        }
        if (a <= l && r <= b) { // 要求区間が対象区間に含まれている場合
            return _data[k];
        }

        // どちらでもない場合は対象区間を２つに分けて再帰する

        auto leftValue = query(a, b, 2 * k + 1, l, l + (r - l) / 2);
        auto rightValue = query(a, b, 2 * k + 2, l + (r - l) / 2, r);

        return f(leftValue, rightValue);
    }
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 19088
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author DJ
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ARainySeason solver = new ARainySeason();
        solver.solve(1, in, out);
        out.close();
    }

    static class ARainySeason {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            int cnt = 1;
            if (s.contains("SSS")) {
                out.println("0");
            } else {
                for (int i = 0; i < s.length() - 1; ++i) {
                    if (s.charAt(i) == 'R' && s.charAt(i + 1) == 'R') {
                        cnt++;
                    }
                }
                out.println(cnt);
            }
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return nextString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 25580
#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(deprecated)]

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

const MOD_10_9_7: u64 = 1_000_000_007;
const INF: i64 = 1_000_000_000_000;
const MIN_INF: i64 = -1_000_000_000_000;

/// FYI: https://github.com/vain0x/scan-bench
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($format:tt)*) => (write!(std::io::stderr(), $($format)*).unwrap());
}

#[allow(unused_macros)]
macro_rules! debugln {
    ($($format:tt)*) => (writeln!(std::io::stderr(), $($format)*).unwrap());
}

fn main() {
    let n = read!(usize);
    let mut a: Vec<usize> = read![[usize]];
    a.sort();
    a.reverse();
    let mut alice = 0;
    let mut bob = 0;

    for i in 0..n {
        if i % 2 == 0 {
            alice += a[i];
        } else {
            bob += a[i];
        }
    }

    println!("{}", alice - bob);
}


Measured memory_bytes: 4352
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()


using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

vector<string> list;

void solve(int n, string s, int lim){
    if(n == 1){
        list.push_back(s);
        return;
    }
    for(int i = 0; i <= lim + 1; i++){
        char c = ('a' + i);
        string t = s;
        t.push_back(c);
        if(i != lim + 1)solve(n - 1, t, lim);
        else solve(n - 1, t, lim + 1);
    }
}

int main(){
    int n;
    cin >> n;
    string s = "a";
    solve(n, s, 0);
    sort(ALL(list));
    for(auto l : list)cout << l << endl;
}


Measured memory_bytes: 7796
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int x;
    cin >> x;
    vector<int> power;
    power.push_back(1);
    for(int i=0; i<x; i++){
        power.push_back(power[i]+(i+2));
        if(power[i+1]>=x) break;
    }
    if(x==1){
        cout << 1;
    }else{
        cout << power.size();
    }
    
    return 0;
}


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

int64_t mod = 1000000007;
int64_t large = 9223372036854775807;
double PI = 3.141592653589793;

int64_t gcd(int64_t p, int64_t q)
{
    if (p < q)
        swap(p, q);

    if (p % q == 0)
        return q;
    else
        return gcd(q, p % q);
}

int main()
{
    int64_t N, tmp, ans = 1;
    cin >> N;
    for (int64_t i = 0; i < N; i++)
    {
        cin >> tmp;
        ans = (ans / gcd(ans, tmp)) * tmp;
    }
    cout << ans;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <deque>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <unordered_map>
#include <unordered_set>

using namespace std;

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

	int sum = 0;
	for (int i = 0; i < n; ++i)
	{
		int h;
		cin >> h;
		if (h >= k)
		{
			++sum;
		}
	}

	cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>
#include <list>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int h, w, k; cin >> h >> w >> k;
	vector<string> s(h);
	vector<bool> isZ(h, 0);
	int firstLine = -1;
	rep(i, 0, h - 1)
	{
		cin >> s[i];
		bool zeroS = true;
		rep(j, 0, w - 1)if (s[i][j] == '#')zeroS = false;
		if (zeroS)isZ[i] = true;
		else if (!zeroS && firstLine == -1)firstLine = i;
	}
	
	vector<vector<int>> a(h, vector<int>(w, 0));
	int now = 1;
	rep(i, firstLine, h - 1)
	{
		if (isZ[i])
		{
			rep(j, 0, w - 1)a[i][j] = a[i - 1][j];
			continue;
		}

		bool firstS = true;
		rep(j, 0, w - 1)
		{
			if (s[i][j] == '#')
			{
				if (firstS)firstS = false;
				else ++now;
			}
			a[i][j] = now;
		}
		++now;
	}
	for (int i = firstLine - 1; i >= 0; --i)
	{
		if (isZ[i])rep(j, 0, w - 1)a[i][j] = a[i + 1][j];
	}
	rep(i, 0, h - 1)
	{
		rep(j, 0, w - 1)cout  << a[i][j] << " ";
		cout << "" << endl;
	}
}


Measured memory_bytes: 1280
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var A = int.Parse(Console.ReadLine());
            Console.WriteLine(N * N - A);
        }
    }
}


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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;

typedef tree<
ll,
null_type,
less<ll>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
// ordered_set X;
// *X.find_by_order(i) = ith largest element (counting from zero)
// X.order_of_key(k) = number of items in X < k (strict lt)

ll MAX_N = 200001;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int N;
    ll K;
    cin >> N >> K;

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

    vi fst(MAX_N+1, MAX_N+1);
    vi lst(MAX_N+1, -1);
    vi nxt(N, -1);

    for(int i=0;i<N;i++) {
        fst[A[i]] = min(fst[A[i]], i);

        if (lst[A[i]] != -1) {
            nxt[lst[A[i]]] = i;
        }

        lst[A[i]] = max(lst[A[i]], i);
    }

    vi c0(N+1, -1);
    for(int i=N-1;i>=0;i--) {
        int j = nxt[i];
        if (j == -1) {
            c0[i] = A[i];
        } else {
            c0[i] = c0[j + 1];
        }
    }

    vi g(N+1, -1);
    for(int i=0;i<=N; i++) {
        if (c0[i] == -1) {
            g[i] = 0;
        } else {
            g[i] = fst[c0[i]] + 1;
        }
    }

    vi cycle(N+1, -1);
    cycle[0] = 0;
    int ind = 0;
    while (cycle[g[ind]] == -1) {
        cycle[g[ind]] = cycle[ind] + 1;
        ind = g[ind];
    }

    int pref = cycle[g[ind]];
    int clen = cycle[ind] - pref + 1;

    K--;
    if (K > pref) {
        K = pref + (K - pref) % clen;
    }

    int fini;
    for (int i=0;i<=N;i++) {
        if(cycle[i] == K) fini = i;
    }

    vi lastA(0);
    vb contains(MAX_N, false);
    for (int i = fini; i<N; i++){
        if (!contains[A[i]]) {
            contains[A[i]] = true;
            lastA.push_back(A[i]);
        } else {
            while (lastA.back() != A[i]){
                contains[lastA.back()] = false;
                lastA.pop_back();
            } 
            lastA.pop_back();
            contains[A[i]] = false;
        }
    } 


    for (int x : lastA) cout << x << " ";
    cout << endl;


    return 0;
}

Measured memory_bytes: 7924
#include <iostream>
using namespace std;
int main()
{
	long int n, a, sum = 0, ans = 0;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a;
		if (a % 2 == 0)
		{
			sum++;
		}
		else
		{
			ans++;
		}
	}
	if(ans % 2 == 1)
	{
		cout << "NO" << endl;
	}
	else
	{
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct Node {
  int key;
  struct Node *right, *left, *parent;
};
typedef struct Node Node;

Node *root, *NIL;

Node * treeMinimum(Node *x) {
  while(x->left != NIL)
    x = x->left;
  return x;
}

Node * find(Node *u, int k) {
  while(u != NIL && k != u->key) {
    if(k < u->key) u = u->left;
    else u = u->right;
  }
  return u;
}

Node * treeSuccessor(Node *x) {
  if(x->right != NIL) return treeMinimum(x->right);
  Node *y = x->parent;
  while(y != NIL && x == y->right) {
    x = y;
    y = y->parent;
  }
  return y;
}

void treeDelete(Node *z) {
  Node *y; // 削除する対象
  Node *x; // yの子

  // 削除する節点を決める
  if(z->left == NIL || z->right == NIL) y = z;
  else y = treeSuccessor(z);

  // yの子xを決める
  if(y->left != NIL) {
    x = y->left;
  } else {
    x = y->right;
  }

  if(x != NIL) {
    x->parent = y->parent;
  }

  if(y->parent == NIL) {
    root = x;
  } else {
    if(y == y->parent->left) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }

  if(y != z) {
    z->key = y->key;
  }
}

void insert(int k) {
  Node *y = NIL;
  Node *x = root;
  Node *z;
  
  z = (Node *)malloc(sizeof(Node));
  z->key   = k;
  z->left  = NIL;
  z->right = NIL;
  
  while(x != NIL) {
    y = x;
    if(z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if(y == NIL) {
    root = z;
  } else {
    if( z->key < y->key) {
      y->left = z;
    } else {
      y->right = z;
    }
  }
}

void inorder(Node *u) {
  if(u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node *u) {
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
  
int main(void) {
  int n, i, x;
  char com[16];
  scanf("%d",&n);
  
  for(i=0;i<n;i++) {
    scanf("%s",com);
    if(!strcmp(com,"find")) {
      scanf("%d",&x);
      Node *t = find(root,x);
      if(t != NIL) printf("yes\n");
      else printf("no\n");
    } else if(!strcmp(com,"insert")) {
      scanf("%d",&x);
      insert(x);
    } else if(!strcmp(com,"print")) {
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if(!strcmp(com,"delete")) {
      scanf("%d",&x);
      treeDelete(find(root,x));
    }
  }

  return 0;
}


Measured memory_bytes: 20612
S, T = input(), input()

convert = dict()

answer = 'Yes'
for s, t in zip(S, T):
    if s in convert and convert[s] != t:
        answer = 'No'
        break
    else:
        convert[s] = t

after = convert.values()
if len(after) != len(set(after)):
    answer = 'No'

print(answer)

Measured memory_bytes: 3632
N,W=map(int,input().split())
w,v=[],[]
for _ in range(N):
  aw,V=map(int,input().split())
  w.append(aw)
  v.append(V)
dp=[[0 for _ in range(W+1)] for _ in range(N)]
#print(dp)
for i in range(N):
  for j in range(W+1):
    if j-w[i]>=0:
      #print(dp[i-1][j-w[i]])
      dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i]]+v[i])
    else:
      dp[i][j]=dp[i-1][j]
print(dp[-1][-1])

Measured memory_bytes: 217780
#include <iomanip>
#include <iostream>
#include <string>

typedef long long ll;
typedef long double ld;

int main()
{
  int N;
  std::cin >> N;
  ld sum = 0.0;
  for (ll i = 0; i < N; i++) {
    ld x; std::string u;
    std::cin >> x >> u;
    sum += u == "BTC" ? x * 380000.0 : x;
  }

  std::cout << std::fixed << std::setprecision(10) << sum << std::endl;
  return 0;
}


Measured memory_bytes: 256
s = input()
xy = list(map(int,input().split()))
data = [[0],[0]]
direct = 0
for i in s:
    if i == "F":
        data[direct][-1] += 1
    else:
        direct ^= 1
        data[direct].append(0)
judge = [False, False]
for direct in range(2):
    set_now = set((data[direct][0],))
    for d in data[direct][1:]:
        s_next = set()
        for e in set_now:
            s_next.add(e+d)
            s_next.add(e-d)
        set_now = s_next

    if xy[direct] in set_now:
        judge[direct] = True

if judge[0] and judge[1]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 48220
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int n,m,i,pos;
string s1,s2;
cin>>s1>>s2;
n=s1.size();
m=s2.size();
string ans(n+m+1,'-');
pos=0;
for(i=0;i<n;++i){
    ans[pos]=s1[i];
    pos+=2;
}
pos=1;
for(i=0;i<m;++i){
    ans[pos]=s2[i];
    pos+=2;
}
for(i=0;i<n+m;++i){
    cout<<ans[i];
}

    return 0;
}

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

int main()
{
  bool cards[4][13] = {
    { true, true, true, true, true, true, true, true, true, true, true, true, true, },
    { true, true, true, true, true, true, true, true, true, true, true, true, true, },
    { true, true, true, true, true, true, true, true, true, true, true, true, true, },
    { true, true, true, true, true, true, true, true, true, true, true, true, true, },
  };
  int n;
  cin >> n;
  int num;
  char suit;
  enum SUITS
  {
    SPADE,
    HART,
    CLUB,
    DIAMOND,
  };
  SUITS s;
  for (int i=0; i<n; i++)
  {
    cin >> suit >> num;
    s = suit == 'S' ? SPADE :
        suit == 'H' ? HART :
        suit == 'C' ? CLUB :
                      DIAMOND;
    cards[s][num-1] = false;
  }
  for (int i=0; i<4; i++)
  {
    for (int j=0; j<13; j++)
    {
      if ( cards[i][j] )
      {
        switch (i)
        {
        case 0:
          cout << "S " << j+1 << endl;
          break;
        case 1:
          cout << "H " << j+1 << endl;
          break;
        case 2:
          cout << "C " << j+1 << endl;
          break;
        case 3:
          cout << "D " << j+1 << endl;
          break;
        }
      }
    }
  }
}

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

int main ()
{
	int n, x;
	while ((cin >> n >> x))
	{
		if (n==0 && x==0)
			break;
		int ans=0;
		for (int i=1; i<=n; i++)
			for (int j=i+1; j<=n; j++)
				for (int k=j+1; k<=n; k++)
				{
					if (i+j+k==x) ans++;
				}
		cout << ans << endl;		
	}
}

Measured memory_bytes: 3072
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
const long long INF=20000000000;
//setprecision(2) <<

const int MOD = 1000000007;

long long max(long long a,long long b){
	if(a<b)return b;
	else return a;	
}
long long min(long long a,long long b){
	if(a>b)return b;
	else return a;	
}
long long gcd(long long a,long long b){
	if(a<b)swap(a,b);
	if(a%b==0)return b;
	else return gcd(a%b,b);
}

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

long long com(long long n,long long k){
	
}
long long getDigit(long long n){
	if(n==1)return 1;
	else return log10(n)+1;
}

class Point{
public:
	long long x;
	long long y;
};


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N,M;
	cin>>N>>M;
	vector<int>a(N);
	vector<int>b(N);
	vector<int>c(M);
	vector<int>d(M);
	for(int i=0;i<N;i++)cin>>a[i]>>b[i];
	for(int i=0;i<M;i++)cin>>c[i]>>d[i];
	
	for(int i=0;i<N;i++){
		long long ans=INF;
			int num=0;	
		for(int j=0;j<M;j++){
			//ans=min(ans,abs(a[i]-c[j])+abs(b[i]-d[j]));
			if(ans>abs(a[i]-c[j])+abs(b[i]-d[j])){
				ans=abs(a[i]-c[j])+abs(b[i]-d[j]);
				
				num=j+1;
			}
		}
		cout<<num<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
vector <int> a[100010];
vector <int> b[100010];
int par[100010];
bool vis[100010];
void dfs(int x, int pa){
    if(vis[x])
        return;
    vis[x]=1;
    for(int i=0; i<a[x].size(); ++i){
        dfs(a[x][i], x);
    }
}
int mxx[100010], rt;
int dfs1(int x){
    if(vis[x])
        return mxx[x];
    if(rt==x)
        return 0;
    vis[x]=1;
    int tmp, mx=0;
    for(int i=0; i<b[x].size(); ++i){
        tmp=dfs1(b[x][i])+1;
        if(tmp>=mx){
            mx=tmp;
            par[x]=b[x][i];
        }
    }
    mxx[x]=mx;
    return mx;
}

int main(){
    int n, m;
    while(cin>>n>>m){
        ll ans=0;
        int x, y;
        for(int i=0; i<n-1+m; ++i){
            scanf("%d%d",&x,&y);
            a[x].push_back(y);
            b[y].push_back(x);
        }
        rt=1;
        for(int i=1; i<=n; ++i){
            if(!vis[i]){
                rt=i;
                dfs(i, 0);
            }
        }
        memset(vis, 0, sizeof vis);
        for(int i=1; i<=n; ++i){
            dfs1(i);
            cout<<par[i]<<endl;
        }
    }
  return 0;
}




Measured memory_bytes: 15872
import qualified Data.ByteString.Char8  as C
import Data.List
main = C.interact $ sol . C.lines

sol [o,e] = fst . fst $ C.mapAccumL f (C.empty,e) o

f (acc,e) c = if C.null e 
  then ((C.snoc acc c,e), c)
  else ((C.snoc (C.snoc acc c) (C.head e),C.tail e), c)

Measured memory_bytes: 508
#include<bits/stdc++.h>
#define read freopen("in.txt","r",stdin)
#define write freopen("out.txt","w",stdout)
using namespace std;
const int INF=1e9+5;
int main(){
    //read;
    //write;
    int n,k;
    cin >> n >> k;
    vector<int> h(n+2),cost(n+2,INF);
    for(int i=0;i<n;++i){
        cin >> h[i];
    }
    cost[0]=0;
    for(int i=0;i<n;++i){
        for(int j=i+1;j<=i+k;++j){
            cost[j]=min(cost[j],cost[i]+abs(h[i]-h[j]));
        }
    }
    cout << cost[n-1];
    return 0;
}


Measured memory_bytes: 1024