akhauriyash/Code-Regression huggingface dataset:
package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)

	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	aa := make([]int, n)
	bb := make([]int, n)
	cc := make([]int, n)

	for i := 0; i < n; i++ {
		aa[i] = getNextInt(scanner)
	}
	for i := 0; i < n; i++ {
		bb[i] = getNextInt(scanner)
	}
	for i := 0; i < n; i++ {
		cc[i] = getNextInt(scanner)
	}
	sort.Ints(aa)
	sort.Ints(bb)
	sort.Ints(cc)

	var ans int64
	for i := 0; i < n; i++ {
		ai := bsa(bb[i], aa, true)
		ci := bsa(bb[i], cc, false)
		if ai == n || aa[ai] >= bb[i] {
			ai--
		}
		if ai < 0 {
			continue
		}
		if ci >= n {
			continue
		}
		if ci == 0 && cc[ci] <= bb[i] {
			continue
		}
		ans += int64(ai+1) * int64(n-ci)
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}

func bsa(b int, aa []int, less bool) int {
	l := 0
	r := len(aa)
	for l < r {
		m := (l + r) >> 1
		if less {
			if aa[m] >= b {
				r = m
				continue
			}
			l = m + 1
			continue
		}
		if aa[m] <= b {
			l = m + 1
			continue
		}
		r = m
	}
	return l
}


Measured memory_bytes: 7040
#include <iostream>
#define rep(i,k,n) for(int i=k;i<=n;++i)

int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    int k,a,b;
    std::cin >> k >> a >> b;
    std::string s="NG";
    rep(i,a,b){
        if(i%k==0){
            s="OK";
            break;
        }
    }
    std::cout << s << std::endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <string>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
using namespace std;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int k;
  string s;
  cin >> k;
  cin >> s;
  
  if(s.size()-1<k){
    cout << s << endl;
    return 0;
  }
  else{
    for(int i=0; i<k; i++){
      cout << s[i];
    }
    cout << "..." << endl;
  }
  
  return 0;
}

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

public class Main {
  private static int calculateDivCount(int a) {
    int count = 0;
    while (a % 2 == 0) {
      a /= 2;
      count++;
    }
    return count;
  }
  
  private static int solve(int n, int[] as) {
    int minDivCount = Integer.MAX_VALUE;
    for (int a : as) {
      minDivCount = Math.min(minDivCount, calculateDivCount(a));
    }
    return minDivCount;
  }
  
  private static void execute(ContestReader reader, PrintWriter out) {
    int n = reader.nextInt();
    int[] as = reader.nextInt(n);
    out.println(solve(n, as));
  }
  
  public static void main(String[] args) {
    ContestReader reader = new ContestReader(System.in);
    PrintWriter out = new PrintWriter(System.out);
    execute(reader, out);
    out.flush();
  }
}

class ContestReader {
  private BufferedReader reader;
  private StringTokenizer tokenizer;
  
  ContestReader(InputStream in) {
    reader = new BufferedReader(new InputStreamReader(in));
  }
  
  public String next() {
    while (tokenizer == null || !tokenizer.hasMoreTokens()) {
      try {
        tokenizer = new java.util.StringTokenizer(reader.readLine());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
    return tokenizer.nextToken();
  }
  
  public int nextInt() {
    return Integer.parseInt(next());
  }
  
  public long nextLong() {
    return Long.parseLong(next());
  }
  
  public double nextDouble() {
    return Double.parseDouble(next());
  }
  
  public String[] next(int n) {
    String[] array = new String[n];
    for (int i = 0; i < n; i++) {
      array[i] = next();
    }
    return array;
  }
  
  public int[] nextInt(int n) {
    int[] array = new int[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextInt();
    }
    return array;
  }
  
  public long[] nextLong(int n) {
    long[] array = new long[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextLong();
    }
    return array;
  }
  
  public double[] nextDouble(int n) {
    double[] array = new double[n];
    for (int i = 0; i < n; i++) {
      array[i] = nextDouble();
    }
    return array;
  }
  
  public char[] nextCharArray() {
    return next().toCharArray();
  }
  
  public int[][] nextInt(int n, int m) {
    int[][] matrix = new int[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextInt();
      }
    }
    return matrix;
  }
  
  public long[][] nextLong(int n, int m) {
    long[][] matrix = new long[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextLong();
      }
    }
    return matrix;
  }
  
  public double[][] nextDouble(int n, int m) {
    double[][] matrix = new double[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        matrix[i][j] = nextDouble();
      }
    }
    return matrix;
  }
  
  public char[][] nextCharArray(int n) {
    char[][] matrix = new char[n][];
    for (int i = 0; i < n; i++) {
      matrix[i] = next().toCharArray();
    }
    return matrix;
  }
}


Measured memory_bytes: 21332
#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1);
typedef long long ll;
typedef pair<int64_t,int64_t> pll;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define ALL(a) begin(a),end(a)
#define sz(s) (s).size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second

void solve()
{
     int a,b;cin>>a>>b;
     if(a<10&&b<10)cout<<a*b<<endl;
     else cout<<-1<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
 
 
int main() {
  int N;
  int A[110];
  
  cin >> N;
  for(int i=0;i<N;++i) cin >> A[i];
  
  sort(A,A+N,greater<int>());
  
  int Alice =0;
  int Bob =0;
    
  for (int i = 0; i < N; ++i) {
    if (i%2 == 0) {
      Alice += A[i];
    }
    else{
      Bob += A[i];
    }
  }
  
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		sc.close();
		int L = A + B;
		int R = C + D;
		if(R == L) {
			System.out.println("Balanced");
		}else if(R > L) {
			System.out.println("Right");
		}else {
			System.out.println("Left");
		}
	}
}

Measured memory_bytes: 21844
#-swank
(unless (member :child-sbcl *features*)
  (quit
	:unix-status
	(process-exit-code
	  (run-program *runtime-pathname*
				   `("--control-stack-size" "128MB"
					 "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
					 "--eval" "(push :child-sbcl *features*)"
					 "--script" ,(namestring *load-pathname*))
				   :output t :error t :input t))))

(defun binary-search (l r f)
  (if (eq l r)
	(1- l)
	(let ((m (ash (+ l r) -1)))
	  (if (funcall f m)
		(binary-search (1+ m) r f)
		(binary-search l m f)))))


(let ((n 0)
	  (s (read-line)))
  (loop for x across s
		do
		(when (not (char= x #\space))
		  (setf n (+ (* n 10) (- (char-code x) (char-code #\0))))))
  (princ
	(if (= (expt (binary-search 1 (1+ n)
						  (lambda(x) (<= (* x x) n))) 2)
		   n)
	  "Yes"
	  "No")))


Measured memory_bytes: 16700
import heapq

n = int(input())
g = [[] for i in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())
    g[a-1].append((b-1, c))
    g[b-1].append((a-1, c))
q, k = map(int, input().split())
x = []
y = []
for i in range(q):
    X, Y = map(int, input().split())
    x.append(X)
    y.append(Y)

dist = [10**15 for i in range(n)]
h = []
heapq.heappush(h, (0, k-1))
while len(h) > 0:
    top = heapq.heappop(h)
    for i in g[top[1]]:
        d = top[0] + i[1]
        if dist[i[0]] > d:
            dist[i[0]] = d
            heapq.heappush(h, (d, i[0]))

for i in range(q):
    print(dist[x[i]-1] + dist[y[i]-1])

Measured memory_bytes: 54164
#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()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
vector<int> node[105];

void init (void )
{
	rep (i, 105 ) node[i].clear();
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.patrol", "r", stdin );
	init ();
	int from, to;
	int max_node = 0;
	while (	scanf ("%d %d", &from, &to )!= EOF ){
		if (from == 0 && to == 0 ){
			bool ok = true;
			if ((node[1].size() % 2 == 0 ) || (node[2].size() % 2 == 0 ) ){
 				ok = false;
			}else{
				for (int i = 3; i <= max_node; i++ ){
					if (node[i].size() % 2 != 0 ){
						ok = false;
						break;
					} // end if
				} // end for
			} // end if

			if (ok ){
				cout << "OK" << endl;
			}else{
				cout << "NG" << endl;
			} // end if
			
			init ();
			max_node = 0;
		}else{
			node[from].push_back (to );
			node[to].push_back (from );	
			max_node = max (max_node, from );
			max_node = max (max_node, to );
		} // end if
	} // end loop
		
	return 0;
}

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

int main() {
  
  int x, y;
  cin >> x >> y;
  
  int a[] = {0,1,3,1,2,1,2,1,1,2,1,2,1};
  cout << ((a[x] == a[y]) ? "Yes" : "No") << endl;

}

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

//long long MOD = pow(10, 9) + 7;
#define MOD 1000000007

int main()
{
    int N;
    scanf("%d", &N);
    if (N == 1) {
        int A;
        scanf("%d", &A);
        if (A == 0) {
            printf("1\n");
        } else {
            printf("0\n");
        }
        return 0;
    }
    vector<int> A(N + 1), B(N / 2);
    for (int i = 0; i < B.size(); i++) {
        B[i] = 0;
    }
    for (int i = 1; i <= N; i++) {
        scanf("%d", &A[i]);
        if (N % 2 == 0 && A[i] % 2 == 0) {
            printf("0\n");
            return 0;
        }
        if (N % 2 == 1 && A[i] % 2 == 1) {
            printf("0\n");
            return 0;
        }
        B[A[i] / 2]++;
    }
    if (N % 2 == 1) {
        for (int i = 0; i < B.size(); i++) {
            if (i == 0 && B[i] != 1) {
                printf("0\n");
                return 0;
            }
            if (i != 0 && B[i] != 2) {
                printf("0\n");
                return 0;
            }
        }
    } else {
        for (int i = 0; i < B.size(); i++) {
            if (B[i] != 2) {
                printf("0\n");
                return 0;
            }
        }
    }
    long long ans = 1;
    for (int i = 0; i < N / 2; i++) {
        ans *= 2;
        ans %= MOD;
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 768
def write(t):
    for i in range(len(t)):
        print(t[i])
x, y = map(int, input().split())
data = []
ans = []
around = 0
data.append("."*(y+2))
for i in range(x):
    a = input()
    data.append("."+a+".")
    ans.append("")
data.append("."*(y+2))
for i in range(1, x+1):
    for j in range(1, y+1):
        if data[i + 1][j + 1] == "#": around+=1
        if data[i + 1][j]     == "#": around += 1
        if data[i + 1][j - 1] == "#": around += 1
        if data[i]    [j - 1] == "#": around += 1
        if data[i - 1][j - 1] == "#": around += 1
        if data[i - 1][j]     == "#": around += 1
        if data[i - 1][j + 1] == "#": around += 1
        if data[i]    [j + 1] == "#": around += 1
        if data[i][j] == "#":ans[i-1]+="#"
        else: ans[i-1]+=str(around)
        around = 0
write(ans)

Measured memory_bytes: 3064
import sys

input = sys.stdin.readline


def main():
    A = int(input())
    B = int(input())
    C = int(input())
    D = int(input())
    E = int(input())

    order = [A, B, C, D, E]

    ans = float("inf")
    for i in range(5):
        X = order[:]
        X[0], X[i] = X[i], X[0]
        X, Y = X[0], X[1:]

        total = 0
        for y in Y:
            q, r, = divmod(y, 10)
            t = 10 * q
            t += 10 if r > 0 else 0
            total += t
        total += X
        if total < ans:
            ans = total

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main() {
    int N, T;   cin >> N >> T;
    int *c, *t;
    c = new int[N];
    t = new int[N];
    int i;
    for (i = 0; i < N; i++)
        cin >> c[i] >> t[i];

    int ans = 9999;
    for (i = 0; i < N; i++) {
        if (t[i] <= T)
            ans = (c[i] < ans) ? c[i] : ans;
    }

    if (ans != 9999)
        cout << ans << endl;
    else
        cout << "TLE" << endl;
    return 0;
}

Measured memory_bytes: 256
# include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
# include <deque>
# include <functional>
# include <iomanip>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
# include <cassert>
# include <array>
# include <tuple>
# include <unordered_set>
# include <unordered_map>
using namespace std;


int n, x;
int a[200005];
bool used[200005];

int main(int argc, const char * argv[]) {
    #ifdef __APPLE__
        freopen("/Users/danya.smelskiy/Documents/Danya/Resources/input.txt","r",stdin);
        //freopen("/Users/danya.smelskiy/Documents/Danya/Danya/output.out", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> x;
    int m = n + n - 1;
    if (m == 3) {
        if (x == 2) {
            cout << "Yes\n1\n2\n3\n";
            return 0;
        } else {
            cout << "No\n";
            return 0;
        }
    }
    if (x == 1 || x == m) {
        cout << "No\n";
        return 0;
    }
    for (int i = -1; i <= 1; ++i) {
        a[n + i] = x + i;
        used[x + i] = true;
    }
    int last = 1;
    for (int i = 1; i <= m; ++i) if (i < n - 1 || i > n + 1) {
        while (used[last])
            ++last;
        used[last] = true;
        a[i] = last;
    }
    cout << "Yes\n";
    for (int i = 1; i <= m; ++i)
        cout << a[i] << '\n';
    return 0;
}



Measured memory_bytes: 2560
import kotlin.math.*

fun str() = readLine()!!
fun int() = str().toInt()
fun long() = str().toLong()

fun read(d: String = " ") = str().split(d)
fun <T> list(d: String = " ", f: String.() -> T) = read(d).map { f(it) }
fun list() = list { toInt() }

fun <T> MutableList<T>.removeLast() = this.removeAt(this.lastIndex)

const val mod = 1000000007L

fun main() {
    abc000X()
}

fun abc000X() {
    val n = int()
    val dp = arrayOf(longArrayOf(8, 1), longArrayOf(1, 0))
    for (i in 2..n) {
        dp[1][1] = (dp[1][1] * 10 + dp[1][0] + dp[0][1]) % mod
        dp[1][0] = (dp[1][0] * 9 + dp[0][0]) % mod
        dp[0][1] = (dp[0][1] * 9 + dp[0][0]) % mod
        dp[0][0] = dp[0][0] * 8 % mod
    }
    println(dp[1][1])
}


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

int a[100010][3];
int dp[100010][3];
int main(){
  int N; cin>>N;
  for(int i=0;i<N;i++)
    for(int j=0;j<3;j++)
      cin>>a[i][j];
  for(int i=0;i<3;i++)
    dp[0][i] = a[0][i];
  for(int i=1;i<N;i++){
    for(int j=0;j<3;j++){
      for(int k=0;k<3;k++){
        if(j == k) continue;
        if(dp[i][j] < dp[i-1][k] + a[i][j])
          dp[i][j] = dp[i-1][k] + a[i][j];
      }
    }
  }
  int ans = 0;
  for(int i=0;i<3;i++)
    ans = max(ans,dp[N-1][i]);
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int n, k, r, s, p;
    string t;
    cin >> n >> k >> r >> s >> p >> t;

    int total = 0;
    vector<bool> canP(n + k, true), canR(n + k, true), canS(n + k, true);

    for (int i = 0; i < n; i++) {
        //cout << i << ":";
        if (canP[i] && t[i] == 'r') {
            canP[i+k] = false;
            //cout << "p:" << p << endl;
            total += p;
        }
        if (canR[i] && t[i] == 's') {
            canR[i+k] = false;
            //cout << "r:" << r << endl;
            total += r;
        }
        if (canS[i] && t[i] == 'p') {
            canS[i+k] = false;
            //cout << "s:" << s << endl;
            total += s;
        }
    }
    cout << total << endl;
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s,t,u;
  int a,b;
  cin >> s >> t >> a >> b >> u;
  if (u==s){
    a-=1;
    cout << a << " " << b << endl;
  }
  else {
    b-=1;
    cout << a << " " << b << endl;
  }
}

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define putn(x,n) cout<< fixed<< setprecision(n)<< x << endl;
typedef long long ll;

int counter(string s,int split){
	bool alp[26];
	int cnt=0;

	rep(i,0,26)alp[i] = false;
	rep(i,0,split){
		alp[s[i]-'a']=true;
	}
	rep(i,split,s.length()){
		if(alp[s[i]-'a']){
			alp[s[i]-'a']=false;
			cnt++;
		}
	}
	return cnt;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,cnt = 0;
	string s;
	cin >>n;
	cin>>s;
	rep(i,1,n){
		cnt = max(counter(s,i),cnt);
	}
	cout << cnt<<endl;

	return 0;
}


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

int main(){
  int x=0;
  int max=x;
  int n;
  cin >> n;
  char* c =new char[n];
  for(int i=0;i<n;i++)cin >> c;
  
  for(int i=0;i<n;i++){
    if(c[i]=='I')x++;
    if(c[i]=='D')x--;
    if(max<x)max=x;
  }
  
  cout << max;
  delete[] c;
  return 0;
}

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

int main(void) {
  char s[1001];
  char t[1001];
  scanf("%s", s);
  scanf("%s", t);
  int i, j;
  int min = strlen(t);
  int lim = strlen(s) - strlen(t) + 1;
  for(i=0; i<lim; i++) {
    // 一致しなかった文字の数
    int not_match = 0;
    for(j=0; j<strlen(t); j++) {
      not_match += (s[i+j] != t[j]);
    }
    //printf("i=%d, not_match=%d\n", i, not_match);
    if(not_match < min) {
      min = not_match;
    }
  }
  printf("%d\n", min);
  return 0;
}


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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef unsigned long long ll;

int d = 365;
int types = 26;

vector<int>c(types, 0);
vector<vector<int>>s(d, vector<int>(types, 0));

vector<int>last(types, 0);
vector<int>ans(d, 0);

vector<int> compute_score(vector<int> t){
    REP(i, types) last[i] = 0;

    vector<int>satisByDay(d, 0);
    int satis = 0;
    REP(i, d){ 
        int today = t[i]-1;
        satis += s[i][today];
        last[today] = i+1;
        REP(j, types){
            satis = satis - c[j]*(i + 1 - last[j]);
        }
        // cout << satis << endl;
        satisByDay[i] = satis;
    }
    return satisByDay;
}

vector<int> greedy_compute_score(){

    vector<int>satisByDay(d, 0);
    int satis = 0;

    REP(i, types) last[i] = 0;

    REP(i, d){ 
        int maxSatis = -INF;
        int maxj = 0;
        REP(j, types){
            int today = j;
            int curr_satis = s[i][today];
            
            REP(k, types){
                if(j!=k)curr_satis -= c[k]*(i + 1 - last[k]);
            }
            if (curr_satis > maxSatis) {
                maxSatis = curr_satis;
                satis += curr_satis;
                maxj = j;
                last[today] = i+1;
            }
        }
        // cout << satis << endl;
        satisByDay[i] = satis;
        ans[i] = maxj;
    }
    return satisByDay;
}

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

    bool cp = false;

    REP(i, types) cin >> c[i];
    REP(i, d) REP(j, types){
        cin >> s[i][j];
    } 
    vector<int>t(d, 0);
    REP(i, d){
        t[i] = rand() % 26+1;
    }

    vector<int> satis = greedy_compute_score();
    // REP(i, d){
    //     cout << satis[i] << endl;
    // }

    // if (cp){
    //     int m = 5;
    //     cin >> m;
    //     vector<int>da(m, 0);
    //     vector<int>q(m, 0);

    //     REP(i, m){
    //         cin >>  da[i] >> q[i];
    //     }

    //     int oldSatis = satis[d-1];

    //     REP(i, m){
    //         int today = da[i]-1;
    //         int old = t[today];
    //         t[today] = q[i];


    //         int newSatis = compute_score(t)[d-1];

    //         // if (newSatis > oldSatis) oldSatis = newSatis;
    //         // else t[today] = old;

    //         cout << newSatis << endl;
    //     }
    // }

    if(!cp){
        REP(i, d) cout << ans[i]+1 << endl;
        // cout << satis[d-1] << endl;
        // int oldSatis = satis[d-1];

        // REP(i, 10000){
        //     int day = i%365;
        //     if (day==365) day = 364;
        //     int old = t[day];
        //     t[day] = t[day+1];

        //     // int newSatis = newSatis - s[day][old] + s[day][t[day]];
        //     // newSatis += last[day]*c[day] - last[today+1]*c[t[day+1]];


        //     int newSatis = compute_score(t)[d-1];

        //     if (newSatis > oldSatis) oldSatis = newSatis;
        //     else t[day] = old;

        //     cout << oldSatis << endl;
        // }
    }   

}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define repeat_from_reverse(i, m, n) for( int i = (n) - 1; (i) >= (m); --(i) )
#define el cout<<endl
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t t=0; t<v.size(); ++t){cout << " " << #v << "[" << t << "]=" << v[t];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n; cin >> n;
    vector<int> a(n), s(n);
    repeat (i, n) cin >> a[i];
    s = a;
    sort(s.begin(), s.end());
    int x = n / 2 - 1;
    int y = n / 2;
    
    repeat (i, n) {
        int d = distance(s.begin(), lower_bound(s.begin(), s.end(), a[i]));
        if (d <= x) cout << s[y] << endl;
        else cout << s[x] << endl;
    }
    return 0;
}

Measured memory_bytes: 3712
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a)
	fmt.Scan(&b)

	if a >= 13 {
		fmt.Println(b)
	} else if 6 <= a && a <= 12 {
		fmt.Println(b / 2)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 512
import math
n, h = map(int, input().split())
shake =[]
throw = []
for _ in range(n):
    a, b = map(int, input().split())
    shake.append(a)
    throw.append(b)

max_shk = max(shake)
sort_thr = sorted(throw, reverse = True)


count = 0
for i in sort_thr:
    if max_shk < i:
        h = h - i
        count += 1
        if h <= 0:
            break
if h > 0:
    count += math.ceil(h / max_shk)
print(count)

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

int main() {
	int N, C;
	cin >> N >> C;
	int sum = 0;
	for (int i = 0; i < C; ++i) {
		int p;
		cin >> p;
		sum += p;
	}
	if (sum % (N + 1)) cout << sum / (N + 1) + 1;
	else cout << sum / (N + 1);
	cout << endl;
}


Measured memory_bytes: 3108
fun main(args: Array<String>) {
    Program().solve()
}

class Program {
    fun solve() {
        val sc = MyScanner()
        val n = sc.nextInt()
        val a = sc.intList().toIntArray()
        val b = sc.intList()
        var ans = 0L
        for (i in n - 1 downTo 0) {
            var t = b[i]
            val tt = Math.min(t, a[i + 1])
            ans += tt
            t -= tt
            val ttt = Math.min(t, a[i])
            // println("${tt} ${ttt}")
            a[i] -= ttt
            ans += ttt
        }

        println(ans)
    }
}


class MyScanner() {
    private var index = 0
    private var line = listOf<String>()

    fun next(): String {
        while (line.size <= index) {
            line = readLine()!!.split(' ')
            index = 0
        }
        return line[index++]
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextDouble() = next().toDouble()
    fun nextCharArray() = next().toCharArray()
    fun nextChar() = next()[0]

    fun strList(): List<String> {
        index = line.size
        return readLine()!!.split(' ')
    }

    fun intList() = strList().map { it.toInt() }
    fun longList() = strList().map { it.toLong() }
    fun doubleList() = strList().map { it.toDouble() }
}

Measured memory_bytes: 73796
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int r;
    cin >> r;
    cout << (r * r) << endl;
}


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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
const int N=1e5 + 5;

string s;

string substr(int i, int j)
{
	string str ="";
	int k;
	for(k=i;k<=j;k++)
	{
		str += s[k];
	}
	return str;
}

bool ok(string x){
    map<char,int> cnt;
    for(int i=0;i<x.size();i++)
        cnt[x[i] - 'a']++;
    for(int i=0;i<x.size();i++){
        if(cnt[x[i] - 'a'] > (ll)x.size() / 2)
            return 1;
    }
    return 0;
}
 

int32_t main()
{
	IOS;
	cin >> s;
	int n=s.size();
	int cur=2;
	int i=0;
	int j=0;
	int k=0;
	for(cur=2;cur<=min(n,5ll);cur++)
	{
		for(j=cur-1;j<n;j++)
		{
			string str= substr(j-cur+1,j);
			if(ok(str)==1)
			{
				cout << j-cur+2 << " " << j+1 << endl;
				return 0;	
			}	
		}	
	}
	cout << "-1 -1 " << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl "\n"
#define mod 1000000007
using namespace std;

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 

ll nCrModPFermat(ll n, ll r, ll p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    ll fac[n+1]; 
    fac[0] = 1; 
    for (ll i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 

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

    ll x,y;
    cin >> x >> y;
    if ((x+y)%3==0)
    {
        ll n=((2*y)-x)/3;
        ll m=((2*x)-y)/3;

        if (n<0 || m<0)
        {
            cout << "0" << endl;
        }
        else
        {
            // calc and prll (n+m)Cn
            cout << nCrModPFermat(n+m,n,mod) << endl;

        }
    }
    else
    {
        cout << "0" << endl;
    }

    return 0;
}

Measured memory_bytes: 5632
#include <stdio.h>
 
int n, m;
char change[112345678][2], data[112345678];
int main(void) {
    while (true) {
        scanf("%d", &n);
        if (n == 0) { break; }
        for (int i = 0; i < n; ++i) { scanf("%s%s", &change[i][0], &change[i][1]); }
        scanf("%d", &m);
        for (int i = 0; i < m; ++i) { scanf("%s", &data[i]); }
 
        for (int i = 0; i < m; ++i) {
            for (int j = 0; j < n; ++j) {
                if (data[i] == change[j][0]) {
                    data[i] = change[j][1];
                    break;
                }
            }
        }
 
        printf("%s\n", data);
    }
    return 0;
}

Measured memory_bytes: 2600
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(S: str, T: str):
    table = {}
    for i in range(len(T)):
        if table.get(S[i]) == None:
            table[S[i]] = T[i]
        else:
            if table[S[i]] == T[i]:
                continue
            else:
                # 同じ文字を違う文字に変換しようとしたらアウト
                print(NO)
                return

    value_list = []
    for value in table.values():
        value_list.append(value)
        
    # 違う文字を同じ文字に変換しようとしたらアウト
    if len(set(value_list)) == len(table):
        print(YES)
    else:
        print(NO)

    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    T = next(tokens)  # type: str
    solve(S, T)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3828
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <tuple>
#include <list>
#include <deque>
#include <stack>
#include <complex>
#include <functional>
#include <regex>
#include <map>

using namespace std;

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

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

using ll = long long;
using ld = long double;
using ull = unsigned long long;

const int PI = acos(-1);
const int INF = numeric_limits<int>::infinity() / 2;
const ll INFLL = numeric_limits<ll>::infinity() / 2;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b; cin >> a >> b;
  if (b >= a) cout << a << endl;
  else cout << a - 1 << endl;
  return 0;
}


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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

int main(int argc, char *argv[]) {

  i64 N, M, S;
  i64 i, j;
  cin >> N >> M >> S;
  vi A(M), B(M);
  vector<vector<pi> > edges(N);
  REP(0, M, i) {
    i64 U, V;
    cin >> U >> V >> A[i] >> B[i];
    U--; V--;
    edges[U].pb({V, i});
    edges[V].pb({U, i});
  }
  vi C(N), D(N);
  REP(0, N, i) {
    cin >> C[i] >> D[i];
  }

  i64 Smax = accumulate(all(A), 0LL) * 2;
  i64 SN = Smax + 1;

  vvi T(N, vi(SN, -1)); // node, silver -> time
  S = min(S, Smax);
  T[0][S] = 0;
  
  set<pair<i64, pair<i64, i64> > > q; // time, node, silver
  q.insert(make_pair(0, make_pair(0, S)));

  auto try_update = [&](i64 t_new, i64 n_new, i64 s_new) {
    i64 t_old = T[n_new][s_new];
    //printf("try update (%lld, %lld) -> %lld\n", n_new, s_new, t_new);
    if(t_old == -1 || t_old > t_new) {
      if(t_old != -1) {
	pair<i64, pair<i64, i64>> p_old(make_pair(t_old, make_pair(n_new, s_new)));
	assert(q.find(p_old) != q.end());
	q.erase(q.find(p_old));
      }
      pair<i64, pair<i64, i64>> p_new(make_pair(t_new, make_pair(n_new, s_new)));
      q.insert(p_new);
      T[n_new][s_new] = t_new;
    }
  };
  while(!q.empty()) {
    auto p = *q.begin();
    i64 t_cur = p.first;
    i64 n_cur = p.second.first;
    i64 s_cur = p.second.second;
    
    q.erase(q.begin());
    // ride
    for(auto e: edges[n_cur]) {
      const i64 &n_new = e.first;
      const i64 &eid = e.second;

      if(A[eid] <= s_cur) { // afford to ride
	i64 s_new = s_cur - A[eid];
	i64 t_new = t_cur + B[eid];
	try_update(t_new, n_new, s_new);
      }
    }
    // exchange
    if(s_cur + C[n_cur] <= Smax) {
      i64 s_new = s_cur + C[n_cur];
      i64 t_new = t_cur + D[n_cur];
      try_update(t_new, n_cur, s_new);
    }
  }

  REP(1, N, i) {
    i64 ans = -1;
    for(auto t: T[i]) {
      if(t < 0)
	continue;
      if(ans < 0)
	ans = t;
      else
	ans = min(ans, t);
    }
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 12456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> vl;
typedef vector<vector<ll>> vll;
typedef vector<bool> vb;
typedef set<int> si; 
typedef queue<int> qi;
typedef stack<int> sti;
typedef priority_queue<int> pqi;
#define fori(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
//#define __builtin_popcountll bitCountLL
//#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
mt19937 mt_rand(chrono::high_resolution_clock::now().time_since_epoch().count());
//std::uniform_int_distribution<long long> rg(1,1e18);
#define maxn 100005
#define Mod 1000000007
const int INF = 2e9;
const ll ML = 4e18;
    
void solve() {
    string s;
    cin >> s;
    int n = s.size();
    int sum = 0;
    fori(i,0,n)  sum += s[i] - '0';
    if(sum % 9) cout << "No\n";
    else cout << "Yes\n"; 
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
//	freopen("D:\\data_in.txt", "r", stdin);
   
    solve();
   
    /*
    clock_t start,finish;
    start = clock();
    
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


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

using namespace std;

int main()
{
    int arr[5];
    int k,i;
    for(i=0;i<5;i++)
    {
        cin>>arr[i];
    }
    cin>>k;
    sort(arr,arr+5);
    if(arr[4]-arr[0]<=k)
    {
        cout<<"Yay!";
    }
    else
        cout<<":(";
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
#define ff first
#define ss second
#define pb push_back
#define N 100005

ll inv[N], fac[N], finv[N];

void make()
{
	fac[0] = fac[1] = 1;
	inv[1] = 1;
	finv[1] = finv[0] = 1;
	for(int i = 2; i < N; ++i)
	{
		fac[i] = i * fac[i - 1] % MOD;
		inv[i] = MOD - MOD/i * inv[MOD % i] % MOD;
		finv[i] = inv[i] * finv[i - 1] % MOD;
	}
}

ll C(ll n, ll k)
{
	if(n < k || n < 0) return 0;
	return fac[n] * finv[n - k] % MOD* finv[k] % MOD;
}

int n, m;
vector<int> vi[N + 1];
int g[N + 1] = {};
void solve(int k)
{
	g[k] = 1;
	for(auto e : vi[k])
		if(!g[e])
			solve(e);
}

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

	cin >> n >> m;
	int x, y, z;
	pair<int, int> f[n + 1];

	for(int i = 1; i <= n; ++i)
	{
		f[i].ff = i;
	}

	for (int i = 0; i < m; ++i) 
	{
		cin >> x >> y >> z;
		vi[x].pb(y);
		vi[y].pb(x);
		f[x].ss++;
		f[y].ss++;
	}

	sort(f + 1, f + n + 1, [](auto a, auto b){
		return a.ss > b.ss;
	});
	
	int k = 0,no = 0;
	int in = 1, max = 0;

	for (int i = 1; i <= n; ++i)
	{
		if(!g[f[i].ff])
			solve(f[i].ff), no++;
	}
	cout << no << "\n";
	return 0;
}

Measured memory_bytes: 11392
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n;
  cin >> n;
  ll ans = 0;
  rep(i, 1, n + 1) {
    if (i % 3 != 0 && i % 5 != 0)
      ans += i;
  }
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

int main(){
  ll A,B,N;
  cin >> N >> A >> B;
  ll sum = 0;
  ll count = 0;
  count = (N + (A + B - 1)) / (A + B);
  sum = count * (A + B);
  if(N >= sum - B)
    cout << count * A << endl;
  else cout << A * count - (sum - N - B) << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> h(N);
  for (int i = 0; i < N; i++) {
    cin >> h.at(i);
  }
  
  int M = 0;
  
  for (int i = 0; i < N; i++) {
    if ( h.at(i) >= K ) {
       M = M + 1;
    }
  }
  
  cout << M << endl;
  
}


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

int main() {
  int n,alice=0,bob=0;
  cin>>n;
vector<int>cards(n);
  for(int i=0;i<n;i++){
    cin>>cards.at(i);
  }
sort(cards.begin(),cards.end());
reverse(cards.begin(),cards.end());
for(int i=0;i<n;i++){
if(i%2){
bob+=cards.at(i);
}else{
alice+=cards.at(i);
}
}
  cout<<alice-bob<<endl;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int m,n;
char a[100][100];
int s(int x,int y)
{
    int num=0;
    int i,j;
    for( i=x-1;i<=x+1;i++)
    {
        for( j=y-1;j<=y+1;j++)
        {
            if(i>=0&&i<=m-1&&j>=0&&j<=n-1&&a[i][j]=='#')
                num++;
        }
    }
    return num;
}
int main()
{
    int i,j,k;
    scanf("%d %d",&m,&n);
    for(i=0;i<m;i++)
    {
        scanf("%s",a[i]);
    }
    for( i=0;i<m;i++)
    {
        for( j=0;j<n;j++)
        {
            if(a[i][j]=='.')
            {
                k=s(i,j);
                a[i][j]=k+'0';
            }
        }
    }
    for(i=0;i<m;i++)
    {
        printf("%s",a[i]);

    printf("\n");}
}

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

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

    int N; cin >> N;
    int a[N];
    for (int i = 1; i <= N; i++) cin >> a[i];
    int square = 0;
    for (int i = 1; i <= N; i++) {
        if ((i%2 == 1) && (a[i]%2 == 1)) square++;
    }
    cout << square << "\n";
    return 0;
}

Measured memory_bytes: 3604
import heapq

n = int(input())
d_list = list(map(int, input().split()))

heapq.heapify(d_list)

target_idx = n // 2 - 1
for _ in range(0, target_idx):
    heapq.heappop(d_list)

base_value1 = heapq.heappop(d_list)
base_value2 = heapq.heappop(d_list)

print(base_value2 - base_value1)

Measured memory_bytes: 14428
main() {
	long a, b, c, d;
	scanf("%ld%ld%ld%ld", &a, &b, &c, &d);
	long ans = -1e18;
	if (ans < a * c) ans = a * c;
	if (ans < a * d) ans = a * d;
	if (ans < b * c) ans = b * c;
	if (ans < b * d) ans = b * d;
	printf("%ld", ans);
}

Measured memory_bytes: 1724
s = str(input())
t = str(input())

if s[0] == t[0]:
    a = 1
else:
    a = 0

if s[1] == t[1]:
    b = 1
else:
    b = 0

if s[2] == t[2]:
    c = 1
else:
    c = 0

print(a + b + c)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
#include<numeric>
using namespace std;

int INF = 1e9 + 7;

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

int main() {
	int n;
	cin >> n;
	string s;
	ll m = 0, a = 0, r = 0, c = 0, h = 0;
	for (int i = 1; i <= n; i++) {
		cin >> s;
		if (s[0] == 'M') m++;
		if (s[0] == 'A') a++;
		if (s[0] == 'R') r++;
		if (s[0] == 'C') c++;
		if (s[0] == 'H') h++;
	}
	cout << ll(m*a*r + m*a*c + m*a*h + m*r*c + m*r*h + m*c*h + a*r*c + a*r*h + a*c*h + r*c*h) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <map>
#include <queue>
#include <stack>
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
using namespace std;

int main(){
    int n;
    string s, t;
    cin >> n >> s >> t;
    for(int i = 0; i < n; ++i){
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}


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

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define ll      long long

static const int MOD = 1000000007;

long long inv(long long a) { //フェルマーの小定理と繰り返し2乗法による逆元
        long long res = 1;
        long long n = MOD - 2;
        while (n > 0) {
                if (n & 1) res = res * a % MOD;
                a = a * a % MOD;
                n >>= 1;
        }
        return res;
}

long long fact[4040404];
long long invfact[4040404];

void init() {
        fact[0] = 1;
        for (int i = 1; i < 4040404; i ++) fact[i] = (fact[i - 1] * i) % MOD;
        invfact[4040403] = inv(fact[4040403]);
        for (int i = 4040402; i >= 0; i --) invfact[i] = (invfact[i + 1] * (i + 1)) % MOD;
}

long long dp[2020][2020];

void solve() {
        init();
        int n, k;
        cin >> n >> k;
        if (k == 1) {
                cout << 1 << endl;
                return;
        }
        memset(dp, 0, sizeof dp);
        dp[0][1] = 1LL;
        for (int i = 0; i <= n; i ++) {
                for (int j = i; j <= n; j ++) {
                        if (i != 0) dp[i][j] = dp[i - 1][j]; 
                        if (i != j) {
                                //dp[i][j] = (dp[i][j] + dp[i][j - 1] * nCr(i + j * (k - 1) - 1, k - 2) % MOD) % MOD;
                                long long ncr = fact[i + j * (k - 1) - 1];
                                ncr = ncr * invfact[i + j * (k - 1) - 1 - (k - 2)] % MOD;
                                ncr = ncr * invfact[k - 2] % MOD;
                                dp[i][j] = (dp[i][j] + dp[i][j - 1] * ncr % MOD) % MOD;
                        }
                        //cerr << "dp[" << i << "][" << j << "] = " << dp[i][j] << endl;
                }
        }
        cout << dp[n][n] * fact[n] % MOD << endl;
        return;
}

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

        //int T;
        //freopen("a.in", "r", stdin);
        //cin >> T;
        //while (T --) solve();
        
        solve();
        return 0;
}



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

//#include "rubo.h"
//#define mp make_pair
//#define pb push_back
#define in int
#define ll long long
#define vc vector
#define SQ(j) (j)*(j)
//#define x first
//#define y second

//#define ld long double
#define dbl  long double
#define pll pair<long long,long long>
#define pii pair<int,int>
#define all(j) j.begin(), j.end()
#define loop(xxx, yyy) for(int xxx = 0; xxx < yyy; xxx++)
//#define printf(fmt, ...) (0)
//#define HOME
//#define y0 ngacaleiebinvoaeu
//#define y1 gnarpipipaigare
#define j1 adsfndnasfafoasp

#define db(x) cout << #x << " = " << x << endl
#define dbCont(x) cout << #x << ": "; for(auto shun: x) cout << shun << ' '; cout << endl;

typedef long double ld;

using namespace std;


const int K = 100*1000+123;



int dp[K];
vector<int> a;
int main() {

    int n,k;
    cin >> n >> k;
    loop(i,n){
        int e;
        cin >> e;
        a.push_back(e);
    }

    dp[0] = 0;
    for(int i = 1; i <= k; i++){

        bool winning = false;
        for(int take : a){
            int left = i - take;
            if(left < 0) continue;

            if(dp[left] == 0) winning = true;
        }

        if(winning) dp[i] = 1;
        else dp[i] = 0;
    }

    cout << (dp[k] ? "First" : "Second") << endl;


    return 0;
}


Measured memory_bytes: 640
n = int(input())
s = str(input())
answer = n
dpa = [-1]*(n+1)
dpa[0] = 0
dpb = [-1]*(n+1)
dpb[0] = s.count('E')

for i in range(1,n+1):
	if s[i-1] == 'W':
		dpa[i] = dpa[i-1] + 1
		dpb[i] = dpb[i-1]	
	else:
		dpa[i] = dpa[i-1]
		dpb[i] = dpb[i-1] - 1

for i in range(n+1):
	answer = min(answer, dpa[i]+dpb[i])
	
print(answer)
	

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

using namespace std;

int dp[3010][3010];

int main(void) {
  int n, t, s;
  cin >> n >> t >> s;

  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }

  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= t; j++) {
      if (j < b[i]) {
        dp[i + 1][j] = dp[i][j];
      } else if (j - b[i] < s && s < j) {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - 1]);
      } else {
        dp[i + 1][j] = max(dp[i][j], max(dp[i + 1][j - 1], dp[i][j - b[i]] + a[i]));
      }
    }
  }

  cout << dp[n][t] << endl;

  return 0;
}


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

typedef long long ll;

vector<ll> b_vec(51, 1);
vector<ll> p_vec(51, 1);

ll dfs(int n, ll x){
  if (n == 0)
    if (x <= 0) return 0;
    else return 1;
  else if (x <= 1 + b_vec.at(n-1)) return dfs(n-1, x-1);
  else return p_vec.at(n-1) + 1 + dfs(n-1, x-2-b_vec.at(n-1));
}
 
int main() {
  int N;
  ll X;
  cin >> N >> X;
  for (int i = 1; i < N+1; i++) {
    b_vec.at(i) = b_vec.at(i-1) * 2 + 3;
    p_vec.at(i) = p_vec.at(i-1) * 2 + 1;
  }

  cout << dfs(N, X) << endl;
}

Measured memory_bytes: 256
s = gets.strip
words = ["dream","dreamer","erase","eraser"]

until s.empty? do
  reduced = false
  words.map do |w|

    if s[-w.size,w.size] == w
      s = s[0..-w.size - 1]
      reduced = true
      break
    end
  end

  unless reduced
    puts "NO"
    exit
  end
end

puts "YES"

Measured memory_bytes: 56304
S = input()
mod = 2019

array = []
for i in range(len(S)):
    x = (int(S[len(S)-1-i])*pow(10,i,mod))%mod
    array.append(x)
array2 = [0]
y = 0
for i in range(len(S)):
    y = (y+array[i])%mod
    array2.append(y)
array3 = [0] * 2019
ans = 0
for i in range(len(array2)):
    z = array2[i]
    ans += array3[z]
    array3[z] += 1
print(ans)
#3*673


Measured memory_bytes: 98684
//A
#include <iostream>
using namespace std;
int N,i,j;
bool flag = false;

bool check4(int N){
  for(i=0;4*i<N;i++){
    N-=4*i;
    if(N%4 ==0 || N%7 ==0 || N%11 == 0 ){
      cout << "Yes"<<endl;
      return true;
    }
    if(N<0){
      return false;
    }
  }
  return false;
}

bool check7(int N){
  for(i=0;7*i<N;i++){
    N-=7*i;
    if(N%4 ==0 || N%7 ==0 || N%11 == 0 ){
      cout << "Yes"<<endl;
      return true;
    }
    if(N<0){
      return false;
    }
  }
  return false;
}

int main(){
  cin >> N;
  
  if(N%4 ==0 || N%7 ==0 || N%11 == 0 ){
    cout << "Yes"<<endl;
    return 0;
  } else if(N<4){
    cout << "No"<<endl;
    return 0;
  }
  flag =check4(N);
  if(flag==false){
    flag =check7(N);
  }
  if(flag==false){
    cout << "No"<<endl;
    return 0;
  }
  return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,d,e,count=0;
    cin>>a>>b>>c;
    if(b==0) cout<<'0';
    else if(c==0) cout<<a;
    else{
            d=a/(b+c);
            e=a%(b+c);
            if(e>b) cout<<d*b+b;
            else cout<<d*b+e;
    }

}


Measured memory_bytes: 256