akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main() {
	int n, a = 0, e = 0, ans = 1;
	cin >> n;
	vector<int>suu;
	for (int i = 0; i < n; ++i) {
		int tmp;
		cin >> tmp;
		suu.push_back(tmp);
	}
	while (a < n) {
		e = 0;
		if (a >= n - 1) {
			break;
		}
		if (suu[a] != suu[a + 1]) {
			if (min(suu[a], suu[a + 1]) == suu[a]) {
				while (e < 1) {
					++a;
					if (a >= n - 1) {
						break;
					}
					if (suu[a] != min(suu[a], suu[a + 1])) {
						++e;
						++ans;
					}
				}
			}
			else {
				while (e < 1) {
					++a;
					if (a >= n - 1) {
						break;
					}
					if (suu[a] != max(suu[a], suu[a + 1])) {
						++e;
						++ans;
					}
				}
			}
		}
		++a;
	}
	cout << ans << endl;
}

Measured memory_bytes: 892
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var N = cin.ReadInt;
            var L = cin.ReadInt;
            var strList = cin.ReadStrArray(N);
            
            var ans = "";
            
            Array.Sort(strList);
            
            for (int i =0; i<strList.Length; i++){
                ans = ans + strList[i];
                }
            WriteLine(ans);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
    
    public class Function
    {
        public int findSumOfDigits(int n) {
            int sum = 0;
            while (n > 0) { // n が 0 になるまで
            sum += n % 10;
            n /= 10;
                
            }
            return sum;
            
        }
    }
}

Measured memory_bytes: 13532
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}



int main(){
    string s;cin>>s;
    LL q; cin>>q;
    VI query(q);
    VI T(q);
    VI F(q);
    vector<string> C(q);
    bool flip=false;
    REP(i,q){
        cin>>T[i];
        if(T[i]==2){
            cin>>F[i]>>C[i];
        }
    }
    REP(i, q){
        if(T[i]==1){
            flip=!flip;
        }
        else{
            if(flip){
                if(F[i]==1)s.insert(s.length(),C[i]);
                else s.insert(0,C[i]);
            }
            else{
                if(F[i]==1)s.insert(0,C[i]);
                else s.insert(s.length(),C[i]);
            }
        }
        // debug(s)debug(flip)
    }
    if(flip){reverse(ALL(s));cout<<s<<endl;}
    else cout<<s<<endl;
    return 0;
}


Measured memory_bytes: 14976
#include <stdio.h>
#define N 1000
#define inf 1000000

int n,M[N][N];
int d[N];
int Q[2*N], head=0, tail=0;

void enQueue(int);
int deQueue(void);
void BFS(int);

int main(){
	int i, j, u, k, v;
	
	for(i = 1; i <= n; i++){
		for(j = 1; j <= n; j++){
			M[i][j] = 0;
		}
	}
	
	scanf("%d", &n);
	
	for(i = 1; i <= n; i++){
		scanf("%d%d", &u, &k);
		for(j = 0; j < k; j++){
			scanf("%d", &v);
			M[u][v] = 1;
		}
	}
	
	BFS(1);
	
	for(i = 1; i <= n; i++){
		if(d[i] == inf){
			d[i] = -1;
		}
		printf("%d %d\n", i, d[i]);
	}
	
	return 0;
}

void enQueue(int x){
	Q[tail++] = x;
}

int deQueue(){
	return Q[head++];
}

void BFS(int y){
	int i, j, k;
	enQueue(y);
	for(i = 1; i <= n; i++){
		d[i] = inf;
		d[y] = 0;
	}
	while(head != tail){
		j = deQueue();
		for(k = 1; k <= n; k++){
			if(M[j][k] == 0) continue;
			if(d[k] != inf) continue;
			d[k] = d[j] + 1;
			enQueue(k);
		}
	}
}

Measured memory_bytes: 988
import sys
n = int(input())
w = []
for i in range(n):
    w.append(input())
for j in range(n):
    if w.count(w[j]) != 1:
        print("No")
        sys.exit()
for k in range(n-1):
    x = list(w[k])
    y = list(w[k+1])
    if x[len(x)-1] != y[0]:
        print("No")
        sys.exit()
print("Yes")

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

int main() {
	int N; cin >> N;
	vector<vector<int>>F(N, vector<int>(10));
	vector<vector<int>>P(N, vector<int>(11));
	for (int i = 0; i < N; i++)for (int j = 0; j < 10; j++)cin >> F[i][j];
	for (int i = 0; i < N; i++)for (int j = 0; j < 11; j++)cin >> P[i][j];

	int ans = INT32_MIN;
	for (int i = 1; i < pow(2, 10); i++) {
		vector<char>used(10);
		for (int j = 0; j < 10; j++)used[j] = (i>>j) & 1;

		vector<int>cnt(N);
		for (int j = 0; j < 10; j++) {
			for (int k = 0; k < N; k++) {
				if (used[j] && F[k][j])cnt[k]++;
			}
		}

		int sum = 0;
		for (int j = 0; j < N; j++)sum += P[j][cnt[j]];
		ans = max(ans , sum);
	}

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

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

int main()
{
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;

    vector<bool> f;
    for (int i = 0; i < s1.size(); i++) {
        if (s1[i] == s2[i]) {
            f.push_back(true);
        }
        else {
            f.push_back(false);
            i++;
        }
    }

    long long ans = f[0] ? 3 : 6;
    for (int i = 1; i < f.size(); i++) {
        if (f[i]) {
            if (f[i - 1]) {
                ans *= 2;
            }
        }
        else {
            if (f[i - 1]) {
                ans *= 2;
            }
            else {
                ans *= 3;}
        }
        ans %= 1000000007;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())

s = '1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51'
ee = s.split(', ')
print(ee[n-1])

Measured memory_bytes: 2940
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

long long int INF = 1e18;
using namespace std;

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

int main(){
	
	int n;
	cin >> n;
	
	int A[2000];
	for(int i = 0; i < n; i++){
		cin >> A[i];
	}
	
	int ans = 0;
	
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n - 1; j++){
			if(A[j] > A[j + 1]){
				ans++;
				swap(A[j], A[j + 1]);
			}
		}
	}
	
	sort(A, A + n);
	for(int i = 0; i < n - 1; i++){
		cout << A[i] << " ";
	}
	cout << A[n - 1] << endl;
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long r,d,x2000;
  cin >> r >> d >> x2000;
  for(int i=0;i<10;i++){
    cout << r*x2000-d << endl;
    x2000=r*x2000-d;
  }
  return 0;
}

Measured memory_bytes: 256
#87b
a=int(input())
b=int(input())
c=int(input())
x=int(input())
cnt=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            ans=500*i + 100*j + 50*k
            if ans==x:
                cnt+=1
print(cnt)

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

const int MAXN = 2e3 + 5;
const int MOD = 998244353;

int N, K;
int choose[2 * MAXN][2 * MAXN];
int dp[MAXN][MAXN];

void load() {
	scanf("%d%d", &K, &N);
}

inline int add(int x, int y) {
	x += y;
	if (x >= MOD)
		x -= MOD;
	return x;
}

inline int mul(int x, int y) {
	return (long long)x * y % MOD;
}

int calc(int x) {
	int lo = max(x - K, 1);
	int hi = min(x - 1, K);
	int len = hi - lo + 1;
	int pairs = len / 2;
	
	int res = 0;
	for (int i = 0; i <= min(pairs, N); i++)
		res = add(res, mul(dp[pairs][i], choose[N + K - len - 1][N - i]));
	
	if (!(x % 2))
		for (int i = 0; i <= min(pairs, N - 1); i++)
			res = add(res, mul(dp[pairs][i], choose[N + K - len - 2][N - 1 - i]));
			
	return res;
}

int solve() {
	dp[0][0] = 1;
	for (int i = 1; i <= K; i++) {
		dp[i][0] = 1;
		for (int j = 0; j <= i; j++)
			dp[i][j] = add(dp[i - 1][j], mul(dp[i - 1][j - 1], 2));
	}
	
	choose[0][0] = 1;
	for (int i = 1; i <= N + K; i++) {
		choose[i][0] = 1;
		for (int j = 1; j <= i; j++)
			choose[i][j] = add(choose[i - 1][j], choose[i - 1][j - 1]);
	}
	
	for (int i = 2; i <= 2 * K; i++)
		printf("%d\n", calc(i));
}

int main() {
	load();
	solve();
	return 0;
}

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

namespace A
{
    class Program
    {
        public static void Main(string[] args)
        {
            var n = ReadLineIntSpilit();

            Console.WriteLine((n[1]-n[0] == n[2]-n[1]) ? "YES" : "NO");
            ReadLine();
        }

        /// <summary>
        /// コンビネーション
        /// </summary>
        /// <param name="n"></param>
        /// <param name="m"></param>
        /// <returns></returns>
        static int nCm(int n, int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * nCm(n - 1, m - 1) / m;
        }

        /// <summary>
        /// stringを一文字ずつintにキャストして配列に変換します。
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static int[] StringCharArrayIntArray(string str)
        {
            List<int> b = new List<int>();
            for (int i = 0; i < str.Length; i++) {
                b.Add( int.Parse(str[i].ToString()));
            }
            return b.ToArray();
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static int ReadLineInt()
        {
            return int.Parse(Console.ReadLine());
        }

        public static string[] ReadLineStringSplit(char a = ' ')
        {
            return ReadLine().Split(a).ToArray();
        }

        public static int[] ReadLineIntSpilit(char a = ' ')
        {
            return ReadLine().Split(a).Select(x => int.Parse(x)).ToArray();
        }

        static string[] GetAplhaLowerArray() => new string[]{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};
        static string[] GetAplhaUpperArray() => new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
    }
}

Measured memory_bytes: 11348
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    p = list(map(float, input().split()))
    
    dp = [[0]*(n+1) for i in range(n+1)]
    dp[0][0] = 1
    
    for i in range(n):
        for j in range(i+1):
            dp[i+1][j+1] += dp[i][j]*p[i]
            dp[i+1][j] += dp[i][j]*(1-p[i])
    
    ans = 0
    for i in range((n-1)//2+1, n+1):
        ans += dp[n][i]
            
    print(ans)
    
    
if __name__ == "__main__":
    main()


Measured memory_bytes: 204060
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int prime[100001] = {0};
    
    for ( int i = 2; i < 100001; i++ ) {        
        if ( !prime[i] ) {
            for ( int j = i+i; j < 100001; j += i ) {
                prime[j] = 1;
            }
        }       
    }
    
    
    int similar[100001] = {0};
    
    for ( int i = 3; i < 100001; i+=2 ) {
        if ( !prime[i] && !prime[(i+1)/2] ) { similar[i] = 1; }
    }
    
    int X[100001] = {0};
    for ( int i = 3; i < 100001; i++ ) {
        X[i] = X[i-1] + similar[i];
    }
    
    int Q;
    cin >> Q;
    vector<int> A(Q);
    for ( int i = 0; i < Q; i++ ) {
        
        int l,r;
        cin >> l >> r;
        
        A[i] = (X[r]-X[l-1]);
    }
    
    for ( int i = 0; i < Q; i++ ) {
        cout << A[i] << endl;
    }
    
    
    
    return 0;
}

Measured memory_bytes: 2176
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
	char num[6]={0};
	
	while(1){
		int cnt = 0;
		scanf("%s",num);
		if(num[0] == num[1] && num[1] == num[2] && num[2] == num[3]){
			if(num[0] == 48)break;
			else puts("NA");
			continue;
		}
		if(num[0] == '6' && num[1] == '1' && num[2] == '7' && num[3] == '4'){
			puts("0");
			continue;
		}
		while(1){
			sort(num,num+4);
			int s = atoi(num);
			reverse(num,num+4);
			int l = atoi(num);
			int x = 0;
			if(l - s == 6174){
				printf("%d\n",cnt+1);
				break;
			}
			else{
				x = l - s;
				cnt++;
				for(int i = 0; i < 4; i++){
					num[i] = (x / pow(10,3-i))+48;
					x -= (num[i]-48) * pow(10,3-i);
				}
			}
		}
		
	}
	return 0;
}

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

import sys
sys.setrecursionlimit(10 ** 9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

from collections import defaultdict

class Node:
    def __init__(self, key):
        self.key = key
        self.par = -1
        self.left = -1
        self.right = -1

root = None
nodes = defaultdict(lambda: None)

def insert(z):
    global root
    # yはxの親
    y = None
    x = root
    # zの親となるべきノードを探す
    while x is not None:
        y = x
        if z.key < x.key:
            # 左の子に移動
            x = nodes[x.left]
        else:
            # 右の子に移動
            x = nodes[x.right]
    if y is None:
        z.par = -1
    else:
        z.par = y.key
    
    if y is None:
        # Tが空の場合
        root = z
    elif z.key < y.key:
        # zをyの左の子にする
        y.left = z.key
    else:
        # zをyの右の子にする
        y.right = z.key

def tree_walk(node):
    preo.append(node.key)
    if node.left != -1:
        tree_walk(nodes[node.left])
    ino.append(node.key)
    if node.right != -1:
        tree_walk(nodes[node.right])
    return

N = INT()

for _ in range(N):
    instr = input()
    if instr == 'print':
        preo = []
        ino = []
        tree_walk(root)
        print('', *ino)
        print('', *preo)
    else:
        _, key = instr.split()
        key = int(key)
        node = Node(key)
        nodes[key] = node
        insert(node)



Measured memory_bytes: 142228
if __name__ == '__main__':

	l = input()
	S1, S2 = [], []
	
	sum = 0
	n = len(l)
	for i in range(n):
		if l[i] == "\\":
			S1.append(i)
		elif l[i] == "/" and S1:
			j = S1.pop()
			a = i - j
			sum += a
	
			while S2 and S2[-1][0] > j:
				a += S2.pop()[1]
			S2.append([j, a])
	
	print(sum)
	print(len(S2), *(a for j, a in S2))


Measured memory_bytes: 6512
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;

namespace CSharpSpiral {
	class Program {
		static void Main(string[] args) {
			var sw = new StreamWriter(Console.OpenStandardOutput()) {
				AutoFlush =
#if DEBUG
			true
#else
			false
#endif
			};
			Console.SetOut(sw);
			new Program().Solve(new ConsoleInput(
#if DEBUG
			new StreamReader("../../../inputData.txt")
#else
			Console.In
#endif
			, ' '));
			Console.Out.Flush();
		}
		public void Solve(ConsoleInput cin) {
			var dat = cin.ReadIntArray(3);
			var tmp = dat[0];
			dat[0] = dat[1];
			dat[1] = tmp;
			tmp = dat[0];
			dat[0] = dat[2];
			dat[2] = tmp;
			Console.WriteLine(dat.Join());
		}
	}
	static class ExtendClass {
		public static string Join<T>(this IEnumerable<T> X, string separator = " ") => string.Join(separator, X);

	}
	class ConsoleInput {
		private readonly TextReader _stream;
		private readonly char _separator = ' ';
		private readonly Queue<string> inputStream;
		public ConsoleInput(TextReader stream, char separator = ' ') {
			this._separator = separator;
			this._stream = stream;
			inputStream = new Queue<string>();
		}
		public string Read {
			get {
				if(inputStream.Count != 0) return inputStream.Dequeue();
				string[] tmp = _stream.ReadLine().Split(_separator);
				for(int i = 0; i < tmp.Length; ++i)
					inputStream.Enqueue(tmp[i]);
				return inputStream.Dequeue();
			}
		}
		public string ReadLine { get { return _stream.ReadLine(); } }
		public int ReadInt { get { return int.Parse(Read); } }
		public long ReadLong { get { return long.Parse(Read); } }
		public double ReadDouble { get { return double.Parse(Read); } }
		public string[] ReadStrArray(long N) {
			var ret = new string[N];
			for(long i = 0; i < N; ++i)
				ret[i] = Read;
			return ret;
		}
		public int[] ReadIntArray(long N) { var ret = new int[N]; for(long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
		public long[] ReadLongArray(long N) { var ret = new long[N]; for(long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
		public double[] ReadDoubleArray(long N) { var ret = new double[N]; for(long i = 0; i < N; ++i) ret[i] = ReadDouble; return ret; }
		public bool isEOF {
			get { return _stream.Peek() == -1; }
		}
	}

}


Measured memory_bytes: 13396
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int A=scan.nextInt();
		int B=scan.nextInt();
		int H=scan.nextInt();
		int M=scan.nextInt();
		double wm=360/60;
		double wh1=360/12;
		double wh2=30.0/60.0;
		double m_angle=(double)M*wm;
		double h_angle=(double)H*wh1+(double)M*wh2;
		double angle_a=m_angle>h_angle ? m_angle-h_angle : h_angle-m_angle;
		if(angle_a>180)angle_a=360-angle_a;
		double b=Math.pow(A,2);
		double c=Math.pow(B, 2);
		
		double a=Math.sqrt(b+c-2*A*B*Math.cos(Math.toRadians(angle_a)));
		System.out.println(a);

	}

}

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

int main(){
int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A>B){
  	if(C>D){
    cout << B+D << endl;
    }
    else{
    cout << B+C << endl;
    }
  }
  else{
  if(C>D){
  cout << A+D << endl;
  }
  else{
  cout << A+C << endl;
  }
  }
  return 0;
}

Measured memory_bytes: 256
a = list(map(int,input().split()))

N = a[0]
M = a[1]

ctr = [0 for i in range(M)]


for i in range(N):
    b =  list(map(int,input().split()))

    for j in range(b[0]):
        for k in range(M):
            if b[j+1] == k+1:
                ctr[k] += 1

flag = [N == ctr[j] for j in range(M)]
print(sum(flag))

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

const int N = 1e6;
long long a[N + 7];
int n;
long long su[N + 7];
long long tab[N + 7];
long long mtab[N + 7];

int main() {
	ios_base::sync_with_stdio(0);
	cin >> n;
	for(int i = 1; i <= n; ++i) cin >> a[i];
	sort(a + 1, a + n + 1);
	for(int i = 1; i <= n; ++i) {
		su[i] = su[i - 1] + a[i];
		tab[i] = a[i] - 2 * su[i - 1];
	}
	
	mtab[n] = tab[n];
	for(int i = n - 1; i >= 1; --i) {
		mtab[i] = max(tab[i], mtab[i + 1]);
	}
	
	int wynik = 0;
	for(int i = 1; i <= n; ++i) {
		if(mtab[i + 1] <= 0) wynik++;
	}
	cout << wynik << endl;
	return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <map>

using namespace std;
typedef long long ll;
ll N;
ll Q;
vector<string > T;
vector<string > D;
ll isOK(ll posi, string s){
    //ll ab_posi = posi;
    for(ll i = 0; i < Q; i++){
        if(s.substr(posi,1) == T[i]){
            if(D[i] == "L"){
                posi--;
            }else{
                posi++;
            }
        }

        //左よりすぎるとだめよ
        if(posi < 0){
            return 0;
        }else if(posi > N - 1){
        //右よりすぎるとだめよ
            return 1;
        }
    }
    return 2;
}

int main(){
    multimap<string, ll> mp;
    multimap<string, ll> mp2;
    cin >> N >> Q;
    string s;
    cin >> s;

    string t, d;
    for(ll i = 0; i < Q; i++){
        cin >> t >> d;
        T.push_back(t);
        D.push_back(d);
    } 

    //操作
    ll left = -1;
    ll right = N;

    //二部探査
    //左
    while(abs(right-left) > 1){
        ll mid = left + (right - left) / 2;
        if(isOK(mid, s) == 0) left = mid;
        else right = mid;
    }

    ll mxLeft = left;

    left = -1;
    right = N;
    //右
    while(abs(right-left) > 1){
        ll mid = left + (right - left) / 2;
        if(isOK(mid, s) == 1) right = mid;
        else left = mid;
    }  
    ll mxRight = right;
    

    ll ans = mxRight - mxLeft - 1;

    cout << ans << endl;
} 

Measured memory_bytes: 22372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,j,n,m) for(int i=j;i<n;i+=m)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pob pop_back
#define MP make_pair
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.F<<","<<_p.S<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}

template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=55560,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=(ll)1e18;

ll fg[MAXn];
vector<ll> prime,ans;
int main(){
  IOS();
  RST(fg,1);
  fg[0]=fg[1]=0;
  for(int i=2;i<=MAXn;i++){
    if(fg[i]) prime.pb(i);
    for(int j=0;j<SZ(prime) && prime[j]<=MAXn/i;j++){
      fg[i*prime[j]]=0;
      if(i%prime[j]==0) break;
    }
  }
  debug(prime);
  ll n;
  cin>>n;
  REP(i,SZ(prime)){
    if(prime[i]%5==1) ans.pb(prime[i]);
  }
  REP(i,n) cout<<ans[i]<<' ';
}


Measured memory_bytes: 768
# -*- coding: utf-8 -*-
import numpy as np

n = int(input())
a = np.array(input().split(), dtype='int')

j = 1

for i in range(n):
    if a[i] == j:
        j += 1

ans = n - j + 1

if ans == n:
    ans = -1

print(ans)

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

ll a[110];
int main()
{
	ll n, i, j, k, x, y;

	scanf("%lld", &n);
	for(i=0; i<n; i++)
	{
		scanf("%lld %lld", &x, &y);
		if(x==y) a[i]=1;
	}
	ll yes=0;
	for(i=0; i<n-2; i++)
	{
		if(a[i]==1 && a[i+1]==1 && a[i+2]==1) yes=1;
	}

	if(yes) printf("Yes\n");
	else printf("No\n");



	return 0;
}

Measured memory_bytes: 3760
#include<cstdio>
#include<iostream>
#include<sstream>
#include<cctype>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<utility>

#define REP(i,n) for(int i=0; i<n; i++)
#define REPit(it,iterable) for(typeof(iterable.begin()) it=vec.begin(); it != vec.end(); it++)
using namespace std;

int main(void) {
    while(true) {
        int t,p,r;
        cin >> t >> p >> r;
        if(!t) break;

        int wrong[100][20] = {};
        pair<int,pair<int,int> > state[100];
        REP(i,t)
            state[i].second.second = i+1;

        REP(i,r) {
            int tid,pid,time;
            string mes;
            cin >> tid >> pid >> time >> mes;

            tid--;
            pid--;
            if(wrong[tid][pid] == -1) continue;
            if(mes == "CORRECT") {
                state[tid].first--;
                state[tid].second.first += (wrong[tid][pid]*1200 + time);
                wrong[tid][pid] = -1;
            }else{
                wrong[tid][pid]++;
            }
        }
        sort(state, state+t);
        REP(i,t) {
            printf("%d %d %d\n", state[i].second.second, -state[i].first, state[i].second.first);
        }
    }
    return 0;
}

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

//defines
#define openin freopen("input.txt","r",stdin)
#define openout freopen("output.txt","w",stdout)
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define int long long
#define mod 1000000007
#define repr(i,x,y) for (__typeof(x) i=x;i>=y;i--)
#define rep(i,x,y) for (__typeof(x) i=x;i<=y;i++)
#define all(c) (c).begin(),(c).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair

/* Print pair */
template <typename T,typename S>
ostream & operator << (ostream &os , const pair<T,S> &v) {
    os << "(" ;
    os << v.first << "," << v.second << ")" ;
    return os ;
}
/* Print vector */
template <typename T>
ostream & operator << (ostream &os , const vector<T> &v) {
    os << "[" ;
    int sz = v.size() ;
    for(int i = 0 ; i < sz ; ++i) {
        os << v[i] ;
        if(i!=sz-1)os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print set */
template <typename T>
ostream & operator << (ostream &os , const set<T> &v) {
    T last = *v.rbegin() ;
    os << "[" ;
    for(auto it : v) {
        os << it  ;
        if(it != last) os << "," ;
    }
    os << "]\n" ;
    return os ;
}
/* Print Map */
template <typename T,typename S>
ostream & operator << (ostream &os , const map<T,S> &v) {
    for(auto it : v) {
        os << it.first << " : " << it.second << "\n" ;
    }
    return os ;
}
int power(int a , int b)
{
    int res = 1 ;
    while(b)
    {
        if(b%2) {
            res = (res * a) % mod ;
        }
        b/=2 ;
        a = (a*a) % mod ;
    }
    return res ;
}

//debug
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
        cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int r , c , n ; 
vector<pair<pair<int,int>,int> > arr ; 
bool is(int x , int y) {
    return (x == 0 || y == 0 || y == c || x == r) ;
}
void Insert(int x , int y , int idx) { 
    if(x == 0) arr.pb({{1,y},idx}) ; 
    else if(y == c) arr.pb({{2,x},idx}) ;
    else if(x == r) arr.pb({{3,-y},idx}) ;
    else arr.pb({{4,-x},idx}) ;
}
int32_t main()
{
    fast;
    int idx = 1 ;
    cin >> r >> c >> n ; 
    rep(i,1,n) {
        int x1 , y1 , x2 , y2 ; 
        cin >> x1 >> y1 >> x2 >> y2 ; 
        if(is(x1,y1) && is(x2,y2)) {
            Insert(x1,y1,idx) ;
            Insert(x2,y2,idx) ;
            ++idx ; 
        }
    }
    sort(all(arr)) ;
    stack<int> bla ; 
    for(auto it : arr) {
        if(bla.empty() == false && bla.top() == it.second) bla.pop() ;
        else bla.push(it.second) ;
    }
    if(bla.empty()) cout << "YES\n" ; 
    else cout << "NO\n" ;
    return 0;
}



Measured memory_bytes: 8432
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    int n;
    cin >> n;
    vi A(n);
    vector<vector<pint>> xy(n);
    rep(i, n) {
        cin >> A[i];
        rep(j, A[i]) {
            int x, y;
            cin >> x >> y;
            x--;
            xy[i].push_back(make_pair(x, y));
        }
    }

    int res = 0;

    rep(i, 1 << n) {
        int t = 0;

        bool f4 = true;

        rep(j, n) {
            bool f2 = (i >> j) & 1;
            if (!f2) continue;

            bool flag = true;

            rep(k, A[j]) {
                int f3 = (i >> xy[j][k].first) & 1;
                if (f3 != xy[j][k].second) {
                    flag = false; f4 = false;
                }
            }

            if (flag) t++;
        }

        if (f4) res = max(res, t);
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long maximum;
long long mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
  int n,t;
  cin >> n >> t;
  vector<pair<int,int>> sushi(n);
  for(int i=0;i<n;i++){
    int a;
    cin >> a;
    sushi.at(i).first = a;
    int b;
    cin >> b;
    sushi.at(i).second = b;
  }
  sort(sushi.begin(), sushi.end());
  dp.resize(n,vector<int>(t,0));
  int ans;
  for(int i=1;i<n;i++){
    for(int j=0;j<t;j++){
      if(j<sushi.at(i-1).first){
        dp.at(i).at(j) = dp.at(i-1).at(j); 
      }else{
        dp.at(i).at(j) = max(dp.at(i-1).at(j),dp.at(i-1).at(j- sushi.at(i-1).first)+sushi.at(i-1).second);
      }
    }
    ans = max(ans,dp.at(i).at(t-1)+sushi.at(i).second);
  }
  cout << ans << endl;
}


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


int main() {
  std::string s;
  std::cin >> s;
  int count_0 = 0;
  int count_1 = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '0') {
      count_0++;
    } else if (s[i] == '1') {
      count_1++;
    }
  }
  std::cout << 2 * std::min(count_0, count_1) << std::endl;
  return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include <stdlib.h>
typedef long long ll;
int main(){
  ll n,i,a[200001],sum[200001],k,ans;
  scanf("%lld",&n);
  sum[0]=0;
  for(i=1;i<=n;i++){
    scanf("%lld",&a[i]);
    sum[i]=sum[i-1]+a[i];
  }
  for(i=1;i<=n;i++){
    if(sum[i]>sum[n]/2){
      k=i;
      break;
    }
  }
  ans=abs(sum[n]-sum[k-1]*2)>abs(sum[n]-sum[k]*2)?abs(sum[n]-sum[k]*2):abs(sum[n]-sum[k-1]*2);
  printf("%lld",ans); 
  return 0;
}


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

int main() {
    string s;
    cin >> s;
    string t;
    cin >> t;
    int ans = 0;
    for (int i = 0; i < 3; i++) {
        if(s.at(i)==t.at(i))ans++;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int n,a[100001],b[100001],ans;
map <int,int> c;
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(b+1,b+1+n);
	for(int i=1;i<=n;++i){
		c[b[i]]=i;
	}
	for(int i=1;i<=n;++i){
		if(abs(i-c[a[i]])%2==1)ans++;
	}
	cout<<ans/2;
}

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

using namespace std;

int main(int argc, char const *argv[]) {
	int a,b;
	std::cin >> a >> b;
	int count = 0;
	for (int i = a; i <= b; i++) {
		string str = to_string(i);
		if (str[0] == str[4] && str[1] == str[3]) {
			count++;
		}
	}
	std::cout << count << '\n';

	return 0;
}


Measured memory_bytes: 384
import sys

input = sys.stdin.readline


def main():
    _ = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    ans = 0
    for v, c in zip(V, C):
        if v - c > 0:
            ans += (v - c)

    print(ans)


if __name__ == "__main__":
    main()


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

int main(){
  string s;
  cin >> s;
  bool flag=true;
  for(int i=0;i<s.size();i++){
    if((i+1)%2==0){
      if(s[i]=='R') flag=false;
    }else{
      if(s[i]=='L') flag=false;
    }
  }
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3604
/*******************************************************************
 * 		Author : yash1402_										   *
 ******************************************************************/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<pll> vpi;
typedef vector<bool> vb;

struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

int dfs(int node,vector<vi> &adj,vb &vis) {
	if(vis[node]) return 0;
	int c = 1;
	//cout << node << " ";
	vis[node] = true;
	for(unsigned int i=0;i<adj[node].size();i++) {
		c += dfs(adj[node][i],adj,vis);
	}
	return c;
}

void solve() {
	int n,m;
	cin >> n >> m;
	vector<vi> adj(n+1);
	
	int x,y;
	for(int i=0;i<m;i++) {
		cin >> x >> y;
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	
	vb vis(n+1);
	fill(vis.begin(),vis.end(),false);
	
	int ans = 0;
	for(int i=1;i<=n;i++) {
		if(!vis[i]) {
			//cout << i << ": ";
			ans = max(dfs(i,adj,vis),ans);
			//cout << "\n";
		}
	}
	
	cout << ans << "\n";
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	ll T=1;
	//cin >> T;
	while(T--) {
		solve();
	}
}



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

void max_self(ll& a, ll b) {
    a = max(a, b);
}
void min_self(ll& a, ll b) {
    a = min(a, b);
}

const ll INF = 1e18L + 5;

int main() {
    int n, W;
    scanf("%d%d", &n, &W);
    vector<int> weight(n), value(n);
    for(int i = 0; i < n; ++i) {
        scanf("%d%d", &weight[i], &value[i]);
    }
    int sum_value = 0;
    for(int x : value) {
        sum_value += x;
    }
    vector<ll> dp(sum_value + 1, INF); // 0 ... W
    dp[0] = 0;
    // dp[i] - the minimum total weight of items with total value exactly i
    for(int item = 0; item < n; ++item) {
        for(int value_already = sum_value - value[item]; value_already >= 0; --value_already) {
        //~ for(int weight_already = 0; weight_already <= W - weight; ++weight_already) {
            min_self(dp[value_already+value[item]], dp[value_already] + weight[item]);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= sum_value; ++i) {
        if(dp[i] <= W) {
            answer = max(answer, (ll) i);
        }
        //~ min_self(answer, dp[i]);
    }
    printf("%lld\n", answer);
}


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

typedef long long int ll;
ll powk(ll a, ll n = 2){
    ll r = 1;
    for(ll i = 0;i < n;i++){
        r *= a;
    }

    return r;
}

int main()
{
    ll n;
    cin >> n;
    vector<string> s(n);
    for(ll i = 0;i < n;i++){
        cin >> s[i];
    }

    vector<ll> c(5);
    for(ll i = 0;i < n;i++){
        if(s[i][0] == 'M'){
            c[0]++;
        }
        else if(s[i][0] == 'A'){
            c[1]++;
        }
        else if(s[i][0] == 'R'){
            c[2]++;
        }
        else if(s[i][0] == 'C'){
            c[3]++;
        }
        else if(s[i][0] == 'H'){
            c[4]++;
        }
    }

    ll ans = 0;
    for(ll i = 0;i < 5;i++){
        for(ll j = i + 1;j < 5;j++){
            for(ll k = j + 1;k < 5;k++){
                ans += c[i] * c[j] * c[k];
            }
        }
    }

    cout << ans;


    return 0;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define ll long long
#define li long
#define pb push_back
#define mem(arr,x) memset(arr,x,sizeof(arr))
int dis[100010];
vector<int>adj[100010];

void dfs(int node)
{
  for(auto child:adj[node])
  {
    if(dis[child]==0)
    dfs(child);
    dis[node]=max(dis[node],1+dis[child]);
  }
}

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,i,u,v;
    cin>>n>>m;
    vector<int>indeg(n+1,0);
    for(i=0;i<m;i++)
    {
      cin>>u>>v;
      adj[u].pb(v);
      indeg[v]++;
    }
    vector<int>vertices;
    for(i=1;i<=n;i++)
    {
      if(indeg[i]==0)
      vertices.pb(i);
    }
    mem(dis,0);
    for(auto vertex:vertices)
    {
      dis[vertex]=0;
      dfs(vertex);
    }
    int ans=0;
    for(i=1;i<=n;i++)
    ans=max(ans,dis[i]);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 14204
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <iterator>
#include <stdlib.h>  // atoi

using namespace std;

void get_values(vector<int> &values, int &v1, int &v2){
	v2 = values.back();
	values.pop_back();

	v1 = values.back();
	values.pop_back();
}

int main(){
	// Get Input
	string temp;
	getline(cin, temp);
	istringstream iss(temp);
	vector<string> calc{istream_iterator<string>{iss},
                      istream_iterator<string>{}};

	vector<int> values;
	int v1, v2, val;
	for(int i=0; i<calc.size(); ++i){
		temp = calc[i];
		if(temp == "+"){
			get_values(values, v1, v2);
			val = v1 + v2;
			values.push_back(val);
			continue;
		}	
		if(temp == "-"){
			get_values(values, v1, v2);
			val = v1 - v2;
			values.push_back(val);
			continue;
		}	
		if(temp == "*"){
			get_values(values, v1, v2);
			val = v1 * v2;
			values.push_back(val);
			continue;
		}	
		values.push_back(atoi(temp.c_str()));
	}
	cout << values[0] << endl;	
}


Measured memory_bytes: 3192
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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

signed main() {
  ll N;
  cin >> N;
  string S, T;
  cin >> S >> T;
  rep(i, N) {
    cout << S[i] << T[i];
  }
  ENDL;
  return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
xs = gets.chomp.split(' ').map(&:to_i)

ans = 1000000
100.times do |i|
  i += 1
  sum = 0
  xs.each do |x|
    sum += (x - i) ** 2
  end
  ans = ans > sum ? sum : ans
end

puts ans


Measured memory_bytes: 1788
N = int(input())
l = {}
m = 0
for _ in range(N):
  s = input()
  if not s in l:
    l[s] = 1
  l[s] += 1
  m = max(m, l[s])
ml = []
for k, v in l.items():
  if v == m:
    ml.append(k)
ml.sort()
for i in range(len(ml)):
  print(ml[i])

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

int main() {
    int A, B;
    cin >> A >> B;

    if (A >= 13) {
        cout << B << "\n";
    }
    else if (A >= 6) {
        cout << B / 2 << "\n";
    }
    else {
        cout << 0 << "\n";
    }

    return 0;
}

Measured memory_bytes: 888
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let v = read_vec::<i64>();
    let (mut a, mut b, k) = (v[0], v[1], v[2]);
    let mut cur_a = true;
    for i in 0..k {
        if !cur_a {
            std::mem::swap(&mut a, &mut b);
        }
        if a % 2 == 1 {
            a -= 1;
        }
        b += a / 2;
        a /= 2;

        if !cur_a {
            std::mem::swap(&mut a, &mut b);
        }

        cur_a = !cur_a;
    }
    println!("{} {}", a, b);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
long long int gcd(long long int a, long long int b);
int a[200000];
int main() {
	
	//E
	long long int N;
	cin >> N;
	long long int counter = 0;
	if (N % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}
	else {
		if (N == 0) {
			cout << 0 << endl;
			return 0;
		}
		else {
			N = N - (N % 10);
			N = N / 10;
			counter = counter + N;
			while (N > 0) {
				N = N - (N % 5);
				N = N / 5;
				counter = counter + N;
			}
			cout << counter << endl;
			return 0;
		}
	}
	
	
	//D

	/*int n;
	cin >> n;
	int i;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	int counter = 0;
	int seek = 1;
	for (i = 0; i < n; i++) {
		if (a[i] == seek) {
			counter++;
			seek++;
		}
	}
	if (counter == 0) {
		cout << -1 << endl;
		return 0;
	}
	cout << n - counter << endl;
	return 0;*/


	//C
	/*long long int A, B;
	cin >> A >> B;
	cout <<  A * B / gcd(A, B) << endl;
	return 0;*/

	//B
	/*int n;
	cin >> n;
	string s, t;
	cin >> s >> t;
	int i;
	for (i = 0; i < n; i++) {
		cout << s[i];
		cout << t[i];
	}
	cout << endl;
	return 0;*/
}
long long int gcd(long long int a,long long  int b) {
	if (a == 0) {
		return b;
	}
	else if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a%b);
	}
}

Measured memory_bytes: 256
s = input()
t = input()
if len(s) == len(t)-1:
    flag = 0
    for i in range(len(s)):
        if s[i] == t[i]:
            pass
        else:
            flag = 1
            break
    if flag:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")

Measured memory_bytes: 9056
#ABC125C-GCDonBlackboard.py

from sys import stdin
from sys import setrecursionlimit
#import random
from fractions import gcd
from functools import lru_cache

setrecursionlimit(1000000)

input = stdin.readline

N = int(input())
A = list(map(int, input().split()))
#A = [random.randrange(1,10**9) for _ in range(N)]

@lru_cache(maxsize=None)
def L(i):
    if i == 0:
        return 0
    else:
        return gcd(L(i-1),A[i-1])

@lru_cache(maxsize=None)
def R(i):
    if i == N:
        return 0
    else:
        return gcd(R(i+1),A[i])

M = []

for i in range(N):
    M.append(gcd(L(i), R(i+1)))

print(max(M))


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

int main() {
	int b;
	cin >> b;
	int s = 0;
	for (int a = 1;; a++) {
		s += a - 1;
		if (s + a >= b) {
			for (int j = a; j > 0; j--) {
				if (b >= j) {
					b -= j;
					printf("%d\n", j);
				}
				if (b == 0)return 0;
			}
		}
	}
}

Measured memory_bytes: 256