akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int INF = 1e9;

int main()
{
    int h, w, sh, sw, gh, gw;
    cin >> h >> w >> sh >> sw >> gh >> gw;
    sh--;
    sw--;
    gh--;
    gw--;
    int n = h * w;
    vector<vector<char>> field(h, vector<char>(w));
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            cin >> field[i][j];
        }
    }
    priority_queue<P, vector<P>, greater<P>> que;
    que.push(P(0, sh * w + sw));
    vector<int> d(n, INF);
    d[sh*w + sw] = 0;
    vector<int> dx = {1, 0, -1, 0};
    vector<int> dy = {0, -1, 0, 1};
    while(!que.empty())
    {
        P p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first) continue;
        int vx = v / w;
        int vy = v % w;
        // walk
        for(int i = 0; i < 4; i++)
        {
            int nx = vx + dx[i];
            int ny = vy + dy[i];
            if(nx >= 0 && nx < h && ny >= 0 && ny < w && field[nx][ny] == '.')
            {
                int nv = nx * w + ny;
                if(d[nv] > d[v])
                {
                    d[nv] = d[v];
                    que.push(P(d[nv], nv));
                }
            }
        }
        // magic
        for(int x = -2; x <= 2; x++)
        {
            for(int y = -2; y <= 2; y++)
            {
                int nx = vx + x;
                int ny = vy + y;
                if(nx >= 0 && nx < h && ny >= 0 && ny < w && field[nx][ny] == '.')
                {
                    int nv = nx * w + ny;
                    if(d[nv] > d[v] + 1)
                    {
                        d[nv] = d[v] + 1;
                        que.push(P(d[nv], nv));
                    }
                }
            }
        }
    }
    int nv = gh*w + gw;
    if(d[nv] == INF) cout << -1 << endl;
    else cout << d[nv] << endl;
}



Measured memory_bytes: 8292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b)
{
    if (a > b)
        a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b)
{
    if (a < b)
        a = b;
}

int main()
{
    ll n;
    cin >> n;
    bool ok = false;
    rep(i, 1, 10) rep(j, 1, 10) if (i * j == n) ok = true;
    if (ok)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

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

int main()
{
 long long int test;
 //cin>>test;
 test=1;
 while(test--)
 {
  string str;
  int sum=0;
  cin>>str;
  for(long long int i=0;i<str.length();i++)
   { sum+=str[i]-'0';
   	 sum=sum % 9;
   	}
   	if(sum)
   		cout<<"No";
   	else
   		cout<<"Yes";
 }
}

Measured memory_bytes: 3716
"""
    Author: _YL_
"""
s = input()
n = int(input())

flip = 0
left = 0
right = 1
strs = ["", ""]

i = 0
while i < n:
    lst = input().split()

    if lst[0] == "1":
        flip += 1
        left = 0 if left == 1 else 1
        right = 0 if right == 1 else 1
    elif lst[1] == "1":
        strs[left] += lst[2]
    else:
        strs[right] += lst[2]
    i += 1

if flip % 2 == 1:
    s = s[::-1]
    
s = strs[left][::-1] + s + strs[right]

print(s)


Measured memory_bytes: 4436
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    
    int A[N];
    
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    for(int i = 0; i < N; i++){
        int v = A[i];
        int j = i - 1;
        while((j >= 0) && (A[j] > v)){
            A[j + 1] = A[j];
            j--;
        }
        A[j + 1] = v;
        
        for(int j = 0; j < (N - 1); j++){
            cout << A[j] << " ";
        }
        
        cout << A[N-1] << endl;
    }
}


Measured memory_bytes: 3088
#include<stdio.h>
#include<string.h>
int main(){
    char a[4];
    int cnt;
    int maxm=0;
    int i;
    scanf("%s",&a);
    cnt=0;
    for(i=0;i<4;i++){
        if(a[i]=='R'){
            cnt++;
        }
        else{
            if(cnt>=maxm){
                maxm=cnt;
            }
            cnt=0;
        }
    }
    printf("%d\n",maxm);
    return 0;
}


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

int main(){
  int n,m;
  char c;
  vector<char> transB,transA;
  vector<char> input; 
  while(cin >> n){
    if(n == 0)
      return 0;

    transB.clear(); transA.clear(); input.clear();
    for(int i =0;i<n;i++){
      cin >> c;
      transB.push_back(c); 
      cin >> c;
      transA.push_back(c);
 }
      
    cin >> m;
   for(int i=0;i<m;i++){
     cin >> c;
     input.push_back(c);
  }
  for(int i=0;i<m;i++){
    for(int k =0;k < n;k++){ 
      if(input[i] == transB[k]){
	input[i] = transA[k];  break;
    }
    }
  }

  for(int i = 0;i<m;i++){
    cout << input[i];
    }
    cout << endl;
  }
}
  
  

Measured memory_bytes: 1120
object Main{
    def main(args: Array[String]): Unit ={
        val scanner = new java.util.Scanner(System.in)
        val a,b = scanner.nextInt()
        if(a < b) System.out.println("a < b")
        else if(a > b) System.out.println("a > b")
        else System.out.println("a == b")
    }
}

Measured memory_bytes: 44852
package main

import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
	//	"github.com/pkg/profile"
)

func main() {
	//	defer profile.Start(profile.ProfilePath(".")).Stop()

	s := bufio.NewScanner(os.Stdin)
	s.Split(bufio.ScanWords)

	if !s.Scan() {
		log.Fatal("scan error")
	}

	var w = bufio.NewWriter(os.Stdout)

	n, _ := strconv.Atoi(s.Text())
	ar := make([]int, 10000)
	c := 0

	for i := 0; s.Scan() && i < n; i++ {
		x, _ := strconv.Atoi(s.Text())
		ar[x]++
		c++
	}

	if s.Err() != nil {
		log.Fatal(s.Err())
	}

	p := 0

	for x := 0; x < 10000; x++ {
		y := ar[x]
		if y > 0 {
			for j := 0; j < y; j++ {
				p++
				if p == c {
					fmt.Fprintln(w, x)
				} else {
					fmt.Fprintf(w, "%d ", x)
				}
			}
		}
	}

	_ = w.Flush()

}



Measured memory_bytes: 6348
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



n,k,q=LI()
L=[k-q] * n
A = IR(q)



for l in A:
    L[l-1]+=1



for j in range(n):
    if L[j] > 0:
        print('Yes')
    else:
        print('No')

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

int main(int argc, char **argv)
{
    int N, M;
    std::cin >> N >> M;

    std::vector<int> cities(N);
    
    for(int i = 0; i < M; i++){
        int a, b;
        std::cin >> a >> b;
        cities.at(a-1)++;
        cities.at(b-1)++;
    }
    
    for(int i = 0; i < N; i++){
        std::cout << cities.at(i) << std::endl;
    }

    
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c)
#define ft first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
using namespace std;
using Graph = vector<vector<int>>;
typedef long long lint;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<ull> ulvec;
typedef vector<double> dvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;
typedef vector<tuple<ll,ll,ll>> tvec;
typedef vector<string> svec;

const ll MAX_N=10000;

ll H,W;
ll N;
ll a[MAX_N+1];
ll b[101][101];

void solve(){
    ll x=0,y=0,k=0;
    bool flag=true;
    while(true){
        b[y][x]=k+1;
        a[k]--;
        if(a[k]==0) k++;
        if(flag){    
            if(x==W-1){
                y++;
                flag=false;
            }else{
                x++;
            }
        }else{
            if(x==0){
                y++;
                flag=true;
            }else{
                x--;
            }
        }
        if(a[N-1]==0) break;
    }
    rep(i,H){
        rep(j,W) cout<<b[i][j]<<' ';
        cout<<endl;
    }
}

int main(){
    cin>>H>>W;
    cin>>N;
    rep(i,N) cin>>a[i];
    solve();
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 tmp;
	multiset<int64> memo;
	for(int64 ii = 0;ii < 3;ii++)
	{
		cin >> tmp;
		memo.insert(tmp);
	}
	auto ite = memo.begin();
	tmp = *ite;
	ite++;
	tmp += *ite;
	cout << tmp << endl;
	return 0;
}

Measured memory_bytes: 3572
using System.Linq;
using static System.Console;

class Program
{
    
    static void Main(string[] args)
    {
        ReadLine();
        var arr = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        ReadLine();
        var keys = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        WriteLine(Binarysearch(arr, keys));
    }

    static int Binarysearch(int[] A, int[] keys)
    {
        var count = 0;
    	foreach(var key in keys){
            var left = 0;
	    var right = A.Length;
            while (left < right)
            {
                var mid = (left + right) / 2;
                if(A[mid] == key)
                {
                    count += 1;
                    break;
                }
                else if(A[mid] > key)
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }
    	}
    	return count;
    }
}


Measured memory_bytes: 23080
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let p: Vec<usize> = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect();
    let mut diff = 0;
    for i in 0..n {
        if i + 1 != p[i] {
            diff += 1;
        }
    }
    println!("{}", if diff <= 2 { "YES" } else { "NO "});
}


Measured memory_bytes: 4352
n=int(input())
a=list(map(int,input().split()))
a = sorted(a)
def trian(a):
    n=len(a)
    res = 0
    # 最小辺x
    for x in range(n):
        z=x+2
        # 真ん中の辺y
        for y in range(x+1,n):
            # 最大の辺z
            # nより小さく、二辺の和よりも小さい
            while(z<n and a[x]+a[y]>a[z]):
                z+=1
            # y+1から毎回数えるのではなく、yが増えれば、zも増えるのを利用し、前回の値を保存しておく
            res += z-y-1
    return res
print(trian(a))


Measured memory_bytes: 3188
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    char a;
    char x,y;
    for(int i = 0;i < 6;i++){
        cin >> a;
        
        if(i == 2){
            x = a;
        }
        if(i == 3){
            if(a != x){
                cout << "No";
                return 0;
            }
        }
        
        if(i == 4){
            y = a;
        }
        
        if(i == 5){
            if(a != y){
                cout << "No";
                return 0;
            }
        }
        
        
    }
    cout << "Yes";
}


Measured memory_bytes: 256
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

a,b,c,k = MI()

if a >= k:
    print(k)
elif a + b >= k:
    print(a)
else:
    print(a - (k-a-b))


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

int main() {
  int n;
  cin >> n;
  vector<int> a(4);
  rep(i, n){
    string s;
    cin >> s;
    if(s == "AC")a[0]++;
    if(s == "WA") a[1]++;
    if(s == "TLE")a[2]++;
    if(s == "RE")a[3]++;
  }
  cout << "AC" << " x " << a[0] << endl;
  cout << "WA" << " x " << a[1] << endl;
  cout << "TLE" << " x " << a[2] << endl;
  cout << "RE" << " x " << a[3] << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int,int);
void dfs( vector< vector<int> >&, int , vector<int>& );
void bfs( vector< vector<int> >&, int , vector<int>& );

void solve()
{
    int n;
    cin>>n;

    vector<int> a(n-1);
    map<int,int> p;
    rep(i,0,a.size())
    {
        cin>>a[i];
        p[a[i]]++;
    }

    rep(i,1,n+1)
    {
        cout<<p[i]<<endl;
    }
}

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

void dfs ( vector< vector<int> > &v , int x , vector<int> &vis )
{
    vis[x] = 1;

    rep(i,0,v[x].size())
    {
        if( vis[v[x][i]] == 0 )
        {
            dfs(v,v[x][i],vis);
        }
    }
}

void bfs( vector< vector<int> > &v , int x , vector<int> &vis )
{
    queue<int> q;
    q.push(x);

    while( !q.empty() )
    {
        int p = q.front();
        q.pop();

        rep(i,0,v[p].size())
        {
            if ( vis[v[p][i]] == 0 )
            {
                vis[v[p][i]] = 1;
                q.push(v[p][i]);
            }
        }
    }
}

Measured memory_bytes: 17256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, H);
    IN(ll, W);
    IN(ll, N);
    ll x = max(H, W);
    OUT((N + x - 1) / x);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iostream>
#include <numeric>
#define rep(i,n) for (int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
int INF = 1e9;

int main(){
	int n;cin >> n;
	cout << n*(n+1)/2 << endl;
	
} 
 

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

        
        long res=2019;
    
        long bai = L/2019;

        if(L%2019==0 || 2019*(bai+1)<=R){
            res = 0;
        }else{
            for(long i=L; i<R; i++){
                for(long j=i+1; j<R+1; j++){
                    res = Math.min(res,(i*j)%2019);
                }
            }
        }
        System.out.println(res);
        
        }
    }

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

#define debug(s) cout << s << endl
#define debug1(s, t) cout << s << " " << t << endl
#define debug2(s, t, u) cout << s << " " << t << " " << u << endl
#define printvec(v)       \
    for (auto &&i : v)    \
        cout << i << " "; \
    cout << endl
#define rep(n, i) for (int i = 0; i < n; i++)

using namespace std;
using i64 = long long;

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

    i64 diff[400][400];     // 200で中央

    for (int i = 0; i < 400; i++)
    {
        for (int j = 0; j < 400; j++)
        {
            diff[i][j] = pow(i-200,5) - pow(j-200,5);
        }
    }

    for (int i = 0; i < 400; i++)
    {
        for (int j = 0; j < 400; j++)
        {
            if (x == diff[i][j])
            {
                cout << i-200 << " " << j-200 << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 5348
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
long long cnt; int l;
int A[1000000];
int n; vector<int> G;

// 4 8 9 1 10 6 2 5 3 7  g=4

// 間隔gを指定した挿⼊ソート
void insertionSort(int A[],int n,int g){
    for (int i=g; i<n; i++) {
        int v = A[i];
        int j = i - g;
        while( j >= 0 && A[j] > v ) {
            A[j + g] = A[j];
            j -= g;
            cnt++;
        }
        A[j + g] = v;
    }
}

void shellSort(int A[], int n) {
    // 数列G = {1, 4, 13, 40, 121, 364, 1093, ...} を⽣成
    for ( int h = 1; ; ) {
        if ( h > n ) break;
        G.push_back(h);
        h = 3*h + 1;
    }
    for(int i=G.size()-1;i>=0;i--) {
        // 逆順にG[i] = g を指定
        insertionSort(A, n, G[i]);
    }
}

int main() {
    cin >> n;
    // より速い⼊⼒scanf 関数を使⽤
    for ( int i = 0; i < n; i++ )
        scanf("%d", &A[i]);
    cnt = 0;
    shellSort(A, n);
    cout << G.size() << endl;
    for(int i=G.size()-1; i>=0;i--) {
        printf("%d", G[i]);
        if ( i ) printf(" ");
    }
    printf("\n");
    printf("%lld\n", cnt);
    for ( int i = 0; i < n; i++ )
        printf("%d\n", A[i]);
    return 0;
}



Measured memory_bytes: 7184
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)
 ll nums[200050]={0};
  ll oks[200050]={0};

int main(){
  ll N;

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


  for(ll i=0;i<N;i++){
      nums[A[i]]++;
  }
ll sum=0;
  for(ll i=0;i<=200030;i++){
      if(nums[i]!=0){
      sum += nums[i]*(nums[i]-1)/2;
      oks[i] = nums[i]*(nums[i]-1)/2;
      }
  }

    for(ll i=0;i<N;i++){
      cout<<((sum-oks[A[i]])+(((nums[A[i]]-1)*(nums[A[i]]-2))/2))<<endl;
  }











}

Measured memory_bytes: 6272
#include <iostream>
#include <vector>
using namespace std;
typedef long long i64;
typedef char str255[256];

#define BIG_PRIME 1000000007
#define remainder(x) ((x) % BIG_PRIME)

str255 S, T;
int len;

void Solve()
{
  str255 ans;
  int ptr = 0;
  for (int i = 0; i < len; ++i){
    ans[ptr++] = S[i];
    ans[ptr++] = T[i];
  }
  ans[ptr] = '\0';

  cout << ans << endl;
}

void Init()
{
  cin >> len;
  cin >> S >> T;
}

void Clean(){}

int main(){ Init(); Solve(); Clean(); return 0; }


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

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int t = Integer.parseInt(st.nextToken());
        int[] a = new int[n];
        st = new StringTokenizer(br.readLine());
        for (int i = 0; i < n; i++) {
            a[i] = Integer.parseInt(st.nextToken());
        }
        int score = 0;
        int min = a[0], max = a[0];
        for (int i = 0; i < n; i++) {
            if (min > a[i]) {
                max = a[i];
                min = a[i];
            } else {
                max = Math.max(a[i], max);
            }
            score = Math.max(score, max - min);
        }
        int second_score = 0;
        min = a[0];
        max = a[0];
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (min > a[i]) {
                max = a[i];
                min = a[i];
                second_score = 0;
            } else {
                max = Math.max(a[i], max);
                if (second_score < max - min) {
                    second_score = max - min;
                    if (second_score == score) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23992
#include <bits/stdc++.h>
using namespace std;
 
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b) - 1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
 
typedef long long Int;
typedef vector<int> VI;
typedef pair<int, int> PII;
 
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000;
const Int LINF = INF * (Int) INF;
const int MAX = 100007;
const int MOD = 998244353;


int n;

VI G[MAX];
Int pw[MAX];

Int bpow(Int a, Int k) {
    Int res = 1;
    while (k) {
        if(k & 1) {
            res *= a;
            res %= MOD;
        }
        a *= a;
        a %= MOD;
        k /= 2;
    }
    return res;
}

vector<Int> fwht(vector<Int> data) {
    int n = SZ(data);
    while (n & (n - 1)) {
        ++ n;
        data.push_back(0);
    }
    for (int len = 1; 2 * len <= n; len <<= 1) {
        for (int i = 0; i < n; i += 2 * len) {
            for (int j = 0; j < len; j++) {
                int a = data[i + j];
                int b = data[i + j + len];
                data[i + j] = (a + b) % MOD;
                data[i + j + len] = (MOD + a - b) % MOD;
            }   
        }
    }
    return data;
}

vector<Int> F() {
    int m;
    cin >> m;
    FOR(i,0,n)
        G[i].clear();
    FOR(i,0,m) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        if (a < b) swap(a, b);
        G[a].push_back(b);
    }
    vector<Int> R;
    set<int> S, T;
    FOR(i,0,n)
        S.insert(i);
    while (SZ(S)) {
        Int c = 0;
        while (SZ(S)) {
            int v = *S.rbegin();
            S.erase(v);
            c += pw[v + 1];
            c %= MOD;
            for(int to: G[v]) {
                if (S.find(to) != S.end()) {
                    S.erase(to);
                    T.insert(to);
                }
            }
        }
        // cout << endl;
        R.push_back(c);
        S.swap(T);
    }
    // cout << endl;
    while (SZ(R) < n) R.push_back(0);
    return R;
}

int main(int argc, char* argv[])
{
	ios::sync_with_stdio(false); cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    // mt19937 rng(47);

    Int val = 1;
    FOR(i,0,18) {
        val = val * 10 % MOD;
    }
    pw[0] = 1;
    FOR(i,1,MAX)
        pw[i] = pw[i - 1] * val % MOD;
    
    cin >> n;
    vector<Int> A = F();
    vector<Int> B = F();
    vector<Int> C = F();

    A = fwht(A);
    B = fwht(B);
    C = fwht(C);
    FOR(i,0,SZ(A)) {
        A[i] = A[i] * B[i] % MOD * C[i] % MOD;
    }
    A = fwht(A);

    cout << A[0] * bpow(SZ(A), MOD - 2) % MOD << endl;
    
    cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;
	return 0;
}



Measured memory_bytes: 12248
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████  
//
#include "bits/stdc++.h"
using namespace std;
#define INF (1<<30)
#define LINF (1LL<<60)
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl
#define SP << " " << 
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#define MSB(x) (63-__builtin_clzll(x))
#define pcnt(x) (__builtin_popcountll(x))
#define parity(i,j) (i&(1LL<<j))
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  string s;
  cin >> s;

  cout << s.substr(0,3) << endl;

  return 0;
}

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

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

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

string ans[1001][1001];
template<typename T>
void fin(T a){
  cout<<a<<endl;
  exit(0);
}

signed main(){
  int n;cin>>n;
  if(n==2)fin(-1);
  if(n==3){
    cout<<"aa."<<endl<<"..b"<<endl<<"..b"<<endl;
    return 0;
  }
  if(n==4){
    cout<<"aacd"<<endl<<"bbcd"<<endl<<"cdaa"<<endl<<"cdbb"<<endl;
    return 0;
  }
  for(int i=0;i<n;i++)for(int j=0;j<n;j++)ans[i][j]='.';
  ans[0][0]=ans[0][1]=ans[0][n-1]=ans[1][n-1]=ans[n-2][0]=ans[n-1][0]=ans[n-1][n-2]=ans[n-1][n-1]='z';
  ans[1][0]=ans[2][0]=ans[0][n-3]=ans[0][n-2]=ans[n-1][1]=ans[n-1][2]=ans[n-3][n-1]=ans[n-2][n-1]='y';
  char now='a';
  for(int i=1;i<=n-4;i++){
    ans[i+1][i]=ans[i+2][i]=now;
    now++;if(now=='x')now='a';
    ans[i][i+1]=ans[i][i+2]=now;
    now++;if(now=='x')now='a';
  }
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++)cout<<ans[i][j];cout<<endl;
  }
}

/*
解説AC
5や7を作れるのに気づくのが遅かったのと、3で価値3のが作れない時点で組み合わせを諦めてしまっていたのが一つ目の敗因
ただ今回の実装はkeymoonの天才的なパズル
んーでもこれ実験しても気づかない気がするんだよな
パズルわからん
*/


Measured memory_bytes: 55936
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define each(i,c) for(auto i=(c).begin();i!=(c).end();++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizoef(a))
#define sz(s) (int)((s).size())
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define pb push_back
#define MP(x,y) make_pair((x),(y))

using namespace std;

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

int wall[102];
int cnt[102];
vector<int> rank;

int main()
{
	memset (wall, -1, sizeof (wall ) );
	memset (cnt, 0, sizeof (cnt ) );

	rank.clear();
	ios_base::sync_with_stdio(0);
	int N, M; cin >> N >> M;

	vector<int> a(M, 0 ), L(M, 0 );
	rep (i, M ) cin >> a[i] >> L[i];
	rep (i, M ){
		int j = a[i], k = 0; 
		while (k < L[i] ){
			wall[j%N] = i;
			j++, k++;
		} // end while
	} // end rep

	int curr = 0;
	// 起点 0 の壁は塗られていない
	if (wall[0] == -1 ){
		rep (j, N ){
			if (wall[j] == -1 ){
				if (curr != 0 ){
					rank.push_back (curr );
					curr = 0;
				} // end if
			}else							
			if (wall[j] != -1 ){
				curr++;
			} // end if
		} // end rep
		if (curr != 0 ) rank.push_back (curr );
	}else{
	// 起点 0 の壁が塗られている（続いている可能性あり）
		rep (j, N ){
			if (wall[j] == -1 ){
				if (curr != 0 ){
					rank.push_back (curr );
					curr = 0;
				} // end if
			}else							
			if (wall[j] != -1 ){
				curr++;
			} // end if
		} // end rep
		if (curr != 0 ){
			if (!rank.empty() ){
				rank[0] += curr;
			}else{
				rank.push_back (curr );
			} // end if
		} // end if
	} // end if

	rep (i, rank.size() ){
		cnt[rank[i]]++;
	} // end rep

	for (int i = 101; i >= 0; i-- ){
		if (cnt[i] != 0 ){
			cout << i << ' ' << cnt[i] << endl;
		} // end if
	} // end for

	return 0;
}


Measured memory_bytes: 1224
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);
 
int main() {
	int n, m;
	std::cin >> n >> m;
	std::vector<int> p;
	int a, b;
	int count = m - 1;
	for (int i = 0; i < m; i++) {
		std::cin >> a >> b;
		if (a < n)p.emplace_back(n - a);
		else count--;
	}
	std::sort(p.begin(), p.end());
	int ans = 0;
	for (int i = 0; i < count; i++) {
		ans += p[i];
	}
	std::cout << ans << std::endl;
}

Measured memory_bytes: 3116
#include<stdio.h>
int main()
{
    int n,i,sum=0,sum1=0,sum2=0,sum3=0;
    scanf("%d",&n);
    sum1=n;
    sum2=n*n;
    sum3=n*n*n;
    sum=(sum1+sum2+sum3);
    printf("%d\n",sum);
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  unsigned long long a[n];
  unsigned long long ans=1;
  unsigned long long max=1;
  for(int i=0; i<18; i++)
    max = max*10;
  for(int i=0; i<n; i++){
    cin >> a[i];
    if(a[i]==0){
      ans = 0;
      break;
    }
  }
  if(ans!=0){
    for(int i=0; i<n; i++){
      if(a[i]<=max/ans)
      	ans = ans * a[i];
      else{
        cout << -1 << endl;
        ans = max + 1;
        break;
      }
    }
  }
  if(ans <= max)
    cout << ans << endl;
}



Measured memory_bytes: 4416
#include <iostream>
#include <utility>
#include <queue>
#include <memory>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>

#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)

using namespace std;
using ll = long long;
const int mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    ll ans = 0;
    vector<ll> a(n),b(n),c(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    rep(i,n) cin >> c[i];
   
    sort(a.begin(),a.end(),less<ll>());
    sort(b.begin(),b.end(),less<ll>());
    sort(c.begin(),c.end(),less<ll>());
    
    rep(i,n){
        if(a[0] >= b[i])continue;
        if(c[n-1] <= b[i])continue;

        ll left = lower_bound(a.begin(),a.end(),b[i]) - a.begin();
        ll right = c.end() - upper_bound(c.begin(),c.end(),b[i]);
        
        ans += left * right;       
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353 
#define inf 1000000000000000000
#define endl '\n'
ld dp[301][301][301];
int main()
{
	fastio;
	#ifdef APNA_IO
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll n;
	cin>>n;
	ll arr[n];
	for(ll i=0;i<n;i++)
		cin>>arr[i];
	ll cnt1=0,cnt2=0,cnt3=0;
	for(ll i=0;i<n;i++)
	{
		if(arr[i]==1)
			cnt1++;
		if(arr[i]==2)
			cnt2++;
		if(arr[i]==3)
			cnt3++;
	}
	for(ll i=0;i<=n;i++)
	{
		for(ll j=0;j<=n;j++)
		{
			for(ll k=0;k<=n;k++)
			{
				ld a=0.0,b=0.0,c=0.0;
				if(i==0 && j==0 && k==0)
				{
					dp[i][j][k]=0.0;
					continue;
				}
				if(k-1>=0)
					a=dp[i][j][k-1];
				if(j-1>=0)
					b=dp[i][j-1][k+1];
				if(i-1>=0)
					c=dp[i-1][j+1][k];
				dp[i][j][k]=(k*1.0*a+j*1.0*b+i*1.0*c+n*1.0)/((i+j+k)*1.0);
			}
		}
	}
	cout<<setprecision(20)<<dp[cnt3][cnt2][cnt1]<<endl;
	return 0;
}

Measured memory_bytes: 426368
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

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

const int MAX_H = 1005;
const int MAX_W = 1005;

const int MAX_M = 1e6;

bool prime[MAX_M+1];
int cave[MAX_H][MAX_W];

void find_start(int start_num, int& sx, int& sy) {
    REP(y, MAX_H) REP(x, MAX_W) {
        if (cave[y][x] == start_num) {
            sx = x;
            sy = y;
            return;
        }
    }
}

int main() {
    prime[0] = prime[1] = true;
    FOR(i, 2, MAX_M+1) {
        if (prime[i]) continue;
        for (int j = i+i; j < MAX_M+1; j += i) {
            prime[j] = true;
        }
    }

    int y = MAX_H/2, x = MAX_W/2;
    int d = 0;
    FOR(i, 1, MAX_M+1) {
        cave[y][x] = i;
        y += dy[d];
        x += dx[d];
        int d2 = (d + 1) % 4;
        if (cave[y + dy[d2]][x + dx[d2]] == 0) {
            d = d2;
        }
    }

    int caves, start_n;
    while (cin >> caves >> start_n, caves|start_n) {
        int x, y;
        find_start(start_n, x, y);

        pii res = {0, 0}; // ?????°, ?´???°?´?????????????

        vector<int> G(MAX_W, -1);
        G[x] = 0;
        bool updated;
        do {
            updated = false;
            vector<int> G2(G);
            REP(x, MAX_W) {
                if (G[x] == -1 || cave[y][x] > caves) continue;
                if (!prime[cave[y][x]]) {
                    G[x]++;
                    pair<int, int> r(G[x], cave[y][x]);
                    res = max(res, r);
                }
                for (int dx = -1; dx <= 1; dx++) {
                    int sx = x + dx;
                    int sy = y + 1;
                    if (0 <= sx && sx < MAX_W && 0 <= sy && sy < MAX_H) {
                        if (cave[sy][sx] != 0 && cave[sy][sx] <= caves) {
                            G2[sx] = max(G[x], G2[sx]);
                            updated = true;
                        }
                    }
                }
            }
            G = G2;
            if (++y >= MAX_H) break;
        } while (updated);
        printf("%d %d\n", res.first, res.second);
    }
}

Measured memory_bytes: 6112
#include<bits/stdc++.h>
#define console
using namespace std;
#ifndef console
ifstream fin("data.in");
ofstream fout("data.out");
#else
#define fin cin
#define fout cout
#endif
#define usain_bolt() (ios_base::sync_with_stdio(false), \
fin.tie(NULL), fout.tie(NULL))
typedef long long ll;
int main()
{
    usain_bolt();
    ll a, b, c, d, e;
    fin >> a >> b >> c >> d >> e;
    if (a == 0) fout << 1;
    else if (b == 0) fout << 2;
    else if (c == 0) fout << 3;
    else if (d == 0) fout << 4;
    else if (e == 0) fout << 5;
    
#ifndef console
    fin.close(), fout.close();
#endif
    return 0;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
    
    int N;
    cin>>N;
    
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin>>vec[i];
    }
    
    
    int ans=0;
    
    for(int i=0;i<N;i++){
        for(int j=2;j*j<=vec[i];j++){
            if(vec[i]%j==0){
                ans--;
                break;
            }
        }
        ans++;
    }
    
    cout<<ans<<endl;
}


Measured memory_bytes: 3132
using System;
using System.Collections.Generic;
using System.Linq;
using static Atcoder;
using System.Threading.Tasks;
using System.ComponentModel;

public class Hello
{

    public static void Main()
    {
        int N = Cin();
        HashSet<string> H = new HashSet<string>();
        string[] s = SpRead(' ');
        for (int i = 0; i < N; i++) {
            if (!H.Contains(s[i])) H.Add(s[i]);
        }
        if (H.Count == 3) Console.WriteLine("Three");
        else if (H.Count == 4) Console.WriteLine("Four");
    }
    
}


public class Atcoder
{
    static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
    public static int LCM(int a, int b)
    {
        int c = a * b;
        if (a < b) Swap(ref a, ref b);
        int d = a % b;
        while (d != 0)
        {
            a = b;
            b = d;
            d = a % b;
        }
        return c / b;
    }
    public static string strReverce(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static int Cin()
    {
        return int.Parse(Console.ReadLine());
    }
    public static bool IsPrime(int n)
    {
        if (n < 2) return false;
        if (n == 2) return true;
        if (n % 2 == 0) return false;

        //double sqrtNum = Math.Sqrt(n);
        for (int i = 3; i < n; i += 2)
        {
            if (n % i == 0) return false;
        }
        return true;
    }
    public static string[] SpRead(char c)
    {
        return Console.ReadLine().Split(c);
    }
}


Measured memory_bytes: 11348
import sys
s = input()
a = 'R U D'
b = 'L U D'
for i, num in enumerate(s):
  if i % 2==0:
    if num in a:
      continue
    else:
      print('No')
      sys.exit()
  else:
    if num in b:
      continue
    else:
      print('No')
      sys.exit()
print('Yes')

Measured memory_bytes: 3060
require "set"
k = gets.chomp.to_i

# 7, 77, 777, ... の一般項を a_n とおくと
# k * m = a_n (mは自然数) となるような最小のnを見つけたい
# 式変形すると m = a_n / k
# 左辺は自然数なので, 右辺も自然数になる必要がある
# つまり a_n が k で割り切れるような最小のnを見つけたい
# そのようなnが存在しないときもあることに注意
# a_nは2や5の倍数ではないので, kも2や5の倍数になりえない
# 実は-1になる条件は2と5の倍数のみ

if k % 2 == 0 || k % 5 == 0
  puts -1
  exit
end

#set = Set.new
a_n = 0
n = 0
while true do
  n += 1
  a_n = (a_n * 10 + 7) % k
  break if a_n == 0
end
puts n


Measured memory_bytes: 14460
k, a, b = gets.split.map(&:to_i)

hit_only = 1 + k
hit_and_change_once = 0
hit_and_change = 0

if b>a && k >= a+1
    hit_and_change_once = b + k - (a+1)
    hit_and_change += b + (k - (a+1))/2 * (b-a) + (k - (a+1))%2
end

puts [hit_only, hit_and_change_once, hit_and_change].max



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

vector<int> dp(1e5+1, -INF);
map<int, vector<int>> p;

int func(int n){
  if(dp[n] >= 0) return dp[n];
  int res = 0;
  rep(i, p[n].size()){
    res = max(res, func(p[n][i])+1);
  }
  return dp[n] = res;
}

int main(){
  int n, m;
  cin >> n >> m;
  rep(i, m){
    int x, y;
    cin >> x >> y;
    p[x].push_back(y);
  }
  int ans = -INF;
  rep(i, n+1) ans = max(func(i), ans);
  cout << ans << endl;
  return 0;
}


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

signed main() {
#ifdef _DEBUG
	freopen("in" , "r", stdin );
	//freopen("out", "w", stdout);
#endif
	string s; cin >> s;
	deque<char> dq;
	for (int i = 0; i < (int) s.size(); i++) {
		dq.push_back(s[i]);
	}
	int r = 0;
	int q; cin >> q;
	while (q--) {
		int t; cin >> t;
		if (t == 1) r = 1 - r;
		else {
			int f; cin >> f;
			if (r) {
				if (f == 1) f = 2;
				else f = 1;
			}
			char c; cin >> c;
			if (f == 1) dq.push_front(c);
			else dq.push_back(c);
		}
	}
	while (dq.size()) {
		if (r == 0) {
			cout << dq.front();
			dq.pop_front();
		} else {
			cout << dq.back();
			dq.pop_back();
		}
	}
	cout << '\n';
}

Measured memory_bytes: 896
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<string>
#include<time.h>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;

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


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

    for (int i = s.size() - 1; i >= c.size() - 1; --i) {
        for (int j = 0; j < c.size(); ++j) {
            if (s[i - j] != '?' && s[i - j] != c[c.size() - 1 - j]) goto LOOP_END;
        }
        for (int j = 0; j < c.size(); ++j) {
            s[i - j] = c[c.size() - 1 - j];
        }
        for (char& c : s) if (c == '?') c = 'a';
        cout << s << endl;
        return 0;
    LOOP_END:
        continue;
    }
    cout << "UNRESTORABLE" << endl;
    return 0;
}

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

#define int long long
#define double long double

const int INF=2147483647;
const int MOD=1000000007;
const int mod=998244353;
const double eps=1e-12;

using namespace std;

struct Pt{
    int x,y,idx;
};

bool cmp(Pt a,Pt b){
    return (a.x<b.x);
}

Pt pt[200001];

int p[200001];
int sz[200001];
int res[200001];

int findp(int v){
    if(v==p[v]){
        return v;
    }
    return p[v]=findp(p[v]);
}

void Union(int v1,int v2){
    int p1=findp(v1);
    int p2=findp(v2);
    if(p1==p2){
        return;
    }
    if(sz[p1]<sz[p2]){
        p[p1]=p2;
        sz[p2]+=sz[p1];
    }
    else{
        p[p2]=p1;
        sz[p1]+=sz[p2];
    }
}

vector<int> mq;

signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>pt[i].x>>pt[i].y;
        pt[i].idx=i;
    }
    sort(pt,pt+n,cmp);

    for(int i=0;i<n;i++){
        sz[i]=1;
        p[i]=i;
    }

    for(int i=0;i<n;i++){

        int Min=i;

        while(mq.empty()==0 and pt[*mq.rbegin()].y < pt[i].y ){
            Union(*mq.rbegin(),i);
            if(pt[Min].y > pt[*mq.rbegin()].y){
                Min=*mq.rbegin();
            }
            mq.pop_back();
        }
        mq.push_back(Min);

    }

    for(int i=0;i<n;i++){
        res[ pt[i].idx ]=sz[findp(i)];
    }

    for(int i=0;i<n;i++){
        cout<<res[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 13100
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <string>
#include <unordered_map>
using namespace std;


int main(){
    long long n, a[5];
    cin >> n;
    for (int i = 0; i < 5; i++){
        cin >> a[i];
    }
    long long time = ceil(1.0 * n / a[0]);
    long long min_a = a[0];
    for (int i = 1; i < 5; i++){
        if (a[i] < min_a){
            min_a = a[i];
            time = i + ceil(1.0 * n / a[i]);
        }
        else {
            time++;
        }
    }
    cout << time << endl;
    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;
int main()
{
    int n,a[100001];
    scanf("%d",&n);
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
    }
    sort(a,a+n);
    int f=0;
     for(int i=0; i<n; i++)
    {
      if(a[i]==a[i+1])
       {
           a[i]=a[i+1]=0;
           f+=2;
           i=i+1;
       }
    }
    printf("%d\n",n-f);
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

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


Measured memory_bytes: 3072