akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = n;i >= m;i--)
#define REPO(i, n) for(int i = 1;i <= n;i++)
#define ll long long
#define INF 1999999999
#define MINF -1999999999
#define ALL(n) n.begin(),n.end()

int main() {
	string s;
	int a = INF, b = MINF;
	cin >> s;
	REP(i, s.size()) {
		if (s[i] == 'A') a = min(a, i);
		if (s[i] == 'Z') b = max(b, i);
	}
	cout << b - a + 1 << endl;
}

Measured memory_bytes: 640
#include<stdio.h>
#include<string>
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int N, K, Q;
    cin >> N >> K >> Q;
    
    int exc = Q-K;
    
    vector<int> v(N);

    while(Q--){
        int x;
        scanf("%d",&x);
        v[x-1]++;
    }
    
    for(int i=0;i<N;i++){
        if(v[i]>exc)
            printf("Yes\n");
        else
            printf("No\n");
    }
    



}

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

const int N = 13;
const int mod = 1000000007;


int main() {
	// 入力
	string S;
	cin >> S;

	int dp[N];	// DPテーブル
	memset(dp, 0, sizeof(dp));
	dp[0] = 1;

	// 動的計画法(DP)
	int mul = 1;
	rep(i, (int)S.size()) {
		int nextDP[N];
		memset(nextDP, 0, sizeof(nextDP));
		if (S[S.size() - i -1] == '?') {
			rep(k, 10) {
				rep(j, N) {
					nextDP[(k * mul + j) % N] += dp[j];
					nextDP[(k * mul + j) % N] %= mod;
				}
			}
		}
		else {
			int k = S[(int)S.size() - i - 1] - '0';
			rep(j, N) {
				nextDP[(k * mul + j) % N] += dp[j];
				nextDP[(k * mul + j) % N] %= mod;
			}
		}
		mul *= 10;
		mul %= N;
		rep(j, N) {
			dp[j] = nextDP[j];
		}
	}
	cout << dp[5] << endl;

	return 0;
}


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

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

  int x=0, mi=0;
  rep(i, n) {
    if (s[i]=='(') x++;
	if (s[i]==')') x--;
	mi=min(mi, x);
  }
  rep(i, -mi) s="("+s;
  rep(i, x-mi) s=s+")";
  cout<<s<<endl;
}


Measured memory_bytes: 256
inp0 = input()
inp = [int(x) for x in input().split(" ")]

ans = 0
for index in range(1, len(inp)-1):
    a = sorted([inp[index-1], inp[index], inp[index+1]])
    if min(a) == inp[index]:
        pass
    chk = list(set(a))
    # if not len(chk) == 2 and inp[index] == a[1]:
    if inp[index] == a[1]:
            ans = ans+1
    # elif  and inp[1] == a[1]
    #         ans = ans+1

print(ans)

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Range Set
//-------------------------------------------------
template<typename T>
class RangeSet
{
private:
    ::std::vector<int> v;
    ::std::unordered_map<T, int> Map;
    ::std::vector<::std::vector<T> > data;
    int kind;
public:
    RangeSet(const ::std::vector<T> &v_):v(v_.size()){
        int sz = v_.size(); kind = 0;
        for(int i=0;i<sz;i++){
            T t = v_[i];
            if (Map.count(t)){
                data[Map[t]].push_back(i);
            }else{
                Map[t] = kind++;
                data.push_back(::std::vector<T>());
                data.back().push_back(i);
            }
            v[i] = Map[t];
        }
    }
    int query(T x){
        if (!Map.count(x)) return 0;
        return data[Map[x]].size();
    }
    int query(int a, int b, T x){
        if (a>b) return 0;
        if (!Map.count(x)) return 0;
        int xi = Map[x];
        auto right = ::std::upper_bound(data[xi].begin(),data[xi].end(),b);
        auto left  = ::std::lower_bound(data[xi].begin(),data[xi].end(),a);
        return right-left;
    }
    void update(int k, T x){
        int ei = v[k];
        auto eitr = ::std::lower_bound(data[ei].begin(),data[ei].end(),k);
        data[ei].erase(eitr);
        v[k] = Map[x];
        if (Map.count(x)){
            int xi = Map[x];
            auto itr = ::std::lower_bound(data[xi].begin(),data[xi].end(),k);
            data[xi].insert(itr, k);
        }else{
            Map[x] = kind++;
            data.push_back(::std::vector<T>());
            data.back().push_back(k);
        }
    }
};

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    vll a(n);
    rep(i,n){cin>>a[i]; a[i]--;}
    vll s(n+1);
    s[0] = 0;
    rep(i,n) s[i+1]=(s[i]+a[i])%k;
    RangeSet<ll> rs(s);
    ll ans=0;
    rep(i, n){
        ans+=rs.query(i+1, i+k-1, s[i]);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 24692
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
     
int main(){
  int N;
  std::cin >> N;
  int x0=0,x1,y0=0,y1,t0=0,t1;
  for(int i=0;i<N;i++){
    std::cin >> t1 >> x1 >> y1;
    int sum=abs(x0-x1)+abs(y0-y1);
    if(t1-t0<abs(sum)){
      std::cout << "No" <<std::endl;
      return 0;
    }

    if((t1-t0)%2!=abs(sum)%2){
      std::cout << "No" <<std::endl;
      return 0;
    }
    x0=x1;
    y0=y1;
    t0=t1;

  }
  std::cout << "Yes" <<std::endl;
}

Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	// input1 = input[0].split(' ').map((n) => (parseInt(n)))
	// input[0].split(' ').map((n) => (parseInt(n)))
	// input[2].split(' ').map((n) => (parseInt(n)))
	// ans = input.filter((n) => (s <= n)).length
	var ans = 1000
	inputarr = []
	for (var i = 0; i < input[0].length -2; i++) {
		inputarr.push(input[0].slice(i, i+3))
	}
	inputarr.forEach((n) => {
		if (Math.abs(753 - n) < ans) {
			ans = Math.abs(753 - n) 
		}
	})

	//出力
	console.log(ans)
}
// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
// Main(require('fs').readFileSync('./input.txt', 'utf-8'));

Measured memory_bytes: 21064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;

int main(){
    int N;
    std::cin >> N;

    int l, i = 0, W[N];
    while (std::cin >> l) {
        W[i] = l;
        i++;
        if (i >= N) {
            break;
        }
    }
    int s_1=0,s_2=0;
    int minWeight = 10000;
    int absWeight;
    for(i=0;i<N-1;i++){
        s_1=0;
        s_2=0;
        for(int j=0;j<=i;j++) s_1 += W[j];
        for(int j=i+1;j<N;j++) s_2 += W[j];
        absWeight = abs(s_1-s_2);
        if(minWeight > absWeight) minWeight = absWeight;
    }
    printf("%d\n",minWeight);

    return 0;
}

Measured memory_bytes: 256
/*
------------____________----------------
--------------CRISTIANO-----------------
SUUUUUUUUUIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
GOOOOOOOOOOOOOOAAAAAAAALLLLLLLLLLLLLLLLL
 
Author- Shubham Jha
IIIT- ALLAHABAD
*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl "\n"
ll ans(ll n)
{
    if(n==1)
        return 1;
    else
    {
        return (1+2*ans(n/2));
    }
    
}
int main()
{
  ll n;
  cin>>n;
  cout<<ans(n);
}

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

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        String[] arrS = s.split("");
        Arrays.sort(arrS);

        boolean result = arrS[0].equals(arrS[1]) && arrS[2].equals(arrS[3]) && !arrS[0].equals(arrS[2]);

        System.out.println(result ? "Yes" : "No");
    }
}


Measured memory_bytes: 21844
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  long long int A[N], sum=0, sum_0=0, ans[N];
  for(int i=0; i<N; i++) cin >> A[i];
  for(int i=0; i<N; i++) sum += A[i];
  for(int i=1; i<N; i+=2) sum_0 += A[i];
  ans[0] = sum - 2*sum_0;
  for(int i=0; i<N-1; i++){
    ans[i+1] = 2*A[i] - ans[i];
  }
  for(int i=0; i<N; i++) cout << ans[i] << " ";
  cout << endl;
  return 0;
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


typedef long long ll;
ll hint = 10;
int get(ll n) {
    if (n == 0) return 0;

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


    /*if (n <= hint && to_string(n) <= to_string(hint)) return 1;
    if (n > hint && to_string(n) > to_string(hint)) return 1;
    return 0;*/

    fflush(stdout);
    string s; cin >> s;
    if (s == "Y") return 1;
    else return 0;
}
//---------------------------------------------------------------------------------------------------
ll str2int(string s) {
    ll res = 0;
    fore(i, s) res = res * 10 + i - '0';
    return res;
}
//---------------------------------------------------------------------------------------------------
ll solve() {
    int ng = 1, ok = 19;
    while (ng + 1 != ok) {
        int x = (ng + ok) / 2;
        string s = "1";
        rep(i, 0, x - 1) s += "0";
        if (!get(str2int(s))) ok = x;
        else ng = x;
    }
    int dig = ok - 1;

    if (dig == 18) {
        ng = 0, ok = 11;
        while (ng + 1 != ok) {
            int x = (ng + ok) / 2;
            string s = "9";
            rep(i, 0, x - 1) s += "9";
            if (get(str2int(s))) ok = x;
            else ng = x;
        }
        dig = ok;
    }

    string ans = "";
    rep(i, 0, dig - 1) {
        int ok = 0, ng = 10;
        while (ok + 1 != ng) {
            int x = (ok + ng) / 2;
            string a = ans + char('0' + x);
            if (get(str2int(a))) ok = x;
            else ng = x;
        }
        ans += char('0' + ok);
    }

    ng = -1, ok = 10;
    while (ng + 1 != ok) {
        int x = (ok + ng) / 2;
        string a = ans + char('0' + x) + "0";
        if (get(str2int(a))) ok = x;
        else ng = x;
    }
    ans += char('0' + ok);

    return str2int(ans);
}
//---------------------------------------------------------------------------------------------------
void _main() {

    ll a = solve();
    printf("! %lld\n", a);

    return;
    
    rep(i, 1, 1010) {
        hint = i;
        ll b = solve();
        if (hint != b) printf("ng! %d\n", i);
    }

    

    //rep(i, 0, 10) cout << get(1200 + i * 10) << endl;
}

Measured memory_bytes: 596
#include<stdio.h>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;
int a[200008];
int main(void)
{
	long long sum1=0,sum2=0,min,q;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		sum1=sum1+a[i];
	}	
	min=10e15;
	for(q=0;q<n-1;q++)
	{
		long long w;
		sum2=sum2+a[q];
		sum1=sum1-a[q];
		if(sum2-sum1>0)
			w=sum2-sum1;
		else
			w=sum1-sum2;
		if(min>w)
      		min=w;	
  }
	
	printf("%lld\n",min);	
	
	return 0;
 } 

Measured memory_bytes: 1024
/* You got a dream , you gotta protect it . */
/* Sometimes you win , sometimes you learn . */
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lp(i , N) for(ll i = 0; i < ll (N) ; i++)
#define debug(x) cout<<" [ " << #x << " is: " << x << " ] "<<endl;
using namespace std;
typedef long long ll;
typedef long double ld;
const long double EPS = 1e-6;
const long double pi = acos(-1);
int main(){
    FAST
    ll n;
    cin >> n;
    set<ll>s;
    for(ll i = 0; i < n; i++){
        ll num;
        cin >> num;
        s.insert(num);
    }
    if(s.size() == n) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll n, ans = -1; string s; cin >> n >> s;
    for(ll cut=1; cut<n; cut++){
        ll cnt = 0;
        set<char> ch1, ch2;
        for(auto p: s.substr(0, cut)) ch1.insert(p);
        for(auto p: s.substr(cut)) ch2.insert(p);
        for(auto p: ch1) if(ch2.find(p) != ch2.end()) cnt++;
        chmax(ans, cnt); 
    }
    cout << ans << endl;
}

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

int main() {
  int x, a, b;
  cin >> x >> a >> b;
  if (abs(x-a)<abs(x-b)) {
    cout << 'A' << endl;
  }
  else {
    cout << 'B' << endl;
  }
}


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

#include <iostream>
#include <fstream>

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

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

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

#endif //INCLUDE_DEBUG_HPP

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

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

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

debug dbg;

class BCollatzProblem {
public:
	void solve(std::istream& in, std::ostream& out)
	{
        int s;
        in >> s;
        vector<int> resv;
        map<int, int> mp;
        while(!mp[s]){
            resv.push_back(s);
            mp[s] = 1;
            if(s % 2 == 0) s /= 2;
            else s = 3*s + 1;
        }

        out << resv.size()+1 << endl;
	}
};


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


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

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

template<class T, int SZ> struct sums {
    T sum[SZ][SZ];
    sums () { memset(sum,0,sizeof sum); }
    void init() {
        FOR(i,1,SZ) FOR(j,1,SZ) 
            sum[i][j] += sum[i][j-1]
            +sum[i-1][j]-sum[i-1][j-1];
    }
    T get(int X1, int X2, int Y1, int Y2) {
        return sum[X2][Y2]-sum[X1-1][Y2]
        	-sum[X2][Y1-1]+sum[X1-1][Y1-1];
    }
};

sums<int,2005> cum[3];
int N,M,Q;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M >> Q;
    FOR(i,1,N+1) FOR(j,1,M+1) {
        char c; cin >> c;
        if (c == '1') cum[0].sum[i][j] = 1;
    }
    FOR(i,1,N) FOR(j,1,M+1) if (cum[0].sum[i][j] && cum[0].sum[i+1][j]) cum[1].sum[i][j] = 1;
    FOR(i,1,N+1) FOR(j,1,M) if (cum[0].sum[i][j] && cum[0].sum[i][j+1]) cum[2].sum[i][j] = 1;
    // cout << cum[0].sum[3][4] << "\n";
    F0R(i,3) cum[i].init();
    F0R(i,Q) {
        int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        cout << cum[0].get(x1,x2,y1,y2)-cum[1].get(x1,x2-1,y1,y2)-cum[2].get(x1,x2,y1,y2-1) << "\n";
    }
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS

Measured memory_bytes: 48896
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=0, b=0;
		while(true){
			int H = scan.nextInt(), W = scan.nextInt();
			if(H==0 && W==0) break;
			for (int j=0;j<H;j++) {
				for(int i=0;i<W;i++){
					if(0==((i+j)%2)) System.out.print("#");
					else System.out.print(".");
				}
				System.out.println();
			}
			System.out.println();
		}
	}
}


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

int linearSearch(int *, int, int);


main()
{

	int n, q;
	int *s, *t;
	int c=0;
	
	int i;


	scanf("%d", &n);
	s = (int *)malloc( sizeof(int) *(n+1) );
	for( i=0; i<n; i++) {
		scanf("%d", &s[i]);
	}
	
	scanf("%d", &q);
	t = (int *)malloc( sizeof(int) *q );
		for( i=0; i<q; i++) {
		scanf("%d", &t[i]);
	}
	
	
	for( i=0; i<q; i++) {
		c += linearSearch( s, n, t[i]);
	}
	
	printf("%d\n", c);
	
	return 0;
	
}


int linearSearch(int *array, int length, int key) {
		
	int i=0;
	array[length] = key;
	
	while(array[i] != key) {
			i++;
	}
	if( i==length ) {
		return 0;
	}
	return 1;
}

Measured memory_bytes: 632
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

// Mod int
// cf. https://www.youtube.com/watch?v=1Z6ofKN03_Y
struct mint {
  ll x;
  mint(ll x = 0) : x((x + MOD) % MOD) {}
  mint& operator+= (const mint a) {
    if ((x += a.x) >= MOD) x %= MOD;
    return *this;
  }
  mint operator+ (const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint& operator-= (const mint a) {
    if ((x += MOD - a.x) >= MOD) x %= MOD;
    return *this;
  }
  mint operator- (const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint& operator*= (const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator* (const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) { return 1; }
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(MOD-2);
  }
  mint& operator/= (const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/ (const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

const ll MAX_N = 1005;
// dp[i][j] .. number at (i-1,j-1)
mint dp[MAX_N][MAX_N];

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

  ll h, w;
  cin >> h >> w;
  vector<string> a(h);
  rep(r, h) {
    cin >> a[r];
  }

  rep(r, h) rep(c, w) {
    if (a[r][c] != '#') {
      if (r == 0 && c == 0) {
        dp[r][c] = 1;
      } else if (r == 0) {
        dp[r][c] += dp[r][c-1];
      } else if (c == 0) {
        dp[r][c] += dp[r-1][c];
      } else {
        dp[r][c] += dp[r][c-1];
        dp[r][c] += dp[r-1][c];
      }
    }
  }
  cout << dp[h-1][w-1].x << endl;
}


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

char s[30];
bool f[30];

int main(){
 scanf("%s",s);
 int len = strlen(s); 
 bool f0 = 1;
 for(int i = 0 ; i < len ; i++){
  if(f[s[i]-'a']){
    f0 = 0;
    break;
  }
  f[s[i]-'a'] = 1;
 }
 puts(f0 ? "yes" : "no");
 return 0;
}

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

#include <algorithm>

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

using namespace std;

/*


int ans[100010] = {0};
vector<pair<int, int>> path;
vector<pair<int, int>> tmp;

vector<int> func(vector<int> next) {

	vector<int> ret;
	for (int from : next) {

		for (auto p : path) {
			if (p.first == from && ans[p.second] == 0)
			{
				
				ans[p.second] = p.first;
				ret.push_back(p.second);
			}
			if (p.second == from && ans[p.first] == 0)
			{
				ans[p.first] = p.second;
				ret.push_back(p.first);
			}
			else {
				tmp.push_back(p);
			}
		}
		swap(path, tmp);
		tmp.clear();
	}
	return ret;
}

bool check(int N) {

	for (int i = 2; i < N + 1; i++)
	{
		if (ans[i] == 0)
			return false;
		return true;
	}
}

int main() {

	int N, M;
	vector<pair<int, int>> tmp;

	cin >> N >> M;

	rep(i, M) {
		int a, b;
		cin >> a >> b;
		path.push_back({ a, b });

	}


	vector<int> next = { 1 };
	while (!path.empty())
	{

		next = func(next);

		if (next.empty())break;

	}
	if (check(N)) {

		cout << "Yes" << endl;
		for (int i = 2; i < N + 1; i++)
		{
			cout << ans[i] << endl;
		}

	}
	else
	{
		cout << "No";
	}


	return 0;
}

*/
/*
vector<int> to[10010];
int main() {
	int N, M;
	cin >> N >> M;

	rep(i, M) {
		int a, b;
		cin >> a >> b;
		to[a].push_back(b);
		to[b].push_back(a);
	}

	queue<int> q;
	q.push(1);

	vector<int> dist(N+1, -1);
	vector<int> pre(N+1, -1);

	dist[0] = 0;

	while (!q.empty())
	{
		int f = q.front(); q.pop();
		for (auto u : to[f])
		{
			//cout << u;
			if (dist[u] != -1)continue;
			dist[u] = dist[f] + 1;
			pre[u] = f;

			q.push(u);
		}
	}

	rep(i, N) {
		if (i == 0)continue;
		cout << pre[i] << endl;
	}

	cin >> N;

	return 0;
}

*/

vector<int> path[100010];
int main() {
	int N, M;
	cin >> N >> M;

	rep(i, M)
	{
		int a, b;
		cin >> a >> b;

		path[a].push_back(b);
		path[b].push_back(a);
	}

	queue<int> from;
	vector<int> done( N+1,0 );
	done[1] = 1;
	vector<int> ans( N+1,0 );
	from.push(1);

	while (!from.empty()) {
		int f = from.front(); from.pop();
		for (auto p : path[f])
		{
			if (done[p] != 0)continue;
			done[p] = 1;
			ans[p] = f;
			from.push(p);
		}
	}

	cout << "Yes" << endl;
	rep (i, N+1) {
		if (i == 0)continue;
		if (i == 1)continue;
		cout << ans[i] << endl;
	}
	//cin >> N;

	return 0;
}

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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;

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

   int h, n, cnt = 0, a;
   cin >> h >> n;
   vector<int> x;

   rep(i, n)
   {
      cin >> a;
      x.push_back(a);
      cnt += a;
   }

   if (cnt >= h)
   {
      cout << "Yes" << '\n';
   }
   else
   {
      cout << "No" << '\n';
   }
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int maxn = 110000;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    ll n;
    cin >> n;
    vector<ll> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    vector<ll> b(n + 1);
    map<ll, int> mp;
    for (int i = 1; i <= n; i++)
    {
        b[i] = i - a[i];
        mp[a[i] + i]++;
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++)
    {
        ll cur = b[i];
        ans += mp[cur];
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 28996
#include <bits/stdc++.h>
using namespace std;
#define dhoom ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);  
typedef long long ll;
#define fi first
#define se second
#define sc scanf
#define pr printf
#define pb push_back
const ll inf = 1e18;
const int nax = 2e6 + 7;
const ll mod = 1e9 + 7;
using namespace std;
ll exp(ll a , ll b){
	if(b == 0)	return 1;
	int x = b % 2 == 0 ?   ((exp(a , b/2)%mod)*(exp(a , b / 2)%mod))%mod :  (a%mod*exp(a , b - 1) % mod)%mod;
	return x;
}
ll ans[10000];
int main(int argc,char ** argv){
	dhoom;
	int n , x , y;
	cin >> n >> x >> y;
	x-- , y--;				
	for(int i = 0 ; i < n ; i++){
		for(int j = i + 1 ; j < n ; j++){
			int	 dis = min(min(abs(i - j) , abs(i-x) + abs(y - j) + 1 ), abs(x - j) + 1 + abs(y - i));
			ans[dis]++; 
		}
	}
	for(int i = 1 ; i <= n - 1  ; i++){
		cout << ans[i] << endl;
	}
	return 0;
}


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

using namespace std;

int main()
{
  int x, n;
  cin >> x >> n;
  if (n == 0)
  {
    cout << x << "\n";
    return 0;
  }

  int v[101];
  for (int i = 0; i <= 100; i++)
  {
    v[i] = 0;
  }

  int p;
  for (int i = 0; i < n; i++)
  {
    cin >> p;
    v[p] = 1;
  }

  int res = x;
  int i = 0;
  while (true)
  {
    if (x - i <= 0)
    {
      res = 0;
      break;
    }

    if (v[x - i] == 0)
    {
      res = x - i;
      break;
    }

    if (x + i >= 101)
    {
      res = 101;
      break;
    }
    if (v[x + i] == 0)
    {
      res = x + i;
      break;
    }

    i++;
  }

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


Measured memory_bytes: 3636
h = {
    1 => 1,
    2 => 2,
    3 => 2 ** 2,
    4 => 2 * 3,
    5 => 2 ** 4,
    6 => 2 ** 2 * 3,
    7 => 2 ** 6,
    8 => 2 ** 3 * 3,
    9 => 2 ** 2 * 3 ** 2,
    10 => 2 ** 4 * 3,
    11 => 2 ** 10,
    12 => 2 ** 2 * 3 * 5,
}
p h[gets.to_i]


Measured memory_bytes: 6868
#include <bits/stdc++.h>
 
using namespace std;
 
#define ld long double
#define ll long long

const int N = 1002;

int n,m,ans;
char g[N][N];
vector<pair<int,int>> src;
int d[N][N];
bool vis[N][N];

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

void bfs(vector<pair<int,int>> s){
    queue<pair<int,int>> q;
    for(int i=0;i<s.size();i++){
        q.push(s[i]);
        vis[s[i].first][s[i].second] = 1;
        d[s[i].first][s[i].second] = 0;
    }
    while(!q.empty()){
        int x = q.front().first;
        int y = q.front().second;
        q.pop();
        for(int i=0;i<4;i++){
            if(!vis[x + dx[i]][y + dy[i]] && g[x + dx[i]][y + dy[i]] != '#'){
                q.push({x + dx[i], y + dy[i]});
                vis[x + dx[i]][y + dy[i]] = 1;
                d[x + dx[i]][y + dy[i]] = d[x][y] + 1;
                ans = d[x + dx[i]][y + dy[i]];
            }
        }
    }
}

int main(){
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
    #endif*/
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;

    cin>>n>>m;
    for(int i=0;i<=n+1;i++){
        for(int j=0;j<=m+1;j++){
            g[i][j] = '#';
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>g[i][j];
            if(g[i][j] == '#'){
                src.push_back({i, j});
            }
        }
    }

    bfs(src);

    cout<<ans;

    return 0;
}

Measured memory_bytes: 29928
#include <bits/stdc++.h>
using namespace std;
#define show(x) cout << #x << " : " << x << endl
int n, i, a[100001][4];
int main ()
{
    cin >> n;
    for(i = 1; i <= n; i++) cin >> a[i][1] >> a[i][2] >> a[i][3];
    for(i = 2; i <= n; i++)
    {
        a[i][1] += max(a[i-1][2], a[i-1][3]);
        a[i][2] += max(a[i-1][1], a[i-1][3]);
        a[i][3] += max(a[i-1][1], a[i-1][2]);
    }
    cout << max(a[n][1], max(a[n][2], a[n][3])) << endl;
}



Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <random>
#include <time.h>
using namespace std;
int main() {
	long long int n, a[100],yan;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (a[i] < a[j]) {
				yan = a[i];
				a[i] = a[j];
				a[j] = yan;
			}
		}
	}
	cout << a[0] - a[n - 1] << endl;
}

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

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

ll pow_ (ll x, ll n, ll M){
    ll u = 1;
    if(n > 0){
        u = pow_(x, n/2, M);
        if (n % 2 == 0) u = (u*u) % M;
        else u = (((u * u)% M) * x) % M;
    }
    return u;
};

int main() {
    int n, p;
    cin >> n >> p;
    ll odd = 0, even = 0;
    for (int i = 0; i < n; ++i) {
        int k;
        cin >> k;
        (k % 2 ? odd : even)++;
    }
    ll ans;
    if(!p){
        if(odd == 0) ans = pow_(2, odd+even, numeric_limits<ll>::max());
        else ans = pow_(2, odd+even-1, numeric_limits<ll>::max());
    }else {
        if(odd == 0) ans = 0;
        else {
            ans = pow_(2, odd+even-1, numeric_limits<ll>::max());
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
int main () {
    int n;
    cin >> n;
    int l[n];
    for (int i = 0; i < n; i++) {
        cin >> l[i];
    }
    int ret = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if ((l[i] + l[j] > l[k]) && (l[j] + l[k] > l[i]) && (l[k] + l[i] > l[j])) {
                    if ((l[i] != l[j]) && (l[j] != l[k]) && (l[k] != l[i])) {
                        ret++;
                    }
                }
            }
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<stdio.h>
#include<string.h>

using namespace std;
int main()
{
    char  sr[5];
    int a=0;
    cin>>sr;
    int i;
    for(i=0;sr[i]!='\0';i++)
    {
    	if(sr[i]=='+')
    		a++;
    	else
    		a--;
	}
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
def cmb(n, k, mod):
    numerator = 1
    for i in range(k):
        numerator = (numerator * (n-i)) % mod

    denominator = 1
    for i in range(1, k+1):
        denominator = (denominator * i) % mod

    return (numerator * pow(denominator, mod-2, mod)) % mod


def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x


def myPow(x, n, m):
    if(n == 0):
        return 1
    if(n % 2 == 0):
        return myPow(x * x % m, n / 2, m)
    else:
        return x * myPow(x, n - 1, m) % m


n, a, b = map(int, input().split())
mod = 10**9 + 7
print((myPow(2, n, mod) - cmb(n, a, mod) - cmb(n, b, mod) - 1) % mod)


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

using namespace std;

int main(){
	string st;
	cin>>st;
	int f=0;
	for (int i=0;i<st.size();++i){
		if (st[i]=='C') f=1;
		if (st[i]=='F'&&f==1) f=2; 
	}
	if (f==2) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import sys
from collections import defaultdict
def input(): return sys.stdin.readline().rstrip()

class UnionFind:
    def __init__(self, n):
        self.n = n + 1
        self.parents = [-1] * (n + 1)
        self.mem = [[] for _ in range(n+1)]

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)
    
    def size(self, x):
        return -self.parents[self.find(x)]
    
    def members(self, x):
        root = self.find(x)
        if not self.mem[root]:
            self.mem[root] = [i for i in range(1, self.n) if self.find(i) == root]
        return self.mem[root]

def main():
    N, M, K = map(int, input().split())

    friends = defaultdict(lambda : 1)
    friendsGroup = UnionFind(N)
    for _ in range(M):
        a, b = map(int, input().split())
        friendsGroup.union(a, b)
        friends[a] += 1
        friends[b] += 1

    block_and_same = defaultdict(int)
    for _ in range(K):
        c, d = map(int, input().split())
        if friendsGroup.same(c, d):
            block_and_same[c] += 1
            block_and_same[d] += 1

    ans = [0] * (N + 1)
    for i in range(1, N+1):
        ans[i] = friendsGroup.size(i) - friends[i] - block_and_same[i]
    print(*ans[1:])

if __name__ == '__main__':
    main()


Measured memory_bytes: 43028
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,x;
    int a[100];
    scanf("%d%d",&n,&x);
    int num=0;
    int t=1;
    for(int i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        num+=a[i];
        if(num<=x)
            t++;
    }
    printf("%d\n",t);
    return 0;
}



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

using namespace std;

int main(){

  int n, m;
  cin >> n >> m;
  int l = -1e9;
  int r = 1e9;
  for(int i = 0; i < m; i++){
    int a , b;
    cin >> a >> b;
    l = max(a, l);
    r = min(b, r);
  }
  int ans = max(r - l + 1, 0);
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
import sys
n,m=map(int,input().split())
l=[]
if m==0:
    if n==1:
        print(0)
        sys.exit()
    else:
        print(10**(n-1))
        sys.exit()
for i in range(m):
    l.append(list(map(int,input().split())))
sortfirst=lambda val:val[0]
l.sort()
l.sort(key=sortfirst)
for i in range(m-1):
    if l[i][0]==l[i+1][0] and l[i][1]!=l[i+1][1]:
        print(-1)
        sys.exit()
if l[0]==[1,0] and n>=2:
    print(-1)
    sys.exit()
ans=[1]+[0]*(n-1)
for i in range(m):
    ans[l[i][0]-1]=l[i][1]
print("".join(map(str,ans)))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
using namespace std;
int n,m,d[100000],z=0;
vector<int> v[100000];
bool b[100000];
void f(int x, int y){
    if(x==y){
        z++;
        return;
    }
    b[x]=true;
    for(int i=0;i<v[x].size();i++){
        if(!b[v[x][i]]){
            f(v[x][i], y);
        }
    }
}
int main(void){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    int u=0;
    for(int i=0;i<n;i++){
        d[i]=v[i].size();
        if(d[i]%2==1){
            cout<<"No"<<endl;
            return 0;
        }
        if(d[i]==6)u=3;
        if(d[i]==4)u=min(3, u+1);
    }
    if(u<2){
        cout<<"No"<<endl;
        return 0;
    }
    if(u==2){
        int x=-1,y;
        for(int i=0;i<n;i++){
            if(d[i]==4){
                if(x==-1)x=i;
                else y=i;
            }
        }
        fill(b, b+n, false);
        b[x]=true;
        for(int i=0;i<v[x].size();i++){
            if(!b[v[x][i]]){
                f(v[x][i], y);
            }
        }
        if(z==4){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 7424
from collections import deque
d = {
    'a': deque([i for i in input()]),
    'b': deque([i for i in input()]),
    'c': deque([i for i in input()]),
}
s = 'a'
while True:
    if len(d[s]) == 0:
        print(s.upper())
        break
    t = d[s].popleft()
    s = t

Measured memory_bytes: 3316
#include<iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int p[n], q[n];
    for(int i=0; i<n; i++)
    {
        cin>>p[i];
        q[i] = p[i];
    }

    for(int i=0; i<n; i++)
    {
        for(int j=i+1; j<n; j++)
        {
            if(q[i]>q[j])
            {
                int temp = q[i];
                q[i] = q[j];
                q[j] = temp;
            }
        }
    }

    int c=0;

    for(int i=0; i<n; i++)
    {
        if(p[i]==q[i])
            continue;
        c++;
    }

    if(c<=2)
        cout<<"YES";
    else
        cout<<"NO";

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        Integer a[] = new Integer[N];
        for (int i=0; i<N; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a, Comparator.reverseOrder());
        long ret = 0;
      for(int i=0;i<N;i++){
       if(i>=K){
         ret += a[i];
       }
        
      }
      System.out.println(ret);
    }
}

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

using namespace std;

#define sp(x) cout<<setprecision(x);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define all(a) (a).begin(), (a).end()
#define inf 10000000
#define linf INT64_MAX*0.99
#define print(s) cout<<(s)<<endl
#define lint long long
#define yes "Yes"
#define no "No"

typedef pair<int, int> P;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s; //s.length() = 4;
    cin>>s;
    char a = s[0];
    char b = '0';
    string ans = "Yes";
    int cnta = 1, cntb = 1;

    FOR(i,1,4){
        if(s[i]!=a&&b=='0'){
            b = s[i];
            continue;
        }
        if(s[i]!=a&&s[i]!=b) ans = "No";
        if(s[i]==a) cnta++;
        if(s[i]==b) cntb++;
    }
    if(cnta!=2||cntb!=2) ans = "No";
    print(ans);
    return 0;
}

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

int W, H;
bool Buildings[102][102] = { false };
bool visible[102][102] = { false };

void visibilityDiffusion(int w, int h){
	if (w == 0 || h == 0 || w == W + 1 || h == H + 1) return;
	if (visible[w][h]) return;

	visible[w][h] = true;
	if (!Buildings[w-1][h]) visibilityDiffusion(w-1, h);
	if (!Buildings[w+1][h]) visibilityDiffusion(w+1, h);
	if (h % 2 == 1){
		// odd
		if (!Buildings[w][h-1]) visibilityDiffusion(w, h-1);
		if (!Buildings[w][h+1]) visibilityDiffusion(w, h+1);
		if (!Buildings[w+1][h-1]) visibilityDiffusion(w+1, h-1);
		if (!Buildings[w+1][h+1]) visibilityDiffusion(w+1, h+1);
	}
	else{
		// even
		if (!Buildings[w-1][h-1]) visibilityDiffusion(w-1, h-1);
		if (!Buildings[w-1][h+1]) visibilityDiffusion(w-1, h+1);
		if (!Buildings[w][h-1]) visibilityDiffusion(w, h-1);
		if (!Buildings[w][h+1]) visibilityDiffusion(w, h+1);
	}
}

int main(){
	cin >> W >> H;
	for (int i = 1; i <= H; i++){
		for (int j = 1; j <= W; j++){
			cin >> Buildings[j][i];
		}
	}

	// 建物がない場所のうち、外から見える部分を探索する
	for (int i = 1; i <= W; i++){
		if (!Buildings[i][1]) visibilityDiffusion(i, 1);
		if (!Buildings[i][H]) visibilityDiffusion(i, H);
	}
	for (int i = 1; i <= H; i++){
		if (!Buildings[1][i]) visibilityDiffusion(1, i);
		if (!Buildings[W][i]) visibilityDiffusion(W, i);
	}

	int ans = 0;
	int hole = 0;
	for (int i = 1; i <= H; i++){
		for (int j = 1; j <= W; j++){
			if (Buildings[j][i]){
				ans += 6;
				if (Buildings[j+1][i]) ans -= 2;
				if (i % 2 == 1){
					// odd
					if (Buildings[j][i+1]) ans -= 2;
					if (Buildings[j+1][i+1]) ans -= 2;
				}
				else{
					// even
					if (Buildings[j][i+1]) ans -= 2;
					if (Buildings[j-1][i+1]) ans -= 2;
				}
			}
			else if (!visible[j][i]){
				hole += 6;
				if (!Buildings[j+1][i]) hole -= 2;
				if (i % 2 == 1){
					// odd
					if (!Buildings[j][i+1]) hole -= 2;
					if (!Buildings[j+1][i+1]) hole -= 2;
				}
				else{
					// even
					if (!Buildings[j][i+1]) hole -= 2;
					if (!Buildings[j-1][i+1]) hole -= 2;
				}
			}
		}
	}

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

Measured memory_bytes: 1644
/**
*    author:  Dooloper
*    created: 06.06.2020 10:37:22
**/

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <functional>
#include <cassert>
#include <math.h>


using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define PI 3.14159265358979323846264338327950L

int main() {
    cin.tie(0);
    int A, B, C, D;
    cin >> A >> B >> C >> D;
    long double tate = PI * 2 * ((long double)C / 12.0 + ((long double)D / 60.0) / 12.0 - (long double)D / 60.0);
    long double yoko = (long double)(A * A + B * B) - (long double)(2 * A * B) * cosl(tate);

    printf("%20.20Lf\n", sqrt(yoko));
    return 0;
}

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

int main() {
  string t;
  string s;
  cin >> s;
  bool yes = true;
  while(t.size()<s.size()) {
    int start = t.size();
    if(s[start] == 'd') {
      t += "dream";
    } else if (s[start] == 'e') {
      if(s.size()-t.size() == 1) {
        yes = false;
        break;
      } else if (s.size()-t.size() == 2) {
        t += "er";
      } else if (s.size()-t.size() >= 3) {
        if(s[start+2]=='a') {
          t += "erase";
        } else if(s[start+2]=='e') {
          t += "ererase";
        } else if(s[start+2]=='d') {
          t += "erdream";
        } else {
          yes = false;
          break;
        }
      } else {
        yes = false;
        break;
      }
    } else if (s[start] == 'r') {
      t += 'r';
    } else {
      yes = false;
      break;
    }
  }

  if(s != t) yes = false;
  if(yes) cout << "YES" << endl;
  else cout << "NO" << endl;
}

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

int main(){
    string s;
    cin >> s;
    ll k,ans=0,ans2=0;
    cin >> k;
    int n=0,p=s.size()-1;
    if(s.at(0)!=s.at(p)){
    while(n<s.size()-1){
        if(s.at(n)==s.at(n+1)){
            ans++;
            n+=2;
        }else{
            n++;
        }
    }
    ans*=k;
    }else{
      while(n<s.size()-1){
        if(s.at(n)==s.at(n+1)){
            ans++;
            n+=2;
        }else{
            n++;
        }
    }
    if(n==s.size()){
        ans*=k;
    }else{
        n=1;
        ans2++;
       while(n<s.size()-1){
        if(s.at(n)==s.at(n+1)){
            ans2++;
            n+=2;
        }else{
            n++;
        }
    }
    if(n!=s.size()){
        ans2*=k-1;
        ans+=ans2;
    }else{
        if(k%2==0){
            ans=(ans+ans2)*k/2;
        }else{
            ans=(ans+ans2)*(k-1)/2+ans;
        }
    }
    }  
    }
    
    
    cout << ans;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from collections import defaultdict
N,M = map(int,input().split())
abc = [list(map(int,input().split())) for i in range(M)]

g = defaultdict(list)
rg = defaultdict(list)
for a,b,c in abc:
    g[a].append((b,c))
    rg[b].append(a)

inf = 10**20
score = [-inf]*(N+1)
score[1] = 0

for i in range(N-1):
    for v in range(1,N+1):
        for nv, c in g[v]:
            if score[v] + c > score[nv]:
                score[nv] = score[v] + c

update = [False]*(N+1)
for v in range(1,N+1):
    for nv, c in g[v]:
        if score[v] + c > score[nv]:
            score[nv] = score[v] + c
            update[v] = True

visited = [False]*(N+1)
l = [N]
while l:
    v = l.pop()
    visited[v] = True
    for nv in rg[v]:
        if not visited[nv]:
            l.append(nv)
for u,v in zip(update, visited):
    if u and v:
        print('inf')
        exit()

print(score[N])


Measured memory_bytes: 75740
#include<stdio.h>
int main()
{
  int a, b, d, r;
  double e,s,f;
  scanf("%d %d", &a, &b);
  d = a / b;
  r = a%b;
  e = a; s = b;
  f = e / s;
  printf("%d %d %0.9lf\n",d,r,f);
  return 0;
}

Measured memory_bytes: 2724
from math import *
from collections import *
from random import *
from decimal import Decimal
from bisect import *
import sys
input=sys.stdin.readline
def lis():
    return list(map(int,input().split()))
def ma():
    return map(int,input().split())
def inp():
    return int(input())

n,k=ma()
a=lis()
l,h=0,max(a)
while(l+1<h):
    m=(l+h)//2
    c=0
    for i in a:
        c+=ceil(i/m)-1
    if(c<=k):
        h=m
    else:
        l=m
print(h)
        
        
    


Measured memory_bytes: 109888