akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
import copy
H,W,K = map(int,input().split())
C_org = [list(input().rstrip()) for _ in range (H)]
ans = 0 
def change(C, k, row):
    if row==0:
        for i in range(W):
            C[k][i] = '.'
    else:
        for i in range(H):
            C[i][k] = '.'
    return 

for i in range(1<<H):
    C1 = copy.deepcopy(C_org)
    for k in range(H):
        if i==0:
            break
        if i&1:
            for t in range(W):
                C1[k][t] = '.'
        i>>=1

    for j in range(1<<W):
        C2 = copy.deepcopy(C1)
        for k in range(W):
            if j==0:
                break
            if j&1:
                for t in range(H):
                    C2[t][k] = '.'
            j>>=1
        
        cnt = 0
        for cc in C2:
            for c in cc:
                if c=='#':
                    cnt += 1
        if cnt==K:
            ans += 1
print(ans)

Measured memory_bytes: 72208
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<cinttypes>

using namespace std;

using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vll=vector<ll>;
using vvll=vector<vll>;
using vpii=vector<pii>;

#define PI 3.1415926535897932384626433832795


int bit_count(ll v)
{
	int ret=0;

	for(;v>0;)
	{
		ret++;
		v&=v-1;
	}

	return ret;
}


int msb(ll v)
{
	if(v==0) return -1;

	int ret=0;
	if(v & 0xFFFFFFFF00000000LL) v>>=32,ret+=32;
	if(v & 0xFFFF0000LL) v>>=16,ret+=16;
	if(v & 0xFF00) v>>=8,ret+=8;
	if(v & 0xF0) v>>=4,ret+=4;
	if(v & 0xC) v>>=2,ret+=2;
	if(v & 0x2) v>>=1,ret+=1;
	return ret;
}


int lsb(ll v)
{
	if(v==0) return -1;

	int ret=0;
	if(!(v & 0xFFFFFFFFLL)) v>>=32,ret+=32;
	if(!(v & 0xFFFF)) v>>=16,ret+=16;
	if(!(v & 0xFF)) v>>=8,ret+=8;
	if(!(v & 0xF)) v>>=4,ret+=4;
	if(!(v & 0x3)) v>>=2,ret+=2;
	if(!(v & 0x1)) v>>=1,ret+=1;
	return ret;
}


template<typename X>
bool max_u(X&m, X v)
{
	if(m<v)
	{
		m=v;
		return true;
	}
	return false;
}


template<typename X>
bool min_u(X&m, X v)
{
	if(m>v)
	{
		m=v;
		return true;
	}
	return false;
}


struct solve
{
	ll a, b, c, d;
	map<ll,ll> dp;
	vpii act;

	solve(ll a, ll b, ll c, ll d) : a(a),b(b),c(c),d(d)
	{
		act={{2,a},{3,b},{5,c}};
	}
	ll operator()(ll n)
	{
		if(n==0) return 0;
		if(n==1) return d;
		if(dp[n]>0) return dp[n];

		ll ans=a*msb(n)+d*bit_count(n);
		if(ans/n>d) min_u(ans, d*n);

		for(auto [r, cost]:act)
		{
			int updown=n-n/r*r;
			if(updown==0)
			{
				min_u(ans, cost+(*this)(n/r));
				continue;
			}
			min_u(ans, cost+d*updown+(*this)(n/r));
			min_u(ans, cost+d*(r-updown)+(*this)(n/r+1));
		}
		dp[n]=ans;
		return ans;
	}
};


int main(void)
{
	int t;
	while(scanf("%d", &t)==1)
	{
		ll n;
		int a, b, c, d;
		for(int i=0;i<t;i++)
		{
			scanf("%" SCNd64 "%d%d%d%d", &n, &a, &b, &c, &d);
			printf("%" SCNd64 "\n", solve(a, b, c, d)(n));
		}
	}
	return 0;
}


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

//int gcd(int a, int b) {
//	if (b != 0)
//		return gcd(b, a%b);
//	return a;
//}
//
//int lcm(int a, int b) {
//	return a * b / gcd(a, b);
//}

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a == b)
		cout << c;
	else if (a == c)
		cout << b;
	else
		cout << a;
	return 0;
}

Measured memory_bytes: 256
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=0
a.sort()
# Combination O(k)
MOD=10**9+7

class Combination:
    """
    O(n)の前計算を1回行うことで，O(1)でnCr mod mを求められる
    n_max = 10**6のとき前処理は約950ms (PyPyなら約340ms, 10**7で約1800ms)
    使用例：
    comb = Combination(1000000)
    print(comb(5, 3))  # 10
    """
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        self.modinv = self.make_modinv_list(n_max)
        self.fac, self.facinv = self.make_factorial_list(n_max)

    def __call__(self, n, r):
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def make_factorial_list(self, n):
        # 階乗のリストと階乗のmod逆元のリストを返す O(n)
        # self.make_modinv_list()が先に実行されている必要がある
        fac = [1]
        facinv = [1]
        for i in range(1, n+1):
            fac.append(fac[i-1] * i % self.mod)
            facinv.append(facinv[i-1] * self.modinv[i] % self.mod)
        return fac, facinv

    def make_modinv_list(self, n):
        # 0からnまでのmod逆元のリストを返す O(n)
        modinv = [0] * (n+1)
        modinv[1] = 1
        for i in range(2, n+1):
            modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod
        return modinv

comb=Combination(10**5)

for i in range(len(a)):
    tmp=0
    if i>=k-1:
        tmp=comb(i,k-1)
    vv=0
    if n-i-1>=k-1:
        vv=comb(n-i-1,k-1)
    ans+=a[i]*(tmp-vv)
    ans%=MOD

print(ans%MOD)

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

#define MAX_N 300000

using namespace std;

typedef long long lint;

const lint MOD = (lint)(1e9) + 7;

lint rez;

int n;
int ap[61];

int main()
{
    cin >> n;
    for(int i = 1; i <= n; i ++)
    {
        lint a;
        cin >> a;
        for(int j = 0; j < 60; j ++)
        {
            if(((1LL << j) & a) != 0)
                ap[j] ++;
        }
    }

    rez = 0;
    for(int i = 0; i < 60; i ++)
    {
        lint zeros = n - ap[i];
        lint ones = ap[i];

        rez += (zeros * ones % MOD) * ((1LL << i) % MOD) % MOD;
        rez %= MOD;
    }

    cout << rez << "\n";

    return 0;
}


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

using namespace std;

int main() {
  string S;
  cin>>S;
  if(S=="Sunny") S="Cloudy";
  else if(S=="Cloudy") S="Rainy";
  else S="Sunny";
  cout<<S;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
using namespace std;


int main() {
//    cout << fixed << setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    string a, b, s;
    int aa, bb;
    cin >> a >> b >> aa >> bb >> s;
    if (s == a) cout << aa - 1 << ' ' << bb;
    else cout << aa << ' ' << bb - 1;

}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repp(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perr(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  vector<pair<pair<string,int>,int>> v(n);
  rep(i,n){
    cin >> v[i].first.first >> v[i].first.second;
    v[i].first.second*=-1;
    v[i].second = i+1;
  }
  sort(all(v));
  rep(i,n){
    cout << v[i].second << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
vector<bool> seen;
void dfs(const Graph& G, int v) {
    seen[v] = true; // v を訪問済にする
 
    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) {
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}
signed main() {
    long long INF = 1000000000000;
    int N,K;cin>>N>>K; vector<int>H(100005);
    vector<int>DP(100005, INF);
    DP[0] = 0;
    for(int X=0;X<N;X++){
      cin>>H[X];
    }
    for (int X = 0; X < N; X++) {
        for (int Y = 1; Y <= K; Y++) {
            chmin(DP[X + Y], DP[X] + abs(H[X] - H[X + Y]));
        }
    }
    cout<<DP[N-1]<<endl;
}

Measured memory_bytes: 4844
#include <bits/stdc++.h>
#define ll long long
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
const int N = 1e5 + 50;
ll n, a[N], s1[N], s2[N], s;
int main()
{
	IO;
	cin >> n;
	for(int i = 1; i <= n + 1; i++)
	{
	    if(i <= n)
            cin >> a[i];
		s1[i] = abs(a[i] - a[i - 1]);
		if(i > 1)
			s2[i] = abs(a[i] - a[i - 2]);
		else
			s2[i] = s1[i];
		s += s1[i];
	}
	for(int i = 1; i <= n; i++)
		cout << s - s1[i] - s1[i + 1] + s2[i + 1] << '\n';
}


Measured memory_bytes: 3584
# https://atcoder.jp/contests/abc144/tasks/abc144_a
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    a, b = map(int, input().split())
    if a > 9 or b > 9:
        print(-1)
        return

    print(a * b)

if __name__ == '__main__':
    main()


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

bool palin(string s)
{
    int n=s.length();
    for(int i=0;i<=n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        return false;
        
    }
    return true;
}

int main() {
	// your code goes here
	int n;
	cin>>n;
	int a[n];
	vector<ll>cnt(n+1,0);
	for(int i=0;i<n;i++)
	{
	    cin>>a[i];
	    cnt[a[i]]++;
	}
	//vector<ll>res(n+1,0);
	 ll sum=0;
	for(int i=1;i<=n;i++)
	{
	        if(cnt[i]>0)
	        sum+=(cnt[i]*(cnt[i]-1))/2;
	        
	}

	for(int k=0;k<n;k++)
	{
	    ll ans=0;
	    ans=sum-(cnt[a[k]]*(cnt[a[k]]-1))/2;
	    if(cnt[a[k]]>2)
	    ans+=((cnt[a[k]]-1)*(cnt[a[k]]-2))/2;
	    cout<<ans<<"\n";
	    
	   
	}
	
	return 0;
}


Measured memory_bytes: 4864
'use strict'
const main = input => {
  const n = parseInt(input[0], 10), a = input[1].split(' ').map(val => parseInt(val, 10));
  // console.log(n, a);
  let rev = new Array(n);
  for(let i = 0; i < n; i++) {
    rev[a[i]-1] = i+1;
  }
  rev.map(val => console.log(val)
  );
  
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));

Measured memory_bytes: 34052
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
#define vi vector<ll>
#define all(a) a.begin(),a.end()
typedef pair<int,int> P;
const long long mod=998244353;
const long long inf=1ll<<61;
int p[105];
signed main(){
  int n;cin>>n;
  rep(i,n)cin>>p[i];
  sort(p,p+n);
  for(int x=100;x>=0;x--){
    int cnt=0;
    rep(i,n)if(p[i]>=x)cnt++;
    if(cnt>=x){
      cout<<x<<endl;return 0;
    }
  }
}


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

int main() {
  string S;
  int a = 0, b, c = 0;
  cin >> S;
  if (S.at(0) != 'A') cout << "WA" << endl;
  else {
    for (int i = 2; i < S.size() - 1; i++) {
      if (S.at(i) == 'C') a++;
    }
    if (a != 1) cout << "WA" << endl;
    else {
      for (int i = 2; i < S.size() - 1; i++) {
        if (S.at(i) == 'C') b = i;
      }
      for (int i = 1; i < b; i++) {
        c += isupper(S.at(i));
      }
      for (int i = b + 1; i < S.size(); i++) {
        c += isupper(S.at(i));
      }
      if (c != 0) cout << "WA" << endl;
      else cout << "AC" << endl;
    }
  }
}

Measured memory_bytes: 256
#pragma region RegionDefs
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define reps(i,l,r) for(int i=(l),i##_len=(r);i<i##_len;++i)
#define repr(i,l,r) for(int i=(r)-1,i##_left=(l);i>=i##_left;--i)
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
const ll INF = 1e9;
template<class T=ll> using V = vector<T>;
template<class T=ll> using PQ = priority_queue<T>;
template<class T=ll> using PQG = priority_queue<T, V<T>, greater<T>>;
const ll MOD = 100007LL;
void in() {}
template<class Head, class... Tail>
void in(Head&& head, Tail&&... tail) { cin >> head; in(move(tail)...); }
#define IN(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define TIN(T, ...) T __VA_ARGS__; in(__VA_ARGS__)
#define VIN(T, v, n) V<T> v(n); for(auto& _elem:v)cin>>_elem
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (a>b) {a=b; return 1;} return 0;}
template<class T>
string join(vector<T>& v, string delim="") { ostringstream os; rep(i,v.size())i?os<<delim<<v[i]:os<<v[0]; return os.str(); }
#pragma endregion RegionDefs

void solve()
{
    IN(d, t, s);
    cout << (d <= t * s ? "Yes" : "No") << endl;
}

int main()
{
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;
}

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

void swap(int* i, int* j)
{
        int temp_i = *i;
        int temp_j = *j;

        *i = temp_j;
        *j = temp_i;
}

int main()
{
        //input integers
        int* A;
        int* B;
        int* C;

        int X;
        int Y;
        int Z;

        cin >> X >> Y >> Z;

        swap(&X, &Y);
        swap(&X, &Z);

        A = &X;
        B = &Y;
        C = &Z;

        cout << (*A) << endl;
        cout << (*B) << endl;
        cout << (*C) << endl;
        return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define rep(n) for(int i=0;i<n;i+=1)
#define fill(c,v) memset(c,v,sizeof(c));
#define prarr(a,n) rep(n) cout<<a[i]<<" \n"[i==n-1]; 
#define sc(a) scanf("%d",&a);
#define scl(a) scanf("%lld",&a);
#define scf(a) ascanf("%f",&a);
#define ff first
#define ss second
#define pu push_back
#define inf 1000000001
#define MOD 1000000007 
#define INF 100000000000001
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int s;
    cin>>s;
    vector<ll> v;
    map<ll,bool> m;
    ll a;
    m[s] = 1;
    a =s;
    if(s&1)
    a = 3*a+1;
    else 
     a = a/2;
 	int c =1; 
    while(m[a]!=1)
    {
     m[a]=1; 

    if(a&1)
    a = 3*a+1;
    else 
     a = a/2; 
    c++;
    }	
    cout<<c+1<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int n;
char sl[30005];

int main()
{
	cin >> n >> sl;

	int count = 0;

	for (char i = '0'; i <= '9'; i++)
	{
		for (char j = '0'; j <= '9'; j++)
		{
			for (char k = '0'; k <= '9'; k++)
			{
				const char* p = sl;
				bool f_i = false, f_j = false, f_k = false;
				while (p != sl + n)
				{
					if (!f_i)
					{
						if (*p == i)
						{
							f_i = true;

						}
						goto FINA;
					}
					if (!f_j)
					{
						if (*p == j)
						{
							f_j = true;
						}
						goto FINA;
					}
					if (!f_k)
					{
						if (*p == k)
						{
							f_k = true;
							break;
						}
						goto FINA;
					}
				FINA:
					p++;
				}
				if (f_i && f_j && f_k)
					count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<iomanip>
#include<map>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s[n];
    map<string,int>d;
    bool flag=true;
    for(int i=0;i<n;i++){
        cin>>s[i];
        d[s[i]]++;
        if(d[s[i]]>1)flag=false;
        if(i>0){
            if(s[i][0]!=s[i-1][s[i-1].size()-1])flag=false;
        }
    }
    if(flag)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 3620
// https://atcoder.jp/contests/abc138/tasks/abc138_c
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define BIT(n) (1LL << (n))
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> v(n);
    REP(i, n) cin >> v[i];
    sort(ALL(v));
    double d = v[0];
    for (int i = 1; i < n; i++) {
        d = (d + v[i]) / 2;
    }
    cout << setprecision(10) << d << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()

if s[0] == s[1] == s[2] == 'S':
  print(0)
elif s[1] != 'R' and (s[0] == 'R' or s[2] == 'R'):
  print(1)
elif s[1] == 'R' and s.count('R') == 2:
  print(2)
elif s[1] == 'R' and s.count('R') == 1:
  print(1)
else:
  print(3)

Measured memory_bytes: 9116
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = nextInt(scanner);
        long[] fx = new long[n];
        long[] fy = new long[n];
        for (int i = 0; i < n; i++) {
            long x = nextLong(scanner);
            long y = nextLong(scanner);
            fx[i] = x - y;
            fy[i] = x + y;
        }
        long fxMax = Arrays.stream(fx).max().orElse(0);
        long fxMin = Arrays.stream(fx).min().orElse(0);
        long fyMax = Arrays.stream(fy).max().orElse(0);
        long fyMin = Arrays.stream(fy).min().orElse(0);
        System.out.println(Math.max(fxMax - fxMin, fyMax - fyMin));
    }

    private static int nextInt(Scanner scanner) {
        return Integer.parseInt(scanner.next());
    }

    private static long nextLong(Scanner scanner) {
        return Long.parseLong(scanner.next());
    }

    private static float nextFloat(Scanner scanner) {
        return Float.parseFloat(scanner.next());
    }

    private static double nextDouble(Scanner scanner) {
        return Double.parseDouble(scanner.next());
    }


}


class UnionFind {
    int[] parent;

    UnionFind(int n) {
        parent = new int[n];
        Arrays.fill(parent, -1);
    }

    int find(int x) {
        if (parent[x] < 0) {
            return x;
        } else {
            parent[x] = find(parent[x]);
            return parent[x];
        }
    }

    void unite(int x, int y) {
        int rootX = find(x);
        int rootY = find(y);
        if (rootX == rootY) {
            return;
        }

        if (parent[rootX] > parent[rootY]) {
            int temp = rootX;
            rootX = rootY;
            rootY = temp;
        }
        parent[rootX] += parent[rootY];
        parent[rootY] = rootX;
    }

}


Measured memory_bytes: 64108
#include <bits/stdc++.h>
using namespace std;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef long double ld;
typedef int32_t i32;

#define int long long
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front

#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>=b;i--)
#define FILL(a,b,c) for(ll i=0;i<c;i++) a[i]=b;

#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define allr(v) (v).rbegin(), (v).rend()

#define endl "\n"
#define setpri(x) setprecision(x)
#define vp(x) cout<<#x<<" : "<< (x)<<" | "
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define forf(i,a,b) for(int i=a;i<b;i++)

#define INF 1e17+4
#define MINF 
#define MAX_INT 100000
#define MOD 1000000007
ll mod(ll n) { n %= MOD; if (n < 0) return n + MOD; else return n;}
vector<int> adj[1000002];
int vis[1000002],dep[1000002],siz[1000002];

// void dfs(ll cur,ll par)
// {
//     vis[cur]=1;siz[cur]=1;
//     for(auto x:adj[cur])
//     {
//         if(vis[x]!=1)
//         {
//             dep[x]=dep[cur]+1;
//             dfs(x,cur);
//             siz[cur]+=siz[x];
//         }    
//     }
// }
void dfs(ll cur)
{
    queue<int> q;
    q.push(1);
    vis[1]=0;dep[1]=0;
    int p=0;
    while(!q.empty())
    {
        int tp=q.front();q.pop();
        if(vis[tp]==1)
        {
            continue;
        }
        int r=dep[tp];
        vis[tp]=1;
        for(auto x:adj[tp])
        {
            if(vis[x]!=1)
            {
                if(dep[x]==0)
                    dep[x]=tp;
                q.push(x);
            }
        }
    }

}

// bool sortfunc(const pair<int,int> &a, const pair<int,int> &b) 
// { 
//     return ;


void solve()
{
    int n,m;
    cin>>n>>m;
    forf(i,0,m)
    {
        int x,y;
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    dfs(1);
    forf(i,1,n+1)  
        if(vis[i]==0)
        { no;return;}
    yes;
    forf(i,2,n+1)
        cout<<dep[i]<<endl;
        
}

signed main()
{
    FAST;
    
    // ll t;cin>>t;while(t--)
        solve();
 
    return 0;
}














Measured memory_bytes: 35212
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
using namespace std;
#define MAX 300000
typedef long long ll;

char t[MAX],d[MAX];
ll N,Q;
string s;




bool mycheck(ll goal,ll place){
  for(ll i=1;i<=Q;i++){
    if(t[i]==s[place-1]){
      if(d[i]=='L') place--;
      else place++;
    }
    if(place==goal) return true;
    if(place==0 || place==N+1) return false;
  }
  return false;
}

int main(){
  cin>>N>>Q>>s;

  for(ll i=1;i<=Q;i++){
    cin>>t[i]>>d[i];
  }

  ll s=0,e=N+1,ans0,ansN,ans,h;
  h=(s+e)/2;

  while(true){
    if(mycheck(0,h)) s=h;
    else e=h;
    h=(s+e)/2;
    if(s+1==e) break;
  }
  ans0=s;

  s=0,e=N+1;
  h=(s+e)/2;

  while(true){
    if(mycheck(N+1,h)) e=h;
    else s=h;
    h=(s+e)/2;
    if(s+1==e) break;
  }
  ansN=e;
  if(ans0+1>=ansN) ans=N;
  else ans=ans0+(N+1-ansN);
  cout<<N-ans<<endl;




}


Measured memory_bytes: 1028
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define alll(v) v.begin(),v.end()
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}cout<<endl;}

ll memo[201][100001];

ll solve(vector<ll> &v, int start, ll target){
    ll len = v.size() - start;
    if(len == 1) return target % v[start];
    ll ans2, ans1;
    if(memo[start + 1][target] != -1 ) ans2 = memo[start + 1][target];
    else {
        memo[start + 1][target] = solve(v, start +1, target);
        ans2 = memo[start + 1][target];
    }
    if(memo[start + 1][target % v[start]] != -1 ) ans1 = memo[start + 1][target % v[start]];
    else {
        memo[start + 1][target % v[start]] = solve(v, start +1, target % v[start]);
        ans1 = memo[start + 1][target % v[start]];
    }
    return (ans1 + (len - 1) * ans2) % 1000000007;
}

int main() {
    rep(i, 201) rep(j, 100001) memo[i][j] = -1; 
    ll n,r;
    cin>>n>>r;
    vector<ll> v;
    rep(i, n) {
        ll x;
        cin >>x;
        v.push_back(x);
    }
    sort(alll(v));
    reverse(alll(v));
    ll sum = solve(v, 0, r);
    pr(sum);
    return 0;
}



Measured memory_bytes: 157312
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;


int main(){
    
    int n; cin>>n;
    vector<ll> a(n);
    REP(i,n)cin>>a[i];
    
    ll t=2;
    ll ans = (a[0]==1)?0:a[0]-1; a[0]=1;
    for(int i=1;i<n;i++){
        if(a[i]>t){
            if(a[i]%t==0){
                ans+=a[i]/t-1;
            }else{
                ans+=a[i]/t;
            }
        }else if(a[i]==t){
            t++;
        }
    }
    
    cout<<ans<<endl;
    
    return 0;
}


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

#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

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

    for (int x = 1; x <= 10000; x++) {
        int aa = x * 8 / 100;
        int bb = x * 10 / 100;
        if (a == aa && b == bb) {
            cout << x;
            return 0;
        }
    }
    cout << -1;

    return 0;
}

Measured memory_bytes: 256
a, b, c = map(int, input().split())
if b < a:
    tmp = a
    a = b
    b = tmp
if c < a:
    tmp = c
    c = b
    b = a
    a = tmp
elif c < b:
    tmp = b
    b = c
    c = tmp

print(a, b, c)


Measured memory_bytes: 5596
#include <iostream>
#include <cmath>

int main() {
   
   int x1,x2,x3,x4,x5;
   
   std::cin >> x1 >> x2 >> x3 >> x4 >> x5;
   
   int sum = x1 + x2 + x3 + x4 + x5;
   
   std::cout << 15 - sum << std::endl;
   
   return 0;
   
}


Measured memory_bytes: 3156
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cmath>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> p(n), q(n), vec(n);
    for (int i = 0; i < n; i++) cin >> p[i];
    for (int i = 0; i < n; i++) cin >> q[i];
    for (int i = 0; i < n; i++) vec[i] = i+1;
    int i = 1, a, b;
    do {
        if (vec == p) a = i;
        if (vec == q) b = i;
        i++;
    } while (next_permutation(vec.begin(), vec.end()));
    cout << abs(a-b) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  int N,A;
  cin >> N >> A;
  if(N%500<=A) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import numpy as np

n, k = map(int, input().split())

p = np.asarray(list(map(int, input().split())))

e = (p + 1) / 2

ans = 0
sum = 0

for i in range(n - k + 1):
    if i == 0:
       ans = np.add.reduce(e[:k])
       sum = np.add.reduce(e[:k])

    else:
        sum = sum - e[i-1] + e[i+k-1]
        if ans < sum:
            ans = sum + 1 - 1

print(ans)


Measured memory_bytes: 33984
#include <bits/stdc++.h> 
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 2e5+10;
const int N = 1e5+10;
const int E = 1e6+10; 
ll n,m,k;

int main(){
	cin>>n>>m;
	if(n>=10) cout<<m<<endl;
	else{
		m = m+100*(10-n);
		cout<<m<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;

int main() {
    int N;
    string S, T;
    cin >> N >> S >> T;
    S.erase(unique(S.begin(), S.end()), S.end());
    T.erase(unique(T.begin(), T.end()), T.end());
    N = S.length();
    
    
    vector<bool> A(N);
    for (int i = 0; i < N; i++) A[i] = (S[i]==T[i]);
    long long ans = (A[0] ? 3 : 6);
    for (int i = 1; i < N; i++) {
        if (A[i]) {
            if (A[i-1]) ans *= 2;
        } else {
            if (A[i-1]) ans *= 2;
            else ans *= 3;
        }
        ans %= MOD;
    }
    
    cout << ans%MOD << endl;
    return 0;
}

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

const int mod = 1e9+7;

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

    int n;
    string s, t;
    cin >> n >> s >> t;

    if (s == t) {
        cout << n << endl;
        return 0;
    }

    int ma = 0;
    rep(i, n) {
        int cnt = 1;
        if (s[i] == t[0]) {
            rep(j, n - 1 - i) {
                if (s[i + j + 1] == t[j + 1]) cnt++;
            }
            ma = max(ma, cnt);
        }
    }

    cout << 2 * n - ma << endl;

    return 0;
}


Measured memory_bytes: 256
#include<set>
#include<cstdio>

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

using namespace std;

typedef long long ll;

const ll P=1000000007,Pinv=13499267949257065399;

int main(){
	int n,q;
	char s[300001]; scanf("%d%d%s",&n,&q,s);

	static ll Ppow[300002];
	Ppow[0]=1;
	rep(i,300001) Ppow[i+1]=P*Ppow[i];

	set<ll> S;
	int l=0,r=0;
	ll h=s[0];
	while(q--){
		char cmd[8]; scanf("%s",cmd);
		if(cmd[0]=='L' && cmd[1]=='+'){
			h-=s[l]*Ppow[r-l];
			l++;
		}
		else if(cmd[0]=='L' && cmd[1]=='-'){
			l--;
			h+=s[l]*Ppow[r-l];
		}
		else if(cmd[0]=='R' && cmd[1]=='+'){
			r++;
			h=h*P+s[r];
		}
		else{
			h=(h-s[r])*Pinv;
			r--;
		}
		S.insert(h);
	}

	printf("%d\n",S.size());

	return 0;
}

Measured memory_bytes: 17728
a,b,c=map(int,input().split())
#b=int(input())
#c=int(input())
day=0
cnt=0
while(True):
    day+=1
    #print(day)
    #print(c)
    if day%7==0:
        c-=b
    c-=a
    if c<=0:
        break
print(day)


Measured memory_bytes: 5596
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
#include<unordered_map>
using namespace std ;

#define MAXN 300007

int n , m ;

pair < int , int > a[ MAXN ] ;

vector < int > open[ MAXN ] ;
vector < int > close[ MAXN ] ;

vector < int > divs[ MAXN ] ;
int ans[ MAXN ] ;


class Tree {
public :
    int tr[ 5 * MAXN ] ;
    void init ( int where , int IL , int IR ) {
        tr[ where ] = 0 ;
        if ( IL == IR ) { return ; }
        int mid = ( IL + IR ) / 2 ;
        init ( 2 * where , IL , mid ) ;
        init ( 2 * where + 1 , mid + 1 , IR ) ;
    }
    void update ( int where , int IL , int IR , int pos , int val ) {
        if ( IR < pos || pos < IL ) { return ; }
        tr[ where ] += val ;
        if ( IL == IR ) { return ; }
        int mid = ( IL + IR ) / 2 ;
        if ( pos <= mid ) {
            update ( 2 * where , IL , mid , pos , val ) ;
        }
        else {
            update ( 2 * where + 1 , mid + 1 , IR , pos , val ) ;
        }
    }
    int query ( int where , int IL , int IR , int pos ) {
        if ( IL > pos ) { return 0 ; }
        if ( IR <= pos ) { return tr[ where ] ; }
        int mid = ( IL + IR ) / 2 ;
        return ( query ( 2 * where , IL , mid , pos ) + query ( 2 * where + 1 , mid + 1 , IR , pos ) ) ;
        
    }
};
Tree w ;

void calc_divs ( ) {
    int cnt = 0 ;
    for ( int i = 1 ; i <= m ; ++ i ) {
        for ( int j = i ; j <= m ; j += i ) {
            divs[ j ].push_back ( i ) ;
            ++ cnt ;
        }
    }
}

void input ( ) {
    scanf ( "%d%d" , &n , &m ) ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        scanf ( "%d%d" , &a[ i ].first , &a[ i ].second ) ;
        open[ a[ i ].first ].push_back ( i ) ;
        close[ a[ i ].second ].push_back ( i ) ;
    }
}

void solve ( ) {
    calc_divs ( ) ;
    w.init ( 1 , 1 , m ) ;
    for ( int i = 1 ; i <= m ; ++ i ) {
        int sz = open[ i ].size ( ) ;
        for ( int j = 0 ; j < sz ; ++ j ) {
            w.update ( 1 , 1 , m , a[ open[ i ][ j ] ].first , 1 ) ;
        }
        sz = divs[ i ].size ( ) ;
        int cnt = w.query ( 1 , 1 , m , i ) ;
        for ( int j = 0 ; j < sz ; ++ j ) {
            ans[ divs[ i ][ j ] ] += cnt - w.query ( 1 , 1 , m , i - divs[ i ][ j ] ) ;
        }
        sz = close[ i ].size ( ) ;
        for ( int j = 0 ; j < sz ; ++ j ) {
            w.update ( 1 , 1 , m , a[ close[ i ][ j ] ].first , -1 ) ;
        }
    }
    for ( int i = 1 ; i <= m ; ++ i ) {
        printf ( "%d\n" , ans[ i ] ) ;
    }
}


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


Measured memory_bytes: 41856
#include<bits/stdc++.h>
using namespace std;
int A[300000],B[300000];
int flag[300000];
int n,q;
void evaluate(int k){
  if(flag[k]==0) return ;
  A[k*2+1]=A[k*2+2]=B[k];
  B[k*2+1]=B[k*2+2]=B[k];
  flag[k*2+1]=flag[k*2+2]=1;
  flag[k]=0;
  return ;
}
int update(int s,int t,int x,int k,int l,int r){
  if(s>=r || l>=t) return A[k];
  if(s<=l && r<=t){
    A[k]=x;
    B[k]=x;
    flag[k]=1;
    return A[k];
  }
  evaluate(k);
  int al=update(s,t,x,k*2+1,l,(l+r)/2);
  int ar=update(s,t,x,k*2+2,(l+r)/2,r);

  return A[k]=min(al,ar);
}
int find(int i,int k){
  if(flag[k]) A[i]=B[k];
  if(k==0) return A[i];
  return find(i,(k-1)/2);
}
int main(){
  int com,s,t,x,k;
  for(int i=0;i<300000;i++) A[i]=B[i]=INT_MAX;
  cin>>n>>q;
  int ra=1;
  while(ra<=n) ra*=2;
  n=ra;
  for(int i=0;i<q;i++){
    cin>>com;
    if(com==0){
      cin>>s>>t>>x;
      update(s,t+1,x,0,0,n);
    }
    else if(com==1){
      cin>>k;
      cout<<find(k+n-1,k+n-1)<<endl;
    }
  }
  //for(int i=0;i<10;i++) cout<<A[i]<<endl;
  return 0;
}



Measured memory_bytes: 6236
#include <bits/stdc++.h>
#include<algorithm>
#include<cmath>
#define ll long long
#define pb push_back
#define vi vector<int>
#define si set<int>
#define msi multiset<int>
#define vll vector<ll>
#define ff first
#define ss second
#define pii pair<int,int>
#define mp make_pair
#define all(a) a.begin(),a.end()
#define f(i,x,n) for(int i=x;i<n;i++)
#define fd(i,n,x) for (int i=n;i>=x;i--)
#define itr :: iterator it
#define endl '\n'
#define INF 1e9
#define mod 1e9+7

using namespace std;
ll step(ll i,ll n,ll k,vector<ll>&h,vector<ll>&dp)
{
    if(i==n-1)
        return 0;
    if(i>=n)
        return INF;
    if(dp[i]!=-1)
        return dp[i];

        ll mini=INF;
        /*ll left=abs(h[i]-h[i+2])+step(i+2,n,h,dp);
        ll right;
        /*if(i+2>=n)
        right=INF;
        else
        right=abs(h[i]-h[i+1])+step(i+1,n,h,dp);*/
        for(int x=1;x<=k;x++)
        {
            ll ans=abs(h[i]-h[i+x])+step(i+x,n,k,h,dp);
            mini=min(mini,ans);
        }
        return dp[i]=mini;

}
int main()
{
    ll n,k;
    cin>>n>>k;
    vector<ll>h;
    vector<ll> dp(n,-1);
    for(ll i=0;i<n;i++)
    {
        ll a;
        cin>>a;
        h.push_back(a);
    }
    cout<<step(0,n,k,h,dp);
}


Measured memory_bytes: 14324
import sys
import heapq
from collections import deque

# sys.setrecursionlimit(100001)
INF = sys.maxsize


# ===CODE===
def main():
    n = int(input())

    rslt = set()


    for i in range(n):
        rslt.add(input())

    print(len(rslt))


if __name__ == '__main__':
    main()


Measured memory_bytes: 31440
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main(void){
  int N;
  ll K;
  int ans=0;
  cin >> N >> K;
  ll P[100010]={0};
  int a,b;
  for(int i=0;i<N;i++){
    cin >> a >> b;
    P[a]+=b;
  }
  for(int i=1;i<100010;i++){
    if(K<=P[i]){
      cout << i;
        return 0;
    }
    K-=P[i];
  }
}

Measured memory_bytes: 1024
N = input()
N = int(N[-1])
if N == 2 or N == 4 or N == 5 or N == 7 or N == 9:
    print("hon")
elif N == 0 or N == 1 or N == 6 or N == 8:
    print("pon")
else:
    print("bon")

Measured memory_bytes: 61856
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
int main(){
    int N;cin>>N;
    vl info(N);
    rep(i,N)cin>>info[i];
    sort(all(info));
    ll ans=INF;
    rep(i,info[N-1]+1){
        ll now=0;
        rep(j,N){
            now+=pow(info[j]-i,2);
        }
        ans=min(ans,now);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
fn input() -> String{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).expect("Error");
    buf.trim().to_string()
}
fn main(){
    let s = &input();
    let w = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
    let mut i = 7;
    for day in &w{
        if s != day{
            i -= 1
        }else{
            println!("{}", i);
            break;
        }
    }
    
}

Measured memory_bytes: 4352
main = do
    [x,n] <- map read . words <$> getLine :: IO [Int]
    ps <- map read . words <$> getLine :: IO [Int]
    print $ if n == 0
                then x
                else head $ [x + s * d | d <- [0..x], s <- [-1,1], notElem (x + s * d) ps ]


Measured memory_bytes: 4244
#include<bits/stdc++.h>
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int mod = 1000000007;

int main() {
  double a, b, h, m;
  cin >> a >> b >> h >> m;
  double minute = 360 * m / 60;
  double hour = 360 * h / 12 + minute / 12;
  double diff = abs(minute - hour);
  double theta = min(diff, 360 - diff);
  // cout << theta << endl;

  theta = (theta / 360) * 2 * M_PI;
  double dc = a * a + b * b - 2 * a * b * cos(theta);
  dc = sqrt(dc);
  printf("%.16f\n", dc);
}

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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i = 0;i < n;i++) cin >> h[i];
    sort(h.begin(),h.end());
    k = min(n,k);
    long long ans = 0;
    for(int i = 0;i < k;i++){
        h.pop_back();
    }
    for(int i = 0;i < h.size();i++) ans += h[i];
    cout << ans << endl;
    return 0;
}    


Measured memory_bytes: 1024
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
    a, b, c = nm()
    k = ni()
    t = 0
    while a >= b:
        b *= 2
        t += 1
    while b >= c:
        c *= 2
        t += 1
    print('Yes' if t <= k else 'No')
    return

solve()


Measured memory_bytes: 9196
NM = [int(i) for i in input().split()]
N, M = NM[0], NM[1]
abList = sorted([[int(i) for i in input().split()] for _ in range(M)], key=lambda x: x[1])
bridge = 0
ans = 0

for ab in abList:
    if not ab[0] <= bridge < ab[1]:
        bridge = ab[1] - 1
        ans += 1

print(ans)

Measured memory_bytes: 23604
#include <stdio.h>
#include <stdlib.h>

int diff(int a, int b)
{
  return (a > b) ? a - b : b - a;
}

int str_length(const char s[])
{
  int len = 0;

  while (s[len])
    len++;
  return len;
}

int main(void)
{
  char s[11];
  int a[10];
  scanf("%s", s);

  int len = str_length(s);
  for (int i = 0; i < len; i++) {
    a[i] = s[i] - '0';
  }
  int min = diff(753, a[0] * 100 + a[1] * 10 + a[2]);
  for (int i = 1; i < len - 2; i++)
    if (diff(753, a[i] * 100 + a[i + 1] * 10 + a[i + 2]) < min)
      min = diff(753, a[i] * 100 + a[i + 1] * 10 + a[i + 2]);
  printf("%d\n", min);	

  return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#define N 101

int n,Go[N],Back[N],Link[N],Keep[N][N],Count=1;

void dfs(int x){
	int i;
	Go[x] = Count++;

	for(i = 0; i < Link[x]; i++){
		if(Go[Keep[x][i+1]] == 0){
			dfs(Keep[x][i+1]);
		}
	}
	Back[x] = Count++;
}
  
int main(){

	int i,j,Num;

	scanf("%d",&n);
	for( i = 0; i < n; i++){
		Go[i+1] = Back[i+1] = 0;
		scanf("%d",&Num);
		scanf("%d",&Link[Num]);
		for(j = 0; j < Link[Num]; j++) scanf("%d",&Keep[Num][j+1]);
	}

	for(i = 0; i < n; i++) if(Go[i+1] == 0) dfs(i+1);

	for(i = 0; i < n; i++){
		printf("%d %d %d\n",i+1,Go[i+1],Back[i+1]);
	}

	return 0;
}

Measured memory_bytes: 636
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define F first
#define S second
#define ins insert
#define mp make_pair
#define fo(i, n1, n, x) for(int i = n1; i <= n; i += x)
#define foo(i, n, n1, x) for(int i = n; i >= n1; i -= x)
#define bit __builtin_popcount
#define md (l + ((r - l) / 2))
#define all(x) x.begin(),x.end()
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

const int N = 2e5 + 11, mod = 1e9 + 7, mod2 = 998244353;
const int MAX = 3e5 + 11;
const int INF1 = 2e9 + 11;
const ll INF2 = 2e18 + 11;
const double INF3 = 1e8 + 11;
const int base = 500;
const int P = 31;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const double EPS = 1e-6;
const double PI = acos(-1.0);


template<typename T> using ordered_set = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }


typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

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

string s;
int ans[N],add[N];
main() {
    file("cowdate");
    ios;
    cin>>s;
    int n=s.size();
    int l=0,r=0;
    while (1) {
//        cout<<r<<' ';
        ++r;
        if (r>1) ++r;
        int cnt1=1,cnt2=0;
        while (r<n and s[r]=='R') ++r,++cnt1;
        int bound=r;
        while (r<n and s[r]=='L') ++r,++cnt2;
        --r;
        if (cnt1%2==cnt2%2) {
            ans[bound-1]=ans[bound]=(cnt1+cnt2)/2;
        } else {
            if (cnt1&1) ans[bound-1]=(cnt1+cnt2+1)/2,ans[bound]=ans[bound-1]-1;
            else ans[bound]=(cnt1+cnt2+1)/2,ans[bound-1]=ans[bound]-1;
        }
//        cout<<r<<'\n';
        if (r==n-1) break;
    }
    for (int i=0;i<n;++i) cout<<ans[i]<<' ';
    return 0;
}
/**

*/


Measured memory_bytes: 1104
#include <bits/stdc++.h>
using namespace std;
//make_tuple emplace_back next_permutation push_back make_pair second first setprecision

#if MYDEBUG
#include "lib/cp_debug.h"
#else
#define DBG(...) ;
#endif

using LL = long long;
constexpr LL LINF=334ll<<53;
constexpr int INF=15<<26;
constexpr LL  MOD=1E9+7;

struct Problem{
    int n,ans,loop;
    vector<pair<int,int>> p;
    Problem(LL n):n(n),p(n){};

    void dfs(int mask, multiset<pair<int,int>> slopes){
        int s = 0;
        for(int i=0; i<n; ++i){
            if(((mask>>i)&1) ==0){
                s=i;
                break;
            }
            if(i==n-1){
                assert(slopes.size()==n/2);
                //DBG(slopes)
                auto it = slopes.begin();
                vector<int> c;
                int tmp=0;
                for(;it!=slopes.end();++it){
                    c.push_back(slopes.count(*it));
                }
                assert(c.size()==n/2);
                for(int i=0; i<(int)c.size(); ++i){
                    tmp+=c[i]*(c[i]-1)/2;
                    i+=c[i]-1;
                }
                ans=max(ans,tmp);
                loop++;
                return;
            }
        }
        pair<int,int> p1 ,p2;

        for(int i=s+1; i<n; ++i){
            p1=p[s];
            if((mask>>i)&1)continue;
            p2=p[i];
            if(p1.first>p2.first)swap(p1,p2);
            pair<int,int>slope;
            if(p1.first==p2.first)slope={0,1};
            else if (p1.second==p2.second)slope={1,0};
            else{
                int dy=p2.second-p1.second;
                int dx=p2.first-p1.first;
                int g=__gcd(dx,dy);
                slope={dx/g,dy/g};
            }
            slopes.insert(slope);
            dfs((mask|(1<<i))|(1<<s),slopes);
            slopes.erase(slopes.lower_bound(slope));
            //slopes.erase(slope);
        }
    }
    void solve(){
        ans=0;loop=0;
        for(int i=0; i<n; ++i){
            cin >> p[i].first >> p[i].second;
        }
        dfs(0,{});
        cout << ans <<"\n";
        DBG(loop)
    }
};

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    long long n=0;
    cin >> n;
    Problem p(n);
    p.solve();
    return 0;
}

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

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

	if(a > b)
		cout << "a > b" << endl;
	if(a < b)
		cout << "a < b" << endl;
	if(a == b)
		cout << "a == b" << endl;

	return 0;
}

Measured memory_bytes: 1156
#include <iostream>
using namespace std;
#define MAX 10000
#define NIL -1
struct node{int parent,left,right;};
node T[MAX];
int n,D[MAX],H[MAX];
void setDepth(int u,int d)
{
    if(u==NIL)  return ;
    D[u]=d;
    setDepth(T[u].left,d+1);
    setDepth(T[u].right,d+1);
}
int setHeight(int u)
{
    int h1=0,h2=0;
    if(T[u].left!=NIL)
        h1=setHeight(T[u].left)+1;
    if(T[u].right!=NIL)
        h2=setHeight(T[u].right)+1;
    return H[u]=(h1>h2 ? h1:h2);
}
int getSibling(int u)
{
    if(T[u].parent==NIL)
        return NIL;
    if(T[T[u].parent].left!=u && T[T[u].parent].left!=NIL)
        return T[T[u].parent].left;
    if(T[T[u].parent].right!=u && T[T[u].parent].right!=NIL)
        return T[T[u].parent].right;
    return NIL;
}
void print(int u)
{
    cout<<"node "<<u<<": ";
    cout<<"parent = "<<T[u].parent<<", ";
    cout<<"sibling = "<<getSibling(u)<<", ";
    int deg=0;
    if(T[u].left!=NIL)  deg++;
    if(T[u].right!=NIL)  deg++;
    cout<<"degree = "<<deg<<", ";
    cout<<"depth = "<<D[u]<<", ";
    cout<<"height = "<<H[u]<<", ";
    if(T[u].parent==NIL)
        cout<<"root"<<endl;
    else if(T[u].left==NIL && T[u].right==NIL)
        cout<<"leaf"<<endl;
    else
        cout<<"internal node"<<endl;
}
int main()
{
    int v,l,r,root=0;
    cin>>n;
    for(int i=0;i<n;i++)
        T[i].parent=NIL;
    for(int i=0;i<n;i++)
    {
        cin>>v>>l>>r;
        T[v].left=l;
        T[v].right=r;
        if(l!=NIL)  T[l].parent=v;
        if(r!=NIL)  T[r].parent=v;
    }
    for(int i=0;i<n;i++)
        if(T[i].parent==NIL)
            root=i;
    setDepth(root,0);
    setHeight(root);

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



Measured memory_bytes: 3124