akhauriyash/Code-Regression huggingface dataset:
# import bisect
import unittest
from io import StringIO
# https://note.nkmk.me/python-scipy-connected-components/
from collections import Counter, deque
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    def main():
        n = int(input())
        D = list(map(int, input().split()))
        cnts=[0]*(max(D)+1)
        for i in D:
            cnts[i]+=1

        if cnts[0]!=1 or D[0]!=0: return 0
        ans=1

        for i in range(2,max(D)+1):
            if cnts[i]==0:
                return 0
            ans*=cnts[i-1]**cnts[i]

        return ans % 998244353

    print(main())

# 
resolve()

Measured memory_bytes: 66196
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
#define INF 1e18
using namespace std;

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

const int MAX_N=1<<17;
int N,dat[2*MAX_N-1];

void init(int n)
{
    N=1; while(N<n) N*=2;
    REP(i,2*N-1) dat[i]=INT_MAX;
}

void update(int k,int value)
{
    k+=N-1; dat[k]=value;
    while(k>0){
	k=(k-1)/2;
	dat[k]=min(dat[2*k+1],dat[2*k+2]);
    }
}

int getMin(int a,int b,int k,int l,int r)
{
    if(r<=a or b<=l) return INT_MAX;
    if(a<=l and r<=b) return dat[k];

    int vl=getMin(a,b,2*k+1,l,(l+r)/2);
    int vr=getMin(a,b,2*k+2,(l+r)/2,r);
    return min(vl,vr);
}

signed main()
{
    int n,q; cin>>n>>q;
    init(n);
    REP(i,q){
	int com,x,y; cin>>com>>x>>y;
	if(com==0)
	    update(x,y);
	else
	    cout<<getMin(x,y+1,0,0,N)<<endl;
    }

}



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


def gen(path, maxOrd):
    if len(path) == N:
        print("".join(chr(ord("a") + x) for x in path))
    else:
        for x in range(maxOrd + 2):
            path.append(x)
            gen(path, max(maxOrd, x))
            path.pop()


gen([], -1)



Measured memory_bytes: 61912
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
#define chmin(a, b) ((a)=min((a), (b)))
#define chmax(a, b) ((a)=max((a), (b)))
#define fs first
#define sc second
#define eb emplace_back
using namespace std;

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

const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
const double eps=1e-10;

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

int main(){
    int a, p; cin>>a>>p;
    a *= 3;
    cout << (a + p) / 2 << endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e16+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int fac[2500], finv[2500], inv[2500];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < 2500; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
int COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
signed main() {
    int N,K;
    cin >> N >> K;
    COMinit();
    for(int i = 1; i <= K; i++) {
        int ans = COM(N-K+1,i);
        ans *= COM(K-1,i-1);
        cout << ans%mod << endl;
    }
}


Measured memory_bytes: 3688
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,z,w;
  cin >> n >> z >> w;
  vector<ll> a(n);
  for(int i = 0;i < n;i++)cin >> a[i];
  if(n != 1)cout << max(abs(a[n - 1] - w),abs(a[n - 1] - a[n - 2])) << endl;
  else cout << abs(a[0] - w) << endl;
}

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

char s[4];

int main()
{
	scanf("%s", &s);
	if (s[0] == s[1] && s[1] == s[2])puts("Yes");
	else if (s[1] == s[2] && s[2] == s[3])puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;

void solve()
{
  int a,b,c;
  cin >> a >> b >> c;
  if(b-a == c-b)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}

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


Measured memory_bytes: 256
from math import ceil

N, H = map(int, input().split())

max_A = 0
B = []
for i in range(N):
    a, b = map(int, input().split())
    max_A = max(max_A, a)
    B.append(b)

B.sort(reverse=True)

ans = 0
for b in B:

    if H <= 0:
        print(ans)
        exit()

    if b > max_A:
        H -= b
        ans += 1
    else:
        break

print(ans + ceil(H / max_A))


Measured memory_bytes: 7440
n,m,Q = map(int,input().split())
a = []
for i in range(n+1):
  a.append([0]*(n+1))

s = a[:]

for i in range(m):
  l,r = map(int,input().split())
  a[l][r] += 1

for l in range(1,n+1):
  for r in range(1,n+1):
    s[l][r] = a[l][r] + s[l-1][r] + s[l][r-1] - s[l-1][r-1]

for i in range(Q):
  p,q = map(int,input().split())
  print(s[q][q] - s[p-1][q] - s[q][p-1] + s[p-1][p-1])

Measured memory_bytes: 14884
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
#include <unordered_map>
using namespace std;

const int N = 200010;
int a[N], b[N], c[N];
int ans[N];

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

	for (int bit = 29; bit >= 0; bit--) {
		for (int j = 2; j <= n; j++) {
			int x = a[1] ^ a[j];
			if (x & (1 << bit)) b[j] = 1;
			else b[j] = 0;
		}
		for (int i = 0; i < 2; i++) {
			c[1] = i;
			for (int j = 2; j <= n; j++)
				c[j] = b[j] ^ c[1];
			int tot = 0;
			for (int j = 1; j <= n; j++)
				tot ^= c[j];
			bool flag = true;
			for (int k = 1; k <= n; k++) {
				int x = tot ^ c[k];
				if (x == ((a[k] >> bit) & 1)) continue;
				else {
					flag = false;
					break;
				}
			}
			if (flag) {
				ans[1] |= (1 << bit) * i;
				break;
			}
		}
	}
	for (int i = 2; i <= n; i++)
		ans[i] = ans[1] ^ (a[1] ^ a[i]);
	for (int i = 1; i <= n; i++)
		printf("%d%c", ans[i], i == n ? '\n' : ' ');
	return 0;
}


Measured memory_bytes: 6236
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace d
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, k;
            {
                var si = Console.ReadLine().Split(' ');
                n = int.Parse(si[0]);
                k = int.Parse(si[1]);
            }
            string s = Console.ReadLine();

            List<int> ones = new List<int>();
            List<int> zeros = new List<int>();

            bool readingOne = true;
            if (s[0] == '0')
            {
                readingOne = false;
                ones.Add(0);
            }

            int index = 0;
            while (index < s.Length)
            {
                int start = index;
                while (index < s.Length && ((readingOne && s[index] == '1') || (!readingOne && s[index] == '0')))
                    index++;
                // index will be next index
                int cnt = index - start;
                if (readingOne)
                {
                    ones.Add(cnt);
                } else
                {
                    zeros.Add(cnt);
                } 
                readingOne = !readingOne;
            }

            if (readingOne)
                ones.Add(0);

            while (zeros.Count < k)
            {
                ones.Add(0);
                zeros.Add(0);
            }

            Debug.Assert(ones.Count == zeros.Count + 1);

            int ret = 0;
            int cur = 0;
            for (int i = 0; i < k; i++)
            {
                cur += ones[i];
                cur += zeros[i];
            }
            cur += ones[k];

            ret = cur;
            for (int i = 0; i + k < zeros.Count; i++)
            {
                cur -= ones[i];
                cur -= zeros[i];

                cur += ones[i + k + 1];
                cur += zeros[i + k];
                ret = Math.Max(ret, cur);
            }

            Console.WriteLine("{0}", ret);
        }
    }
}


Measured memory_bytes: 14432
n = int(input())
a = [int(input()) for i in range(n)]

max_value = max(a)
max_index = a.index(max_value)

for i in range(n):
    if not i == max_index:
        print(max_value)
    else:
        newlist = a[:i] + a[i+1:]
        print(max(newlist))


Measured memory_bytes: 15604
<?php
list($x1,$y1,$x2,$y2)=explode(" ",trim(fgets(STDIN)));
$x=$x2-$x1;
$y=$y2-$y1;
$x3=$x2-$y;
$y3=$y2+$x;
$x4=$x3-$x;
$y4=$y3-$y;
echo $x3." ".$y3." ".$x4." ".$y4;

Measured memory_bytes: 4728
N, x = map(int, input().split())
a_list = list(map(int, input().split()))

a_list.sort()
sum_num = 0
for i in range(N):
    item = a_list[i]
    if x >= item:
        if i != N-1:
            sum_num += 1
            x -= item
        elif x == item:
            sum_num += 1
            x -= item
    else:
       break
print(sum_num)

Measured memory_bytes: 3316
#ifdef debug
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

#define vec vector
#define ALL(x) begin(x), end(x)

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

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

int main() {

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

    int n;

    scanf("%d", &n);

    vec< int > p(n);

    ll res = 0;

    vec< vec< int > > seq(n);

    for(int i = 0;i < n;i++) {
        scanf("%d", &p[i]);
        if(p[i] > i) {
            puts("-1");
            return 0;
        }
        seq[i - p[i]].push_back(i);
    }

    for(int last = -1, i = 0;i < n;i++) {
        if(seq[i].empty()) continue;
        if(seq[i].front() <= last) {
            puts("-1");
            return 0;
        }
        for(int j = 0;j + 1 < (int)seq[i].size();j++) {
            if(seq[i][j] + 1 != seq[i][j + 1]) {
                puts("-1");
                return 0;
            }
        }
        res += p[seq[i].back()];
        last = seq[i].back();
    }

    printf("%lld\n", res);

    return 0;
}


Measured memory_bytes: 11904
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
using namespace std;

stack<string> s;

int cnt = 0;
int max_cha(string upper) {
    char temp = -1;
    for (int i = 0; i < upper.size(); i++) {
        temp = max(temp, upper[i]);
    }
    return temp;
}
void hyojun(int N) {

    if (s.top().size() == N) {
        cnt++;
        //cout << cnt<<"  ";
        cout << s.top() << endl;
        s.pop();
    }
    else {
        string upper = s.top();
        s.pop();

        for (char c = max_cha(upper) + 1; c >= 'a'; c--)
            s.push(upper + c);
    }

    if (!s.empty())
        hyojun(N);

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

    s.push("a");
    hyojun(N);
}


Measured memory_bytes: 17024
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>
#include <bitset>

using namespace std;
typedef long long ll;

int main() {
  int N;
  cin >> N;
  vector<pair<int, int> > R;
  for (int i = 0; i < N; ++i) {
    int X, L;
    cin >> X >> L;
    R.push_back(make_pair(X + L, X - L));
  }
  sort(R.begin(), R.end());

  int cnt = 1;
  int prev = 0;
  for (int i = 1; i < N; ++i) {
    if (R[prev].first <= R[i].second) {
      prev = i;
      ++cnt;
    }
  }
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
 
using namespace std;
const int N = 100005;
typedef long long ll;
int a[N];
double b[N];
int main()
{
     int n,maxa=-1;
     cin>>n;
     for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    double mid=1.0*a[n]/2,minb=1000000009.0;
    int ans;
    for(int i=1;i<n;i++){
       // printf("%lf\n",mid-(1.0*a[n]-1.0*a[i]));
        if(fabs(mid-(1.0*a[n]-1.0*a[i]))<minb)
        {
            ans=a[i];
            minb=fabs(mid-(1.0*a[n]-1.0*a[i]));
        }
    }
    printf("%d %d\n",a[n],ans);
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<map>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<set>
#include<list>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<limits>
#include<unordered_map>
#include<cctype>
#pragma warning(disable:4996)
using namespace std;

#define debug(i) cout<<"<debug> "<<#i<<" "<<i<<" <\\debug>"<<endl
#define mfor(i,a,b) for(int i=(a);i<=(b);i++)
#define mrep(i,a,b) for(int i=(a);i>=(b);i--)
#define lll __int128
#define Re register
#define mem(a,b) memset(a,(b),sizeof(a))
#define Design ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define endl '\n'
typedef pair<int, int> intpair;
typedef pair<long long int, long long int> llpair;
typedef long long int ll;
const int INF = 0x3f3f3f3f;
const long long int INFLL = 0x3f3f3f3f3f3f3f3f;
//#pragma comment(linker, "/STACK:1024000000,1024000000") 

ll x[200010];
ll a[200010];
ll d[200010];	//差分数组
ll f[200010];
ll res[200010];
double ans[200010];

int main()
{
	Design;
	ll n, m, k;
	cin >> n;
	mfor(i, 1, n) cin >> x[i], d[i] = res[i] = i;
	cin >> m >> k;
	mfor(i, 1, m) cin >> a[i];
	mfor(i, 1, m) swap(d[a[i]], d[a[i] + 1]);
	for (ll i = k; i; i >>= 1)
	{
		//debug(i);
		if (i & 1)
		{
			mfor(i, 1, n) f[i] = res[d[i]];
			mfor(i, 1, n) res[i] = f[i];
		}
		mfor(i, 1, n) f[i] = d[d[i]];
		mfor(i, 1, n) d[i] = f[i];
	}
	mfor(i, 1, n)
	{
		ans[i] = x[res[i]] - x[res[i] - 1] + ans[i - 1];
	}
	mfor(i, 1, n) cout << fixed << setprecision(10) << ans[i] << endl;
}


Measured memory_bytes: 7932
# -*- coding: utf-8 -*-
import sys
n, k = map(int, input().split())
k_max = (n - 2) * (n - 1) // 2

if k > k_max:
    print(-1)
    sys.exit()

m = n - 1 + k_max - k

print(m)
cnt = 0
exit_flag = False
for i in range(1, n):
    for j in range(i + 1, n + 1):
        print(i, j)
        cnt += 1
        if cnt == m:
            exit_flag = True
            break
    if exit_flag:
        break

Measured memory_bytes: 43376
#include<iostream>

using namespace std;

int main() {
	int x[6], ans;;

	for (int i = 1; i <= 5; i++) {
		cin >> x[i];
		if (x[i] == 0) {
			ans = i;
		}
	}
	cout << ans << endl;

	return 0;
}

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

#define LL long long
#define LD long double
#define SC(t,x) static_cast<t>(x)
#define AR(t) vector < t >
#define PII pair < int, int >
#define PLL pair < LL, LL >
#define PIL pair < int, LL >
#define PLI pair < LL, int >
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define PRF first
#define PRS second
#define INIT(ar,val) memset ( ar, val, sizeof ( ar ) )
#define lp(loop,start,end) for ( int loop = start; loop < end; ++loop )
#define lpd(loop,start,end) for ( int loop = start; loop > end; --loop )
#define lpi(loop,start,end) for ( int loop = start; loop <= end; ++loop )
#define lpdi(loop,start,end) for ( int loop = start; loop >= end; --loop )
#define qmax(a,b) (((a)>(b))?(a):(b))
#define qmin(a,b) (((a)<(b))?(a):(b))
#define qabs(a) (((a)>=0)?(a):(-(a)))

const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;

int a1, a2, a3, a4, a5, a6, a7;

void init ();
void input ();
void work ();



int main()
{
	init();
	input();
	work();
}



void init ()
{
	// Init Everything Here
	
	ios::sync_with_stdio ( false );
}

void input ()
{
	// input method
	
	cin >> a1 >> a2 >> a3 >> a4 >> a5 >> a6 >> a7;
}

void work ()
{
	// main work
	
	LL ans = SC ( LL, a2 ) + ( a4 >> 1 << 1 ) + ( a5 >> 1 << 1 );
	if ( ( ( a4 & 1 ) ^ ( a5 & 1 ) ) && ( a1 & 1 ) && ( a4 && a5 ) ) ++ans, --a1;
	else if ( ( a4 & 1 ) && ( a5 & 1 ) && a1 ) --a1, ans += 3;
	ans += a1 >> 1 << 1;
	
	cout << ans << endl;
}

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

int main()
{
  int N,M;
  std::cin>>N>>M;
  
  std::vector<int> H(N);
  for(auto &e:H)
  {
    std::cin>>e;
  }
  
  std::vector<bool> great(N,true);
  for(int i=0;i!=M;i++)
  {
    int A,B;
    std::cin>>A>>B;
    A--;
    B--;
    
    if(H[A]<H[B])
    {
      great[A]=false;
    }
    else if(H[A]>H[B])
    {
      great[B]=false;
    }
    else
    {
      great[A]=false;
      great[B]=false;
    }
  }
  
  int result=0;
  for(auto e:great)
  {
    if(e)
    {
      result++;
    }
  }
  
  std::cout<<result<<std::endl;
  
  return 0;
}

Measured memory_bytes: 3760
/*
ID: jerrywcy
LINK:
LANG: C++
STATUS:
*/
#include <bits/stdc++.h>

#define init(array,x) memset(array,x,sizeof(array))

using namespace std;

typedef long long ll;

const int inf=0x3f3f3f3f;

int n,m;
string s,t;
ll ans;
int cnt[2][26];
vector<int> v[26];

int read(){
    int f=1,x=0;
    char ss=getchar();
    while(ss<'0'||ss>'9'){if(ss=='-')f=-1;ss=getchar();}
    while(ss>='0'&&ss<='9'){x=x*10+ss-'0';ss=getchar();}
    return f*x;
}

int main()
{
	ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
    cin>>s;n=s.size();
    cin>>t;m=t.size();
    if (s==t){cout<<n<<endl;return 0;}
    for (int i=0;i<n;i++){v[s[i]-'a'].push_back(i);cnt[0][s[i]-'a']++;}
    for (int i=0;i<m;i++)cnt[1][t[i]-'a']++;
    for (int i=0;i<26;i++)if (cnt[1][i] && !cnt[0][i]){cout<<-1<<endl;return 0;}

    int j=0;
    while (1){
        int pos=-1;
        while (j<m && *--v[t[j]-'a'].end()>pos){
            pos=*upper_bound(v[t[j]-'a'].begin(),v[t[j]-'a'].end(),pos);
    //        cout<<pos<<' '<<j<<endl;
            j++;
        }
        if (j==m){cout<<ans+pos+1<<endl;return 0;}
        ans+=n;
//        cout<<ans<<endl;
    }

	return 0;
}


Measured memory_bytes: 1228
#include <bits/stdc++.h>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long int ll;
typedef unsigned long long int ull;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> o_set; 

#define     int                 ll
#define     pb                  push_back
#define     mp                  make_pair
#define     xx                  first
#define     yy                  second    
#define     all(a)              a.begin(),a.end()
#define     vi                  vector<int>
#define     vpi                 vector<pii>
#define     pii                 pair<int, int>
#define     present(DT, val)    (DT.find(val) != DT.end()) //for set and map
#define     cpresent(DT, val)   (find(all(DT),val) != DT.end()) //vectors
#define     input               "/home/pollution/Desktop/WorkSpace/C++/Files/input.txt"
#define     output              "/home/pollution/Desktop/WorkSpace/C++/Files/output1.txt"
#define     error               "/home/pollution/Desktop/WorkSpace/C++/Files/error.txt"
#define     IO()                ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define     INF                 2e18
#define     MOD                 1000000007
#define     clr(x)              memset(x, 0, sizeof(x))
#define     init(x, a)          memset(x, a, sizeof(x))
#define     out(a)              for (auto i: a) cout<<i<<' '; cout<<'\n'
#define     cpy(a,b)            memcpy(a,b,sizeof(b))
#define     is(a)               to_string(a)
#define     ci(a,c)             a-c
#define     debug(i)            cout<<"point :"<<i<<'\n';
#define     setd(val,n)         cout<<fixed<<setprecision(n)<<val<<'\n'

void solve(){
    int x,y,a,b,c; cin>>x>>y>>a>>b>>c;
    vi p(a),q(b),r(c);
    for(int i = 0; i < a; ++i) cin>>p[i];
    for(int i = 0; i < b; ++i) cin>>q[i];
    for(int i = 0; i < c; ++i) cin>>r[i];
    sort(all(p));
	sort(all(q));
	sort(all(r));
	reverse(all(p));
	reverse(all(q));
	reverse(all(r));
	int i1=x-1,i2=y-1, ans = 0;
	for(int i = 0; i < x; ++i) ans+=p[i];
	for(int i = 0; i < y; ++i) ans+=q[i];
	for(int i = 0; i < c; ++i){
		if(i1>=0 && i2>=0){
			if(ans <= ans-p[i1]+r[i] && ans-p[i1]+r[i] >= ans-q[i2]+r[i]){
				ans=ans-p[i1]+r[i];
				i1--;
			}
			else if(ans <= ans-q[i2]+r[i] && ans-p[i1]+r[i]<=ans-q[i2]+r[i]){
				ans=ans-q[i2]+r[i];
				i2--;
			}
			else break;
		}
		else if(i1>=0){
			if(ans-p[i1]+r[i]>=ans){
				ans=ans-p[i1]+r[i];
				i1--;
			}
			else break;
		}
		else if(i2>=0){
			if(ans-q[i2]+r[i]>=ans){
				ans=ans-q[i2]+r[i];
				i2--;
			}
			else break;	
		}
		else break;
	}
	cout<<ans<<'\n';
}

signed main() { 
    IO();
    
    int t=1;
    // cin>>t;
    while(t--) solve();
    return 0; 
}


Measured memory_bytes: 2560
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  int n;
  scanf("%d", &n);

  llong ans = 0;
  REP(i,n){
    int tmp;
    scanf("%d", &tmp);
    ans += tmp - 1;
  }

  printf("%lld\n", ans);
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int prime_check(long num) {
    int i;

    if (num==2) return 1;
    if (num%2==0) return 0;

    for (i=3;i<=num/i;i+=2) {
        if (num%i==0) return 0;
    }
    return 1;
}

int main(void) {
    int i, n, boo, count;
    long num;

    scanf("%d", &n);
    count=0;
    for (i=0; i<n; i++) {
        scanf("%ld", &num);
        boo=prime_check(num);
        if (boo==1) count++;
    }
    printf("%d\n", count);
    return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include<bits/stdc++.h>
#include<cmath>
#include <algorithm> 
#include <unordered_map>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long n,d;
	cin >> n;
	string s;
	cin >> s;
	long long red=0;
	long long white = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			red++;
		}
	}
	for (int i = 0; i < red; i++) {
		if (s[i] == 'W') {
			white++;
		}
	}
	cout << white;
	return 0;
}

Measured memory_bytes: 3720
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <utility>
using namespace std;
//#define local
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int n,i,j,ans=1000000,a[110];
    cin>>n;
    for(i=0; i<n; i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=a[0]; i<=a[n-1]; i++)
    {
        int sum=0;
        for(j=0; j<n; j++)
            sum+=(a[j]-i)*(a[j]-i);
        ans=min(ans,sum);
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int mod = 1000000007;
const int INF = 1001001001;
vector<vector<int>> dp;

int main(){
    int h,n;
    cin >> h >> n;
    vector<int> a(n,0);
    vector<int> b(n,0);
    int amax = 0;
    rep(i,n){
      cin >> a.at(i) >> b.at(i);
      amax = max(amax,a.at(i));
    }
    vector<vector<int>> dp(n+1,vector<int>(h+1+amax,INF));

    rep(i,h+1+amax) dp.at(0).at(i) = (i+a[0]-1)/(a[0])*b[0];
 
    for(int i=1;i<n;i++){
        for(int j=0;j<=h+amax;j++){
                dp[i][j] = min(dp[i-1][j], dp[i][j-a[i]]+b[i]);
        }
    }
    int minans=INF;
    for(int j=h;j<h+amax;j++){
      minans = min(minans,dp[n-1][j]);
    }
    cout << minans << endl;
}

Measured memory_bytes: 44160
unittest
{
	assert( [ "5", "6 9 4 2 11" ].parse.expand.solve == "11 6" );
	assert( [ "2", "100 0" ].parse.expand.solve == "100 0" );
}



import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	as.sort();
	
	auto n = as[ $ - 1 ];
	as.popBack;
	auto c = n * 0.5L;
	auto r = long.max;
	foreach( a; as )
	{
		if( ( c - a ).abs < ( c - r ).abs ) r = a;
	}
	return format( "%s %s", n, r );
}


Measured memory_bytes: 7080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        long a = in.nextLong();
        long b = in.nextLong();
        long c = in.nextLong();
        long k = in.nextLong();

        long answer = 0;
        if (k >= a) {
            answer = a;
            k -= a;
        } else {
            answer = k;
            k = 0;
        }

        if (k >= b) {
            k -= b;
        } else {
            k = 0;
        }

        if (k >= c) {
            answer -= c;
        } else {
            answer -= k;
        }

        out.println(answer);
    }
}


Measured memory_bytes: 32752
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define yn(x, ok, ng) cout << ((x)?(ok):(ng)) << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
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 const INF = 1001001001;


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

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

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

mint dp[n+1][14];
dp[0][0] = 1;
reverse(s.begin(), s.end());
int ten = 1;
rep(i,n) {
    rep(j,14) {
        if(s[i] == '?') {
            rep(k,10) {
                dp[i+1][(j+(k*ten))%13] += dp[i][j];
            }
        }
        else {
            int k = s[i] - '0';
            dp[i+1][((j+k*ten))%13] += dp[i][j];
        }
    }
    ten = (ten * 10) % 13;
}

cout << dp[n][5] << endl;
return 0;
}

Measured memory_bytes: 11472
#include<stdio.h>

int main(){
	int i,j;
	int ans;
	char input[1025];
	int now; // 1:Left,2:Rigth

	while(1){
		scanf("%s",input);
		if(input[0] == '#')break;
		ans = -1;
		now = 0;
		for(i = 0;input[i] != '\0';i++){
			switch(input[i]){
				case 'q':
				case 'w':
				case 'e':
				case 'r':
				case 't':
				case 'a':
				case 's':
				case 'd':
				case 'f':
				case 'g':
				case 'z':
				case 'x':
				case 'c':
				case 'v':
				case 'b':
					if(now != 1)ans++;
					now = 1;
					break;
				case 'y':
				case 'u':
				case 'i':
				case 'o':
				case 'p':
				case 'h':
				case 'j':
				case 'k':
				case 'l':
				case 'n':
				case 'm':
					if(now != 2)ans++;
					now = 2;
					break;
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 540
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace SolutionCS
{
    class Program
    {
        class IntUnionFind
        {
            // 親の要素を指す配列
            int[] rootArray;

            // 初期化(最大要素数指定する)
            public IntUnionFind(int max_element)
            {
                rootArray = new int[max_element];
                for (int i = 0; i < rootArray.Length; i++)
                {
                    rootArray[i] = i;       // 自分自身を指す=root
                }
            }

            public bool IsRoot(int element)
            {
                return rootArray[element] == element;
            }

            // 要素の根を返す
            public int Root(int element)
            {
                // 要素インデックス=親の要素インデックスなら親、そうでないなら親をたどる
                if (rootArray[element] != element)
                {
                    // 根を取得
                    int r = Root(rootArray[element]);
                    // 根を付け替え
                    rootArray[element] = r;
                    // 根を返す
                    return r;
                }

                // 根を返す
                return element;
            }

            // 同じ根かどうかを返す
            public bool IsSameRoot(int element1, int element2)
            {
                return (Root(element1) == Root(element2));
            }

            // 要素を結合
            public void Unite(int element1, int element2)
            {
                int root1 = Root(element1);
                int root2 = Root(element2);

                if (root1 == root2)
                {
                    return;
                }

                rootArray[root1] = root2;
            }
        }


        static void Main(string[] args)
        {
            string[] inS = Console.ReadLine().Split(' ');
            int N = int.Parse(inS[0]);
            int M = int.Parse(inS[1]);

            IntUnionFind uf = new IntUnionFind(N);

            for (int i = 0; i < M; i++)
            {
                string[] inP = Console.ReadLine().Split(' ');
                int e0 = int.Parse(inP[0]) - 1;
                int e1 = int.Parse(inP[1]) - 1;

                uf.Unite(e0, e1);
            }

            int result = 0;

            for (int i = 0; i < N; i++)
            {
                if (uf.IsRoot(i))
                {
                    result++;
                }
            }

            Console.WriteLine("{0}", result);
        }
    }
}


Measured memory_bytes: 17472
#include<stdio.h>
#include<stdlib.h>
#define MAX 1000
#define WMAX 10000
#define miner(x, y) ((x) < (y) ? (x) : (y))
#define swap(x, y, type) do {type t = x; x = y; y = t;} while(0)
void qsort1(int, int, int*);
int mcsort(int, int, int*);
main()
{
        int i, n, min = WMAX, *w;
        scanf("%d", &n);
        w = (int*)malloc(sizeof(int) * n);
        for (i = 0; i < n; i++) {
                scanf("%d", &w[i]);
                min = miner(w[i], min);
        }
        printf("%d\n", mcsort(min, n, w));
        free(w);
}
void qsort1(int left, int right, int *s){
        int pivot = s[(left + right) / 2], i = left, j = right;
    if (left >= right) return;
    do {
        while (s[i] < pivot) i++;
        while (s[j] > pivot) j--;
        if (i <= j) {
            swap(s[i], s[j], int);
            i++;
            j--;
        }
    }while (i <= j);
    qsort1(left, j, s);
    qsort1(i, right, s);
}
int mcsort(int min, int n, int *w)
{
        int i, ans = 0, s[n], f[n], p[WMAX + 1];
        for (i = 0; i < n; i++) {
                s[i] = w[i];
                f[i] = 0;
        }
        qsort1(0, n - 1, s);
        for (i = 0; i < n; i++) {
        p[s[i]] = i;
    }
        for (i = 0; i < n; i++) {
                int cur = i, m = WMAX, sum = 0, cn = 0;
                if(f[i]) continue;
                while (!f[cur]) {
                        f[cur] = 1;
                        cn++;
                        m = miner(w[cur], m);
                        sum += w[cur];
                        cur = p[w[cur]];
                }
                ans += miner(sum + (cn - 2) * m, sum + m + (cn + 1) * min);
    }
        return ans;
}


Measured memory_bytes: 1848
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <map>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<int> H(N);
    for(int i=0; i<N; i++) {
        cin >> H[i];
    }
    vector< vector<int> > g(N);
    while(M--) {
        int A, B;
        cin >> A >> B;
        --A; --B;
        g[A].emplace_back(B);
        g[B].emplace_back(A);
    }

    int ans = 0;
    for(int i=0; i<N; i++) {
        bool ok = true;
        for(auto u: g[i]) {
            if(H[u] >= H[i]) ok = false;
        }
        if(ok) ++ans;
    }

    cout << ans << endl;
    return 0;
}


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

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

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

const int MAX = 1e5 + 5;
const int INF = 1001001001;
const int MOD = 1e9 + 7;

int main(){
    string s;
    cin >> s;

    bool ans = s[0] != s[1] || s[1] != s[2];

    if (ans) puts("Yes");
    else puts("No");
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define MOD 1000000007
#define cey ce("Yes")
#define cen ce("No")
#define ceY ce("YES")
#define ceN ce("NO")
vector<bool[26]> K(1100000);
int indexes = 0;

void update(int i, char c, char pre) {

	int j = indexes + i;

	K[j][pre - 'a'] = false;
	K[j][c - 'a'] = true;

	while (j / 2 > 0) {
		fx(26) {
			K[j / 2][x] = K[j / 2 * 2][x] | K[j / 2 * 2 + 1][x];
		}
		j /= 2;
	}

}

int search(int a, int b, int k, int l, int r, bool ans[26]) {

	if (r < a || b < l) {
		fx(26) {
			ans[x] = false;
		}
		return INT_MAX;
	}
	if (a <= l && r <= b) {
		fx(26) {
			ans[x] = K[k][x];
		}
		return 0;
	}
	bool ans1[26] = { false, };
	bool ans2[26] = { false, };

	int vl = search(a, b, k * 2, l, (l + r) / 2, ans1);
	int vr = search(a, b, k * 2 + 1, (l + r) / 2 + 1, r, ans2);
	fx(26) {
		ans[x] = ans1[x] | ans2[x];
	}
	return min(vl, vr);
}

int main()
{
	int N, Q;
	string S;
	cin >> N >> S >> Q;
	int i = N;
	while (i > 0) {
		i /= 2;
		indexes++;
	}
	if ((int)pow(2, indexes - 1) == N) {
		indexes = (int)pow(2, indexes - 1);
	}
	else {
		indexes = (int)pow(2, indexes);
	}

	fx(N) {
		update(x, S[x], S[x]);
	}

	fx(Q) {
		int a;

		cin >> a;
		if (a == 1) {
			int b;
			char c;
			cin >> b >> c;
			update(b - 1, c, S[b - 1]);
			S[b - 1] = c;
		}
		else {
			int b, c;
			cin >> b >> c;
			bool d[26] = { false, };
			search(b - 1, c - 1, 1, 0, indexes - 1, d);
			int ans = 0;
			fy(26) {
				if (d[y])
					ans++;
			}
			ce(ans)
		}
	}

	return 0; 
}


Measured memory_bytes: 28804
import java.util.*;
import java.io.*;
class Main {
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        int n = sc.nextInt();
        p((int)Math.ceil((double)n/(double)2));
    }
    public static String stringCopy(String str) {
        StringBuilder builder = new StringBuilder();
        builder.append(str.toCharArray());
        return builder.toString();
    }
    public static <T> void p(T element) {
	System.out.println(element);
    }
    public static <T> void pp(T element) {
        System.out.print(element);
    }
    public static int min(int a, int b, int c) {
	int min = Math.min(a,b);
	min = Math.min(min,c);
	return min;
    }
    public static int max(int a, int b,int c) {
	int max= Math.max(a,b);
	max = Math.max(max,c);
        return max;
    }
}
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
 
    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }
 
    private boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
 
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }
 
    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
 
    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
 
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }
 
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}

Measured memory_bytes: 22996
#include<stdio.h>
#include<math.h>
int main(void){
	
	int i,n,j,anum=0;
	float ans[10000];
	for(i=0;i<10000;i++){
		scanf("%d",&n);
		if(n==0)break;
		anum++;
		float tensu[n];
		float ave=0.0,alfa=0.0;
		for(j=0;j<n;j++){
			scanf("%f",&tensu[j]);
		}
		for(j=0;j<n;j++){
			ave+=tensu[j];
		}
		ave/=n;
		for(j=0;j<n;j++){
			tensu[j]=(tensu[j]-ave)*(tensu[j]-ave)/n;
		}
		for(j=0;j<n;j++){
			alfa+=tensu[j];
		}
		ans[i]=sqrt(alfa);
	}
	for(i=0;i<anum;i++){
		printf("%f\n",ans[i]);
	}
	return 0;
}


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

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

    if (N % 2 == 1)
        cout << 0 << endl;
    else {
        ll ans = 0;
        for (ll i = 5; i <= N; i *= 5) {
            ans += N / 2 / i;
        }
        cout << ans << endl;
    }
}

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

int main()
{
    int K;
   string str; 
    cin>>K;
    cin>>str;

    if(str.size()<=K)
    {
        cout<<str<<endl;
    }
    else
    {
        string temp= str.substr(0,K)+"...";
        cout<<temp<<endl;
    }
    


}
    

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

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

typedef long long ll;

int main() {
  string s;
  cin >> s;

  if(s == "Sunny") cout << "Cloudy" << endl;
  if(s == "Cloudy") cout << "Rainy" << endl;
  if(s == "Rainy") cout << "Sunny" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string op;
  int A,B;
  cin >> A >> op >> B;
  int result;
  
  if (op == "+"){
    result = A + B;
  }
  else if(op == "-"){
    result = A - B;
  }
  
  cout << result << endl;
}
 

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

#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define forn(i,n) for(ll i=0;i<n;i++)
#define fore(i,a,b) for(ll i=a;i<=b;i++)
#define ford(i,n) for(ll i=n-1;i>=0;i--)
#define fi first
#define se second
#define endl "\n"
#define all(a) a.begin(),a.end()
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PI 3.14159265

/******************************************************************************************************/
void file(){
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
}
/******************************************************************************************************/

const ll nax=2e5+1,mod=1e9+7;



int main(){

    sync
   // file();
    
    string s,t;
    cin>>s>>t;
    ll n = s.size(),m = t.size();
    vector< vector<ll> > v(26);
    forn(i,n){
        v[s[i]-'a'].pb(i+1);
    }
    ll prev = 0;
    ll ans = 0;
    for(auto it:t){
        if(v[it-'a'].empty()){
            cout<<-1;
            return 0;
        }
        else{
            auto ii = upper_bound(all(v[it-'a']),prev);
            if(ii==v[it-'a'].end()){
                ans++; prev = 0;
                auto ii = upper_bound(all(v[it-'a']),prev);
                prev = *ii;
            }
            else{
                prev = *ii;
            }
    }
    } 
    cout<<ans*n+prev;     

  return 0;
}

Measured memory_bytes: 1736
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < k; i++) {
            int l = sc.nextInt();
            for (int j = 0; j < l; j++) {
                int num = sc.nextInt()-1;
                array[num]++;
            }
        }
        
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (array[i] == 0) count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 46100
N = int(input())
T = list(map(int,input().split()))
M = int(input())
K = T
a = 0
for i in range(M):
    L = K
    P,X = map(int,input().split())
    a = L[P-1] 
    L[P-1] = X
    print(sum(L))
    L[P-1] = a

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Linq;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var d_list = new List<int>();
            for(int i=0;i<N;i++){
                d_list.Add(int.Parse(Console.ReadLine()));
            }
            //sort
            d_list.Sort();
            int num = 1;
            for(int i=1;i<N;i++){
                if(d_list[i]>d_list[i-1]) num++;
            }
            Console.WriteLine(num);
        }
    }
}


Measured memory_bytes: 13268