akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

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

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

int main(){
    int x1, y1, x2, y2; cin>>x1>>y1>>x2>>y2;
    int x=x2-x1, y=y2-y1;
    cout << x2-y << " " << y2+x << " " << x1-y << " " << y1+x << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}
//INSERT ABOVE HERE


signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  Int n;
  cin>>n;
  vector<Int> A(n);
  cin>>A;

  Int sum = 0;
  for(Int a:A) sum ^= a;
  for(Int &a:A) a &= ~sum;

  Int ans = sum;
  for(Int i=0, j=60;j>=0&&i>=0;j--){
    for(Int k=i;k<n;k++) if(A[k]>>j&1) swap(A[i], A[k]);
    if((A[i]>>j&1) == 0) continue;
    for(Int k=i+1;k<n;k++)
      if(A[k]>>j&1) A[k] ^= A[i];

    Max(ans, ans^A[i]);
    i++;
  }

  ans = ans + (ans ^ sum);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

const int N = 987;
int f[N + 1][N];

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

    int cur = 1;
    rep(j, N){
    	rep(i, j + 1){
    		f[i][j] = cur;
    		f[j + 1][i] = cur;
    		cur++;
    	}
    }

    int n; cin >> n;
    rep(k, N){
    	if(k * (k + 1) == 2 * n){
    		cout << "Yes" << endl;
    		cout << k + 1 << endl;
    		rep(i, k + 1){
    			cout << k;
    			rep(j, k){
    				cout << " " << f[i][j];
    			}
    			cout << endl;
    		}
    		return 0;
    	}
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 5248
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<ctime>
using namespace std;
typedef long long ll;
#define sqr(x) ((x)*(x))
#define mp make_pair
#define PI pair<int,int>
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline int read(){
    int x = 0; char ch = gc(); bool positive = 1;
    for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
    for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
    return positive ? x : -x;
}
inline void write(int a){
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(int a){
    if(a<0){
    	a=-a; putchar('-');
    }
    write(a); puts("");
}
#define int long long
const ll N=310000;
ll m,a[N],n,A,B,pos,down;
ll calc(ll x){return x+((n-x)%A==0?(n-x)/A:((n-x)/A+1));}
signed main(){
	m=n=read(),A=read(),B=read();
	if (A+B>n+1||A*B<n){puts("-1"); return 0;}
	ll l=0,r=n,ans=0;
	while(l<=r){
		ll mid=(l+r)>>1;
		if (calc(mid)>=B)ans=mid,r=mid-1;
		else l=mid+1;
	}
	for(int i=n;i>=n-ans+1;i--)a[i]=++down;n-=down;m-=down;
	for(;;){
		ll Pos=pos;
		pos+=A;pos=min(pos,m);
		for(int j=1;j<=A;j++){
			a[pos--]=down+n--;
			if (pos<=Pos)break;
		}
		pos+=A;
		pos=min(pos,m);
		if(pos==m)break;
	}
	for(int i=1;i<=m+down;i++)printf("%d ",a[i]);
}

Measured memory_bytes: 4480
class UnionFind():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x


N, M = map(int, input().split())
P = map(int, input().split())

uf = UnionFind(N)
for _ in range(M):
    x, y = map(int, input().split())
    uf.union(x - 1, y - 1)

ans = 0
for i, p in enumerate(P):
    if uf.find(i) == uf.find(p - 1):
        ans += 1

print(ans)


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

int main(){
    string str;
    getline(cin, str);
    
    for(int i = 0; i < str.size(); i++){
        if(str[i] >= 'a' && str[i] <= 'z'){
            str[i] = str[i] - 'a' + 'A';
        }else if(str[i] >= 'A' && str[i] <= 'Z'){
            str[i] = str[i] - 'A' + 'a';
        }
    }
    
    cout << str << endl;
    return 0;
}
    


Measured memory_bytes: 3160
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define dom 998244353
#define all(c) begin(c),end(c)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
template <typename T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <typename T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }
#define long long long
#define List vector
#define var auto
#define Count size()
#define Length size()
int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑

void solve()
{
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++)
	{
		cin >> A[i];
	}
	vector<int> B(N);
	for (int i = 0; i < N; i++)
	{
		cin >> B[i];
	}
	
	int ans = 0;
	for (int r = 28; r >= 0; r--)
	{
		int T = 1 << r;
		for (int i = 0; i < N; i++)
		{
			A[i] &= ~(T << 1);
			B[i] &= ~(T << 1);
		}
		sort(all(B));

		long x = 0;
		for(var v : A)
		{
			x += (int)(lower_bound(all(B), 2 * T - v) - lower_bound(all(B), T - v))
				+ (int)(lower_bound(all(B), 4 * T - v) - lower_bound(all(B), 3 * T - v));
		}
		if ((x & 1) == 1)
		{
			ans += T;
		}
	}
	cout << ans << endl;
}

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


Measured memory_bytes: 1792
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
double pi=3.1415926535898;
//double pi=acos(-1.0);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define pii        pair<int,int>
#define pis        pair<int,string>
#define vi         vector<int>
#define F          first
#define S          second
//#define max(a,b) a<b?b:a  __builtin_popcount;
//#define min(a,b) a<b?a:b
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 50500;
const int inf = INT_MAX;
const double eps = 1e-6;
//////////////////////    Hi    ^_^  hack me if you can :P

int main()
{
    string s ;
    cin>>s;
    int st = s.find('A');
    reverse(all(s));
    int en = s.find('Z');

    cout<<sz(s)-en-st;
    r0;
}

/*



https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)


*/


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
int main(){
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    rep(i,n) {
        int a;
        cin >> a;
        if(i%2==0 && a%2 == 1) ans++;
    }
    cout << ans << endl;

}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int x,a,b;
	cin >> x >> a>> b;
	if(abs(x-a) < abs(x-b))cout << 'A' << endl;
	else cout << 'B' << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll INF = 1e18;
const int MAXN = 5007;
ll dp[MAXN][MAXN];
int a[MAXN], p[MAXN];
int main()
{
    int n; ll A, B; scanf("%d%lld%lld", &n, &A, &B);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]), p[a[i]] = i;
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
            dp[i][j] = INF;
    dp[0][0] = 0;
    for (int i = 1; i <= n; i++)
    {
        ll MIN = INF;
        for (int j = 0; j <= n; j++) 
        {
            MIN = min(MIN, dp[i - 1][j]);
            if (j == p[i]) dp[i][p[i]] = min(dp[i][p[i]], MIN);
            else if (j < p[i]) dp[i][j] = min(dp[i][j], MIN + B);
            else dp[i][j] = min(dp[i][j], MIN + A);
        }
    }
    // for (int i = 0; i <= n; i++)
    //     for (int j = 0; j <= n; j++) printf("%lld%c", dp[i][j], " \n"[j == n]);
    ll ans = INF;
    for (int i = 0; i <= n; i++) ans = min(ans, dp[n][i]);
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 195968
import math
X = int(input())
search = True
if X == 2:
  search = False
elif X == 3:
  search = False
cnt = 0
if bin(X&1)==bin(0):
  cnt += 1
while search:
  X = X + cnt
  cnt = 2
  tmp = False
  sum = 0
  for x in str(X):
    sum += int(x)
  con = X**(1/2)
  if float(con).is_integer():
    continue
  con = math.floor(con)
  prime = True
  for i in range(con)[3::2]:
    if X % i == 0:
      prime = False
      break
  
  if prime:
    break
print(X)
  

Measured memory_bytes: 3188
N = int(input())
a = list(map(int, input().split()))

num = [0] * (10**5+1)
for i in a:
    num[i] += 1

a = [i for i in num if i != 0]
ans = N
for i in range(len(a)):
    eat = (a[i]-1) // 2
    a[i] -= eat * 2
    ans -= eat * 2

ans -= a.count(2)//2 * 2
if a.count(2) % 2 == 1:
    ans -= 2
print(ans)


Measured memory_bytes: 14836
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define INT(str) stoi((str), 0)
#define INTB(str) stoi((str), 0, 2) // 2進数の文字列を int に
//cout << fixed << setprecision(15);

int main() {
  int n;
  cin >> n;
  int r = 0;
  rep(i, n) {
    int a;
    cin >> a;
    if((i + 1) % 2 == 1 && a % 2 == 1)
      r++;
  }
  cout << r << endl;
}


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

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

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

class UnionFindTree {
public:
    this(size_t n) {
        parent = iota(n).array();
        rank = new size_t[](n);
    }
    size_t find(size_t n) {
        if(n == parent[n]) {
            return n;
        } else {
            parent[n] = find(parent[n]);
            return parent[n];
        }
    }
    void unite(size_t n, size_t m) {
        auto p1 = find(n);
        auto p2 = find(m);
        if(n == m) {
            return;
        }
        if(rank[p1] < rank[p2]) {
            swap(p1, p2);
        }
        if(rank[p1] == rank[p2]) {
            ++rank[p1];
        }
        parent[p2] = p1;
    }
private:
    size_t[] parent;
    size_t[] rank;
}
unittest {
    auto uft = new UnionFindTree(10);
    foreach(i; iota(10)) {
        assert(uft.find(i) == i);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0).drop(1)) {
        uft.unite(i, i-3);
    }
    foreach(i; iota(10).filter!(a => a%3 == 0)) {
        assert(uft.find(0) == uft.find(i));
    }
    foreach(i; iota(10).filter!(a => a%3 != 0)) {
        assert(uft.find(0) != uft.find(i));
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

void main(){
    auto n = readLong();
    auto a = readLongs();
    long[long] c;
    foreach(ai; a) {
        ++c[ai];
    }
    long eat;
    foreach(k, ref v; c) {
        if(v > 2) {
            eat += (v-1) / 2;
            v = (v%2 == 1 ? 1: 2);
        }
    }
    auto m = c.byValue.count!(v => v == 2);
    eat += m/2  + m % 2;
    writeln(n - 2*eat);
}



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

int main() {
  int N,L;
  cin >> N >> L;
 
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  
  sort(S.begin(), S.end());
  
  for (int i = 0; i < N; i++) {
    cout << S.at(i);
    if (i == N - 1){
      cout << endl;
    }
  }
}

 

Measured memory_bytes: 256
/*
Author: Sagar Gupta
E mail: sagar.june97p@gmail.com
*/

#pragma comment(linker, "/STACK:268435456")
#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 endl ("\n")
#define deb(n) cerr << #n << " = " << (n) << '\n'
#define PI (3.141592653589)
#define ordered_set tree<int, null_type, std::less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define MOD 1000000007

long long power(long long a, long long n)
{
    if (n == 0)
        return 1 % MOD;
    if (n == 1)
        return a % MOD;
    long long sol = 1ll;
    long long x = a % MOD;
    while (n)
    {
        if (n % 2)
        {
            sol *= x;
            sol %= MOD;
        }
        n /= 2ll;
        x = x * x;
        x %= MOD;
    }
    return sol;
}
const int mx = 200001;
long long fact[mx];

long long ncr(long long n, long long r)
{
    if (r > n - r)
    {
        r = n - r;
    }
    long long num = 1ll;
    long long dem = fact[r];
    while (r--)
    {
        num *= n;
        num %= MOD;
        n--;
    }
    num = (num * power(dem, MOD - 2)) % MOD;
    return num;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed;
    cout.precision(10);
    // Those who forgive themselves, and are able to accept their true nature...THEY ARE THE STRONG ONES

    long long n, a, b;
    cin >> n >> a >> b;
    long long sol = power(2, n);
    sol = (sol - 1 + MOD) % MOD;
    fact[0] = 1;
    for (int i = 1; i < mx; i++)
    {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
    sol = (sol - ncr(n, a) + MOD) % MOD;
    sol = (sol - ncr(n, b) + MOD) % MOD;
    cout << sol;

    return 0;
}

Measured memory_bytes: 1792
N = int(input())
count = {}
for i in range(N):
    s = list(input())
    s.sort()
    s = ''.join(s)
    if s in count:
        count[s] += 1
    else:
        count[s] = 1

ans = 0
for d in count:
    ans += (count[d] - 1) * count[d] // 2
print(ans)


Measured memory_bytes: 17808
N=int(input())

DP=[[0 for i in range(3)] for j in range(N)]
DP[0]=list(map(int,input().split()))
for i in range(1,N):
    lis=list(map(int,input().split()))
    for j in range(3):
        DP[i][j]=lis[j]+max(DP[i-1][(j+1)%3],DP[i-1][(j+2)%3])
print(max(DP[N-1]))


Measured memory_bytes: 24308
from scipy.sparse import*
(n,m),*t=[map(int,t.split())for t in open(0)]
a,b,c=zip(*[(i,j+n-1,1)for i,(_,*t)in enumerate(t)for j in t])
print('YNEOS'[1in csgraph.connected_components(csr_matrix(((c,(a,b))),[n+m]*2))[1][:n]::2])

Measured memory_bytes: 61152
#include <cstdio>
#include <algorithm>

using namespace std;

const int N=2005,mo=1e9+7;

typedef long long LL;

int n,m,f[N][N][2],s[N],ans;

int main()
{
	scanf("%d%d",&n,&m);
	f[n+1][0][1]=1;
	for (int i=n;i;i--)
	{
		for (int j=n-i;j>=0;j--) s[j]=(s[j+1]+f[i+1][j][0])%mo;
		for (int j=0;j<=n-i+1;j++)
		{
			f[i][j][1]=(j>0)?(f[i+1][j-1][1]+s[j-1])%mo:0;
			f[i][j][0]=(s[j]+f[i+1][j][1])%mo;
		}
	}
	ans=f[1][n-m][0];
	for (int i=1;i<n-m;i++) ans=ans*2%mo;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 30976
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main()
{
    int a,b,c,d,l,i,j;
    char s[1001];
    while(~scanf("%s",&s))
    {
        a=b=c=d=0;
        l=strlen(s);
        for(i=0; i<l; i++)
        {
            if(s[i]=='N')
                a++;
            if(s[i]=='S')
                b++;
            if(s[i]=='W')
                c++;
            if(s[i]=='E')
                d++;
        }
        if(a!=0&&b!=0&&c!=0&&d!=0)
            printf("Yes\n");
        else if(c!=0&&d!=0&&a==0&&b==0)
            printf("Yes\n");
        else if(a!=0&&b!=0&&c==0&&d==0)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <cstdio>
#include <new>
#include <vector>
#include <cstdlib>
#include <string>
#include <set>
#include <tuple>
#include<map>

using namespace std;
int main() {
	int X, A, B;
	cin >> X >> A >> B;

	if (B - A <= 0) {
		cout << "delicious" << endl;
	}
	else if (B - A <= X) {
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;
	}

}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main()
{
  int N;
  cin >> N;
  vector<int> p(N + 1);
  REP1(i, N)
  cin >> p[i];
  int ans = 0;
  REP1(i, N)
  {
    if (p[i] == i)
    {
      ans++;
      swap(p[i], p[i + 1]);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
N=int(input())
*T,=map(int,input().split())
M=int(input())
PX=[list(map(int,input().split()))for i in range(M)]

for p,x in PX:
    A=T[p-1]
    T[p-1]=x
    print(sum(T))
    T[p-1]=A

Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>

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

using namespace std;

double dp[100005][15];
double two[105];

double solve(int n, int k){
  if(n == 0) return 0;
  double& d = dp[n][k];
  if(d != -1.0) return d;
  return d = two[k] * (1.0 + solve(n-1, min(k+1, 10))) + (1.0 - two[k]) * solve(n-1, 0);
}

int main(){

  int n;
  cout << fixed << setprecision(10);

  rep(i, 100005) rep(j, 15) dp[i][j] = -1.0;
  double tmp = 1.0;
  rep(i, 15) {
    two[i] = tmp;
    tmp *= 0.5;
  }

  while(cin >> n){
    if(n == 0) break;
    cout << solve(n, 0) << endl;
  }

  return 0;
}

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

int N, T, A, H[1100];

int main(){

  cin >> N >> T >> A;

  for(int i; i < N; ++i){
    cin >> H[i];
  }

  double dmin = 1e9, ans = -1;

  for(int i = 0; i < N; ++i){
    double t = T - H[i] * 0.006;
    double d = abs(A - t);
    if(d < dmin){
      dmin = d;
      ans = i;
    }
  }

  cout << ans + 1 << endl;

  return 0; 
}

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

int main() {
    string s;
    cin >> s;
    int a[26] = {0};
    for(int i = 0; i < s.size(); ++i) {
        a[s[i] - 'a'] = 1;
    }
    for(int i = 0; i < 26; ++i) {
        if(a[i] == 0) {
            cout << (char)(i+'a') << '\n';
            return 0;
        }
    }
    cout << "None" << '\n';

    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
#define N 500

int main(void){
  int i,j;
  char name[N],type,hoge;
  char newName[N],ansName[N];

  for(;;){
    scanf("%s%c%c",name,&hoge,&type);
    if(type=='X')
      break;

    for(i=0,j=0;name[i];i++,j++){
      if('A'<=name[i] && name[i]<='Z'){
        if(i){
          newName[j]=' ';
          j++;
        }
        newName[j]=name[i]+'a'-'A';
      }else if(name[i]=='_'){
        newName[j]=' ';
      }else{
        newName[j]=name[i];
      }
    }
    newName[j]=0;

    if(type=='U'){
      for(i=0,j=0;newName[i];i++,j++){
        if(!i){
          newName[i]-='a'-'A';
        }else if(newName[i]==' '){
          i++;
          newName[i]-='a'-'A';
        }
        ansName[j]=newName[i];
      }
    }else if(type=='L'){
      for(i=0,j=0;newName[i];i++,j++){
        if(i && newName[i]==' '){
          i++;
          newName[i]-='a'-'A';
        }
        ansName[j]=newName[i];
      }
    }else if(type=='D'){
      for(i=0,j=0;newName[i];i++,j++){
        if(newName[i]==' ')
          newName[i]='_';

        ansName[j]=newName[i];
      }
    }
    ansName[j]=0;
    
    printf("%s\n",ansName);
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i =0;i<(int)(n);i++)
typedef long long ll;
using namespace std;
// https://youtu.be/F2p_e6iKxnk?t=843
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() {
	ll a, b;
	cin >> a >> b;
	cout << lcm(a, b) << endl;
	return 0;
}

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

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

	bool possible = true;
	if(n%2){
		if(counter[0]!=1){
			cout<<0;
			return 0;
		}
		for(int i=2; i<=n-1; i+=2){
			if(counter[i]!=2) possible = false;
		}
		if(!possible) cout<<0; 
	}
	else{
		for(int i=1; i<=n-1; i+=2){
			if(counter[i]!=2) possible = false;
		}
		if(!possible) cout<<0;
	}
	if(possible){
		int ret = 1;
		for(int i=0; i<n/2; i++){
			ret*=2;
			ret%=1000000007;
		}
		cout<<ret;
	}
}

Measured memory_bytes: 4040
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int N;
  string S;
  cin >> N >> S;

  int ans = 0;
  for (int i = 0; i <= N - 3; i++){
    if (S.at(i) == 'A' && S.at(i + 1) == 'B' && S.at(i + 2) == 'C') ans++;
  }
  cout << ans << endl;
}


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

#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

int f[] = {0,1000,2,3,4,5,6,7,8,9,10,11,12,13};

signed main() {
    int a, b;
    cin >> a >> b;
    if(f[a] > f[b]){
        cout << "Alice" << endl;
    }else if(f[a] < f[b]){
        cout << "Bob" << endl;
    }else{
        cout << "Draw" << endl;
    }
}

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

struct Card {char suit, value; };

void bubble(struct Card A[],int N){
    for(int i=0; i < N; i++){
        for(int j=N-1; j >= i + 1; j--){
            if(A[j].value < A[j-1].value){
                Card t = A[j];
                A[j] = A[j-1];
                A[j-1] = t;
            }
        }
    }
}

void selection(struct Card A[],int N){
    for (int i =0;i<N; i++){
        int minj = i;
        for(int j=i;j < N; j++){
            if(A[j].value < A[minj].value){
                minj =j;
            }
        }
        Card t = A[i];
        A[i] = A[minj];
        A[minj] = t;
    }
}

void print(struct Card A[], int N){
    for (int i=0; i < N; i++){
        if(i >0){
            cout << " ";
        }
        cout << A[i].suit << A[i].value;
    }
    cout << endl;
}

bool isStable(struct Card C1[], struct Card C2[], int N){
    for (int i=0; i < N; i++){
        if(C1[i].suit != C2[i].suit){
            return false;
        }
    }
    return true;
}

int main(){
    Card C1[100],C2[100];
    int N;
    char ch;

    cin >> N;
    for(int i=0; i<N; i++){
        cin >> C1[i].suit >> C1[i].value;
    }

    for(int i=0; i < N; i++){
        C2[i] = C1[i];
    }

    bubble(C1,N);
    selection(C2,N);

    print(C1,N);
    cout << "Stable" << endl;
    print(C2,N);
    if(isStable(C1,C2,N)){
        cout << "Stable" << endl;
    }
    else{
        cout << "Not stable" << endl;
    }
    
    return 0;

}




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

int main() {
  int n = 0;
  int c0 = 0;
  int c1 = 0;
  int c2 = 0;
  int c3 = 0; 
  cin >> n;
  string s[n];
  for (int i=0; i<n; i++) {
    cin >> s[i];
    if (s[i] == "AC") {
      c0++;
    } else if (s[i] == "WA") {
      c1++;
    } else if (s[i] == "TLE") {
      c2++;
    } else {
      c3++;
    }
  }
  cout << "AC x " << c0 << endl;
  cout << "WA x " << c1 << endl;
  cout << "TLE x " << c2 << endl;
  cout << "RE x " << c3 << endl;
}

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

typedef long long ll;
const int MAX_N = 100000;

int main() {
	int N;
	ll X, x[MAX_N], d[MAX_N];

	std::cin >> N >> X;
	for(int i = 0; i < N; ++i) {
		std::cin >> x[i];
		d[i] = std::abs(X - x[i]);
	}
	std::sort(d, d + N);

	ll ans = d[0], r = d[0];
	for(int i = 1; i < N; ++i) {
		ans = d[i];
		while(r > 0) {
			std::swap(r, ans);
			r %= ans;
		}
		r = ans;
	}

	std::cout << ans << std::endl;
}

Measured memory_bytes: 1792
import math
A, B = map(int, input().split())

Y = B*10  # Y+0~9
ans = -1

if A == math.floor(Y*0.08):
    ans = Y
elif A == math.floor((Y+1)*0.08):
    ans = Y+1
elif A == math.floor((Y+2)*0.08):
    ans = Y+2
elif A == math.floor((Y+3)*0.08):
    ans = Y+3
elif A == math.floor((Y+4)*0.08):
    ans = Y+4
elif A == math.floor((Y+5)*0.08):
    ans = Y+5
elif A == math.floor((Y+6)*0.08):
    ans = Y+6
elif A == math.floor((Y+7)*0.08):
    ans = Y+7
elif A == math.floor((Y+8)*0.08):
    ans = Y+8
elif A == math.floor((Y+9)*0.08):
    ans = Y+9

print(ans)


Measured memory_bytes: 38384
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <numeric>
#include <stack>
#include <map> // pair
#include <cstdlib>  // abs() for integer
#include <cmath>    // abs() for float, and fabs()
typedef std::stack<int> IntStack;
typedef std::stack<char> charStack;
#define START 0
#define FORWARD 1
#define BACK 2
using namespace std;
using ll = long long;
typedef pair <ll, ll > pll;
bool comp(const pll &a, const pll &b) {
	return a.first < b.first;
}
//*********************************************************
// 最大公約数（Greatest Common Divisor）を返す。
// 引数に０がある場合は０を返す。
//*********************************************************
ll gcd(ll a, ll b)
{
	ll tmp, r;
	if (a < b) {
		tmp = a;
		a = b;
		b = tmp;
	}

	/* ユークリッドの互除法 */
	r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
	//// 引数に０がある場合は０を返す
	//if ((0 == m) || (0 == n))
	//	return 0;

	//// ユークリッドの方法
	//while (m != n)
	//{
	//	if (m > n) m = m - n;
	//	else         n = n - m;
	//}
	//return m;
}//gcd

int main()
{
	ll a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	ll x[100004] = {};
	ll y[100004] = {};
	ll z[2003][2003] = { {} };
	vector<tuple<ll, ll>> vec;
	string s;
	string t;
	//IntStack yStack;
	//charStack Stack;
	//vector<pair<int, int> > pairs(a);
	//cout << LLONG_MAX<< endl;

	cin >> a;
	cin >> b;
	c = 99999;
	for (int i = 0; i < a; i++)
	{
		ans += i + b;
		if (abs(c)>abs(i+b))
		{
			c = i + b;
		}
	}
	ans -= c;


	cout << ans << endl;

	//cout << ans << endl;


	////std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	//cout << d+1 << endl;
	//cout << "" << endl;

	return 0;
}
//sort(x, x + a, std::greater<ll>());

//char型の文字数字は、-'0'で数値に変換できる
//accumulate(x, x + a, 0);//int型までの配列の合計
//memcpy(x, visited, sizeof(ll)*n);
//void kansuu(ll num, ll visited[10]) {}
//kansuu(1, zz);
//cout << setprecision(15) << v << endl;
//cout << char(z - 'a');
//log10(i) + 1 //10進数の桁数を取得
//
//int temp;
//for (int i = 0; i < n - 1; i++) {
//	for (int j = n - 1; j > i; j--) {
//		if (w[j - 1] < w[j]) {  /* 前の要素の方が大きかったら */
//			temp = w[j];        /* 交換する */
//			w[j] = w[j - 1];
//			w[j - 1] = temp;
//		}
//	}
//}
//
//最小公倍数
//ll x = a * b;
//ll tmp;
///* 自然数 a > b を確認・入替 */
//if (a<b) {
//	tmp = a;
//	a = b;
//	b = tmp;
//}
///* ユークリッドの互除法 */
//ll r = a % b;
//while (r != 0) {
//	a = b;
//	b = r;
//	r = a % b;
//}
//a = x / b;//答え


/*vector<pair<ll, ll> > hoges(a);
for (int i = 0; i < a; i++)
{
cin >> x[i];
cin >> y[i];
hoges[i] = make_pair(x[i], y[i]);
}
sort(hoges.begin(),hoges.end(),comp);
for (int i = 0; i < a; i++)
{
if (hoges[i].second>=b)
{
ans += hoges[i].first*b;
break;
}
else
{
ans += hoges[i].first*hoges[i].second;
b -= hoges[i].second;

}
}*/

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b,c;
    cin >> a >> b >> c;

    if (a > b) a^=b^=a^=b;
    if (b > c) b^=c^=b^=c;
    if (a > b) a^=b^=a^=b;

    cout << a << " " << b << " " << c << "\n";
    return 0;
}

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

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ALL(x) x.begin(), x.end()
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
random_device rnd;
mt19937 mt(rnd());
using ll = long long;
using lld = long double;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using PII = pair<int, int>;
const int IINF = 1 << 30;
const ll INF = 1ll << 60;
const ll MOD = 1000000007;

int sn;
bool comp(const pair<pair<int, int>, int> &x, const pair<pair<int, int>, int> &y)
{
    if (x.first.first / sn != y.first.first / sn)
        return x.first.first / sn > y.first.first / sn;
    return x.first.second / sn > y.first.second / sn;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, q;
    cin >> n >> q;
    vector<int> tmp;
    rep(i, n)
    {
        int t;
        cin >> t;
        tmp.push_back(t);
    }

    vector<int> col(n + 1, 0);
    col[tmp[0]]++;
    int num = 1;
    int cl = 0, cr = 0;
    vector<pair<pair<int, int>, int>> query(q);
    rep(i, q)
    {
        int l, r;
        cin >> l >> r;
        l--;
        r--;
        query[i] = {{l, r}, i};
    }
    sn = 1;
    while (sn * sn <= n)
    {
        sn++;
    }
    sn--;
    sort(ALL(query), comp);

    VI ans(q, 0);
    rep(i, q)
    {
        int l = query[i].first.first;
        int r = query[i].first.second;

        if (r < cr)
        {
            while (r != cr)
            {
                col[tmp[cr]]--;
                if (col[tmp[cr]] == 0)
                    num--;
                cr--;
            }
        }
        if (r > cr)
        {
            while (r != cr)
            {

                cr++;
                if (col[tmp[cr]] == 0)
                    num++;
                col[tmp[cr]]++;
            }
        }

        if (l > cl)
        {
            while (l != cl)
            {
                col[tmp[cl]]--;
                if (col[tmp[cl]] == 0)
                    num--;
                cl++;
            }
        }

        if (l < cl)
        {
            while (l != cl)
            {
                cl--;
                if (col[tmp[cl]] == 0)
                    num++;
                col[tmp[cl]]++;
            }
        }
        ans[query[i].second] = num;
    }
    rep(i, q)
    {
        cout << ans[i] << "\n";
    }
    return 0;
}


Measured memory_bytes: 15564
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")

#include <stdio.h>
#include <bits/stdc++.h>			

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()
#define what_is(x) #x << " is " << (x)

using namespace std;

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

const int N = (int)1e5 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;
const double PI = 3.1415926535897932384626;
const double eps = 1e-9;

int n;

struct point {
	double x, y;
	void in() {
		cin >> x >> y;
	}
};

point p[111];

int main() {
  cin >> n;
	for(int i = 1; i <= n; i ++)
		p[i].in();
	for(int i = 1; i <= n; i ++) {
		vector<double> v;
		for(int j = 1; j <= n; j ++) {
			if(i == j) continue;
			v.pb(atan2(p[j].y - p[i].y, p[j].x - p[i].x));
		}
		stable_sort(all(v));
		double mx = 0;
		mx = v[0] + 2 * PI - v.back();
		for(int j = 0; j < sz(v) - 1; j ++) 
			mx = max(mx, v[j + 1] - v[j]);
		if(mx + eps < PI) {
			cout << "0.00000\n";
		} else {
			//mx = 2.0 * PI - mx;
			//cout << "i: " << i << " mx: " << mx << "\n";
			cout << fixed << setprecision(5) << /*0.5 - */(mx - PI) / (2.0 * PI) << "\n";
		}
	}
	return 0;  
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int main(){
	int N;
	string S;
	while(cin >> N >> S){
		vector<int> cntW(N, 0);
		vector<int> cntE(N, 0);
		for(int i=1;i<N;i++){
			cntW[i] = cntW[i-1] + (S[i-1] == 'W');
		}
		for(int i=N-2;i>=0;i--){
			cntE[i] = cntE[i+1] + (S[i+1] == 'E');
		}
		int res = N;
		for(int i=0;i<N;i++) res = min(res, cntW[i] + cntE[i]);
		cout << res << endl;
	}
}

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

const int N = 3e5 + 9;

int need[4], sz[3], cnt[2];
vector<pair<int, int>> v;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> need[0] >> need[1];
    for(int i = 0; i < 3; i++) cin >> sz[i];
    for(int i = 0; i < 3; i++){
        for(int j = 0; j < sz[i]; j++){
            int k; cin >> k;
            v.push_back({k, i});
        }
    }
    sort(v.begin(), v.end());
    long long ans = 0, tot = 0;
    for(int i = v.size() - 1; i >= 0; i--){
        int ty = v[i].second;
        if(tot == need[0] + need[1]) continue;
        if(cnt[ty] == need[ty]) continue;
        if(ty < 2) cnt[ty]++;
        ans += v[i].first, tot++;
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 6512
#include <bits/stdc++.h>
#define optimize ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long
#define ld long double
#define lint __int128
#define vi vector<int>
#define pb push_back
#define lp(i,a,b) for(int i = a ; i <= b ; i ++)
#define rlp(i,a,b) for(int i = b ; i >= a ; i --)
#define a_sort(v) sort(v.begin(), v.end())
#define d_sort(v) sort(v.rbegin(), v.rend())
#define pii pair<int,int>
#define pi 3.14159265358979323846264338327950
using namespace std ;
// #define debug

const int MOD = 1E9 + 7 ;
const int N = 1E5 ;

int main() {
    #ifdef debug
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif // debug
    optimize

    int a , b ; cin >> a >> b ;
    cout << a * b << endl ;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<double> point;
#define F first
#define S second



int main()
{
	#ifdef DGC
		//freopen("a.txt", "r", stdin);
		//freopen("b.txt", "w", stdout);
	#endif

	ios_base::sync_with_stdio(0), cin.tie(0);

	int n, x;
	cin >> n >> x;
	int c = 0, ans = 1;
	for (int i = 0, l; i < n; ++i)
	{
		cin >> l;
		c += l;
		ans += c <= x;
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1000000000
#define  pow(x) pow(10,(x)) 
typedef long long int LL;
const int MOD = 1000000007;
//sort(all(x))とするとソートできるよ

unsigned GetDigit(unsigned num){
    if(num == 0)return 1;
    return log10(num)+1;
}

int main(){
    string S;cin >> S;
    LL K;cin >> K;
    vector<int> s;
    int ksize = GetDigit(K);
    for(auto i : S){
        s.push_back(i -'0');
    }

    int one_ct = 0;
    if(s[0] == 1){
        rep(i,s.size()){
            if(i == 0){
                one_ct++;
                continue;
            }
            if(s[i-1] == s[i]){
                one_ct++;
            }
            else{
                break;
            }
        }
    }


    if(one_ct >= K){
        cout << '1' << endl;
    }
    else if(one_ct != 0 && one_ct < K){
        cout << s[one_ct] << endl;
    }
    else{
        cout << s[0] << endl;
    }
}

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

using namespace std;

#define ll long long 
#define Hello_World ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

int main()
{
	int t, n;
	string ch;
	
	multimap<string, int>m;
	
	cin >> t >> n;
	
	while(t--)
	{
		cin >> ch;
		m.insert({ch,1});
	}
	
	string ans = "";
	
	for(auto it : m)
	{
		ans += it.first;
	}
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);
const long double PI = acos(-1);
typedef long long ll;
typedef pair<ll, ll> pii;
typedef complex<double> pnt;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

/* START */
#define int long long
int32_t main() { _
	int n;
	cin >> n;
	vector<int> l(90);
	l[0] = 2;
	l[1] = 1;
	for (int i = 2; i <= n; ++i)
		l[i] = l[i - 1] + l[i - 2];
	cout << l[n] << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sqr(x) ((x)*(x))
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define ld long double
#define vi vector<int>
#define all(a) a.begin(),a.end()
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > > 
#define pii pair<int,int> 
#define pb push_back
#define mp make_pair
#define debuge cerr<<"isok"<<endl
#define debug(x) cerr<<#x<<"="<<x<<endl
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
#define SS second
#define FF first
#define ls (k<<1)
#define rs (k<<1|1)
#define clr(a,x) memset(a,x,sizeof(a))
#define cpy(a,x) memcpy(a,x,sizeof(a))
#define file(x) freopen(x".in","r",stdin),freopen(x".out","w",stdout)
#define SZ(x) ((int)x.size())
using namespace std;
template<class T> inline void gmin(T &x,const T &y){x=x>y?y:x;}
template<class T> inline void gmax(T &x,const T &y){x=x<y?y:x;}
template<class T> inline bool Gmin(T &x,const T &y){return x>y?x=y,1:0;}
template<class T> inline bool Gmax(T &x,const T &y){return x<y?x=y,1:0;}
const int BufferSize=1<<16;
char buffer[BufferSize],*Bufferhead,*Buffertail;
bool Terminal;
inline char Getchar(){
	if(Bufferhead==Buffertail){
		int l=fread(buffer,1,BufferSize,stdin);
		if(!l){Terminal=1;return 0;}
		Buffertail=(Bufferhead=buffer)+l;
	}
	return *Bufferhead++;
}
template<class T>inline bool read(T &x){
	x=0;char c=Getchar(),rev=0;
	while(c<'0'||c>'9'){rev|=c=='-';c=Getchar();if(Terminal)return 0;}
	while(c>='0'&&c<='9') x=x*10+c-'0',c=Getchar();
	if(c=='.'){
		c=Getchar();double t=0.1;
		while(c>='0'&&c<='9') x=x+(c-'0')*t,c=Getchar(),t=t/10;
	}
	x=rev?-x:x;
	return 1;
}
template<class T1,class T2> inline bool read(T1 &x,T2 &y){return read(x)&read(y);}
template<class T1,class T2,class T3> inline bool read(T1 &x,T2 &y,T3 &z){return read(x)&read(y)&read(z);}
template<class T1,class T2,class T3,class T4> inline bool read(T1 &x,T2 &y,T3 &z,T4 &w){return read(x)&read(y)&read(z)&read(w);}
inline bool reads(char *x){
	char c=Getchar();
	while(c<33||c>126){c=Getchar();if(Terminal)return 0;}
	while(c>=33&&c<=126) (*x++)=c,c=Getchar();
	*x=0;return 1;
}
template<class T>inline void print(T x,const char c='\n'){
	if(!x){putchar('0');putchar(c);return;}
	if(x<0) putchar('-'),x=-x;
	int m=0,a[20];
	while(x) a[m++]=x%10,x/=10;
	while(m--) putchar(a[m]+'0');
	putchar(c);
}
//--------------------------------head---------------------------------------------

const int inf=0x3f3f3f3f;
const int N=200005,M=100005,mod=1e9+7;
template<class T,class S> inline void ch(T &x,const S y){x=(x+y)%mod;}
inline int exp(int x,int y,const int mod=::mod){
	int ans=1;
	while(y){
		if(y&1) ans=(ll)ans*x%mod;
		x=(ll)x*x%mod;y>>=1;
	}return ans;
}

int n,t,x,y;

int main(){
#ifdef rqgao2014
	assert(freopen("input.txt","r",stdin));
#endif
	read(n);
	for(int i=1;i<=n;i++){
		int p,tx,ty;read(p,tx,ty);
		if(p-t<abs(tx-x)+abs(ty-y)){puts("No");return 0;}
		if((p-t&1)!=(abs(tx-x)+abs(ty-y)&1)){puts("No");return 0;}
		t=p;x=tx;y=ty;
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
 
typedef long long ll;

#define MP make_pair
#define F first
#define S second

int main(){
	ll n,k;
    cin >> n>>k;
    vector<ll> a(n);
  	for(ll i=0;i<n;i++){
    cin>>a[i];
    }
    ll ans=0,cnt=0,fir=0;
    ll tmp=(k*(k-1)/2)%1000000007;
  	for(ll i=0;i<n;i++){
        cnt=0;fir=0;
    	for(ll j=0;j<n;j++){
        	if(a[j]<a[i]){
              	cnt++;
            	if(i<j)fir++;
            }
        }
        ans = (ans+cnt*tmp)%1000000007;
        ans = (ans+fir*k)%1000000007;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int64_t gcd(int64_t a, int64_t b) {return b?gcd(b, a%b):a;}
int64_t lcm(int64_t a, int64_t b) {return a/gcd(a,b)*b;}
int64_t extgcd(int64_t a, int64_t b, int64_t &x, int64_t &y) { // ax+by=gcd(a, b)の解を与える
    int64_t d = a;
    if(b) {
        d = extgcd(b, a%b, y, x);
        y -= (a/b)*x;
    } else {
        x = 1; y = 0;
    }
    return d;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int x;
    cin >> x;
    cout << lcm(x, 360)/x << endl;
}

Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>


using namespace std;



int main() {

	int ans = 99999999;
	string p;
	cin >> p;
	int a = 0, b = 0;
	for (int i = 0; i < p.size(); i++) {
		if (i % 2) {
			if (p[i] == '0')a++;
			else b++;
		}
		else {
			if (p[i] == '0')b++;
			else a++;

		}

	}
	cout << min(a, b) << endl;

	return 0;

}

Measured memory_bytes: 512