akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int K = sc.nextInt();
		
		
	
	
	
	final String base36 = Integer.toString(N, K);
	
	System.out.println(base36.length());
	
}
}



Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.141592653589793;
const long double DEL = 1e-10;
const int mod =  1000000007;

#define fio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mpq priority_queue<int,vector<int>,greater<int>>
#define deb(a) cerr << #a << ": " << a << endl
#define vvpii vector<vector<pair<int,int>>>
#define ftt cin>>t;for(int tt=1;tt<=t;++tt)
#define Rev(v) reverse(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end())
#define mem(a,b) memset(a,b,sizeof(a))
#define forr(i,a,b) for(i=a;i<=b;i++)
#define umii unordered_map<int,int>
#define vpii vector<pair<int,int>>
#define all(a) a.begin() , a.end()
#define vvi vector<vector<int>>
#define pq priority_queue<int>
#define sqr(a) (((a) * (a)))
#define double long double
#define dbg cout<<"\nhi\n"
#define pii pair<int,int>
#define mii map<int,int>
#define vb vector<bool>
#define vi vector<int>
#define int long long
#define nl cout<<"\n"
#define pb push_back
#define sp <<" "<<
#define ss second
#define ff first
inline void read(int &x)
{
      int c = getchar();
      x = 0;
      int neg = 0;
      for(; ((c<48 || c>57) && c != '-'); c = getchar());
      if(c=='-')
      {
            neg = 1;
            c = getchar();
      }
      for(; c>47 && c<58 ; c = getchar())
      {
            x = (x<<1) + (x<<3) + c - 48;
      }
      if(neg)
      {
            x = -x;
      }
}
int fpow(int x, int n)
{
    int res = 1;
    while(n){
          if(n&1){
                res = res * x % mod;
          }
          x = x * x % mod;
          n>>=1;
    }
    return res;
}
int gcd(int a,int b)
{
    if(b == 0)
    {
          return a;
    }
    return gcd(b,a % b);
}
void sieve(int n)
{
      bool prime[1000006];
      memset(prime, true, sizeof(prime));
      int rootn = (int)sqrt(n);
      for (int p = 2; p <= rootn; p++)
      {
            if (prime[p] == true)
            {
                  for (int i = p*p; i <= n; i += p)
                  {
                        prime[i] = false;
                  }
            }
      }
      prime[1] = 0;
}
const int N = 3050;
int cnt, sum, mid, mx, mn, ans, b[N];
int n, m, d, i, j, k, l, p, q, r, t, w, x, y, z;
bool f, f1, f2;
string s;
// you can also use __int128 :)

//******************************************* CHECK CONSTRAINTS **************************************************
vvi a(N,vi(N)),dp(N,vi(4));


int32_t main()
{     fio;
      cin>>n>>m>>k;
      forr(i,1,k)
      {
            cin>>x>>y>>z;
            a[x][y] = z;
      }
      ans = 0;
      forr(i,1,n)
      {
            forr(k,1,3)
            {
                  mx = 0;
                  int mx2 = 0;
                  forr(j,1,m)
                  {
                        dp[j][k] = max(max(dp[j][3] + a[i][j],mx + a[i][j]),mx2);
                        mx = max(mx,dp[j][k-1]);
                        mx2 = max(mx2,dp[j][k]);

                        ans = max(ans,dp[j][k]);
                  }
            }
      }
      cout<<ans;
     
}


Measured memory_bytes: 76676
#include <stdio.h>

int main(void)
{
    int n = 0;
    char a;
    char b;
    char c;
    char d;

    scanf("%c%c%c%c", &a, &b, &c, &d);
    switch (a)
    {
    case '+':
        n++;
        break;
    case '-':
        n--;
        break;
    }

    switch (b)
    {
    case '+':
        n++;
        break;
    case '-':
        n--;
        break;
    }

    switch (c)
    {
    case '+':
        n++;
        break;
    case '-':
        n--;
        break;
    }

    switch (d)
    {
    case '+':
        n++;
        break;
    case '-':
        n--;
        break;
    }

    printf("%d\n",n);
}

Measured memory_bytes: 128
N,A,B,C = map(int,input().split())
l = []
cand = []
for i in range(N):
    l.append(int(input()))
for i in range(4**N):
    a,b,c = [],[],[]
    for j in range(N):
        tmp = i // (4**j) % 4
        if tmp == 1:
            a.append(l[j])
        elif tmp == 2:
            b.append(l[j])
        elif tmp == 3:
            c.append(l[j])
    if a != [] and b != [] and c != []:
        al,bl,cl = sum(a),sum(b),sum(c)
        cand.append(abs(al-A)+abs(bl-B)+abs(cl-C)+10*(len(a)+len(b)+len(c)-3))
print(min(cand))

Measured memory_bytes: 5000
#include <bits/stdc++.h>
#define ll long long int
#define mod_ceil(a, b) (a % b) ? a / b + 1 : a / b
using namespace std;

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

    ll x, last = 0, i = 0;
    cin >> x;
    for (;; i++)
    {
        last += i;
        if (last >= x)
        {
            cout << i << endl;
            return 0;
        }
    }
}

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

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 10010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
 #define LOOP 10000000

int main() {

    ll N, ans = 0;
    
    cin >> N;

    if( N % 2 == 1 ){
        ans = 0;
    } else{
        N /= 10;
        ans=N;
        while(N>0){
            N /= 5;
           // cout << N << endl;
            ans += N;
        }
       //if( N >= 10) ans += N / 10;
       //if( N >= 100) {
       //    N /= 10;
       //    ans += N / 10;
       //}

    }

    cout << ans << endl;

}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int a1,a2,a3,cost=0,max=0,sec=0,trd=0;
    scanf("%d",&a1);
    max=a1;
    sec=a1;
    trd=a1;
    scanf("%d",&a2);
    if(a2>max){
      max=a2;
    }else{
      sec=a2;
    }
    scanf("%d",&a3);
    if(a3>max){
      trd=sec;
      sec=max;
      max=a3;
    }else if(a3>sec){
      trd=sec;
      sec=a3;
    }else{
      trd=a3;
    }
    cost+=max-sec;
    cost+=sec-trd;
    printf("%d\n",cost);
    return (0);
}


Measured memory_bytes: 128
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
#include<stack>
#include <sstream> 
#include <limits>
#include <numeric>
#include<string.h>
#include<set>
using namespace std;
#define ll long long int
#define all(v) begin(v), end(v)
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
//typedef vector<int> V;
//typedef vector<V> VV;
//typedef vector<VV> VVV;
using namespace std;

int l[10000];

int main() {
	int x, n,a,count1=0;
	cin >> n >> x;
	for (int i = 0; i < n; i++) {
		cin >> a;
		l[i + 1] = a + l[i];
		if (l[i + 1] <= x)count1++;
	}
	cout << count1 + 1 << endl;
}

Measured memory_bytes: 256
/// wa ^3^

#pragma GCC optimize("O3")

#include<bits/stdc++.h>
                           
#define x first
#define y second
#define pb push_back
#define sz(x) (int) x.size()
 
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;                                   

const int MOD = 1e9 + 7;
const int INF32 = 1e9 + 1e2;

template<typename T> istream 
&operator>>(istream &a, vector<T> &v) { 
for (auto& x : v) a >> x; return a; }

void stndrtn() {
#ifdef accepted
    freopen(".in", "r", stdin);
#endif        
}

const bool flag = 0;

void maincode() {
    int n;
    cin >> n;
    vector<ll> p = {0};
    for (int x; n--;) {
        cin >> x, p.pb(p.back()+x);
    }    
    ll ans = 0;
    map<ll, int> cnt;
    for (ll x : p) {
        ans += cnt[x]++;
    }
    cout << ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr), stndrtn();
    int ts = 1;
    if (flag) 
        cin >> ts;
    while (ts--)
        maincode(); 
    return 0;
}



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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a;
    cin >> n;
    vector<int> a_1;
    for(int i=0;i<n;i++){
        cin >> a;
        a_1.emplace_back(a);
    }
    sort(a_1.begin(),a_1.end());
    cout << abs(a_1[0]-a_1[n-1]) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.math.*

fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    
    val endinges = Array(N, {Pair(0.0, 0.0)})
    
    for (i in 0 until N) {
        val (x, y) = readInputLine().split(" ").map { it.toDouble() }
        endinges[i] = Pair(x, y)
    }
    
    endinges.sortBy { Math.atan2(it.first, it.second) }

    var ans = 0.0
    
    for (i in 0 until N) {
        var x = 0.0
        var y = 0.0
        for (j in 0 until N) {
            x += endinges[(i + j) % N].first
            y += endinges[(i + j) % N].second

            ans = Math.max(ans, Math.sqrt(x * x + y * y))
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}



Measured memory_bytes: 37860
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=LLONG_MAX,mod=1000000007,BS,k;

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
		ll n,x,t;cin>>n>>x>>t;
		ll num;num=ceil((1.0*n)/x)*t;
		cout<<num;
}


Measured memory_bytes: 3648
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back
#define F first
#define S second


typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int n;
	cin >> n;
	vector<PII> p(n);
	rep(i, n)cin >> p[i].first >> p[i].second;
	SORT(p);
	rep(i, n)cout << p[i].first << " " << p[i].second << endl;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define inchar			getchar
#define outchar(x)		putchar(x)
#define ll long long int
#define all(v) v.begin(), v.end()
#define SP outchar(' ')
#define LN outchar('\n')
using namespace std;

template<typename T> void inpos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=0; if(c=='-')neg=1;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
template<typename T> void outpos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do{snum[i++]=n%10+'0';n/=10;}while(n);i=i-1;while(i>=0)outchar(snum[i--]);}
inline void instr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while(c!='\n'&&c!=' '&&c!=EOF){str[i]=c;c=inchar();++i;}str[i]='\0';}


// DO TOP SORT
vector <vector <int > > Graph;
vector <int> sorted;

void dovisit(int i , bool * visited) {
	visited[i] = true;
	for(auto elem : Graph[i]) {
		if (!visited[elem]) {
			dovisit(elem, visited);
		}
	}
	sorted.push_back(i);
}

void topSort (int n) {
	bool visited[n];
	memset(visited, 0 , sizeof (visited));
	
	for (int i = 0; i<n;i++) {
		// cout << i <<endl;
		if (!visited[i]) {
			dovisit(i, visited);
		}
	}
	// Sorted Stack aa chuke
	 // stack me travel karo
	int dp[n];
	memset(dp, 0 , sizeof(dp));
	
	for (int m = 0; m<n;m++) {
		int i = sorted[m];
		// cout << i <<endl;
		int k = 0;
		for(auto elem:Graph[i]) {
			k = max(k,dp[elem]);
		}
		dp[i] = k+1; 
		
	}
	int maxi = -1;
	for (int i = 0; i<n;i++) {
		maxi = max(maxi, dp[i]);
	}
	cout << maxi -1<<endl;
	
}




int main () {
	// Make Graph

	int n, m;
	cin >> n >> m;
	Graph.resize(n);
	int x , y;
	for (int i = 0; i<m;i++) {
		cin >> x >> y; 
		x--;
		y--;
		Graph[x].push_back(y);
		// Graph[y].push_back(x);
	}
	topSort(n);

}

Measured memory_bytes: 8444
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define per(i,n) for (int i = (n)-1; i >=0; --i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;

int main(){
    vector<string> s(3);
    rep(i,3)cin>>s[i];
    rep(i,3)cout<<(char)toupper(s[i][0]);
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <queue>
#include <vector>
#include <iostream>
#pragma warning(disable : 4996)
using namespace std;
int N, M, Q, a[200009], b[200009], r[200009], f[200009], dist[200009], ret[200009]; vector<int> g[200009], gt[200009]; bool vis[100009];
int main() {
	scanf("%d%d%d", &N, &M, &Q);
	for (int i = 0; i < M; i++) {
		scanf("%d%d", &a[i], &b[i]), a[i]--, b[i]--;
		g[a[i]].push_back(b[i]);
		g[b[i]].push_back(a[i]);
	}
	fill(f, f + M, -1);
	for (int i = 0; i < Q; i++) scanf("%d", &r[i]), r[i]--, f[r[i]] = i;
	queue<int> que1; que1.push(0);
	fill(dist, dist + N, -1); dist[0] = 0;
	while (!que1.empty()) {
		int u = que1.front(); que1.pop();
		for (int i : g[u]) {
			if (dist[i] == -1) {
				dist[i] = dist[u] + 1;
				que1.push(i);
			}
		}
	}
	for (int i = 0; i < M; i++) {
		if (dist[a[i]] == dist[b[i]]) continue;
		if (dist[a[i]] > dist[b[i]]) swap(a[i], b[i]);
		if (f[i] == -1) gt[a[i]].push_back(b[i]);
	}
	int cnt = N - 1;
	vector<bool> vis(N); vis[0] = true;
	queue<int> que2; que2.push(0);
	while (!que2.empty()) {
		int u = que2.front(); que2.pop();
		for (int i : gt[u]) {
			if (!vis[i]) {
				vis[i] = true; cnt--;
				que2.push(i);
			}
		}
	}
	for (int i = Q - 1; i >= 0; i--) {
		ret[i] = cnt;
		if (dist[a[r[i]]] == dist[b[r[i]]]) continue;
		gt[a[r[i]]].push_back(b[r[i]]);
		if (vis[a[r[i]]] && !vis[b[r[i]]]) {
			vis[b[r[i]]] = true; cnt--;
			queue<int> que; que.push(b[r[i]]);
			while (!que.empty()) {
				int u = que.front(); que.pop();
				for (int j : gt[u]) {
					if (!vis[j]) {
						vis[j] = true, cnt--;
						que.push(j);
					}
				}
			}
		}
	}
	for (int i = 0; i < Q; i++) printf("%d\n", ret[i]);
	return 0;
}

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

int main(){
    char sample[]={'A','T','C','G'};
    string str;
    int count=0;
    int ans=0;
    bool judge=false;

    cin>>str;
    for(int i=0;i<str.size();i++){
        for(int j=0;j<4;j++){
            if(str[i]==sample[j]){
                count++;
                judge=true;
                break;
            }
            judge=false;
        }
        if(ans<count){
            ans=count;
        }
        if(!judge){
            count=0;
        }
    }
    cout<<ans<<endl;

    return 0;
}

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

ll a, b, c, k, ans;

int main() {// freopen("_in.txt","r",stdin);
	scanf("%lld%lld%lld%lld",&a,&b,&c,&k);
	if (k & 1) ans = b - a; else ans = a - b;
	printf("%lld\n",ans);
}

Measured memory_bytes: 256
N = int(input())
Problems = list(map(int, input().split()))
M = int(input())
arr = []
for i in range(M):
  P, T = map(int, input().split())
  sum = 0
  for j in range(N):
    if j != P - 1:
      sum += Problems[j]
    else:
      sum += T
  arr.append(sum)
for num in arr:
  print(num)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef pair<long,long> P;
int main(){
  long N;cin>>N;
  vector<long>S(1<<N);
  for(long i=0;i<(1<<N);i++)cin>>S[i];
  sort(S.begin(),S.end(),greater<long>());
  vector<P>A;//値と個数
  for(long i=0;i<(1<<N);i++){
    if(i==0||A[A.size()-1].first!=S[i])A.push_back(P(S[i],1));
    else A[A.size()-1].second++;
  }
  long M=A.size();
  vector<long>B(M);//個数
  B[0]=1;
  for(long i=0;i<N;i++){
    vector<long>C(M);long rem=0;
    for(long j=0;j<M-1;j++){
      //枠Aに治るまで, Bを右に移動. 2つ以上いけるはず
      // 1個下にはいくつBが移動できるか
      //   使えるのはB[j]+rem
      //   = A[j+1]-B[j+1]: 空いているかず
      //    溢れるかどうか: B[j]+rem>(A[j+1]-B[j+1])なら溢れる
      //    その時は次に回す
      // 
      if(rem+B[j]>A[j+1].second-B[j+1]){
        rem=rem+B[j]-(A[j+1].second-B[j+1]);
        C[j+1]=A[j+1].second-B[j+1];
      }
      else{
        C[j+1]=B[j]+rem;
        rem=0;
      }
    }
    for(long j=0;j<M;j++)B[j]+=C[j];
    //for(long j=0;j<M;j++)cout<<B[j]<<" ";cout<<endl;
  }
  for(long i=0;i<M;i++)if(A[i].second!=B[i]){cout<<"No";return 0;}
  cout<<"Yes";
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod =(1e9)+7;
using P = pair<ll,ll>;

int main(){
   ll k,t;cin >>k>>t;
   ll mx=0;
   ll sum=0;
    for (int i = 0; i < t; ++i) {
        ll a;cin >>a;
        mx=max(mx,a);
        sum+=a;
    }
//    cout <<sum <<" "<<mx<<endl;
    sum-=mx;
    mx-=sum;
    mx--;
    if(mx<0)cout <<0<<endl;
    else cout <<mx<<endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
constexpr int N_MAX = 100000;
constexpr int N_LOG_MAX = 30;
constexpr int X_MAX = 1000000001;

int n, l, q;
vector<ll> hotels(N_MAX, X_MAX);
vector<vector<ll>> nxt(N_MAX, vector<ll>(N_LOG_MAX, N_MAX));

int solve(int a, int b) {
    int ng = 0, ok = n;
    while(ok-ng > 1) {
        int mid = (ng+ok)/2;
        int c = a;
        for(int j=N_LOG_MAX-1;j>=0&&c<b;--j) {
            if(mid & (1 << j)) {
                c = nxt[c][j];
            }
        }
        if(b <= c) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    return ok;
}

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> n;
    for(int i=0;i<n;++i){
        cin >> hotels[i];
    }
    cin >> l;

    for(int i=0;i<n;++i) {
        auto itr = upper_bound(hotels.begin(), hotels.end(), hotels[i]+l);
        nxt[i][0] = int(itr - hotels.begin()) - 1;
    }
    for(int j=1;j<N_LOG_MAX;++j) {
        for(int i=0;i<n;++i) {
            if(nxt[i][j-1] < n) {
                nxt[i][j] = nxt[nxt[i][j-1]][j-1];
                // cerr << i << " " << j << ": " << nxt[i][j] << endl;
            }
        }
    }

    cin >> q;
    int a, b;
    for(int i=0;i<q;++i) {
        cin >> a >> b;
        if(a > b) swap(a, b);
        cout << solve(a-1, b-1) << endl;
    }
}


Measured memory_bytes: 28928
#include <bits/stdc++.h>
using namespace std;
int c,n,k,i;
int main(){
  cin>>n>>k;
  vector<int> p(n);
  for(;i<n;++i)cin>>p[i];
  sort(p.begin(),p.end());
  for(i=0;i<k;++i)c+=p[i];
  cout<<c;
}

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

int main() {
	int W, H, N, x, y, a, count = 0;
	cin >> W >> H >> N;
	bool M[100][100] = { false };
	for (int i = 0; i < N; i++) {
		cin >> x >> y >> a;
		if (a == 1) {
			for (int X = 0; X < x; X++) {
				for (int Y = 0; Y < H; Y++) {
					M[X][Y] = true;
				}
			}
		}
		if (a == 2) {
			for (int X = x; X < W; X++) {
				for (int Y = 0; Y < H; Y++) {
					M[X][Y] = true;
				}
			}
		}
		if (a == 3) {
			for (int X = 0; X < W; X++) {
				for (int Y = 0; Y < y; Y++) {
					M[X][Y] = true;
				}
			}
		}
		if (a == 4) {
			for (int X = 0; X < W; X++) {
				for (int Y = y; Y < H; Y++) {
					M[X][Y] = true;
				}
			}
		}
	}
	for (int X = 0; X < W; X++) {
		for (int Y = 0; Y < H; Y++) {
			if (M[X][Y]) count++;
		}
	}
	cout << W * H - count << endl;
}


Measured memory_bytes: 256
function heron(a,b,c){
   var s=(a+b+c)/2;
   var S=Math.sqrt(s*(s-a)*(s-b)*(s-c));
   return S;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var i=0;i<Arr.length;i++){
   var ALX=Arr[i].split(" ").map(Number);
   var A=ALX[0];
   var L=ALX[1];
   var X=ALX[2];
   var sum=0;
   sum+=heron(A,L,L);
   sum+=(heron(L,(L+X)/2,(L+X)/2)*2);
   console.log(sum.toFixed(10));
}

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

int main()
{
  int i,j,k,v;
  int n;
  int *A;

  cin >> n;
  A = new int [n];
  for(i=0; i<n; i++){
    cin >> A[i];
  }
  for(i=0; i<n-1; i++){// initial state                                         
    cout << A[i] << ' ';
  }
  cout << A[n-1] << "\n";

  for( i=1; i<n; i++ ){
    v = A[i];
    for(j=i-1; j>=0 && A[j]>v;){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    for(k=0;k<n-1;k++){
      cout << A[k] << ' ';
    }
    cout << A[n-1] << "\n";
  }

  delete [] A;
  return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>

using namespace std;


int main() {
	string s; cin >> s;
	string ans;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '0') {
			ans += '0';
		}
		else if (s[i] == '1') {
			ans += '1';
		}
		else if (ans.size() != 0) {
			ans.pop_back();
		}
	}
	cout << ans << endl;
}

    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  





void solve(){
	int n ; cin >> n ;
	vi v(n);
	re(v);
	vi tin(n);
	fr(i,0,n-1) tin[i]=i;
	trace(tin);
	auto cmp = [&](int a , int b ){return v[a] < v[b];};
	sort(all(tin),cmp);
	rep(i,0,n)cout << tin[i]+1 << ' ';
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


Measured memory_bytes: 4692
def check_load(k, w, max_weight) -> bool:
  truck_itr = 0
  truck_weight = 0
  for w_i in w:
    if w_i > max_weight:
      return False
    if truck_weight + w_i > max_weight:
      truck_weight = 0
      truck_itr += 1

    truck_weight += w_i
    if truck_itr > k-1:
      return False
    
  return True

def solve():
  # input
  n,k = map(int, input().split())
  w = []
  truck = []
  for i in range(1,n+1):
    w.append(int(input()))

  # kの積載量に対してトラックに詰めこむ操作の二分法で探索する。
  right = sum(w) # 解の上界
  left = sum(w)//n # 平均を床関数とったものが下界
  max_weight = left
  while right-left > 1:
    # print(left,right,max_weight)
    if check_load(k, w, max_weight):
      right = max_weight
    else:
      left = max_weight

    max_weight = (right+left)//2
  
  print(right)
  
solve()


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

#pragma warning(disable:4996)
using namespace std;
using ld=long double;
ld eps=1e-9;

vector<vector<int>>pres;
vector<long long int>dfs(const vector<vector<pair<int, long long int>>>&edges, const int start,bool flag=false) {
	vector<long long int>dp(edges.size(),1e18);
	if (flag) {
		pres.resize(edges.size());
	}
	dp[start]=0;

	priority_queue<pair<long long int,int>>que;
	que.emplace(0,start);
	while (!que.empty()) {
		auto p(que.top());
		que.pop();
		const int now(p.second);
		const long long int now_cost(-p.first);
		if(now_cost!=dp[now])continue;
		
		for (auto e : edges[now]) {
			const int next(e.first);
			const long long int next_cost(now_cost+e.second);
			if (dp[next] > next_cost) {
				dp[next]=next_cost;
				que.emplace(-next_cost,next);
				if(flag)pres[next] = vector<int>{ now };
			}
			else if (dp[next] == next_cost) {
				if(flag)pres[next].push_back(now);
			}
		}
	}
	return dp;
}

long long int solve(int N, int M, int S,int T ,int U, int V,
	const vector<vector<pair<int ,long long int>>>&edges) {

	vector<long long int>from_Us(N);
	vector<long long int>from_Vs(N);
	vector<long long int>from_Ss(N);

	


	from_Us = dfs(edges, U);
	from_Vs = dfs(edges, V);

	pres.clear();
	from_Ss = dfs(edges, S, true);

	long long int ans = from_Us[V];
	priority_queue<pair<long long int, int>>que;
	que.emplace(make_pair(from_Ss[T], T));
	vector<int>flags(N);
	vector<long long int>mins(N, 1e18);
	for (int i = 0; i < N; ++i) {
		mins[i] = from_Vs[i];
	}
	while (!que.empty()) {
		auto atop(que.top());
		que.pop();
		const int now = atop.second;
		long long int amin = mins[now];

		long long int nans = amin + from_Us[now];
		ans = min(ans, nans);

		for (auto e : pres[now]) {
			mins[e] = min(mins[e], amin);
			if (!flags[e]) {
				flags[e] = true;
				que.emplace(make_pair(from_Ss[e], e));

			}
		}

	}
	return ans;
}

int main() {
	
	int N,M,S,T,U,V;cin>>N>>M>>S>>T>>U>>V;
	S--;T--;U--;V--;
	vector<vector<pair<int, long long int>>>edges(N);
	for (int i = 0; i < M; ++i) {
		int a, b, c; cin >> a >> b >> c; a--; b--;
		edges[a].push_back(make_pair(b, c));
		edges[b].push_back(make_pair(a, c));
	}
	long long int ans=solve(N,M,S,T,U,V,edges);
	ans=min(ans,solve(N,M,S,T,V,U,edges));
	cout<<ans<<endl;
	return 0;
} 


Measured memory_bytes: 27356
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
int main()
{
  int n;
  string s;
  cin >> n;
  cin >> s;
  for(int i=0; i<s.length(); i++){
    for(int j=0; j<n; j++){
      s[i]++;
      if(s[i] >= 91) s[i] = 65;
    }
  }

  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <limits.h>
#include <assert.h>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <math.h>
#include <stack>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long int
#define db double
#define ldb long double
#define MOD 1000000007
#define Fi first
#define Se second
#define INF INT_MAX
#define NINF INT_MIN
#define L_INF LLONG_MAX
#define L_NINF LLONG_MIN
#define gc getchar
#define sz(x) (int)(x).size()
#define pii pair<int,int>
#define pll pair<ll,ll>

void fsscan(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

void scani(int &x)
{
    register int c = gc();x = 0;int neg = 0;
    for(;((c<48 || c>57) && c != '-');c = gc());
    if(c=='-') {neg=1;c=gc();}
    for(;c>47 && c<58;c = gc()) {x = (x<<1) + (x<<3) + c - 48;}
    if(neg) x=-x;
}

int main()
{
    fsscan();
    ll n,m;
    cin>>n>>m;
    ll temp=0;
    if((n==1&&m==1)||(m==1&&n==1))
    {
        cout<<"1";
        return 0;
    }
    
    if(n==1||m==1)
    {
        cout<<max(temp,max(n,m)-2);
        return 0;
    }
    
    if(n==2||m==2)
    {
        cout<<"0";
        return 0;
    }
    
    cout<<n*m-(4+2*n+2*m-8);
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
data=[-1]*n
for i in range(m):
  s,c=map(int,input().split())
  if (s==1 and c==0) and n>=2:
    print(-1)
    exit()
  if data[s-1]==-1 or data[s-1]==c:
    data[s-1]=c
  elif data[s-1]!=-1 and data[s-1]!=c:
    print(-1)
    exit()
  
if data[0]==-1 and n!=1:
  data[0]=1
elif data[0]==-1 and n==1:
  data[0]=0
for i in range(1,n):
  if data[i]==-1:
    data[i]=0
print(*data,sep='')

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

int main()
{
	int N;
	cin >> N;
	vector<int> h(N);
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	vector<int> dp(N, 1e9 + 1);
	dp[0] = 0;
	for (int i = 1; i < N; i++) {
		dp[i] = min(dp[i], dp[i - 1] + abs(h[i - 1] - h[i]));
		if (0 <= i - 2) {
			dp[i] = min(dp[i], dp[i - 2] + abs(h[i - 2] - h[i]));
		}
	}
	cout << dp[N - 1] << endl;
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int c5 = 0;
		int c7 = 0;
		if ( A==5 )c5++; else c7++;
		if ( B==5 )c5++; else c7++;
		if ( C==5 )c5++; else c7++;
		if ( c5==2 && c7==1 ) System.out.println("YES");
		else System.out.println("NO");
	}
}


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

int main(int argc, char const *argv[])
{
	int n,a,b,c,d;
	string s;
	cin>>n>>a>>b>>c>>d>>s;
	--a,--b,--c,--d;
	int f=1;
	if (b>c)
	{
		for (int i = a+1; i <= b; ++i)
		{
			if (s.at(i-1)=='#'&&s.at(i)=='#')
			{
				f=0;
			}
		}
		for (int i = c+1; i <= d; ++i)
		{
			if (s.at(i-1)=='#'&&s.at(i)=='#')
			{
				f=0;
			}
		}
		if (f==1)
		{
			cout<<"Yes\n";
		}
		else
		{
			cout<<"No\n";
		}
		return 0;
	}
	for (int i = min(a,b)+1; i <= max(c,d); ++i)
	{
		if (s.at(i-1)=='#'&&s.at(i)=='#')
		{
			f=0;
		}
	}
	if (f==0)
	{
		cout<<"No\n";
		return 0;
	}
	if (c<d)
	{
		cout<<"Yes\n";
		return 0;
	}
	f=0;
	for (int i = b+1; i <= d+1; ++i)
	{
		if (s.at(i-2)=='.'&&s.at(i-1)=='.'&&s.at(i)=='.')
		{
			f=1;
		}
	}
	if (f==1)
	{
		cout<<"Yes\n";
		return 0;
	}
	cout<<"No\n";
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    long long ans;
    long long r=0,g=0,b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R') r++;
        else if(s[i]=='G') g++;
        else if(s[i]=='B') b++;
    }
    
    ans=r*g*b;
    for(int i=0;i<n-2;i++){
        int len=1; 
        while(i+len+len<n){
            if(s[i]!=s[len+i] && s[len+i]!=s[len+len+i] && s[i]!=s[len+len+i])
                ans--;
            len++;
        }
    }
 
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3636
//




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


#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pp pop_back()
#define pf push_front
#define ppf pop_front()
#define ff first
#define ss second
#define mp make_pair
#define fr(i,j,n) for(ll i=j; i<n; i++)
#define rfr(i,j,n) for(ll i=n-1; i>=j; i--)
#define pll pair<ll,ll>
#define plb pair<ll,bool>
#define psl pair<string,ll>
#define psb pair<string,bool>
#define srt(v) sort((v).begin(),(v).end())
#define ub(v,val) upper_bound((v).begin(),(v).end(),(val))-(v).begin()
#define lb(v,val) lower_bound((v).begin(),(v).end(),(val))-(v).begin()


typedef long double ld;
typedef long long int ll;


//getline(cin,string);
const ll inf = (ll) 1e18 + 19;
const ll mod = (ll) 1e9  +  7;




ll dfs(vector <ll> v[],vector <ll> &dp,ll node) {
    ll mx=-inf;
    if(dp[node]!=-1) return dp[node];
    if(v[node].size()==0) return 0;
    for(auto it: v[node]) {
        mx=max(mx,dfs(v,dp,it));
    }
    return dp[node]=1+mx;
}




void cazz() {
    ll t=1,i=0,j,n;
    //cin>>t;
    while(t--) {
        ll m;
        cin>>n>>m;
        vector <ll> v[n+1];
        ll a,b;
        fr(i,0,m) {
            cin>>a>>b;
            v[a].pb(b);
        }
        ll mx=-inf;
        vector <ll> dp(n+1,-1);
        fr(i,1,n+1) {
            mx=max(mx,dfs(v,dp,i));
        }
        cout<<mx<<"\n";
    }
}




int main() {
    spdio;
	cazz();
	return 0;
}


Measured memory_bytes: 12076
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        Integer n = sc.nextInt();
        int[] arr = new int[n];
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; ++i) {
            arr[i] = sc.nextInt();
            if (map.containsKey(arr[i])) {
                map.put(arr[i], map.get(arr[i]) + 1);
            } else {
                map.put(arr[i], 1);
            }
        }

        int res = 0;
        for (Integer key: map.keySet()) {
            if (key > map.get(key)) {
                res += map.get(key);
            } else if (key < map.get(key)) {
                res += map.get(key) - key;
            }
        }

        System.out.println(res);
    }
}


Measured memory_bytes: 61536
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		long[] point = new long[8];
		int var = 0;
		for (int i = 0; i < n; i++) {
			int t = scanner.nextInt();
			if (t < 400) {
				point[0]++;
			} else if (t < 800) {
				point[1]++;
			} else if (t < 1200) {
				point[2]++;
			} else if (t < 1600) {
				point[3]++;
			} else if (t < 2000) {
				point[4]++;
			} else if (t < 2400) {
				point[5]++;
			} else if (t < 2800) {
				point[6]++;
			} else if (t < 3200) {
				point[7]++;
			} else {
				var++;
			}
		}
		int min = 0;
		for (int i = 0; i < point.length; i++) {
			if (point[i] > 0) {
				min++;
			}
		}
		int max = min + var;
		if (min == 0) {
			min = 1;
		}
		System.out.println(min+" "+max);
		scanner.close();
	}
}

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

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
    if(ch=='A')return 1;
    else if(ch=='C')return 2;
    else if(ch=='G')return 3;
    else if(ch=='T')return 4;
    else return 0;
}

long long getKey(char str[]){
    long long sum=0,p=1,i;
    for(i=0;i<strlen(str);i++){
        sum+=p*(getChar(str[i]));
        p*=5;
    }
    return sum;
}

int h1(int key){return key%M;}
int h2(int key){return 1+(key%(M-1));}

int find(char str[]){
    long long key, i, h;
    key=getKey(str);
    for(i=0;;i++){
        h=(h1(key)+i*h2(key))%M;
        if(strcmp(H[h],str)==0)return 1;
        else if(strlen(H[h])==0)return 0;
    }
    return 0;
}

int insert(char str[]){
    long long key,i,h;
    key=getKey(str);
    for(i=0;;i++){
        h=(h1(key)+i*h2(key))%M;
        if(strcmp(H[h],str)==0) return 1;
        else if(strlen(H[h])==0){
            strcpy(H[h],str);
            return 0;
        }
    }
    return 0;
}

int main(){
    int i,n,h;
    char str[L],com[9];
    for(i=0;i<M;i++)H[i][0]='\0';
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s",com,str);
        
        if(com[0]=='i'){
            insert(str);
        }else{
            if(find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}


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

int main(){
  string S,T;
  cin>>S>>T;
  int N=S.size();
  bool flag=true;
  int i=0;
  while(S!=T){
    S.push_back(S[0]);
    S.erase(S.begin(),S.begin()+1);
    if (i==3*N){
      flag=false;
      break;
    }
    i++;
  }
  if (flag){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}
  

Measured memory_bytes: 3600
#include <iostream>
using namespace std;
int main()
{
    int a;
    string s;
    cin >> a;
    cin >> s;
    int x = 0;
    int max1 = 0;
    for (int i=0; i<a; i++)
    {
        if (s[i] == 'I')
        {
            x++;
        }
        else
        {
            x--;
        }
        max1 = max (x,max1);
    }
    cout << max1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
//#include <fstream>
#include <complex>
#define _USE_MATH_DEFINES
#include <cmath>
#include <math.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

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

	int ans;

	for (ans = 1; ans <= 2000; ans++) {
		if (floor(ans*0.08) == a && floor(ans*0.1) == b) {
			break;
		}
	
	}

	if(ans!=2001)cout << ans << endl;
	else cout << -1 << endl;
	return 0;

}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
char str1[1000],str2[1000];
int C[1001][1001];

void LongestCommonSub(){
  int len1,len2,i,j,max=-1;
  len1=strlen(str1);
  len2=strlen(str2);
  for(i=0;i<=len1;i++)
    C[i][0]=0;
  for(j=0;j<=len2;j++)
    C[0][j]=0;

  for(i=1;i<=len1;i++){
    for(j=1;j<=len2;j++){
      if(str1[i-1]==str2[j-1])
	C[i][j]=C[i-1][j-1]+1;
      else{
	if(C[i-1][j]>C[i][j-1])
	  C[i][j]=C[i-1][j];
	else
	  C[i][j]=C[i][j-1];
      }
      if(max<C[i][j])
	max=C[i][j];
    }
  }
  printf("%d\n",max);
}

int main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%s",str1,str2);
    LongestCommonSub();
  }
  return 0;
}


Measured memory_bytes: 5652
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int x,n,a;
  int p[1000]={};
  cin>>x>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    p[a]=1;
  }
  int num=0,ab=x;
  for(int i=-100000;i<=100000;i++){
    if(ab>abs(x-i)&&p[i]==0){
      ab=abs(x-i);
      num=i;
    }
  }
  cout<<num<<"\n";
}

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

using namespace std;
int main(){
	int x1,x2,y1,y2,x3,x4,y3,y4,size1,size2;
	cin>>x1>>y1>>x2>>y2;
	size1 = x2 - x1;
	size2 = y2 - y1;
	y3 = y2 + size1;
	y4 = y1 + size1;
	x3 = x2 - size2;	
	x4 = x1 - size2;
	cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<" ";
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string a;
int main()
{
  int i,ans=0,p,t,j;
  cin>>a;
  for(i=0;i<a.size();i++)
  {
    cin>>a[i];
    if(a[i]=='C')
    {
      ans++;
      for(j=i;j<a.size();j++)  
        if(a[j]=='F')
        {
	      cout<<"Yes"<<endl; 
		  return 0;
	    }
	} 
  }
  cout<<"No"<<endl;  
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a > b) swap(a, b);
	if (b > c) swap(b, c);
	if (a > b) swap(a, b);
	int sum = 0;
	if (a == b) sum++;
	if (b == c) sum++;
	switch (sum) {
	case 0: cout << 3; break;
	case 1: cout << 2; break;
	case 2: cout << 1; break;
	}
	cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}

#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define  st first
#define  nd second
#define int long long 


template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

typedef cc_hash_table<int, int, hash<int > > ht;

const int  M    = 1000000007;
const int  maxn =  200005 ;
const long long   inf  =  LONG_LONG_MAX    ;
const long double eps = 1.084202e-19;

int val = 0 ; 
vector<int> adj[maxn];
int vis[maxn];

void dfs(int u){
    val+=1;
    vis[u]=1;
    for(auto j : adj[u]){
          if(!vis[j]){
                dfs(j);
          }
    }
}
int32_t main(){
     ios_base::sync_with_stdio(false);
     cin.tie(NULL); 
     int n , m ;
     cin >> n  >> m ;
     for ( int i = 0 ; i< m ; i++){
           int l , r ; 
           cin >> l >> r ; 
           adj[l].push_back(r);
           adj[r].push_back(l);
     }
     int ans = 0 ; 
     for ( int i = 1 ; i<=n ; i++){
           if(!vis[i]){
                 dfs(i);
                 ans = max(ans,val);
                 val =0 ;
           }
     }
     cout << ans ; 

}
/*

*/

Measured memory_bytes: 22388
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            String S = in.next();

            String[] week = new String[] { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT", };
            HashMap<String, Integer> map = new HashMap<String, Integer>();
            for (int i = 0; i < week.length; i++) {
                map.put(week[i], 7 - i);
            }

            System.out.println(map.get(S));
        }
    }
}


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

int main() {
    int A, B, K; cin >> A >> B >> K;
    vector<int> ans;
    for (int i = 1; i <= 100; i++)
    {
        if(A%i==0 && B%i==0){
            ans.push_back(i);
        }
    }
    cout << ans[ans.size()-K] << endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        while(true){
            int n=sc.nextInt();
            if(n==0){
                break;
            }
            int p,d1,d2;
            int pp=0;
            int max=0;
            for(int i=0;i<n;i++){
                p=sc.nextInt();
                d1=sc.nextInt();
                d2=sc.nextInt();
                if(d1+d2>max){
                    max=d1+d2;
                    pp=p;
                }
            }
            System.out.println(pp+" "+max);
        }
    }
}


Measured memory_bytes: 161796
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("fma,avx,avx2")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define ld long double
#define sz(a) (int) (a).size()
#define all(a) (a).begin(), (a).end()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 5010;
const int inf = 1e10;

int vis[maxn], cost[maxn], len[maxn];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int n, k;
    cin >> n >> k;
    vector<int> p(n), c(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    int ans = -inf;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
        ans = max(ans, c[i]);
    }
    for (int i = 0; i < n; i++) {
        memset(vis, 0, sizeof vis);
        int cur = i;
        cost[i] = 0;
        len[i] = 0;
        while (!vis[cur]) {
            vis[cur] = 1;
            cur = p[cur];
            cost[i] += c[cur];
            len[i]++;
        }
    }
    for (int i = 0; i < n; i++) {
        int res = 0;
        int st = k;
        if (cost[i] > 0) {
            res += cost[i] * (st / len[i]);
            st %= len[i];
        }
        if (st < k) ans = max(ans, res);
        memset(vis, 0, sizeof vis);
        int cur = i;
        while (!vis[cur] && st > 0) {
            vis[cur] = 1;
            cur = p[cur];
            res += c[cur];
            st--;
            ans = max(ans, res);
        }
    }
    for (int i = 0; i < n; i++) {
        int res = 0;
        int st = k;
        memset(vis, 0, sizeof vis);
        int cur = i;
        while (!vis[cur] && st > 0) {
            vis[cur] = 1;
            cur = p[cur];
            res += c[cur];
            st--;
            ans = max(ans, res);
            if (cost[i] > 0) {
                ans = max(ans, res + (st / len[i]) * cost[i]);
            }
        }
    }
    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 3852
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
using namespace std;

#define INF (1ll<<60)


long long M = 1000000007;


int main(int argc, char const *argv[]) {
    string s;cin>>s;
    int n=s.length();
    int res = 1<<30;
    for(int i=0;i<n;++i){
        char c = s[i];
        int ma = 0,tmp = 0;
        for(int i=0;i<n;++i){
            if(s[i]!=c)tmp++;
            else tmp = 0;
            ma = max(ma,tmp);
        }
        res = min(ma,res);
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
        double high,low,x;
        scanf("%lf",&x);
        high =x;
        low = x;
        while(scanf("%lf",&x)!=EOF){
                if(high < x) high = x;
                if(low  > x) low  = x;
        }
        printf("%.1lf",high-low);
return 0;
}

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

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))


class BCardGameForTwo {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    multiset<int, greater<int>> set;
    REP(i, n){
      int a;
      in >> a;
      set.insert(a);
    }
    int cnt1 = 0, cnt2 = 0;
    while(!set.empty()){
      cnt1 += *set.begin();
      set.erase(set.begin());
      if(!set.empty()) {
        cnt2 += *set.begin();
        set.erase(set.begin());
      }
    }
    out << cnt1 - cnt2 << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	BCardGameForTwo solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3620
"""
a=[]
for i in range():
	a.append(int(input()))

if a[0]!=1:
	print(a[1]+a[2])
else:
	print("Hello World")
"""
a=int(input())
if a==1:
	print("Hello World")
else:
	b=int(input())
	c=int(input())
	print(b+c)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std; 
#define int int64_t
#define itn int
#define fi first
#define se second
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a;
  vector<int> x,y;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a;
    x.push_back(a);
    y.push_back(a);
  }
  sort(x.begin(),x.end());
  for(int i=0;i<n;i++){
    if(x[n/2]<=y[i]) cout<<x[(n-1)/2]<<"\n";
    else cout<<x[(n+1)/2]<<"\n";
  }
  return 0;
}


Measured memory_bytes: 6692