akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <complex>

using namespace std;
typedef long long ll;


typedef complex<double> xy_t;
double dot_product(xy_t a, xy_t b) { return (conj(a)*b).real(); }
double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

vector<int> G[100005];
std::vector<P> tree[100010];

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

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define re(i,a,b) for(i=a;i<=b;i++)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl;

ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans=0;
ll a,b,c,d,e,h,w;
ll start,end;

ll x[500005],y[500005],z[500005];
string s,t,u;
bool flag;
bool check[100005];


int main(){
    cin>>n;
    cin>>u;
    m = (1<<n);
    s = u.substr(0,n);
    t = u.substr(n,n);
    reverse(t.begin(),t.end());
    map<pair<string,string>,ll> mp;
    vector<pair<string,string>> v;
    for(i=0;i<m;i++){
        string a,b,c,d;
        for(j=0;j<n;j++){
            if((i>>j) & 1){
                a = a + s[j];
                c = c + t[j];
            }else{
                b = b + s[j];
                d = d + t[j];
            }
        }
        
        //deba(a);
        mp[pair<string,string>(a,b)]++;
        v.pb(pair<string,string>(c,d));
    }
    for(i=0;i<v.size();i++){
        ans += mp[v[i]];
    }
    p(ans);
    
    return 0;
}


Measured memory_bytes: 98156
#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;
/*template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
*/typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pl;
typedef pair<int,int> pii;

#define LOCAL 0
#define dbg(x) cout << #x << " is " << x << "\n"
#define gll(x) scanf("%d",&x)
#define gll2(x,y) scanf("%d%d",&x,&y)
#define gll3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define gllarr(arr,n) f(i,n) gll(arr[i]);
#define sz(x) ((int)x.size())
#define s(x) sort(x.begin(),x.end())
#define all(v) v.begin(),v.end()
#define rs(v) { s(v) ; r(v) ; }
#define r(v) {reverse(all(v));}
#define pb push_back
#define f(i,n) for(int i=0;i<n;i++)
#define fr(i,n) for(int i=n-1;i>=0;i--)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)

const ll mod = (ll)1e9 + 7;
const ll inf = (ll)1e16;
const ld eps = 1e-12;
const ll N = (int)1e5 + 5;
const ll LOGN = 19;
const ld PI = 3.14159265358979323846;
inline ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
inline ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
inline ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    if (LOCAL) {
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\input.txt", "r", stdin);
        freopen("C:\\Users\\Dishant\\Desktop\\Collection-DEV c++\\output.txt", "w", stdout);
    }
    ll n, k;
    cin>>n>>k;
    ld ans = 0;
    for(ll i = 1; i <= n; i++){
        ll curr_score = i;
        ll to = 0;
        while(curr_score < k){
            curr_score *= 2ll;
            to++;
        }
        ld to2 = (ld)pow((ld)2, (ld)to);
        ld to_add = (ld)1/(ld)n;
        to_add = to_add * (ld)1/(ld)to2;
        ans += to_add;
    }
    cout<<setprecision(15)<<fixed<<ans;
    return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x = scanner.nextInt();
		int y = scanner.nextInt();

		int[] member = new int[x];
		for (int i = 0; i < member.length; i++) {
			member[i] = scanner.nextInt();
		}

		scanner.close();

		int ans = 0;
		for (int i : member) {
			if (i >= y) {
				ans++;
			}
		}

		System.out.println(ans);
	}
}

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

int main()
{
    int N;
    cin >> N;
    cout << (N + 1) / 2 << endl;
}

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

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int M = scan.nextInt();
        int[] p = new int[M];
        boolean[] result = new boolean[N];
        int[] wa_list = new int[N];
        for (int i = 0; i < M; i++) {
            p[i] = scan.nextInt()-1;
            String s = scan.next();
            boolean is_ac = "AC".equals(s) ? true : false;
            if (is_ac) {
                result[p[i]] = is_ac;
            }
            if (!is_ac && !result[p[i]]) {
                wa_list[p[i]] += 1;
            }
        }
        int ac_count = 0;
        int wa_count = 0;
        for (int i = 0; i < N; i++) {
            if (result[i]) {
                ac_count += 1;
                wa_count += wa_list[i];
            }
        }
        System.out.printf("%d %d\n", ac_count, wa_count);
    }
}


Measured memory_bytes: 64076
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll x, k, d;
  cin >> x >> k >> d;
  ll ans = -1;
  if(x < 0) x *= -1;
  ll a = x%d;
  ll b = d-a;
  ll p = (x-a)/d;
  ll q = p+1;
  if(k < p){
    ans = x - k*d;
  }else{
    if(k%2 == p%2) ans = a;
    else ans = b;
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int N=1e5+5,mo=1e9+7;

typedef long long LL;

int n,m,g[4][4],f[4][4],c[4][4],p[N];

int a[4][4]={
	{1,1,2,1},{1,1,2,1},{1,0,1,1},{1,0,0,1}
};

int b[4][4]={
	{0,1,2,1},{0,1,2,1},{0,0,1,1},{0,0,0,1}
};

char ch;

int read()
{
    int x=0,sig=1;
    for (ch=getchar();ch<'0' || ch>'9';ch=getchar()) if (ch=='-') sig=-1;
    for (;ch>='0' && ch<='9';ch=getchar()) x=x*10+ch-48;
    return x*sig;
}

void mulg()
{
	memset(c,0,sizeof(c));
	for (int i=0;i<4;i++) for (int k=0;k<4;k++) for (int j=0;j<4;j++)
		c[i][j]=(c[i][j]+(LL)g[i][k]*f[k][j])%mo;
	memcpy(g,c,sizeof(g));
}

void mulf()
{
	memset(c,0,sizeof(c));
	for (int i=0;i<4;i++) for (int k=0;k<4;k++) for (int j=0;j<4;j++)
		c[i][j]=(c[i][j]+(LL)f[i][k]*f[k][j])%mo;
	memcpy(f,c,sizeof(f));
}

void mula()
{
	memset(c,0,sizeof(c));
	for (int i=0;i<4;i++) for (int k=0;k<4;k++) for (int j=0;j<4;j++)
		c[i][j]=(c[i][j]+(LL)f[i][k]*a[k][j])%mo;
	memcpy(f,c,sizeof(f));
}

void mulb()
{
	memset(c,0,sizeof(c));
	for (int i=0;i<4;i++) for (int k=0;k<4;k++) for (int j=0;j<4;j++)
		c[i][j]=(c[i][j]+(LL)f[i][k]*b[k][j])%mo;
	memcpy(f,c,sizeof(f));
}

void quick(int x)
{
	if (!x) return;
	quick(x>>1);
	mulf();
	if (x&1) mula();
}

int main()
{
	n=read(); m=read();
	g[0][0]=g[1][1]=g[2][2]=g[3][3]=1;
	for (int i=1;i<=m;i++)
	{
		memset(f,0,sizeof(f));
		f[0][0]=f[1][1]=f[2][2]=f[3][3]=1;
		p[i]=read();
		quick(p[i]-p[i-1]-1);
		mulb();
		mulg();
	}
	memset(f,0,sizeof(f));
	f[0][0]=f[1][1]=f[2][2]=f[3][3]=1;
	quick(n-p[m]);
	mulg();
	printf("%d\n",g[0][0]);
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<n;++i)
#define rep2(i,a,b) for (ll i=a;i<b;++i)
const ll MOD=1000000007;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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

int main(){
    int a,b;
    cin >> a >> b;
    cout << max(0,a-2*b) << endl;
}

Measured memory_bytes: 256
void main() {
	"%(%d %)".writefln(generate_prime_list(2000).filter!(a => a % 5 == 1).take(ri));
}

ulong[] generate_prime_list(T)(T N) if(isIntegral!T) {
	ulong[] prime_list = [2];
	bool not_prime = false;
	foreach(i; 3..N.to!ulong+1) {
		auto p = i.to!float.sqrt.ceil.to!ulong;
		foreach(j; prime_list) {
			if(j > p) break;
			if(i % j == 0) {
				not_prime = true;
				break;
			}
		}
		if(!not_prime) prime_list ~= i;
		not_prime = false;
	}
	return prime_list;
}

// ===================================

import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}

T[] deepcopy(T)(T[] a) {
	static if(isArray!T) {
		T[] res;
		foreach(i; a) {
			res ~= deepcopy(i);
		}
		return res;
	} else {
		return a.dup;
	}
}


Measured memory_bytes: 256
/******************************************************************************

Coder :         rajath_pai
date :          17/05/2020
Contest :       AtCoder Beginner Contest 168
problem :       A - ∴ (Therefore)
link :          atcoder.jp/contests/abc168

*******************************************************************************/
#include<bits/stdc++.h>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;

#define w(x)            int x;  cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define fo(i,a,b)       for(int i = a; i < b; i++)
//int tc = 0;
//printf("Case #%d: %d\n",tc,);

/*
    string binary = bitset<8>(input number).to_string(); //to binary
    cout<<binary<<"\n";

    unsigned long decimal = bitset<8>(binary).to_ulong();   //binary to decimal
    cout<<decimal<<"\n";
*/

int main(){
    FIO;
    //w(t)
       //tc++;
       int k;
       string s;
       cin >>k>>s;
       if(s.length() > k ){
           for(int i =0;i<k;i++){
               cout<<s[i];
           }
           cout<<"...";
       }
       else{
           cout<<s;
       }
    return 0;
}


Measured memory_bytes: 3652
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    int n,k,ans=1;
    scanf("%d\n%d",&n,&k);
    for(int i=0;i<n;i++) ans+=min(ans,k);
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back

string s;

int main(){
	
	cin >> s;
	for ( int i = 1; i < 3; i++ ){
		if ( s[i] != s[i-1] ){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

s = list(map(int, list(input())))[::-1] + [0]*2
n = len(s) - 1
cnt = 0
fl = 0
for i in range(n+1):
    if s[i] > 5 or (s[i] == 5 and s[i+1] >= 5):
        cnt += 10 - s[i]
        s[i+1] += 1
    else:
        cnt += s[i]

print(cnt)


Measured memory_bytes: 21084
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<iomanip>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<cmath>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>
    #include<cassert>
    #include<cmath>
    #include<cstdint>
     
    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
    #define ALL(a)  (a).begin(),(a).end()
     
    using namespace std;
    using ll = long long;
    using Graph = vector<vector<int>>;
    using P = pair<int, int>;
     
const int MOD = 1e9 + 7;


int main(){
   int l, r, d;
   cin >> l >> r >> d;
   ll res = 0;
   REP(i, l, r){
      if(i % d == 0)res++;
   }
   cout << res << endl;
}


Measured memory_bytes: 3616
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.FileStore;

public class Main {

  public static void main(String[] args) throws IOException {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      String[] order;
      StringBuilder result = new StringBuilder(n*4);
      Dictionary dict = new Dictionary(10_000_000);

      for(int i=0; i<n; i++) {
        order = br.readLine().split(" ");
        switch( order[0] ) {
          case "insert" :
            dict.insert(order[1]);
            break;
          case "find" :
            result.append( dict.find(order[1]) ).append("\n");
            break;
        }
      }

      System.out.print(result);
    }
  }
}

class Dictionary {
  boolean[] dict;

  public Dictionary(int size) {
    dict = new boolean[size];
  }

  public void insert(String str) {
    int key   = getKey(str);
    dict[key] = true;
  }
  public String find(String ref) {
    int key = getKey(ref);

    return isExist(key) ? "yes" : "no";
  }
  private int getKey(String str) {
    int len = str.length();
    int ret = 0;
    StringBuilder buf = new StringBuilder();
    for(int i=0; i<len; i++ ) {
      buf.append( str1ToInt(str.substring(i,i+1)) );
    }
    ret = Integer.parseInt(buf.toString(), 5);

    return ret;
  }
  private boolean isExist(int key) {

    return dict[key];
  }
  private int str1ToInt(String s1) {

    switch( s1 ) {
      case "A" :
        return 1;
      case "C" :
        return 2;
      case "G" :
        return 3;
      case "T" :
        return 4;
      default :
        return -1;
    }

  }
}


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

int main() {
	int h,w;
	cin>>h>>w;
	vector<string>a(h);
	for (int i=0; i<h; i++){
		cin>>a[i];}

	vector<bool> row(h, false);
	vector<bool> col(w, false);
	for (int i=0; i<h; i++) {
		for (int j=0; j<w; j++){
			if(a[i][j]=='#'){  // '#'を一つでも含む行列はtrueに設定され、
				row[i] = true; // 下記のコードで出力の対象にされる
				col[j] = true;
			}
		}
	}

	for (int i=0; i<h; i++){
		if (row[i]) {
			for (int j=0; j<w; j++){
				if(col[j]){
					cout<<a[i][j]; // '#'がある行列の中で'#'マスだけ出力する
				}                  // 全て'.'の行列は出力されないことになる
			}
			cout<<endl;  //　改行する
		}
	}
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define N 200005
#define INF 1ll<<60
#define int long long
#define LOG(x) cerr<<#x<<" = "<<x<<endl
#define add_edge(u,v) nxt[++cnt]=head[u],head[u]=cnt,to[cnt]=v
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
char ch;bool fs;void re(int& x)
{
	while(ch=getchar(),ch<33);
	if(ch=='-')fs=1,x=0;else fs=0,x=ch-48;
	while(ch=getchar(),ch>33)x=x*10+ch-48;
	if(fs)x=-x;
}
using namespace std;
int n,a[N],b[N],f[N],g[N],ans=INF,fa[N];
int find(int x)
{
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
main()
{
	re(n);
	for(int i=1;i<=n;++i)re(a[i]);
	memcpy(b,a,sizeof a);
	memset(fa,0,sizeof fa);
	fa[n]=n;
	for(int i=n-1;i;--i)
	{
		f[i]=f[i+1];
		while(a[i]>a[i+1])
		{
			int fuck=i+1;
			a[i+1]*=4;
			while(fuck<n)
			{
				if(a[fuck]>a[fuck+1])
				{
					fuck=fa[fuck]=find(fuck+1);
					a[fuck]*=4;
				}
				else break;
			}
			f[i]+=(fuck-i)*2;
		}
		fa[i]=i;
	}
	memcpy(a,b,sizeof a);
	memset(fa,0,sizeof fa);
	fa[1]=1;
	for(int i=2;i<=n;++i)
	{
		g[i]=g[i-1];
		while(a[i]>a[i-1])
		{
			int fuck=i-1;
			a[i-1]*=4;
			while(fuck>1)
			{
				if(a[fuck]>a[fuck-1])
				{
					fuck=fa[fuck]=find(fuck-1);
					a[fuck]*=4;
				}
				else break;
			}
			g[i]+=(i-fuck)*2;
		}
		fa[i]=i;
	}
	for(int i=1;i<=n;++i)
		ans=min(ans,g[i-1]+i-1+f[i]);
	printf("%lld\n",ans);
}
/*
1 2 3 0 0 0 0 1 2 3
*/


Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
int main(){
string S;
  int64_t K;
  cin>>S>>K;
  int64_t N=S.size();
  int64_t Min=min(N-1,K-1);
  char c='1';
  for(int64_t i=0;i<=Min;i++){
  if(S.at(i)!='1'){
   c=S.at(i); break;
  }
  
  }cout<<c<<endl;

return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

using namespace std;

int main()
{
	set<string> s;

	int n;
	cin >> n;

	for (int i = 0; i < n; i++) {
		string instruction, keyword;
		cin >> instruction >> keyword;
		if (instruction == "insert") {
			s.insert(keyword);
		} else if (instruction == "find") {
			if (s.count(keyword) == 0) {
				cout << "no" << endl;
			} else {
				cout << "yes" << endl;
			}
		}
	}

	return 0;
}



Measured memory_bytes: 32152
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
#include <cassert>
#include <functional>

using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

int main() {
	//input
	int N;
	cin >> N;
	vector<ll> a(N), a_uni(N), a_cnt(3, 0);
	rep(i, N) {
		cin >> a[i];
		a_uni[i] = a[i];
	}

	//make a_uni's factor unique
	sort(all(a_uni));
	decltype(a_uni)::iterator result = unique(all(a_uni));
	a_uni.erase(result, a_uni.end());

	if (a_uni.size() == 1) {
		if (a_uni[0] != 0) {
			cout << "No" << endl;
		}
		else {
			cout << "Yes" << endl;
		}
	}
	else if (a_uni.size() == 2) {
		if (a_uni[0] == 0) {//ソートされるよね？
			rep(i, N) {
				if (a[i] == 0) {
					a_cnt[0]++;
				}
				else {
					a_cnt[1]++;
				}
			}
			if (a_cnt[1] == a_cnt[0] * 2) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
		else {
			cout << "No" << endl;
		}
	}
	else if (a_uni.size() == 3 && a_cnt[0] == 0) {
		rep(i, N) {
			if (a[i] == a_uni[0]) {
				a_cnt[0]++;
			}
			else if (a[i] == a_uni[1]) {
				a_cnt[1]++;
			}
			else {
				a_cnt[2]++;
			}
		}
		if (a_cnt[0] == a_cnt[1] && a_cnt[1] == a_cnt[2]) {
			if ((a_uni[0] ^ a_uni[1]) == a_uni[2]) {
				cout << "Yes" << endl;
			}
			else {
				cout << "No" << endl;
			}
		}
		else {
			cout << "No" << endl;
		}
	}
	else {
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 1792
# -*- coding: utf-8 -*-
from math import gcd

def solve():
    K = int(input())
    M = [[gcd(i,j) for j in range(K+1)] for i in range(K+1)]
    res = sum(M[j][k] for m in M[1:] for j in m[1:] for k in range(1,K+1))
    return str(res)


if __name__ == '__main__':
    print(solve())



Measured memory_bytes: 9488
using System;
namespace ABC083B_SomeSums
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int a = int.Parse(str[1]);
            int b = int.Parse(str[2]);

            int total = 0;

            for (int i = 1; i <= n; i++)
            {
                int p = i;
                int q = p % 10;
                while (p >= 10)
                {
                    p /= 10;
                    q += p % 10;
                }
                if (a <= q && q <= b)
                {
                    total += i;
                }
            }
            Console.WriteLine(total);

        }
    }
}


Measured memory_bytes: 13140
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = IntStream.range(0, n).map(i -> sc.nextInt()).toArray();
		sc.close();
		Student[] students = new Student[n];
		for (int i = 0; i < n; i++) {
			students[i] = new Student(i + 1, a[i]);
		}
		Arrays.sort(students);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append(i > 0 ? " " : "");
			sb.append(students[i].getId());
		}
		System.out.println(sb.toString());
	}

	public static class Student implements Comparable<Student> {
		private int id;
		private int order;

		public Student(int id, int order) {
			this.id = id;
			this.order = order;
		}

		public int getId() {
			return id;
		}

		public int getOrder() {
			return order;
		}

		@Override
		public int compareTo(Student target) {
			if (this.order > target.getOrder()) {
				return 1;
			} else if (this.order < target.getOrder()) {
				return -1;
			}

			return 0;
		}
	}
}


Measured memory_bytes: 52364
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int H, W;
void calc( vector <vector <bool> >& vec, int i, int j, vector <vector <int> >& dist, int n ){
	if (i == H || i == -1 || j == -1 || j == W)
		return;
	if (vec[ i ][ j ] && ( dist[ i ][ j ] > n || dist[ i ][ j ] < 0 )){
		dist[ i ][ j ] = n;
		n++;
		calc( vec, i + 1, j, dist, n );
		calc( vec, i, j + 1, dist, n );
		calc( vec, i - 1, j, dist, n );
		calc( vec, i, j - 1, dist, n );
	}
}

int main( void ){
	cin >> H >> W;
	vector <vector <bool> > vec( H, vector <bool>( W ));
	rep( i, 0, H ){
		rep( j, 0, W ){
			char str;
			cin >> str;
			if (str == '.')
				vec[ i ][ j ] = true;
			else
				vec[ i ][ j ] = false;
		}
	}

	int maximum = 0;
	vector <vector <int> > dist( H, vector <int>( W ));
	rep( i, 0, H ){
		rep( j, 0, W ){
			rep( k, 0, H )
			rep( l, 0, W )
			dist[ k ][ l ] = -1;
			calc( vec, i, j, dist, 0 );
			rep( k, 0, H )
			rep( l, 0, W )
			maximum  = max( maximum, dist[ k ][ l ] );
		}
	}
	cout << maximum << endl;


}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}


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();
        int amount=100000;
        for(int i=0;i<n;i++) {
            amount*=1.05;
            amount=amount%1000>0?(amount/1000+1)*1000:amount;
        }
        System.out.println(amount);
        sc.close();
    }
}


Measured memory_bytes: 26028
#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 mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    ll n;
    cin>>n;
    ll i,j;
    ll a[n];
    for(i=0;i<n;i++)cin>>a[i];
    string print[3];
    print[0]="pairwise coprime";
    print[1]="setwise coprime";
    print[2]="not coprime";

    unordered_map<ll,ll> m;
    ll g=0;
    for(i=0;i<n;i++)
    {
        g=gcd(g,a[i]);
        // cout<<a[i]<<" ";
        for(j=2;j*j<=a[i];j++)
        {
            if(a[i]%j==0)
            {
                m[j]++;
                // cout<<j<<" ";
                while(a[i]%j==0)
                {
                    a[i]/=j;
                }
            }
        }
        if(a[i]>1)
        {
            // cout<<a[i]<<" ";
            m[a[i]]++;
        }
        // cout<<"\n";
    }
    
    ll f=0;
    for(auto it:m)
    {
        if(it.second>1)
        {
           f=1;
           break; 
        }
    }
    if(!f)
    {
        cout<<print[0];
        return;
    }
    if(g==1)
    {
        cout<<print[1];
        return;
    }
    cout<<print[2];

    
}



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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 14320
let memoize n f =
  let dp = Hashtbl.create n in
  let rec get x =
    try Hashtbl.find dp x with
    | Not_found ->
        let result = f get x in
        Hashtbl.add dp x result;
        result in
  get

let () = Scanf.scanf "%d\n" @@ fun n ->
  let cas = Array.init (2 * n) @@ fun _ -> Scanf.scanf "%c %d\n" @@ fun c a -> c, a in
  let inv_ws = Array.make n 0 in
  let inv_bs = Array.make n 0 in
  let acc_ws = Array.make_matrix (2 * n + 1) (n + 1) 0 in
  let acc_bs = Array.make_matrix (2 * n + 1) (n + 1) 0 in
  for i = 2 * n - 1 downto 0 do
    begin match cas.(i) with
    | ('W', a) ->
        inv_ws.(a - 1) <- i;
        acc_ws.(i).(a) <- 1 + acc_ws.(i).(a)
    | ('B', a) ->
        inv_bs.(a - 1) <- i;
        acc_bs.(i).(a) <- 1 + acc_bs.(i).(a)
    end;
    for j = 1 to n do
      acc_ws.(i).(j) <- acc_ws.(i).(j) + acc_ws.(i).(j - 1);
      acc_bs.(i).(j) <- acc_bs.(i).(j) + acc_bs.(i).(j - 1)
    done;
    for j = 0 to n do
      acc_ws.(i).(j) <- acc_ws.(i).(j) + acc_ws.(i + 1).(j);
      acc_bs.(i).(j) <- acc_bs.(i).(j) + acc_bs.(i + 1).(j)
    done
  done;
  let dp = Array.make_matrix (n + 1) (n + 1) max_int in
  dp.(0).(0) <- 0;
  for w = 1 to n do
    dp.(w).(0) <- dp.(w - 1).(0) - w + 1
      + inv_ws.(w - 1)
      + acc_ws.(inv_ws.(w - 1) + 1).(w)
  done;
  for b = 1 to n do
    dp.(0).(b) <- dp.(0).(b - 1) - b + 1
      + inv_bs.(b - 1)
      + acc_bs.(inv_bs.(b - 1) + 1).(b)
  done;
  for w = 1 to n do
    for b = 1 to n do
      dp.(w).(b) <- min
        ( dp.(w - 1).(b) + inv_ws.(w - 1)
          + acc_ws.(inv_ws.(w - 1) + 1).(w)
          + acc_bs.(inv_ws.(w - 1) + 1).(b) )
        ( dp.(w).(b - 1) + inv_bs.(b - 1)
          + acc_ws.(inv_bs.(b - 1) + 1).(w)
          + acc_bs.(inv_bs.(b - 1) + 1).(b) ) - w - b + 1
    done
  done;
  Printf.printf "%d\n" @@ dp.(n).(n)


Measured memory_bytes: 162104
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename X> ostream& operator << (ostream& x,const vector<X>& v){for(ll i=0;i<v.size();++i) x<<v[i]<<" ";return x;}
template <typename X> ostream& operator << (ostream& x,const set<X>& v){for(auto it:v) x<<it<<" ";return x;}
template <typename X, typename Y> ostream& operator << (ostream& x, const pair<X,Y>& v) {x<<v.ff<<" "<<v.ss;return x;}
template <typename T, typename S> ostream& operator << (ostream& os, const unordered_map<T, S>& v) { for (auto it : v) os << it.first << "=>" << it.second << endl; return os; }
struct pair_hash {inline std::size_t operator()(const std::pair<ll, ll> & v) const {return v.first*31+v.second;}};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC targett("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define fr first
#define sc second
#define prnt(m) for(auto it = m.begin() ; it != m.end() ; ++it){cout<<*it<<endl;}
#define tra(it,m) for(auto it=m.begin();it!=m.end();++it)
#define dbg(x) cout<<#x<<" = "<<x<<'\n';
#define fri(i,s,n) for(ll i=s;i<n;i++)
#define mod 1000000007LL
#define mod2 998244353
#define vct2 vector<vector<ll>>
#define vct vector<ll>
#define pll pair<ll,ll>
#define rz(n) resize(n)
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define arrin(a,n) for(ll i = 0; i < n ; i++){cin>>a[i];}
#define arrout(a,n) for(ll i = 0;i < n; i++){cout<<a[i]<<" ";}
#define ex(s) cout<<s<<endl,exit(0);
#define inf 4e18
#define five 100005;
#define six 1000005;
#define printclock cerr<<"Time"<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
//_______________________________________________________________________________________
int main()
{
       ld a,b;
       cin>>a>>b;
       ld ans = a*b;
       ans = floor(ans);
       cout<<(ll)(ans)<<endl;
}


Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }
using namespace std;
typedef long long ll;


int main() {
	int n;
	cin >> n;
	int m = n;
	int sum = 0;
	while(m){
		sum += m % 10;
		m /= 10;
	}
	cout << (n % sum ? "No" : "Yes") << endl;
	return 0;
}


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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000007;
const long long INF = 1LL << 60;
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; }

int main() {
    int K;
    cin >> K;
    string s = "ACL";
    string res;
    for (int i = 0; i < K; ++i) res += s;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main() {
	int n, m, count = 0;
	int s[10000], t[500];

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> t[i];
	}

	for (int i = 0; i < m; i++) {
		for (int j = 0; j < n; j++) {
			if (t[i] == s[j]) {
				count++;
				break;
			}
		}
	}

	cout << count << endl;

	return 0;
}

Measured memory_bytes: 1196
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
map<pair<ll,ll>,ll> mp;
ll f(ll i,ll x) {
  if(mp.count({i,x})) return mp[{i,x}];
  if(!x--) return 0;
  if(!i--) return 1;
  ll a=(1LL<<i+2)-3;
  ll res;
  if(!x) res=0;
  else if(x<a+1) res=f(i,x);
  else res=f(i,a)+f(i,x-a-1)+1;
  mp[{i+1,x+1}]=res;
  return res;
}
int main(){
  ll n,x;
  cin>>n>>x;
  cout<<f(n,x)<<endl;
}


Measured memory_bytes: 3648
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,a = LI()
    x = LI()
    m = 2501
    d = [[0]*m for i in range(n+1)]
    d[0][0] = 1
    for xi in x:
        for i in range(n)[::-1]:
            ni = i+1
            for j in range(m):
                if not d[i][j]:
                    continue
                k = j+xi
                if k >= m:
                    break
                d[ni][k] += d[i][j]
    ans = 0
    for i in range(1,n+1):
        k = a*i
        if k < m:
            ans += d[i][k]
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 41712
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;


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

    int H, W;
    cin >> H >> W;

    int a[505][505];
    CLR(a, 0);
    REP(i, H) REP(j, W) cin >> a[i][j];

    vector<pair<P, P> > ans;
    REP(i, H) REP(j, W - 1) {
            if (a[i][j] % 2 == 1) {
                a[i][j]--;
                a[i][j + 1]++;
                ans.push_back({{i, j},
                               {i, j + 1}});
            }
        }
    REP(i, H - 1) {
        if (a[i][W - 1] % 2 == 1) {
            a[i][W - 1]--;
            a[i + 1][W - 1]++;
            ans.push_back({{i,     W - 1},
                           {i + 1, W - 1}});
        }
    }

    cout << ans.size() << endl;
    REP(i, ans.size()) {
        auto prev = ans[i].first;
        auto next = ans[i].second;
        cout << prev.first + 1 << " " << prev.second + 1 << " " << next.first + 1 << " " << next.second + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 8432
#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;}

int main(){
    string a,b;cin>>a>>b;
    int t = stoi(a+b);
    string ans = "No";
    int u = sqrt(t);
    if(u*u==t) ans = "Yes";
    cout<<ans<<endl;


}

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

using namespace std;

const int MAXN = 1e5+10;

int n;
vector< int > graph[ MAXN ];
int prv[ MAXN ];
bool used[ MAXN ];

void init( ) {
	for( int i = 0; i < MAXN; ++i ) {
		used[ i ] = false;
		graph[ i ].clear();
		prv[ i ] = -1;
	}
}

int dfs( int u ) {
	int r = 1;
	used[ u ] = true;
	for( auto& v : graph[u] ) {
		if( !used[v] ) {
			r += dfs(v);
		}
	}
	return r;
}

vector< int > get_path( int f, int t ) {
	vector< int > p;
	queue< int > q;
	q.push( f ); prv[ f ] = -2;
	while( !q.empty() ) {
		int u = q.front(); q.pop();
		for( auto& v : graph[u] ) {
			if( prv[ v ] == -1 ) {
				prv[ v ] = u;
				q.push( v );
			}
		}
	}
	for( int u = t; u != -2; u = prv[u] ) {
		p.push_back( u );
		used[ u ] = true;
	}
	reverse( p.begin(), p.end() );
	return p;
}

int main( ) {
	
#ifdef LOCAL
	freopen( "input", "r", stdin );
#endif

	while( cin >> n ) {
		init( );
		for( int i = 1; i < n; ++i ) {
			int a, b; cin >> a >> b;
			graph[ a ].push_back( b );
			graph[ b ].push_back( a );
		}
		int ta = 0, tb = 0;
		vector< int > p = get_path( 1, n );
		for( int i = 0; i < p.size(); ++i ) {
			int val = dfs( p[i] );
			( i*2 < p.size() ? ta += val : tb += val );
		}
		cout << ( ta > tb ? "Fennec" : "Snuke" ) << '\n';
	}

	return 0;
}


Measured memory_bytes: 6908
#include<stdio.h>
void swap(int *a,int *b){
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
}
int GCD(int n,int m){
	if(m > n)
		swap(&n,&m);
	if(m == 0)
		return n;
	else
		return GCD(m,n%m);
}
int main(){
	int a,b,c;

	while(scanf("%d %d",&a,&b) != EOF){
		c = GCD(a,b);
		printf("%d %d\n",c ,(a/c)*b);
	}	
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, B;
  cin >> A >> B;
  string str;
  int cou = 0;
  for(int i = 0; i < A * B; i++) {
    cin >> str;
    cou++;
    if(str == "snuke") {
      break;
    }
  }
  int X = cou % B;
  int Y = (cou - X) / B + 1;
  if(X == 0) {
    X = B;
    Y--;
  }
  string alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  char W = alp.at(X - 1);
  cout << W << Y << endl;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n;
	char input[200];
	string str;

	scanf("%d", &n);

	scanf("%s", input);

	str = input;

	if (n % 2)
	{
		printf("No\n");

		return 0;
	}

	for (int i = 0; i < n / 2; i++)
	{
		if (str[i] != str[i + n / 2])
		{
			printf("No\n");

			return 0;
		}
	}

	printf("Yes\n");

	return 0;
}

Measured memory_bytes: 256
from itertools import combinations_with_replacement
N, M, Q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(Q)]

def f():
    for A in combinations_with_replacement(range(1, M + 1), N):
        pa = 1
        for a in A:
            if a < pa:
                break
        else:
            yield list(A)

ans = 0
for A in f():
    point = 0
    for a, b, c, d in abcd:
        if A[b-1] - A[a-1] == c:
            point += d
    ans = max(ans, point)
print(ans)

Measured memory_bytes: 68400
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

struct BIT {
	vector<LL>seg;
	int width;
	BIT(int x) :width(1) {
		while (width<x)width *= 2;
		seg.resize(width + 1);
	}
	void add(int x, LL val) {
		x++;
		while (x <= width) {
			seg[x] += val;
			x += (x&-x);
		}
	}
	LL query(int x) {
		LL res = 0;
		while (x>0) {
			res += seg[x];
			x -= (x&-x);
		}
		return res;
	}
};

int n, q;

int main() {
	cin >> n >> q;
	BIT bit(n);
	for (int i = 0; i<q; ++i) {
		int com, x, y;
		cin >> com >> x >> y;
		if (com == 0) {
			bit.add(x - 1, y);
		}
		else {
			LL ans = bit.query(y) - bit.query(x - 1);
			cout << ans << endl;
		}
	}
	return 0;
}




Measured memory_bytes: 3868
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>

using namespace std;

int main()
{
    long long n, a, b;
    cin >> n >> a >> b;

    long long ans;
    ans = n / (a + b) * a;

    n = n % (a + b);
    ans += min(n, a);

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int s[200005];
int main(){
    int n;
    cin >> n;
    long long int a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        s[i+1] = s[i] + a[i];
    }
    int x,y;
    long long int ans=1e18;
    long long int SUMA,SUMB,SUMC,SUMD;
    x=0; y=2;
    for(int i=2;i<n-1;i++){
        while(s[i]-s[x]>s[x])x++;
        while(s[n]-s[y]>s[y]-s[i])y++;
        for(int j=0;j<2;j++)for(int k=0;k<2;k++){
            SUMA=s[x-j]; SUMB=s[i]-s[x-j];
            SUMC=s[n]-s[y-k]; SUMD=s[y-k]-s[i];
            ans=min(ans,max(max(SUMA,SUMB),max(SUMC,SUMD))-min(min(SUMA,SUMB),min(SUMC,SUMD)));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = scan.nextInt();
		int x = scan.nextInt();
		int[] p = new int[n];
		int i;
		for(i = 0; i < n; i++)
			p[i] = scan.nextInt();
		int[] ap = new int[n];
		for(i = 0; i < n; i++)
			ap[i] = Math.abs(x - p[i]);
		int ans = ap[0];
		for(i = 1; i < n; i++)
			ans = gcd(ans, ap[i]);
		out.print(ans);
		out.flush();
	}
	public static int gcd(int a, int b) {
		if(b == 0)
			return a;
		return gcd(b, a % b);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

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


Measured memory_bytes: 24288
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <utility>

using namespace std;


int main() {
    int x,a;
    cin>>x>>a;
    
    cout<<((x>=a)?10:0)<<endl;
    return 0;
}


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

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}

int main(){
  int i,n,a[1024],r;
  while(scanf("%d",&n),n!=0){
    r=1234567890;
    for(i=0;i<n;i++){scanf("%d",&a[i]);}
    qsort(a,n,sizeof(int),sortfncsj);
    for(i=1;i<n;i++){r=min(a[i]-a[i-1],r);}
    printf("%d\n",r);
  }
  return 0;
}



Measured memory_bytes: 2036
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <algorithm>

using namespace std;
using ll = long long;
using ld = long double;

int main() {

    int A,B,C;
    cin >> A >> B >> C;
    cout << A*B/2<< endl;
    return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)

int N,K;
#define MAXN 2002
ll C[MAXN][MAXN];
void solve(int i){
    if(K-1<0||N-K+1<0){
        cout << 0<< endl;
        return;
    }
    ll ans = (C[K-1][i-1]*C[N-K+1][i]);
    cout << ans%MOD << endl;
}

int main(){
    cin >> N >> K;
    for(int j=0;j<=2001;j++){
        C[0][j] = 0;
    }
    for(int i=0;i<=2001;i++){
        C[i][0] = 1;
    }
    

    for(int i=1;i<=2001;i++)for(int j=1;j<=2001;j++){
        if(i==j)C[i][j] = 1;
        else if(i<j)C[i][j] = 0;
        else C[i][j] = C[i-1][j]+C[i-1][j-1];
        C[i][j]%=MOD;
    }
    int i=1;
    
    for(i=1;i<=K;i++){
        solve(i);
    }

    return 0;
}

Measured memory_bytes: 31616
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000000

int n,A[MAX];

void maxHeapify(int i){
  int l,r,largest,temp;
  l=2*i;
  r=2*i+1;

  if(l<=n && A[l]>A[i]){
    largest=l;
  }
  else{
    largest=i;
  }
  if(r<=n && A[r]>A[largest]){
    largest=r;
  }

  if(largest!=i){
    temp=A[i];
    A[i]=A[largest];
    A[largest]=temp;
    maxHeapify(largest);
  }
}

int main(){
  int i;

  scanf("%d",&n);

  for(i=1;i<n+1;i++){
    scanf("%d",&A[i]);
  }

  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }

  for(i=1;i<n+1;i++){
    printf(" %d",A[i]);
  }
  printf("\n");

  return 0;
}



Measured memory_bytes: 3652