akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N;
  cin >> N;
  map<long, long> mp;
  long a;
  for(int i = 0; i < N; i++){
    cin >> a;
    mp[a]++;
  }
  int flag = 1, sub = 0;
  if(N % 3 == 0){
    if(mp.size() == 3){
      for(auto i = mp.begin(); i != mp.end(); ++i){
        sub ^= i->first;
        if(i->second != N /3)flag = 0;
      }
      cout << (flag == 1 && sub == 0?"Yes":"No") << endl;
    } else if(mp.size() == 2 && mp[0] == N / 3)cout << "Yes" << endl;
    else if(mp[0] == N)cout << "Yes" << endl;
    else cout << "No" << endl;
  } else if(mp[0] == N)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  for (int &x : a)
    cin >> x;

  sort(a.begin(), a.end());
  for (int i = 0; i < n - 1; i++)
  {
    if (a.at(i) == a.at(i + 1))
    {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll = long long int;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}



int main(){
  char c;
  cin>>c;
  if('A'<= c and c <= 'Z')
    std::cout << 'A' << std::endl;
  else
    std::cout << 'a' << std::endl;
      
      
  return 0;
}



Measured memory_bytes: 3620
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <valarray>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>
#include <random>

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

int main()
{
  int n, k;
  cin >> n >> k;
  if (k == 1)
    cout << 0 << endl;
  else
    cout << n - k << endl;

  return 0;
}


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

bool is_edge(int x, int y, int r, int c)
{
  return (x == 0 || x == r || y == 0 || y == c);
}

int key(int x, int y, int r, int c)
{
  if (y == 0) return x;
  if (x == r) return r + y;
  if (y == c) return r + c + (r - x);
  return r + c + r + (c - y);
}

struct Point {
  int key, id, flag;
  Point(int k, int i, bool f):key(k),id(i),flag(f){};
  bool operator<(const Point& p) const {
    return key < p.key;
  };
};

int main(int argc, char *argv[])
{
  int r, c, n;
  cin >> r >> c >> n;

  vector<Point> pts;
  pts.reserve(n);
  for (int i = 0; i < n; ++i) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (is_edge(x1,y1,r,c) && is_edge(x2,y2,r,c)) {
      int k1 = key(x1,y1,r,c);
      int k2 = key(x2,y2,r,c);
      pts.push_back(Point(min(k1,k2),i,true));
      pts.push_back(Point(max(k1,k2),i,false));
    }
  }

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

  stack<int> st;
  for (vector<Point>::iterator pt = pts.begin(); pt != pts.end(); ++pt) {
    if (pt->flag) {
      st.push(pt->id);
    } else {
      if (st.top() != pt->id) {
        puts("NO");
        return 0;
      }
      st.pop();
    }
  }
  puts("YES");
  return 0;
}


Measured memory_bytes: 3456
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<functional>
#include<math.h>
#include<random>
#include <bitset>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e16
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> Q;
 
const int inf = (int)1e9; 
 
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}
 

 
int main(void){
    int n;
    cin>>n;
    vector<ll>a(n),s(n+1);
    for(int i=0;i<n;i++)cin>>a[i];
    s[0]=0;
    for(int i=0;i<n;i++){
        s[i+1] = (s[i]+a[i])%N;
    }
    ll ans = 0;
    for(int i=0;i<n-1;i++){
        ll t = (a[i]*(s[n]-s[i+1]))%N;
        ans = (ans+t)%N;
    }
    cout<<(ans+N)%N<<endl;
	return 0;
}

Measured memory_bytes: 6420
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    ll h;
    cin >> h;
    ll ans = 0;
    ll cur = 1;
    while (h != 0)
    {
        ans += cur;
        h = h / 2;
        cur *= 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
C=[list(map(int,input().split())) for _ in range(3)]

a=[0]*3
b=[0]*3
for j in range(3):
    b[j] = C[0][j] - a[0]
for i in range(3):
    a[i] = C[i][0] - b[0]
ans=True
for i in range(1,3):
    for j in range(1,3):
        if C[i][j] != a[i]+b[j]:
            ans=False
print('Yes' if ans else 'No')


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

int main(void){
	int a,b;
	int w,h;
	long int map[102][102][3][3];
	memset(map,0,sizeof(map));
	map[1][1][0][0]=1;
	for(a=1;a<=100;a++){
		for(b=1;b<=100;b++){
			map[a+1][b][1][0]=(map[a][b][0][2])%100000;
			map[a+1][b][2][0]=(map[a][b][0][0]+map[a][b][1][0]+map[a][b][2][0])%100000;
			map[a][b+1][0][1]=(map[a][b][2][0])%100000;
			map[a][b+1][0][2]=(map[a][b][0][0]+map[a][b][0][1]+map[a][b][0][2])%100000;
		}
	}
	while(1){
		cin >> w >> h;
		if(w==0 && h==0)break;
		cout << (map[w][h][1][0]+map[w][h][2][0]+map[w][h][0][1]+map[w][h][0][2])%100000 << endl;
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)

Measured memory_bytes: 33116
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入


int main(){
    ll N,A,B;
    cin>>N>>A>>B;
    vector<ll> h(N);
    REP(i,N) cin>>h[i];
    ll l,r,mid;
    l=-1;
    r=INF;
    while(r-l>1){
        mid=(r+l)/2;
        ll cnt=0;
        REP(i,N){
            ll tmp=h[i]-B*mid;
            if(tmp<=0) continue;
            else{
                if(tmp%(A-B)==0) cnt+=tmp/(A-B);
                else cnt+=(tmp/(A-B)+1);
            }
        }
        if(cnt<=mid) r=mid;
        else l=mid;
    }
    cout<<r<<endl;

    
}

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

using namespace std;

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

const int inf = 1e9;
const ll inf64 = 1e18;

struct Clue {
    int a, b, c;
};

const int N = 1e5 + 5;

int n, q;
ll m;
Clue clues[N];
int parent[N];

int find(int x) {
    return parent[x] == x ? x : parent[x] = find(parent[x]);
}

void merge(int x, int y) {
    parent[find(x)] = find(y);
}

int main() {

#ifdef debug
    freopen("input.txt", "r", stdin);
#endif

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

    cin >> n >> m >> q;

    for (int i = 0; i < q; i++) {
        cin >> clues[i].a >> clues[i].b >> clues[i].c;
    }

    if (m == n - 1) {
        for (int i = 0; i < q; i++) {
            if (clues[i].c) {
                cout << "No\n";
                return 0;
            }
        }
        cout << "Yes\n";
        return 0;
    }

    for (int i = 0; i < n; i++) {
        parent[i] = i;
    }

    for (int i = 0; i < q; i++) {
        if (clues[i].c == 0) {
            merge(clues[i].a, clues[i].b);
        }
    }

    for (int i = 0; i < q; i++) {
        if (clues[i].c == 0) continue;
        int u = clues[i].a;
        int v = clues[i].b;
        u = find(u);
        v = find(v);
        if (u == v) {
            cout << "No\n";
            return 0;
        }
    }

    int k = 0;

    for (int i = 0; i < n; i++) {
        if (i == find(i)) {
            k++;
        }
    }

    if (n + 1ll * k * (k - 3) / 2 < m) {
        cout << "No\n";
    } else {
        cout << "Yes\n";
    }

    return 0;
}


Measured memory_bytes: 1792
n, a, b = gets.chomp.split(" ").map(&:to_i)

counter = 0
n.times do |i|
  i += 1
  i_org = i
  sum = 0
  while true do
    sum += i % 10
    i /= 10
    break if i.zero?
  end
  if a <= sum && sum <= b
    counter += i_org
  end
end
puts counter


Measured memory_bytes: 3836
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node{
  int p, l, r;
};

struct Node A1[MAX];
int num;
int A2[MAX], A3[MAX];

int getDepth(int m){
  int d = 0;
  while(1){
    m = A1[m].p;
    if ( m == NIL ) break;
    d++;
  }
  return d;
}

int getSibling(int m){
  if ( A1[m].p == NIL ) return NIL;
  if ( A1[A1[m].p].l != m && A1[A1[m].p].l != NIL )return A1[A1[m].p].l;
  if ( A1[A1[m].p].r != m && A1[A1[m].p].r != NIL )return A1[A1[m].p].r;
  return NIL;
}

void print(int m){
  printf("node %d: ", m);

  printf("parent = %d, ", A1[m].p);
  printf("sibling = %d, ", getSibling(m));
  int deg = 0;
  
  if ( A1[m].l != NIL )
    deg++;
  if ( A1[m].r != NIL )
    deg++;
  
  printf("degree = %d, ", deg);
  printf("depth = %d, ", A2[m]);
  printf("height = %d, ", A3[m]);

  if ( A1[m].p == NIL ){
    printf("root\n");
  } else if ( A1[m].l == NIL && A1[m].r == NIL ){
    printf("leaf\n");
  } else {
    printf("internal node\n");
  }
}

int main(){
  int i, v, l, r;
  scanf("%d", &num);

  for ( i = 0; i < num; i++ ) {
    A1[i].p = NIL;
  }

  for ( i = 0; i < num; i++ ){
    scanf("%d %d %d", &v, &l, &r);
    A1[v].l = l;
    A1[v].r = r;
    if ( l != NIL ) A1[l].p = v;
    if ( r != NIL ) A1[r].p = v;
  }

  for ( i = 0; i < num; i++ ){
    A2[i] = getDepth(i);
    A3[i] = 0;
  }
 for ( i = 0; i < num; i++ ){
    scanf("%d %d %d", &v, &l, &r);
    A1[v].l = l;
    A1[v].r = r;
    if ( l != NIL ) A1[l].p = v;
    if ( r != NIL ) A1[r].p = v;
  }

  for ( i = 0; i < num; i++ ){
    A2[i] = getDepth(i);
    A3[i] = 0;
  }

  for ( i = 0; i < num; i++ ){
    if ( A1[i].l == NIL && A1[i].r == NIL ) { // is leaf
      A3[i] = 0;
      int p = A1[i].p;
      int c = 1;
      while(1){
        if ( p == NIL ) break;
        if ( A3[p] < c ) A3[p] = c;
        c++;
        p = A1[p].p;
      }
    }
  }

  for ( i = 0; i < num; i++ ) print(i);
  return 0;
}

Measured memory_bytes: 620
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;

inline bool check(ll x, ll y, ll xMax, ll yMax) { return x >= 0 && y >= 0 && xMax > x && yMax > y; }
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string tostring(T x) { ostringstream sout; sout << x; return sout.str(); }
template<class T> inline T sqr(T x) { return x*x; }
template<class T> inline T mypow(T x, ll n) { T res = 1; while (n > 0) { if (n & 1)res = res * x;	x = x * x;	n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

#define For(i,a,b)	for(ll (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define rFor(i,a,b)	for(ll (i) = (a-1);i >= (b);(i)--)
#define rrep(i,n)	rFor(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define tostr(a)	tostring(a)
#define dump(val) 	cerr << #val " = " << val << endl;
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

const ll dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, -1, 0, 1, -1, 1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = 1e17 + 9;

#define int ll
#define double ld

signed main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int h, w;
	cin >> h >> w;

	rep(i, h) {
		string s;
		cin >> s;
		cout << s << endl << s << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pi;
typedef pair<ll, ll> pll;
#define fi first
#define se second
#define pb push_back
#define ppb pop_back

int main() {
  ll n;
  cin >> n;
  ll m = n/1000*1000;
  if (m==n) puts("0");
  else cout << m+1000-n << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip> //setprecision()
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
using ll = long long;
using namespace std;

double Mcos(double k){return cos(k*atan(1.0)*4/180);}

void monmo(){
    
}

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


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

struct edge{
public:
    int to,cost;
};

vector<edge> G[100001];
int n;
bool passed[100001];
const int mod=10007;
int maxCost;
int sumCost;
int cnt;

void dfs(int s,bool first,int from){
    if(!first)
        passed[s]=true;
    for(int i = 0; i < G[s].size(); i++){
        edge &e=G[s][i];
        if(passed[e.to]||e.to==from)
            continue;
        sumCost+=e.cost;
        if(maxCost<e.cost){
            cnt=1;maxCost=e.cost;
        }
        else if(maxCost==e.cost)
            cnt++;
        dfs(e.to,false,s);
        break;
    }
}

int main(){
    while(cin>>n&&n!=0){
        maxCost=0;
        for(int i = 0; i < n; i++)
            G[i].clear();
        fill(passed,passed+n,false);
        for(int i = 0; i < n; i++){
            for(int j = 0; j < 2; j++){
                int to,cost;
                cin>>to>>cost;
                edge e;
                e.to=to;e.cost=cost;
                G[i].push_back(e);
            }
        }
        int mul=1;
        for(int i = 0; i < n; i++){
            if(passed[i])
                continue;
            maxCost=0;
            sumCost=0;
            cnt=0;
            dfs(i,true,-1);
            mul*=cnt;
            mul%=mod;
        }
        cout<<mul%mod<<endl;
    }
    return 0;
}

Measured memory_bytes: 2300
#include<iostream>
using namespace std;
int tmp,b[100000+10];
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		scanf("%d",&tmp);
		b[tmp] = i;
	}
	for(int i=1;i<=n;i++){
		printf("%d ",b[i]);
	}
	return 0;
}

Measured memory_bytes: 1280
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;


int main()
{
	FAST;
	string a,b;
	cin >> a >> b;
	while(a.size() < b.size())
	    a = '0' + a;
	 while(b.size() < a.size())
	    b = '0' + b;
	
	if(a == b)
		cout << "EQUAL";
    else if(a > b)
        cout << "GREATER";
    else
        cout << "LESS";
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    map<int,int> m;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        m[a] = i+1;
    }
    for(int i=0; i<n; i++){
        cout << m[i+1] << " ";
    }
}

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

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int n, k;
    cin >> n >> k;
    
    int ans = 0;
    
    while(n)
        n /= k, ans++;

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
N = int(input())
T = [int(input()) for _ in range(N)]

def gcd(A, B):
    A, B = sorted([A, B], reverse=True)
    prev_r = B
    r = A % B
    while r > 0:
        prev_r = B
        r = A % B
        A, B = B, r
    return prev_r

if N > 1:
    tmp = (T[0] * T[1]) // gcd(T[0], T[1])
    for t in T[2:]:
        tmp = (tmp * t) // gcd(tmp, t)
else:
    tmp = T[0]

print(tmp)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
int main(){
  ll n;
    cin>>n;
    if(n%2)
    {
        cout<<0;
        return 0;
    }
    ll k=n/2;
    ll c=0;
    ll val=5;
    while(k>=val)
    {
        c+=k/val;
        val*=5;
    }
    cout<<c;
    return 0;
}

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

using namespace std;

int main(){
    
    int a=0,b=0,c=0,i=0;
    double d=0;
    
    cin>>a>>b>>c;

    
    for(int x=a;x<=b;++x){
        d=c%x;
        if(d==0){
            ++i;
        }
    }
    
    cout<<i<<endl;
  
    return 0;
 
}

Measured memory_bytes: 1164
#pragma region Include
#include <bits/stdc++.h>
// #include <algorithm>
// #include <bitset>
// #include <climits>
// #include <cmath>
// #include <iostream>
// #include <iterator>
// #include <map>
// #include <queue>
// #include <sstream>
// #include <stack>
// #include <string>
// #include <unordered_map>
// #include <unordered_set>
// #include <vector>
#pragma endregion

using namespace std;

#pragma region Macros
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define all(c) (c).begin(), (c).end()
#define newl "\n"
#define out(x) cout << (x) << newl
#define dump(x) \
  cout << "Line " << __LINE__ << " : " << #x << " = " << (x) << newl
template <class T>
using VV = vector<vector<T>>;
#define Uni(v) (v).erase(unique((v).begin(), (v).end()), (v).end());

template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "[";
  rep(i, vec.size()) os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "]";
  return os;
}

template <typename T>
ostream& operator<<(ostream& os, vector<vector<T>>& mat) {
  os << "[";
  rep(i, mat.size()) os << mat[i] << (i + 1 == mat.size() ? "" : ",\n ");
  os << "]";
  return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x;
  return is;
}

template <typename V, typename H>
void resize(vector<V>& vec, const H head) {
  vec.resize(head);
}

template <typename V, typename H, typename... T>
void resize(vector<V>& vec, const H& head, const T... tail) {
  vec.resize(head);
  for (auto& v : vec) resize(v, tail...);
}
constexpr double EPS = 1e-10;
const int INF = 0x3f3f3f3f;

string tostring(int i, int digit) {
  auto cur = cout.flags();
  stringstream ss;
  ss << setw(4) << setfill('0') << i;
  string ret = ss.str();
  cout.flags(cur);
  return ret;
}

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

#pragma endregion

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll N, K;
  cin >> N >> K;
  vector<ll> H(N);
  cin >> H;
  ll sum = 0;
  sort(all(H));

  rep(i, N - K) { sum += H[i]; }

  out(sum);
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>


using namespace std;


int main()
{
   int i, h, m, s;
   cin >> i;
   h = i / 3600;
   m = i / 60- h * 60;
   s = i % 60;
   cout << h << ":" << m << ":"<< s << endl;


   
   return 0;
}



Measured memory_bytes: 3100
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= (int)end; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

const double PI = 3.14159265358979323846;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    double R;
    cin >> R;
    cout << fixed << setprecision(3) << 2 * PI * R << endl;
    return 0;
}

Measured memory_bytes: 3768
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <numeric>
#include <map>
#include <string>

using namespace std;

int main() {
    string a;
    cin>>a;
    for(int i = 0;i < a.size();i++)
    {
        if(a[i] == '1')
            cout<<"9";
        else
            cout<<"1";
    }
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn main() {
    let mut n: u32 = read();
    let mut v: Vec<u32> = read_vec();
    let mut c: Vec<u32> = read_vec();
    let mut ans:u32 = 0;
    for i in 0..n {
        if v[i as usize]>c[i as usize] {
            ans += v[i as usize]-c[i as usize];
        }
    }
    println!("{}", ans);
}
fn read<T: FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_vec2<T: FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

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

#define EB emplace_back
#define int long long
#define F first
#define S second
#define N 100005
#define ALL(x) x.begin(),x.end()
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;


int32_t main()
{
    IOS;

    int tt=1;
    //cin>>tt;
    while(tt--)
    {
        //int n; cin>>n; int arr[n]; for(int i = 0; i<n; i++) cin>>arr[i];
		int a,b; cin>>a>>b;
		cout<<2*b -a ;

		
		cout<<endl;
    }
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl '\n'
typedef long long int ll;
int flag=0;

using namespace std;
ll arr[300000];

int main()
{
  
  ll n,a,b,c,d;
  string s;
  cin>>n>>a>>b>>c>>d;
  cin>>s;
  for(int i=0;i<s.size();i++){
      if(s[i]=='#') arr[i+1]=1;
  }
//   for(int i=1;i<=n;i++) cout<<arr[i]<<" ";
//   cout<<endl;
    if(c<d){
        for(int i=b;i<d;i++){
            if(arr[i]==1 && arr[i+1]==1){ cout<<"No"<<endl; return 0; }
        }
        for(int i=a;i<c;i++){
            if(arr[i]==1 && arr[i+1]==1){ cout<<"No"<<endl; return 0; }
        }
        cout<<"Yes"<<endl; return 0;
    }
    else{
       for(int i=b;i<d;i++){
            if(arr[i]==1 && arr[i+1]==1){ cout<<"No"<<endl; return 0; }
        }
        int flag=0;
        for(int i=b-1;i<=d-1;i++){
            if(arr[i]==0 && arr[i+1]==0 && arr[i+2]==0){
                 flag=1; arr[i+1]=1; break;
            }
        }
        if(flag==0) arr[d]=1;
        for(int i=a;i<c;i++){
            if(arr[i]==1 && arr[i+1]==1){ cout<<"No"<<endl; return 0; }
        }
        
        cout<<"Yes"<<endl; return 0;
    }
 
}

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

int main() {
    string O, E;
    cin >> O >> E;
    int oc = 0, ec = 0;
    string ans = "";
    for (int i=0; i < O.size() + E.size(); i++) {
        if (i % 2 == 0) {
            ans += O[oc++];
        }
        else {
            ans += E[ec++];
        }
    }   
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;

public class Main
{
	public static void main(String[] args) throws IOException
	{		
		BufferedReader br =
			new BufferedReader(new InputStreamReader(System.in));
			
			String str1 = br.readLine();
			int num1 = Integer.parseInt(str1);
			
			String str2 = br.readLine();
			int num2 = Integer.parseInt(str2);

		if(num1==1 && num2==2)System.out.println("3");
		else if(num1==1 && num2==3)System.out.println("2");
		else if(num1==2 && num2==1)System.out.println("3");
		else if(num1==2 && num2==3)System.out.println("1");
		else if(num1==3 && num2==1)System.out.println("2");
		else if(num1==3 && num2==2)System.out.println("1");
	}
}




Measured memory_bytes: 22356
data = list(map(int, input().split()))

def cookie1(a, b):
  if a % 2 == 1:
    a = a - 1
  else:
    pass
  return (int(a / 2), b + int(a / 2))

def cookie2(a, b):
  if b % 2 == 1:
    b = b - 1
  else:
    pass
  return (a + int(b / 2), int(b / 2))

a = data[0]
b = data[1]
for i in range(data[2]):
  if i % 2 == 0:
    c = cookie1(a, b)
    a = c[0]
    b = c[1]
  else:
    c = cookie2(a, b)
    a = c[0]
    b = c[1]
print("{0} {1}".format(a, b))

Measured memory_bytes: 3064
/*
          , -- 、
        /;;;;;;', 　　　
        i二二二i
      , ' 　    ヽ ???
     i　ﾉﾉﾉﾉﾉﾍ .', 　　
     〉ﾘi' ﾟ ヮﾟﾉﾚく　 WAyon..........
  ○⊂}〈lﾄ--ｲl〉{つ● 　　
      ,ｒ/ー i-ヽヽ 　　　
     ｀｀i_ﾗi_ﾗ
*/

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int INF=(int)1e12;
const int mod=(int)1e9+7;
#define all(a) (a).begin(),(a).end()
typedef vector<vector<int>> graph;

#define pb push_back

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

class Radix {
private:
    const char* s;
    int a[128];
public:
    Radix(const char* s = "abcdefghijklmnopqrstuvwxyz") : s(s) {
        int i;
        for(i = 0; s[i]; ++i)
            a[(int)s[i]] = i;
    }
    std::string to(long long p, int q) {
        int i;
        if(!p)
            return "0";
        char t[64] = { };
        for(i = 62; p; --i) {
            t[i] = s[p % q];
            p /= q;
        }
        return std::string(t + i + 1);
    }
    std::string to(const std::string& t, int p, int q) {
        return to(to(t, p), q);
    }
    long long to(const std::string& t, int p) {
        int i;
        long long sm = a[(int)t[0]];
        for(i = 1; i < (int)t.length(); ++i)
            sm = sm * p + a[(int)t[i]];
        return sm;
    }
};

signed main () {
    char a;cin >>a;
    if('a'<=a&&a<='z')cout <<"a"<<endl;
    else cout <<"A"<<endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
int main(){
	int ans=1001;
	string s,t;
	cin>>s>>t;
	for(int i=0;i<sz(s)-sz(t)+1;i++){
		int c=0;
		for(int j=0;j<sz(t);j++){
			c+=(s[i+j]!=t[j]);
		}
		ans=min(ans,c);
	}
	cout<<ans;
}


Measured memory_bytes: 3584
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int MAXN=220000;
const ll INF=1E18;
int n, m, a[MAXN];
struct Edge
{
	int to, val;
	Edge(int v, int w): to(v), val(w) {}
};
vector<Edge> g[MAXN];
struct DSU
{
	int f[MAXN];
	void init()
	{
		for (int i=1; i<=n; i++) f[i]=i;
	}
	int getf(int x)
	{
		if (x==f[x]) return x;
		return f[x]=getf(f[x]);
	}
	bool merge(int u, int v)
	{
		int x=getf(u), y=getf(v);
		if (x==y) return 0;
		f[x]=y; return 1;
	}
} dsu;
typedef pair<ll, int> pli;
pli dp1[MAXN], dp2[MAXN], p[MAXN];
void dfs1(int u, int f)
{
	for (Edge e:g[u])
	{
		int v=e.to;
		if (v!=f)
		{
			dfs1(v, u);
			dp1[u]=min(dp1[u],
			make_pair(dp1[v].first+e.val, dp1[v].second));
		}
	}
}
void dfs2(int u, int f)
{
	for (Edge e:g[u])
	{
		int v=e.to;
		if (v!=f)
		{
			dp1[v]=min(dp1[v],
			make_pair(dp1[u].first+e.val, dp1[u].second));
			dfs2(v, u);
		}
	}
	for (Edge e:g[u])
	{
		int v=e.to;
		if (v!=f)
		{
			dp2[u]=min(dp2[u], dsu.getf(dp1[v].second)!=dsu.getf(dp1[u].second)?
			make_pair(dp1[v].first+e.val, dp1[v].second):
			make_pair(dp2[v].first+e.val, dp2[v].second));
		}
	}
}
void dfs3(int u, int f)
{
	for (Edge e:g[u])
	{
		int v=e.to;
		if (v!=f)
		{
			dp2[v]=min(dp2[v], dsu.getf(dp1[u].second)!=dsu.getf(dp1[v].second)?
			make_pair(dp1[u].first+e.val, dp1[u].second):
			make_pair(dp2[u].first+e.val, dp2[u].second));
			dfs3(v, u);
		}
	}
}
int main()
{
//	freopen("AT3611.in", "r", stdin);
//	freopen("AT3611.out", "w", stdout);
	scanf("%d", &n);
	for (int i=1; i<=n; i++) scanf("%d", &a[i]);
	for (int i=1; i<n; i++)
	{
		int u, v, w;
		scanf("%d%d%d", &u, &v, &w);
		g[u].push_back(Edge(v, w));
		g[v].push_back(Edge(u, w));
	}
	dsu.init();
	int cnt=0; ll ans=0;
	while (cnt<n-1)
	{
		for (int i=1; i<=n; i++)
		{
			dp1[i]=make_pair(a[i], i);
			dp2[i]=make_pair(INF, 0);
		}
		dfs1(1, 0); dfs2(1, 0); dfs3(1, 0);
		for (int i=1; i<=n; i++)
		{
//			printf("%d %d\n", dp1[i].second, dp2[i].second);
			p[i]=dsu.getf(dp1[i].second)!=dsu.getf(i)?dp1[i]:dp2[i];
			p[i].first+=a[i];
		}
		for (int i=1; i<=n; i++)
			p[dsu.getf(i)]=min(p[dsu.getf(i)], p[i]);
		for (int i=1; i<=n; i++)
		{
			pli t=p[dsu.getf(i)];
			if (t.first<INF&&dsu.merge(i, t.second))
				cnt++, ans+=t.first;//, printf("#%d %d %lld\n", i, t.second, t.first);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 57984
import java.util.*

fun main(args: Array<String>) {
    val scan = Scanner(System.`in`)
    var a=scan.nextLine()
    var b = scan.nextLine()
    var ans = 0
    for(i in 0..a.length-1)
    {
        if(a[i]!=b[i])
            ans++
    }
    println(ans)
}


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

int main(){
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    for(int i=0; i<s.size(); i++){
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    for(auto e:s){
        cout << e;
    }
    cout << endl;
}

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

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }	//最大公約数(Greatest Common Divisor)
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }			//最小公倍数(Least Common Multiple)

long long comb(long long m) {
	return (m * (m - 1)) / 2;
}


int main() {
	int s,w;
	cin >> s>> w;
	
	if (s <= w)
		cout << "unsafe" << endl;
	else
		cout << "safe" << endl;


}

Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <list>
#include <algorithm>

using namespace std;

int main(void){
	//FILE* fp_in = freopen("data.txt", "r", stdin);

	while( 1 ) {
		int N, W, H, S, T;
		vector<vector<int>> est;
		cin >> N >> W >> H;

		if( N == 0 ) break;

		for(int i = 0; i < W + 1; i++) {
			vector<int> nest;
			for(int j = 0; j < H + 1; j++)
				nest.push_back(0);
			est.push_back(nest);
		}

		for(int i = 0; i < N; i++) {
			int x_i, y_i;
			cin >> x_i >> y_i;
			est.at( x_i ).at( y_i ) ++;
		}

		//????¬?????´???????
		for(int i = 0; i < H + 1; i++)
			for(int j = 1; j < W + 1; j++)
				est.at(j).at(i) += est.at(j - 1).at(i);
		for(int i = 0; i < W + 1; i++)
			for(int j = 1; j < H + 1; j++)
				est.at(i).at(j) += est.at(i).at( j - 1 );

		cin >> S >> T;
		S --;
		T --;
		int max = 0;
		for(int i = 1; i <= W - S; i++)
			for(int j = 1; j <= H - T; j++) {
				int tmp = est.at( i + S ).at( j + T ) - est.at( i - 1 ).at( j + T ) - est.at( i + S ).at( j - 1 ) + est.at( i - 1 ).at( j - 1 );
				if( tmp > max ) max = tmp;
			}

		cout << max << endl;

	}

	//while(1){}
	return 0;
}

Measured memory_bytes: 1260
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;
void y(bool c) {
	if (c)print("Yes");
	else print("No");
}
bool s, n, w, e;
void solve() {
	string S; cin >> S;
	int a = 0, b = 0;
	int N = S.size();

	REP(i, N) {
		if (S[i] == 'S')s = true;
		else if (S[i] == 'N')n = true;;
		if (S[i] == 'W')w=true;
		if (S[i] == 'E')e = true;;
	}
	bool ok = true;
	if (s != n || w != e)ok = false;
	y(ok);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}




Measured memory_bytes: 888
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int A[100010];
int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) cin >> A[i];
	sort(A, A + N);
	vector<pair<int,int>> V;
	int num1 = A[0], num2 = A[N - 1];
	for (int i = 1; i < N - 1; i++) {
		if (A[i] < 0) {
			V.push_back({ num2,A[i] });
			num2 -= A[i];
		}
		else {
			V.push_back({ num1,A[i] });
			num1 -= A[i];
		}
	}
	V.push_back({ num2,num1 });
	cout << num2 - num1 << endl;
	for (pair<int, int> P : V) {
		cout << P.first << " " << P.second << endl;
	}
}


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


int main(){
    ll n;
    cin>>n;
    ll num =0;
    ll in;
    ll ans=0;
    rep(i,n){
        cin>>in;
        if(i==0)num=in;

        if(num<=in){//update num
            num = in;
        }else{//num>in:add num
            ans += (num - in);
        }
    }
    
    cout<<ans<<endl;

}



Measured memory_bytes: 3608
s=list(input())

for c in map(ord,s):
	if ord('A') <= c and c <= ord('Z'):
		print(chr(c+(ord('a'))-ord('A')),end="")
	elif ord('a') <= c and c <= ord('z'):
		print(chr(c+(ord('A')-ord('a'))),end="")
	else:
		print(chr(c),end="")
print()



Measured memory_bytes: 5724
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
using namespace std;
int main(){
  string a; cin >> a;
  vector<char> op(3);
  for(int bit=0; bit < 1<<3; bit++){
  	int x=a[0]-'0';
    for(int i=0;i<3;i++){
    	if((bit>>i)&1) {x+=a[i+1]-'0'; op[i]='+';}
    	else {x-=a[i+1]-'0';op[i]='-';}
    }
    if(x==7){
      printf("%c%c%c%c%c%c%c=7",a[0],op[0],a[1],op[1],a[2],op[2],a[3]);
      //ans+="=7"; cout << ans << endl; return 0;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
///
// File:  2582.cpp
// Author: ymiyamoto
//
// Created on Fri Nov 10 21:04:04 2017
//

#include <cstdint>
#include <iostream>
#include <string>

using namespace std;

enum status_t {
  BothOnFloor,
  RightOnFloor,
  LeftOnFloor,
  BothOnStand,
};

int32_t main()
{
  while (true) {
    uint32_t n;
    cin >> n;
    if (n == 0) break;

    status_t old_status = BothOnFloor;
    status_t status = BothOnFloor;
    uint32_t count = 0;
    for (uint32_t i = 0; i < n; i++) {
      string str;
      cin >> str;
      if (str == "lu") {
        if (status == BothOnFloor) {
          status = RightOnFloor;
        } else if (status == LeftOnFloor) {
          status = BothOnStand;
        }
      } else if (str == "ru") {
        if (status == BothOnFloor) {
          status = LeftOnFloor;
        } else if (status == RightOnFloor) {
          status = BothOnStand;
        }
      } else if (str == "ld") {
        if (status == BothOnStand) {
          status = LeftOnFloor;
        } else if (status == RightOnFloor) {
          status = BothOnFloor;
        }
      } else {
        if (status == BothOnStand) {
          status = RightOnFloor;
        } else if (status == LeftOnFloor) {
          status = BothOnFloor;
        }
      }

      if (old_status != status && (status == BothOnStand || status == BothOnFloor)) {
        count++;
        old_status = status;
      }
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 3124
import java.util.*;
public class Main {

		static void solve() {
			Scanner sc = new Scanner(System.in);
			int n = sc.nextInt();
			int[] array = new int [n];
			int ans = 0;
			for(int i = 0;i<n;i++) {
				array[i] = sc.nextInt();
			}
			sc.close();
			for(int j = 0;j<n+1;j++) {
			for(int i = 0;i<n;i++) {
				if(array[i]%2==0 && array[i] !=2) {
					array[i]/=2;
					ans++;
				}
				else {
					array[i]*=3; 
				}
			}
		}
			System.out.println(ans);
		}
	
	public static void main(String[] args) {
		solve();
	}

}

Measured memory_bytes: 34152
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long long n;
  cin >> n;
  long long a[n-1];
  rep(i,n-1)a[i]=0;
  long long u;
  long long p=998244353,ans=1;
  cin >> u;
  if(u!=0){
    cout << 0 << endl;
    return 0;
  }
  rep(i,n-1){
    long long j;
    cin >> j;
    if(j==0){
      cout << 0 << endl;
      return 0;
    }
    j--;
    a[j]++;
  }
  rep(i,n-2){
    long long b=a[i],c=a[i+1];
    if(c==0)continue;
    else{
      rep(o,c)ans=ans*b%p;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP_(i, a_, b_, a, b, ...) for (int i = (a), lim_i = (b); i < lim_i; i++)
#define REP(i, ...) REP_((i), __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Sat Mar  7 21:00:01 JST 2020
 **/

signed main() {
    Int n, a, b;
    cin >> n >> a >> b;
    Int ans = a * (n / (a + b));
    Int rem = n % (a + b);
    ans += min(rem, a);
    cout << ans << endl;
}


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

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

int main() {
    int r = 0, n;
    cin >> n;
    map<int, vector<int>> m;
    for (int i = 0; i < n; ++i) {
        int a;
        scanf("%d", &a);
        r ^= a;
        int u = __builtin_ffs(a);
        if(m[u-1].empty()) m[u-1].emplace_back(a);
    }
    int x = 1 << 30, ans = 0;
    for (int p = 30; p  >= 0; --p) {
        if(r & x){
            if(m[p].empty()) {
                puts("-1");
                return 0;
            }else {
                r ^= m[p][0];
                r ^= (m[p][0]-1);
                ans++;
            }
        }
        x /= 2;
    }
    cout << ans << "\n";
    return 0;
}


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

using ll = long long;
// #define int long long

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, r, n) for(int i = (n); i >= (r); --i) // from n to r
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
/***** MAIN *****/
signed main() {
  int h, n;
  cin >> h >> n;
  int waza[n];
  REP(i,n) {
    cin >> waza[i];
    h -= waza[i];
  }
  if(h <= 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  
  
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 640
#include <iostream>
#include <string>

using namespace std;

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

    // 標準入力から、空白や改行で区切られた整数と文字列を読み込む。
    cin >> a >> b ;
    c = a * b ;
    if (c % 2 == 0){
      cout << "Even" << endl;
    }
    else{
      cout << "Odd" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cstdlib>
#include <stack>
#include <random>

using namespace std;

typedef long long ll;


int a[30], b[30];


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for (int i = 0; i < n; i++)
        b[s[i] - 'a']++;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        a[s[i] - 'a']++;
        b[s[i] - 'a']--;
        int k = 0;
        for (int j = 0; j < 30; j++)
            if (a[j] * b[j])
                k++;
        ans = max(k, ans);
    }
    cout << ans;
    return 0;
}
















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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

//-----------------------------------------------------------------------------

int n;
int a[100000];
map<int,int> mp;

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

	cin>>n;
	REP(i,n) {
		cin>>a[i];
		mp[a[i]]=i;
	}
	sort(a,a+n);
	int cnt=0;
	REP(i,n) {
		if((i&1)!=(mp[a[i]]&1)) cnt++;
	}
	cout<<cnt/2<<endl;

	return 0;
}


Measured memory_bytes: 5376
#include <stdio.h>

int main(void){
    long long x, ans;

    scanf("%lld", &x);
    
    ans = x / 11 * 2;
    x %= 11;

    if(x <= 6 && x > 0){
        printf("%lld", ans + 1);
    }else if(x > 6){
        printf("%lld", ans + 2);
    }else{
        printf("%lld", ans);
    }
    
    return 0;
}

Measured memory_bytes: 1732
#include <stdio.h>

int main()
{
    int N;
    scanf("%d", &N);

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

    int min = P[0];
    int flag = 0;
    for(i = 0; i < N; i++)
    {
        if(min >= P[i])
        {
            flag++;
            min = P[i];
        }


    }

    printf("%d", flag);

    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define MA make_pair
#define LL long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
//
int main(){
  int N;
  set<string> S;
  cin>>N;
  FOR(i,0,N){
    string T;
    cin>>T;
    if(T=="insert"){
      string key;
      cin>>key;
      S.insert(key);
    }else{
      string key;
      cin>>key;
      if(S.find(key)!=S.end()){
        cout<<"yes"<<endl;
      }else{
        cout<<"no"<<endl;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 32104