akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
void *wmem;
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void rd(string &x){
  char *buf=(char *)wmem;
  rd(buf);
  x = buf;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(long long x){
  char f[20];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
char memarr[96000000];
int N;
string S[100000];
int main(){
  int i, j;
  long long res=0;
  wmem = memarr;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<(N);Lj4PdHRW++){
      rd(S[Lj4PdHRW]);
    }
  }
  for(i=0;i<(N);i++){
    sort(S[i].begin(), S[i].end());
  }
  sort(S, S+N);
  j = 0;
  for(i=(1);i<(N);i++){
    if(S[i]==S[i-1]){
      j++;
    }
    else{
      j = 0;
    }
    res += j;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20190810-2

// --- original code ---
// int N;
// string S[1d5];
// {
//   int i, j;
//   ll res = 0;
// 
//   rd(N,S(N));
//   rep(i,N) sort(S[i].begin(), S[i].end());
//   sort(S, S+N);
// 
//   j = 0;
//   rep(i,1,N){
//     if(S[i]==S[i-1]) j++;
//     else             j = 0;
//     res += j;
//   }
//   wt(res);
// }


Measured memory_bytes: 5760
import java.util.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	final int MOD = 1000000007;
	final int MAX = Integer.MAX_VALUE;
	final long LMAX = Long.MAX_VALUE;
	int LEN = 0;
	
	void doIt() {
		 int n = sc.nextInt();
		 if(n % 2 != 0) {
			 System.out.println("No");
			 return;
		 }
		 String s = sc.next();
		 if(s.substring(0, n / 2).equals(s.substring(n / 2, n))) {
			 System.out.println("Yes");
		 }
		 else {
			 System.out.println("No");
		 }
	}
	
	
	public static void main(String[] args) {
		new Main().doIt();
	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
long long n,m,dp[1000001],w,c,sol;
int main(){
cin>>n>>m;
for(int i=1;i<=1000000;i++)
dp[i]=1000000000000000000;
for(int i=1;i<=n;i++){
cin>>w>>c;
for(int j=1000000;j>=c;j--)
if(dp[j-c])
dp[j]=min(dp[j],dp[j-c]+w);
dp[c]=min(dp[c],w);
}
for(int i=1000000;i>=1;i--)
if(dp[i]<=m){
cout<<i;
return 0;
}
}


Measured memory_bytes: 8064
/*This is the solution from Ling2Feng1, no matter AC or not.*/
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<string>
#include<vector>
#include<math.h>
#include<time.h>
#include<utility>
#include<cstdlib>
#include<sstream>
#include<cstring>
#include<stdio.h>
#include<iomanip>
#include<iostream>
#include<algorithm>
using namespace std;
string s,str,restr;
int n;
int ans;
int main(){
//	freopen("C.in","r",stdin);
	cin>>s;
	n=s.size();
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-1-i]){
			if(s[i]=='x') s.insert(s.begin()+s.size()-i,'x');
			else if(s[s.size()-1-i]=='x') s.insert(s.begin()+i,'x'); 
			else{
				cout<<-1<<endl;
				return 0;
			}
//			cout<<s<<endl;
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    int q;
    cin >> q;
    for(int k = 0; k < q; k++){
        string s1, s2;
        cin >> s1;
        cin >> s2;
        int arr[s1.length()+1][s2.length()+1];
        for(int i = 0; i <= s1.length(); i++){
            for(int j = 0; j <= s2.length(); j++){
                if(i == 0 || j == 0){
                    arr[i][j] = 0;
                }else{
                    if(s1[i-1] == s2[j-1])
                        arr[i][j] = arr[i-1][j-1] + 1;
                    else
                        arr[i][j] = max(arr[i-1][j],arr[i][j-1]);
                }
            }
        }
        //debug
        /*
        for(int j = 0; j <= s2.length(); j++){
            for(int i = 0; i <= s1.length(); i++){
                cout << arr[i][j];
            }
            cout << endl;
        }
        */
        cout << arr[s1.length()][s2.length()] << endl;
    }
}

Measured memory_bytes: 7128
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    if(s.size()==3){
        reverse(ALL(s));
    }
    cout<<s<<"\n";
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define MAX 3000
int d[MAX][MAX];
string a,b;
int dp(int l,int r){
    if(r<0||l<0)return 0;
    if(d[l][r]==-1){
        if(a[l]==b[r])d[l][r]=dp(l-1,r-1)+1;
        else d[l][r]=max({dp(l-1,r),dp(l,r-1)});
    }
    return d[l][r];
}
string dp2(int l,int r){
    if(l==0){
        string s="";
        if(d[l][r])return s+a[l];
        else return "";
    }
    if(r==0){
        string s="";
        if(d[l][r])return s+b[r];
        else return "";
    }
    if(a[l]==b[r]){
        return dp2(l-1,r-1)+a[l];
    }else{
        int m=max(d[l-1][r],d[l][r-1]);
        if(m==d[l-1][r])return dp2(l-1,r);
        else return dp2(l,r-1);
    }
}
int main(){
    cin>>a>>b; 
    for(int i=0;i<a.length();i++)for(int j=0;j<b.length();j++)
    d[i][j]=-1;
    dp(a.length()-1,b.length()-1);
    cout<<dp2(a.length()-1,b.length()-1)<<endl;
    
    return 0;
}

Measured memory_bytes: 35840
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
template<class T>void chmax(T &a,T b){if(a<b)a=b;}
template<class T>void chmin(T &a,T b){if(a>b)a=b;}
constexpr int INF=1000000000000000000;
constexpr int mod=1000000007;
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=mod;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%mod;
    int memo=modpow(a,b/2);
    return memo*memo%mod;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],mod-2)%mod*modpow(kaijo[b],mod-2)%mod;
}
int inv(int x){
    x=modpow(x,mod-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
int n,k,a[200010];
int pos,zero,neg,po,ze,ne;
vector<int>s,z,t;
signed main(){
    cin>>n>>k;
    rep(i,n){
        cin>>a[i];
        if(a[i]>0){
            pos++;
            s.pb(a[i]);
        }
        if(a[i]==0){
            zero++;
            z.pb(a[i]);
        }
        if(a[i]<0){
            neg++;
            t.pb(a[i]);
        }
    }
    sort(all(s));
    sort(all(z));
    sort(all(t));
    ne=neg*pos;
    po=((pos)*(pos-1)/2)+((neg)*(neg-1)/2);
    ze=((n)*(n-1)/2)-po-ne;
    if(k<=ne){//neg
        int ok=0,ng=-INF*2;
        while(ok-ng>1){
            int mid=(ok+ng)/2;
            int cnt=0;
            for(int A:t){
                cnt+=s.size()-(lower_bound(all(s),(-mid)/(-A)+((-mid)%(-A)?1:0))-s.begin());
            }
            if(cnt>=k)ok=mid;
            else ng=mid;
        }
        cout<<ok<<endl;
    }
    else if(k<=ne+ze){//0
        puts("0");
    }
    else{//pos
        k-=(ne+ze);
        for(int i=0;i<t.size();i++)t[i]*=-1;
        sort(all(t));
        int ok=2*INF,ng=0;
        while(ok-ng>1){
            int mid=(ok+ng)/2;
            int cnt=0;
            rep(i,t.size()){
                int A=t[i];
                cnt+=max(0ll,upper_bound(all(t),mid/A)-t.begin()-i-1);
            }
            rep(i,s.size()){
                int A=s[i];
                cnt+=max(0ll,upper_bound(all(s),mid/A)-s.begin()-i-1);
            }
            if(cnt>=k)ok=mid;
            else ng=mid;
        }
        cout<<ok<<endl;
    }
    return 0;
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}

int main(){
    int N;
    cin >> N;
    pair<int, int> XV[200000];
    int vs[200000];
    for(int i=0; i<N; i++){
        int x, v;
        cin >> x >> v;
        XV[i] = {x, v};
        vs[i] = v;
    }
    sort(XV, XV+N);
    sort(vs, vs+N);

    int V[200000], L[200000], R[200000];
    for(int i=0; i<N; i++) V[i] = lower_bound(vs, vs+N, XV[i].second) - vs;
    R[0] = V[0];
    for(int i=1; i<N; i++) R[i] = max(R[i-1], V[i]);
    L[N-1] = V[N-1];
    for(int i=N-2; i>=0; i--) L[i] = min(L[i+1], V[i]);

    static int64_t dp[200001];
    dp[0] = 1;
    int l = 0, r = 0;
    int64_t sum = 1;
    for(int i=0; i<N; i++){
        while(l < L[i]){
            add(sum, MOD - dp[l]);
            l++;
        }
        while(r <= R[i]){
            r++;
            add(sum, dp[r]);
        }
        add(dp[r], sum);
        add(sum, sum);
    }
    cout << dp[N] << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD = 1000000007;
const long long INF = 1LL << 60;

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 n; cin >> n;
    vector<int> p(n),q(n);
    for(int i=0;i<n;i++) cin >> p[i];
    for(int i=0;i<n;i++) cin >> q[i];
    vector<int> a;
    for(int i=0;i<n;i++)a.push_back(i+1);
    int coun = 0,x,y;
    do{
        if(equal(a.begin(), a.end(), p.begin())) 
            x = coun;
        if(equal(a.begin(), a.end(), q.begin()))
            y = coun;
        coun++;
    }while(next_permutation(a.begin(),a.end()));
    cout << abs(x-y) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<stdlib.h>
using namespace std; 
int a[100000];
int cmp(const void *a,const void *b)
{
	return *(int *)a - *(int *)b;
}
int main(void)
{
	int n;
	scanf("%d",&n);
	int i;
	for(i = 0;i<n;i++)
		scanf("%d",&a[i]);
	//sort(a,a+n);
	qsort(a,n,sizeof(a[0]),cmp);
	printf("%d",a[n/2] - a[n/2-1]);
	return 0;	
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int n,a,b;
  cin>>n;
  for(int i=0;i<3;i++){
    if(n/100%10==1) cout<<9;
    else cout<<1;
    n*=10;
  }
  cout<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>

int main()
{
    int64_t n;
    scanf("%ld", &n);

    std::vector<int64_t> a;
    for (int64_t i = 0; i < n; i++)
    {
        int64_t l;
        scanf("%ld", &l);
        a.push_back(l);
    }
    std::sort(a.begin(), a.end());
    std::reverse(a.begin(), a.end());

    int64_t sum = 0;
    for (int64_t i = 1; i < n; i++)
    {
        sum += a[i];
    }

    if (a[0] < sum)
        puts("Yes");
    else
        puts("No");

    return 0;
}


Measured memory_bytes: 508
#include <iostream>
#include <vector>
using namespace std;
 
const int mod = 1e+9 + 7;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
  
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i = 0; i < N; ++i){
        cin >> A[i];
    }

    long long res = 0;
    for(int d = 0; d < 60; ++d){
        long long n0 = 0, n1 = 0;
        for(int i = 0; i < N; ++i){
            if((A[i] >> d) & 1) ++n1;   // d 桁目が 1
            else    ++n0;               // d 桁目が 0
        }
        long long tmp = (1ll << d) % mod;   // 2^d
        long long n = n0 * n1 % mod;        // xor 演算を施した要素で d 桁目が 1 である個数
        tmp = tmp * n % mod;                // xor 演算を施した要素の d 桁目の総和
        res = (res + tmp) % mod;
    }
    cout << res << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using ll=long long;
using namespace std;
const long MOD=1e9+7;
template<class T>
T lcm(T a,T b){
    return a/__gcd(a,b)*b;
}

int main(){
    long n;cin >> n;
    long sum,m;
    sum=0;m=-1;
    for(int i=0;i<n;i++){
        long z;
        cin >> z;
        sum+=z;
        if(z>=m){
            m=z;
        }
    }

    cout << (sum-m>m?"Yes":"No");

    return 0;
}

Measured memory_bytes: 256
# 写経元
# https://atcoder.jp/contests/abc126/submissions/5487745

class Node
  attr_accessor :parent
  def initialize(n)
    @parent = n
  end
end

class UnionFindTree
  attr_accessor :nodes#, :parents

  # 木の本数分, 自分自身を親として子を作成する.
  def initialize(n)
    @nodes = (1..n).to_a.map{|i| Node.new(i)}
  end

  # x に対応する1番上の親を返す.
  #   x-1 しているのは 1..n と index を揃えるため.
  def find(x)
    #while @nodes[x-1].parent != x # x と xの親 が一致すれば終了.
    #  x = @nodes[x-1].parent      # x と xの親 が一致しなければ, xを1つ上の親に置き換える.
    #end
    ##return  x = @nodes[x-1].parent
    #return x
    return x if x == @nodes[x-1].parent # x と xの親 が一致すれば終了.
    return @nodes[x-1].parent = find(@nodes[x-1].parent)
  end

  # 親が一致しない場合, bの親をaの1番上の親に置き換える.
  def union(a, b)
    return if find(a) == find(b) # 1番上の親が一致すれば終了.
    $ans -= 1
    return @nodes[find(b)-1].parent = find(a) # bの親をaの1番上の親に置き換えて終了
  end

  #
  #def parents
  #  @nodes.map(&:parent)
  #end

end

n, m = gets.rstrip.split.map(&:to_i)
tree = UnionFindTree.new(n)


$ans = n
m.times do
  x, y, _ = gets.split.map(&:to_i)
  tree.union(x, y)
end

p $ans

Measured memory_bytes: 12028
//#pragma comment(linker, "/STACK:1024000000,1024000000")
/* vim: set fdm=marker */
//{{{
#define __ return
int ATTENTION() {
	/* pls IGNORE this function and go down and HACK me
	 * read this AFTER contest
	 * this function is empty and it will not be called !
	 */

	http://codeforces.com/group/Pmz2A2x7ES
	/* I created a group there.
	 * I hope with the group, people can finish
	 * past contests, which is important for 
	 * increasing rating.
	 * I am still getting familiar with this function.
	 */
	 __ 0;
}
// deprecated because mac doesn't support this...
/* #include <bits/stdc++.h> */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int iinf = 0x7fffffff;
const ll linf = ~(1LL<<63);
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;
template<typename T>
inline T gcd(T a, T b) {
	if(a < 0) return gcd(-a, b);
	if(b < 0) return gcd( a,-b);
	if(a < b) return gcd(b, a);
	if(b == 0) return a;
	return gcd(b, a%b);
}

ll qpow(ll a, ll n, ll mod) {
	a %= mod;
	ll ans = 1LL;
	while(n) {
		if(n & 1) ans = (ans*a % mod);
		a = (a*a % mod);
		n >>= 1;
	}
	return ans;
}

inline ll rev(ll a, ll p) {
	return qpow(a, p - 2, p);
}

#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define rep(x, st, en) for(int x = st; x < en; x++)
#define rer(x, st, en) for(int x = st; x >= en; x--)
#define pb push_back
#define mp make_pair
#define dbgm(msg, var) cerr<<#msg<<" "<<#var<<" = "<<var<<endl; 
#define dbg(var) cerr<<#var<<" = "<<var<<endl;
#define X first
#define Y second
// build prefix sum
template<typename T>
inline void BPS(T* DST, T* SRC, int N, int s = 0) {
	DST[s] = SRC[s];
	rep(i, 1, N) DST[s + i] = DST[s + i - 1] + SRC[s + i];
}
inline int in() { int x; cin>>x; return x; }
#ifdef ALNDBG
namespace alndbg {
	clock_t s, e;
}
#endif

inline void tic() {
#ifdef ALNDBG
	alndbg::s = clock();
#endif
}

inline void toc() {
#ifdef ALNDBG
	alndbg::e = clock();
	cerr<<1000.0 * (alndbg::e - alndbg::s) / CLOCKS_PER_SEC<<" ms"<<endl;
#endif
}



//}}}

// -------------------- Spliters ------------------------
// BFS求最短路小心vis可能访问过
const int maxn = 1;

int main() {
  int D, N;
  scanf("%d%d", &D, &N);
  int base = 1;
  if(D == 1) base = 100;
  if(D == 2) base = 10000;
  int last = -1;
  for(int s = base, nth = 1; ; s += base) {
    int amount = 0;
    int q = s;
    while(q % 100 == 0) {
      q /= 100;
      amount += 1;
    }
    if(amount != D) continue;
    else {
      if(nth == N) {
        cout<<s<<endl;
        return 0;
      } else {
        nth ++;
      }
    }
  }
	return 0;
}
// --USE C++11
// *-USE O2



Measured memory_bytes: 256
#include <iostream>

int main(){
  
  int N ;
  std::cin >> N;
  
  bool flag = false;
  if( N/100 == 7 ){
    flag = true;
  }
  
  if( (N/10)%10 == 7 ){
    flag = true;
  }
  
  if( N%10 == 7 ){
    flag = true;
  }
  
  if( flag == true ){
    std::cout << "Yes" << std::endl;
  }
  else{
    std::cout << "No" << std::endl;
  }
  
 return 0; 
}

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

int main() {
	int a, b, c, d, e, f; double xNum, xDen, yNum, yDen;
	while (cin >> a >> b >> c >> d >> e >> f) {
		xNum = c * e - b * f; xDen = a * e - b * d;
		yNum = a * f - c * d; yDen = a * e - b * d;
		cout << fixed << setprecision(3)
			<< xNum / xDen + 1e-9 << " " << yNum / yDen + 1e-9 << endl;
	}
	return 0;
}


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

int main()
{

    int n; cin>>n;
    vector<int> input(n);

    for(int i = 0 ; i<n ; i++)cin>>input[i];
    sort(input.begin() , input.end());

    int midNum = input.size()/2;



    int k_num = input[midNum]-input[midNum-1];

    cout<<k_num<<endl;


    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

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

    vector<int> num(N); //順番示す
    vector<int> sortnum(N); //sortする配列
    
    for(int i=0;i<N;i++){
        cin >> num[i];
        sortnum[i]=num[i];
    }
    sort(sortnum.begin(),sortnum.end());
    int num2=sortnum[N/2];
    int num1=sortnum[N/2-1]; //midはどっちか
    //cout << num1 << " " << num2 << endl;

    for(int i=0;i<N;i++){
        auto a=lower_bound(sortnum.begin(),sortnum.end(),num[i]);
        int jg=(int)(a-sortnum.begin());
        //cout << jg << endl;
        if(jg<=N/2-1) cout << num2 << endl;
        else cout << num1 << endl;
    }
}

Measured memory_bytes: 3712
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

const int INF = INT_MAX / 2;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    vector<long long> dp(5, 0);
    for(int i=0; i<n; ++i){
        vector<long long> nextDp(5, INF);
        long long tmp = dp[0];
        nextDp[0] = tmp + a[i];

        tmp = min(tmp, dp[1]);
        nextDp[1] = tmp + (a[i] == 0 ? 2 : a[i] % 2);

        tmp = min(tmp, dp[2]);
        nextDp[2] = tmp + ((a[i] + 1) % 2);

        tmp = min(tmp, dp[3]);
        nextDp[3] = tmp + (a[i] == 0 ? 2 : a[i] % 2);

        tmp = min(tmp, dp[4]);
        nextDp[4] = tmp + a[i];

        dp = move(nextDp);
    }

    long long ans = *min_element(dp.begin(), dp.end());
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int ara[n+5];
  int mx=0;
  for(int i=0;i<n;i++)cin>>ara[i],mx=max(mx,ara[i]);
  
  int fre[mx+5],neg=0;
  memset(fre,0,sizeof fre);
  for(int i=0;i<n;i++)
  {
    if(ara[i]==0)neg++;
    else fre[ara[i]-1]++;
    
    fre[ara[i]]++;
    fre[ara[i]+1]++;
  }
  int ans=neg;
  for(int i=0;i<=mx;i++)ans=max(ans,fre[i]);
  cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>

using namespace std;

bool cmp(pair<int,pair<int,int>> lhs, pair<int,pair<int,int>> rhs){
    if (lhs.second.first!=rhs.second.first){
        return lhs.second.first>rhs.second.first;
    } else if (lhs.second.second!=rhs.second.second){
        return lhs.second.second<rhs.second.second;
    } else {
        return lhs.first>rhs.first;
    }
}

bool equiv(pair<int,int> l, pair<int,int> r){
    return (l.first == r.first && l.second == r.second);
}

int main(){
    int M,T,P,R;
    int m,t,p,j;
    while(1){
        cin >> M >> T >> P >> R;
        if (M*M+T*T+P*P+R*R==0) return 0;
        vector<pair<int,pair<int,int>>> point(T,make_pair(0,make_pair(0,0))); //??£?§£??°,????????????????¨?
        vector<vector<int>> bad(T,vector<int>(P,0));
        for(int i=0;i<T;i++){
            point[i].first=i+1;
        }
        for(int i=0;i<R;i++) {
            cin >> m >> t >> p >> j;
            if (j==0){ //??£?§£
                point[t-1].second.first++;
                point[t-1].second.second += m;
                point[t-1].second.second += 20 * bad[t-1][p-1];
            } else {
                bad[t-1][p-1]++;
            }
        }
        sort(point.begin(),point.end(),cmp);
        for(int i=0;i<T;i++) {
            if (i==0) cout << point[i].first;
            else {
                if (equiv(point[i].second,point[i-1].second)) cout << "=";
                else cout << ",";
                cout << point[i].first;
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3092
#include <stdio.h>
#define N 100
int main () {
    int n, m, i, j, k, l, a;
    int m1 [N] [N], m2[N];
    
    scanf ( "%d", &n);
    for ( i = 0; i < n; i++) {
        scanf ("%d %d", &m2[i], &m);
    }
    m2[n] = m;
    
    for (i = 1; i < n + 1; i++) {
        m1[i][i] = 0;
    }
    for ( l = 2; l < n + 1; l++ ) {
        for (i = 1; i < n - l + 2; i++ ) {
            j = i + l - 1;
            m1[i][j] = 10000000;
            for ( k = i; k <= j - 1;k++){
                a = (m1[i][k] + m1[k + 1][j] + m2[i -1] * m2[k] * m2[j] );
                if (m1[i][j] > a) {
                    m1[i][j] = a;
                }
            }
        }
    }
    printf ("%d\n", m1[1][n] );

    return 0;
    
}


Measured memory_bytes: 2096
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll a[405];
ll dp[405][405];
ll sum[405];
ll func(int i,int j)
{
	if(i==j)
		return 0;
	if(dp[i][j]!=-1)
		return dp[i][j];
	ll k,d,min1=LLONG_MAX;
	for(k=i;k<=j-1;k++)
	{
		d=func(i,k)+func(k+1,j)+(sum[k]-sum[i-1])+(sum[j]-sum[k]);
		if(d<min1)
			min1=d;
	}
	dp[i][j]=min1;
	return dp[i][j];
}
int main()
{
	ll s=0,i,j,n;
	cin>>n;
	sum[0]=0;
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		s+=a[i];
		sum[i]=s;
	}
	for(i=0;i<=n;i++)
	{
		for(j=0;j<=n;j++)
			dp[i][j]=-1;
	}
	cout<<func(1,n)<<endl;
}


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




int main(){

	long long a,b,c,k;
	cin>>a>>b>>c>>k;
	long long suma = 0;
	if(k > a){
		suma += a;
		k -= a;
	}
	else{
		cout<<k<<endl;
		return 0;
	}
	if(k > b){
		k -= b;
	}
	else{
		cout<<a<<endl;
		return 0;
	}
	if(k<=c){
		suma -= k;
		cout<<suma<<endl;
		return 0;
	}

	//return 0;
}

Measured memory_bytes: 3608
#include <stdio.h>
#include <string.h>
int main(){
  char O[51];
  char E[51];
  int i;

  scanf("%s%s",O,E);
  for(i=0;i<strlen(O)+strlen(E);i++){
    if(!(i%2))printf("%c",O[i/2]);
    else printf("%c",E[i/2]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ProgramingStudying2
{
    class Program
    {

        static void Main(string[] args)
        {
            var abx = Console.ReadLine().Split();
            var a = double.Parse(abx[0]);
            var b = double.Parse(abx[1]);
            var x = double.Parse(abx[2]);

            if(x > a * a * b / 2)
            {
                Console.WriteLine(Math.Atan(2 * (a * a * b - x) / (a * a * a)) * 180 / Math.PI);
            }
            else
            {
                Console.WriteLine(Math.Atan((a * b * b) / (2 * x)) * 180 / Math.PI);
            }
        }
    }
}


Measured memory_bytes: 27708
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;

int main() {
	string c,d;
	cin>>c>>d;
	int a,b;
	a=c.length();
	b=d.length();
	if(a>b){
		cout << "GREATER" <<endl;
	}
	else if(a==b){
		for(int i=0;i<a;i++){
			if(c[i]>d[i]){
			    cout << "GREATER" <<endl;
			    return 0;
			}
			else if(c[i]<d[i]){
				cout << "LESS" <<endl;
				return 0;
			}
		}
		cout << "EQUAL"<<endl;
	}
	else{
		cout << "LESS" <<endl;
	}
	return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	ll N,X; cin >> N >> X;
	struct test{
		ll b,l,u,c;
		test(ll b,ll l,ll u,ll c):b(b),l(l),u(u),c(c){}
		bool operator<(const test &t) const{
			return c>t.c;
		}
	};
	vector<test> ts;
	ll sum=0;
	for (int i=0;i<N;++i){
		ll b,l,u; cin >> b >> l >> u;
		ts.emplace_back(b,l,u,u*(X-b)+l*b);
		sum+=l*b;
	}
	sort(ts.begin(),ts.end());
	ll lb=-1,ub=N*X;
	while(ub-lb>1){
		ll mid=(ub+lb)>>1LL;
		ll cnt=0;
        for (int i=0;i<mid/X;++i) cnt+=ts[i].c;
        int ok=0;
        for (int i=0;i<N;++i){
            test t=ts[i];
            ll cnt0=cnt;
            if (i<mid/X) cnt0+=ts[mid/X].c-t.c;
            if (mid%X<t.b) cnt0+=t.l*(mid%X);
			else cnt0+=t.u*(mid%X-t.b)+t.l*t.b;
            if (cnt0>=sum) ok=1;
        }
		(ok?ub:lb)=mid;
	}
	cout << ub << '\n';
}

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

int main() {
    string SA, SB, SC;
    cin >> SA >> SB >> SC;

    string turn = "a";
    string ans;

    while (true) {
        if (turn == "a") {
            if (SA.size() == 0) {
                ans = "A";
                break;
            }
            turn = SA[0];
            SA.erase(SA.begin());
        }
        else if (turn == "b") {
            if (SB.size() == 0) {
                ans = "B";
                break;
            }
            turn = SB[0];
            SB.erase(SB.begin());
        }
        else {
            if (SC.size() == 0) {
                ans = "C";
                break;
            }
            turn = SC[0];
            SC.erase(SC.begin());
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<complex>
#define x real() 
#define y imag()
using namespace std;
typedef complex<double> point;
string ccw(point a,point b,point c){
  b-=a;
  c-=a;
  c*=conj(b);
  b*=conj(b);
  if(c.y>0)return "COUNTER_CLOCKWISE";  
  if(c.y<0)return "CLOCKWISE";
  if(c.x>b.x)return "ONLINE_FRONT";
  if(c.x<0)return "ONLINE_BACK";
  return "ON_SEGMENT";
}
int main(){
  double x0,y0,x1,y1;
  cin>>x0>>y0>>x1>>y1;
  point a=point(x0,y0);
  point b=point(x1,y1);
  int q;
  cin>>q;
  for(int i=0;i<q;i++){
    double xp,yp;
    cin>>xp>>yp;
    point c=point(xp,yp);
    cout<<ccw(a,b,c)<<endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <vector>

using namespace std;

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

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

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

    return 0;
}


Measured memory_bytes: 1664
#include <iostream>

using namespace std;

const long MOD = 1000000007;

long inv(long n, long mod){
    long ret = 1;
    long q = mod-2;
    long t = 0;
    long p = n;
    while(q != 0){
        if((q >> t) & 1) {
            ret = ret * p % mod;
            q -= 1<<t;
        }
        t++;
        p = p * p % MOD;
    }

    return ret;
}

long nCr(int n, int r){
    if(r==0) return 1;
    if(n==r) return 1;

    long bb = 1;
    for(long i=n; i>=1; i--){
        bb = bb * i % MOD;
    }

    long bs1 = 1;
    for(long i=r; i>=1; i--){
        bs1 = bs1 * i % MOD;
    }
    bs1 = inv(bs1, MOD);

    long bs2 = 1;
    for(long i=n-r; i>=1; i--){
        bs2 = bs2 * i % MOD;
    }
    bs2 = inv(bs2, MOD);

    long ret = bb * bs1 % MOD;
    ret = ret * bs2 % MOD;
    
    return ret;
}


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

    int p = -X + 2 * Y;
    int q = 2 * X - Y;
    if(p<0 || p%3 != 0) {
        cout << 0 << endl;
        return 0;
    }
    if(q<0 || q%3 != 0){
        cout << 0 << endl;
        return 0;
    }

    p /= 3;
    q /= 3;

    cout << nCr(p+q, p) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>
#include <list>
using namespace std;
 
#define REP(i, n) for (long long i = 0; i < (n); ++i)
#define rep(i, a, b) for (long long i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;


int main(void) {

    int a, b;
    int outlet = 1;
    cin >> a >> b;

    int ans = 0;
    while(outlet < b) {
        outlet--;
        outlet += a;
        ans++;
    }

    cout << ans << endl;

    return 0;
}



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

using namespace std;

long long calc(string S)
{
  int N = S.size();
  int J[100000], I[100000];
  J[0] = (S[0] == 'J');
  I[N - 1] = (S[N - 1] == 'I');
  for(int i = 1; i < N; i++) {
    J[i] = J[i - 1] + (S[i] == 'J');
  }
  for(int i = N - 2; i >= 0; i--) {
    I[i] = I[i + 1] + (S[i] == 'I');
  }
  long long sum = 0;
  for(int i = 0; i < N; i++) {
    if(S[i] == 'O') {
      sum += 1LL * J[i] * I[i];
    }
  }
  return(sum);
}

long long calc2(string S)
{
  int N = S.size();
  int J[100000], I[100000];
  J[0] = (S[0] == 'J');
  I[N - 1] = (S[N - 1] == 'I');
  for(int i = 1; i < N; i++) {
    J[i] = J[i - 1] + (S[i] == 'J');
  }
  for(int i = N - 2; i >= 0; i--) {
    I[i] = I[i + 1] + (S[i] == 'I');
  }
  long long sum = 0, maximum = 0;
  for(int i = 0; i < N; i++) {
    if(S[i] == 'O') {
      sum += 1LL * J[i] * I[i];
    }
    maximum = max(maximum, 1LL * J[i] * I[i]);
  }
  return(sum + maximum);
}
int main()
{
  int N;
  string S;

  cin >> N;
  cin >> S;
  cout << max({calc("J" + S), calc(S + "I"), calc2(S)}) << endl;
}

Measured memory_bytes: 4300
n = int(input())
m = n
output = []
for i in range(2, int(n**0.5)+1):
    while True:
        if n % i != 0:
            break
        else:
            output.append(i)
            n //= i
if n != 1:
    output.append(n)
print(str(m) + ": " + ' '.join(map(str, output)))


Measured memory_bytes: 5636
using System;
using System.Collections.Generic;
using System.IO;

class Solve{
    static void Main(string[] args){
        var N = int.Parse(Console.ReadLine());
        var P = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var Q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int a = 1, b = 1;
        var list = new List<int>(8);
        for (int i = 0; i < N; i++){ 
            var pi = P[i];
            var count = 0;
            foreach (var s in list){
                    if (s < pi) count++;}
            var x = pi - count;
            a += i == N - 1 ? 0 : (x - 1) * Factorial(N - 1 - i);
            list.Add(pi);}
        list.Clear();
        for (int i = 0; i < N; i++){
            var qi = Q[i];
            var count = 0;
            foreach (var s in list){
                    if (s < qi) count++;}
            var x = qi - count;
            b += i == N - 1 ? 0 : (x - 1) * Factorial(N - 1 - i);
            list.Add(qi);}
        var answer = Math.Abs(a - b);
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}

    public static int Factorial(int n){
        int result = 1;
        for (int i = n; i > 1; i--){
            result *= i;}
        return result;}}

Measured memory_bytes: 27816
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	int n;
	scanf("%d", &n);
	int a[n], b[n];
	for (int i = 0; i < n; ++i)
		scanf("%d", a + i);
	for (int i = 0; i < n; ++i)
		scanf("%d", b + i);
	pair<int, int> v[2 * n];
	for (int i = 0; i < n; ++i) {
		v[i] = make_pair(a[i], 1);
		v[i + n] = make_pair(b[i], 2);
	}
	n += n;
	sort(v, v + n);
	ll ans = 1;
	int m = 1000000007;
	for (int i = 0, cnt = 0; i < n; ++i) {
		if (v[i].second == 1) {
			if (cnt > 0)
				ans = ans * cnt % m;
			--cnt;
		} else {
			if (cnt < 0)
				ans = ans * -cnt % m;
			++cnt;
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#include <fstream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#define endl '\n'
//#define ll long long
#define mod 1000000007
#define NCONS 100001
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
#define int long long
//#define double long double
using namespace std;
struct Point{int x; int y;};
struct PPoint{Point x; Point y;};
typedef long long ll;

int gcd(int a, int b) { if(a < b) swap(a, b); if(b <= 0) return a; return gcd(b, a % b); }

#define YYYY cout << "YES" << endl
#define NNNN cout << "NO" << endl
#define yyyy cout << "Yes" << endl
#define nnnn cout << "No" << endl

int N;

int32_t main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int N; cin >> N; N -= 1;
    cout << N * (N + 1) / 2 << endl;
    
      
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

const int MAX=100000+3;
int N, ns[MAX][3];
int dp[MAX][3];
int main(){

    scanf("%d",&N);
    for(int i=0;i<N;i++) scanf("%d%d%d",&ns[i][0],&ns[i][1],&ns[i][2]);


    for(int i=1;i<=N;i++){
        for(int j=0;j<3;j++){
            if(j==0) dp[i][j]=ns[i-1][0]+max(dp[i-1][1], dp[i-1][2]);
            if(j==1) dp[i][j]=ns[i-1][1]+max(dp[i-1][0], dp[i-1][2]);
            if(j==2) dp[i][j]=ns[i-1][2]+max(dp[i-1][0], dp[i-1][1]);
        }
    }
    int ans=0;
    for(int i=0;i<3;i++) ans=max(ans, dp[N][i]);
    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 6004
#include <cstring>
#include <iostream>

static int tp = 1;
static int n;

void depth_first(int node, int *start_ts, int *end_ts, int **adj_list) {
    start_ts[node] = tp;
    tp++;
    for (int i = 0; adj_list[node][i] != -1; i++) {
        int dst = adj_list[node][i];
        if (start_ts[dst] != 0) {
            continue;
        }
        depth_first(dst, start_ts, end_ts, adj_list);
    }
    end_ts[node] = tp;
    tp++;
}

int main() {
    std::cin >> n;
    int *adj_list[n];

    int u, k, v;
    for (int i = 0; i < n; i++) {
        std::cin >> u >> k;
        adj_list[u - 1] = new int[k + 1];
        for (int j = 0; j < k; j++) {
            std::cin >> v;
            adj_list[u - 1][j] = v - 1;
        }
        adj_list[u - 1][k] = -1;
    }

    int start_ts[n], end_ts[n];
    memset(start_ts, 0, sizeof(int) * n);
    for (int i = 0; i < n; i++) {
        if (start_ts[i] == 0) {
            depth_first(i, start_ts, end_ts, adj_list);
        }
    }
    for (int i = 0; i < n; i++) {
        std::cout << i + 1 << " " << start_ts[i] << " " << end_ts[i] << std::endl;
    }
}



Measured memory_bytes: 3136
open System

// prelude
let readStr () = stdin.ReadLine()

let read f () = readStr() |> f
let reads f () = readStr().Split() |> Array.map f

let pair = function
| [|a; b|] -> (a, b)
| _ -> failwith "owatta"

let triple = function
| [|a; b; c|] -> (a, b, c)
| _ -> failwith "owatta"

let readPair f g () =
  let (a,b) = readStr().Split() |> pair
  (f a, g b)

let readTriple f g h () =
  let (a,b,c) = readStr().Split() |> triple
  (f a, g b, h c)

let inc n = n + 1
let dec n = n - 1

let inline flip f a b = f b a
let rec fix f = fun x -> (f (fix f)) x

module Option =
  let getOr defaultValue = function
  | Some x -> x
  | None -> defaultValue

module Array =
  let modify (arr: _ []) i f =
    arr.[i] <- f arr.[i]

module Array2D =
  let modify (arr: _ [,]) i j f =
    arr.[i, j] <- f arr.[i, j]

// start
let N = read int ()
let X = reads int ()

seq {
  for P in 1..100 do
    yield X |> Array.sumBy (fun x -> pown (x-P) 2)
}
|> Seq.min
|> printfn "%d"

Measured memory_bytes: 14160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>

using namespace std;

#define REP(i,n) for (int i=0;i<(n);++i)
#define REP2(i,n) for (int i=0;i<=(n);++i)
#define REP3(i,n) for (int i=1;i<=(n);++i)

static const int MAXN = 1001;
static const int MAXM = 1001;
static const int INF = 1e5;

int main() {

	string S;
	cin >> S;

	int res;
	res = 0;

	REP(i, 4) {
		if (S[i] == '+') {
			++res;
		}
		else {
			--res;
		}
	}
	
	cout << res << endl;


	//int end;
	//cin >> end;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

int main(void){
  SPEEDUP
  cout << setprecision(15);
  int x,y;cin >> x >> y;
  if(x>y)swap(x,y);
  bool same = true;
  if(x==2||y==2)same=false;
  if(x==4 && y != 6 && y != 9 && y != 11) same=false;
  if(x==6  && y != 9 && y != 11) same=false;
  if(x==9  && y != 11) same=false;
  if(x==11)same = false;
  YesNo(same);
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
    public static void main(String[] args) throws IOException{
        FastReader in = new FastReader();
        FastWriter out = new FastWriter();
        int a, b;
        a = in.nextInt();
        b = in.nextInt();
        if (2*b > a) out.pl("0");
        else{
            out.pl(a - (2*b));
        }
        out.close();
    }
}
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; 
    } 
}
class FastWriter{
    PrintWriter out;
    FastWriter(){
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	out.flush();
    }
    void pl(Object o){
        out.write(o.toString());
	    out.write("\n");
        out.flush();
    }
    void pl(){
        out.write("\n");
    }
    void p(Object o){
        out.write(o.toString());
    }
    void close(){
        out.flush();
        out.close();
    }  
}


Measured memory_bytes: 32880
#include <iostream>
#include <math.h>
using namespace std;

int main(){
  long int h, n = 0, ans;
  cin >> h;
  while(true){
    ++n;
    if(pow(2, n)-1 >= h){
      ans = pow(2, n)-1;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> v;

  int ret = 0;
  rep(i,N){
    int a;
    cin >> a;
    v.push_back(a);
    ret += a;
  }

  rep(i,N){
    int x = 0;
    int y = 0;
    rep(j,N){
      if(j<=i){
        x += v[j];
      }else{
        y += v[j];
      }
    }
    ret = min(ret, abs(x-y));
  }

  cout << ret << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll a, b;
  cin >> a >> b;
  cout << a * b << endl;
}

Measured memory_bytes: 3604
n = int(input())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

ans = 0
for i in range(1,n+1):
    if i % 2 == 1:
        div = make_divisors(i)
        if len(div) == 8:
            ans += 1
        
print(ans)

Measured memory_bytes: 38256
#include <stdio.h>

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}



Measured memory_bytes: 2700
# include <bits/stdc++.h>
using namespace std;
# define FOR(i, a, b) for (int i = a; i <= b; ++i)
# define FDR(i, a, b) for (int i = a; i >= b; --i)
# define mp make_pair
# define pb push_back
# define lch p<<1, l, mid
# define rch p<<1|1, mid + 1, r
# define mem(a, b) memset(a, b, sizeof(a))
# define fi first
# define se second
# define MOD 1000000007
# define INF 1000000000
typedef long long i64;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef pair<int, int> PII;
const int N = 200005;

int a[N];

int main ()
{
    int n;
    scanf("%d", &n);
    FOR(i, 1, n) scanf("%d", a + i), a[i] -= i;
    sort(a + 1, a + n + 1);
    int k = (n + 1) / 2;
    i64 ans = 0;
    FOR(i, 1, n) ans += abs(a[i] - a[k]);
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
using ll = long long;
#define int long long
signed main(void){
    int x; cin>>x;
    int ans = x-1;
    ll sum = 0;
    rep(i, ans + 5) {sum+=i+1; if(sum >= x) {cout<<i+1<<endl; return 0;} }
}


Measured memory_bytes: 764
/* Priyansh Agarwal*/
#include<bits/stdc++.h>
#include<algorithm>
#include<unordered_map>
#include<vector>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define MOD1 998244353
#define nline "\n"
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define PI 3.141592653589793238462
#define debug(x) cout << #x << " " << x <<endl;
#define set_bits __builtin_popcount
typedef long long ll;
typedef unsigned long long ull;
typedef long double lld;
/*---------------------------------------------------------------------------------------------------------------------------*/
ll gcd(ll a, ll b) {if (b > a) {return gcd(b, a);} if (b == 0) {return a;} return gcd(b, a % b);}
ll expo(ll a, ll b, ll mod)
{ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % mod; a = (a * a) % mod; b = b >> 1;} return res;}
vector<int> sieve(int n) {int*arr = new int[n + 1](); vector<int> vect; for (int i = 2; i <= n; i++)if (arr[i] == 0) {vect.push_back(i); for (int j = 2 * i; j <= n; j += i)arr[j] = 1;} return vect;}
void extendgcd(ll a, ll b, ll*v) {if (b == 0) {v[0] = 1; v[1] = 0; v[2] = a; return ;} extendgcd(b, a % b, v); ll x = v[1]; v[1] = v[0] - v[1] * (a / b); v[0] = x; return;} //pass an arry of size 3
ll mminv(ll a, ll b) {ll arr[3]; extendgcd(a, b, arr); return arr[0];} //for non prime b
ll mminvprime(ll a, ll b) {return expo(a, b - 2, b);}
bool revsort(ll a, ll b) {return a > b;}
void swap(int &x, int &y) {int temp = x; x = y; y = temp;}
ll combination(ll n, ll r, ll m, ll* fact) {ll val1 = fact[n]; ll val2 = mminvprime(fact[r], m); ll val3 = mminvprime(fact[n - r], m); return ((val1 * val2) % m * val3) % m;}
/*--------------------------------------------------------------------------------------------------------------------------*/
int main()
{
	fastio();
#ifndef ONLINE_JUDGE
	freopen("Input.txt", "r", stdin);
	freopen("Output.txt", "w", stdout);
	freopen("Error.txt", "w", stderr);
#endif
	int n;
	cin >> n;
	ll arr[n];
	ll count = 0;
	for (int i = 0; i < n; i++)
	{
		ll p;
		cin >> p;
		if (i % 2 == 0 && p % 2 != 0)
			count++;
	}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 3608
s = input()
k = int(input())
n = len(list(s))
kouho = set()
for i in range(n):
    for d in range(1, k + 1):
        if i + d <= n:
            kouho.add(s[i : i + d])
ans = list(kouho)
ans.sort()
# print(ans)
print(ans[k - 1])


Measured memory_bytes: 4464