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

int n, q;
int s[1000000];
int ss[1000000];
multiset<int> S;

bool check(int y, int x)
{
	vector<pair<int, int> > v;
	v.push_back(make_pair(0, 0));
	for (multiset<int>::iterator it = S.begin(); it != S.end(); ++it){
		int L = lower_bound(ss, ss + n, *it - y) - ss;
		int R = upper_bound(ss, ss + n, *it) - ss;
		v.push_back(make_pair(L, R));
	}
	v.push_back(make_pair(n, n));
	
	for (int i = 0; i + 1 < v.size(); i++){
		int diff = v[i + 1].first - v[i].second;
		x -= max(0, diff);
		if (x < 0) return false;
	}
	
	return true;
}

int main()
{
	scanf("%d %d", &n, &q);
	for (int i = 0; i < n; i++) scanf("%d", s + i);
	for (int i = 0; i < n; i++) ss[i] = s[i];
	sort(ss, ss + n);
	for (int i = 0; i < q; i++){
		string com;
		int x;
		
		cin >> com >> x;
		if (com == "ADD") S.insert(s[--x]);
		else if (com == "REMOVE") S.erase(S.find(s[--x]));
		else {
			int l = -1, r = 1e9 + 2;
			while (l + 1 < r){
				int m = (l + r) / 2;
				if (check(m, x)) r = m;
				else l = m;
			}
			if (l + 1 > (int)1e9) puts("NA");
			else printf("%d\n", l + 1);
		}
	}
}

Measured memory_bytes: 9108
#include <iostream>
#include <cmath>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;

int main(){
    string s;
    cin>>s;
    string t="YAKI";
    ll ans=0;
    for(ll i=0;i<4;++i){
        if(s[i]==t[i]){
            ans+=1;
        }
    }
    if(ans==4){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  string s, t; cin >> s >> t;
  int s_sz = s.size(), t_sz = t.size();
  vector<vector<int> > dp(s_sz + 1, vector<int>(t_sz + 1, 0));
  REP(i, s_sz) REP(j, t_sz) {
    if (s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
    else dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
  }
  string ans = "";
  int i = s_sz, j = t_sz;
  while (i > 0 && j > 0) {
    if (dp[i][j] == dp[i - 1][j]) --i;
    else if (dp[i][j] == dp[i][j - 1]) --j;
    else {
      ans = s[i - 1] + ans;
      --i;
      --j;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end() 

int const N = 200001;
map<string, bool> f;
string s, an; 
int m, n, c;

bool srt(int x, int y){
     for(int i = x, j = y; i<n && j<n; ++i, ++j){
         if(s[i] != s[j])return s[i] <= s[j];
     }
     return x >= y;
}

int main(){
    cin >> s >> m;
    n = s.size();
    an = s;
    vector<int> g[26];
    for(int i = 0; i<n; ++i)g[s[i]-'a'].push_back(i);
    vector<string> cur; 
    for(char i = 'a'; i<='z'; ++i){
       string z = "";
       z += i;
       if(!g[i-'a'].size())continue;
       if(cur.size() == m)break;
       sort(all(g[i-'a']), srt);
       cur.push_back(z);
       for(auto j: g[i-'a']){
          z = "";
          z += i;
          if(cur.size() == m)break;
          for(int k = j+1; k<n; ++k){
             if(cur.size() == m)break;
             z += s[k];
             if(f[z])continue;
             f[z] = 1;
             cur.push_back(z);
          }
       }
    }
    cout << cur.back();
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 100005

const int INF = 1e9+7;


int main(){

    ll n,m;
    cin >> n >> m;
    vector<ll> a(m);
    for(int i = 0;i < m;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());

    priority_queue<ll> que;

    for(int i = 0;i < m-1;i++){
        que.push(a[i+1]-a[i]);
    }

    ll ans = 0;
    ll coma = n-1;

    while(!que.empty()){

        //cout << que.top() << endl;
        if(coma > 0){
            coma--;
            que.pop();
        }else{
            ans += que.top();
            que.pop();
        }
        //cout << coma << " " << ans << endl;
    }

    cout << ans << endl;




    return 0;
}

Measured memory_bytes: 2168
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#include<bits/stdc++.h>
using namespace std;
#define REP(r,x,y) for(register int r=(x); r<(y); r++)
#define PER(r,x,y) for(register int r=(x); r>(y); r--)
#define REPE(r,x,y) for(register int r=(x); r<=(y); r++)
#define PERE(r,x,y) for(register int r=(x); r>=(y); r--)
#ifdef sahdsg
#define DBG(...) printf(__VA_ARGS__)
#else
#define DBG(...) (void)0
#endif

int cnt[27];

int main() {
	int n;
	scanf("%d", &n);
	REP(i,0,27) cnt[i]=1;
	while(0<n--) {
		char ch=getchar();
		if(ch<'a') ch=getchar();
		cnt[ch-'a']++;
	}
	long long ans =1;
	REP(i,0,26) {
		ans*=cnt[i];
		ans%=1000000007LL;
	}
	printf("%lld\n", ans-1);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAXN=110;
char c[MAXN];
bool chk (int l,int r) {
	for (int i=l;i<=r;i++) {
		if (c[i]!=c[r-(i-l)]) {return 0;}
	}
	return 1;
}
int main () {
	scanf("%s",c+1);
	int n=strlen(c+1);
	if (chk(1,n)&&chk(1,(n-1)/2)&&chk((n+3)/2,n)) {printf("Yes\n");}
	else {printf("No\n");}
	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 K;
  cin >> K;

  int even = 0;
  int odd = 0;
  REP(i,1,K+1){
    if(i%2==0) even++;
    else odd++;
  }

  cout << even * odd << endl;
  
  return 0;
}


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

int main()
{
    int n, x;

    while ((cin >> n >> x), !(n == 0 && x == 0)) {
        int ans = 0;

        for (int i = 1; i <= n; ++i) {
            for (int j = i + 1; j <= n; ++j) {
                if (x - i - j > j && x - i - j <= n) {
                    ++ans;
                }
            }
        }

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
#include<stdio.h>

int main(void){
  
  char array[4];  
  scanf("%s",array);

  int flag = 1;

  for(int i=0 ; i<3 ; i++){
    if(array[i] == array[i+1]){
      flag = 0;
      break;
    }
  }

  switch(flag){
  case 0:
    printf("Bad\n");
    break;
  case 1:
    printf("Good\n");
  }   
  
  return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<cstring>
using namespace std;
#define MAXN 100000
int n;
long long ans=0;
int vis[MAXN+5];
int a[MAXN+5];
int read()
{
	int x=0,f=1;
	char c=getchar();
	while('0'>c||c>'9') {if(c=='-') f=-1;c=getchar();}
	while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}
	return x*f;
}
int main()
{
	n=read();
	for(int i=1;i<=n;i++)
	{
		a[i]=read();
		if(a[i]) vis[i]=1;
		ans+=a[i]/2;
		a[i]%=2;
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]&&a[i-1])
		{
			a[i]=0;
			a[i-1]=0;
			ans++;
		}
		else if(a[i]==0&&a[i-1])
		{
			if(vis[i])
			{
				a[i]++;
				a[i-1]--;
			}
		}
	}
	printf("%lld",ans);
}



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

int n,w,we[104],v[104],dp[100004];

int main() {
    scanf("%d%d",&n,&w);
    for(int i=0;i<n;++i)    scanf("%d%d",we+i,v+i);
    memset(dp,-1,sizeof(dp));
    dp[0] = 0;
    int ret = 0;
    for(int i=0;i<n;++i)
        for(int j=100000;j>=v[i];--j)
            if(dp[j-v[i]]!=-1)
                if(dp[j-v[i]]+we[i]<=w) {
                    if(dp[j]!=-1)   dp[j] = min(dp[j],dp[j-v[i]]+we[i]);
                    else            dp[j] = dp[j-v[i]]+we[i];
                    ret = max(ret,j);
                }

    printf("%d",ret);
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define let auto const

template<typename... Types>
struct dynarr: std::vector<Types...> {
  using std::vector<Types...>::vector;
  using size_type = typename std::vector<Types...>::size_type;
  auto&& operator[](size_type i) { return this->at(i); }
  auto&& operator[](size_type i) const { return this->at(i); }
};

struct eulartour_path {
  vector<vector<i64>> G;
  vector<i64> in, out;
  i64 cnt;
  eulartour_path(i64 n): G(n), in(n), out(n) {}
  void add_edge(i64 u, i64 v) {
    G[u].push_back(v);
    G[v].push_back(u);
  }

  void dfs(i64 v, i64 f) {
    for(auto to: G[v]) {
      if(to == f) continue;
      in[to] = cnt;
      cnt++;
      dfs(to, v);
      out[to] = cnt;
      cnt++;
    }
  }

  i64 start_tour(i64 r) {
    in[r] = cnt;
    cnt++;
    dfs(r, -1);
    return cnt;
  }
};


struct segment_tree {
  using T = i64;
  T ope(const T& a, const T& b) {
    return a + b;
  }
  T ide() { return 0; }
 
  i64 n;
  vector<i64> node;
 
  segment_tree(vector<i64> init) {
    n = 1;
    while(n < init.size()) n *= 2;
    node.resize(2 * n);
    rep(i, 0, init.size()) node[i + n] = init[i];
    for(int i = n - 1; i >= 1;i--) node[i] = ope(node[i * 2], node[i * 2 + 1]);
  }
 
  void update(i64 i, i64 x) {
    i += n;
    node[i] += x;
    while(i > 1) {
      i = i / 2;
      node[i] = ope(node[i * 2], node[i * 2 + 1]);
    }
  }
  
  /* [l, r] */
  T get(i64 l, i64 r) {
    T lx = ide();
    T rx = ide();
    l += n;
    r += n;
    while(l < r) {
      if(l & 1) { lx = ope(lx, node[l]); }
      if(!(r & 1)) { rx = ope(node[r], rx); }
      l = (l + 1) >> 1;
      r = (r - 1) >> 1;
    }
    if(l == r) { lx = ope(lx, node[l]); }
    return ope(lx, rx);
  }
};

int main() {
  i64 N;
  cin >> N;
  eulartour_path eul(N);
  rep(i,0,N) {
    i64 k;
    cin >> k;
    rep(j,0,k) {
      i64 c;
      cin >> c;
      eul.add_edge(i, c);
    }
  }

  segment_tree seg(vector<i64>(eul.start_tour(0)));
  
  i64 Q;
  cin >> Q;
  rep(q, 0, Q) {
    i64 type;
    cin >> type;
    if(type == 0) {
      i64 v, w;
      cin >> v >> w;
      seg.update(eul.in[v], w);
      seg.update(eul.out[v], -w);
    }
    else {
      i64 u;
      cin >> u;
      cout << seg.get(eul.in[0] + 1, eul.in[u]) << endl;
    }
  }
}



Measured memory_bytes: 178092
#include <iostream>
#include <algorithm>
#include <math.h>
#include <iomanip>

using namespace std;

string S;
int N;

void Main() {
  cin >> N;
  cin >> S;

  for (int i = 0; i < S.length(); ++i) {
    S[i] = (S[i] + N - 'A') % 26 + 'A';
  }

  cout << S;
}

int main() {
  Main();
  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 FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
 
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<bool> VB;

int main() {
    int r;
    cin >> r;
    cout << r*r;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string s ;
    getline(cin,s);
    
        
     //cout<<s;
     for(int i=0;i<s.size();i++){
         char c=s[i];
         if('A'<=c&&c<='Z'){
             c= tolower(c);
         }
         else if('a'<=c&&c<='z'){
             c=c-32;
         }
         cout<<c;
     }
    
    cout<<endl;
}


Measured memory_bytes: 3216
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;

int linearSearch(vector<int> &v, int key){
	int n = v.size();
	int i = 0;
	while(v[i] != key){
		i++;
		if(i == n)
			return -1;
	}
	return i;
}

int main(){
	int n,q;
	vector<int> S,T;
	cin >> n;
	for(int i = 0; i < n; i++){
		int tmp;
		cin >> tmp;
		S.push_back(tmp);
	}
	cin >> q;
	for(int i = 0; i < q; i++){
		int tmp;
		cin >> tmp;
		T.push_back(tmp);
	}

	int cnt = 0;
	for(int i = 0; i < q; i++)
		if(linearSearch(S,T[i]) != -1) cnt++;
	cout << cnt << endl;
}

Measured memory_bytes: 1320
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    double p;
    double dp[n+1];
    for(int i=1;i<=n;i++)dp[i]=0.0;
    //vector<vector<double> > dp(n+1,vector<double> (n+1,0.0));
    dp[0]=1.0;
    for(int i=0;i<n;i++){
    	cin>>p;
    	for(int j=n-1;j>=0;j--){
    		dp[j+1]+=dp[j]*p;
    		dp[j]=dp[j]*(1.0-p);
    	}
    }
    double ans=0.0;
    for(int i=(n+2)/2;i<=n;i++){
    	ans+=dp[i];
    }
    doublecout(ans);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long int;
template<typename T> void swap(T *t1, T *t2){ T* tmp=t1; t1=t2; t2=tmp;}
Int tmpi = 0;
double tmpd = 0.0;


int h, w;
int c[10][10];
int a[500][500];

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

    cin >> h >> w;
    for(int i=0; i<10; i++){
        for(int j=0; j<10; j++){
            cin >> c[i][j];
        }
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> a[i][j];
        }
    }

    
    for(int k=0; k<10; k++){
        for(int i=0; i<10; i++){
            for(int j=0; j<10; j++){
                c[i][j] = min(c[i][j], c[i][k]+c[k][j]);
            }
        }
    }

    Int ans = 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            ans += c[a[i][j]][1];
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

// 0 - indexed
template <typename Monoid>
struct Segmenttree
{
    using F = function<Monoid(Monoid, Monoid)>;
    const Monoid e;
    const F f;

    int sz;
    vector<Monoid> seg;

    // size, operator, unit
    Segmenttree(int N, const F f, const Monoid e) : f(f), e(e)
    {
        sz = 1;
        while (sz < N)
            sz *= 2;
        seg.assign(2 * sz - 1, e);
    }

    void set(int k, const Monoid &x) { seg[k + sz - 1] = x; }
    void build()
    {
        for (int k = sz - 1; k >= 0; k--)
        {
            seg[k] = f(seg[2 * k + 1], seg[2 * k + 2]);
        }
    }

    void update(int k, const Monoid &x)
    {
        k += sz - 1;
        seg[k] = x;
        while (k > 0)
        {
            k = (k - 1) / 2;
            seg[k] = f(seg[k * 2 + 1], seg[k * 2 + 2]);
        }
    }

    Monoid sub_query(int a, int b, int k, int l, int r)
    {
        if (r <= a || b <= l)
            return e;

        if (a <= l && r <= b)
            return seg[k];
        else
        {
            Monoid vl = sub_query(a, b, k * 2 + 1, l, (l + r) / 2);
            Monoid vr = sub_query(a, b, k * 2 + 2, (l + r) / 2, r);
            return f(vl, vr);
        }
    }

    // [l, r)
    Monoid query(int l, int r)
    {
        return sub_query(l, r, 0, 0, sz);
    }

    Monoid operator[](const int &k) const
    {
        return seg[k + sz];
    }
};

int main()
{
    int N;
    cin >> N;
    Segmenttree<int> seg(N, [](int a, int b) { return gcd(a, b); }, 0);
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        seg.update(i, a);
    }

    int ans = 0;
    for (int i = 0; i < N; i++)
    {
        ans = max(gcd(seg.query(0, i), seg.query(i + 1, N)), ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int main(){
    int a, b;
    cin >> a >> b;
    bool ok = true;
    if(a < 1) ok = false;
    if(a > 9) ok = false;
    if(b < 1) ok = false;
    if(b > 9) ok = false;
    if(ok) cout << a*b << endl;
    if(!ok) cout << "-1" << endl;
}

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

int main()
{
    int n;
    cin >> n;
    int cnt = 0;
    for (int i = 1; i <= n; i++)
    {
        if (i % 2 == 1)
            cnt++;
    }
    double ans = (double)cnt / (double)n;
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 3712
#include <iostream>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
static const int mod = 998244353;
typedef long long ll;
typedef pair<int, int> P;
struct mint{
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a){
    if ((x += a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }

  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) {
      x -= mod;
    }
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) { return 1;}
    mint a = pow(t>>1);
    a *= a;
    if (t&1) {a *= *this; }
    return a;
  }
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a){
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

template<typename T>

struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n), d(n+1){}
  void add(int i, T x=1) {
    for (i++; i <= n; i+=i&-i) {
      d[i]+=x;
    }
  }
  T sum(int i){
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
};

mint f(int a, int b, int c, int d){
  mint res = 0;
  vector<int> num = {a, b, c, d};
  vector<mint> o(4), ox(4);
  for (int i = 0; i < 4; i++) {
    ox[i] = mint(2).pow(num[i]);
    o[i] = ox[i] - 1;
  }

  res += ox[0]*o[1]*o[2]*ox[3];
  res += o[0]*ox[1]*ox[2]*o[3];
  res -= o[0]*o[1]*o[2]*o[3];
  res += ox[0]*ox[1]*ox[2]*ox[3];

  return res;
}

int main() {
  int n;
  cin >> n;
  vector<P> p(n);

  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }

  {//compress x
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      mp[p[i].first] = 0;
    }
    int j = 0;
    for (auto&& x : mp) {
      x.second = j++;
    }
    for (int i = 0; i < n; i++) {
      p[i].first = mp[p[i].first];
    }
  }

  {//compress y
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      mp[p[i].second] = 0;
    }
    int j = 0;
    for (auto&& x : mp) {
      x.second = j++;
    }
    for (int i = 0; i < n; i++) {
      p[i].second = mp[p[i].second];
    }
  }

  sort(p.begin(), p.end());

  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  vector<int> d(n);

  for (int _ = 0; _<2; _++) {
    {//calc a, b
      BIT<int> bit(n);
      for (int i=0;i<n;i++){
        a[i] = bit.sum(p[i].second);
        b[i] = i - a[i];
        bit.add(p[i].second);
      }
    }
    reverse(p.begin(), p.end());
    swap(a, c);
    swap(b, d);
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    reverse(c.begin(), c.end());
    reverse(d.begin(), d.end());
  }
  mint ans = 0;
  for (int i = 0; i < n; i++) {
    ans += f(a[i], b[i], c[i], d[i]);
  }
  cout << ans.x << endl;
  return 0;
}

Measured memory_bytes: 11136
n = int(input())
arr = list(map(int, input().split(' ')))
arr = list(map(lambda x: x * 2, arr))
dummy = arr[0]
for i in range(1, n):
    dummy = arr[i] - dummy

ans = []
# starting answer
ans.append(dummy // 2)
for i in range(n-1):
    ans.append(arr[i] - ans[i])
print(*ans)

Measured memory_bytes: 74588
N, M = map(int, input().split())

inf = float('inf')

import heapq
def dijkstra(adj, n, st=1):
    dj = [inf] * (n + 1)
    dj[st] = 0
    q = []
    heapq.heappush(q, (0, st))
    while q:
        fc, fn = heapq.heappop(q)
        if dj[fn] < fc: continue
        for tn, lc in adj[fn]:
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                heapq.heappush(q, (dj[tn], tn))
    return dj

ans = 0
ab = [[int(x) for x in input().split()] for _ in range(M)]
for i in range(len(ab)):
    adj = dict((x, []) for x in range(N + 1))
    for j, (a, b) in enumerate(ab):
        if i == j: continue
        adj[a].append((b, 1))
        adj[b].append((a, 1))
    costs = dijkstra(adj, N)
    ans += any(x == inf for x in costs[1:])
print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

#include "bits/stdc++.h"
using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
#define endl '\n'

using ll = long long;
using db = long double;
using ii = pair<int, int>;

const int N = 1e5 + 5, LG = 19, MOD = 998244353;
const int SQ =320;
const long double EPS = 1e-7;
int n;
string s;
int32_t main(){
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif

  cin >> s;
  n = s.size();

  if(s.back()=='1'||s[0]=='0'){
    cout<<-1<<'\n';
    return 0;
  }
  s.pop_back();
  s="#"+s;
  for(int i = 1; i <= n - 1; i++){
    if(s[i]!=s[n-i]){
      cout<<-1<<'\n';
      return 0;
    }
  }

  vector<ii> edges;

  edges.pb({1,2});
  int prv = 2;

  for(int i = 2; i <= n - 1; i++){
    edges.push_back({prv,i+1});
    if(s[i] == '1')prv = i + 1;
  }

  for(auto x:edges)
    cout<<x.F<<' '<<x.S<<'\n';


  return 0;
}


Measured memory_bytes: 2416
fn main() {
    let mut h = 1;
    let mut w = 1;
    h = read();
    w = read();
    while h != 0 || w != 0 {
        for i in 0..h {
            let mut st = String::new();
            for j in 0..w {
                if (i != 0 && j != 0) && (i != h - 1 && j != w - 1) {
                    st.push('.')
                } else {
                    st.push('#');
                }
            }
            println!("{}", st);
        }
        println!("");
        h = read();
        w = read();
    }
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: isize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========



Measured memory_bytes: 5020
N=int(input())
say=[]
for _ in range(N):
  A=int(input())
  t=[]
  for __ in range(A):
    s = list(map(int,input().split()))
    t.append(s)
  say.append(t)

ans=0
for i in range(2**N):
  flag=True
  for j in range(N):
    if not flag:
      break
    if ((i>>j) & 1):
      for s in say[j]:
        if ((i>>s[0]-1)&1) !=s[1]:
          flag=False
  if flag:
    mount = bin(i).count("1")
    ans=max(ans,mount)
print(ans)

Measured memory_bytes: 3064
mod=1000000007
n,m=map(int,input().split())
S=tuple(map(int,input().split()))
T=tuple(map(int,input().split()))
DP=[[0]*(m+1) for _ in range(n+1)]
for i in range(n+1):
    DP[i][0]=1
for i in range(m+1):
    DP[0][i]=1
for i,s in enumerate(S):
    for j,t in enumerate(T):
        if s==t:
            DP[i+1][j+1]=DP[i][j+1]+DP[i+1][j]
        else:
            DP[i+1][j+1]=DP[i][j+1]+DP[i+1][j]-DP[i][j]
        DP[i+1][j+1]%=mod
print((DP[-1][-1])%mod)

Measured memory_bytes: 73308
S = [i for i in input()]
while True:
    S.pop(-1)
    if len(S)%2==0:
        s = ''.join(S)
        s1 = s[:(len(S)//2)]
        s2 = s[len(S)//2:]
        if s1 == s2:
            print(len(S))
            exit(0)
    elif len(S)==0:
        print(0)
        exit(0)


Measured memory_bytes: 3060
//

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

/* エラトステネスの篩 */
const int MAX = 55560;
bool prime[MAX+1]; // MAX以下の判定表を作るので，余計に確保
void make_prime() {
      for(int i = 0; i  <= MAX; i++ )
            prime[i] = true; //最初は素数としておく
      prime[1] = false; // 1は素数でない
      for(int p = 2; p <= MAX; p++ ) // 表だけ作るなら p*p <= MAXでもOK
            if(prime[p])  // pが素数なら
                 for(int n = p+p; n <= MAX; n += p)  // pの倍数は素数でない
                       prime[n] = false;
}

int main(){
  make_prime();
  int n;
  int cnt = 0;
  int idx = 1;

  cin >> n;
  while(true){
  	if(prime[idx] && idx % 5 == 1){
  	  cout << idx;
  	  cnt++;
  	  if(cnt >= n){
  	  	cout << endl;
  	  	break;
  	  }
  	  else cout << " ";
  	}
  	idx++;
  }

  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define endl '\n';
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const ll POSITIVE_INFINITY = 9223372036854775807;
const ll NEGATIVE_INFINITY = -9223372036854775807;
const ll MOD = 1000000007;
const ld PI = acos(-1.0);

template <typename T> inline T bigMod(T A,T B,T M = MOD){A %= M;T ret = 1;while(B){if(B & 1) ret = (ret * A) % M;A = (A * A) % M;B = B >> 1;}return ret;}
template <typename T> inline T invMod (T A,T M = MOD){return bigMod(A,M-2,M);}

const int N = 200005;

int main(){
  FASTER;
  int n;
  cin >> n;
  int mx = -1;
  int ans = 0;
  for (int i = 0; i < n; i++){
    int x;
    cin >> x;
    if (x >= mx){
      ans++;
      mx = x;
    }
  }
  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
int maxN = 100000;
int cnt[100000];
int main()
{
       ios_base::sync_with_stdio(0);
       cin.tie(0);

       int t=1;
       //cin>>t;
       while(t--)
       {
               int l,r,n;
               cin>>l>>r>>n;
               int c=0;
               for(int i=l;i<=r;++i)
               {
                    if(i%n==0)
                         c++;
               }
               cout<<c;
       }
}


Measured memory_bytes: 3612
#include <stdio.h>
int main(){
    int n, k;
    scanf("%d%d", &n, &k);
    long long ans = 0;
    if (k == 0){
        printf("%lld\n", 1ll*n*n);
        return 0;
    }
    for (int b = k+1; b <= n; ++b){
        int t = n/b, r = n%b;
        ans += t*(b-k)+(r>=k?r-k+1:0);
    }
    printf("%lld\n", ans);
}

Measured memory_bytes: 128
#include <stdio.h>
main(){

  int i,j;
  int a[100],n,change,kaisu = 0;

  scanf("%d",&n);

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

    for(j = n - 1 ; j >= i + 1 ; j--){

      if(a[j] < a[j - 1]){

	change = a[j];
	a[j] = a[j - 1];
	a[j - 1] = change;

	kaisu++;

      }
    }
  }
  
  for(i = 0 ; i < n ; i++){
    if(i) printf(" ");
    printf("%d",a[i]);
  }

  printf("\n%d\n",kaisu);
  
  return 0;

}

Measured memory_bytes: 604
//
//  main.cpp
//  ABC173D
#include <iostream>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using P=pair<int,int>;
using ll = long long;
int main(int argc, const char * argv[]) {
    int n;
    cin>>n;
    vector<ll>a(n);
    rep(i,n){
        cin>>a.at(i);
    }
    sort(a.rbegin(),a.rend()); // 降順にソート
    ll ans=a.at(0); // 2人目に到着した人の心地よさ
    int limit=1;
    for(int i=1;i<n;i++){ // ３人目以降の人の心地よさ
        rep(j,2){
        if(limit>n-2) break;
        ans+=a.at(i);
        limit++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4424
import sys
input = sys.stdin.readline
from collections import *

N, A, B = map(int, input().split())
X = list(map(int, input().split()))
l = []

for i in range(N-1):
    l.append(X[i+1]-X[i])

l.sort(reverse=True)
ans = 10**18
walk = sum(l)

for i in range(N):
    ans = min(ans, B*i+walk*A)
    
    if i<N-1:
        walk -= l[i]

print(ans)

Measured memory_bytes: 60396
#include <bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL)
#define int long long
#define ld long double
#define sb __builtin_popcount
#define vi vector<int>
#define vc vector<char>
#define ii pair<int, int>
#define pq priority_queue<ii, vector<ii>, greater<ii>>
#define vii vector<ii>
#define sz(a) int((a).size())
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <=n; i++)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rloop(i,a,b) for(int i=a;i>=b;i--)
#define in(a, b) (b.find(a) != string::npos)
#define minin(a) *min_element(all(a))
#define maxin(a) *max_element(all(a))
#define X first
#define Y second
#define fill(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define rall(v) reverse(v.begin(), v.end())
#define el "\n"
#define mx3(a, b, c) max(max(a, b), c)
#define mn3(a, b, c) min(min(a, b), c)
#define S(v) accumulate(all(v), (ll)0)
#define SP(n) cout.precision(n)
#define PI = atan(1.0) * 4.0;
#define MOD = 1e9 + 7;
void start() {
    fio;
    SP(10);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

int32_t main() {
    start();
    int n;
    cin >> n;
    for (int i = 1000; i; i += 1000) {
        if (i >= n) {
            cout << i - n << el;
            return 0;
        }
    }
    return 0;
}


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

using namespace std;
using ll = int64_t;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using mii = map<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using tpi = tuple<int, int, int>;

using vqi = vector<queue<int>>;
using vpi = vector<pii>;
using bs = bitset<60>;
using vbi = vector<bs>;

ll gcd(ll a, ll b) {
    if (a < b) {
        swap(a, b);
    }

    /* ユークリッドの互除法 */
    ll r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

constexpr int64_t __pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    if (p == 0) {
        return 1;
    }
    if (p % 2 == 0) {
        int64_t t = __pow_mod(n, p / 2, mod);
        return (t * t) % mod;
    }
    return (n * (__pow_mod(n, p - 1, mod) % mod)) % mod;
}

constexpr int64_t pow_mod(int64_t n, int64_t p, int64_t mod) noexcept {
    int64_t res = __pow_mod(n, p, mod);
    if (res == 0) {
        res = mod;
    }
    return res;
}

constexpr int64_t nCr_mod(int64_t n, int64_t r, int64_t mod) noexcept {
    int64_t count = 1;
    auto a = r;
    for (auto i = n; i > n - r; i--) {
        count *= i;
        if (count % mod != 0) {
            count %= mod;
        }
        int64_t inv = pow_mod(a, mod - 2, mod);
        count *= inv;
        if (count % mod != 0) {
            count %= mod;
        }
        a--;
    }
    return count;
}

void solve(long long A, long long B) {
    for (int i = 1; i <= 1000; i++) {
        double a = i * 0.08;
        double b = i * 0.1;
        if (static_cast<int>(a) == A && static_cast<int>(b) == B) {
            cout << i << endl;
            return;
        }
    }
    cout << -1 << endl;
}

int main() {
    long long A;
    std::cin >> A;
    long long B;
    std::cin >> B;
    solve(A, B);
    return 0;
}


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

#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define MOD 1000000007

#define trace1(x)                    cout <<#x<<": "<<x<< endl;
#define trace2(x, y)                 cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)              cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)           cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;

typedef long long ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    ll i,j,n,m,k;
    cin>>n>>k;
    string s;
    cin>>s;
    s[k-1]=s[k-1]+'a'-'A';
    cout<<s;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int N = 100000;
int main(){
    char S0[N];
    int n=0, i, S[N];
    scanf("%s", &S0);

    for (i=0; i<N; i++){
        if (S0[i] != '\0'){
            n++;
            S[i] = (S0[i] - '0');
        }else{
            break;
        }
    }

    int ans = 0, bf, ans1=0, ans2=1;

    bf = S[0];
    for (i=1; i<n; i++){
        if (bf == S[i]){
            ans1++;
            if (S[i] == 0){
                bf = 1;
            }else{
                bf = 0;
            }
            continue;
        }
        bf = S[i];
    }

    bf = (S[0] == 1 ? 0 : 1);
    for (i=1; i<n; i++){
        if (bf == S[i]){
            ans2++;
            if (S[i] == 0){
                bf = 1;
            }else{
                bf = 0;
            }
            continue;
        }
        bf = S[i];
    }

    if (ans2 < ans1) {
        ans = ans2;
    }else{
        ans = ans1;
    }
    printf("%d", ans);
 
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define P pair<int, int>
#define debug(x) cout << #x << ": " << x << ", "
#define debugln(x) cout << #x << ": " << x << '\n'

using namespace std;
using ll = long long;
const int mod = 1e9+7;

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

  int n; cin >> n;
  int ma, mb; cin >> ma >> mb;

  int dp[500][500];
  int dp2[500][500];

  rep(i, 500) {
    rep(j, 500) {
      dp[i][j] = -1;
      dp2[i][j] = -1;
    }
  }

  dp[0][0] = 0;

  rep(k, n) {
    int a, b, c;
    cin >> a >> b >> c;
    rep(i, 500) {
      rep(j, 500) {
        if (i-a >= 0 && j-b >= 0 && dp[i-a][j-b] >= 0) {
          if (dp[i][j] < 0) {
            dp2[i][j] = dp[i-a][j-b] + c;
          } else {
            dp2[i][j] = min(dp[i][j], dp[i-a][j-b] + c);
          }
          //debug(i); debug(j); debugln(dp2[i][j]);
        } else {
          dp2[i][j] = dp[i][j];
        }
      }
    }
    rep(i, 500) {
      rep(j, 500) {
        dp[i][j] = dp2[i][j];
      }
    }
  }

  int ans = INT_MAX;
  rep(i, 500) {
    rep(j, 500) {
      if (dp[i][j] > 0 && i*mb == j*ma) {
        ans = min(dp[i][j], ans);
      }
    }
  }

  if (ans == INT_MAX) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  long long N;
  cin>>N;
  
  cout<<N*(N-1)/2<<endl;
}

Measured memory_bytes: 3604
use std::io::*;
use std::str::FromStr;
use std::collections::HashSet;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n: i32 = read();
  let d: HashSet<i32> = (0..n).map(|_| read()).collect();
  println!("{}", d.len());
}


Measured memory_bytes: 4352
#include <stdio.h>
#define MAXN 101
#define NIL -1
#define INF 2001
#define WHITE 0
#define BLACK 1

int pass[MAXN][MAXN];

int MST(int num){
  int i,j,min=INF,mini,minj,TotalCost=0,end=1;
  int color[MAXN];

  for(i=0; i<num; i++)color[i]=WHITE;

  color[0]=BLACK;
  while(1){
    for(i=0; i<num; i++){
      if(color[i]==BLACK){
	for(j=0; j<num; j++){
	  if(pass[i][j]!=-1){
	    if(min>pass[i][j] && color[j]==WHITE){
	      min=pass[i][j];
	      minj = j;
	    }
	  }
	}
      }
    }
    TotalCost+=min;
    color[minj]=BLACK;
    min=INF;
    for(i=0; i<num; i++){
      if(color[i]!=BLACK)end=0;
    }
    if(end)return TotalCost;
    else end=1;
  }
 
}


int main(){
  int i,j,n;

  scanf("%d",&n);
  for(i=0; i<n; i++){
    for(j=0; j<n; j++){
      scanf("%d",&pass[i][j]);
    }
  }
  printf("%d\n",MST(n));
  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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; }

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VLL a(n);
    REP(i,0,n) cin >> a[i];
    set<LL> s;
    REP(i,0,n) {
        if (s.count(a[i]) != 0) {
            cout << "NO" << endl;
            return;
        }
        s.insert(a[i]);
    }
    cout << "YES" << endl;
}

signed main() {
    solve();
    
    return 0;
}

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

int dp[200010];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	string s;
	cin >> s;
	int N = s.size();
	int bit = 0;
	map<int, int> m;
	m[0] = 0;
	for(int i = 0; i < N; i++){
		//cout << i << endl;
		dp[i + 1] = dp[i] + 1;
		int id = s[i] - 'a';
		// 全部余ってない
		int t = bit;
		if(m.count(t)){
			dp[i + 1] = min(dp[i + 1], m[t] + 1);
		}
		// idが余ってて他余ってない
		t = bit ^ (1 << id);
		if(m.count(t)){
			dp[i + 1] = min(dp[i + 1], m[t] + 1);
		}
		// idが余ってて他1つ余ってる
		for(int j = 0; j < 26; j++){
			if(j == id) continue;
			t = bit ^ (1 << id) ^ (1 << j);
			if(m.count(t)){
				//cout << char('a' + j) << endl;
				dp[i + 1] = min(dp[i + 1], m[t] + 1);
			}
		}

		if(!m.count(bit)){
			m[bit] = dp[i];
		}
		else{
			m[bit] = min(m[bit], dp[i]);
		}
		bit ^= 1 << id;
	}

	cout << dp[N] << endl;
}


Measured memory_bytes: 10644
import std.stdio, std.conv, std.string;
import std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

int DEBUG_LEVEL = 0;
void print()(){ writeln(""); }
void print(T, A ...)(T t, lazy A a){ write(t), print(a); }
void print(int level, T, A ...)(T t, lazy A a){ if(level <= DEBUG_LEVEL) print(t, a); }

void main(string[] args){
	if(args.length > 1 && args[1] == "-debug"){
		if(args.length > 2 && args[2].isNumeric) DEBUG_LEVEL = args[2].to!int;
		else DEBUG_LEVEL = 1;
	}
	
	// ----------------------------------------
	
	int h = read.to!int;
	int w = read.to!int;
	
	bool[][] as = new bool[][](h, w);
	foreach(i; 0 .. h){
		string l = readln.chomp;
		foreach(j; 0 .. w) as[i][j] = (l[j] == '#');
	}
	
	int[][] bs = new int[][](h, w);
	foreach(i; 0 .. h) foreach(j; 0 .. w) if(as[i][j]) bs[i][j] = 0;
	
	int[2][] xs;
	foreach(i; 0 .. h) foreach(j; 0 .. w) if(as[i][j]) xs ~= [i, j];
	
	for(int iq = 0; iq < xs.length; iq ++){
		int i = xs[iq][0], j = xs[iq][1];
		if(i - 1 >= 0 && ! as[i - 1][j]) as[i - 1][j] = 1, bs[i - 1][j] = bs[i][j] + 1, xs ~= [i - 1, j];
		if(i + 1 <  h && ! as[i + 1][j]) as[i + 1][j] = 1, bs[i + 1][j] = bs[i][j] + 1, xs ~= [i + 1, j];
		if(j - 1 >= 0 && ! as[i][j - 1]) as[i][j - 1] = 1, bs[i][j - 1] = bs[i][j] + 1, xs ~= [i, j - 1];
		if(j + 1 <  w && ! as[i][j + 1]) as[i][j + 1] = 1, bs[i][j + 1] = bs[i][j] + 1, xs ~= [i, j + 1];
	}
	print!1("as:", as);
	print!1("bs:", bs);
	
	
	int ans = 0;
	foreach(i; 0 .. h) foreach(j; 0 .. w) ans = max(ans, bs[i][j]);
	
	ans.writeln;
}


Measured memory_bytes: 17532
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)n; ++i)

char s[20];

int main(){
	scanf("%s", s);
	s[5] = s[13] = ' ';
	printf("%s\n", s);
}


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

#define SORT(c) sort((c).begin(), (c).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define ANS(ans) cout << (ans) << endl;
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
typedef vector<int> VI;
typedef pair<int, int> P;

//repetition
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define REP(i, n) for (long long i = 0; i < (n); ++i)

struct Mystruct{
    long long atack;
    long long mp;
    double cost;

    Mystruct(long long input_a, long long input_b){
        atack = input_a;
        mp = input_b;
        cost = input_a*1.0 / input_b;
    }
    bool operator<(const Mystruct &another) const
    {
        if(cost == another.cost){
            return mp < another.mp;
        }
        return cost < another.cost;//年齢を比較
    };
};

int main()
{
    int a,b,c;
    cin>>a>>b>>c;

    if(a==b && a!=c){
        ANS("Yes")
    }
    else if(a == c && a!=b){
        ANS("Yes")
    }
    else if(b==c && b!=a){
        ANS("Yes")
    }
    else{
        ANS("No")
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;
long int n;
long long bCount[100001];
long int a[100001];
long int b[100001];
long int c[100001];

void quickSort(long int arr[], long int left, long int right) {
    long int i = left, j = right;
    long int tmp;
    long int pivot = arr[(left + right) / 2];
    
    /* partition */
    while (i <= j) {
        while (arr[i] < pivot)
            i++;
        while (arr[j] > pivot)
            j--;
        if (i <= j) {
            tmp = arr[i];
            arr[i] = arr[j];
            arr[j] = tmp;
            i++;
            j--;
        }
    };
    
    /* recursion */
    if (left < j)
        quickSort(arr, left, j);
    if (i < right)
        quickSort(arr, i, right);
}

void read(long int arr[]) {
    for (long int i=0; i<n; i++) {
        cin >> arr[i];
    }
}

long int positionOfValue(long int arr[], long int pointValue) { // position from whihc, all value in arr bigger than point Value
    
    if (arr[n-1]<=pointValue) {
        return n;
    }
    
    long int first =0;
    long int last = n - 1;
    
    while (first < last) {
        long int mid = (long int) (first+last)/2;
        if (arr[mid]<=pointValue) {
            first = mid + 1;
        } else {
            last = mid;
        }
    }
    
    return last;
}

void calculateBCount() {
    bCount[n] = 0;
    
    for (long int i=n-1; i>=0; i--) {
        
        long int pos = positionOfValue(c, b[i]);
        
        bCount[i] = bCount[i+1] + (n - pos);
    }
    
}

long long calculateresult() {
    long long sum = 0 ;
    
    for (long int i=n-1; i>=0; i--) {
        
        long int pos = positionOfValue(b, a[i]);
        
        sum = sum + bCount[pos];
        
    }
    
    return sum;
}

int main(int argc, const char * argv[]) {
    
    cin >> n;
    read(a); sort(a, a + n);
    read(b); sort (b, b+n);
    read(c); sort (c, c + n);
    
    calculateBCount();
    
    cout << calculateresult();
    
    return 0;
}


Measured memory_bytes: 3328
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define INF 1e9+7
#define roop(i,m,n) for(int i=m;i<n;i++)
#define mroop(i,m,n) for(int i=m;i<n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;

//おまじない



int main() {

	int a[100] = { 0 };
	roop(i,0, 3) {
		int c;
		cin >> c;
		a[c-1] = 1;
	}

	int ans = 0;

	roop(k, 0, 100) {
		if (a[k] != 0) { ans++; }
	}

	cout << ans << endl;

	return 0;
}


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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t, a[200005];
    cin >> t;
    for(int i=0; i<t; i++) {
        cin >> a[i];
    }
    sort(a, a+t);
    for(int i=0; i<t; i++) {
        if(a[i] == a[i+1]) {
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
using namespace std;

int main(){
    string s;
    int minimum=1000000;
    cin>>s;
    rrep(i,s.size()-2){
        int num=(s[i-1]-'0')*100+(s[i]-'0')*10+(s[i+1]-'0');
        if(abs(753-num)<abs(753-minimum)) minimum=num;
    }
    cout<<abs(753-minimum)<<endl;
    return 0;
}

Measured memory_bytes: 256
import numpy as np
import math
N, K = map(int, raw_input().split())

ans = 0
for i in range(1, N+1):

    mi = np.log2(1.0*K/i)

    mi = max(mi,0)
    mi = math.ceil(mi)
    ans += (1.0/2)**mi

ans = ans/N
print ans


Measured memory_bytes: 16356
ar = [*"A".."Z"] + [*"A".."Z"]

n = gets.chomp.to_i
s = gets.chomp.split("")
a = []
s.each do |i|
    ii = 0
    while true
        if i == ar[ii] 
            a << ar[ii+n]
            break
        end
        ii += 1
    end
end
puts a.join()

Measured memory_bytes: 14592