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

int ch(char x);

int main(void)
{
	char x, y;
	cin >> x >> y;
	int ansx = ch(x);
	int ansy = ch(y);

	if (ansx < ansy)
		cout << "<" << endl;
	else if (ansx > ansy)
		cout << ">" << endl;
	else
		cout << "=" << endl;

}

int ch(char x) {
	int z;
	switch (x) {
		case 'A':
			z = 0;
			break;
		case 'B':
			z = 1;
			break;
		case 'C':
			z = 2;
			break;
		case 'D':
			z = 3;
			break;
		case'E':
			z = 4;
			break;
		case'F':
			z = 5;
			break;
	}
	return z;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
#define REPR(i, n) for (int i = static_cast<int>(n) - 1; i >= 0; --i)
#define FOR(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define FORR(i, a, b) \
  for (int i = static_cast<int>(b) - 1; i >= static_cast<int>(a); --i)
#define ALL(f, x, ...) \
  ([&](auto& y) { return (f)(begin(y), end(y), ##__VA_ARGS__); })(x)
auto INDEX = [](auto& x, auto& xs) { return &x - &xs[0]; };
void async_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}
const auto inf = INT_MAX / 3;
const auto pi = 2 * std::acos(0.0);
const auto eps = 1e-14;
using ll = signed long long;
using ull = unsigned long long;

signed main() {
  async_io();
  // x+y = D
  int D, E;
  while (true) {
    cin >> D >> E;
    if (D == 0 and E == 0) return 0;
    double min_disp = inf;
    REP(x, D / 2 + 1) {
      auto y = D - x;
      double disp = abs(sqrt(x * x + y * y) - E);
      min_disp = min(min_disp, disp);
    }
    cout << min_disp << endl;
  }
}

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

int main() {
	int a,b,c;
  	cin>>a>>b>>c;
  
  if(a+b+c>=22){
  	cout<<"bust"<<endl;
  }
  
  else{
  	cout<<"win"<<endl;
  }
  
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)
using namespace std;
using ll = long long;

int main()
{
  string str;
  int q;
  cin >> str >> q;
  rep(i, q)
  {
    string co, str2;
    int a, b;
    cin >> co >> a >> b;
    if (co == "replace")
    {
      cin >> str2;
      str.replace(str.begin()+a, str.begin()+b+1, str2);
    }
    else if (co == "reverse")
    {
      reverse(str.begin()+a, str.begin()+b+1);
    }
    else if (co == "print")
    {
      cout << str.substr(a, b-a+1) << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
 int i,n,x;
 set<int> s;
 cin >> x >> n;
 if(n==0)
 {
  cout << x;
  return 0;
 }
 int a[n];
 for(i=0;i<n;i++)
 {
  cin >> a[i];
  s.insert(a[i]);
 }
 if(s.find(x)==s.end())
 {
  cout << x;
  return 0;
 }
 sort(a,a+n);
 for(i=1;i<=a[n-1]+1;i++)
 {
  if(s.find(x-i)==s.end())
  {
   cout << x-i;
   return 0;
  }
  else if(s.find(x+i)==s.end())
  {
   cout << x+i;
   return 0;
  }
 }
 return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
int main (void)
{
    char n[10];
    scanf("%s",n);
    int i = 0;
    while (n[i])    {
        i ++;
    }
    if(i == 2)  printf("%s",n);
    else    printf("%c%c%c",n[2],n[1],n[0]); 
}

Measured memory_bytes: 128
import math
while True:
    a,op,b=input().split()
    a=int(a)
    b=int(b)

    if op=="?":break

    if op=="+":
        print(a+b)
    if op=="-":
        print(a-b)
    if op=="*":
        print(a*b)
    if op=="/":
        print(math.floor(a/b))



Measured memory_bytes: 5664
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
ll f(ll n,ll r)
{
     if(n==r) return 1;
     if(r==1) return n;
     return f(n-1,r) + f(n-1,r-1);
}
int main()
{
    ll n,m,x,y;
    cin>>n>>m;
    if(n==0||n==1)
    {
        x=0;
    }
    else
    {
         x =  f(n,2);
    }
    if(m==0||m==1)
    {
        y=0;
    }
   else
    {
         y =  f(m,2);
    }
    cout<<x+y<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int i,a,b,c,sum=0;
  scanf("%d %d %d",&a,&b,&c);
for(i=a;i<=b;i++)
  {
    if(c%i==0)
      {
	sum++;
       }
  }
    printf("%d\n",sum);
    return 0;
  }

Measured memory_bytes: 596
/**
 *    DP
 *    24.04.2020 08:46
**/

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k, h;
  vector<int> v;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> h;
    v.push_back(h);
  }
  vector<int> dp (n + 1, 1e9);
  dp[1] = 0;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (i > j) {
        dp[i] = min(dp[i], dp[i - j] + abs(v[i - 1] - v[i - j - 1]));
      }
    }
  }
  cout << dp[n] << "\n";
  return 0;
}


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

const int M=1e6+5;

int a[M];
ll ans=0,Max=0,d[M];

int main()
{
	//freopen("buying.in","r",stdin);
	//freopen("buying.out","w",stdout);
	int n,m;
	scanf("%d%d",&m,&n);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	for(int i=1;i<m;i++){
		if(a[i]<a[i+1]){
			d[a[i]+2]++; 
			d[a[i+1]+1]-=a[i+1]-a[i];
			d[a[i+1]+2]+=a[i+1]-a[i]-1;
			ans+=a[i+1]-a[i];
		}
		else{
			d[a[i]+2]++;
			if(a[i]<n) d[1]+=n-a[i],d[2]-=n-a[i]-1;
			else d[2]++;
			d[a[i+1]+1]-=a[i+1]-a[i]+n;
			d[a[i+1]+2]+=a[i+1]-a[i]+n-1;
			ans+=a[i+1]-a[i]+n;
		}
	}
	for(int i=1;i<=n;i++) d[i]+=d[i-1];
	for(int i=1;i<=n;i++) d[i]+=d[i-1];
	for(int i=1;i<=n;i++) Max=max(Max,d[i]);
	printf("%lld\n",ans-Max);
	return 0;
}

Measured memory_bytes: 5120
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

struct TopologicalSort {
    int n;
    vector <set<int>> G;
    vector<bool> used;
    vector<int> indeg, p;

    TopologicalSort() {}
    TopologicalSort(int sz) : n(sz), G(n), used(n), indeg(n), p(0) {}

    void add_edge(int s, int t) {
        G[s].insert(t);
    }

    void bfs(int s) {
        queue<int> q;
        q.push(s);
        used[s] = 1;
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            p.push_back(v);
            for (int u:G[v]) {
                indeg[u]--;
                if (indeg[u] == 0 && !used[u]) {
                    used[u] = 1;
                    q.push(u);
                }
            }
        }
    }

    vector<int> build() {
        fill(used.begin(), used.end(), 0);
        fill(indeg.begin(), indeg.end(), 0);

        for (int i = 0; i < n; i++) {
            for (int v:G[i]) {
                indeg[v]++;
            }
        }

        for (int i = 0; i < n; i++) {
            if (indeg[i] == 0 && !used[i]) {
                bfs(i);
            }
        }

        return p;
    }
};

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

    int N, M;
    cin >> N >> M;

    TopologicalSort ts(N);
    vector <vector<int>> parent(N);
    for (int i = 0; i < M; i++) {
        int s, t;
        cin >> s >> t;
        s--;
        t--;
        ts.add_edge(s, t);
        parent[t].push_back(s);
    }

    vector <int> sorted_vertex = ts.build();

    int dp[N]; //dp[i]:iまでの最長パス
    fill(dp, dp + N, 0);

    for (int vertex : sorted_vertex) {
        for (int par : parent[vertex]) {
            dp[vertex] = max(dp[vertex], dp[par] + 1);
        }
    }

    cout << *max_element(dp, dp + N) << endl;
    return 0;
}


Measured memory_bytes: 14464
#include "bits/stdc++.h"
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)


int main(){
	int n;
	while(cin>>n&&n){
		vi r(n),c(n);
		rep(i,n)cin>>r[i];
		rep(i,n)cin>>c[i];
		
		sort(all(r),greater<int>());
		sort(all(c),greater<int>());
		
		rep(col,n){
			rep(row,n){
				if(r[row]>0){
					r[row]--;
					c[col]--;
				}
			}
		}
		
		bool can=true;
		rep(i,n){
			if(c[i]!=0)can=false;
		}
		rep(i,n){
			if(r[i]!=0)can=false;
		}
		
		if(can)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3136
N = int(input())
A = list(map(int,input().split()))
now = 0
dis = 0
for i in A:
    dis += abs(now-i)
    now = i
ans = dis+abs(now)
B = [0]
B.extend(A)
B.append(0)
for i in range(1,N+1):
    if B[i-1] < B[i] > B[i+1] or B[i-1] > B[i] < B[i+1]:
        print(ans - 2*min(abs(B[i-1]-B[i]),abs(B[i]-B[i+1])))
    else:
        print(ans)

Measured memory_bytes: 20444
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar_unlocked
#define putchar putchar_unlocked
int32_t nextint(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); bool s=false; if(c=='-'){s=true;c=getchar_unlocked();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar_unlocked(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar_unlocked(); int s=0; if(c=='-'){s=1;c=getchar_unlocked();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar_unlocked(); while(c==' '||c=='\n') c=getchar_unlocked(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar_unlocked(); } *s='\0'; return len; }

int k[6];
int main(void){
  int a, b, c, d, e;
  scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
  k[a]=1;
  k[b]=1;
  k[c]=1;
  k[d]=1;
  k[e]=1;
  for(int i=1; i<=5; i++){
    if(k[i]==0){
      printf("%d\n", i);
    }
  }
}



Measured memory_bytes: 1676
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: i64,
        b: i64,
        t: i64,
    }
    let mut cur_time = a;
    let mut sum = 0;
    loop {
        if cur_time > t {
            break;
        }

        sum += b;
        cur_time += a;
    }

    println!("{}", sum);
}


Measured memory_bytes: 4352
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef LOCAL
    #define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define debug(...) 42
    #define eprintf(...) 42
#endif

#define PI 3.1415926535897932384626433832795
#define INF 2e9
#define SINV(t) greater<t>()
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define FOREACH(i, v) for(auto i=(v).begin(); i!=(v).end(); ++i)
#define ALL(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;
#define vv(t) vector<t>

#define CHC(mp, x) if(mp.end() != mp.find(x))

template<typename T>
inline T lcm(T a, T b) {return a / __gcd(a, b) * b;}

#pragma endregion

template<typename T>
void SV(vector<T> v){
    REP(i,v.size()){
        #ifdef LOCAL
            cout << i << " : " << v[i] << endl;
        #endif
    }
}
int bitCount(int bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >> 16);
}

int main(void){
    string s;
    cin >> s;
    cout << 'A' << (s[1] == 'B' ? 'R' : 'B') << "C\n";
    return 0;
}


Measured memory_bytes: 3588
#include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++){
		cin >> a[i];
		cout << a[i];
		if(i != n-1) cout << " ";
		else cout << endl;
	}

	for(int i = 1; i <= n-1; i++){
		int v = a[i];
		int j = i - 1;
		while(j >= 0 && a[j] > v){
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = v;
		for(int j = 0; j < n; j++){
			cout << a[j];
			if(j != n-1) cout << " ";
			else cout << endl;
		}
	}
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cerr << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cerr<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 500010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = (1 << 30) - 1;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
mt19937 rng; //use it by rng() % mod, shuffle(all(vec), rng)
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
ll D, A;
pl P[MAX_N];

void solve() {
	cin >> N >> D >> A;
	rep(i, 0, N) cin >> P[i].fst >> P[i].sec;
	sort(P, P + N);
	queue<pl> que;
	ll res = 0;
	ll dam = 0;
	
	rep(i, 0, N) {
		ll x = P[i].fst, h = P[i].sec;
		while(!que.empty() && que.front().fst < x) {
			dam -= que.front().sec;
			que.pop();
		}
		h -= A * dam;
		if(h > 0) {
			ll v = (h + A - 1) / A;
			dam += v;
			que.push(pl(x + 2 * D, v));
			res += v;
		}
		// debug(x, res);
	}
	cout << res << "\n";
}

uint32_t rd() {
	uint32_t res;
#ifdef __MINGW32__
	asm volatile("rdrand %0" :"=a"(res) ::"cc");
#else
	res = std::random_device()();
#endif
	return res;
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
    cerr << fixed;
	cerr.precision(6);
	rng.seed(rd());
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
	if(!freopen("in.txt", "rt", stdin)) return 1;
#endif	
	solve();
    cerr << "Time: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}



Measured memory_bytes: 6016
// see https://gist.github.com/LumaKernel/ff55d49ee1af69b7388f15b707e75c15
const bool DEBUG = 1;
#include <iostream>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <complex>
#include <random>
#include <iomanip>
#include <stdio.h>
#include <sys/time.h>
#include <cassert>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> IP;
typedef pair<P, P> PP;
typedef pair<int, PP> IPP;
typedef vector<int> VI;
typedef vector<P> VP;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)

#define FOR(i,a,b) for(int i=(a);i<int(b);++i)
#define REP(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(b)-1;i>=int(a);--i)
#define RREP(i,n) RFOR(i,0,n)

#define LFOR(i,a,b) for(ll i=(a);i<(b);++i)
#define LREP(i,n) LFOR(i,0,n)
#define LRFOR(i,a,b) for(ll i=(b)-1;i>=(a);--i)
#define LRREP(i,b,a) LRFOR(i,0,n)

#define ALL(a) (a).begin(),(a).end()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define MP make_pair
#define PB push_back
#define EACH(i,c) REP(i,(int)(c).size())
#define REACH(i,c) RREP(i,(int)(c).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

#define BR cout << "\n"

#define dump(x) if(DEBUG)cerr<<"[" << __LINE__ << "] "<<#x<<"="<<(x)<<"\n"
#define dump2(x,y) if(DEBUG)cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)\
			<<" , "<<#y<<"="<<(y)<<"\n"
#define dump3(x,y,z) if(DEBUG)cerr<<"["<<__LINE__<< "] "<<#x<<"="<<(x)\
			<<" , "<<#y<<"="<<(y)<<"\n"\
			<<" , "<<#z<<"="<<(z)<<"\n"

#define SAY(x) if(DEBUG) cerr << "[" << __LINE__ << "] " << (x) << "\n"

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

ll ans;

int main() {
	omajinai;
	ll n,a,b;
	string s;
	cin >> n >> a>> b;
	
	
	cout << min(n*a,b);BR;
//	if(1){
//		cout << "Yes" << endl;
//	}else{
//		cout << "No" << endl;
//	}
}


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

typedef int i32;
typedef long long i64;
typedef unsigned int u32;
typedef unsigned long long u64;


template<typename First, typename Second, typename Third>
struct triple {
   First first;
   Second second;
   Third third;
};


#define debug(x)  cerr<<x<<"\n";
#define loop(i,n) for(i32 i = 0; i < n; ++i)
#define pi  pair<int,int>
#define ti  tuple<int,int,int>
#define mt  make_tuple
#define mk  make_pair
#define vi  vector<int>
#define vll vector<i64>
#define fastInOut ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pr(a) for(auto x:a) cout<<x<<" ";
#define prmap(m) for(auto x:m) cout<<x.first<<" "<<x.second<<"\n";
using namespace std;

int main() 
{ 
	int n,m,x,l;
	cin>>n>>m>>x;
	int cmin=0,cmax=0;
	for(int i=0;i<m;i++){
		cin>>l;
		if(l<=n){
		if(l<x)
			cmin++;
		else
			cmax++;
	
		}
	}
	cout<<min(cmax,cmin);
    return 0; 
} 



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

int main() {
  
  string s;
  cin >> s;
  int ans = 0;
  
  if (s[0] == '1') ans++;
  if (s[1] == '1') ans++;
  if (s[2] == '1') ans++;
  
  cout << ans << endl;
  
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long alice = scanner.nextLong(),brown = scanner.nextLong();
		long ans = Math.abs(alice - brown);
		if(ans <= 1){
			System.out.println("Brown");
		}else{
			System.out.println("Alice");
		}
	}

}


Measured memory_bytes: 20948
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  ull N, K;
  cin >> N >> K;
  cout << K * static_cast<ull>(pow(K - 1, N - 1)) << endl;
  return 0;
}


Measured memory_bytes: 3976
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int N;
    string ans = "No";
    cin >> N;
    vector<int> a(N);
    int qad=0, dbl=0, els=0;
    rep(i,N){
        cin >> a[i];
        if(a[i]%2==0){
            if(a[i]%4==0){
                qad++;
            }else{
                dbl++;
            }
        }else{
            els++;
        }
    }
    if(dbl==0){
        if(els<=qad+1){
            ans = "Yes";
        }
    }else{
        if(els<=qad){
            ans = "Yes";
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))


N = readint()
S = readstr()
Q = readint()
K = readints()

if 'D' not in S:
    printrows([0]*Q)
    exit()
d = S.find('D')
e = S.rfind('D')
ans = []
for k in K:
    m = 0
    c = 0
    a = 0
    for i in range(d+1,min(N,d+k)):
        if S[i]=='M':
            m += 1
        if S[i]=='C':
            c += 1
            a += m
    b = a
    for i in range(d+1,N):
        if i+k-1<N:
            if S[i+k-1]=='M':
                m += 1
            elif S[i+k-1]=='C':
                c += 1
                a += m
        if S[i-1]=='M':
            m -= 1
            a -= c
        elif S[i-1]=='C':
            c -= 1
        if S[i]=='D':
            b += a
            if i==e:
                break
    ans.append(b)
printrows(ans)




Measured memory_bytes: 75760
x1, y1, x2, y2 = map(int, input().split())
xd = x2 - x1
yd = y2 - y1
x3 = x2 - yd
y3 = y2 + xd
x4 = x3 - xd
y4 = y3 - yd
print(x3, y3, x4, y4)

Measured memory_bytes: 38384
def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    sa, sb = [0 for i in range(n+1)], [0 for i in range(n+1)]
    for i in range(1, n+1):
        sa[i] = sa[i-1] + a[i-1]
        sb[i] = sb[i-1] + max(0, a[i-1])

    ans = 0
    for i in range(n-k+1):
        ss = sb[i] + sb[n] - sb[i+k]
        s1 = sa[i+k] - sa[i] + ss
        ans = max(ans, s1, ss)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 17940
package main

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

var (
	N, K int
	avg  []float64
)

func readVariables() {
	N, K = nextInt(), nextInt()
	avg = make([]float64, N)
	for i := 0; i < N; i++ {
		avg[i] = calcAvg(nextInt())
	}
}

func calcAvg(x int) float64 {
	return float64(x+1) / 2
}

func main() {
	readVariables()
	var answer float64
	//init sum
	for i := 0; i < K; i++ {
		answer += avg[i]
	}
	current := answer
	for i := 0; i+K < N; i++ {
		current -= avg[i]
		current += avg[i+K]
		answer = math.Max(answer, current)
	}
	fmt.Println(answer)
}

/* 以下、テンプレート*/

var scanner *bufio.Scanner

func init() {
	scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
}

//nextInt converts next token from stdin and returns integer value.
//nextInt panics when conversion into an integer fails.
func nextInt() int {
	if !scanner.Scan() {
		panic("No more token.")
	}
	num, err := strconv.Atoi(scanner.Text())
	if err != nil {
		panic("nextInt(): cannot convert to int: " + scanner.Text())
	}
	return num
}

func nextStr() string {
	if !scanner.Scan() {
		panic("No more token.")
	}
	return scanner.Text()
}


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

static const int MAX = 100;
static const int INFTY = (1 << 21);

int n,M[MAX][MAX];

int prim() {
	int u,minv;
	int color[MAX] = {}, d[MAX], p[MAX];
	for (int i = 0;i < n;i++) {
		d[i] = INFTY;
		p[i] = -1;
	}
	d[0] = 0;
	while (1) {
		minv = INFTY;
		u = -1;
		for (int i = 0;i < n;i++) {
			if (minv > d[i] && color[i] != 2) {
				u = i;
				minv = d[i];
			}
		}
		if (u == -1) {
			break;
		}
		color[u] = 2;
		for (int v = 0;v < n;v++) {
			if (color[v] != 2 && M[u][v] != INFTY) {
				if (d[v] > M[u][v]) {
					d[v] = M[u][v];
					p[v] = u;
					color[v] = 1;
				}	
			}
		}

	}
	int sum = 0;
	for (int i = 0;i < n;i++) {
		if (p[i] != -1) {
			sum += M[i][p[i]];
		}
	}
	return sum;
}   

int main(){
	cin >> n;
	int e;
	for (int i = 0;i < n;i++) {
		for (int j = 0;j < n;j++) {
			cin >> e;
			if (e == -1) {
				M[i][j] = INFTY;
			}
			else {
				M[i][j] = e;
			}
			
		}
	}
	cout << prim() << endl;
	return 0;

}


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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

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

#define MAX_V 222222
struct edge{int to;long long cap,rev;};

vector<edge> G[MAX_V];
int level[MAX_V];
int iter[MAX_V];

void add_edge(int from,int to,long long cap){
	G[from].push_back((edge){to,cap,G[to].size()});
	G[to].push_back((edge){from,0,G[from].size()-1});
}

void bfs(int s){
	memset(level,-1,sizeof(level));
	queue<int> que;
	level[s] = 0;
	que.push(s);
	while(!que.empty())	{
		int v = que.front();que.pop();
		for(int i = 0;i < G[v].size();++i){
			edge &e = G[v][i];
			if(e.cap > 0 && level[e.to] < 0){
				level[e.to] = level[v] + 1;
				que.push(e.to);
			}
		}
	}
}

int dfs(int v ,int t,long long f){
	if(v == t)return f;
	for(int &i = iter[v];i < G[v].size() ;++i){
		edge &e = G[v][i];
		if(e.cap > 0 && level[v] < level[e.to]){
			long long d = dfs(e.to,t,min(f,e.cap));
			if(d > 0){
				e.cap -= d;
				G[e.to][e.rev].cap += d;
				return d;
			}
		}
	}
	return 0;
}

long long Dinic(int s,int t){
	long long flow = 0;
	while(1){
		bfs(s);
		if(level[t] < 0)return flow;
		memset(iter,0,sizeof(iter));
		long long f;while((f = dfs(s,t,INF)) > 0)flow += f;
	}
}

int E = MAX_V / 2;
int s = MAX_V - 2;
int g = MAX_V - 1;
int mp[MAX_V/2];
int rmp[MAX_V/2];
bool used[MAX_V/2];
bool visited[MAX_V/2];

vector<vector<int>> v(MAX_V / 2);
vector<vector<int>> nv(MAX_V / 2);
vector<pair<int,pair<int,int>>> ans;

void dfs(int num){
	visited[num] = true;
	REP(i,nv[num].size()){
		if(!visited[nv[num][i]]){
			ans.PB(MP(rmp[nv[num][i]], MP(num, nv[num][i])));
			dfs(nv[num][i]);
		}
	}
}

int main(){
	
	int n;cin >> n;
	REP(i,n) {
		if(i != n -1)add_edge(s,i,1);
		add_edge(E+i,g,1);
	}
		
	REP(i,n-1){
		
		int e;cin >> e;
		REP(j,e){
			int tmp;cin >> tmp;tmp--;
			v[i].EB(tmp);
			add_edge(i, E+tmp, 1);
		}
	}
	
	int seica = Dinic(s, g);
	//cout << "seica is " << seica << endl;
	if(seica != n-1){
		cout << -1 << endl;
		return 0;
	}
	
	REP(i,n-1) {
		REP(j,G[i].size()){
			if(G[i][j].cap == 0){
				mp[i] = G[i][j].to - E;
				rmp[mp[i]] = i;
				used[mp[i]] = true;
				break;
			}
		}
	}
	
	REP(i,n-1){
		REP(j,v[i].size()){
			if(v[i][j] != mp[i])nv[v[i][j]].EB(mp[i]);
		}
	}
	
	REP(i,n){
		if(!used[i])dfs(i);
	}
	
	//cout << "ans is " << ans.size() << endl;
	//SHOW1d(used,n);
	//SHOW1d(mp,n);
	//SHOW1d(rmp,n);
	if(ans.size() == n-1){
		sort(ALL(ans));
		REP(i,ans.size()){
			cout << ans[i].SE.FI + 1 << " " << ans[i].SE.SE + 1 << endl;
		}
	}
	else {
		cout << -1 << endl;
	}
	
	return 0;
}

Measured memory_bytes: 55648
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

const ll MOD = 1e9 + 7;

ll power(ll x, ll e) {
  ll v = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) {
      v = v * x % MOD;
    }
    x = x * x % MOD;
  }
  return v;
}

ll inverse(ll x) {
  return power(x, MOD - 2);
}

ll arithmeticSum(ll n, ll a, ll d) {
  static ll inv2 = inverse(2);
  return n * (2 * a % MOD + (n - 1) * d % MOD) % MOD * inv2 % MOD;
}

vector<ll> fact, factInv;
void initFact(int N) {
  fact.resize(N + 1);
  factInv.resize(N + 1);
  fact[0] = 1;
  for (int i = 1; i <= N; i++) {
    fact[i] = fact[i - 1] * i % MOD;
  }
  factInv[N] = inverse(fact[N]);
  for (int i = N - 1; i >= 0; i--) {
    factInv[i] = factInv[i + 1] * (i + 1) % MOD;
  }
}

ll choose(int n, int k) {
  if (k > n) {
    return 0;
  } else {
    return fact[n] * factInv[k] % MOD * factInv[n - k] % MOD;
  }
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  initFact(2000010);
  ll N, M, K;
  while (cin >> N >> M >> K) {
    ll res = 0;
    ll a = 0;
    for (int i = 0; i < N; i++) {
      a += arithmeticSum(N - i, i + 1, 1) - (i + 1) * (N - i) % MOD + MOD;
      a %= MOD;
    }
    a = a * M % MOD * M % MOD;
    ll b = 0;
    for (int i = 0; i < M; i++) {
      b += arithmeticSum(M - i, i + 1, 1) - (i + 1) * (M - i) % MOD + MOD;
      b %= MOD;
    }
    b = b * N % MOD * N % MOD;
    res = (res + a) % MOD;
    res = (res + b) % MOD;
    res = res * choose(N * M - 2, K - 2) % MOD;
    cout << res << endl;
  }
  return 0;
}


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

namespace ConsoleApp15
{
    class Class340
    {
        static void Main()
        {
            int N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var d1 = new int[N];
            var d2 = new int[N];
            d1[0] = A[0];
            d2[0] = A[N - 1];
            for(int i = 0; i < N - 1; i++)
            {
                d1[i + 1] = GCD(d1[i], A[i + 1]);
                d2[i + 1] = GCD(d2[i], A[N - 2 - i]);
            }
            int ans = 0;
            for(int i = 0; i < N; i++)
            {
                if (i == 0) ans = Math.Max(ans, d2[N - 2]);
                else if (i == N - 1) ans = Math.Max(ans, d1[N - 2]);
                else
                {
                    ans = Math.Max(ans, GCD(d1[i - 1], d2[N - 2 - i]));
                }
            }
            Console.WriteLine(ans);
        }
        static int GCD(int a, int b) => a <= 0 ? b : GCD(b % a, a);
    }
}


Measured memory_bytes: 27100
#include<bits/stdc++.h>
using namespace std;
long long Q,H,S,D,N,ans,t;
int main()
{
    cin>>Q>>H>>S>>D>>N;
    t=min(Q*4,min(H*2,S));
    if(t*2<=D)
      cout<<t*N<<endl;
    else cout<<((N%2)*t)+N/2*D<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int N = Integer.valueOf(s.next());

		int ret = 0;
		if(N < 600) {
			ret = 8;
		}else if(N < 800) {
			ret = 7;
		}else if(N < 1000) {
			ret = 6;
		}else if(N < 1200) {
			ret = 5;
		}else if(N < 1400) {
			ret = 4;
		}else if(N < 1600) {
			ret = 3;
		}else if(N < 1800) {
			ret = 2;
		}else if(N < 2000) {
			ret = 1;
		}
		
		System.out.println(ret);
	}
}

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

typedef long long ll;
typedef long double ld;
#define pi 3.14159265359
#define inf 2147483647
#define INF 9223372036854775807
#define mod 1000000007
#define mod2 998244353

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

Measured memory_bytes: 1024
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 1000000)
	s := getString()

	t := "keyence"

	for i := 0; i <= len(t); i++ {
		f0 := strings.HasPrefix(s, t[:i])
		f1 := strings.HasSuffix(s, t[i:])
		// out(t[:i], t[i:], s, f0, f1)
		if f0 && f1 {
			out("YES")
			return
		}
	}
	out("NO")
}


Measured memory_bytes: 640
#include <stdio.h>
#define N 250
  
int parent(int);
int left(int);
int right(int);
  
int A[N];
  
main()
{
    
    
  int n,i;
    
    
    
    
  scanf("%d",&n);
    
  for(i = 1; i <= n; i++){
    scanf("%d",&A[i]);
  }
    
  for(i = 1; i <= n; i++){
    if(parent(i) == 0){
      if(n >= right(i)){
    printf("node %d: key = %d, left key = %d, right key = %d, \n",i,A[i],A[left(i)],A[right(i)]);
      }
      else if(n >= left(i) && n < right(i)){
    printf("node %d: key = %d, left key = %d, \n",i,A[i],A[left(i)]);
      }
      else if(n < left(i)){
    printf("node %d: key = %d, \n",i,A[i]);
      }
    }
    else{
    if(n >= right(i)){
      printf("node %d: key = %d, parent key = %d, left key = %d, right key = %d, \n",i,A[i],A[parent(i)],A[left(i)],A[right(i)]);
    }
    else if(n >= left(i) && n < right(i)){
      printf("node %d: key = %d, parent key = %d, left key = %d, \n",i,A[i],A[parent(i)],A[left(i)]);
    }
    else if(n < left(i)){
      printf("node %d: key = %d, parent key = %d, \n",i,A[i],A[parent(i)]);
    }
    }
  }
      
  return 0;
    
}
  
int parent(int a)
{
  return a/2;
}
  
int left(int a)
{
  return 2*a;
}
  
int right(int a)
{
  return 2*a + 1;
}

Measured memory_bytes: 592
#include <iostream>
#include <cstring>
#include <algorithm>

#define MAX_SIZE (1000 + 10)

int A[MAX_SIZE][MAX_SIZE];
char X[MAX_SIZE];
char Y[MAX_SIZE];

int main()
{
  int N, m, n;
  std::cin >> N;

  for (int q = 0; q < N; ++q)
  {
    std::cin >> X >> Y;
    m = strlen(X);
    n = strlen(Y);
    for (int i = 1; i <= m; ++i)
    {
      for (int j = 1; j <= n; ++j)
      {
        if (X[i - 1] == Y[j - 1])
        {
          A[i][j] = A[i - 1][j - 1] + 1;
        }
        else
        {
          A[i][j] = std::max(A[i][j - 1], A[i - 1][j]);
        }
      }
    }

    std::cout << A[m][n] << std::endl;
  }

  return 0;
}



Measured memory_bytes: 7036
#include <bits/stdc++.h>
using namespace std;
const int SENTINEL = numeric_limits<int>::max();
void merge(vector<int> &A, int left, int mid, int right, int &comp) {
  int n1 = mid - left;
  int n2 = right - mid;
  vector<int> L(n1 + 1, 0);
  vector<int> R(n2 + 1, 0);
  for (int i = 0; i < n1; i++)
    L[i] = A[left + i];
  for (int i = 0; i < n2; i++)
    R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i = 0, j = 0;
  for (int k = left; k <= right - 1; k++) {
    ++comp;
    if (L[i] <= R[j])
      A[k] = L[i++];
    else
      A[k] = R[j++];
  }
}
void merge_sort(vector<int> &A, int left, int right, int &comp) {
  if (left + 1 < right) {
    int mid = (left + right) / 2;
    merge_sort(A, left, mid, comp);
    merge_sort(A, mid, right, comp);
    merge(A, left, mid, right, comp);
  }
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &e : v)
    cin >> e;
  int tot = 0;
  merge_sort(v, 0, v.size(), tot);
  cout << v[0];
  for (size_t i = 1; i < v.size(); i++) {
    cout << " " << v[i];
  }
  cout << endl;
  cout << tot << endl;
  return 0;
}



Measured memory_bytes: 6824
#include <bits/stdc++.h>
#define rep( i, n ) for (ll i = 0; i < ( ll )(n); i++)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;



int main(){
    int x;
    cin>>x;
    if(x>=30) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3588
'''input
6
abcabc
'''
# A coding delight
from sys import stdin, stdout
import gc
gc.disable()
input = stdin.readline

# main starts
n = int(input().strip())
string = input().strip()

if n % 2:
	print("No")
else:	
	if string[:n//2] == string[n//2:]:
		print("Yes")
	else:
		print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep_1(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define rep_2(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

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

    rep_1(x,n){
        rep_1(y,n){
            int z = n-x-y;
            if(z>=0 && x*10000 + y*5000 + z*1000 == Y){
                cout << x<<" "<<y<<" "<<z<<endl;
                return 0;
            }
        }
    }
    cout <<"-1 -1 -1"<<endl;

}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int mod = 1e9+7;
const long long INF = 1LL << 60;
typedef long long ll;
/*
int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<int> > vec(M);
    for (int i = 0; i < M; i++)
    {
        int k; cin >> k;
        vec[i].resize(k);
        for (int j = 0; j < k; j++)
        {
            cin >> vec[i][j];
            vec[i][j]--;
        }
    }
    
    vector<int> p(M);
    for (int i = 0; i < M; i++)
    {
        cin >> p[i];
    }
    int ans = 0;
    for (int i = 0; i < (1 << N); i++)
    {
        bool flag = true;
        for (int j = 0; j < M; j++)
        {
            int c = 0;
            for(int id : vec[j]){
                if((i >> id) & 1){
                    ++c;
                }
            }
            c %= 2;
            if(c != p[j]){
                flag = false;
            }
        }
        if(flag){
            ans++;
        }
    }
    cout << ans << endl;
} */
int main(){
    int N, M;
    cin >> N >> M;
    vector<vector<int> > s(M);
    for(int i=0; i<M;i++){
        int k; cin >> k;
        for(int j=0;j<k;j++){
            int a; cin >> a; --a;
            s[i].push_back(a);
        }
    }
    vector<int> p(M);
    for(int i=0;i<M;i++) cin >> p[i];

    ll ans = 0;
    for(int bit=0;bit<(1<<N); bit++){
        bool ok = true;
        for(int i=0;i<M;i++){
            int con = 0;
            for(auto v : s[i]){
                if(bit & (1<<v)) con++;
                //cout<<"1<<"<<v<<"="<<bitset<4>(1<<v)<<endl;
            }
            if(con % 2 != p[i]) ok = false;
            //cout<<"bit ="<<bitset<4>(bit);
            //cout<<" con="<<con<<endl;
        }
        if(ok) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef double db;
ll H,W;
ll sen[10][10000];
ll rv[10];
int main()
{while(1){
	scanf("%lld%lld",&H,&W);
	if(!H) return 0;
	for(ll i=0;i<H;i++) for(ll j=0;j<W;j++) scanf("%lld",&sen[i][j]);
	ll ans=0;
	for(ll s=0;s< 1<<H;s++){
		fill(rv,rv+H,0);
		ll res=0;
		for(ll i=0;i<H;i++) if((s>>i)&1) rv[i]=1;
		for(ll i=0;i<W;i++){
			ll cnt=0;
			for(ll j=0;j<H;j++){
				cnt+=(sen[j][i]+rv[j])%2;
			}
			res+=max(cnt,H-cnt);
		}
		ans=max(res,ans);
	}
	printf("%lld\n",ans);
}}

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

#define pb push_back
#define mp make_pair
#define st first
#define nd second
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 1e8 + 8;

char A[N];
int k,i,j,t,mo,ans,bas,hed;
long long zz;

signed main(){
    cin >> k;
    zz = 100000000;

    hed = 10;
    for(bas=i=j=1;i<zz;i++){
        if(i == hed){
            hed *= 10;
            bas++;
        }

        t += bas;
        for(; j < i && t > k; j++) t -= A[j];
        if(t == k) ans++;
        A[i] = bas;
    }

    zz *= 9;
    for(i=9;i<=k;i++){
        t = k/i;
        mo = k%(i-1);
        ans += max(0 , (t-mo)/(i-1) + (mo>0 && t >= mo));
        if(ans > mod) ans -= mod; 
        if(k % i == 0){
            ans += zz - t;
            if(ans > mod) ans -= mod; 
        }
        
        zz = zz * 10 % mod;
    }
    
    cout << ans;
    return 0;
}

Measured memory_bytes: 97920
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int a1 = 0;
    int a2 = 0;
    int a3 = 0;
    int a4 = 0;
    for (int i=0;i<n;i++){
      String g = scan.next();
      if (g.equals("AC")){
        a1 += 1;
      }

      if (g.equals("WA")){
        a2 += 1;
      }

      if (g.equals("TLE")){
        a3 += 1;
      }

      if (g.equals("RE")){
        a4 += 1;
      }
    }

    System.out.println("AC x "+a1);
    System.out.println("WA x "+a2);
    System.out.println("TLE x "+a3);
    System.out.println("RE x "+a4);
  }
}


Measured memory_bytes: 59660
#include<stdio.h>
main(){
    int s=0;
    int H=0;
    int M=0;
    scanf("%d",&s);
    while(s>3599){
        s=s-3600;
        H++;
    }
    while(s>59){
        s=s-60;
        M++;
    }
    printf("%d:%d:%d\n",H,M,s);
    return 0;
}

Measured memory_bytes: 592
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
//#define int long long

void solve() {
    int N; cin >> N;
    map<int, int> mp;
    int cnt = 0;
    rep(i, N) {
        int a; cin >> a;
        if(mp[a] == 0) {
            cnt ++;
            mp[a] = 1;
        } else {
            cnt --;
            mp[a] = 0;
        }
    }
    cout << cnt << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 4992
import java.util.*;

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

		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();

		int count = 0;
		for(int i=1; i<=N; i++) {
			int[] sum = new int[5];
			sum[0] = i/10000;
			sum[1] = (i-sum[0]*10000)/1000;
			sum[2] = (i-(sum[0]*10000) - (sum[1]*1000))/100;
			sum[3] = (i-(sum[0]*10000) - (sum[1]*1000) - sum[2]*100)/10;
			sum[4] = (i-(sum[0]*10000) - (sum[1]*1000) - sum[2]*100 - sum[3]*10);

			int s = sum[0] + sum[1] + sum[2] + sum[3] + sum[4];
			//println(sum[0]+","+sum[1]+","+sum[2]+","+sum[3]+s);

			if(s >= A && s <= B) {
				count+= i;
			}
		}

		System.out.println(count);
	}

	public static void print(Object o) {
		System.out.print(o);
	}

	public static void println(Object o) {
		System.out.println(o);
	}
}

Measured memory_bytes: 21844
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
inline int read(){
	char ch=getchar();
	int o=0,f=1;
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		o=(o<<3)+(o<<1)+(ch^48);
		ch=getchar();
	}
	return o*f;
}
int main(){
	int n=read();
	cout<<pow(n,3);
}

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

int main(){
  long H,W,m;
  cin >> H >> W >> m;
  vector<pair<long,long>> hw;
  vector<long> hi(H),wi(W);
  rep(i,int(hi.size()))hi[i] = 0;
  rep(i,int(wi.size()))wi[i] = 0;
  long h1,w1;
  rep(i,m){
    cin >> h1 >> w1;
    h1--;w1--;
    hw.push_back({h1,w1});
    hi[h1]++;
    wi[w1]++;
  }
  long maxh = 0, maxw = 0;
  rep(i,int(hi.size()))if(maxh < hi[i])maxh = hi[i];
  rep(i,int(wi.size()))if(maxw < wi[i])maxw = wi[i];
  long ans = maxh + maxw;
  vector<int> hcan,wcan;
  rep(i,int(hi.size()))if(maxh == hi[i]){
    hcan.push_back(i);
    hi[i] = -INF;
  }
  rep(i,int(wi.size()))if(maxw == wi[i]){
    wcan.push_back(i);
    wi[i] = -INF;
  }
  long tmp = 0;
  rep(i,m){
    if(hi[hw[i].first]==-INF && wi[hw[i].second]==-INF){
      tmp++;
    }
  }
  if(tmp == int(hcan.size())*int(wcan.size()))ans--;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 17000
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i)) //Reversi rep
#define nfor(i,a,b) for(int (i) = (a); (i) < (b); ++(i)) //Natural for
#define rfor(i,a,b) for(int (i) = (b); (i) >= (a); --(i)) //Reversi for
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;

int asc(const void *a, const void *b) {
    return *(int *)a - *(int *)b;
}

int desc(const void *a, const void *b) {
    return *(int *)b - *(int *)a;
}

int main()
{
    string a,b;
    int c;
    cin >> a >> b;
    a += b;
    c = stoi(a);
    rep(i, 1001){
        if (c == i * i) {
            Yes;
            return 0;
        }
    }
    No;
    return 0;
}


Measured memory_bytes: 768