akhauriyash/Code-Regression huggingface dataset:
from heapq import *
from collections import defaultdict

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab_dict = defaultdict(list)
for a, b in ab:
    ab_dict[a].append(-b)

ans = 0
hq = []
heapify(hq)

for i in range(1, 1+m):
    [heappush(hq, num) for num in ab_dict[i]]
    if hq == []:
        continue
    ans -= heappop(hq)
print(ans)

Measured memory_bytes: 50524
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int a,b;
    cin>>a>>b;
    int arr[7]={1,3,5,7,8,10,12};
    int arr2[4]={4,6,9,11};
    int i,cnt1=0,cnt2=0;
    for(i=0;i<7;i++){
        if(a==arr[i]){
            cnt1++;
        }
        if(b==arr[i]){
            cnt1++;
        }
    }
    for(i=0;i<4;i++){
        if(a==arr2[i]){
            cnt2++;
        }
        if(b==arr2[i]){
            cnt2++;
        }
    }
    if(cnt1==2||cnt2==2){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
x, n = map(int, input().split())
if n == 0:
  print(x)
  exit()
lst = list(map(int, input().split()))
dis = 10000
ans = 0
for i in range(300):
  if not i in lst:
    if abs(x-i) < dis:
      dis = abs(x-i)
      ans = i
print(ans)

Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;

ll fact[3000001];
ll invfact[3000001];

int main(){
    ll v,e,r;
    cin >> v >> e >> r;
    vector<pair<int,ll> > edge[v+1];
    for(int i = 0; i < e; i++){
        ll s,t,d;
        cin >> s >> t >> d;
        edge[s].push_back(make_pair(t,d));
    }

    vector<ll> ans(v+1, INF);
    priority_queue<pair<ll, ll>,vector<pair<ll,ll> >,greater<pair<ll,ll> > > q;
    q.push(make_pair(0,r));
    while(q.size() > 0){
        auto tmp = q.top();
        q.pop();
        ll w = tmp.first;
        ll p = tmp.second;
        if(ans[p] == INF) ans[p] = w;
        else continue;
        for(int i = 0; i < edge[p].size(); i++){
            q.push(make_pair(w+edge[p][i].second,edge[p][i].first));
        }
    }

    for(int i = 0; i < v; i++){
        if(ans[i] == INF){
            cout << "INF" << endl;
        } else {
            cout << ans[i] << endl;
        }
    }
    return 0;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

signed main(){
	int N,Q;
	cin>>N>>Q;
	vpint ev;
	rep(i,N){
		int s,t,x;
		cin>>s>>t>>x;
		s-=x;t-=x;
		s=2*s-1;
		t=2*t-1;
		ev.eb(s,x);
		ev.eb(t,x);
	}
	rep(i,Q){
		int d;cin>>d;
		ev.eb(2*d,i);
	}

	sort(all(ev));
	set<int>pos;


	vint ans(Q);
	for(auto &e:ev){
		int t,k;
		tie(t,k)=e;
		if(t&1){
			if(pos.find(k)!=pos.end())pos.erase(k);
			else pos.insert(k);
		}
		else{
			if(pos.size()==0)ans[k]=-1;
			else ans[k]=*pos.begin();
		}
	}
	rep(i,Q)printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 23396
import java.util.*;

public class Main{
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int n=sc.nextInt();
      int x=sc.nextInt();

      int[] l = new int[n];
      int[] d = new int[n+1];
      int cnt=1;

      for(int i=0;i<n;i++){
        l[i]=sc.nextInt();
      }

      d[0]=0;

      for(int i=1;i<=n;i++){
        d[i]=d[i-1]+l[i-1];
        if(d[i]<=x){
          cnt++;
        }
        else{
          break;
        }
      }

      System.out.println(cnt);


    }
}


Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
using tii = tuple<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
//#define INF (ll)1E9
#define INF INT_MAX
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

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

//constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

struct segtree {
	int N = 1;
	vi val;
	segtree(int n) {
		while (N < n) N *= 2;
		val = vi(2 * N);
		for (int i = 0; i < 2 * N; i++) {
			val[i] = 0;
		}
	}
	void add(int k, int a) {
		k += N;
		val[k] += a;
		while (k > 0) {
			k = k / 2;
			val[k] += a;
		}
	}
	int sum(int a, int b) { return sum(a, b, 1, 0, N); }
	int sum(int a, int b, int k, int l, int r) {
		if (r <= a || b <= l) return 0;
		if (a <= l && r <= b) return val[k];
		int m = (l + r) / 2;
		return sum(a, b, k * 2, l, m)+ sum(a, b, k * 2 + 1, m, r);
	}
};

int main(void) {
	int n, q;
	int a, b, c;
	cin >> n >> q;
	segtree st(n);
	//cout << st.val.size() << endl;
	rep(i, q) {
		cin >> a >> b >> c;
		if (a == 0) {
			st.add(b-1, c);
		}
		else cout << st.sum(b-1, c) << endl;
	}
	///cout << endl;
	//rep(i, st.val.size())cout <<i<<"  "<< st.val[i] << endl;
}




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

int main(){
    int H,W;
    cin >> H >> W;
    vector<vector<char>>grid(H,vector<char>(W));
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> grid.at(i).at(j);
        }
    }
    for(int i = 0; i < H; i++){
        bool isspace = true;
        for(int j = 0; j < W; j++){
            if(grid.at(i).at(j) == '#'){
                isspace = false;
                break;
            }
        }
        if(isspace){
            grid.erase(grid.begin() + i);
            H--;
            i--;
        }
    }

    for(int i = 0; i < W; i++){
        bool isspace = true;
        for(int j = 0; j < H; j++){
            if(grid.at(j).at(i) == '#'){
                isspace = false;
                break;
            }
        }
        if(isspace){
            for(int j = 0; j < H; j++){
                grid.at(j).erase(grid.at(j).begin() + i);
            }
            W--;
            i--;
        }
            
    }

    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cout << grid.at(i).at(j);
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define mod 1000000007
#define eps 0.000000001
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define sz(x) ((int)x.size())
#define ln(x) ((int)x.length())
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define dbg(x) cout<<#x<<": "<<x<<endl;
const double PI = acos(-1.0);
using namespace std;

void cp()
{
    int n,m,total=0;
    cin>>n>>m;
    vector<int> arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
        total += arr[i];
    }
    int count=0;
    for(int i=0;i<n;i++)
    {
        if(arr[i]*4*m >= total)
            count++;
    }
    if(count >=m)
        cout<<"Yes";
    else
        cout<<"No";
}

int main()
{
    FASTIO;
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        cp();
    }
    return 0;
}

Measured memory_bytes: 256
package main
import "fmt"

func main() {
    var temp int
    var five int
    var seven int
    var i int
    five = 0;
    seven = 0;
    i = 0
    for{
        fmt.Scanf("%d",&temp);
        if( temp == 5){
            five++;
        }else if(temp == 7){
            seven++;
        }
        i++;
        if i == 3 {
            break
        }
    }
    if( seven == 1 && five == 2){
        fmt.Printf("YES\n");
    }else{
        fmt.Printf("NO\n");
    }
//    fmt.Printf("%d\n",temp);
}


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

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

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


int main()
{
    string s;
    cin>>s;
    sort(s.begin(),s.end());
    if(s[0]==s[1]&&s[2]==s[3])
    {
        if(s[1]==s[2])
        {
            cout<<"No"<<endl;
        }
        else
        {
            cout<<"Yes"<<endl;
        }
        return 0;
    }
    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}

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

// clang-format off
#define forn(i, x, y) for(int i = x; i < y; i++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL)
// clang-format on

using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;

const long long MOD = 1000000007;

void add(LL &a, LL b)
{
  a += b;
  if (a >= MOD)
    a -= MOD;
}

int main()
{
  IOS;

  int N;
  cin >> N;
  VI A(N);
  int k;
  forn(i, 0, N) forn(j, 0, N)
  {
    cin >> k;
    A[i] |= k << j;
  }

  VLL dp(1 << N);
  dp[0] = 1;
  for (int mask = 1; mask < (1 << N); mask++)
  {
    int m = __builtin_popcount(mask) - 1;
    for (int w = 0; w < N; w++)
    {
      if (mask & A[m] & (1 << w))
        add(dp[mask], dp[mask ^ (1 << w)]);
    }
  }
  cout << dp[(1 << N) - 1] << endl;

  return 0;
}


Measured memory_bytes: 19552
#include<bits/stdc++.h> 
//compiling code: g++ test.cpp(file) -o script(output) -std=c++11(version) -O2(make it 2x faster)
using namespace std;

queue<pair<int, pair<int, int>>> Q; //first number: distance to coordinate, second pair: store coordinates
int H, W;
char G[1005][1005];
int dist[1005][1005];

int dr[4] = {1, -1, 0, 0};
int dc[4] = {0, 0, -1, 1};

int main(){
    cin >> H >> W;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            cin >> G[i][j];
            if(G[i][j] == '#'){
                Q.push(make_pair(0, make_pair(i, j)));
            }
        }
    }

    memset(dist, -1, sizeof(dist));

    while (!Q.empty()){
        int d = Q.front().first, r = Q.front().second.first, c = Q.front().second.second;//takes out nearest node
        Q.pop();
        if(dist[r][c] != -1) continue;//check if visited
        dist[r][c] = d;//update the distance
        for (int i=0; i<4; i++){
            if(r + dr[i] >= 0 && r + dr[i] < H && c + dc[i] >= 0 && c + dc[i] < W)
                Q.push(make_pair(d + 1, make_pair(r + dr[i], c + dc[i])));
        }
    }

    int ans = 0;
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            ans = max(ans, dist[i][j]);
        }
    }

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 53448
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <fstream>
using namespace std;

int main()
{
    int A, B;
    string s;
    int count = 0;

    cin >> A;
    cin >> B;

    for (int i = A; i <= B; i++) {
        s = to_string(i);

        if(s[0] == s[4] && s[1] == s[3]) {
            count += 1;
        }
    }
    
    cout << count << endl;
}

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

// constexpr int M = 32;
// constexpr char CH_INT[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};

int main() {
    int n, k;
    cin >> n >> k;

    // char str[M];
    // rep(i, 0, M) { str[i] = '\0'; }

    int length = 0;
    while (true) {
        // str[length++] = CH_INT[n % k];
        ++length;
        n = n / k;
        if (n == 0) { break; }
    }

    // rrep(i, 0, length) {
    //     cout << str[i];
    // }
    // cout << endl;

    cout << length << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	static int mod = 1000000007;
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextInt();
		long m = sc.nextInt();
		long ans = Integer.MAX_VALUE;
		loop:for(long i = n; i <= m; i++) {
			for(long j = i+1; j <= m; j++) {
				ans = Math.min(ans, (i*j)%2019);
				if(ans == 0) {
					break loop;
				}
			}
		}

		System.out.println(ans);
		sc.close();

	}
}


Measured memory_bytes: 23124
-- | Main entry point to the application.
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Debug.Trace
import Text.Printf

rInt :: String -> Int
rInt str = read str :: Int

gcdm a b
    | a < b = gcdh a b
    | otherwise = gcdh b a

gcdh a b
    | b == 0 = a
    | otherwise = gcdh b (a `mod` b)

-- | The main entry point.
main :: IO ()
main = do
    [a,b] <- (map rInt . words) <$> getLine
    putStrLn . show $ gcdm a b

Measured memory_bytes: 3600
#include <stdio.h>

int main() {
	int N; 
	long long int sum = 0;
	scanf("%d", &N);
	
	for (int i = 0; i <= N; i++) {
		if (i % 3 == 0 && i % 5 == 0) {
			continue;
		} 
		else if (i % 3 == 0 || i % 5 == 0) {
			continue;
		} 
		else {
			sum += i;
		}
	}
	printf("%lld\n", sum);
	
	return 0;
}

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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	int N;
	cin >>N;
	map<pair<int, int>, int> M;
	ll ANS=0;
	Rep0(i, N) {
		string S;
		cin >>S;
		ll A;
		if (-1==S.find(".")) { // int
			A=atoi(S.c_str());
			A *=1000000000;
		} else {
			string SS=S.substr(S.find(".")+1);
			SS+="000000000";
			SS=SS.substr(0, 9);
			A=atoi(SS.c_str()); // Frac to Int
			SS=S.substr(0, S.find("."));
			ll II=atoi(SS.c_str());
			II *=1000000000;
			A +=II;
		}
		int N2=0;
		int N5=0;
		while (0==A%2) {
			A /=2;
			N2++;
		}
		while (0==A%5) {
			A /=5;
			N5++;
		}
		for (auto MM: M)
			if ((MM.first.first+N2>=18)&&(MM.first.second+N5>=18))
				ANS +=MM.second;
		M[{N2, N5}]++;
	}
	cout <<ANS <<endl;
	return 0;
}



Measured memory_bytes: 3588
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

A, B = rl()

def get_divisors(n):
    divs = [1]
    for i in range(2, int(n**0.5)+1):
        c = 0
        while n % i == 0:
            n = n // i
            c += 1
        if c > 0:
            divs.append(i)
    if n > 1:
        divs.append(n)
    return divs

from fractions import gcd
divs = get_divisors(gcd(A,B))
print(len(divs))


Measured memory_bytes: 65516
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;

template<class T> bool ckmin(T& a, const T& b) {
    return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
    return a < b ? a = b, 1 : 0; }

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template <typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template <typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template <class X, class Y>
std::ostream & operator << (std::ostream & os, std::pair <X, Y> const& p) {
    return os << p.first << " " << p.second;
}

template <class Ch, class Tr, class Container>
std::basic_ostream <Ch, Tr> & operator << (std::basic_ostream <Ch, Tr>& os, Container const& x) {
    bool first = true;
    for(auto& y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class ERedScarf {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        vi A(n);
        in >> A;
        int tot = accumulate(all(A), 0, [&](int x, int y) {
            return x ^ y;
        });
        trav(x, A) {
            x ^= tot;
        }
        out << A << '\n';
	}

	void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
	ERedScarf solver;
    solver.setup();
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3976
/*
*/
#include<bits/stdc++.h> 
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
//#define int long long 
#define LL long long 
#define rg register 
#define pt(x) printf("%d ", x);
#define Fin(x) {freopen(#x".in","r",stdin);}
#define Fout(x) {freopen(#x".out","w",stdout);}
using namespace std;
const int MAXN = 1e6 + 10, INF = 1e9 + 10, mod = 1e9 + 7;
const double eps = 1e-9;
inline int read() {
    char c = getchar(); int x = 0, f = 1;
    while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
}


main() {
	int D = read();
	if(D == 25) puts("Christmas");
	else if(D == 24) puts("Christmas Eve");
	else if(D == 23) puts("Christmas Eve Eve");
	else if(D == 22) puts("Christmas Eve Eve Eve");

    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);

		while (true) {

			// ?????????????????\???
			String input = sc.nextLine();

			// 0?????\?????????????????????
			if (input.equals("0"))
				break;

			// ??\?????????????????????char????????????
			char[] sentence = input.toCharArray();

			// ????¨?????????\???????????°
			int sum = 0;

			// ???????????°??????????¨?????¨????????????????
			for (int cnt = 0; cnt < sentence.length; cnt++) {

				sum += Character.getNumericValue(sentence[cnt]);

			}
			System.out.println(sum);
		}
		sc.close();
	}
}

Measured memory_bytes: 26640
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

int main(void) {
  int p[2][6];
  REP(i, 2) REP(j, 6) scanf("%d", &p[i][j]);

  auto calc = [&] (double x) {
    double q[2] = {x, 1-x};
    
    double ans = 0;
    REP(i, 2) {
      REP(j, 6) {
        double p1 = q[i] * p[i][j] / 100.0;
        double p2 = q[1-i] * p[1-i][j] / 100.0;
        if (p1 < p2) ans += p1;
      }
    }
    return ans;
  };

  double lo = 0, hi = 1;
  REP(it, 100) {
    double m1 = lo + (hi-lo)/3;
    double m2 = hi - (hi-lo)/3;
    if (calc(m1) > calc(m2)) hi = m2;
    else lo = m1;
  }
  
  printf("%.12lf\n", 1-calc(lo));
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#define cs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i,b)  for(int i=0;i<(int)(b);i++)
#define Rep(i,n) for(int i=1;i<(int)(n);i++)
#define repp(i,a,b)  for(int i=a;i<=(int)(b);i++)
#define Repp(i,a,b)  for(int i=a;i>=(int)(b);i--)
typedef long long ll;
typedef long double ld;
using namespace std;

string arr[100008];
string f(string x){
    int it,l=x.size();
    string t=x;
    Repp(i,l-2,0){
        if(t[i]>=t[i+1]&&t[i+1]!='9')
        {
            t[i+1]++;it=t[i+1]-'0';
            repp(j,i+2,l-1){
                it--;
                if(it>=0) t[j]=char(it+'0');
                else t[j]='0';
            }
            return t;
        }
    }
    if(t[0]=='9') return to_string(stoi(x)+1);
    else {
        t[0]++;it=t[0]-'0';
        repp(j,1,l-1){
            it--;
            if(it>=0) t[j]=char(it+'0');
            else t[j]='0';
        }
    }
    return t;
}
int main(){

    cs;
    arr[1]="1";
    repp(i,2,100000) arr[i]=f(arr[i-1]);
    int k;cin>>k;cout<<arr[k];
    
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
#define re return
#define pb push_back
#define po pop_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define si size
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define pi 3.14159265359
#define er erase
#define in insert
#define em empty
#define ft front
#define fo(i,n) for(i = 0; i < n; i++)
#define ro(i,n) for(i = n - 1; i >= 0; i--)
#define fr(i,j,n) for(i = j; i < n; i++)
#define rf(i,j,n) for(i=n-1;i>=j;i--)
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::pair<int,int> ii;
typedef std::vector<ii> vii;
typedef std::vector<std::string> vs;
typedef double dl;
typedef long double ld;
typedef long long ll;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> vll;
#define filename ""
using namespace std;
    const int N=(int)1e5+10;
    int d[N];
    int was[N];
    int inf=(int)1e9+10;
    vector<pair<int,int> > v[N];
    vector<pair<int,int> > g[N];
    int q[N];
bool sss(int x,int y)
{
    if (d[x]==d[y]) re x<y;
    re d[x]<d[y];
}
    set<int,bool (*) (int,int)> s(sss);
int main()
{
    /*
	freopen(filename".in","r",stdin);
	freopen(filename".out","w",stdout);
	*/
	/*
	freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    */
    int n,m,i,a,b,c,w=0,e=0;
    cin>>n>>m;
    fo(i,m)
    {
        scanf("%d%d%d",&a,&b,&c);
        v[a-1].pb({b-1,c});
        g[b-1].pb({a-1,c});
    }
    fo(i,n)
    {
        d[i]=inf;
        s.in(i);
    }
    int x;
    while(!s.empty())
    {
        x=*s.begin();
        s.er(x);
        if (d[x]==inf) d[x]=0;
        fo(i,v[x].size())
        {
            if (!was[v[x][i].fi])
            {
                s.er(v[x][i].fi);
                d[v[x][i].fi]=d[x]+v[x][i].se;
                was[v[x][i].fi]=1;
                s.in(v[x][i].fi);
            }
            else
            {
                if (d[v[x][i].fi]!=d[x]+v[x][i].se)
                {
                    cout<<"No\n";
                    re 0;
                }
            }
        }
        fo(i,g[x].size())
        {
            if (!was[g[x][i].fi])
            {
                s.er(g[x][i].fi);
                d[g[x][i].fi]=d[x]-g[x][i].se;
                was[g[x][i].fi]=1;
                s.in(g[x][i].fi);
            }
            else
            {
                if (d[g[x][i].fi]!=d[x]-g[x][i].se)
                {
                    cout<<"No\n";
                    re 0;
                }
            }
        }
    }
    cout<<"Yes\n";
    re 0;
}


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

//ABC166D
//ABC166C
//ABC166B
int main(void) {
  int n, k, i, j, tmp, sum=0, s;
  scanf("%d %d", &n, &k);
  int cou[n];
  for(i=0; i<n; i++)
    cou[i]=0;

  for(i=0; i<k; i++){

    scanf(" %d", &s);
    for(j=0; j<s; j++){
      scanf(" %d", &tmp);
      cou[tmp-1]++;
    }
  }
  for(i=0; i<n; i++)
    if(cou[i]==0) sum++;
  printf("%d", sum);
}

Measured memory_bytes: 1736
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#define shosu(x) fixed<<setprecision(x)
using namespace std;

int w,h;
char field[105][105],sum;

void tmp(int x,int y){
	int vx[4]={1,0,-1,0},vy[4]={0,1,0,-1};
	for(int k=0;k<4;k++){
		int tmpx=x+vx[k],tmpy=y+vy[k];
		if(tmpx>=0&&tmpx<w&&tmpy>=0&&tmpy<h){
			if(field[tmpx][tmpy]!='!'&&sum==field[tmpx][tmpy]){
				field[tmpx][tmpy]='!';
				tmp(tmpx,tmpy);
			}
		}
	}
}

int bfs(int x,int y){
	int ans=0;
	for(int i=0;i<x;i++){
		for(int j=0;j<y;j++){
			cin>>field[i][j];
		}
	}
	for(int i=0;i<x;i++){
		for(int j=0;j<y;j++){
			if(field[i][j]!='!'){
				sum=field[i][j];
				field[i][j]='!';
				tmp(i,j);
				ans++;
			}
		}
	}
	return ans;
}

int main(){
	while(1){
		cin>>w>>h;
		if(w==0&&h==0) break;
		cout<<bfs(w,h)<<endl;
	}
}

Measured memory_bytes: 1792
N, *A = map(int, open(0).read().split())

dp = [[0] * 2 for _ in range(N + 1)]
dp[0][1] = -float('inf')

for i in range(N):
    dp[i + 1][0] = max(dp[i][0] + A[i], dp[i][1] - A[i])
    dp[i + 1][1] = max(dp[i][0] - A[i], dp[i][1] + A[i])
    
print(dp[N][0])



Measured memory_bytes: 72332
#include <iostream>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long int lli;
//const int MAX=;

int main(){
	string S;
	cin>>S;
	int w;
	cin>>w;
	int l=S.size();
	
	rep(i,l){
		if(i%w==0)cout<<S[i];
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#define fail {cout<<"No"<<endl;return 0;}
using namespace std;
int n,x=0,y=0,t=0,a,b,c;
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>c>>a>>b;
        if(abs(x-a)+abs(y-b)>c-t)
	        fail;
        if((abs(x-a)+abs(y-b))%2==0 &&(c-t)%2==1)
	        fail;
        if((abs(x-a)+abs(y-b))%2==1 &&(c-t)%2==0)
	        fail;
		t=c;
		y=b;
        x=a;
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

int main()
{
    long k;
    cin >> k;

    queue<long> lunlunsq;
    long count = 0;

    for(long lunlun = 1; lunlun <= 9; lunlun++)
    {
        count++;
        lunlunsq.push(lunlun);
        if(count == k)
        {
            cout << lunlun;
            return 0;
        }
    }

    while(true)
    {
        long baseLunlun = lunlunsq.front();
        lunlunsq.pop();
        long digit = baseLunlun % 10;

        if(digit > 0)
        {
            long lunlun = baseLunlun * 10 + digit - 1;
            count++;
            lunlunsq.push(lunlun);
            if(count == k)
            {
                cout << lunlun;
                return 0;
            }
        }

        {
            long lunlun = baseLunlun * 10 + digit;
            count++;
            lunlunsq.push(lunlun);
            if(count == k)
            {
                cout << lunlun;
                return 0;
            }
        }

        if(digit < 9)        
        {
            long lunlun = baseLunlun * 10 + digit + 1;
            count++;
            lunlunsq.push(lunlun);
            if(count == k)
            {
                cout << lunlun;
                return 0;
            }
        }
    }


    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

int main() {
    IOS
    int n, y;
    cin >> n >> y;
    ll sum = 0, a = -1, b = -1, c = -1;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            int f = n - i - j;
            if (f >= 0) {
                sum = 10000 * i + 5000 * j + 1000 * f;
                if (sum == y) {
                    a = i; b = j; c = f;
                    break;
                }
            }
        }
    }
    cout << a << ' ' << b << ' ' << c << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll a[7];

 void DICE(char y){
	ll k;
	if(y=='W'){
		k=a[1];
		a[1]=a[3];
		a[3]=a[6];
		a[6]=a[4];
		a[4]=k;
	}
	  else if(y=='E'){
			k=a[1];
			a[1]=a[4];
			a[4]=a[6];
			a[6]=a[3];
			a[3]=k;
	  }
	    else if(y=='S'){
	    	k=a[1];
	    	a[1]=a[5];
	    	a[5]=a[6];
	    	a[6]=a[2];
	    	a[2]=k;
		}
			else{
		    	k=a[1];
		    	a[1]=a[2];
		    	a[2]=a[6];
		    	a[6]=a[5];
		    	a[5]=k;
			}
}
int main(){
	
	for(ll i=1;i<=6;i++){
		cin>>a[i];
	}
	
	string s;
	
	cin>>s;
	
	ll n;
	
	n=s.size();
	
	for(ll i=0;i<n;i++){
		char c;
		c=s[i];
		DICE(c);
	}
	
	cout<<a[1]<<endl;
}


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

int main(){
  int n;
  cin >>n;
  int sum = 0;
  rep(i,n+1) sum += i;
  cout << sum << endl;
  return 0;
}



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

int main()
{
    int r, c;
    int m[101][101] = {0};

    cin >> r >> c;

    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            cin >> m[i][j];
        }
    }

    for (int i = 0; i < r; i++) {
        for (int j = 0; j < c; j++) {
            m[i][c] += m[i][j];
            m[r][j] += m[i][j];
            m[r][c] += m[i][j];
        }
    }

    for (int i = 0; i < r + 1; i++) {
        for (int j = 0; j < c + 1; j++) {
            if (j == c) {
                cout << m[i][j];
            } else {
                cout << m[i][j] << ' ';
            }
        }

        cout << endl;
    }

    return 0;
}

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

int main() {
    while (true) {
        int a, b;
        cin >> a >> b;
        if ((a | b) == 0) {
            break;
        }
        int** coord = new int* [b];
        for (int i = 0; i < b; i++) {
            coord[i] = new int [a];
        }
        for (int y = 0; y < b; y++) {
            for (int x = 0; x < a; x++) {
                coord[y][x] = 0;
            }
        }
        coord[0][0] = 1;
        int n;
        cin >> n;
        for (int i = 0; i < n; i++) {
            int xi, yi;
            cin >> xi >> yi;
            coord[yi - 1][xi - 1] = -1;
        }
        for (int y = 0; y < b; y++) {
            for (int x = 0; x < a; x++) {
                if (coord[y][x] == -1) {
                    coord[y][x] = 0;
                } else {
                    if (x - 1 >= 0) {
                        coord[y][x] += coord[y][x - 1];
                    }
                    if (y - 1 >= 0) {
                        coord[y][x] += coord[y - 1][x];
                    }
                }
            }
        }
        cout << coord[b - 1][a - 1] << endl;
        for (int i = 0; i < b; i++) {
            delete[] coord[i];
        }
        delete[] coord;
    }
}

Measured memory_bytes: 0
#include<stdio.h>
int a[100010];
int book[100010];
int b[100010];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    int sum=0;
    for(int i=0;i<m;i++)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        if(a[x]<=a[y]) book[x]=1;
        if(a[x]>=a[y]) book[y]=1;
    }
   for(int i=1;i<=n;i++)
   {
       if(book[i]==0)
        sum++;
   }
    printf("%d\n",sum);
}


Measured memory_bytes: 2496
#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 fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18
#define ret return

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll x[111111];

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
		cin >> x[i];
	}
	ll ans = INF;
    for(int i = 0; i+k-1<n; i++){
		if(x[i+k-1]<0){
			ans=min(ans,abs(x[i]));
		}
		else if(x[i]>0){
			ans=min(ans,abs(x[i+k-1]));
		}
		else{
			ans=min(ans,abs(x[i])+abs(x[i+k-1])+min(abs(x[i]),abs(x[i+k-1])));
		}
	}
	cout << ans << '\n';
}


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

using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll MOD = 1000000007;
ll INF = 1000000009;

/*
*/

void solve(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll x[n+10];
    rep(i,n){
        cin >> x[i];
    }
    ll ans=0;
    for(int i=1; i<n; i++){
        ll tmp = x[i]-x[i-1];
        if(tmp*a>b){
            ans += b;
        }
        else{
            ans += tmp*a;
        }
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 1024
import math
n, k = map(int, input().split())
ans = 0
if n >= k: ans += n - k + 1
p = 1/2
while k > 1:
  if n >= k: ans += p * (k - math.ceil(k / 2))
  elif n >= k / 2: ans += p * (n - math.ceil(k / 2) + 1)
  k = math.ceil(k / 2)
  p /= 2
print(ans / n)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,k;
    cin >> n >> k;
    vector <int> x(n);
    vector <int> dp(n);
    long ans = 0;
    for(int i = 0; i < n; i++){
        cin >> x[i];
        dp[i] = min(abs(x[i]),abs(x[i]-k));
        ans+=2*dp[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
N,C,K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()
ans=s=0
while s<N:
    t=T[s]+K
    sm=1
    for i in range(s+1,min(s+C,N)):
        if T[i]<=t:
            sm+=1
        else:
            break
    s+=sm
    ans+=1
print(ans)


Measured memory_bytes: 81104
#[doc = " https://github.com/hatoo/competitive-rust-snippets"]
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
mod util {
    use std::fmt::Debug;
    use std::io::{stdin, stdout, BufWriter, StdoutLock};
    use std::str::FromStr;
    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }
    #[allow(dead_code)]
    pub fn chars() -> Vec<char> {
        line().chars().collect()
    }
    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
    #[allow(dead_code)]
    pub fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
        let out = stdout();
        let writer = BufWriter::new(out.lock());
        f(writer)
    }
}
#[allow(unused_macros)]
macro_rules ! get { ( $ t : ty ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . trim ( ) . parse ::<$ t > ( ) . unwrap ( ) } } ; ( $ ( $ t : ty ) ,* ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; let mut iter = line . split_whitespace ( ) ; ( $ ( iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) , ) * ) } } ; ( $ t : ty ; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ ( $ t : ty ) ,*; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ ( $ t ) ,* ) ) . collect ::< Vec < _ >> ( ) } ; ( $ t : ty ;; ) => { { let mut line : String = String :: new ( ) ; stdin ( ) . read_line ( & mut line ) . unwrap ( ) ; line . split_whitespace ( ) . map ( | t | t . parse ::<$ t > ( ) . unwrap ( ) ) . collect ::< Vec < _ >> ( ) } } ; ( $ t : ty ;; $ n : expr ) => { ( 0 ..$ n ) . map ( | _ | get ! ( $ t ;; ) ) . collect ::< Vec < _ >> ( ) } ; }
#[allow(unused_macros)]
macro_rules ! debug { ( $ ( $ a : expr ) ,* ) => { eprintln ! ( concat ! ( $ ( stringify ! ( $ a ) , " = {:?}, " ) ,* ) , $ ( $ a ) ,* ) ; } }
const BIG_STACK_SIZE: bool = true;
#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}
fn solve() {
    let (n, m, x, y) = get!(usize, usize, i64, i64);
    let mut xs = util::gets::<i64>();
    let mut ys = util::gets::<i64>();

    xs.push(x);
    ys.push(y);

    if xs.iter().max().unwrap() < ys.iter().min().unwrap() {
        println!("No War");
    } else {
        println!("War");
    }
}


Measured memory_bytes: 8572
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int N = (1e2) + 5;
const int W = (1e5) + 5;
bool done[N][W];
ll memo[N][W];
ll wt[N], val[N];
int n, w;

ll knapsack(int n, int free) {
	if (n == 0) return 0;
	if (free == 0) return 0;
	ll &ret = memo[n][free];
	if (done[n][free]) return ret;
	done[n][free] = 1;
	if (free - wt[n - 1] >= 0) {
		return ret = max(val[n - 1] + knapsack(n - 1, free - wt[n - 1]), knapsack(n - 1, free));
	}
	return ret = knapsack(n - 1, free);
}

int main() {
	scanf("%d", &n);
	scanf("%d", &w);
	for (int i = 0; i < n; ++i) {
		scanf("%lld %lld", &wt[i], &val[i]);
	}
	memset(done, 0, sizeof done);
	ll ans = knapsack(n, w);
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 89728
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DBG(X) cout << #X << "=" << (X) << '\n';
	#define SAY(X) cout << (X) << '\n';
#else
	#define DBG(X)
	#define SAY(X)
#endif
 
using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	int n = fetch<int>();
	auto S = fetch<string>();

	if(n & 1) {
		cout << "No\n";
		return;
	}

	bool good = true;

	for(int i = 0; i < n / 2; ++i) {
		if(S[i] != S[i + n / 2]) {
			good = false;
			break;
		}
	}

	cout << (good ? "Yes\n" : "No\n");
}

int main() {
	fast_io();
	solve();

	return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()

const int MAX = 1e5+10;
const int MOD = 998244353;

int N;
string S;

string solve() {
    if (N&1) return "No";
    REP (i, N/2) {
        if (S[i] != S[i+N/2]) return "No";
    }
    return "Yes";
}

int main() {
    cin >> N >> S;
    cout << solve() << endl;
}

Measured memory_bytes: 256
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,a,j,x=0,y=0,m;
    cin>>a;
    cout<<a+(a*a)+(a*a*a)<<endl;
    return 0;
}



Measured memory_bytes: 3628
import math
N=int(input())
# rootを求める
# 二分探索すればいいのか！！！
root_n = int(math.sqrt(N))
up_n = root_n
up_ans = 0
keta = lambda x: len(str(x))
while up_n <= N:
  if N % up_n == 0:
    pair = int(N/up_n)
    # 桁数を求める
    up_ans = max(keta(pair), keta(up_n))
    break
  else:
    up_n-=1

print(up_ans)



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

int main()
{
  int a, b;
  int n;

  while (~scanf("%d%d%d", &a, &b, &n)){
    int s = 0;
    for (int i = 0; i < n; i++){
      a *= 10;
      s += (a / b) % 10;
      a %= b;
    }
    printf("%d\n", s);
  }

  return (0);
}

Measured memory_bytes: 1188
#include <iostream>
using namespace std;
 
int main() {
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	if(a==0){
		cout<<1;
	}else if(b==0){
		cout<<2;
	}else if(c==0){
		cout<<3;
	}else if(d==0){
		cout<<4;
	}else if(e==0){
		cout<<5;
	}
	
}

Measured memory_bytes: 3548
//Pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int64_t _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int64_t _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

const int64_t MAX_N = 200002;

int64_t n, a[MAX_N];
vector<pair<int64_t, int64_t> > p;

void readInput() {
	cin >> n;
	for (int64_t i=1; i<=n; ++i)
		cin >> a[i];
}

bool check(int64_t v) {
	p.clear();
	p.push_back(make_pair(0, a[1]));
	for (int64_t i=2; i<=n; ++i) {
		if (a[i]>a[i-1]) {
			if (p.back().first==0)
				p.back().second += a[i] - a[i-1];
			else
				p.push_back(make_pair(0, a[i] - a[i-1]));
		}
		else {
			int64_t tmp = a[i-1];
			while (tmp-p.back().second>=a[i]) {
				tmp -= p.back().second;
				p.pop_back();
			}
			p.back().second -= tmp-a[i];
			if (p.size()==1 && p[0].first==v-1)
				return false;
			pair<int64_t, int64_t> last = p.back();
			if (p.back().first==v-1)
				p.pop_back();
			--p.back().second;
			p.push_back(make_pair(p.back().first+1, 1));
			if (p[p.size()-2].second==0)
				p.erase(p.begin() + p.size() - 2);
			while (p.size()>1 && p[p.size()-2].first==p.back().first) {
				p[p.size()-2].second += p.back().second;
				p.pop_back();
			}
			if (last.first==v-1) {
				p.push_back(make_pair(0, last.second));
			}
		}
		// for (auto v : p)
		// 	cerr << v.first << ' ' << v.second << ' ';
		// cerr << '\n';
	}
	return true;
}

int64_t bisect() {
	int64_t l = 1, r = n;
	for (int64_t mid=(l+r)/2; mid!=l && r!=mid; mid=(l+r)/2) {
		if (check(mid))
			r = mid;
		else
			l = mid;
	}
	for (int64_t i=l; i<=r; ++i) {
		if (check(i))
			return i;
	}
	assert(0);
}

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
	readInput();
	;//debug(check(3));
	cout << bisect();
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vi v(3);
	REP(i, 3)cin >> v[i];
	sort(ALL(v));
	int ans = v[2] - v[1];
	if ((v[1] - v[0]) % 2) {
		ans += (v[1] - v[0]) / 2 + 2;
	}
	else {
		ans += (v[1] - v[0]) / 2;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256