akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ll n, cnt = 0;
	cin>>n;
	if(n==1||n==2||n==4){
		cout<<4<<endl;
		return 0;
	}
	while(n!=4){
		if(n%2==0)	n/=2;
		else		n=3*n + 1;
		cnt++;
		if(n==4)	break;
	}
	cout<<cnt+4;
	return 0;
}


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


 int euclid(long long int a, long long int b){
  if (b < a) {
    long long int c = b;
    b=a;
    a=c;
  }
  int r=a%b ;
  while(r)
  {
  a=b;
  b=r;
  r=a%b;
  }
return b;
}
int main(){
  long long int a,b;
  while(scanf("%d %d",&a,&b)!=EOF){
    cout << euclid(a,b) << " "<<a*b/(euclid(a,b))<<endl;
}
}



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

using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define allpt(v) (v).begin(), (v).end()
#define allpt_c(v) (v).cbegin(), (v).cend()
#define allpt_r(v) (v).rbegin(), (v).rend()


const int mod = 1e9 + 7;
const string wsp = " ";
const string tb = "\t";
const string rt = "\n";

template <typename T>
void show1dvec(const vector<T> &v)
{
    if (v.size() == 0)
        return;
    int n = v.size() - 1;
    rep(i, n) cout << v[i] << wsp;
    cout << v[n] << rt;
    return;
}

template <typename T>
void show2dvec(const vector<vector<T>> &v)
{
    int n = v.size();
    rep(i, n) show1dvec(v[i]);
}

template <typename T, typename S>
void show1dpair(const vector<pair<T, S>> &v)
{
    int n = v.size();
    rep(i, n) cout << v[i].first << wsp << v[i].second << rt;
    return;
}

template <typename T, typename S>
void pairzip(const vector<pair<T, S>> &v, vector<T> &t, vector<T> &s)
{
    int n = v.size();
    rep(i, n)
    {
        t.push_back(v[i].first);
        s.push_back(v[i].second);
    }
    return;
}

template <typename T>
void maxvec(vector<T> &v)
{
    T s = v[0];
    int n = v.size();
    rep(i, n - 1)
    {
        if (s > v[i + 1])
        {
            v[i + 1] = s;
        }
        s = v[i + 1];
    }
}

template <typename T, typename S>
bool myfind(T t, S s)
{
    return find(t.cbegin(), t.cend(), s) != t.cend();
}

vector<int> make_kmp_table(string t)
{
    int lt = t.length();
    VI kmptable(lt, 0);
    kmptable[0] = -1;

    return kmptable;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    // int n;
    // string s, t;
    // cin >> n >> s;
    // VL dp(n + 1, 0ll);
    // vector<set<int>> callspell(n);
    // dp[0] = 1;
    // rep(i, n)
    // {
    //     cin >> t;
    // }

    // rep(i, n)
    // {
    //     for (int z : callspell[i])
    //     {
    //         dp[i + z - 1] += dp[i - 1];
    //         dp[i + z - 1] %= mod;
    //     }
    // }

    // cout << dp[n] << rt;

    int n, x, y;
    cin >> n;
    VI v(n), seq;
    rep(i, n)
    {
        cin >> x;
        v[x - 1] = i;
    }

    x = 0, y = -1;
    rep(i, n)
    {
        if (y <= v[i])
        {
            x++;
        }
        else
        {
            seq.push_back(x);
            x = 1;
        }
        y = v[i];
        if (i == n - 1)
            seq.push_back(x);
    }
    cout << n - *max_element(allpt_c(seq)) << rt;
    return 0;
}


Measured memory_bytes: 2168
#include<stdio.h>

int n, A[50];

// 入力値の M から選んだ要素を引いていく再帰関数
int solve(int i, int m) {
  if ( m == 0 ) return 1;
  if ( i >= n ) return 0;
  int res = solve(i + 1, m) || solve(i + 1, m - A[i]);
  return res;
}

int main() {
  int q, M, i;

  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  scanf("%d", &q);
  for ( i = 0; i < q; i++ ) {
    scanf("%d", &M);
    if ( solve(0, M) ) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}


Measured memory_bytes: 2612
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int x = scan.nextInt();
        int a = scan.nextInt();
        int b = scan.nextInt();
        int da = Math.abs(x-a);
        int db = Math.abs(x-b);
        if (da < db) {
            System.out.println("A");
        } else {
            System.out.println("B");
        }
    }
}


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

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

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)







using P = pair<ll, ll>;

int main() {
    ll x, y, z;
    cin >> x >> y >> z;
    ll n = x + y + z;;
    vector<pair<ll, pair<ll, pair<ll ,ll>>>> v(n);
    REP(i, n){
        cin >> v[i].second.first >> v[i].second.second.first >> v[i].second.second.second;
        v[i].first = v[i].second.first - v[i].second.second.first;
    }

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

    vector<ll> dp1(n);
    ll sumy = 0, sumz = 0;
    priority_queue<P, vector<P>, greater<P>> que1;
    for(ll i = 0; i < y; i++){
        sumy += v[i].second.second.first;
        que1.push({v[i].second.second.first - v[i].second.second.second, v[i].second.second.second});
    }
    dp1[y - 1] = sumy;
    for(ll i = y; i < n - x; i++){
        sumy += v[i].second.second.first;
        que1.push({v[i].second.second.first - v[i].second.second.second, v[i].second.second.second});
        auto tmp = que1.top(); que1.pop();
        sumy -= tmp.first + tmp.second;
        sumz += tmp.second;
        dp1[i] = sumy + sumz;
    }

    vector<ll> dp2(n);
    sumz = 0;
    ll sumx = 0;
    priority_queue<P, vector<P>, greater<P>> que2;
    for(ll i = n - 1; i >= n - x; i--){
        sumx += v[i].second.first;
        que2.push({v[i].second.first - v[i].second.second.second, v[i].second.second.second});
    }
    dp2[n - x] = sumx;
    for(ll i = n - x - 1; i >= y; i--){
        sumx += v[i].second.first;
        que2.push({v[i].second.first - v[i].second.second.second, v[i].second.second.second});
        auto tmp = que2.top(); que2.pop();
        sumx -= tmp.first + tmp.second;
        sumz += tmp.second;
        dp2[i] = sumx + sumz;
    }

    ll ans = 0;
    for(ll i = y - 1; i < n - x; i++){
        cerr << dp1[i] << " " << dp2[i + 1] << endl;
        ans = max(ans, dp1[i] + dp2[i + 1]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 7412
def print_array(A, N):
    for i in xrange(N - 1):
        print str(A[i]),

    print A[N - 1]

def selectionSort(A, N):
    swap_num = 0
    for i in xrange(0, N):
        minj = i
        for j in xrange(i, N):
            if A[j] < A[minj]:
                minj = j

        if minj != i:
            swap_num += 1
            temp = A[i]
            A[i] = A[minj]
            A[minj] = temp

    return swap_num

def main():
    N = int(raw_input())
    A = []

    for num in raw_input().split():
        A.append(int(num))

    temp = selectionSort(A, N)
    print_array(A, N)

    print temp


if __name__ == "__main__":
    main()

Measured memory_bytes: 6444
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    string s, t;
    cin >> s >> t;
    rep(i, s.size())
    {
        if (s == t)
        {
            cout << "Yes" << endl;
            return 0;
        }
        s = s.substr(1) + s[0];
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
h,n = map(int,input().split())
inf = 10**10
magic = [list(map(int,input().split())) for i in range(n)]
max_a = max(a for a,b in magic)
dp = [inf for i in range(h + max_a)]
dp[0] = 0
for i in range(1,h+max_a):
    dp[i] = min(dp[i-a] + b for a,b in magic)
print(min(dp[h:]))

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

int main(){
  int N;
  cin >> N;
  vector <int> a(N);
  vector <int> b(N);
  vector <int> c(N,0);
  int A,B=0;
  for (int i=0;i<N;i++){
    cin>>a[i];
  }
  for (int i=0;i<N;i++){
    cin>>b[i];
  }

  for (int i=0;i<N;i++){
    c[i]=i+1;
  }
  int count=1;

    do {
          if(c==a){
            A=count;
          }
          if(c==b){
            B=count;
          }
          count++;
        }
    while(next_permutation(c.begin(),c.end()));
  cout<<abs(B-A)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool cmp(int x,int y){
	return x>y;
} 

int main(){
	long long N,K,tmp;
	vector <long long> H;
	cin>>N>>K;
	for(int i=1;i<=N;i++){
		cin>>tmp;
		H.push_back(tmp);
	}
	sort(H.begin(),H.end(),cmp);
	tmp=0;
	for(int i=K;i<H.size();i++)tmp+=H[i];
	cout<<tmp;
} 

Measured memory_bytes: 2420
import java.io.IOException;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int MAX = 1000000;
		boolean[] prime = new boolean[MAX + 1];
		for (int i = 4; i <= MAX; i += 2) {
			prime[i] = true;
		}
		for (int i = 3; i <= Math.sqrt(MAX); i += 2) {
			if (!prime[i]) {
				for (int j = i * 3; j <= MAX; j += i * 2) {
					prime[j] = true;
				}
			}
		}
		while (true) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			if ((n | m) == 0)
				break;
			int[] a = new int[n];
			int min = Integer.MAX_VALUE;
			boolean[] f = new boolean[m + 1];
			for (int i = 0; i < n; i++) {
				int s = scanner.nextInt();
				min = Math.min(s, min);
				a[i] = s;
				for (int j = s; j <= m; j += s) {
					f[j] = true;
				}
			}
			int max = 0;
			for (int i = min; i <= m; i++) {
				if (!f[i])
					for (int j = 0; j < n; j++) {
						if (i - a[j] >= 0 && f[i - a[j]]) {
							f[i] = true;
							break;
						}
					}
				if (f[i] && !prime[i])
					max = i;
			}
			System.out.println(max == 0 ? "NA" : max);

		}

	}
}

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

N=int(input())
P=[tuple(map(int,input().split())) for i in range(N)]

PLUS=[]
MINUS=[]

for x,y in P:
    PLUS.append(x+y)
    MINUS.append(x-y)

PLUS.sort()
MINUS.sort()

print(max(PLUS[-1]-PLUS[0],MINUS[-1]-MINUS[0]))



Measured memory_bytes: 124876
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit
#include <cstdio>	// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
string FILE_NAME = "testcase.0097";
string NAME;
string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

ll dp[101][1001];

int main()
{
//	cut here before submit 
#if DEBUG
	NAME = FILE_NAME;
	int CNT = 1;
	NAME += itos (CNT );
	while (freopen (NAME.c_str() , "r", stdin ) != NULL ) {
#endif
	ios_base::sync_with_stdio(0);
	int n, s;
	while (cin >> n >> s, n  ){
		memset (dp, 0LL, sizeof (dp ) );
		dp[0][0] = 1LL;
		for (int i = 0; i <= 100; i++ ){
			for (int j = 9; j >= 0; j-- ){
				for (int k = 0; i + k <= 1000; k++ ){
					dp[j+1][i+k] += dp[j][k];
				} // end for
			} // end for
		} // end for
		cout << dp[n][s] << endl;
	} // end rep
#if DEBUG
	CNT++;	// cut here before submit
	NAME = FILE_NAME;
	NAME += itos (CNT );
	} // end loop; cut here before submit
#endif			
	return 0;
}

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

int main(void){
    // Your code here!
    
    string S;
    cin >> S;
    int S_size = S.size();
    vector<int> S_number(4);
    
    for(int i = 0; i < S_size; i++){
        S_number.at(i) = S[i] - '0';
    }

    for(int i = 0; i <= 1; i++){
        int ans = 0;
        for(int j = 0; j <= 1; j++){
            for(int k = 0; k <= 1; k++){
                if(i == 0)
                    ans = S_number.at(0) - S_number.at(1);
                else
                    ans = S_number.at(0) + S_number.at(1);
                if(j == 0)
                    ans = ans - S_number.at(2);
                else
                    ans = ans + S_number.at(2);
                if(k == 0)
                    ans = ans - S_number.at(3);
                else
                    ans = ans + S_number.at(3);
                    
                if(ans == 7){
                    if(i == 0)
                        cout << S_number.at(0) << "-" << S_number.at(1);
                    else
                        cout << S_number.at(0) << "+" << S_number.at(1);
                    if(j == 0)
                        cout << "-" << S_number.at(2);
                    else
                        cout << "+" << S_number.at(2);
                    if(k == 0)
                        cout << "-" << S_number.at(3)<< "=7" << endl;
                    else
                        cout << "+" << S_number.at(3) << "=7" << endl;
                        
                    return 0;
                }
            }
        }
    }
    
}


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

int main(){
  int n,k;
  cin >> n >> k;
  int ans=0,a;
  for(int i=0;i<n;i++){
    cin >> a;
    ans+=min(abs(a),abs(k-a))*2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3588
import java.util.ArrayList;
import java.util.Scanner;

class Main{

	static int N;
	static int M;
	static 		ArrayList<ArrayList<Integer>> map;
	static boolean[] used;
	static int f = 0;
	static int s = 0;

	static long mod = 1000000007;
	static ArrayList<Integer> saitan;




	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		int[] a = new int[n];

		boolean[] color = new boolean[8];
		int godcolor = 0;


		for(int i = 0;i < n;i++){
			a[i] =sc.nextInt();
			if(a[i] < 400){
				color[0] = true;
			}else if(a[i] < 800){
				color[1] = true;

			}else if(a[i] < 1200){
				color[2] = true;

			}else if(a[i] < 1600){
				color[3] = true;

			}else if(a[i] < 2000){
				color[4] = true;

			}else if(a[i] < 2400){
				color[5] = true;

			}else if(a[i] < 2800){
				color[6] = true;

			}else if(a[i] < 3200){
				color[7] = true;

			}else{
				godcolor++;
			}
		}

		int ansmax = 0;
		int ansmin = 0;
		int count = 0;

		for(int i = 0;i <8;i++){
			if(color[i]){
				count++;
			}
		}
		
		ansmax = count + godcolor;
		ansmin = count;
		if(ansmin == 0){
			ansmin = 1;
		}
		System.out.println(ansmin + " "+ansmax);
		



	}
	static int lowerbond(int k, int[] data){		//kより小さい最小の値をdataの中から探し、返す二分探索
		int min = -1;
		int max = data.length;

		while(max-min > 1){
			int mid = (max+min)/2;
			if(data[mid] >= k){
				max = mid;
			}else{
				min = mid;
			}
		}
		return data[max];
	}


	static long cal(int n){
		long x = (long)n;
		for(int i = n-1;i > 0;i--){
			//	System.out.println(i);
			x *= i;
			x %= mod;
		}
		return x;
	}

}




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

int N,M;
int  X[100010];
int ans;

int main(void)
{
    cin >> N >> M;

    

    int len[100010];
    int  ad[100010];


    for(int i=0;i<M;i++)
    {
        cin >> X[i];
    }

    if(N>=M)
    {
        cout << 0 << endl;

        return 0;
    }

    sort(X,X+M);

    int max=0;

    for(int i=0;i<M;i++)
    {
        len[i]=abs(X[i]-X[i+1]);

         ad[i]=len[i];
    }

    sort(ad,ad+(M-1));

    for(int i=0;i<M-N;i++)
    {
        ans+=ad[i];
    }

    cout << ans << endl;

    


    return 0;
}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define UNIQUE(v) { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); }
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) { cerr << "[DEBUG] " #q ": ["; REP(i, (q).size()) { cerr << (q)[i] << (i == i_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; }
template<class T> T gcd(const T &a, const T &b) { return a < b ? gcd(b, a) : b ? gcd(b, a % b) : a; }
template<class T> T lcm(const T &a, const T &b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
#define CHOKUDAI_ const
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using cll = DANCE_ DANCE_ CHOKUDAI_;
using  ld = long double;
using namespace std;

// モジュール


// 処理内容
int main() {
    
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];

    vector<ll> abits(40);
    REP(i, n) {
        REP(j, 40) {
            if (a[i] & (1LL << j)) {
                ++abits[j];
            }
        }
    }

    ll i = 1, j = 0;
    while (i <= k) {
        i <<= 1;
        ++j;
    }
    i >>= 1;
    --j;

    bool is_free = false;
    ll argmax = 0;
    for (; i; i >>= 1, --j) {
        bool is_1_majority = abits[j] > n - abits[j];
        if (is_free) {
            if (!is_1_majority) {
                argmax |= i;
            }
        } else if (k & i) {
            if (!is_1_majority) {
                argmax |= i;
            } else {
                is_free = true;
            }
        }
    }
    DUMP(argmax);

    ll ans = 0;
    REP(i, n) {
        ans += argmax ^ a[i];
    }
    cout << ans << endl;
    
}

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

#define mem(arr, i) fill(arr, arr + sizeof(arr), i)
#define MEM(arr, i) memset(arr, i, sizeof(arr))
#define Push push_back
#define Pair make_pair
#define ALL(x) x.begin(), x.end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef pair<pll,lli> p3l;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<p3l> v3L;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv(maxN+5, 1);
vcL fac(maxN+5, 1);

void ADD(lli &x, lli y) {
	x += y;
	if (x >= mod) x -= mod;
	if (x < 0) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = (x % mod + mod) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if (e & 1) MUL(ans, b);
		MUL(b, b);
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow(n, mod - 2);
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod - mod / i) * inv[mod % i] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[i - 1] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if (a < b) return 0;

	MUL(ans, inv[fac[a - b]]);
	MUL(ans, inv[fac[b]]);
	MUL(ans, fac[a]);

	return ans;
}

lli Lucas(lli n, lli m) {
	if (m == 0) return 1;
	return cm(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas(n, m);
}

/// coding area ///

const lli maxn = 1E5;

void precal() {

	return;
}

void solve() {
	lli n;
	cin >> n;
	cout << (n / 2) * (n - n / 2) << '\n';
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



Measured memory_bytes: 3328
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>

#include<functional>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int N,M;
int bN[100010];
bool red[100010];
int main(){
    cin>>N>>M;
    for(int i=1;i<=N;i++){
        bN[i]=1;
    }
    red[1]=true;
    for(int i=0;i<M;i++){
        int x,y;
        cin>>x>>y;
        if(red[x]){
            red[y]=true;
        }
        bN[x]--;bN[y]++;
        if(bN[x]==0){
            red[x]=false;
        }
    }
    int ans=0;
    for(int i=1;i<=N;i++){
        if(red[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 768
from functools import lru_cache
from sys import setrecursionlimit

setrecursionlimit(900010)

N = int(input())
a = list(map(int, input().split()))

@lru_cache(maxsize=None)
def f(n):
	if n == 0: return 0
	if n == 1: return abs(a[0] - a[1])
	return min(f(n - 1) + abs(a[n - 1] - a[n]), f(n - 2) + abs(a[n - 2] - a[n]))

print(f(N - 1))


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;





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

    ll n, p;
    cin>>n>>p;

    map<ll,ll> mp;
    for (ll i=2; i*i<=p; i++) {
	while (p%i==0) {
	    mp[i]++;
	    p/=i;
	}
    }
    if (p>1) mp[p]++;


    ll res = 1;
    for (auto x: mp) {
	ll pw = x.second/n;
	while (pw--) res *= x.first;
    }

    cout<<res<<endl;    
    return 0;
}


Measured memory_bytes: 3668
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int N,K;
int C[5555],R[5555];
vector<int> G[5555];
struct state{
  int id, c;
  bool operator<( const state &st ) const {
    return c > st.c; 
  }
};
vector<int> nG[5555];

void init(){
  for(int i=0;i<N;i++){
    G[i].clear(); nG[i].clear();
  }   
}

void bfs(int st){
  queue<state> q;
  vector<int> h(N,-1);
  q.push( (state){ st, 0 } );
  h[st] = 0;
  while( !q.empty() ){
    state p = q.front(); q.pop();
    if( p.c >= R[st] ) break;
    int nc = p.c + 1;
    for(int to : G[p.id]) {
      if( h[to] == -1 ){
	h[to] = nc;
	q.push( (state){ to, nc } );
	nG[st].push_back( to );
      }
    }
  }
}

const int INF = 1000000009;
int dijk(int st){
  priority_queue<state> q;
  vector<int> h(N,INF);  
  q.push( (state){ st, 0 } );
  h[st] = 0;
  while( !q.empty() ){
    state p = q.top(); q.pop();
    if( h[p.id] < p.c ) continue;
    if( p.id == N-1 ) return h[p.id];
    int nc = p.c + C[p.id];
    for(int to : nG[p.id]){
      if( h[ to ] > nc ) {
	h[ to ] = nc;
	q.push( (state){ to, nc } );
      }
    }
  }
  return h[N-1];
}

int main(){
  while( cin >> N >> K && (N||K) ) {
    init();
    for(int i=0;i<N;i++){
      cin >> C[i] >> R[i];
    }
    for(int i=0;i<K;i++){
      int a, b; cin >> a >> b; --a; --b;
      G[a].push_back( b );
      G[b].push_back( a );
    }
    for(int i=0;i<N;i++) bfs(i);
    cout << dijk( 0 ) << endl;
  }
  return 0;
}

Measured memory_bytes: 70328
import sys
input = sys.stdin.readline
from collections import deque
import marshal


class Graph:
    def __init__(self, n, directed=False, decrement=True, destroy=False, edges=[]):
        self.n = n
        self.directed = directed
        self.decrement = decrement
        self.destroy = destroy
        self.edges = [set() for _ in range(self.n)]
        self.parent = [-1]*self.n
        self.info = [-1]*self.n
        for x, y in edges:
            self.add_edge(x,y)

    def add_edge(self, x, y):
        if self.decrement:
            x -= 1
            y -= 1
        self.edges[x].add(y)
        if self.directed == False:
            self.edges[y].add(x)

    def add_adjacent_list(self, i, adjacent_list):
        if self.decrement:
            self.edges[i] = set(map(lambda x: x - 1, adjacent_list))
        else:
            self.edges[i] = set(adjacent_list)

    def bfs(self, start=1, goal=-1, time=0, save=False):
        """
        :param start: スタート地点
        :param goal: ゴール地点
        :param save: True = 前回の探索結果を保持する
        :return: （ループがあっても）最短距離。存在しなければ -1
        """
        if self.decrement:
            start -= 1
            goal -= 1
        if not save:
            self.parent = [-1] * self.n
        p, t = start, time
        self.parent[p] = -2
        next_set = deque([(p, t)])

        while next_set:
            p, t = next_set.popleft()
            for q in self.edges[p]:
                if t>=2:
                    continue
                if self.parent[q] != -1:
                    continue
                if q == goal:
                    return True
                self.parent[q] = p
                next_set.append((q, t + 1))
        return False


N, M = map(int, input().split())
graph = Graph(N, directed=False, decrement=True, destroy=False)
for _ in range(M):
    x, y = map(int, input().split())
    graph.add_edge(x, y)

if graph.bfs(start=1, goal=N, time=0, save=False):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")




Measured memory_bytes: 158576
class Integer

  # O(min(n-k,k) log m)
  # combination: nPk / k! (mod p), note: m must be a prime number
  def cmb(k, m=10**9+7)
    n = self
    return 0 if k < 0 || n < k
    k = n - k if k > n - k
    n.prm(k, m) * k.prm(k,m).modinv(m) % m
  end

  # mod must be a prime number
  # O(log m)
  def modinv(mod = 10**9+7)
    pow(mod-2, mod)
  end

  # O(log n)
  def pow(n , mod = nil )
    a = self
    res = 1
    while n > 0
      if (n & 1) != 0
        res *= a
        res %= mod if mod
      end
      a *= a
      a %= mod if mod
      n >>= 1
    end
    res
  end

  # O(k)
  def prm(k, mod = nil)
    (0...k).reduce(1) do |res,i|
      res *= (self - i )
      res %= mod if mod
      res
    end
  end
end

x, y = gets.to_s.split.map{|t|t.to_i}

a =    2 * x -  y 
b =   - x + 2 * y 
 
ans = 0
if a % 3 == 0 and b % 3 == 0
  a = a / 3
  b = (b / 3)
  # p [a+b,a,b]
  ans = (a+b).cmb(a)
end

print(ans)



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

int main() {
    string in;
    cin>>in;
    int prev = -1, ans = -1,alen = -1,tlen = 0;
    for(int i=0; i<in.length(); ++i) {
        if(in[i] == 'e') {
            if(prev == 0) tlen = 1;
            else tlen++;

            if(tlen > alen) {
                ans = 0;
                alen = tlen;
            }
            prev = 0;
            i += 2;
        }else{
            if(prev == 1) tlen = 1;
            else tlen++;

            if(tlen > alen) {
                ans = 1;
                alen = tlen;
            }
            prev = 1;
            i += 6;
        }

    }

    if(ans) cout<<"chicken"<<endl;
    else cout<<"egg"<<endl;
}

Measured memory_bytes: 0
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
int N, c, ret; string s[509];
int main() {
	cin >> N; ret = N + 1;
	for (int i = 0; i < N; i++) cin >> s[i];
	for (int i = 0; i < N; i++) {
		c = 0;
		for (int j = 0; j < N; j++) {
			if (s[i][j] == '.') c++;
		}
		if (s[i][i] == '.') {
			c++;
			for (int j = 0; j < N; j++) {
				if (s[j][i] == '#') {
					c--; break;
				}
			}
		}
		ret = min(ret, c);
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (s[j][i] == '.') {
				ret++; break;
			}
		}
	}
	cout << (ret != 2 * N + 1 ? ret : -1) << endl;
	return 0;
}

Measured memory_bytes: 512
import sys

N = int(input())
t = [0 for i in range(N+1)]
x = [0 for i in range(N+1)]
y = [0 for i in range(N+1)]

for i in range(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())

for i in range(N):
    time = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if (time - dist) >= 0 and (time - dist) % 2 == 0:
        pass
    else:
        print("No")
        sys.exit()
print("Yes")


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

#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ppb pop_back
#define vll vector<ll>
#define vi vector<int>
#define endl "\n"

const ll INF = 1000000007;

/*
const int max_size = 100001;
int parent[max_size];
int Size[max_size];

int root(int x){
	while(x!=parent[x]){
		parent[x] = parent[parent[x]];
		x = parent[x];
	}
	return x;
}

void sunion(int x,int y){
	int rx = root(x);
	int ry = root(y);
	if(rx != ry){
		if(Size[rx] > Size[ry]){
			parent[ry] = parent[rx];
			Size[rx] += Size[ry];
		}
		else{
			parent[rx] = parent[ry];
			Size[ry] += Size[rx];
		}
	}
}
*/

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin >> t;
	while(t--){
		int n,k;
		cin >> n >> k;
		int h[n];
		for(auto &it : h) cin >> it;
		int dp[n+1];
		dp[0] = dp[1] = 0;
		int j=0;
		for(int i=2;i<=n;i++){
			j = max(1,i-k);
			dp[i] = INF;
			while(j<i){
				dp[i] = min(dp[i],dp[j]+abs(h[i-1]-h[j-1]));
				j++;
			}
			// cout << dp[i] << " ";
		}
		cout << dp[n] << endl;
	}
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;


public class Main {
    public static void main(String[] args){
    	Scanner input = new Scanner(System.in);
    	int n = input.nextInt();
    	int num = 100000;
    	while(n != 0){
    		num *= 1.05;
    		String strnum = String.valueOf(num);
    		if(!strnum.substring(strnum.length()-3,strnum.length()).equals("000")){
    			num = Integer.parseInt(String.valueOf((Integer.parseInt(strnum.substring(0,strnum.length()-3))+1)).concat("000"));
    		}
    		n--;
    	}
    	System.out.println(num);
    }
}

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

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

  int cur = 0;
  int mul = 1;
  vector<int> cnt(2019);
  cnt[0] = 1;

  for (int i = s.size() - 1; i >= 0; --i) {
    cur += mul * (s[i] - '0');
    cur %= 2019;
    ++cnt[cur];
    mul = mul * 10 % 2019;
  }

  long long ans = 0;
  for (int c : cnt) {
    ans += (long long)(c - 1) * c / 2;
  }

  cout << ans << '\n';
}


Measured memory_bytes: 3296
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    string s,t;
    cin >> s >> t;
    deque<char> dq;
    REP(i,s.length()) {
        dq.push_back(s[i]);
    }

    REP(i,s.length()) {
        int ind = 0;
        bool ok = true;
        for (auto&& e: dq) {
            if (e != t[ind]) ok = false;
            ++ind;
        }
        if (ok) {
            cout << "Yes" << endl;
            return 0;
        }
        char top = dq.front(); dq.pop_front();
        dq.push_back(top);
    }

    cout << "No" << endl;
    return 0;
}

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

signed main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    int n;
    cin >> n;

    vector<vector<int>> a(n+1,vector<int>(n+1));

    for(int i = 2;i < n+1;i ++){
        int b = i;
        int j = 2;
        while(b > 1){
            if(b % j == 0){
                a.at(i).at(j) ++;
                b /= j;
                continue;
            }

            j ++;
        }
    }

    vector<int> sum(n+1,1);
    for(int i = 2;i < n+1;i ++){
        for(int j = 2;j < n+1;j ++){
            sum.at(i) += a.at(j).at(i);
        }
    }

    int ans = 1;
    for(int i = 1;i < n+1;i ++){
        ans *= sum.at(i);
        ans %= 1000000007;
    }

    cout << ans << endl;
}

Measured memory_bytes: 8192
n,m = map(int,input().split())
ans = [-1 for i in range(n)]
for i in range(m):
  s,c = map(int,input().split())
  if s == 1 and c == 0 and n != 1:
    print(-1)
    exit()
  if ans[s-1] != -1 and ans[s-1] != str(c):
    print(-1)
    exit()
  ans[s-1] = str(c)
for i in range(n):
  if ans[i] == -1:
    if i == 0 and n != 1:
      ans[0] = "1"
    else:
      ans[i] = "0"
print(int("".join(ans)))

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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll x, y, z;
    cin >> x >> y >> z;
    cout << z << " " << x << " " << y << endl;
    return 0;
}



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

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++){
        cin >> a[i];
    }
    vector<vector<ll>> dp(n, vector<ll>(n));
    for (int L = n - 1; L >= 0; L--){
        for (int R = L; R < n; R++){
            if (L == R) dp[L][R] = a[L];
            else {
                dp[L][R] = max(a[L] - dp[L + 1][R], a[R] - dp[L][R - 1]);
            }
        }
    }
    cout << dp[0][n - 1];
    return 0;
}


Measured memory_bytes: 70656
#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,t;
    cin >> N >> t;
    double ans = (double)0;
    for(int i=0; i<N; i++){
        int x,h;
        cin >> x >> h;
        ans = max(ans, (double) h * t / x);
    }
    cout << fixed << ans << endl;

    return 0;
}


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

using namespace std;

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

    int count;
    count = 0;

    for(int i=0;i<s.size();i++)
    {
        if(s[i] == 'p')
            count++;
    }

    cout << (int)s.size()/2 - count << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
  string s;
  cin >> s;
  int N = s.size();
  int ans = 0;
  for (int i=0; i<N; i++) {
    ans += s[i]-'0';
  }
  int m = stoi(s);
  if (m%ans == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

const int N = 200005;
string s;
int d[N][2];

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s;
	s = '~' + s;
	for(int i = 0 ; i < N ; i ++)
		d[i][0] = d[i][1] = LLONG_MIN;
	d[1][1] = 1;
	d[2][1] = (s[2] == s[1] ? LLONG_MIN : 2);
	d[2][2] = 1;
	for(int i = 1 ; i < s.size() ; i ++){
		d[i + 2][2] = max(d[i + 2][2], 1 + d[i][1]);
		d[i + 1][1] = max(d[i + 1][1], 1 + d[i][2]);
		if(i + 1 < s.size())
			if(s[i] != s[i + 1]) 
				d[i + 1][1] = max(d[i + 1][1], 1 + d[i][1]);
		if(i + 2 < s.size())
			if(s[i - 1] != s[i + 1] && s[i] != s[i + 2])
				d[i + 2][2] = max(d[i][2] + 1, d[i + 2][2]);
	}
	cout << max(d[s.size() - 1][1], d[s.size() - 1][2]);
}


Measured memory_bytes: 4300
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; using ll = long long; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

ll mpow(ll x, ll n) { ll y = 1; for (; n; n /= 2) { y = n % 2 ? y * x % MOD : y; x = x * x % MOD; } return y; }

struct Combination {
    vector<ll> fact, ifact;
    Combination(int n) : fact(n + 1), ifact(n + 1) {
        fact[0] = 1; for (int i = 0; i < n; ++i) fact[i + 1] = fact[i] * (i + 1) % MOD;
        ifact[n] = mpow(fact[n], MOD - 2); for (int i = n; i > 0; --i) ifact[i - 1] = ifact[i] * i % MOD;
    }
    ll operator ()(int n, int k) const { return k < 0 || k > n ? 0 : fact[n] * ifact[n - k] % MOD * ifact[k] % MOD; }
} C(2e5);

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

    bool rev = false;
    if (B > W) swap(B, W), rev = true;

    vector<ll> P(B + W), Q = P;

    ll inv2 = mpow(2, MOD - 2);
    rep(i, B, B + W) {
        P[i] = (P[i - 1] + C(i - 1, B - 1) * mpow(inv2, i) % MOD) % MOD;
    }
    rep(i, W, B + W) {
        Q[i] = (Q[i - 1] + C(i - 1, W - 1) * mpow(inv2, i) % MOD) % MOD;
    }

    vector<ll> ans(B + W);
    rep(i, B + W) {
        ans[i] = inv2 * (1 - P[i] + Q[i] + MOD) % MOD;
        if (rev) ans[i] = (1 - ans[i] + MOD) % MOD;
    }

    for (ll x : ans) write(x);
}


Measured memory_bytes: 9984
N, D = map(int, input().split())
X =[]
for i in range(N):
  X.append(list(map(int, input().split())))
ans=0
dist=0
for i in range(N):
  for j in range(N):
    if i < j:
      for k in range(D):
        dist += abs(X[i][k] - X[j][k])**2
      dist = dist**(1/2)
      if round(dist,0) == dist:
        ans += 1
      dist = 0
print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int D; cin >> D;
  vector<LL> c(26); cin >> c;
  vector<vector<LL>> s(D, vector<LL>(26, 0));
  for (int i = 0; i < D; ++i) cin >> s[i];

  for (int d = 0; d < D; ++d) cout << (d % 26) + 1 << endl;
}


Measured memory_bytes: 3720
import collections
N = int(input())
A = list(map(int,input().split()))
A_col = collections.Counter(A)
length = []
for k,v in A_col.items():
    if v >= 4:
        length.append(k)
    if v >= 2:
        length.append(k)
length.sort()
if len(length) <= 1:
    print(0)
else:
    print(length[-1]*length[-2])

Measured memory_bytes: 22072
prime = Array.new(1000000,true)
(2..1000).each do |i|
	j = i * i
	while j < 1000000
		prime[j] = false
		j += i
	end
end

while gets
	n = $_.to_i
	ans = 0
	(2..n).each do |i|
		ans += 1 if prime[i]
	end
	puts ans
end

Measured memory_bytes: 13900
#include<stdio.h>
int main(){
  int a,b;
  char ch;
  
  scanf("%d %c %d",&a,&ch,&b); 
  while(ch != '?'){
    switch(ch){
    case  '+':
    printf("%d\n",a+b);
    scanf("%d %c %d",&a,&ch,&b);
    break;

    case '-':
    printf("%d\n",a-b);
    scanf("%d %c %d",&a,&ch,&b);
    break;
  
    case '*':
    printf("%d\n",a*b);
    scanf("%d %c %d",&a,&ch,&b);
    break;

    case '/':
    printf("%d\n",a/b);
    scanf("%d %c %d",&a,&ch,&b);
    break;

    default:
    break;}}

  return 0;

}

Measured memory_bytes: 600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//数取得
		int N = sc.nextInt();
		String S = sc.next();
		sc.close();

		String answer = "No";

		if(N % 2 == 0) {
			String f = S.substring(0, N/2);
			String r = S.substring(N/2);

			if(f.equals(r)) {
				answer = "Yes";
			}
		}

		System.out.println(answer);
	}

}


Measured memory_bytes: 26964
x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
ans = r
for i in range(x):
    ans.append(p[i])
for i in range(y):
    ans.append(q[i])
r.sort(reverse=True)
print(sum(ans[:x+y]))

Measured memory_bytes: 112620
#include <stdio.h>
int main(void)
{
	int v[10];
	int m1,m2,m3;
	int i;
	
	for(i=0;i<10;i++)
		scanf("%d",&v[i]);
	
	m1=v[0];
	for(i=0;i<10;i++){
		if(v[i]>m1)
		m1=v[i];
	}
	for(i=0;i<10;i++){
		if(v[i]==m1){
			v[i]=-1;
			break;
		}
	}
	
	m2=v[0];
	for(i=0;i<10;i++){
		if(v[i]>m2)
		m2=v[i];
	}
	for(i=0;i<10;i++){
		if(v[i]==m2){
			v[i]=-1;
			break;
		}
	}
	
	m3=v[0];
	for(i=0;i<10;i++){
		if(v[i]>m3)
		m3=v[i];
	}
	
	printf("%d\n%d\n%d\n",m1,m2,m3);
	
	return 0;
}

Measured memory_bytes: 600
from itertools import product

N, M = [int(s) for s in input().split()]
k = [0] * M
s = []
for i in range(M):
  in_list = [int(s) for s in input().split()]
  k = in_list[0]
  s.append(in_list[1:])
p = [int(s) for s in input().split()]

count = 0
for state in product(*([range(2)] * N)):
  for i in range(M):
    sum_on = 0
    for m in s[i]:
      if state[m - 1]:
        sum_on += 1
    if sum_on % 2 != p[i]:
      break
  else:
    count += 1
print(count)

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

using namespace std;

int main(){
       int a,b,c;
       cin>>a>>b>>c;
       if(a<c&&c<b)cout<<"Yes"<<endl;
      else if(a>c&&c>b)cout<<"Yes"<<endl;
     // else if(a<b&&b<<c)cout<<"Yes"<<endl;

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


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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)

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

int main(void) {
    int n, x, t, ans;
    vector<int> vc;
    ans=0;
    cin >> n >>x;
    REP(i,n){
        cin >> t;
        vc.push_back(t);
    }

    sort(vc.begin(), vc.end());
    REP(i,n){
        x -= vc[i];
        ans++;
    }
    while(1){
        x -= vc[0];
        if(x<0){
            break;
        }
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
	int K, X; cin >> K >> X;
	if (K * 500 >= X) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 256
def putQueen(i):
    while i < 8 and row[i]:i += 1
    if i == 8:
        for i in range(8):
            print(''.join(queen[i]))
    for j in range(8):
        if col[j] or dpos[i+j] or dneg[i-j+7]: continue
        queen[i][j] = 'Q'
        row[i] = col[j] = dpos[i+j] = dneg[i-j+7] = 1
        putQueen(i+1)
        queen[i][j] = '.'
        row[i] = col[j] = dpos[i+j] = dneg[i-j+7] = 0

k = int(input())
row = [0] * 8
col = [0] * 8
dpos = [0] * 15
dneg = [0] * 15
queen = [['.' for j in range(8)] for i in range(8)]

for i in range(k):
    r, c = map(int, input().split())
    row[r] = col[c] = dpos[r+c] = dneg[r-c+7] = 1
    queen[r][c] = 'Q'

putQueen(0)


Measured memory_bytes: 5616
#include <stdio.h>
int main()
{
  int i,x,y,a;
  scanf ("%d%d",&x,&y);
   
  if (x<y){
    i=x;
    x=y;
    y=i;
  }
  a=x%y;
  while(a!=0){
    x=y;  
    y=a;
    a=x%y;
  }
  printf ("%d\n",y);
  return 0;
}
 



Measured memory_bytes: 2044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); i++)

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);


ll gcd(ll a, ll b){  if(b==0){  return a; }   return gcd(b , a%b); }


int main() {

int n;
cin>>n;
ll a[n];
REP(i,n){
  cin>>a[i];
}

ll sum = 0;
ll num = 1987;
REP(i,n){
  sum += a[i];
}

cout<<sum-n<<"\n";

  
  return 0;
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }
template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N;
	string S; cin >> S;
	string T = S;
	N = S.size();
	reverse(T.begin(), T.end());

	bool flag = true;
	flag &= (T == S);
	

	T = S.substr(0, (N-1)/2);
	reverse(T.begin(), T.end());
	flag &= (T == S.substr(0, (N-1)/2));

	T = S.substr((N+1)/2, N-(N+1)/2);
	reverse(T.begin(), T.end());
	flag &= (T == S.substr((N+1)/2, N-(N+1)/2));

	cout << (flag ? "Yes" : "No") << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    v.push_back(k);
  }
  long long int sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += v[i] * v[j];
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256