akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi = acos(-1);
double r;

inline ll read(){
    ll s = 0, w = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){ if(ch == '-') w = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
    return s * w;
}

inline void print(ll x){
    if(x < 0) x = ~x + 1, putchar('-');
    if(x > 9) print(x / 10);
    putchar(x % 10 + '0');
}

int main(){
    scanf("%lf", &r);
    cout << 2.0 * pi * r;

    return 0;
}

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

int main() {
    set<long long>s;
    int len;
    cin >> len;
    while(len--){
        long long ai;
        cin >> ai;
        if(ai % 2 == 0 && (ai % 3 != 0 && ai % 5 != 0)){
            cout << "DENIED" << endl;
            return 0;
        }
    }
    cout << "APPROVED" << endl;
}

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

using namespace std;
/*
class uft{
  vector<int>p,rank;
public:
  map<int,int>mp;
  uft(){}
  uft(int size){
	p.resize(size,0);
	rank.resize(size,0);
	for(int i=0;i<size;++i)
	  make_uft(i);
  }
  void make_uft(int x){
	p[x]=x;rank[x]=0;
	mp[x]=1;
  }
  bool same(int x, int y){return find_par(x)==find_par(y);}
  void unite(int x,int y){link(find_par(x),find_par(y));}
  void link(int x,int y){
	if(rank[x]>rank[y]){
	  p[y]=x;
	  int t=mp[y];
	  mp.erase(y);
	  mp[x]+=t;
	}
	else{
	  p[x]=y;
	  int t=mp[x];
	  mp.erase(x);
	  mp[y]+=t;
	  if(rank[x]==rank[y])
		++rank[y];
	}
  }
  int find_par(int x){
	if(x!=p[x])
	  p[x]=find_par(p[x]);
	return p[x];
  }
};

int main(){
  pair<int,int>bridge[100010];
  int n,m;cin>>n>>m;
  for(int i=m-1;i>=0;--i){
	cin>>bridge[i].first>>bridge[i].second;
	bridge[i].first--;bridge[i].second--;
  }

  long long count[100010]={n*(n-1)/2};
  uft ut(n);
  for(int i=1;i<m;++i){
	int a=bridge[i-1].first,b=bridge[i-1].second;
	if(ut.same(a,b)){count[i]=count[i-1];continue;}
	count[i]=count[i-1]-ut.mp[ut.find_par(a)]*ut.mp[ut.find_par(b)];
	ut.unite(a,b);
  }
  for(int i=m-1;i>=0;--i)
	cout<<count[i]<<endl;
  return 0;
}
*/
class UFT{
public:
  vector<int> p;
  UFT(){}
  UFT(int N){
	p.resize(N,-1);
  }
  int par(int a){
	if(p[a]>=0){p[a]=par(p[a]);return p[a];}
	return a;
  }
  int size(int a){
	return -p[par(a)];
  }
  void unite(int a,int b){
	a=par(a);b=par(b);
	if(a==b)return;
	if(size(a)<size(b))swap(a,b);
	p[a]-=size(b);
	p[b]=a;
  }
};
int main(){
  long long n,m;cin>>n>>m;
  int a[100001];
  int b[100001];
  for(int i=0;i<m;++i){
	cin>>a[i]>>b[i];
	a[i]--;b[i]--;
  }
  long long count[100001]={};
  count[m-1]=(long long)(n*(n-1)/2);
  UFT uft(n);
  for(int i=m-1;i>0;--i){
	if(uft.par(a[i])==uft.par(b[i]))count[i-1]=count[i];
	else{
	  count[i-1]=count[i]-(uft.size(a[i])*uft.size(b[i]));
	  uft.unite(a[i],b[i]);
	}
  }
  for(int i=0;i<m;++i)
	cout<<count[i]<<endl;
  return 0;
}


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

const int MX = 1000005;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  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;
  }
};
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x;return o;}

struct Sieve {
    int n;
    vector<int> f, primes;
    Sieve(int n=1):n(n), f(n+1) {
        f[0] = f[1] = -1;
        for (ll i = 2; i <= n; i++) {
            if (f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for (ll j = i*i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }
    bool isPrime(int x) { return f[x] == x;}
    vector<int> factorList(int x) {
        vector<int> res;
        while (x != 1) {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<P> factor(int x) {
        vector<int> fl = factorList(x);
        if (fl.size() == 0) return {};
        vector<P> res(1, P(fl[0], 0));
        for (int p : fl) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
};

int main() {
    Sieve sieve(1e6);
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    map<int,int> mp;
    rep(i,n) {
        auto f = sieve.factor(a[i]);
        for (auto p : f) {
            mp[p.first] = max(mp[p.first], p.second);
        }
    }

    mint lcm = 1;
    for (auto p : mp) {
        rep(i,p.second) {
            lcm *= p.first;
        }
    }

    mint ans;
    rep(i,n) {
        mint b = lcm/a[i];
        ans += b;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 7872
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in xrange(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            else:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        else:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,raw_input().strip().split())
ices = []
while True:
    ice = int(raw_input().strip())
    ices.append(ice)
    if len(ices) == N:
        break

orderN(N,L,ices)

Measured memory_bytes: 12644
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  ll X; cin >> X;
  ll money = 100;
  int i = 0;
  while(money < X){
    money += money/100;
    i++;
  }
  cout << i << endl;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()
{
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k)
        cout << s << endl;
    else
    {
        for(int i = 0; i < k; i++)
            cout << s[i];
        
        cout << "..." << endl;
    }
        
    
    return 0;
}


Measured memory_bytes: 3628
from collections import deque

N = int(input())

x_list = [0] * N
y_list = [0] * N

for i in range(N):
    x, y = map(int, input().split())
    x_list[i] = x + 1000000
    y_list[i] = y

# graph
G = dict()
for i in range(N):
    x = x_list[i]
    y = y_list[i]
    G[x] = dict()
    G[y] = dict()

for i in range(N):
    x = x_list[i]
    y = y_list[i]
    G[x][y] = 1
    G[y][x] = 1

x_su = list(set(x_list))
Lx = len(x_su)
x_su_ind = dict()
for i in range(Lx):
    x_su_ind[x_su[i]] = i

y_su = list(set(y_list))
Ly = len(y_su)
y_su_ind = dict()
for i in range(Ly):
    y_su_ind[y_su[i]] = i

done_x = [0]*Lx
done_y = [0]*Ly

res = 0

id_0 = 0
while True:
    while done_x[id_0] == 1:
        id_0 += 1
        if id_0 == Lx:
            break
    if id_0 == Lx:
        break
    # BFS
    cx = 1
    cy = 0
    queue = deque([x_su[id_0]])
    done_x[id_0] = 1
    while len(queue) > 0:
        p = queue.popleft()
        for q in G[p].keys():
            if q < 1000000:
                if done_y[y_su_ind[q]] == 0:
                    queue.append(q)
                    done_y[y_su_ind[q]] = 1
                    cy += 1
            else:
                if done_x[x_su_ind[q]] == 0:
                    queue.append(q)
                    done_x[x_su_ind[q]] = 1
                    cx += 1
    res += cx * cy

print(res - N)


Measured memory_bytes: 97108
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000
#define NMAX 102

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	std::fill( (T*)array, (T*)(array+N), val );
}

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

int A[NMAX],B,C,N,W,H,ans = 0,sum = 0,dp[HMAX][WMAX];
string S;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){
	if(sum % 10 == 0){
		ans = 0;
	}else{
		ans = sum;
	}
	for (int i = 0; i < N; ++i)
	{
		if(A[i] % 10 == 0){
			continue;
		}
		if(sum%10 == 0){
			ans = max(ans ,sum-A[i]);
		}
	}
}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> N;
	for (int i = 0; i < N; ++i)
	{
		cin >> A[i];
		sum += A[i];
	}
	solve();
	#ifdef DEBUG
	debug();
	#endif
	answer();

	return 0;
}

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

int main(){
  int64_t A, B, C, K;
  cin >> A >> B >> C >> K;
  if(K<=A){
    cout << K << endl;
  }
  else if(K<=A+B){
    cout << A << endl;
  }
  else{
    cout << A-(K-(A+B)) << endl;
  }
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
#define ll long long
#define f   first
#define s   second
#define pb          push_back
#define mod         1000000007
#define hell        998244353
#define inf         1000000000000000000LL
using namespace std;
ll n,k,m;
//ll dp[15][1005];
ll fen[20005];
void update(ll x,ll val)
{
    for(int i=x;i<=n;i+=(i&-i))
        fen[i]+=val;
}
ll query(ll x)
{
    ll sum=0;
    for(;x>0;x-=(x&-x))
        sum+=fen[x];
    return sum;

}
ll bs(ll sum)
{   //hcout<<query(2);
    //cout<<sum;
    ll l=0,h=n;  
    while(h>l+1)
    {   ll mid=(l+h)/2;
        //cout<<l<<mid<<h<<query(mid)<<" ";
        ll x=query(mid);
        if(x>=sum) h=mid;
        else l=mid;
        

    }
    //cout<<l<<h<<" ";
    if(query(l)==sum) return l;
    else return h;
}
void solve()
{   
    cin>>n;
    vector<ll> v(n);
    for(int i=0;i<n;i++)
        cin>>v[i];
    ll dp[n][n];
    memset(dp,0,sizeof(dp));
    for(int i=n-1;i>=0;i--)
    {
        for(int j=i;j<n;j++)
        {
            if(i==j) dp[i][j]=v[i];
            else dp[i][j]=max(v[i]-dp[i+1][j],v[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1];

    
}

int main()
{
    ll t=1;
    //cin>>t;
    while(t--)
        solve();

}

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

int main(){
  int a,b;
  scanf("%d %d",&a,&b);
  if(a<b){
    for(int i=0;i<b;i++){
      printf("%d",a);}}
  else{
    for(int i=0;i<a;i++){
      printf("%d",b);}}
  printf("\n");

  return 0;
}


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

int32_t main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    int n ;
    cin >> n;

    map < int , int > mp , mm;

    for(int i = 1 ; i <= n ; i++){
        int x ; cin >> x;
        mp[i + x]++;
        mm[i - x]++;
    }

    int ans = 0;
    for(auto x : mp){
        if(mm.find(x.first) != mm.end()){
            ans += mm[x.first] * x.second;
        } 
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 26760
#include <stdio.h>
#include <stdlib.h>
#define K 10000

int main(){
  int n,*A,*b,c[K],i;
  scanf("%d",&n);
  A=(int *)malloc(n*sizeof(int));
  b=(int *)malloc(n*sizeof(int));
  
  for(i=0;i<=K;i++)
    c[i]=0;
  
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
    c[A[i]]++;
  }

  for(i=1;i<=K;i++)
    c[i]+=c[i-1];

  for(i=n-1;i>=0;i--)
    b[--c[A[i]]]=A[i];

  for(i=0;i<n-1;i++)
    printf("%d ",b[i]);
  printf("%d\n",b[n-1]);
  
  return 0;
}



Measured memory_bytes: 17456
#include <bits/stdc++.h>
using namespace std;
#define LOOP(val, times)   for(val = 0; val < (times); val++)
int main(){
  int n;
  cin>>n;
  vector<int> qq(0);
  for(int i=1;i<=9;i++){
      for(int j=1;j<=9;j++){
        qq.push_back(i*j);
     }
  }
  int i;
  int h=0;
  LOOP(i,81){

    
    if(n==qq[i]){
      h=1;
      break;
    }
  }
  if(h){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}
    


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<bitset>

#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
VI val;

void MAIN() {
    scanf("%d", &N);
    for (int i=1; i<=30000; i++) {
	if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
	    val.push_back(i);
	}
    }

    LL sum = 0;
    VI ans(val.begin(), val.begin() + N);
    ans.pop_back();
    ans.pop_back();

    REP (i, N-2) sum += val[i];
    int cur = N-2;
    while (1) {
	LL tmp = sum + val[cur];
	tmp %= 30;
	tmp = (30 - tmp) % 30;
	if (tmp % 2 == 0 || tmp % 3 == 0 || tmp % 5 == 0) {
	    ans.push_back(val[cur]);
	    sum += val[cur];
	    cur++;
	    break;
	}
	cur++;
    }

    while (1) {
	LL tmp = sum + val[cur];
	tmp %= 30;
	if (tmp == 0) {
	    ans.push_back(val[cur]);
	    break;
	}
	cur++;
    }

    rprintf("%d", ans.begin(), ans.end());
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

int main(){
  int n;
  cin >> n;
  map<int, int> mp;
  rep(i, n){
    int num;
    cin >> num;
    mp[num]++;
  }
  int ans = 0;
  for(auto p : mp){
    int num = p.first;
    int cnt = p.second;
    if(num > cnt) ans += cnt;
    else ans += cnt-num;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 7956
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int n, a, b, c, d;
    string s;

    cin >> n >> a >> b >> c >> d;
    a--; b--; c--; d--;
    cin >> s;

    if (s[c] == '#' || s[d] == '#') {
        cout << "No" << endl;
    } else {
        bool possible = true;
        // [b, d) に2つ以上連続する岩がない                                                         
        for (int i = b; i < d - 1; i++)
            if (s[i] == '#' && s[i+1] == '#')
                possible = false;
        // [a, c) に2つ以上連続する岩がない                                                         
        for (int i = a; i < c - 1; i++)
            if (s[i] == '#' && s[i+1] == '#')
                possible = false;

        if (c > d) {
            // とびこしあり                                                                         
            bool found = false;
            // [b-1, d+1] に３つ以上連続する空きマスがなければならない                              
            for (int i = b-1; i < d; i++) {
                if (s[i] == '.' && s[i+1] == '.' && s[i+2] == '.') {
                    found = true;
                    break;
                }
            }
            if (!found)
                possible = false;
        }

        cout << (possible ? "Yes" : "No") << endl;
    }

    return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound

int N, M;
int P[100100];

struct UF {
    static const int N = 100100;//書き換え!
    int par[N];

    UF() {
        rep(i, N) {
            par[i] = i;
        }
    }

    void init() {
        rep(i, N) {
            par[i] = i;
        }
    }

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

    bool same(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        par[root(x)] = y;
    }
};

struct Graph {
    int V, E;
    static const int MAX_V = 100100;
    vector<int> G[MAX_V];
    UF uf;

    Graph(int V, int E) : V(V), E(E) {
        rep(i, MAX_V) {
            marks[i] = -1;
        }
    }

    //a->b有向
    void addEdge(int a, int b) {
        G[a].push_back(b);
    }

    int marks[MAX_V];

    void marking(int v, int mark) {
        if (marks[v] != -1)return;
        marks[v] = mark;
        uf.unite(v, mark);
        rep(i, G[v].size()) {
            marking(G[v][i], mark);
        }
    }

    bool isMarked(int v) {
        return marks[v] != -1;
    }
};

signed main() {
    cin >> N >> M;
    rep(i, N) {
        cin >> P[i];
        --P[i];
    }
    Graph graph(N, M);
    rep(i, M) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        graph.addEdge(x, y);
        graph.addEdge(y, x);
    }
    rep(i, N) {
        if (!graph.isMarked(i))graph.marking(i, i);
    }
    int ans = 0;
    rep(i, N) {
        if (graph.uf.same(i, P[i]))++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 10880
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ENDL '\n'
#define print(i) std::cout << (i) << '\n'

#define int long long // at least int64 > 9*10^18
#define all(v) (v).begin(), (v).end()
/* libraries */

signed main() {
	int a,b;
	std::cin >> a >> b;
	if(a>0 && a<10) if(b>0 && b<10) {
		print(a*b);
		return 0;
	}
	print(-1);
	return 0;
}


Measured memory_bytes: 256
#include <atcoder/twosat>
#include <iostream>
#include <vector>

using namespace std;
using namespace atcoder;

int main() {
    int n, d;
    cin >> n >> d;
    vector<int> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }

    // ts[i] = (i-th flag is located on x[i])
    two_sat ts(n);

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (abs(x[i] - x[j]) < d) {
                // cannot use both of x[i] and x[j]
                ts.add_clause(i, false, j, false);
            }
            if (abs(x[i] - y[j]) < d) {
                ts.add_clause(i, false, j, true);
            }
            if (abs(y[i] - x[j]) < d) {
                ts.add_clause(i, true, j, false);
            }
            if (abs(y[i] - y[j]) < d) {
                ts.add_clause(i, true, j, true);
            }
        }
    }

    if (!ts.satisfiable()) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;
    auto answer = ts.answer();
    for (int i = 0; i < n; i++) {
        if (answer[i])
            cout << x[i] << endl;
        else
            cout << y[i] << endl;
    }

    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <string.h>

int main()
{
    int a[30];

    memset(a,0,sizeof(a));

    char s[30];

    scanf("%s",s);

    for (int i = 0;i < strlen(s);i++)
        a[s[i]-'a']++;

    bool f = 0;

    for (int i = 0;i < 30;i++)
        if (a[i] >= 2) f = 1;

    if (f) printf("no\n");
    else printf("yes\n");

    return 0;
}


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

a.sort()
flg=0
if(a[0]==a[1]):
    flg=1
for i in range(1,N-1):
    if(a[i]==a[i-1]):
        flg=1
if flg==1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 26808
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = 1000000;
		boolean[] map = new boolean[N + 1];
		for (int i = 1; i <= N; i *= 2) {
			for (int j = 1; i * j <= N; j *= 3) {
				for (int k = 1; i * j * k <= N; k *= 5) {
					int s = i*j*k;
					map[s] = true;
				}
			}
		}
		while (true) {
			int n = scanner.nextInt();
			if (n == 0)
				break;
			int m =scanner.nextInt();
			int c = 0;
			for(int i=n;i<=m;i++){
				if(map[i])
					c++;
				
			}
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 21556
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

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

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int N,M;
VI Vec;

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int a, b, c; cin >> a >> b >> c;

    cout << min(a+b, min(b+c, c+a)) << endl;
  
    return 0;
}



Measured memory_bytes: 256
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A, B = list(map(int, sys.stdin.buffer.readline().split()))
    print(A//B if A%B == 0 else A//B+1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;

int main() {
  int N; cin >> N;
  vi p(N); rep(i,N) cin >> p.at(i);
  
  sort(all(p));
  
  int ans = 0;
  rep(i,N-1) {
    ans += p.at(i);
  }
  ans += p.at(N-1)/2;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
L,R=map(int,input().split())
ans=2018
if R-L>=2019**2:
    R=L+2019**2
for i in range(L,R):
    for j in range(i+1,R+1):
        ans=min(ans,(i*j)%2019)
        if ans==0:
            break
print(ans)

Measured memory_bytes: 40684
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        mut s: chars
    }
    let d = 1000000007;
    s.reverse();
    let rem = vec![1, 10, 9, 12, 3, 4];
    let n = s.len();
    let mut qs = vec![0; 6];
    let mut r: usize = 0;
    for i in 0..n {
        if s[i] == '?' {
            qs[i % 6] += 1;
        } else {
            r = (r + s[i].to_digit(10).unwrap() as usize * rem[i % 6]) % 13;
        }
    }
    let mut tab: Vec<usize> = vec![0; 13];
    tab[r] = 1;
    for i in 0..6 {
        for j in 0..qs[i] {
            let mut next: Vec<usize> = vec![0; 13];
            for k in 0..10 {
                for l in 0..13 {
                    next[(l + k * rem[i]) % 13] = (next[(l + k * rem[i]) % 13] + tab[l]) % d;
                }
            }
            tab = next;
        }
    }
    println!("{}", tab[5]);
}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);
	int h,w;
	string s[100];
	cin>>h>>w;
	for(int i=0;i<h;i++){
		cin>>s[i];
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			if(s[i][j]=='#'){
				if(i==0 && j==0) 
					if(s[i+1][j]=='.' && s[i][j+1]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
				if(i==0)
					if(s[i][j+1]=='.' && s[i][j-1]=='.' && s[i+1][j]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
				if(j==0)
					if(s[i+1][j]=='.' && s[i-1][j]=='.' && s[i][j+1]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
				if(i==h-1 && j==w-1)
					if(s[i-1][j]=='.' && s[i][j-1]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
				if(i==h-1)
					if(s[i-1][j]=='.' && s[i][j+1]=='.' && s[i][j-1]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
				if(j==w-1)
					if(s[i+1][j]=='.' && s[i-1][j]=='.' && s[i][j-1]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
				if(i!=0 && i!=h-1 && j!=0 && j!=w-1)
					if(s[i+1][j]=='.' && s[i-1][j]=='.' && s[i][j+1]=='.' && s[i][j-1]=='.'){
						cout<<"No"<<endl;
						return(0);
					}
			}
		}
	}
	cout<<"Yes"<<endl;
    return(0);
}

Measured memory_bytes: 3664
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<map>
#include<vector>
#include<set>
#include<cctype>
#include<string>
#include<queue>
#define rep(a,b) for(register int i=a;i<=b;i++)
#define red(a,b) for(register int i=a;i>=b;i--)
#define  ULL unsigned long long
#define  LL long long
using namespace std;

struct node
{
	int val;
	int num;
}A[100050],B[100050]; 
map<int ,int >M;
map<int ,int >K;
int cmp(node a,node b)
{
	return a.num>b.num;
}
int main()
{
	int n;
	int cnt1=0,cnt2=0;
	int pre;int index;
	cin>>n;
	rep(1,n/2)
	{
		scanf("%d",&pre);
		if(!M[pre])
		{
			M[pre]=++cnt1;
			A[cnt1].val=pre;
			A[cnt1].num=1;
		}
		else
		{
			index=M[pre];
			A[index].num++;
		}
		scanf("%d",&pre);
		if(!K[pre])
		{
			K[pre]=++cnt2;
			B[cnt2].val=pre;
			B[cnt2].num=1;
		}
		else
		{
			index=K[pre];
			B[index].num++;
		}
	}
	sort(A+1,A+1+cnt1,cmp);
	sort(B+1,B+1+cnt2,cmp);
	int ans1=A[1].num,ans2=B[1].num;
//	cout<<ans1<<" "<<ans2<<endl;
	int ans;
	if(A[1].val!=B[1].val)
	{
		ans1=n/2-ans1;
		ans2=n/2-ans2;
		ans=ans1+ans2;
	}
	else
	{
		
        if(cnt1==1&&cnt2==1)
        {
        	cout<<n/2<<endl;
        	return 0;
        }
        else if(cnt1==1)
        {
        	ans2=B[2].num;
        }
        else if(cnt2==1)
		{
			ans1=A[2].num;
		}
		else
		{
			ans=min(n-A[1].num-B[2].num,n-A[2].num-B[1].num);
			cout<<ans<<endl;
			return 0;
		} 
		ans=-ans1-ans2+n;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
//#include <boost/array.hpp>
//#include <boost/range/numeric.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
//using namespace boost::multiprecision;

constexpr long long INF = LLONG_MAX;
constexpr long long MOD = 1000000007;
constexpr long double PI = M_PI;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << fixed << setprecision(12)
#define dbglf cerr << '\n'

#define ACCM(arr) accumulate(ALL(arr),0LL)
#define Yes(ex) cout << ((ex) ? "Yes" : "No") << endl
#define YES(ex) cout << ((ex) ? "YES" : "NO") << endl

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void veccin(vector<T>& v) {
    for (auto && e : v) { cin >> e; }
}

template < typename T >
inline void dbg(T a) { cerr << a << ' '; }

ll n, m, k;
ll ans = 0, sum = 0, cnt = 0;
//ld d;
string s/*1, s2, s3*/;
char c/*1, c2, c3*/;
bool flag = false;

/*--------------------template--------------------*/

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

    cin >> n >> m;
	vi p(m); veccin(p);
	sort(ALL(p));
	if(m==0) {
    	cout << n;
    	return 0;
    }
	REP(i,100) {
    	if (find(ALL(p),n-i)==p.end() && n-i > -2) {
        	ans = n-i;
        	break;
        } else if (find(ALL(p),n+i)==p.end() && n+i < 102) {
        	ans = n+i;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 3656
/*

Coded by peyha X

*/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int a,b,c,k;

int exp(int x,int n){
	if(n==0) return 1;
	return x*exp(x,n-1);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin >> a >> b >> c >> k;
	
	if(a>=b && a>=c){
		cout << exp(2,k)*a+b+c << '\n';
	}
	else if(b>=a && b>=c){
		cout << exp(2,k)*b+a+c << '\n';
	}
	else{
		cout << exp(2,k)*c+a+b << '\n';
	}
	
	
	
	
	
	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
 
int main() {
    int n;
    while (scanf("%d", &n), n) {
        map<string, int>mp;
        string s; int Max = 0;
        int d = 0;
        for (int i = 1; i <= n; i++) {
            string c; cin >> c;
            mp[c]++;
            if (mp[c] > Max) { s = c; Max = mp[c]; }
            int sec = 0;
            for (auto p : mp) {
                if (p.first != s&&sec < p.second)sec = p.second;
            }
            if (sec + n - i < Max && !d)d = i;
        }
        if (!d)puts("TIE");
        else cout << s << ' ' << d << endl;
    }
}

Measured memory_bytes: 3252
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#define RG register
#define LL long long
using namespace std;
const int N=9e5+10;
int n,cnt,num=1;
LL h,w,col[N],ans[12],zro;
template<typename I> inline void read(I &ot){
	I ch=getchar(), x=0, f=1;
	while(ch<'0' || ch>'9'){if(ch=='-') f=-1; ch=getchar();	}
	while(ch>='0' && ch<='9'){x=x*10+ch-'0'; ch=getchar();	}
	ot=x*f;}
template<typename I, typename... U> inline void read(I &x,U&... y){read(x); read(y...);}
int main()
{
//	freopen("Snuke's Coloring.in","r",stdin);
	//freopen(".out","w",stdout);
	read(h,w,n); zro=(h-2)*(w-2);
	for(int i=1,a,b;i<=n;i++)
	{
		read(a,b);
		for(int x=-2;x<=0;x++)
		 for(int y=-2;y<=0;y++)
		  if(a+x>0 && a+x<=h-2 && b+y>0 && b+y<=w-2)
		   col[++cnt]=(a+x-1)*(w-2)+(b+y);
	}
	sort(col+1,col+cnt+1);
	for(int i=1;i<=cnt;i++)
	 if(col[i]==col[i+1]) num++;
	 else ans[num]++, zro--, num=1;
	printf("%lld\n",zro);
	for(int i=1;i<10;i++) printf("%lld\n",ans[i]);
	//fclose(stdin); fclose(stdout);
	return 0;
}

Measured memory_bytes: 7296
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class AXXFESTIVAL {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    string s;
	    in >> s;
	    int len = s.length() - 8;
	    out << s.substr(0, len) << endl;
	}
};


int main() {
	AXXFESTIVAL solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
#include <cctype>
#include <cstdio>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll> ;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI  3.1415926535
#define rep(i, k, n) for(ll i = k; i < n; i++)

int main(){
  ll n; cin >> n;
  vll height(n);
  
  rep(i, 0, n){cin >> height[i];}
  
  ll ans = 0;
  rep(i, 1, n){
    if(height[i] < height[i-1]){
      ans += height[i-1] - height[i];
      height[i] = height[i-1];
    }
  }
  
  cout << ans << endl;
  
}
      
    
  
  
    
    


Measured memory_bytes: 4724
//#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
#define REP1(i,a,b) for(int i=(a);i<=(b);i++)
#define em emplace_back
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define mkp make_pair
#define pii pair<int,int>
#define Rosario ios::sync_with_stdio(0),cin.tie(0);
#define pll pair<ll,ll> 
//#define lb(x) (x&-x)

int n;
string a,b;
int main(){//Rosario
    cin>>n>>a>>b;
    REP(i,n) putchar(a[i]),putchar(b[i]);
//    system("pause");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, int> ii;
deque<char> dq;
char s[15];
string r;

int main(int argc, char ** argv) {
	scanf("%s", s);
	rep(i, 0, strlen(s)) {
		if(s[i] == 'B' && !dq.empty()) dq.pop_back();
		if(s[i] != 'B') dq.pb(s[i]); 
	}
	while(!dq.empty()) {
		printf("%c", dq.front());
		dq.pop_front();
	}
	printf("\n");
	return 0;
}


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

typedef long long ll;
#define mod 1000000007
#define PRINTV(v) for(int z = 0; z < (v).size(); z++){cout<<v[z]<<" ";}cout<<"\n";

template<typename T>
void deb(initializer_list<T> &l)
{
    for (auto &e : l)
        cout << e << ' ';
    cout << endl;
}
void solve(){
    int n, k, ans = 0;
    cin>>n>>k;
    vector<int> v(n, 0);
    for(auto& e: v){
        cin>>e;
    }
    sort(v.begin(), v.end());
    for(int i = 0; i < k; i++){
        ans += v[i];
    }
    cout<<ans;

}

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

    int t = 1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 3648
//       BAAP IZ HERE           //
#include<bits/stdc++.h>
using namespace std;
#define gcd __gcd
#define lli long long int
#define jmd ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

int main()
{
    jmd;
    int n; int x;
    int num;
    cin>>x>>n; set<int> s;
    for(int i=0;i<n;i++)
    {    
        cin>>num;
        s.insert(num);
    }
    int ans;
    for(int i=0;;i++)
    {
        if(s.count(x-i)==0)
        {
            ans = x-i;break;
        }
        if(s.count(x+i)==0)
        {
            ans = x+i;break;
        }
    }
    cout<<ans;
}

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

#define reps(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   reps(i,0,n)
#define all(x) (x).begin(),(x).end()
#define INF (2000000000)
#define MOD (1000000007)
#define PI (acos(-1))

int main(){
  int n,k;
  string s;
  cin >> n >> s >> k;
  rep(i,n){
    if(s[i]!=s[k-1]){
      cout << "*";
    }else{
      cout << s[i];
    }
  }
  cout << endl;
}


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

int main()
{
    long int a,b;
    cin>>a>>b;
    
    
    long int x=0;
    
    for(int i=0;i<b;i++)
    {
        int y;
        cin>>y;
        x+=y;
    }
    
    if(x>=a)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#![allow(unused_imports)]
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::collections::BinaryHeap;

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}
impl<T: Iterator> IteratorExt for T {}

fn main() {
    let _n = read!(isize);
    let a = read!([isize]);
    let q = read!(isize);

    let mut v = vec![0; 100000+1];
    for &e in &a {
        v[e as usize] += 1;
    }

    let mut sum: isize = a.iter().sum();

    for _ in 0..q {
        let (b, c) = read!(isize, isize);
        sum += v[b as usize]*(c-b);
        let t = v[b as usize];
        v[b as usize] = 0;
        v[c as usize] += t;
        println!("{}", sum);
    }
}



Measured memory_bytes: 3776
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>
#define ll long long int
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
using namespace std;
int mx4[] = {0,1,0,-1};
int my4[] = {1,0,-1,0};
int mx2[] = {1,0};
int my2[] = {0,1};

class AHonestOrDishonest {
public:
	void solve(istream& in, ostream& out) {
        char a, b;
        in >> a >> b;
        if(a == 'H') {
            if (b == 'H') out << 'H' << endl;
            else out << 'D' << endl;
        }else{
            if(b == 'H') out << 'D' << endl;
            else out << 'H' << endl;
        }
	}
};

int main() {
	AHonestOrDishonest solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 256
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//setprecision(15)有効数字15桁
//-std=c++14
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 n, m;
vector<ll> a;
ll dfs(int i, ll score)
{
    if (i == n)
    {
        if (score % 2 == 0)
        {
            return 1;
        }
        return 0;
    }
    return dfs(i + 1, score * (a[i] - 1)) + dfs(i + 1, score * (a[i] + 1)) + dfs(i + 1, score *a[i]);
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        ll temp;
        cin >> temp;
        a.push_back(temp);
    }
    cout << dfs(0, 1)<< "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define cinf(n,x,y,z) for(int i=0;i<(n);i++) cin >> x[i]>>y[i]>>z[i];
typedef long long int ll;
using namespace std;

int main(){
	int w,a,b; cin >>w >>a >>b;
	if(a<=b && b<=a+w){cout <<0 << endl; return 0;}
	if(a<=b+w &&b+w<=a+w){cout << 0 << endl; return 0;}
	if(b<=a+w && a+w<=b+w){cout << 0 << endl; return 0;}
	if(a<=b+w && b+w<=a+w){cout << 0 << endl; return 0;}
	cout << min(abs(a+w-b),abs(b+w-a))<< endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,r,s,p,sum=0;
string t,ans;
int main(){
	cin>>n>>k>>r>>s>>p;
	cin>>t;
	ans=t;
	for(int i=0;i<t.size();i++){
		if(t[i]=='r') ans[i]='p';
		else if(t[i]=='p') ans[i]='s';
		else if(t[i]=='s') ans[i]='r';
	}
	for(int i=k;i<t.size();i++){
		if(ans[i-k]==ans[i]) ans[i]='x';
	}
	for(int i=0;i<t.size();i++){
		if(ans[i]=='p') sum+=p;
		else if(ans[i]=='s') sum+=s;
		else if(ans[i]=='r') sum+=r;
	}
	cout<<sum<<endl;
	return 0;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

vector<int> g[101010];
int col[101010],cnt;
bool dfs(int v,int c){
   col[v]=c; cnt++; bool res=1;
   for(int t:g[v]){
      if(col[t]!=-1){
         if(col[t]+c!=1)res=0;
      }
      else if(!dfs(t,c^1))res=0;
   } return res;
}

int main(){
   int n,m; cin>>n>>m;
   rep(i,0,n)col[i]=-1;
   rep(i,0,m){
      int x,y; cin>>x>>y; x--; y--;
      g[x].push_back(y); g[y].push_back(x);
   }
   ll a=0,b=0,c=0;
   rep(i,0,n)if(col[i]==-1){
      cnt=0; bool f=dfs(i,0);
      if(cnt==1)a++;
      else if(f)b++; else c++;
   }
   cout<<(a*a+a*(n-a)*2)+(b+c)*(b+c)+b*b<<endl;
   return 0;
}


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

using namespace std;

typedef long long I64;
const I64 NMAX = 2e5;
const I64 INF = 400000000000001LL;

I64 v[NMAX+2];
I64 sp[NMAX+2];
I64 ans = INF;
    I64 N;

I64 get_sume(I64 a, I64 b, I64 c)
{
    if( a >= b || b >= c || a >= c ) return INF;
    if( a < 1 || c >= N ) return INF;
    vector<I64> vv = {sp[a], sp[b] - sp[a], sp[c] - sp[b], sp[N] - sp[c]};
    sort( vv.begin(), vv.end() );
    return vv.back() - vv[0];
}

pair<I64,I64> split(I64 a, I64 b)
{
    I64 p = 0;
    I64 q = (1 << 17);
    while( q ) {
        if( a + p + q < b ) {
            if( sp[a + p + q] - sp[a - 1] <= sp[b] - sp[a + p + q] )
                p += q;
        }
        q >>= 1;
    }
    return {a + p, a + p + 1};
}

I64 get_cost(I64 pos)
{
    if( pos == 1 || pos == N ) return INF;
    auto x = split(1, pos);
    auto y = split(pos + 1, N);
    auto v1 = get_sume(x.first, pos, y.first);
    auto v2 = get_sume(x.second, pos, y.first);
    auto v3 = get_sume(x.first, pos, y.second);
    auto v4 = get_sume(x.second, pos, y.second);
    return min( min(v1,v2), min(v3,v4) );
}

int main()
{
    cin >> N;
    for( I64 i = 1;  i <= N;  ++i ) {
        cin >> v[i];
        sp[i] = sp[i - 1] + v[i];
    }
    I64 best = INF;
    for( I64 i = 2;  i < N;  ++i ) {
        best = min(best, get_cost(i));
    }
    cout << best << '\n';
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  double a, b;
  cin >> a >> b;
  int ans = ceil((a + b) / 2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
using namespace std; 
  int main(){
  long long 	int a,b;
  	cin>>a>>b;
  long	int k=(a+b)/2;
  	if(abs(a-k)==abs(b-k)){
  		cout<<k<<endl;
	  }
	  else
	  cout<<"IMPOSSIBLE"<<endl;
	  return 0;
  }


Measured memory_bytes: 256