akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	public static void main (String args[]) {
		Scanner sc = new Scanner(System.in);
		int a, b, c;
		int n;

		while (true) {
			a = sc.nextInt();
			b = sc.nextInt();
			c = sc.nextInt();
			if ((a | b | c) == 0) {
				break;
			}
			n = sc.nextInt();

			int swap = a;
			a = Math.min(a, b);
			b = Math.min(Math.max(swap, b), c);
			
			double k = Math.sqrt(1.0 * a * a + b * b);
			for (int i = 0; i < n; i++) {
				int r = sc.nextInt();
				if (k / 2 < r) {
					System.out.println("OK");
				} else {
					System.out.println("NA");
				}
			}
		}
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int N;
cin >> N;
vector<int> vec(N);
int ans = 0;
for (int i = 0;i < N;i++) {
    cin >> vec.at(i);
    ans += vec.at(i);
}
sort(vec.begin(),vec.end());
ans -= vec.at(N-1) /2;
cout << ans << endl;

return 0;
}


Measured memory_bytes: 256
S = input()
N = len(S)
dp = [0] * (N+1)
dp[0] = 0
dp[1] = 1
if N >= 2:
    dp[2] = 1 + (1 if S[0]!=S[1] else 0)
    for i in range(2,N):
        if S[i] != S[i-1]: dp[i+1] = dp[i]+1
        else: dp[i+1] = dp[i-2]+2
print(dp[N])

Measured memory_bytes: 11144
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

const int mod = 1e9+7;

int n;
long long h[N];
long long b[N];
long long dp[N];
long long segtree[N << 2];

long long s;
long long e;
long long val;

void update(int P , int L , int R){
     if(L > e || R < s){
        return;
     } else if(s <= L && R <= e) {
        segtree[P] = val;
     } else {
        int mid = (L + R) >> 1;
        update( (P << 1) | 0 , L , mid + 0);
        update( (P << 1) | 1 , mid + 1 , R);
        segtree[P] = max(segtree[P << 1] , segtree[P << 1 | 1]);
     }
}

long long query(int P , int L , int R){
    if(L > e || R < s){
        return 0;
    } else if(s <= L && R <= e){
        return segtree[P];
    } else {
        int mid = (L + R) >> 1;
        long long a = query( (P << 1) | 0 , L , mid + 0);
        long long b = query( (P << 1) | 1 , mid + 1 , R);
        return max(a , b);
    }
}


int main(){
    long long mx = 0;
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        scanf("%lld" , &h[i]);
        mx = max(mx , h[i]);
    }
    for(int i = 1; i <= n; i++){
        scanf("%lld" , &b[i]);
    }
    for(int i = 1; i <= n; i++){
        // dp[i] = max among 1 ... h[i] - 1
        if(h[i] - 1 >= 1){
            s = 1;
            e = h[i] - 1;
            dp[i] = query(1 , 1 , n) + b[i];
        } else {
            dp[i] = b[i];
        }
        //cout << h[i] << " " << dp[i] << endl;
        s = h[i];
        e = h[i];
        val = dp[i];
        update(1 , 1 , n);

        /*for(int j = 0; j < i; j++){
            if(h[i] > h[j]){
                dp[i] = max(dp[i] , dp[j] + b[i]);
            }
        }*/
    }
    s = 1;
    e = mx;
    printf("%lld\n" , query(1 , 1 , n));
}


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

int main(){
int n,d,x;
scanf("%d %d %d",&n,&d,&x);
int a[100];
int ans=x;
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<n;i++){
	int day=1;
	while(day<=d){
		day=day+a[i];
		ans=ans+1;
	}
}

printf("%d\n",ans);
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define faster ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
#define ll long long
#define ld long double
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define REP(i,a,b) for(ll i = a; i < b; i++)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * b) / gcd(a, b)
#define bins(v, x) binary_search(v.begin(), v.end(), x)
const double pi = 2*acos(0.0);
const int INF = 1e9+1;
const int mod = 1e9+7;
const int mod1 = 998244353;
 
ll modExp(ll base, ll exp, ll mod) {
   ll res = 1;
   while (exp > 0) {
    	if (exp % 2 == 1) {
        	res= (res * base) % mod;
		}
      exp = exp >> 1;
      base = (base * base) % mod;
   }
   return res;
}

ll inverse(ll base, ll exp, ll mod) {
   return modExp(base, exp - 2, mod);
}

bool compare(const pair<int, int>&i, const pair<int, int>&j) {
    return (i.S > j.S || (i.S == j.S && i.F > j.F));
}

void test() {
   char s;
   cin >> s;

   if(s <= 'Z' && s >= 'A') cout << "A";
   else if(s <= 'z' && s >= 'a') cout << "a";
}

int main() {
   //freopen("input.txt","r",stdin);
   //freopen("output.txt","w",stdout);
   faster;
   cout.precision(10);
   cout << fixed;

   int t = 1;
   //cin >> t;
   while(t--)
      test();

   return 0;
}

Measured memory_bytes: 3632
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 110;
const int MAX_INF = 0x3fffffff;

int a[MAXN];

int main ()
{
    int n;
    scanf ("%d", &n);
    for (int i = 1; i <= n; i ++)
    {
        scanf ("%d", &a[i]);
    }
    sort (a + 1, a + n + 1);
    int ans = MAX_INF;
    for (int i = a[1]; i <= a[n]; i ++)
    {
        int tmp = 0;
        for (int j = 1; j <= n; j ++)
        {
            tmp += (i - a[j])*(i - a[j]);
        }
        if (tmp < ans)
        {
            ans = tmp;
        }
    }
    printf ("%d\n", ans);
    return 0;
}


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

class Main
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	
    public static void main(String args[]) throws Exception
    {
		long k=sc.nextLong();int n=50;long[] a=new long[n];
		
		for(int i=0;i<n;i++)
		{
			a[i]=i;
		}
		
		out.println(n);
		
		for(int i=0;i<n;i++)
		{
			long now=(k/n)+(i<(k%n)?1:0);
			
			a[i]+=(now*n);
			
			long left=k-now;
			
			a[i]-=left;
			
			out.print(a[i]+" ");
		}
		
		out.println("");out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 20692
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000000
void MatrixChainMultiplication(int*,int);
int **F;
int main(){
  int n,i,j,*matrix;
  scanf("%d",&n);
  matrix = (int*)malloc(sizeof(int) * (n + 1));
  F = (int**)malloc(sizeof(int*) * (n + 1));
  for(i=1; i<=n; i++) F[i] = (int*)malloc(sizeof(int) * (n + 1));
  for(i=0; i<n; i++){
    scanf("%d",&matrix[i]);
    scanf("%d", (i != n - 1 ? &j : &matrix[i+1]));
  }
  MatrixChainMultiplication(matrix,n);
  printf("%d\n",F[1][n]);
  return 0;
}
 
void MatrixChainMultiplication(int* p,int n){
  int i,j,k,l,q;
  // n--;
  for(i=1; i<=n; i++) F[i][i] = 0;
  for(l=2; l<=n; l++){
    for(i=1; i<=n-l+1; i++){
      j = i + l - 1;
      F[i][j] = MAX;
      for(k=i; k<=j-1; k++){
        q = F[i][k] + F[k+1][j] + p[i-1] * p[k] * p[j];
        F[i][j] = (F[i][j] < q ? F[i][j] : q);
      }
    }
  }
}



Measured memory_bytes: 2052
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<pair<long,long>> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i].first >> A[i].second;
  }
  sort(A.begin(), A.end());
  cout << A[N -1].first + A[N - 1].second;
}

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

namespace AtCoder
{
    static class Program
    {
        static void Main()
        {
            //ここから

            var vs = IO.ReadLineToLongList();
            long L = vs[0];
            long R = vs[1];

            int l = (int)(L % 2019);
            int r = (int)(R % 2019);

            int ans;

            if ( R - L >2017) { ans = 0; }
            else
            {
                int min = int.MaxValue;
                for(int i = l; i < r; i++)
                {
                    for(int j = i + 1; j <= r; j++)
                    {
                        min = Math.Min(min, i * j % 2019);
                    }
                }
                ans = min;
            }

            

            //ここまで
            Console.WriteLine(ans);
            Console.ReadKey();
        }

    }

    static class Func
    {
        static long mod = 1000000007;
        static public void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }
        static public long GCD(long a, long b) { return b != 0 ? GCD(b, a % b) : a; }
        static public long LCM(long a, long b) { return (long)a * b / GCD(a, b); }
        static public int Factorial(int a) { return a == 1 ? a : a * Factorial(a - 1); }

        static public long Conbination(int n,int m)
        {
            if (m == 0) return 1;
            if (n == 0) return 0;
            return n * Conbination(n - 1, m - 1) / m;
        }

        static public void Factoring(long num, ref long[] vs)
        {
            if (num == 1)
            {
                vs[1]++;
            }
            for (long i = 2; i < (long)Math.Sqrt(num); i++)
            {
                if (num % i == 0)
                {
                    vs[i]++;
                    Factoring(num / i, ref vs);
                }
            }
            vs[1]++;
        }
    }

    static class IO
    {
        static public string ReadLineToString() { return Console.ReadLine(); }
        static public int ReadLineToInt() { return int.Parse(Console.ReadLine()); }
        static public long ReadLineToLong() { return long.Parse(Console.ReadLine()); }
        static public List<string> ReadLineToStringList() { return Console.ReadLine().Split(' ').ToList(); }
        static public List<int> ReadLineToIntList() { return Console.ReadLine().Split(' ').Select(int.Parse).ToList(); }
        static public List<long> ReadLineToLongList() { return Console.ReadLine().Split(' ').Select(long.Parse).ToList(); }

        static public void WriteStrings(object[] strings) { foreach (var o in strings) { Console.Write(o + " "); } }
    }
}

Measured memory_bytes: 11220
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#define rep(i,n) for (int i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  int t = 0;
  int ans = 0;
  while (true) {
    t += A;
    if (t > T) break;
    else ans += B;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3140
//y14-3
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <cassert>
using namespace std;
#define LL long long
#undef INT_MIN
#undef INT_MAX
#define INT_MIN -2147483648
#define INT_MAX 2147483647
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807
#define segment_size 65536
#define ROOP() while (true)

int main(){
    int N;
    cin >> N;
    for(int i=0; i<N; i++){
        int K,P;
        cin >> K >> P;
        if(K % P == 0) cout << P << endl;
        else cout << K % P << endl;
    }
    return 0;
}



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

int main(){
  int high,west;
  cin>>high>>west;
  vector<vector<char>> pic(high+2,vector<char>(west+2,'#'));
  for(int i=1;i<=high;i++){
    for(int j=1;j<=west;j++){
      cin>>pic.at(i).at(j);
    }
  }
  for(int i=0;i<high+2;i++){
    for(int j=0;j<west+2;j++){
      cout<<pic.at(i).at(j);
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
def mi(): return map(int,input().split())
def lmi(): return list(map(int,input().split()))
def ii(): return int(input())
def isp(): return input().split()

n=ii()
a=lmi()
INF=10**9+7
ans=0
for i in range(60):
  x=0
  for j in range(n):

    if (a[j]>>i)&1:
      x+=1

  num=x*(n-x)*2**i
  ans+=num

print(ans%INF)

Measured memory_bytes: 115948
X,Y = list(map(int,input().split()))

ans=0
if X==1 and Y==1:
    ans+=400000
if X==1:
    ans+=300000
elif X==2:
    ans+=200000
elif X==3:
    ans+=100000
if Y==1:
    ans+=300000
elif Y==2:
    ans+=200000
elif Y==3:
    ans+=100000
    
print(ans)


Measured memory_bytes: 3060
/*..........mango is luv..........*/
#include<bits/stdc++.h>
using namespace std;
#define fk(i,start,end) for(ll i=start;i<ll(end);i++)
typedef long long int ll;
int main()
{ 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll n;
  cin>>n;
  if(n>=30)
  {
     cout<<"Yes";
  }
  else
  {
     cout<<"No";
  }   
     return 0;

}

Measured memory_bytes: 3652
hoge=[1,2,3,4,5,6,7,8,9]
n=100001
new=[1,2,3,4,5,6,7,8,9]
while len(hoge)<n:
  huga=[]
  for i in range(len(new)):
    aaa=new[i]*10+new[i]%10
    huga.append(aaa)
    if(new[i]%10!=9):
      aaa=new[i]*10+new[i]%10+1
      if(1>=abs(int(str(aaa)[-1])-int(str(aaa)[-2]))):
        huga.append(aaa)
    if(new[i]%10!=0):
      aaa=new[i]*10+new[i]%10-1
      if(1>=abs(int(str(aaa)[-1])-int(str(aaa)[-2]))):
        huga.append(aaa)
  new=huga
  hoge=hoge+huga
hoge.sort()
print(hoge[int(input())-1])

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  int L, R;
  L = A + B;
  R = C + D;
  
  if (L == R ){
    cout << "Balanced" << endl;
  }
  else if (L > R){
    cout << "Left" << endl;
  }
  else {
    cout << "Right" << endl;
  }

}

Measured memory_bytes: 256
n,m = map(int, input().split())

result = [False]*n
count = [0]*n
for _ in range(m):
  p,s = input().split()
  p = int(p)-1
  if not result[p]:
    if s == "AC": result[p] = True
    else: count[p] += 1
      
ng = 0
for i in range(n):
  if result[i]:
    ng += count[i]
print(result.count(True),ng)

Measured memory_bytes: 4596
y = int(input())
dp = [0]*99
dp.insert(0,1)
if y >= 2000:
    print(1)
else:
    for x in range(100,y+1):
        if dp[x-100] == 1 or dp[x-101] == 1 or dp[x-102] == 1 or dp[x-103] == 1 or dp[x-104] == 1 or dp[x-105] == 1:
            dp.append(1)
        else:
            dp.append(0)

    print(dp[y])

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

using ll = long long;

ll n;
vector<ll> a;

int main(int argc, char **argv)
{
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

	sort(a.begin(), a.end());

	bool flag = true;
	int before = -1;
	for (int i = 0; i < n; ++i)
	{
		if (before == a[i])
		{
			flag = false;
			break;
		}
		before = a[i];
	}
	std::cout << (flag ? "YES" : "NO")<< std::endl;
}

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

void run(int N, int R) {
    int innerRating = R;
    if(N < 10){
        // 内部レーティングは特殊計算のケース
        innerRating = R + 100 * (10 - N);
    }
    std::cout << innerRating << std::endl;
}

int main(){
    int a, b;
    std::cin >> a >> b;
    run(a, b);
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <math.h>
#include <set>

using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
ll MOD = 1000000007;

int main() {
	string s; ll k; cin >> s >> k;
	set<string> T;

	rep(i, 0, s.size()) {
		repe(j, 1, 5) {
			T.insert(s.substr(i, j));
		}
	}

	ll i = 0;
	for (set<string>::iterator it = T.begin(); it != T.end(); it++) {
		i++;
		if (i == k) {
			cout << *it << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 1664
"""
答えをにブタン
円がKこ以上重なる点が生まれる最小のtを求める
どうやって判定する？
"""

def wantnum(m):

    plis = []

    for i in range(N):
        plis.append([xyc[i][0] , xyc[i][1]])

    for i in range(N):
        for j in range(i):

            xA = xyc[i][0]
            yA = xyc[i][1]
            xB = xyc[j][0]
            yB = xyc[j][1]
            r1 = m / xyc[i][2]
            r2 = m / xyc[j][2]

            X = xB-xA
            Y = yB-yA

            a = (X**2 + Y**2 + r1**2 - r2**2) / 2

            retx1 = ( a*X + Y * (( (X**2+Y**2)*(r1**2) - a**2 )**0.5) ) / (X**2 + Y**2)
            rety1 = ( a*Y - X * (( (X**2+Y**2)*(r1**2) - a**2 )**0.5) ) / (X**2 + Y**2)

            retx1 += xA
            rety1 += yA

            retx2 = ( a*X - Y * (( (X**2+Y**2)*(r1**2) - a**2 )**0.5) ) / (X**2 + Y**2)
            rety2 = ( a*Y + X * (( (X**2+Y**2)*(r1**2) - a**2 )**0.5) ) / (X**2 + Y**2)

            retx2 += xA
            rety2 += yA

            if type(retx1) is not complex and type(rety1) is not complex:
                plis.append([retx1,rety1])
            if type(retx2) is not complex and type(rety2) is not complex:
                plis.append([retx2,rety2])

    ans = 0
    for nx,ny in plis:

        nnum = 0

        for i,j,r in xyc:
            if (i-nx)**2 + (j-ny)**2 < (m/r)**2 + 10**(-7):
                nnum += 1

        ans = max(ans,nnum)

    return ans

            

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

xyc = []
l = 0
r = 0

for i in range(N):
    
    x,y,c = map(int,input().split())
    xyc.append([x,y,c])

    r = max(r , c * ((x**2+y**2)**0.5) )

while r - l > 10**(-7) and r-l > l * (10**(-7)):

    m = (r+l) / 2

    ret = wantnum(m)
    #print (ret,m)

    if ret >= K:
        r = m
    else:
        l = m

print (r)

Measured memory_bytes: 57048
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;


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

    deque<char> que;
    rep(i, s.length()) que.push_back(s[i]); 

    bool rev = false;

    rep(i, q) {
        int t;
        cin >> t;
        if (t == 1) {
            rev = 1-rev;
        }
        else {
            int f;
            char c;
            cin >> f >> c;
            --f;
            if (f^rev) {
                que.push_back(c);
            }
            else {
                que.push_front(c);
            }
        }
    }
    string ans = "";
    while (!que.empty()) {
        if (rev) {
            ans += que.back();
            que.pop_back();
        }
        else {
            ans += que.front();
            que.pop_front();
        }
    }

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

Measured memory_bytes: 1412
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int main() {
	int N;
	string S,T;
	cin >> N >> S >> T;
	string o;
	for(int i=0;i<N;i++){
		o+=S[i];
		o+=T[i];
	}
	cout << o << endl;

	return 0;
}



Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int mod = 1e9+7;
const ll INF = 1e18L + 5;

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


int main()
{
    int n, w;
    cin >> n >> w;
    
    vector<ll> weight(n), value(n);
    int sum_value = 0;
    for(int i=0;i<n;++i)
    {
        cin >> weight[i] >> value[i];
        sum_value += value[i];
    }
    
    // dp[i] -> minimum total weights of items with total value exactly i
    
    vector<ll> dp(sum_value + 1, INF);
    dp[0] = 0;
    for(int item = 0; item < n; ++item)
    {
        for(int value_already = sum_value - value[item]; value_already >= 0; --value_already)
        {
            min_self(dp[value_already+value[item]], dp[value_already] + weight[item]);
        }
    }
    
    ll ans = 0;
    for(int i=0;i<=sum_value;++i)
    {
        if(dp[i] <= w)
        {
            ans = max(ans, 1ll * i);
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 4056
void main()
{
    long[] tmp = readln.split.to!(long[]);
    long a = tmp[0], b = tmp[1], c = tmp[2];
    long x = tmp[3], y = tmp[4];

    if (a + b < 2 * c)
    {
        writeln(a * x + b * y);
    }
    else
    {
        long z = min(x, y);
        long u = a * (x - z) + b * (y - z);
        long v = 2 * c * (max(x, y) - z);
        writeln(2 * c * z + min(u, v));
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Comparator;

public class Main
{
  static long imp[];
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String[] sl = s.split(" ");
    int n = Integer.parseInt(sl[0]);
    long a[] = new long[n];
    long b[] = new long[n];
    Integer ord[] = new Integer[n];
    imp = new long[n];
    for(int i = 0; i < n; i++)
    {
      s = r.readLine();
      sl = s.split(" ");
      a[i] = Long.parseLong(sl[0]);
      b[i] = Long.parseLong(sl[1]);
      imp[i] = a[i] + b[i];
      ord[i] = i;
    }

    class Comp implements Comparator<Integer>
    {
      @Override
      public int compare(Integer o1, Integer o2)
      {
        if(imp[o1] > imp[o2])
          return -1;
        else if(imp[o1] < imp[o2])
          return 1;
        return 0;
      }
    }

    Arrays.sort(ord, new Comp());

    long sum = 0;
    for(int i = 0; i < n; i++)
    {
      int proc = ord[i];
      if((i & 1) == 0)
      {
        sum += a[proc];
      }
      else
      {
        sum -= b[proc];
      }
    }

    System.out.println(sum);

  }

}

Measured memory_bytes: 76896
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

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

typedef long long int ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<pii> vpii;
typedef vector<vint> det1;
typedef vector<vpii> det2;

const int N = 5;
int K;
int X[N];

int main()
{
    rep(i, N) { cin >> X[i]; }
    cin >> K;

    int ans = 0;

    for (int i=0;i<N;++i)
    {
        for (int j=i+1;j<N;++j)
        {
            if (std::abs(X[j] - X[i]) > K) { ++ans; }
        }
    }

    cout << (ans == 0 ? "Yay!" : ":(") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
P s2p(string s){
  return P(stoi(s.substr(0,2)),stoi(s.substr(3,2)));
}
bool contain(string c,string p){
  P stc=s2p(c.substr(0,5));
  P enc=s2p(c.substr(6,5));
  P stp=s2p(p.substr(0,5));
  P enp=s2p(p.substr(6,5));
  //cout<<stc.first<<" "<<stc.second<<endl;
  //cout<<enc.first<<" "<<enc.second<<endl;
  //cout<<stp.first<<" "<<stp.second<<endl;
  //cout<<enp.first<<" "<<enp.second<<endl;
  return stp<=stc&&enc<=enp;
}
int main(){
  int k,n,m;
  cin>>k;
  string c[k];
  for(int i=0;i<k;i++) cin>>c[i];
  cin>>n;
  vector<string> t[n];
  for(int i=0,j;i<n;i++){
    string tmp;
    cin>>j;
    for(int a=0;a<j;a++){
      cin>>tmp;
      t[i].push_back(tmp);
    }
  }
  cin>>m;
  vector<string> s[m];
  for(int i=0,j;i<m;i++){
    string tmp;
    cin>>j;
    for(int a=0;a<j;a++){
      cin>>tmp;
      s[i].push_back(tmp);
    }
  }
  int ans=0;
  for(int i=0;i<k;i++){
    int a=0,b=0;
    for(int l=0;l<n;l++){
      bool f=0;
      for(int j=0;j<(int)t[l].size();j++){
	f|=contain(c[i],t[l][j]);
      }
      if(f) a++;
    }
    for(int l=0;l<m;l++){
      bool f=0;
      for(int j=0;j<(int)s[l].size();j++){
	f|=contain(c[i],s[l][j]);
      }
      if(f) b++;
    }
    //cout<<a<<" "<<b<<endl;
    ans+=min(a,b);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 4648
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int H, N;
    cin >> H >> N;
    vint A(N);
    rep(i, N) cin >> A[i];
    ll S = 0;
    rep(i, N) S += ll(A[i]);
    if (S >= ll(H)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
	long long n,p;
	scanf("%lld %lld",&n,&p);
	long long arr[n];long long x,y;
	x=0;y=0;
	for(int i=0;i<n;i++)
	{
		scanf("%lld",&arr[i]);
		if(arr[i]%2==0)
			x++;
		else
			y++;
	}
	long long ans=1;
	if(p==0)
	{
		if(x==0&&y==1)
			printf("0\n");
		else
		{
			ans=(long long)(pow(2,x));
			if(y!=0)
				ans=ans*(long long)(pow(2,y-1));
			printf("%lld\n",ans);
		}
	}
	else
	{
		if(y==0)
			printf("0\n");
		else
		{
			ans=(long long)(pow(2,x));
			ans=ans*(long long)(pow(2,y-1));
			printf("%lld\n",ans);
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Dice d = new Dice();
		for(int i = 0; i < 6; i++) {
			d.side[i] = sc.nextInt();
		}
		String cmd = sc.next();
		for(int i = 0; i < cmd.length(); i++) {
			switch(cmd.charAt(i)) {
				case 'E':{
					d.rollE();
					break;
				}
				case 'W':{
					d.rollW();
					break;
				}
				case 'S':{
					d.rollS();
					break;
				}
				case 'N':{
					d.rollN();
					break;
				}
			}
		}
		d.getUpperSide();
		sc.close();
	}
}

class Dice {
	int[] side = new int[6];

	public void getUpperSide() {
		System.out.println(this.side[0]);
	}

	public void rollE() {
		int w = this.side[5];
		this.side[5] = this.side[2];
		this.side[2] = this.side[0];
		this.side[0] = this.side[3];
		this.side[3] = w;
	}
	public void rollW() {
		int w = this.side[5];
		this.side[5] = this.side[3];
		this.side[3] = this.side[0];
		this.side[0] = this.side[2];
		this.side[2] = w;
	}
	public void rollN() {
		int w = this.side[5];
		this.side[5] = this.side[4];
		this.side[4] = this.side[0];
		this.side[0] = this.side[1];
		this.side[1] = w;
	}
	public void rollS() {
		int w = this.side[5];
		this.side[5] = this.side[1];
		this.side[1] = this.side[0];
		this.side[0] = this.side[4];
		this.side[4] = w;
	}
}



Measured memory_bytes: 26332
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
using namespace std;
#define pi pair<int32,int32>
#define pl pair<int64,int64>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}

int main(){
    int q; cin >> q;
    list<int> L;
    list<int>::iterator it = L.end();
    for(int i = 0; i < q; i++){
        int n; cin >> n;
        if (n == 0){
            int x; cin >> x;
            it = L.insert(it,x);
        } else if (n == 1){
            int x; cin >> x;
            if (x > 0){
                for(int i = 0; i < x; i++){
                    it++;
                }
            } else {
                for(int i = x; i < 0; i++){
                    it--;
                }
            }
        } else {
            it = L.erase(it);
        }
    }
    for(it = L.begin(); it != L.end(); it++){
        cout << *it << endl;
    }
}


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

int main()
{
	string S; cin >> S;
	int red = 0, blue = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '0') red++;
		else blue++;
	}
	cout << min(red, blue) * 2 << endl;
}

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

int main(){
    int N, M;
    cin >> N >> M;
    long long A[N];
    long long B[N];
    vector<pair<long long, long long> > a;
    long long sum = 0;
    long long count = 0;

    for(int i = 0; i < N; i++){
        cin >> A[i] >> B[i];
        a.push_back(make_pair(A[i], B[i]));
    }

    sort(a.begin(), a.end());

    for(int i = 0; i < N; i++){
        if(count + a[i].second < M){
            sum += a[i].first * a[i].second;
            count += a[i].second;
        }
        else{
            sum += a[i].first * (M - count);
            break;
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 3444
#pragma GCC optimize("-Ofast")

#include <bits/stdc++.h>

using namespace std;

signed main() {
	// 入力を受け取る
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

	// 各うさぎiについて、仲良しなうさぎが存在するか
	// 順に判定していく
	int ans = 0;
	for (int i = 0; i < n; ++i)
		if (i + 1 == a[a[i] - 1])
			++ans;

	// 答えの計算・出力
	ans /= 2;
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <unistd.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
 
 
typedef long long ll;
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
//const ll MOD = 1000000007;
const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { -1,0, 1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// #define mp make_pair
//#define endl '\n'


int main() {
  int n;
  cin >> n;
  vl a(n);
  rep (i, n) {
    cin >> a[i];
  }

  sort(all(a));
  rep (i, n - 1) {
    if (a[i] < 0 and a[i + 1] < 0) {
      a[i] *= -1;
      a[i + 1] *= -1;
    }
  }

  ll ans = 0;
  rep (i, n) {
    ans += a[i];
  }

  rep (i, n - 1) {
    if (a[i] < 0 and a[i + 1] >= 0) {
      chmax(ans, ans - (a[i] + a[i + 1]) + (-(a[i] + a[i + 1])));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <stdio.h>
#define N 8
int Q[N][N] ={0};

void printQueen( )
{
  int i,j;
  for(i = 0 ; i < N ;i++){
    for(j = 0 ; j < N ;j++){
      if(Q[i][j] == 1){
	printf("Q");
      }
      else printf(".");
    }
    printf("\n"); 
  }
}


int check(int b,int a){
  int i, j;
    
  for(i=0;i<N;i++){
    if(i!=a && Q[b][i]==1){
      return 0;
    }
  }
  for(i=0;i<N;i++){
    if(i!=b &&Q[i][a]==1){
      return 0;
    }
  }
  i=b-1;
  j=a+1;
  while(i>=0 && j<N){
    if(Q[i--][j++]==1){
      return 0;
    }
  }
  i=b-1;
  j=a-1;
  while(i>=0 && j>=0){
    if(Q[i--][j--]==1){
      return 0;
    }
  }

  i=b+1;
  j=a-1;

  while(i<N && j>=0){
    if(Q[i++][j--]==1){
      return 0;
    }
  }

  i=b+1;
  j=a+1;
  while(i<N && j<N){
    if(Q[i++][j++]==1){
      return 0;
    }
  }

  return 1;
}


int setQueen(int X){
  int i;
  for(i=0;i<N;i++){
    if(Q[X][i]==1){
      if(!setQueen(X+1)){
	return 0;
      }
    }
  }

  if(X==N){
    printQueen();
    return 1;
  }
  else {
    for(i = 0 ; i < N ; i++){
      if(Q[X][i]==0 && check(X,i)){
	Q[X][i]=1;
	if(!setQueen(X+1)){
	  Q[X][i]=0;
	}
      }
    }
  }

  return 0;
}

int main( ){
  int i,j,a,b,number,A=0;
  scanf("%d",&number);
  for(i = 0; i < number; i++){
    scanf("%d %d",&b,&a);
    Q[b][a]=1;
  }
  i= setQueen(A);
  return 0;
}



Measured memory_bytes: 2112
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws Exception
	{
		int n=nextInt();
		int m=nextInt();
		int a[]=new int[n+1];
		int p2=-1;
		boolean flag=true;
		for(int i=1;i<=n;i++)
		{
			a[i]=nextInt()/2;
			int c=0;
			for(int j=a[i];j%2==0;j=j/2)
				c++;
			if(p2==-1)
				p2=c;
			else if(p2!=c)
				flag=false;
		}
		if(!flag)
		{
			out.println(0);
			return;
		}
		long lcm=1;
		for(int i=1;i<=n;i++)
		{
			lcm=lcm(lcm,a[i]);
			if(lcm>m)
			{
				out.println(0);
				return;
			}
		}
		out.println((m/lcm+1)/2);
	}
	long lcm(long a,long b)
	{
		return a*b/gcd(a,b);
	}
	long gcd(long a,long b){
	    if(a==0)
	        return b;
	    return gcd(b%a,a);
	}

	 
	///////////////////////////////////////////////////////////

	public void run()throws Exception
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws Exception{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws Exception{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws Exception{
		return br.readLine();
	}
	int nextInt()throws Exception{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws Exception{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws Exception{
		return Double.parseDouble(nextToken());
	}
}

Measured memory_bytes: 47392
#include<iostream>
using namespace std;
int main(){
  int n;
  cin>>n;
  int a[n],b=0,c=0,x=1,k=-1;
  for(int i=0;i<n;i++)
  cin>>a[i];
  for(int i=0;i<n;i++){
    if(a[i]==x){
        c++;
        x++;
        continue;
    }
    else{
        b++;
        continue;
    }
  }
  if(c==0&&b==n)
    cout<<k;
  else if(c==n)
    cout<<'0';
  else
    cout<<b;
}


Measured memory_bytes: 4416
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) ((x)&(-x))
typedef long long LL;

const int maxm = 2e5+5;
LL n, k;

LL buf[maxm];

bool check(LL x) {
    LL cnt = 0, i, j;
    for(i = 0; i < n; ++i) {
        if(buf[i]*buf[i] <= x) cnt--;
        if(buf[i] > 0) {
            j = (x / buf[i]) + 5;
            while(j*buf[i] > x)--j;
            LL pos = upper_bound(buf, buf+n, j) - buf;
            cnt += pos; 
        } else if(buf[i] < 0) {
            j = x / buf[i] - 5;
            while(j*buf[i]>x)++j;
            LL pos = lower_bound(buf, buf+n, j) - buf;
            cnt += n - pos;
        } else {
            if(x >= 0) cnt += n;
        }
    }
    cnt /= 2;
    return cnt >= k;
}

void run_case() {
    cin >> n >> k;
    for(int i = 0; i < n; ++i) cin >> buf[i];
    sort(buf, buf+n);
    LL l = -(1LL<<60), r = 1LL<<60, ans, mid;
    while(l <= r) {
        mid = (l+r)>>1;
        if(check(mid)) {
            ans = mid;
            r = mid-1;
        } else
            l = mid+1;
    }
    cout << ans;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    //cout.setf(ios_base::showpoint);cout.precision(8);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    map<ll, ll> m;
    for (ll i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        m[a]++;
    }
    ll ans = 0;
    for (auto i : m)
    {
        if (i.second % 2 != 0)
            ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 6528
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

MOD = 998244353

N = int(read())

import numpy as np

def cumprod(arr,MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)
    for n in range(1,Lsq):
        arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD
    for n in range(1,Lsq):
        arr[n] *= arr[n-1,-1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U,MOD):
    x = np.arange(U,dtype=np.int64); x[0] = 1
    fact = cumprod(x,MOD)
    x = np.arange(U,0,-1,dtype=np.int64); x[0] = pow(int(fact[-1]),MOD-2,MOD)
    fact_inv = cumprod(x,MOD)[::-1]
    return fact,fact_inv

U = 10**7 + 10
fact, fact_inv = make_fact(U,MOD)

x = np.full(U,2,dtype=np.int64); x[0] = 1
pow2 = cumprod(x,MOD)

n = N//2
comb = fact_inv[:n] * fact_inv[N:N-n:-1] % MOD * fact[N] % MOD

x = (comb * pow2[:n] % MOD).sum()
answer = pow(3,N,MOD) - x - x
answer %= MOD
print(answer)

Measured memory_bytes: 676500
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


N, M = map(int, input().split())
if N >= M:
    s1 = input()
    s2 = input()
else:
    N, M = M, N
    s2 = input()
    s1 = input()


g = gcd(N, M)
lcm = N*M//g
ans = lcm
if N == M:
    if s1 == s2:
        ans = lcm
    else:
        ans = -1
else:
    if any(i != j for i, j in zip(s1[::N//g], s2[::M//g])):
        ans = -1
    else:
        ans = lcm
# else:
#    if s1[0] == s2[0]:
#        ans = lcm
#    else:
#        ans = -1
print(ans)


Measured memory_bytes: 3316
def to_xyi(str, target):
  index = 0
  for s in list(str):
    if target == int(s):
      x = index%4
      if index < 4:
        y = 0
      else:
        y = 1
      return (x, y, index)
    index += 1

def zero_swap(str, mx, my):
  zx, zy, zi = to_xyi(str, 0)

  for index in range(len(list(str))):
    sx, sy, si = to_xyi(str, index)
    if (zx + mx) == sx and (zy + my) == sy:
      nstr = []
      for s in list(str):
        if s == str[zi]:
          nstr.append(str[si])
        elif s == str[si]:
          nstr.append(str[zi])
        else:
          nstr.append(s)
      return ''.join(nstr)

rules = (
  (lambda x, y : x <= 2, lambda str : zero_swap(str,  1,  0)),
  (lambda x, y : y == 0, lambda str : zero_swap(str,  0,  1)),
  (lambda x, y : x >= 1, lambda str : zero_swap(str, -1,  0)),
  (lambda x, y : y == 1, lambda str : zero_swap(str,  0, -1)),
)

goal = '01234567'

move_num = {goal: 0}
queue = [goal]

while True:
  if len(queue) == 0: break
  search_map = queue.pop(0)

  for can_move, move in rules:
    x, y, i = to_xyi(search_map, 0)
    if not can_move(x, y): continue
    next_map = move(search_map)
    if move_num.has_key(next_map): continue
    move_num[next_map] = move_num[search_map] + 1
    queue.append(next_map)

import sys
for s in sys.stdin:
  s = s.replace(' ', '').rstrip()
  print move_num[s]

Measured memory_bytes: 5884
#include <bits/stdc++.h>
#include <cmath>
#include <string>

using namespace std;

int main(){

	string s, t;
	int ans=0;

	cin>> s;
	cin>> t;

	if(s[0]==t[0]) ans++;
	if(s[1]==t[1]) ans++;
	if(s[2]==t[2]) ans++;

	cout<< ans << endl;

}

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

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=200009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}

int h,w,n;
string s,t;
int p,q;
void bye()
{
    cout<<"NO"<<endl;
    exit(0);
}
void chk_lft()
{
     int x=p,y=q;
     f(i,0,n-1)
     {
         if(s[i]=='L')y--;
         if(y<=0)bye();
         if(t[i]=='R' && y<w)y++;
     }
}
void chk_rgt()
{
     int x=p,y=q;
     f(i,0,n-1)
     {
         if(s[i]=='R')y++;
         if(y>w)bye();
         if(t[i]=='L' && y>1)y--;
     }
}
void chk_up()
{
     int x=p,y=q;
     f(i,0,n-1)
     {
         if(s[i]=='U')x--;
         if(x<=0)bye();
         if(t[i]=='D' && x<h)x++;
     }
}
void chk_down()
{
     int x=p,y=q;
     f(i,0,n-1)
     {
         if(s[i]=='D')x++;
         if(x>h)bye();
         if(t[i]=='U' && x>1)x--;
     }
}
 main()

{
    fast
    cin>>h>>w>>n;
    cin>>p>>q;
    cin>>s>>t;
    chk_lft();
    chk_rgt();
    chk_up();
    chk_down();
    cout<<"YES"<<endl;
    return 0;

}





































Measured memory_bytes: 3964
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;


int main(){

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

    cin >> N;

    ll ansleft = 1;
    ll target = 2;
    while(target*target<=N){
        if(N%target==0){
            ansleft=target;
        }

        target++;
    }

    cout << ansleft + N/ansleft - 2 << endl;
    

}

Measured memory_bytes: 3572