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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

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

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int n;
    cin >> n;
    vector<int> a(3*n);
    for(int i = 0; i < n*3; ++i){
        cin >> a[i];
    }
    priority_queue<int, vector<int>, greater<int>> que1;
    priority_queue<int> que2;
    vector<ll> fst(n+1), snd(n+1);
    for(int i = 0; i < n; ++i){
        fst[0] += a[i];
        que1.push(a[i]);
        snd[n] += a[3*n-1-i];
        que2.push(a[3*n-1-i]);
    }
    for(int i = 1; i <= n; ++i){
        que1.push(a[i+n-1]);
        fst[i] = fst[i-1] + a[i+n-1] - que1.top();
        que1.pop();
        que2.push(a[2*n-i]);
        snd[n-i] = snd[n-i+1] + a[2*n-i] - que2.top();
        que2.pop();
    }
    ll ans = -LLINF;
    for(int i = 0; i <= n; ++i){
        ans = max(ans, fst[i] - snd[i]);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3964
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
       
using namespace std;
       
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
 
// #define MAX 100010
 
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES
 
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    // #ifndef ONLINE_JUDGE
        // freopen("input.txt","r",stdin);
        // freopen("output.txt","w",stdout);
    // #endif
    // int t;
    // cin>>t;
    // while(t--)
    long long int n,m;
    cin>>n>>m;
    if(n>=m)
        cout<<m/2<<endl;
    else
    {
        long long int ans = n;
        m = m-(2*n);
        long long int temp = m/4;
        ans+= temp;
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a;
    int b;
    scanf("%d %d",&a,&b);
    int d = a/b;
    int r = a%b;
    double f = a*1.0 / b*1.0;
    printf("%d %d %f\n",d,r,f);
    return 0;
}


Measured memory_bytes: 2104
using System;


namespace ConsoleApplication18
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int i = 0; i < 5; )
            {



                String s = Console.ReadLine();
                string[] ss = s.Split(' ');
                int a = int.Parse(ss[0]);
                string c = (ss[1]);
                int b = int.Parse(ss[2]);

                if (c == "+")
                {
                    Console.WriteLine(a + b);
                }
                else if (c == "-")
                {
                    Console.WriteLine(a - b);
                }
                else if (c == "*")
                {
                    Console.WriteLine(a * b);
                }
                else if (c == "/")
                {
                    Console.WriteLine(a / b);
                }
                else if (c == "?")
                {
                    break;
                }

            }

            

        }
    }
}

Measured memory_bytes: 9020
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    for(int i = 0; i <= 25; i++)
        for(int j = 0; j <= 14; j++)
            if(4*i + 7*j == n)
            {
                printf("Yes\n");
                return 0;
            }
    printf("No\n");
    return 0;
}


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

int main() {
	string s, ans; cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '0') ans += '0';
		else if (s[i] == '1') ans += '1';
		else if(ans.length() > 0) ans.erase(ans.end() -1);
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
# ABC 146 A
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
elif s == "SAT":
    print(1)

Measured memory_bytes: 38384
import heapq

N,K = map(int,input().split())

P = list(map(int,input().split()))

minlis = []
maxlis = []
endflag = [False] * N

ans = 1

for i in range(K):

    heapq.heappush(minlis,P[i])
    heapq.heappush(maxlis,-1 * P[i])

for i in range(N - K):

    flag = False

    endflag[P[i]] = True
    if minlis[0] != P[i]:
        flag = True

    while endflag[minlis[0]]:
        heapq.heappop(minlis)

    if P[i+K] <= -1 * maxlis[0]:
        flag = True

    while endflag[-1 * maxlis[0]]:
        heapq.heappop(maxlis)

    

    heapq.heappush(minlis,P[i+K])
    heapq.heappush(maxlis,-1 * P[i+K])



    if flag:
        ans += 1

kaburi = 0
P.append(-2)
now = 0
nmax = -1
for i in range(N+1):
    if nmax < P[i]:
        now += 1
        nmax = P[i]
    else:
        if now >= K:
            kaburi += 1 #max(0 , now - K + 1)
        now = 1
        nmax = P[i]
        
#print (ans,kaburi)
if kaburi >= 2:
    print (ans - kaburi + 1)
else:
    print (ans)


Measured memory_bytes: 25000
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

using Graph = vector<vector<int>>;

typedef pair<int, int> P;
const int MOD = 1000000007;

int main(){
    int N; cin >> N;
    vector<int> h(N);
    rep(i,N) cin >> h[i];

    int ans = 0;
    while(true){
        int left = -1;
        int right = -1;
        int min_v = 10000;
        rep(i,N){
            if (h[i] > 0) min_v = min(min_v, h[i]);
            if (left == -1){
                if (h[i] > 0) left = i;
            }
            else{
                if (h[i] == 0) {
                    right = i-1;
                    break;
                }
            }
        }
        if (right == -1) right = N-1;
        if (min_v == 10000) break;
        
        for(int i = left; i <= right; i++){
            h[i] -= min_v;
        }
        ans += min_v;
    }

    cout << ans << endl;
}



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

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
using ll = long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using mii = map<int, int>;
using msi = map<string, int>;
using pii = pair<int, int>;

bool f(int n) {
    int cnt = 0;
    for(int i = 1; i <= n; i++) {
        if(n % i == 0) cnt++;
    }
    if(cnt == 8) return true;
    return false;
}


int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    
    int n; cin >> n;
    int ans = 0;
    for(int i = 3; i <= n; i+=2) {
        if(f(i)) ans++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int a,b,s;
int main()
{
    cin>>a>>b;
    if(a==0||b==0)
    {
    	cout<<"Zero"<<endl;
    	return 0;
	}
	if(a<0&&b<0)
	{
		s=b-a;
		if(s%2==0)
		{
			cout<<"Negative"<<endl;
		    return 0;
		}
		else
		{
			cout<<"Positive"<<endl;
    	    return 0;
		}
	}
	if(a<0&&b>0)
	{
		cout<<"Zero"<<endl;
    	return 0;
	} 
	if(a<0)
	{
		a=a*-1;
		if(a%2==0)
		{
			cout<<"Positive"<<endl;
    	    return 0;
		}
		else
		{
			cout<<"Negative"<<endl;
		    return 0;
		}
	}
	else
	{
		cout<<"Positive"<<endl;
		return 0;
	}
    return 0;
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,0,N) cin >> a[i];

    int ans=0,prev=a[0],cnt=1;
    rep(i,1,N){
        if(prev!=a[i]){
            ans+=cnt/2;
            prev=a[i];
            cnt=1;
        }else{
            ++cnt;
        }
    }
    ans+=cnt/2;
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

using namespace std;

int main()
{
    long long int num,n;
    int digits;
    vector<long long int>vec;
    cin>>n;
    digits=int(floor(log10(n)+1));
    digits=(digits/2);
    for(int i = 1; i <=int(pow(10,(digits+1))); i++)
    {
        if(n % i == 0 && vec.size()==0)
            {vec.push_back(i);vec.push_back((n/i));}
        else if(n%i==0 && vec.size()!=0)
            {vec.push_back(i);vec.push_back((n/i));}
    }
    sort(vec.begin(),vec.end());
    num=(vec.size()/2);
    cout<<(vec[num-1]-1)+(vec[num]-1)<<endl;
    return 0;
}


Measured memory_bytes: 512
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

import itertools

N = int(readline())
A = list(map(int,readline().split()))

A.sort()

# [それより小さい数の倍数として出てきたか,同じ数が出てきたか]
check = [[False,False] for i in range(10**6+1)]
ans = 0
for a in A:
    if check[a][1]:
        check[a][0] = True
    if check[a][0]:
        continue
    for j in range(2*a,10**6+1,a):
        check[j][0] = True
    check[a][1] = True
 
for a in A:
    if not check[a][0]:
        ans += 1
print(ans)
 

Measured memory_bytes: 106320
#include <stdio.h>
double getSn(long long int n);
int main(void) {
	int i, j;
	long long int x = 1;
	int k;
	long long int n = 1;
	scanf("%d", &k);
	puts("1");
	for (i=1; i < k; i++) {
		if (getSn(x + n) > getSn(x + n + n)) {
			n *= 10;
		}
		x += n;
		printf("%lld\n", x);
	}
	return 0;
}

double getSn(long long int n) {
	double sn = 0;
	long long int tn = n;
	do {
		sn += tn % 10;
		tn /= 10;
	} while (tn != 0);
	return n / sn;
}

Measured memory_bytes: 128
#![allow(unused_imports)]
#![allow(unused_macros)]
use itertools::Itertools;
use std::cmp::{max, min};
use std::collections::*;
use std::io::{stdin, Read};

trait ChMinMax {
    fn chmin(&mut self, other: Self);
    fn chmax(&mut self, other: Self);
}
impl<T> ChMinMax for T
where
    T: PartialOrd,
{
    fn chmin(&mut self, other: Self) {
        if *self > other {
            *self = other
        }
    }
    fn chmax(&mut self, other: Self) {
        if *self < other {
            *self = other
        }
    }
}

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, $var:ident $($r:tt)*) => {
        let $var = parse_val!($it, usize);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: tt),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, u1) => {
        $it.next().unwrap().parse::<usize>().unwrap() -1
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let nl: Vec<_> = it
        .next()
        .unwrap()
        .chars()
        .map(|x| x.to_digit(10).unwrap() as usize)
        .collect();
    let mut dp = (0, 1);
    for ni in nl {
        dp = (
            min(dp.0 + ni, dp.1 + 10 - ni),
            min(dp.0 + ni + 1, dp.1 + 10 - ni - 1),
        );
    }
    println!("{}", dp.0);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 10748
#include<iostream>
#include<string>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<cstdlib>
#include<queue>
#include<utility> //pair
using namespace std;

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

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

int main() {
	//入力;
	string S;
	cin >> S;
	if (S == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
	




	//小数点以下の桁数表示;
	//cout << fixed << setprecision(15);

	return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
using namespace std;

int main() {

    int N, W;
    cin >> N >> W;

    vector<int> v(1005), w(1005);
    for(int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }

    int dp[105][10005];

    for(int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (j < w[i]) {
                dp[i + 1][j] = dp[i][j];
            } else {
                dp[i + 1][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
            }
        }   
    }

    cout << dp[N][W] << endl;

    return 0;
}


Measured memory_bytes: 7032
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> T;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using vec = vector<int>;

struct UnionFind {
    public:
    vector<int> child, tree, sum, ed;

    public:
    UnionFind(int v) {
        tree.resize(v);
        sum.resize(v);
        ed.resize(v,0);
        rep(i, v) tree[i] = i, sum[i] = 1;
    }

    int root(int i) {
        if(i == tree[i]) {
            rep(j, child.size()) tree[child[j]] = i;
            child.clear(); 
            return i;
        }
        else {
            child.push_back(i);
            return i = root(tree[i]);
        }
    }

    int size(int i) {
        return sum[root(i)];
    }

    int edsize(int i) {
        return ed[root(i)];
    }

    int unit(int x, int y) {
        x = root(x);
        y = root(y);
        if(isUnit(x,y)){
            ed[min(x,y)] ++;
        }
        else{
            sum[min(x,y)] += sum[max(x,y)];
            ed[min(x,y)] += 1 + ed[max(x,y)];
            tree[max(x,y)] = min(x,y);
        }
    }

    bool isUnit(int x, int y) {
        return root(x) == root(y);
    }
};

int Nmax=100100;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int n,h,w;
    cin>>n>>h>>w;
    vector<T> x(n);
    rep(i,n){
        int r,c,a;
        cin>>r>>c>>a; // a is score
        x[i]=T(a,r,c);
    }
    sort(rall(x));
    UnionFind uf1(h+w+Nmax);
    UnionFind uf2(h+w+Nmax);
    ll ans=0;
    rep(i,n){
        int a,r,c; // a is score
        tie(a,r,c)=x[i];
        if(uf1.isUnit(r,c+Nmax)&&uf2.isUnit(r,c+Nmax)){
            // 取れない
        }
        else if(uf1.isUnit(r,c+Nmax)){
            // 辺がある
            if(uf1.edsize(r)<uf1.size(r)){
                uf1.unit(r,c+Nmax);
                uf2.unit(r,c+Nmax);
                ans+=a;
            }
        }
        else{
            // 辺がない
            if(uf1.edsize(r)+uf1.edsize(c+Nmax)<uf1.size(r)+uf1.size(c+Nmax)){
                uf1.unit(r,c+Nmax);
                ans+=a;
            }
        }
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 15616
#include <stdio.h>

int main(void) {
  
  char b;
  scanf("%c", &b);
  
  if(b == 'A') puts("T");
  else if(b == 'C') puts("G");
  else if(b == 'G') puts("C");
  else puts("A");
  
  return 0;
  
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
    static final int INF = (int)1e9;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        
        ArrayList<Integer>[] ch = new ArrayList[n];
        for(int i=0; i<n; i++){
            ch[i] = new ArrayList<>();
        }
        
        for(int i=0; i<n-1; i++){
            int a = Integer.parseInt(sc.next())-1;
            int b = Integer.parseInt(sc.next())-1;
            ch[a].add(b);
            ch[b].add(a);
        }
        
        long[] ans = new long[n];
        for(int i=0; i<m; i++){
            int p = Integer.parseInt(sc.next())-1;
            int x = Integer.parseInt(sc.next());
            ans[p] += x;
        }
        
        boolean[] used = new boolean[n];
        ArrayDeque<Integer> q = new ArrayDeque<>();
        q.offerFirst(0);
        used[0] = true;
        while(q.size()!=0){
            int now = q.removeLast();
            for(int next : ch[now]){
                if(!used[next]){
                    ans[next] += ans[now];
                    q.offerFirst(next);
                    used[next] = true;
                }
            }
        }
        
        System.out.print(ans[0]);
        for(int i=1; i<n; i++){
            System.out.print(" " + ans[i]);
        }
        System.out.println("");
    }
}


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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

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<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<deque>
#include<cctype>
#include<math.h>
using namespace std;
#define ll long long
int main(){
    ll a,b;
    cin >> a >> b;
    if(a<=0&&b>=0)cout <<"Zero";
    if(a>0)cout << "Positive";
    if(b<0&&(b-a)%2==1)cout << "Positive";
    if(b<0&&(b-a)%2==0)cout << "Negative";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#define N 10

int main(void)
{
    int n, i;
    int a, b, c, d;

    while(scanf("%d", &n) != EOF) {
        i = 0;
        for(a=0; a<N; a++) {
            for(b=0; b<N; b++) {
                for(c=0; c<N; c++) {
                    for(d=0; d<N; d++) {
                        if(a+b+c+d == n) {
                                i++;
                                break;
                        }
                    }
                }
            }
        }
        printf("%d\n", i);
    }

    return (0);
}

Measured memory_bytes: 596
n=int(input())
A = list(map(int,input().split()))
sA=[str(i) for i in A]
pA = ' '.join(sA)
print(pA)
for i in range(1,n):
    v = A[i]
    j = i-1
    while (j>=0 and A[j]>v):
        A[j+1] = A[j]
        j =j-1
    A[j+1] = v
    #print(A)
    sA=[str(i) for i in A]
    pA = ' '.join(sA)
    print(pA)



Measured memory_bytes: 5604
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var all = list[0];
	for(var i = 1; i < N; i++){
		all ^= list[i];
	}
	myerr(all);
	for(var i = 0; i < N; i++){
		list[i] = list[i] ^ all;
	}
	myout(myconv(list, 8));
}


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

using namespace std;

using LL = long long;

string s;
LL ans;

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

    cin >> s;
    for (int i = 0, cur = 0; i <= (int)s.size(); ) {
        int nxtI = i;
        while (i < (int)s.size() && s[nxtI] == '>') ++nxtI;
        if (i == nxtI) {
            ans += cur;
            ++cur;
        }
        else {
            ans += max(cur, nxtI - i) + (LL)(nxtI - i) * (nxtI - i - 1) / 2;
            cur = 1;
        }

        i = nxtI + 1;
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 1172
#include<bits/stdc++.h>
using namespace std;
const int n = 1E5;
vector<int> V[n + 50];
map<pair<int, int>, int> M;
void search(int from)
{
	set<int> S; S.clear();
	for(int i=0; i<V[from].size(); i++)
	{
		pair<int, int> P(min(from, V[from][i]), max(from, V[from][i]));
		if(M[P]) S.insert(M[P]);
	}
	int ind = 1;
	for(int i=0; i<V[from].size(); i++)
	{
		while(S.count(ind)) ind ++;
		pair<int, int> P(min(from, V[from][i]), max(from, V[from][i]));
		if(!M[P]) M[P] = ind ++;
	}
}
int main()
{
	int a; cin >> a;
	int mx = 0;
	pair<int, int> arr[a + 50];
	for(int i=0; i<a - 1; i++)
	{
		cin >> arr[i].first >> arr[i].second;
		if(arr[i].second < arr[i].first) swap(arr[i].first, arr[i].second);
		V[arr[i].first].push_back(arr[i].second);
		V[arr[i].second].push_back(arr[i].first);
		mx = max(mx, (int)V[arr[i].second].size());
		mx = max(mx, (int)V[arr[i].first].size());
		M[arr[i]] = 0;
	}
	for(int i=1; i<=a; i++)
		search(i);
	cout << mx << '\n';
	for(int i=0; i<a - 1; i++)
		cout << M[arr[i]] << '\n';
	return 0;
}

Measured memory_bytes: 13056
/**    epsileer 10 August 2019  17:37:49  **/    
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<LL,LL> PII;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define TEST LL t = 1; while(t--) solve()

void solve(){
    LL n; cin>>n;
    string s[n];
    for(LL i=0;i<n;i++){
        cin>>s[i];
        sort(&s[i][0], &s[i][0]+s[i].size());
    }
    sort(&s[0], &s[0]+n);
    LL count = 1;
    LL ans = 0;
    for(LL i=1;i<n;i++){
        if(s[i] == s[i-1]){
            count++;
        }
        else{
            ans += (count)*(count-1)/2;
            count = 1;
        }
    }
    ans += (count)*(count-1)/2;
    cout<<ans;
}

int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); TEST;
return 0;
}

Measured memory_bytes: 5760
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	ans := -1
	switch s {
	case "SUN":
		ans = 7
	case "MON":
		ans = 6
	case "TUE":
		ans = 5
	case "WED":
		ans = 4
	case "THU":
		ans = 3
	case "FRI":
		ans = 2
	case "SAT":
		ans = 1
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1768
import collections
n = int(input())
A = list(map(int, input().split()))
A.sort()
cnt = collections.Counter(A)
#print(cnt)
for a in A:
    if cnt[a] >= 2:
        del cnt[a]
    for j in range(2*a, A[-1]+1, a):
        del cnt[j]
#print(cnt)
print(len(cnt))


Measured memory_bytes: 36228
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
//================================================

int a = 0, b = 0, c, d, n, k=0;
string s, t;


int main()
{
	int sum = 0; cin >> n;
	vector<int> a(n + 1), b(n), c(n-1);
	rep(i, n)
		cin >> a[i];
	a[n] = 0;
	rep(i, n)
		cin >> b[i]; 
	rep(i, n-1)
		cin >> c[i];
	rep(i,n)
	{
		sum += b[a[i]-1];
		if (a[i] + 1 == a[i + 1])
			sum += c[a[i]-1];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
//Bokan ga bokka--nn!!
//Daily Lunch Special Tanoshii !!
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 2000000000
#define s(x) scanf("%d",&x)
#define rep(i,x) for(int i=0;i<x;i++)
bool e[5005][5005]={};
P za[3005];
int main()
{
	int n;
	while(1)
	{
		scanf("%d",&n);
		if(!n) return 0;
		rep(i,n)
		{
			int x,y;
			scanf("%d %d",&x,&y);
			e[x][y]=true;
			za[i]=mp(x,y);
		}
		int ret=0;
		rep(i,n)
		{
			for(int j=i+1;j<n;j++)
			{
				int x1=za[i].first;
				int y1=za[i].second;
				int x2=za[j].first;
				int y2=za[j].second;
				
				if((x1+x2+y1-y2)%2==1 || (x1+x2+y1-y2)<0 || (x1+x2+y1-y2)>10000) continue;
				if((x1+x2-y1+y2)%2==1 || (x1+x2-y1+y2)<0 || (x1+x2-y1+y2)>10000) continue;
				if((y1+y2+x1-x2)%2==1 || (y1+y2+x1-x2)<0 || (y1+y2+x1-x2)>10000) continue;
				if((y1+y2-x1+x2)%2==1 || (y1+y2-x1+x2)<0 || (y1+y2-x1+x2)>10000) continue;
				if(e[(x1+x2+y1-y2)/2][(y1+y2-x1+x2)/2])
				{
					if(e[(x1+x2-y1+y2)/2][(y1+y2+x1-x2)/2])
					{//printf("%d %d\n",i,j);				
						ret=max(ret,((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2);
					}
				}
				
			}
		}
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 25068
N = int(input())
A = [int(a) for a in input().split()]

pre = -1
c = 0
ans = 0
for a in A:
    if a == pre:
        c += 1
        if c % 2 == 0:
            ans += 1
    else:
        c = 1
    pre = a
    
print(ans)

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

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define eb          emplace_back
#define	endl		'\n' 
#define max(a,b)	((a)>(b)?(a):(b))
#define min(a,b)	((a)<(b)?(a):(b))
#define vi          vector<int>
#define vii         vector<pair<int, int> >
#define mp          make_pair
#define mem1(a)     memset((a),-1,sizeof(a))
#define all(a)      (a).begin(),(a).end()
#define vs          vector<string>
#define F           first
#define S           second
#define gcd(a,b)    __gcd((a),(b))
#define lcm(a,b)    (a)*((b)/gcd((a),(b)))
#define DECIMAL(n)  cout << fixed ; cout << setprecision(n);
#define FAST        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mi          map<int,int>
#define sz(x)       (ll)(x).size()
#define rep(i,a,b)  for(int i=(a);i<(b);i++)
#define pii         pair<int,int>

int solve()
{
	string a,b;
	cin>>a>>b;
	int l1=sz(a),l2=sz(b);
	if(l1>l2)
	{
		string c=a;
		a=b;
		b=c;
	}
	l1=sz(a),l2=sz(b);
	int arr[l1+1][l2+1]={0};
	int val[l2+1];
	rep(i,0,l2+1)
	{
		val[i]=-1;
	}
	bool used[l2+1];
	rep(i,0,l2+1)
	used[i]=false;
	rep(i,0,l1+1)
	{
		rep(j,0,l2+1)
		arr[i][j]=0;
	}
	for(int i=l1-1;i>=0;i--)
	{
		bool yes=false;
		for(int j=l2-1;j>=0;j--)
		{
			int c=0;
			//if(a[i]==b[j]&& !yes && !used[j])
			if(a[i]==b[j])
			{
				//val[j]=i;
			//	used[j]=true;
			//	yes=true;
			//	c=1;
				arr[i][j]=arr[i+1][j+1]+1;
			}
			else
			arr[i][j]=max(arr[i+1][j],arr[i][j+1]);
		}
	}
	string ans="";
	int i=0,j=0;
	int temp=-1;
	/*rep(i,0,l2)
	{
		if(val[i]!=-1)
		{
			if(val[i]>temp)
			{
				ans+=b[i];
				temp=val[i];
			}
		}
	}*/
	while(i<l1&&j<l2)
	{
		if(arr[i][j]==arr[i+1][j])
			i++;
		else if(arr[i][j]==arr[i][j+1])
			j++;
		else if(arr[i][j]==arr[i+1][j+1])
			i++,j++;
		else
		{
			ans+=a[i];
			i++;j++;
		}
	}
	cout<<ans;
    return 0;
}
signed main()
{
    FAST
    #ifndef ONLINE_JUDGE 
        freopen("input.txt", "r", stdin); 
        freopen("output.txt", "w", stdout); 
    #endif 
    int t=1;
    //cin>>t;
    while(t)
    {
        solve();
        t--;
    }
    cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
    return 0;
}

Measured memory_bytes: 38920
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int n, i, j, k;
	string s, ss = "";
	vector<int> c(26), maxx(26, 10000);
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> s;
		c.assign(26, 0);
		for (auto ch : s) c[ch - 'a']++;
		for (j = 0; j < 26; j++) maxx[j] = min(maxx[j], c[j]);
	}
	ss = "";
	for (i = 0; i < 26; i++) {
		if (maxx[i] > 0) {
			s = "a";
			s[0] = 'a' + i;
			for (j = 0; j < maxx[i]; j++) {
				ss = ss + s;
			}
		}
	}
	cout << ss << "\n";

	return 0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX(a, b) ((a)>(b)?(a):(b))
#define MIN(a, b) ((a)<(b)?(a):(b))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

using namespace std;

typedef long long ll;

int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  if(c > b || a > d){
    cout << 0 << endl;
  }
  else{
    cout << MIN(b, d) - MAX(a, c) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))


def main():
    n, m = map(int, input().split())
    ab = [tuple(map(int, input().split())) for _ in range(m)]
    edges = [[] for _ in range(n)]
    for a, b in ab:
        edges[a - 1].append(b - 1)
        edges[b - 1].append(a - 1)
    
    q = int(input())
    ans = [0 for _ in range(n)]
    dd = [-1 for _ in range(n)]
    vdc = [tuple(map(int, input().split())) for _ in range(q)]
    for v, d, c in vdc[::-1]:
        if dd[v - 1] >= d:
            #  v - 1 から距離 d の部分は塗りつぶされているため無視
            continue
        
        node = set()
        node.add(v - 1)
        while d >= 0 and len(node) > 0:
            next_node = set()
            for u in node:
                if dd[u] >= d:
                    continue
                dd[u] = d
                if ans[u] == 0:
                    ans[u] = c
                for v in edges[u]:
                    if dd[v] < d - 1:
                        next_node.add(v)
            node = next_node
            d -= 1
    
    print(*ans, sep='\n')


if __name__ == '__main__':
    main()


Measured memory_bytes: 57440
<?php
  $n = trim(fgets(STDIN));
  for($i=0; $i<$n; $i++){
      $s = trim(fgets(STDIN));
      $score += $s;
      if($s%10 != 0){
          $list[] = $s;
      }
  }
  if($score%10 != 0){
      echo $score;
  }else{
      if(count($list) != 0){
          sort($list);
          echo $score-$list[0];
      }else{
          echo "0";
      }
  }

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



int main() {
	ios::sync_with_stdio(false);
	string st; cin >> st;
	string form = "", back = "";
	int q; cin >> q;
	bool rev = false;
	for (int i = 0; i < q; i++) {
		int t; cin >> t;
		if (t == 1) rev = 1-rev;
		else {
			int f;
			string c;
			cin >> f >> c;
			if (f == 1) {
				if (!rev) form += c; else back += c;
			}
			else {
				if (!rev) back += c; else form += c;
			}
		}
	}
	if (!rev) {
		for (int i = form.size()-1; i >= 0 ; i--) cout << form[i];
		cout << st;
		cout << back << "\n";
	}
	else {
		for (int i = back.size()-1; i >= 0; i--) cout << back[i];
		for (int i = st.size()-1; i >= 0; i--) cout << st[i];
		cout << form << "\n";
	}
}

Measured memory_bytes: 1104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()


int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    vector<int> b(n,0);

    int m=0;
    for(int i=n-1;i>=0;i--){
        int tmp=0;
        for(int j=2*i+1;j<n;j+=i+1){
            if(b[j]==1) tmp++;
        }
        if(a[i]==0 && tmp%2==1){
            m++;
            b[i]=1;
        }
        else if(a[i]==1 && tmp%2==0){
            m++;
            b[i]=1;
        }
    }

    cout<<m<<endl;
    if(m==0) return 0;
    rep(i,n){
        if(b[i]==1) cout<<i+1<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 4836
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Main main = new Main();
		main.solveB();
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int minK = N;
		int minKnum = 0;
		int maxK = 0;
		int maxKnum = 0;
		for (int i = 0; i < N; i++) {
			int num = sc.nextInt();
			if (minK > num) {
				minK = num;
				minKnum = 0;
			}
			if (maxK < num) {
				maxK = num;
				maxKnum = 0;
			}
			if (minK == num) {
				minKnum++;
			}
			if (maxK == num) {
				maxKnum++;
			}
		}
		if (judge(minK, minKnum, maxK, maxKnum)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	private boolean judge(int minK, int minKnum, int maxK, int maxKnum) {
		if (minK + 1 < maxK) {
			return false;
		}
		if (minK == maxK) {
			if (minK + 1 == minKnum) {
				return true;
			}
			return minK <= minKnum / 2;
		}
		if (maxKnum < 2) {
			return false;
		}
		return (minKnum < maxK) && (maxK <= minKnum + maxKnum / 2);
	}
}

Measured memory_bytes: 48524
#include <iostream>
#include <algorithm>
#include <vector>
#include <limits.h>
#include <cmath>
#include <map>
#include <iomanip>
using namespace std;
using ll=long long;
using P=pair<int,int>;

int main(){
    int n;
    cin>>n;
    vector<int> c;
    int mx=0;
    for(int i=0;i<n;i++){
        int s;
        cin>>s;
        s--;
        if(c.size()==0||(c.size()>0&&c[c.size()-1]!=s)){
            c.push_back(s);
        }
    }
    n=c.size();
    vector<int> mn(200000,n);
    vector<int> e[n];
    vector<int> dp(n,0);
    for(int i=0;i<n-1;i++)e[i].push_back(i+1);
    for(int i=n-1;i>=0;i--){
        if(mn[c[i]]!=n)e[i].push_back(mn[c[i]]);
        mn[c[i]]=i;
    }
    dp[0]=1;
    const int MOD=1e9+7;
    for(int i=0;i<n;i++){
        for(int j=0;j<e[i].size();j++){
            dp[e[i][j]]+=dp[i];
            dp[e[i][j]]%=MOD;
        }
    }
    cout<<dp[n-1]<<endl;
}



Measured memory_bytes: 13556
#include <bits/stdc++.h>
using namespace std;
using str = string;
using ll = long long;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define RREP(i,n) for(int i=int(n)-1; i>=0; i--)
#define FOR(i,f,t) for(int i=int(f); i<=int(t); i++)
#define RFOR(i,f,t) for(int i=int(f); i>=int(t); i--)
#define ALL(vec) (vec).begin(),(vec).end()
#define ASORT(vec) sort(ALL(vec))
#define DSORT(vec) sort(ALL(vec), greater<int>());
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define YES(ans) if(ans) cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define Yes(ans) if(ans) cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define yes(ans) if(ans) cout<<"yes"<<endl; else cout<<"no"<<endl;
#define INF 1000000000000
#define NOD 1000000007
#define PI 3.141592653589793238462643

int main() {
	str s;
	cin >> s;
	if(s == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  int x=0;
  int e[8]={};
  for(int i=0;i<n;i++){
    if(a[i]<400) e[0]=1;
    else if(a[i]<800) e[1]=1;
    else if(a[i]<1200) e[2]=1;
    else if(a[i]<1600) e[3]=1;
    else if(a[i]<2000) e[4]=1;
    else if(a[i]<2400) e[5]=1;
    else if(a[i]<2800) e[6]=1;
    else if(a[i]<3200) e[7]=1;
    else x++;
  }
  int y=0;
  for(int i=0;i<8;i++) y+=e[i];
  cout<<max(y,1LL)<<" "<<y+x<<endl;
  return 0;
}


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

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) cout << (j ? s1 : s2) << endl;
# define YES(j) cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;


int main()
{
    int n;cin >> n ;
    char s[300000];

    int l_w=0,r_e=0;
    for(int i=0;i<n;i++){
        cin >> s[i];
        if(s[i]=='E' && i!=0) r_e++;
    }

    int mi=r_e;
    for(int i=1;i<n;i++){
        if(s[i-1]=='W') l_w++;
        if(s[i]=='E') r_e--;
        mi = min(r_e+l_w,mi);
    }
    p(mi)
} 

Measured memory_bytes: 512
#include<stdio.h>

int main(){

  int N,A[100];
  int i,j=0;
  int v;
  
  scanf("%d",&N);

  for(i=0;i<N;i++){
    
    scanf("%d",&A[i]);
  }
  for(i=0;i<N-1;i++){
    
    printf("%d ",A[i]);
  }

  printf("%d\n",A[N-1]);
  
  for(j=0;j<N;j++){
  for(i=1;i<N;i++){
    
    v = A[i];
    j = i - 1;
    
      
      while(j>=0 && A[j]>v){
	
	A[j+1] = A[j];
	j--;
	A[j+1] = v;
      }
      
      for(j=0;j<N-1;j++){
	
	printf("%d ",A[j]);
      }
      printf("%d\n",A[N-1]);
    }
  }
  
  return 0;
}


    



Measured memory_bytes: 2056
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

N=gets.to_i
s,t=get
s=s.split("")
t=t.split("")
ans=""
N.times do|i|
  ans+=s[i]+t[i]
end
puts ans


Measured memory_bytes: 1788
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
using namespace std;
typedef pair<int,int> p;
typedef pair<int,p> P;
typedef pair<p,p> p2;
#define pu push
#define pb push_back
#define mp make_pair
short field[5005][5005]={};
int main(){
	int n,m;
	scanf("%d %d",&n,&m);
	for(int i=0;i<m;i++){
		int a,b,c;
		scanf("%d %d %d",&a,&b,&c);
		field[a][b]=(short)c+1;
	}
	for(int i=1;i<n;i++){
		for(int j=1;j<=n;j++){
			if(field[i][j]>0){
				field[i+1][j]=max((int)field[i+1][j],(int)field[i][j]-1);
				if(j!=n){
					field[i+1][j+1]=max((int)field[i+1][j+1],(int)field[i][j]-1);
				}
			}
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			if(field[i][j]>0){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 48912
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class ATakoyaki {
public:
    void solve(std::istream& cin, std::ostream& cout) {
        int N, X, T;
        cin >> N >> X >> T;
        cout << (N + X - 1) / X * T << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    ATakoyaki solver;
    solver.solve(in, out);
    return 0;
}


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

int main(){
    int n, x;
    cin >> n >> x;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    int nokori = x;
    for(int i = 0; i < n; i++){
        nokori -= v[i];
    }
    cout << n+nokori/v[0] << endl;
  	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (h, a) = [int(e) for e in lines[0].split(" ")]

    return (h, a)


def solve(h, a):

    result = h//a
    if h % a != 0:
        result = result + 1


    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		int tyuo=s.length()-2;
		System.out.print(s.charAt(0));
		System.out.print(tyuo);
		System.out.println(s.charAt(s.length()-1));
	}

}


Measured memory_bytes: 23124
program main
    implicit none
    integer ::n,l,i,min1,t,u
    read(*,*) n,l
    
    min1=10000
    
    do i=1,n
        if (abs(l+i-1)<min1)then
            min1=abs(l+i-1)
            t=l+i-1
        end if
    end do
    u=n*(l-1)+n*(n+1)/2 - t
    write(*,*) u
    
    stop
end program main
    

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

using namespace std;


int read_map(vector< vector <int> >& map,int &w, int &h){
  cin >> w >>  h;
  if (w == 0 && h == 0){
    return 0;
  }
  map.reserve(h);
  for (int i = 0; i < h ; ++i) map[i].resize(w);
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      cin >> map[i][j];
    }
  }
  return 1;
}


bool island_check(vector<vector<int> >& map, int i, int j){
  if (map[i][j] == 1){
    return true;
  }
  return false;
}

void walk_island(vector<vector<int> >& map, int i, int j, int w, int h){
  int start_i, start_j;
  start_i = i;
  start_j = j;
  while (++j < w){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (--j >= 0){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (++i < h){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (--i >= 0){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (++i < h && ++j < w){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (--i >= 0 && ++j < w){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (--i >= 0 && --j >= 0){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
  i = start_i;
  j = start_j;
  while (++i < h && --j >= 0){
    if (island_check(map, i, j))
    {
      map[i][j] = 2;
      walk_island(map, i, j, w, h);
    }else{
      break;
    }
  }
}

int search_island_num(vector< vector <int> >& map, int w, int h){
  int island_count = 0;
  for (int i = 0; i < h; ++i)
  {
    for (int j = 0; j < w; ++j)
    {
      if(map[i][j] == 1){
        island_count++ ;
        map[i][j] = 2;
        walk_island(map, i, j, w, h);
      }
    }
  }
  return island_count;
}

int main(){
  vector< vector<int> > map;
  int w, h;
  while (read_map(map, w, h) != 0) {
    cout << search_island_num(map, w, h) << endl;
    map.clear();
  }
}

Measured memory_bytes: 1424
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

int main(){
ll K;
string S;
cin >> K >> S; 
if(S.size()<=K){
  cout << S << endl;
}else{
  cout << S.substr(0,K) << "..." << endl;
}
}

Measured memory_bytes: 3604
N = gets.to_i
A = gets.split.map &:to_i
a = [0, *A, 0]
sum = 0
a.inject{|r,n|
  sum += (r - n).abs
  n
}
p *(1..N).map{|i|
  sum - (a[i-1] - a[i]).abs - (a[i] - a[i+1]).abs + (a[i-1] - a[i+1]).abs
}

Measured memory_bytes: 16372