akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 500005
int main()
{
    int a,b,c,d;
    in2(a,b);
    in2(c,d);
    if(c==a+1)
        out(1);
    else
        out(0);
}







Measured memory_bytes: 256
import java.util.Scanner;


public class Main  {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long D = sc.nextInt();
		int count = 0;
		for(int i = 0; i < N; i++) {
			long p = sc.nextInt();
			long q = sc.nextInt();
			if(D * D >= (p * p) + (q * q)) {
				count++;
			}
		}
		System.out.print(count);	
	}
}


Measured memory_bytes: 59836
#include <iostream>
#include <vector>
#include <iomanip>
#include <cstring>
using namespace std;


int main()
{
    string s;
    cin >> s;
    int length = s.length();
    for (int i = 0; i < length; i++)
    {
        if (i % 2 == 0 && s[i] == 'L')
        {
            cout << "No";
            return 0;
        }
        if (i % 2 == 1 && s[i] == 'R')
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        int n = in.nextInt();
        int d = in.nextInt();

        int range = (2 * d) + 1;
        int inspector = n / range;
        if ((n % range) != 0) {
            inspector++;
        }
        out.println(inspector);
    }
}


Measured memory_bytes: 20692
#include<iostream>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
struct Point{
  ll x,y,z;
  Point(){};
  Point(ll x,ll y,ll z):x(x),y(y),z(z){}
  Point operator+(Point p){
    return Point(x+p.x,y+p.y,z+p.z);
  }
  Point operator-(Point p){
    return Point(x-p.x,y-p.y,z-p.z);
  }
};
ll dot(Point a,Point b){
  return (a.x*b.x+a.y*b.y+a.z*b.z);
}
struct ball{
  Point p;
  ll r;
  ull l;
};
typedef Point Vector;
ull check(ball ba,Point x,Point y){
  ull z=0;
  Vector v=y-x,c=ba.p-x;
  if(dot(v,c)<=0){
    if(dot(c,c)<=ba.r*ba.r) z=ba.l;
  }else{
    if(dot(v,c)>dot(v,v)){
      if(dot(ba.p-y,ba.p-y)<=ba.r*ba.r) z=ba.l;
    }else{
      if(dot(c,c)*dot(v,v)-(dot(v,c)*dot(v,c))<=ba.r*ba.r*dot(v,v))  z=ba.l;
    }
  }
  return z;
}
int main(){
  ll n,q;
  cin >> n >> q;
  ball bs[51];
  int i,j,k;
  
  ll x,y,z;
  for(i=0;i<n;i++){
    cin >>  x >>  y >>  z >> bs[i].r >> bs[i].l;
    bs[i].p=Point(x,y,z);
  }
  for(i=0;i<q;i++){
    Point p,b;
    cin >> x >> y >> z;
    p=Point(x,y,z);
    cin >> x >> y >> z;
    b=Point(x,y,z);
    ull o=0;
    for(j=0;j<n;j++){
      o+=check(bs[j],p,b);
    }
    cout << o << endl;
  }
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	cout<<B+(B-A)<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

const int NM = 200010;
vector<int> isl[NM];
// int dist[NM];
map<ll, ll> dist;

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

    int n,m; cin>>n>>m;
    rep(i, m){
        int a,b;cin>>a>>b;
        isl[a].push_back(b);
        isl[b].push_back(a);
    }
    // bfs
    queue<pair<ll, ll>> q;
    // rep(i,NM) dist[i] = -1;
    q.push(make_pair(1,1));
    dist[1] = 1;
    while(!q.empty()){
        ll now = q.front().first;
        ll d_now = q.front().second;
        q.pop();
        for(auto t : isl[now]) {
            if(dist[t] != 0) continue;
            dist[t] = d_now + 1;
            q.push(make_pair(t, dist[t]));
        }
    }

    cout<< ((dist[n]-1<=2 && dist[n] != 0) ? "POSSIBLE" : "IMPOSSIBLE") <<endl;

}

Measured memory_bytes: 26224
#include<stdio.h>
   
int main(int argc, char* argv[])
{
  char c, a[26];
  int i;
 
  for(i = 0; i < 26; i++){
    a[i] = 0;
  }
 
  while((c = getchar()) != EOF){
    if(('a' <= c && c <= 'z')||('A' <= c && c <= 'Z')){
      if('a' <= c && c <= 'z'){
        a[c - 'a']++;
      }else{
        a[c - 'A']++;
      }
    }
  }
 
  for(i = 0; i < 26; i++){
    printf("%c : %d\n", 'a' + i, a[i]);
  }
 
  return(0);
}

Measured memory_bytes: 524
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
int main()
{
  lli t,a,b;
  cin>>t>>a>>b;
  lli M=(a/t)*t;
if(M<a)
M+=t;
  if(M>b)
    cout<<"NG"<<endl;
  else
    cout<<"OK"<<endl;
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {
    
    public static final int N = 3;

    public static void main(String[] args) {
       
        Scanner sc = new Scanner(System.in);
        
        int val1 = sc.nextInt();
        int val2 = sc.nextInt();
        int val3 = sc.nextInt();
        
        for(int i=1; i<=N; i++){
            if(val1 > val2){
                int temp = val1;
                val1 = val2;
                val2 = temp;
            }else if(val2 > val3){
                int temp = val2;
                val2 = val3;
                val3 = temp;
            }
        }
        
        System.out.println(val1 +" "+ val2 +" "+ val3);
    }
    
}


Measured memory_bytes: 26220
#include<stdio.h>

int main(void)
{
	unsigned long int a, b, c, d, e, r , s;
	int i, j, k, l;
	unsigned long long int sum = 0;
	int tmp;
	
	scanf("%ld", &a);

	for (i = 1; a >= i; i++) {
		for (j = 1; a >= j; j++) {

			b = i;
			c = j;

			if (b < c) {
				tmp = b;
				b = c;
				c = tmp;
			}

			r = b % c;
			while (r != 0) {
				b = c;
				c = r;
				r = b % c;
			}

			for (k = 1; a >= k; k++) {
				
				d = k;
				e = c;

				if (e < d) {
					tmp = e;
					e = d;
					d = tmp;
				}

				/* ユークリッドの互除法 */
				r = e % d;
				while (r != 0) {
					e = d;
					d = r;
					r = e % d;
				}

				sum = sum + d;

			}
		}
	}

	printf("%lld", sum);

	return 0;
}

Measured memory_bytes: 1736
#include<queue>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define ll long long
#define inf 1000000000LL
#define mod 1000000007
using namespace std;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9')
    {
        if(ch=='-')f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
    {
        x=x*10+ch-'0';
        ch=getchar();
    }
    return x*f;
}
const int N=2e5+10;
pair<ll,ll> B[N*2];
int main()
{
   // while(true)
    {
        int n=read(),t=read();
        int top=0;
        ll x;
        for(int i=0;i<n;i++)
        {
            x=read();
            B[top].first=x;
            B[top].second=-1;
            top++;
           // cout<<x+t<<endl;
            B[top].first=x+t;
            B[top].second=1;
            top++;
        }
        sort(B,B+top);
        int count=0;
        ll pre=0,ans=0;
        bool first=1;
        for(int i=0;i<top;i++)
        {
            if(B[i].second==1){
                count++;
                if(count==0){
                      //  cout<<B[i].first<<" "<<pre<<endl;
                    ans+=B[i].first-pre;
                }
            }
            if(B[i].second==-1){
                count--;
                if(count==-1){
                    pre=B[i].first;
                }
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,k;
  cin>>a>>b>>c>>k;
  if(k<=a){
    cout<<k<<endl;
  }
  else if(k<=a+b){
    cout<<a<<endl;
  }
  else{
    cout<<2*a+b-k<<endl;

  }
}

Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	string a, b, c;
	cin >> n >> a >> b >> c;
	ll ans = 0;
	REP(i, n) {
		if(a[i] == b[i] && b[i] == c[i]) {
			ans += 0;
		} else if(a[i] == b[i]) {
			ans++;
		} else if(b[i] == c[i]) {
			ans++;
		} else if(c[i] == a[i]) {
			ans++;
		} else {
			ans += 2;
		}
	}
	cout << ans << endl;
	return 0;
}

/* --------------------------------------- */


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>

using namespace std;
using boost::adaptors::reversed;
using boost::irange;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;

int main() {
    ll A, B;
    cin >> A >> B;
    if (A <= 8 && B <= 8){
        cout << "Yay!";
    }else{
        cout << ":(";
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;

public class Main {	
	
	static int GCD(int A, int B) {
		int temp;
		while((temp = A%B) != 0) {
			A = B;
			B = temp;
		}
		return B;
	}
	
	static int gcd(int a, int b, int c) {
		int temp;
		int d = GCD(a,b);
		while((temp = c%d) != 0){
			c = d;
			
			d = temp;
		}
		return d;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K = sc.nextInt();
		
		int sum = 0;
		
		for(int i = 1; i <= K; i++) {
			for(int j = 1; j <= K; j++) {
				for(int k = 1; k <= K; k++) {
					sum += gcd(i,j,k);
				}
			}
		}
		
		System.out.println(sum);
	}

}

Measured memory_bytes: 35840
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int n;
  scanf("%d", &n);
  int a, ans = 0;
  rep(i, 0, n) {
    scanf("%d", &a);
    while (a % 2 == 0) {
      ans++;
      a /= 2;
    }
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <atcoder/all>
#define F first
#define S second
using namespace std;
using namespace atcoder;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
typedef pair<int, int> P;
const ll Mod = 998244353;
int main() {
  int N,M;
  cin >> N >> M;
  vector<ll> a(N),b(M);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> b[i];
  }
  vector<ll> ans = convolution<Mod>(a,b);
  for (int i = 0; i < N+M-1; i++) {
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 27216
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int k;cin>>k;
  int ox,oy;cin>>ox>>oy;
  int x = ox-oy;
  int y= ox+oy;
  dump(ox,oy,x,y);

  dump(x, k);
  if (abs(x)%2==1 and k%2==0){
    cout << -1 << endl;
    return 0;
  }

  auto f=[&](int z){  // abs(z)<=2*k
    pii res;
    if (z>=0) {
      res.first = -k;
      res.second = -(z-k);
    }
    else{
      res.first = k;
      res.second = -(z+k);
    }
    return res;
  };
  vector<pii> res;
  while(true){
    if ((abs(x)==k && abs(y)<=k) || (abs(y)==k && abs(x)<=k)) {
      dump("pat 1");
      res.pb(mp(-x,-y));
      x = 0;
      y = 0;
    }
    else if(abs(x)<=2*k && abs(y)<=2*k && abs(x)%2==0){
      dump("pat 2");
      dump(x,f(x));
      dump(y,f(y));
      auto a = f(x);
      auto b = f(y);
      res.pb(mp(a.first, b.second));
      res.pb(mp(a.second, b.first));

      x = 0;
      y = 0;
    }
    else{
      dump("pat 3");
      int p,q;
      if (x>=0) x-=k,p=-k;
      else x+=k, p=k;

      if (y>=0) y-=k, q=-k;
      else y+=k, q=k;
      res.pb(mp(p,q));
    }
    dump(x,y);

    if (x==0 && y==0) break;
  }
  dump(res);

  cout << sz(res) << endl;
  int nx = 0;
  int ny = 0;
  each(el, res){
    int a,b;
    a = -el.first;
    b = -el.second;
    dump(a,b);
    nx += (a+b)/2;
    ny += (-a+b)/2;
    // assert(abs((a+b)/2) + abs((-a+b)/2) == k);
    cout << nx << " " << ny << endl;
  }
  // assert(nx==ox && ny==oy);

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 6508
#include<iostream>

using namespace std;

int main(){
	int N,D;
	cin >> N;
	cin >> D;
	int ans;
	if(N/(D*2+1)<1){
		ans=1;
	}else if(N%(D*2+1)>0){
		ans =1+ N/(D*2+1);
	}else{
		ans =N/(D*2+1);
    }




	cout << ans << endl;


}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int m;
    int32_t k;
    cin >> m >> k;

    if (k >= (1 << m))
    {
        cout << -1 << endl;
        return 0;
    }

    if (m == 1)
    {
        if (k == 1)
        {
            cout << -1 << endl;
        }
        else
        {
            cout << 1 << " " << 0 << " " << 0 << " " << 1 << endl;
        }
        return 0;
    }

    cout << k;
    for (int32_t i = 0; i < (1 << m); i++)
    {
        if (i != k)
        {
            cout << " " << i;
        }
    }
    cout << " " << k;
    for (int32_t i = (1 << m) - 1; i >= 0; i--)
    {
        if (i != k)
        {
            cout << " " << i;
        }
    }
    cout << endl;

    return 0;
}

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

using namespace std;

int main() {

    int n;
    cin >> n;
    n = 1000 - n%1000;
  	if(n == 1000)
      cout << 0;
  else
  {
    cout << n;
  }

	return 0;
}


Measured memory_bytes: 3640
/****************************************************************************************************
                                        SUBMITTED BY-

                                                AISH_07

****************************************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define ll long long
#define sl set<ll>
#define vs vector<string>
#define pb push_back
#define vl vector<ll>
#define vi vector<int>
#define PI  3.14159265
#define mod 998244353

int main()
{

 int n,k;
 cin>>n>>k;

 int a[n];
 for(int i=0;i<n;i++)
    cin>>a[i];
 sort(a,a+n);

 ll sum=0;

 for(int i=0;i<k;i++)
    sum+=a[i];
 cout<<sum<<"\n";

  return 0;

}



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

int main(){
    int n, m; 
    cin >> n >> m;
    long long ans = n*(n-1) / 2 + m*(m-1) / 2;

    cout << ans << endl;

    return 0;
  }


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

using namespace std;

int main()
{
	int n,m;
	cin>>n>>m;
	int mn = INT_MAX,mx = 0;
	for(int i = 0 ;i < m ; i++)
	{
		int l,r;
		cin>>l>>r;
		if(mn > r)
			mn = r;
		if(mx < l)
			mx = l;
	}
	if(mn >= mx)
		cout<<mn - mx + 1<<endl;
	else
		cout<<0<<endl;
}	

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int32 i = (a); i < (b); ++i)
#define rrep(i,a,b) for(int32 i = (b) - 1; i >= (a); --i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define ALL(x) (x).begin(),(x).end()
#define C(x) cout << #x << ":" << x << endl
#define scanf scanf_s

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;
inline uint32 MIN(uint32 a, uint32 b){
	if (a > b) return b;
	return a;
}

int main() {
	uint32 n;
	uint32 s;
	cin >> n >> s;
	vector<uint32> a(n + 1);
	a[n] = 0;
	rep(i, 0, n)
		cin >> a[i];
	uint32 ans = INF;
	uint32 now = 0;
	uint32 l = 0, r = 0;
	while (r <= n){
		if (now < s){
			now += a[r++];
		}
		else{
			ans = MIN(ans, r-l);
			now -= a[l++];
		}
	}
	if (ans == INF) ans = 0;
	printf("%u\n", ans);
	return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> h(N);
  for (int i = 0; i < N; i++) cin >> h[i];
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (h[i] >= K) {
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
n = int(input())
V = list(map(int,input().split()))
for i in range(n-1):
    V.sort()
    for j in range(n-1):
        if V[j] == 0:
            continue
        else:
            Vx = (V[j]+V[j+1])/2
            V[j] = 0
            V[j+1] = Vx

print(V[n-1])

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

class Program
{
    public Program() { }


    Scanner cin;

    void myon()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = cin.nextInt();
        }
        int maxPrice = 0;
        int sumPrice = 0;
        for (int i = 0; i < N; i++)
        {
            maxPrice = Math.Max(maxPrice, A[i]);
            sumPrice += A[i];
        }

        int Payment = sumPrice - maxPrice / 2;

        Console.WriteLine(Payment);
    }

    static void Main(string[] args)
    {
        new Program().myon();
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return next();
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}


Measured memory_bytes: 13140
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    while(true) {
        auto n = readInt();
        if(n == 0) {
            return;
        }
        auto m = 32;
        auto a = cycle(readInts());
        while(m > 0) {
            m -= (m-1)%5;
            writeln(m);
            if(m > 0) {
                m -= min(m, a.front);
                writeln(m);
                a.popFront();
            }
        }
    }

}

Measured memory_bytes: 2440
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main(){
    long long n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;i++){
        int a;
        cin >> a;
        v.push_back(a);
    }
    sort(v.begin(),v.end());
    bool sw = true;
    if(n%2 == 1){
        if(v[0] !=0){
            sw = false;
        }
        for(int i=0;i<n/2;i++){
            if(v[i*2+1] !=(i+1)*2 || v[i*2+2] != (i+1)*2){
                sw = false;
            } 
        }
    }
    else{
        for(int i=0;i<n/2;i++){
            if(v[i*2] != i*2+1 || v[i*2+1] != i*2+1){
                sw = false;
            }
        }
    }
    if(sw){
        long long ans = 1;
        for(long long i=0;i<n/2;i++){
            ans = (ans*(long long)2)%(long long)(1000000007);
        }
        cout << ans<< endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 892
#include <iostream>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include <algorithm>
#include<string.h>
#define ll long long
#define ull unsigned long long
using namespace std; 
/*
struct edge{
	int to, nxt, w, h;
}e[400005];
int head[200005], tot = 1;*/
ll a[300005], n, ans, mod = 1000000007, tp;
signed main() 
{
	while (~scanf("%lld", &n))
	{
		ans = 0;
		for (int i = 0; i < n; i++)
			scanf("%lld", &a[i]); 
		for (int i = 0; i < 60; i++)
		{
			tp = 0;
			for (int j = 0; j < n; j++)
			{
				if ((a[j] >> i) & 1)
				{
					tp++;
				}
			}
			ans = (ans + ((ll)1 << i) % mod * tp % mod * (n - tp)) % mod;
		}
		printf("%lld\n", ans);
	}
}


Measured memory_bytes: 2560
import java.util.Scanner;

/**
 *
 * @author cs18097
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int lg = s.length() -1;
        int ans = 0;
        char[] str = s.toCharArray();
        for(int i = 0;i <= lg/2;i++){
            if(str[i]!=str[lg-i])ans++;
        }
        System.out.print(ans);
    }
    
}


Measured memory_bytes: 23508
N = int(input())
W = [input() for i in range(N)]


ans = "Yes"
for i in range(N - 1):
  if W[i] in W[i + 1:]:
    ans = "No"
    break
  elif W[i][-1] != W[i + 1][0]:
    ans = "No"
    break
print(ans)  

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

typedef long long ll;
typedef long double ld;

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

    ll X;
    cin >> X;

    ll count = 0;

    for(ll i = 1LL;; i++) {
        count += i;
        if(count >= X) {
            cout << i << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
	int n,a[1010],b[1010],c[1010],i,j;
	long long t=0;
	scanf("%d",&n);
	for(i=0;i<n-1;i++)scanf("%d %d %d",&a[i],&b[i],&c[i]);
	for(i=0;i<n;i++){
		t=0;
		for(j=i;j<n-1;j++){
			t=t<b[j]?b[j]:t;
			t+=c[j]-((t-1)%c[j]+1);
			t+=a[j];
		}
		printf("%lld\n",t);
	}
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
  double n,ans;
  while(  cin >> n){
    ans = n;
    for(int i = 2 ; i <= 10 ; i++){
      if(i%2 == 1){
	n = n/3.0;
	ans += n;
      }
      else{
	n*=2.0;
	ans +=n;
      }
    }
    printf("%.6f\n",ans);
  }
}

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

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

    int ans[n];
    for(int i = 0; i < n; i++) {
        int a;
        cin >> a;
        ans[a - 1] = i + 1;
    }

    for(int i = 0; i < n; i++) {
        cout << ans[i] << ' ';
    }
    cout << endl;
   
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <cstdio>

#define fol(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
    int n,a,count = 0,ans=0,index=0;
    cin >>n;
    fol(i,n){
        if (index!=i-1) count = 0;
        cin >>a;
        if (a==i+1){
            if (count !=1) {
                count = 1,index = i;
                ans++;
            }else{
                count = index = 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
// #include <boost/dynamic_bitset.hpp>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <chrono>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeindex>
#include <typeinfo>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define DEBUG(x) cout << #x << ": " << x << endl
#define INFILE() freopen("input.txt", "r", stdin)
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define REPC(i, a) REP(i, 0, a)
#define RREP(i, a, b) for (int i = (a); i >= (b); i--)
#define RREPC(i, a) RREP(i, a, 0)
#define ALL(s) begin(s), end(s)
#define RALL(s) rbegin(s), rend(s)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_i = pair<ll, int>;
using i_ll = pair<int, ll>;
using d_i = pair<double, int>;
using ll_ll = pair<ll, ll>;
using d_d = pair<double, double>;

static constexpr ll LL_MOD = 1000000009;
static constexpr ll LL2_MOD = 1000000007;
static constexpr double EPS = numeric_limits<double>::epsilon();
static constexpr double PI = 3.14159265358979323846264338327950288;

static map<type_index, const char *const> scanType = { { typeid(int), "%d" },
{ typeid(ll), "%lld" },
{ typeid(double), "%lf" },
{ typeid(char), "%c" } };

template <class T> static void scan(vector<T> &v);
static void scan(vector<string> &v, bool isWord = true);
// static boost::dynamic_bitset<> scan(char trueValue = 'o');

int main(int argc, char *argv[]) {
	 //INFILE();
	 
	ll s, count = 1;
	cin >> s;

	map<ll, ll> ns;
	ns[s] = 1;

	ll prev = s;

	while (true) {
		count++;

		if (prev % 2 == 0) {
			if (ns.count(prev / 2) == 1) {
				cout << count << endl;
				return 0;
			}
				ns[prev  / 2] = count;
				prev = prev / 2;
			}
		else {
			if (ns.count(3 * prev + 1) == 1) {
				cout << count << endl;
				return 0;
			}
				ns[3 * prev + 1] = count;
				prev = 3 * prev + 1;
		}

	}
	return 0;
}

template <class T> static void scan(vector<T> &v) {
	auto tFormat = scanType[typeid(T)];
	for (T &n : v) {
		scanf(tFormat, &n);
	}
}

static void scan(vector<string> &v, bool isWord) {
	if (isWord) {
		for (auto &n : v) {
			cin >> n;
		}
		return;
	}

	int i = 0, size = static_cast<int>(v.size());
	string s;
	getline(cin, s);

	if (s.size() != 0) {
		i++;
		v[0] = s;
	}

	for (; i < size; ++i) {
		getline(cin, v[i]);
	}
}

//static boost::dynamic_bitset<> scan(char trueValue) {
//	string s;
//	getline(cin, s);
//
//	if (s.size() == 0) {
//		getline(cin, s);
//	}
//
//	for_each(begin(s), end(s),
//		[trueValue](char &c) { c = (c == trueValue) ? '1' : '0'; });
//	return boost::dynamic_bitset<>(string(rbegin(s), rend(s)));
//}


Measured memory_bytes: 888
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  for i in range(n-1)[::-1]:
    if l[i]>l[i+1]:
      l[i]-=1

  for i in range(n-1):
    if l[i]>l[i+1]:
      return 'No'

  # print(l)
  return 'Yes'

# main()
print(main())


Measured memory_bytes: 16716
x = input()

continus_s = 0
living_t_cnt = 0
for i in range(len(x)):
    if x[i] == 'S':
        if continus_s > 0:
            continus_s = 0
        continus_s -= 1
    else:
        continus_s += 1
        if continus_s > 0:
            living_t_cnt += 1
print(living_t_cnt*2)

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

struct edge{ int u,v,cost; };
const int MAX_V = 100000;
int par[MAX_V + 10];
int rankrank[MAX_V + 10];
vector<edge> es;
int V, E;

void init(int n){
    for (int i = 0; i < n; i++){
        par[i] = i;
        rankrank[i] = 0;
    }
}

int getRoot(int x){
    if (par[x] == x){
        return x;
    }else{
        return par[x] = getRoot(par[x]);
    }
}

void unite(int x, int y){
    x = getRoot(x);
    y = getRoot(y);
    if (x == y) return;
    if (rankrank[x] == rankrank[y]) {
        par[y] = x;
        rankrank[x]++;  
    }else if (rankrank[x] < rankrank[y]) {
        par[x] = y;
    }else if (rankrank[x] > rankrank[y]) {
        par[y] = x;
    }
}

bool isSame(int x, int y){
    return getRoot(x) == getRoot(y);
}

bool comp(const edge& e1, const edge& e2){
    return e1.cost < e2.cost;
}

int kruskal(){
    sort(es.begin(), es.end(), comp); 
    for (auto i = es.begin(); i != es.end(); ++i){
        edge e = *i;
    }
    init(V);

    int res = 0;
    for (auto i = es.begin(); i != es.end(); ++i){
        edge e = *i;
        if (!isSame(e.u, e.v)){
            unite(e.u, e.v);
            res += e.cost;
        }
    }
    return res;
}


int main(){
    cin >> V;
    vector <pair<int, int>> X,Y;
    for (int i = 0; i < V; ++i){
        int x,y;
        cin >> x >> y;
        X.push_back(make_pair(x,i));
        Y.push_back(make_pair(y,i));
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
  
    for (auto i = X.begin(); i != X.end(); ++i){
        pair<int, int> prev, next; 
        int pf, ps, nf, ns;
        if (i == X.begin()){
            prev = *i;
            pf = prev.first;
            ps = prev.second;
        }else{
            next = *i;
            nf = next.first;
            ns = next.second;
            es.push_back(edge{ps, ns, abs(nf - pf)});
            prev = next;
            pf = prev.first;
            ps = prev.second;
        }   
    }
  
    for (auto i = Y.begin(); i != Y.end(); ++i){
        pair<int, int> prev, next; 
        int pf, ps, nf, ns;
        if (i == Y.begin()){
            prev = *i;
            pf = prev.first;
            ps = prev.second;
        }else{
            next = *i;
            nf = next.first;
            ns = next.second;
            es.push_back(edge{ps, ns, abs(nf - pf)});
            prev = next;
            pf = prev.first;
            ps = prev.second;
        }   
    }
    cout << kruskal() << endl;
    return 0;
}

Measured memory_bytes: 7144
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    string S;
    cin >> S;
    if(S[0] < 'a'){
        fin("A");
    }else{
        fin("a");
    }
    return 0;
}

Measured memory_bytes: 3044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
using pii = pair<int, int>;

struct judge {
  string str;
  int count;

  judge(string temp) {
    str = temp;
    count = 0;
  }
};
int main() {
  int n;
  cin >> n;

  judge j[4] = {judge("AC"), judge("WA"), judge("TLE"), judge("RE")};

  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    for (int k = 0; k < 4; k++) {
      if (j[k].str == temp) j[k].count++;
    }
  }

  for (int i = 0; i < 4; i++) {
    cout << j[i].str << " x " << j[i].count << endl;
  }
}

Measured memory_bytes: 3620
#-*-coding:utf-8-*-
import bisect

def main():

    n = int(input())
    a_list = list(map(int, input().split()))
    b_list = list(map(int, input().split()))
    c_list = list(map(int, input().split()))

    a_list.sort()
    b_list.sort()
    c_list.sort()

    cnt = 0
    
    for b in b_list:
        i = bisect.bisect_left(a_list, b)
        j = n - bisect.bisect_right(c_list, b)
        cnt += i * j
    
    print(cnt)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 22964
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;

int main() {
	int n, x, i, input, tmp, sa, ans=0;
	cin >> n >> x;
	for (i = 0; i < n; i++) {
		cin >> input;
		sa = abs(input - x);
		if (i == 0) {
			ans = sa;
		}
		else if (sa % ans != 0) {
			tmp = sa % ans;
			while (tmp != 0) {
				sa = ans;
				ans = tmp;
				tmp = sa % ans;
			}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
ll test[12345678], res[12345678];
signed main() {
	vector<char> v; map<ll, ll> cost;
	ll n, m, a, b, c, x, cnt = 0, ans = 1000000; string s, t;
	cin >> n; test[0]++;
	for (int h = 0; h < n; h++) {
		cin >> a; a = min(a, 24 - a); test[h] = a;
	}
	test[n] = 0; sort(test, test + n + 1);
	for (int h = 0; h <= n; h++) {
		if (h == 0) { ans = min(ans, abs(test[h] - test[n])); }
		else { ans = min(ans, abs(test[h - 1] - test[h])); }
	}
	for (int i = 0; i <= (1 << 11); i++) {
		vector<ll> sep = { }; cnt = 10000;
		for (int h = 0; h <= n; h++) {
			res[h] = test[h];
		}
		for (int j = 0; j <= 10; j++) {
			if ((i & (1 << j)) > 0) {
				sep.push_back(j + 1);
			}
		}
		//if (sep.size() == 0) { continue; }//?
		for (int h = 0; h < sep.size(); h++) {
			for (int j = 0; j <= n; j++) {
				if (res[j] == sep[h]) { res[j] = 24 - res[j]; break; }
			}
		}
		sort(res, res + 1 + n);
		for (int h = 0; h <= n; h++) {
			//cout << i << ' ' << res[h] << endl;
			if (h == 0) { cnt = min(cnt, min(abs(res[h] - res[n]), 24 - abs(res[h] - res[n]))); }
			else { cnt = min(cnt, min(abs(res[h - 1] - res[h]), 24 - abs(res[h - 1] - res[h]))); }
		}
		ans = max(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2304
#include <cstdio>
const int mo=1000000007;
int f[3005][3005][2];
int main(){
	int n,m;
	scanf("%d%d\n",&n,&m);
	for (int i=0;i<=n;i++) f[0][i][i==0]=1;
	for (int i=0;i<m;i++)
		for (int j=0;j<=n;j++)
			for (int k=0;k<2;k++)
			if (f[i][j][k]){
				int x=f[i][j][k];
				if (j) (f[i+1][j-1][k||j==1]+=x)%=mo,(f[i+1][j][k||j==1]+=x)%=mo;
				if (j<n) (f[i+1][j][k]+=x)%=mo,(f[i+1][j+1][k]+=x)%=mo;
			}
	int ans=0;
	for (int i=0;i<=n;i++) (ans+=f[m][i][1])%=mo;
	printf("%d\n",ans);
}

Measured memory_bytes: 70656
#pragma GCC optimize("Ofast")
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include<bits/stdc++.h>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}
void F(); 
signed main() {
	fast_cin();
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(5);
	int t=1;
	// cin>>t;
	fr(i,1,t) {
		F();
	}

return 0;
}
void F() {
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(s.length()&1) {
		cout << "No" ; 
	}
	else 
	{
		// int n = s.length() ; 
		if(s.substr(0,n/2) == s.substr(n/2,n/2)) {
			cout<<"Yes";
		}
		else
		{
			cout<<"No";
		}
		
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <cstdlib> //絶対値 abs()
using namespace std;


int main(){
	int n,l;
	cin >> n >> l;
	vector<string> s(n);
	for(int i=0; i<n; i++){
		cin >> s[i];
	}
	sort(s.begin(),s.end());

	for(int i=0; i<n; i++){
		cout << s[i];
	}
	return 0;

}

Measured memory_bytes: 256
function Main(input) {

    s = input.split("");

    for (var i = 0; i < s.length; i++) {
        s[i] = parseInt(s[i], 10);
    }

    var count0 = 0;
    var count1 = 0;

    for (var i = 0; i < s.length; i++) {
        if (s[i] == 0) {
            count0++;
        }
    }

    for (var i = 0; i < s.length; i++) {
        if (s[i] == 1) {
            count1++;
        }
    }

    var value = Math.min(count0, count1);

    console.log(value * 2);
}



Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 8384
#include <stdio.h>

int main(void){
	int N, a;
	int min, max;
	int i;

	scanf("%d", &N);

	min = 1000;
	max = 0;
	i = 0;
	while (i < N)
	{
		a = 0;
		scanf("%d ", &a);

		if (max < a)
		{
			max = a;
		}
		if (a < min)
		{
			min = a;
		}
		i++;
	}

	printf("%d", max - min);

	return 0;
}

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

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


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n,k,s;
    cin>>n>>k>>s;
    if(s<(ll)1e9)
    {
        for (int i = 0; i < n; i++)
        {
            if(i<k)
            {
                cout<<s;
            }
            else
            {
                cout<<(ll)1e9;
            }
            
            if(i<n-1)
            {
                cout<<" ";
            }
            else cout<<endl;
        }        
    }
    else
    {
        for (int i = 0; i < n; i++)
        {
            if(i<k)
            {
                cout<<s;
            }
            else
            {
                cout<<1;
            }
            
            if(i<n-1)
            {
                cout<<" ";
            }
            else cout<<endl;
        }  
    }
    
    
    return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define mod 1000000007
#define string_mod 2549536629329_base_255
#define pb push_back
#define F first
#define S second
#define ff first
#define endl "\n"
#define ss second
#define all(v) v.begin(), v.end()
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    //  cout << x << " ";
    while (y > 0)
    {

        if (y & 1)
            res = (res * x) % p;

        y = y >> 1;
        x = (x * x) % p;
    }
    return res % p;
}
int lcm(int a, int b)
{
    return (a * b) / __gcd(a, b);
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc;
    tc = 1;
    while (tc--)
    {
        int n;
        cin >> n;
        string a, b;
        cin >> a >> b;
        for (int i = 0;i < n; i++)
        {
            cout << a[i] << b[i];
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
const int N = 2e5 + 5; 
using namespace std;

int n, a[N], b[N];
char s[N]; 

template < typename T >
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if(c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
	return x * w; 
}

bool solve(int pos, int x, int y)
{
	b[pos] = x, b[pos + 1] = y, b[pos - 1] = b[pos] ^ a[pos] ^ b[pos + 1];
	for(int i = pos + 1; i < 2 * n; i++) b[i + 1] = b[i] ^ a[i] ^ b[i - 1]; 
	if(b[2 * n] == b[n] && b[2 * n] ^ a[2 * n] == b[2 * n - 1] ^ b[n + 1]) return 1; 
	return 0; 
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("cpp.in", "r", stdin); 
#endif
	n = read <int> (), scanf("%s", s + 1);
	for(int i = 1; i <= n; i++) a[i] = a[i + n] = s[i] == 'o';
	if(solve(n + 1, 0, 0))
	{
		for(int i = n + 1; i <= 2 * n; i++) printf("%c", b[i] ? 'S' : 'W');
		puts(""); return 0; 
	}
	if(solve(n + 1, 0, 1))
	{
		for(int i = n + 1; i <= 2 * n; i++) printf("%c", b[i] ? 'S' : 'W');
		puts(""); return 0; 
	}
	if(solve(n + 1, 1, 0))
	{
		for(int i = n + 1; i <= 2 * n; i++) printf("%c", b[i] ? 'S' : 'W');
		puts(""); return 0; 	
	}
	if(solve(n + 1, 1, 1))
	{
		for(int i = n + 1; i <= 2 * n; i++) printf("%c", b[i] ? 'S' : 'W');
		puts(""); return 0; 
	}
	puts("-1"); 
	return 0; 
}


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

int n, m, x[10];
int c[10]={0,2,5,5,4,5,6,3,7,6};
string d[10005];

string f(string p, string q) {
	int ps = p.size();
	int qs = q.size();
	if(ps>qs || ps==qs && p>q) return p;
	else return q;
}

int main() {
	int i, j, t;
	cin >> n >> m;
	while(m--) {
		cin >> t;
		x[c[t]] = max(x[c[t]], t);
	}
	for(i=1; i<=n; i++) d[i] = ".";
	d[0] = "";
	for(i=2; i<=n; i++) {
		for(j=2; j<=8; j++) {
			t = x[j];
			if(!t || i<j || d[i-j]==".") continue;
			d[i] = f(d[i], d[i-j] + (char)(t+'0'));
		}
	}
	cout << d[n];
	return 0;
}


Measured memory_bytes: 41600
import collections

n = int(input())
a = list(map(int, input().split()))
ac = collections.Counter(a)
if n % 2:
    if ac[0] != 1:
        print(0)
        exit()
    for i in ac:
        if i == 0:
            continue
        if ac[i] != 2:
            print(0)
            exit()
else:
    if ac[1] != 2:
        print(0)
        exit()
    for i in ac:
        if i == 1:
            continue
        if ac[i] != 2:
            print(0)
            exit()
mod = 10 ** 9 + 7
print((2 ** (n // 2)) % mod)

Measured memory_bytes: 14820