akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

using namespace std;
# define INF 0x3f3f3f3f 

// iPair ==> Integer Pair 
typedef pair<int, int> iPair;

int dd[10000] = { 0, };

// This class represents a directed graph using 
// adjacency list representation 
class Graph
{
	int V; // No. of vertices 

		   // In a weighted graph, we need to store vertex 
		   // and weight pair for every edge 
	list< pair<int, int> > *adj;

public:
	Graph(int V); // Constructor 

				  // function to add an edge to graph 
	void addEdge(int u, int v, int w);

	// prints shortest path from s 
	void shortestPath(int s);
};

// Allocates memory for adjacency list 
Graph::Graph(int V)
{
	this->V = V;
	adj = new list<iPair>[V];
}

void Graph::addEdge(int u, int v, int w)
{
	adj[u].push_back(make_pair(v, w));
	adj[v].push_back(make_pair(u, w));
}

// Prints shortest paths from src to all other vertices 
void Graph::shortestPath(int src)
{
	priority_queue< iPair, vector <iPair>, greater<iPair> > pq;

	// Create a vector for distances and initialize all 
	// distances as infinite (INF) 
	vector<int> dist(V, INF);
	// Insert source itself in priority queue and initialize 
	// its distance as 0. 
	pq.push(make_pair(0, src));
	dist[src] = 0;

	/* Looping till priority queue becomes empty (or all
	distances are not finalized) */
	while (!pq.empty())
	{
		// The first vertex in pair is the minimum distance 
		// vertex, extract it from priority queue. 
		// vertex label is stored in second of pair (it 
		// has to be done this way to keep the vertices 
		// sorted distance (distance must be first item 
		// in pair) 
		int u = pq.top().second;
		pq.pop();

		// 'i' is used to get all adjacent vertices of a vertex 
		list< pair<int, int> >::iterator i;
		for (i = adj[u].begin(); i != adj[u].end(); ++i)
		{
			// Get vertex label and weight of current adjacent 
			// of u. 
			int v = (*i).first;
			int weight = (*i).second;

			// If there is shorted path to v through u. 
			if (dist[v] > dist[u] + weight)
			{
				// Updating distance of v 
				dist[v] = dist[u] + weight;
				pq.push(make_pair(dist[v], v));
			}
		}
	}

	for (int i = 0; i < V; i++) {
		dd[dist[i]]++;
		//printf("%d->%d= %d\n", src, i, dist[i]);
	}
}

// Driver program to test methods of graph class 
int main()
{
	// create the graph given in above fugure 
	int n, x, y;
	cin >> n >> x >> y;
	Graph g(n);
	for (int i = 0; i < n-1; i++) {
		g.addEdge(i, i + 1, 1);
	}
	g.addEdge(x - 1, y - 1, 1);
	for (int i = 0; i < n; i++) {
		dd[i] = 0;
	}
	for (int k = 0; k < n; k++) {
		g.shortestPath(k);
	}
	for (int i = 1; i < n; i++) {
		printf("%d\n", dd[i]/2);
	}
	return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] x = new int[m];
        for (int i = 0; i < m; i++) {
            x[i] = sc.nextInt();
        }
        if (n >= m) {
            System.out.println(0);
            return;
        }
        Arrays.sort(x);
        ArrayList<Integer> l = new ArrayList<>();
        for (int i = 1; i < m; i++) {
            l.add(x[i] - x[i - 1]);
        }
        Collections.sort(l);
        int ans = x[m - 1] - x[0];
        for (int i = 0; i < n - 1; i++) {
            // System.out.println(l.get(l.size() - 1 - i));
            ans -= l.get(l.size() - 1 - i);
        }
        System.out.println(ans);
    }

}


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

char a[51][51];
int dx[]={-1,0,1},dy[]={-1,0,1};
int main(){
	int h,w;
	cin>>h>>w;
	for(int i=0;i<=w;i++){
		a[1][i]='.';
	}
	for(int i=1;i<=h;i++){
		a[i][0]='.';
		for(int j=1;j<=w;j++){
			cin>>a[i][j];
		}
		a[i][w+1]='.';
	}
	for(int i=0;i<=w;i++){
		a[h+1][i]='.';
	}
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			int sum=0;
			for(int k=0;k<3;k++){
				for(int l=0;l<3;l++){
			if(a[i+dx[k]][j+dy[l]]=='#'){
				sum++;
			}
		}}
		if(a[i][j]=='.'){
				cout<<sum;
			}
			else{
				cout<<'#';
			}
		}
		cout<<endl;
	}
}


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>

long long PRIME = 1e9 + 7;
using namespace std;

int main(){
    long long N, M;
    cin >> N >> M;

    long long L_max = 0;
    long long R_min = N;
    long long L, R;
    for(int i = 0; i < M; ++i){
        cin >> L >> R;

        L_max = max(L, L_max);
        R_min = min(R, R_min);
    }

    if(L_max > R_min){
        cout << 0;
    }
    else{
        cout << R_min - L_max + 1;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
    for(auto &e:t) fill_v(e,v);
}

template<ll mod = static_cast<ll>(1e9+7)>
class mint{
    ll _n;

    /* modの範囲に収めた数を返す */
    ll getModV(ll n) {
        while(n < 0) n += mod;

        return n % mod;
    }

public:
    mint(ll n): _n{n} {
        _n = getModV(_n);
    }

    mint(){_n = 0;}

    mint& operator=(const mint& v) {
        _n =  v._n;
        return *this;
    }

    mint& operator+=(const mint& v){
        _n = getModV(_n + v._n);
        return *this;
    }

    friend mint operator+(const mint& v, const mint& u) {
        return mint(v) += u;
    }

    mint& operator-=(const mint& v) {
        _n = getModV(_n - v._n);
        return *this;
    }

    friend mint operator-(const mint& v, const mint& u) {
        return mint(v) -= u;
    }

    mint& operator*=(const mint& v) {
        _n = getModV(_n * v._n );
        return *this;
    }

    friend mint operator*(const mint& v, const mint& u) {
        return mint(v) *= u;
    }

    mint& operator/=(const mint& v) {
        return *this *= getIndV(v);
    }

    friend mint operator/(const mint& v, const mint& u) {
        return mint(v) /= u;
    }

    friend bool operator<(const mint& v, const mint& u) {
      return v._n < u._n;
    }

    friend bool operator<=(const mint& v, const mint& u) {
      return v._n <= u._n;
    }
    
    friend ostream& operator<<(ostream& out, const mint& v) {
        return out << v._n;
    }

    friend istream& operator>>(istream& is, mint& v) {
      is >> v._n;
      return is;
    }

    /* 逆元 */
    friend mint getIndV(const mint& v) {
        return mpow(v, mod - 2);
    }

    friend mint mpow(const mint& v, const int& n) {
        if(n == 0LL) return mint(1LL);
        else{
            if(n % 2) return mpow(v * v, n / 2) * v;
            else return mpow(v * v, n / 2);
        }
    }
};

int main() {
  constexpr int mod = 1e9 + 7, lim = 1e6;
  using mint = mint<mod>;
  int h, w, a, b; cin >> h >> w >> a >> b;

  vector<mint> fac(lim+1, 1), dfac(lim+1, 1);
  for(int i=1; i<=lim; i++) fac[i] = fac[i-1] * mint(i);

  dfac[lim] = getIndV(fac[lim]);
  for(int i=lim-1; i>=1; i--) dfac[i] = dfac[i+1] * mint(i+1);

  function<mint(int, int)> comb = [&](int fh, int fw){
    mint ret = fac[fh + fw] * dfac[fh] * dfac[fw];
    return ret;
  };

  mint ans = 0;
  for(int fh = 0; fh < h - a; fh++){
    mint ret = comb(fh, b - 1) * comb(h - fh - 1, w - b - 1);
    ans += ret;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 16000
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner (System.in);
		int n = sc.nextInt();
		for (int i = 1; true; i++) {
			if (n*i % 2 == 0) {
				System.out.println(n*i);
				break;
			}
		}
	}
}


Measured memory_bytes: 35548
#include<stdio.h>
int main(void)
{
	int m,f,b;
	scanf("%d %d %d",&m,&f,&b);
	if(m>=b){
		printf("%d\n",0);
	}
	else if(m+f<b){
		printf("NA\n");
	}
	else if(m+f>=b){
	printf("%d\n",b-m);	
	}
	return 0;
}


Measured memory_bytes: 2136
program baisuu_search
    integer(8) :: K, i
    integer :: a(1000001)

    read *, K
    a(1) = mod(7,K)
    do i = 2 , K
        a(i) = mod(a(i-1)*10+7, K)
    end do
    do i = 1,K
        if(a(i)==0)then
            print *, i
            exit
        else if(i == K)then
            print *, '-1'
        end if
    end do
end program

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

using namespace std;
#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 16023;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int x, y, c;
bool d, t[2][N], v[2][N];
string s;

int main() {
	int i, j;
	cin >> s >> x >> y;
	v[1][8000] = 1;
	for (i = 0; s[i] == 'F'; i++);
	v[0][8000 + i] = 1;
	for (; i <= s.size(); i++) {
		if (s[i] == 'F') c++;
		else {
			for (j = c; j < N - c; j++) {
				t[d][j - c] = max(t[d][j - c], v[d][j]);
				t[d][j + c] = max(t[d][j + c], v[d][j]);
			}
			for (j = 0; j < N; j++) v[d][j] = t[d][j], t[d][j] = 0;
			c = 0;
			d = !d;
		}
	}
    cout << (v[0][x + 8000] & v[1][y + 8000] ? "Yes" : "No") << endl;
   	return Accepted;
}

// B...a

Measured memory_bytes: 256
import java.io.*;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.NoSuchElementException;
import java.util.Scanner;
public class Main {
	static int[] list = new int[5133];
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		makePrimeList(50001);
		int[] listx = new int[50001];
		for(int i = 0; i < 5133; i++) {
			for(int j = i; j < 5133; j++) {
				int sum = list[i] + list[j];
				if(sum > 50000) break;
				listx[sum]++;
			}
		}
		while(true) {
			int n = (int)sc.nextLong();
			if(n == 0) break;
			
			
			out.println(listx[n]);
		}
		out.flush();
	}

	public static void makePrimeList(int n) {
		boolean[] isntPrime = new boolean[n];
		isntPrime[0] = isntPrime[1] = true;
		int a = 0;
		list[a++] = 2;
		for(int i = 3; i < n; i+=2) {
			if(!isntPrime[i]) {
				list[a++] = i;
				for(int j = i+i; j < n; j+=i) {
					isntPrime[j] = true;
				}
			}
		}
	}
	
	
	
	
}
	
//------------------------------//
//-----------//
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}

Measured memory_bytes: 21764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1;
void solve() 
{
	vector<ll> v = {1,2,3} ;
	ll a,b;
	cin>>a>>b;
	for(auto x : v )
		if(x!=a and x!=b)cout<<x;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int h, w, i, j;
  cin >> h >> w;
  vector<vector<char>> a(h, vector<char>(w));
  for (i=0;i<h;i++){
    for (j=0;j<w;j++){
      cin >> a[i][j];
    }
  }
  vector<bool> b(h),c(w);
  for (i=0;i<h;i++){
    for (j=0;j<w;j++){
      if (a[i][j]=='#'){
        b[i]=true;
      }
    }
  }
  for (j=0;j<w;j++){
    for (i=0;i<h;i++){
      if (a[i][j]=='#'){
        c[j]=true;
      }
    }
  }
  for (i=0;i<h;i++){
    if(b[i]){
      for(j=0;j<w;j++){
        if(c[j]){
          cout << a[i][j];
        }
      }
      cout << endl;
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
#include <set>
#include <functional>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e4 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    string s;cin>>s;
    int ans = 1e9;
    for(char c='a';c<='z';++c){
        string t = s;
        int cnt = 0;
        while(!t.empty()){
            if(count(t.begin(),t.end(),c)==t.size()) break;
            ++cnt;
            REP(i,t.size()-1)
                if(t[i+1]==c) t[i] = c;
            t.pop_back();
        }
        chmin(ans,cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=100010;

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

    ll n,x,m;
    cin>>n>>x>>m;

    vector<ll> ar;
    vector<ll> freq(m+1,0);
    ar.pb(x);
    freq[x]=1;

    while(1)
    {
        x=(x*x)%m;
        if(freq[x]!=0){break;}
        freq[x]=1;
        ar.pb(x);
    }

    ll ans=0;
    ll idx=0;
    for(idx=0;idx<ar.size();++idx){
        if(ar[idx]==x){break;}
        ans+=ar[idx];
        --n;
        if(n==0){break;}
    }
    vector<ll> ch;
    ll sum=0;
    for(;idx<ar.size();++idx){
        ch.pb(ar[idx]);
        sum+=ar[idx];
    }
    ans+=sum*(n/ch.size());
    n=n%ch.size();
    for(ll i=0;i<ch.size();++i){
        if(n==0){break;}
        ans+=ch[i];
        --n;
        if(n==0){break;}
    }
    cout<<ans;

    return (0);
}


Measured memory_bytes: 5024
IDENTIFICATION DIVISION.
       PROGRAM-ID. ABC043-B.
       DATA DIVISION.
       FILE SECTION.
       WORKING-STORAGE SECTION.
       77 INSTR PIC X(10).
       77 ANS PIC X(10) VALUE SPACE.
       77 I PIC 9(2).
       77 ANSI PIC 9(2).

       PROCEDURE DIVISION.
       MAIN-PROCEDURE.
            ACCEPT INSTR FROM SYSIN.
            PERFORM VARYING I FROM 1 BY 1
             UNTIL LENGTH OF INSTR < I
               EVALUATE INSTR(I:1)
                   WHEN "0"
                       STRING ANS  "0" DELIMITED BY SPACE
                        INTO ANS
                       END-STRING
                   WHEN "1"
                       STRING ANS  "1" DELIMITED BY SPACE
                        INTO ANS
                       END-STRING
                   WHEN "B"
                       MOVE FUNCTION STORED-CHAR-LENGTH (ANS) TO ANSI
                       IF ANSI = 0 THEN
                           CONTINUE
                       ELSE
                         MOVE SPACE TO ANS(ANSI:1)
                       END-IF
               END-EVALUATE
            END-PERFORM.
            DISPLAY ANS.
            STOP RUN.
       END PROGRAM ABC043-B.


Measured memory_bytes: 508
nums = gets.chomp.split("").map(&:to_i)
adv_nums = nums.map { |n| 9 - n }
adv_nums[adv_nums.size - 1] += 1
size = nums.size
flag = true
ans = 0
(0...size).each do |i|
  not_adv = nums[i]
  adv = adv_nums[i]
  if flag
    adv += 1
  else
    not_adv += 1
  end
  if not_adv == adv
    ans += 5
    if nums[i + 1] < 5
      flag = true
    else
      flag = false
    end
  elsif not_adv < adv
    ans += not_adv
    unless flag
      flag = true
    end
  else
    ans += adv
    if flag
      flag = false
    end
  end
end
puts ans


Measured memory_bytes: 73100
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int N=1e5+5;
int a[N],b[N];
struct ds{
    multiset<int,greater<int>> small;
    multiset<int> big;
    int lim,sum;
    ds(int _lim){lim=_lim,sum=0;}
    void add(int x){
        small.insert(x);
        sum+=x;
        if(sz(small)>lim){
            int v=*small.begin();
            sum-=v;
            small.erase(small.begin());
            big.insert(v);
        }
    }
    void del(int x){
        auto it=big.find(x);
        if(it!=big.end()){
            big.erase(it);
        }else{
            small.erase(small.find(x));
            sum-=x;
            assert(!big.empty());
            if(!big.empty()){
                int v=*big.begin();
                big.erase(big.begin());
                small.insert(v);
                sum+=v;
            }
        }
    }
};
int32_t main(){
    int n;
    cin>>n;
    int ans=0,pot=0;
    ds s(n);
    forn(i,n){
        cin>>a[i]>>b[i];
        ans+=a[i];
        pot+=b[i];
        s.add(a[i]);
        s.add(b[i]);
    }
    upn(ans,pot);
    forn(i,n){
        s.del(a[i]);
        s.del(b[i]);
        upn(ans,s.sum);
        s.add(a[i]);
        s.add(b[i]);
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 14552
#include<bits/stdc++.h>
using namespace std;
const int maxn=222,mod=998244353;
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline int read(){
	int x=0,f=0;char ch=getchar();
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
struct line{
	double k,b;
	bool operator<(const line &l)const{
		if(fabs(k-l.k)>1e-8) return k<l.k;
		return b<l.b;
	}
}l[25555];
int n,ans,pt[maxn],x[maxn],y[maxn],llen,cnt[25555];
inline int gcd(int x,int y){return y?gcd(y,x%y):x;}
int main(){
	n=read();
	FOR(i,1,n) x[i]=read(),y[i]=read();
	pt[0]=1;
	FOR(i,1,n) pt[i]=2*pt[i-1]%mod;
	ans=(pt[n]-(n+1)+mod)%mod;
	FOR(i,1,n) FOR(j,i+1,n){
		double k,b;
		if(x[i]==x[j]) k=1e9,b=x[i];
		else k=1.0*(y[j]-y[i])/(x[j]-x[i]),b=y[i]-k*x[i];
		l[++llen]=(line){k,b};
	}
	sort(l+1,l+llen+1);
	FOR(i,2,n) cnt[i*(i-1)/2]=i;
	FOR(i,1,llen){
		int j=i;
		while(j<=llen && fabs(l[i].k-l[j].k)<1e-8 && fabs(l[i].b-l[j].b)<1e-8) j++;
		j--;
		int x=cnt[j-i+1];
		ans=(ans-(pt[x]-(x+1)+mod)%mod+mod)%mod;
		i=j;
	}
	printf("%d\n",ans);
}

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

int main()
{
    string s ;
    while(1)
    {
        cin >> s ;
        if(s == "0") break ;
        int sumi = 0 ;
        for(int i = 0 ; i < s.length() ; i++)
        {
            int a = (int)s[i] - '0' ;
            sumi += a ;
        }
        cout << sumi << endl ;
    }
}


Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,h,w;cin>>n>>h>>w;
  int a,b,cnt=0;
  for(int i=0;i<n;i++){
  	cin>>a>>b;
    if(a>=h && b>=w){
    	cnt++;
    }
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 256
//Author: Fuadul Hasan(fuadul202@gmail.com)
	//BSMRSTU,Gopalganj
	#include<bits/stdc++.h>
	using namespace std;int tc = 1;
	#define happy ios::sync_with_stdio(false);
	#define coding  cin.tie(0);
	#define mp make_pair
	#define ll long long
	#define Pi atan(1)*4
	#define pb  push_back
	#define vpr vector<pr> 
	#define pr pair<int, int> 
	#define vi std::vector<int>
	#define vll std::vector<ll>
	#define YES printf("YES\n");
	#define NO printf("NO\n");
	#define Yes printf("Yes\n");
	#define No printf("No\n");
	#define all(n) n.begin(),n.end()
	#define point(x) setprecision(x)
	#define Test printf("Case %d: ",tc++);
	#define Unique(c) (c).resize(unique(all(c))-(c).begin())
	#define vout(v) for (auto z: v) cout << z << " "; cout << endl;

	const int M = 1e9 + 7;
	const ll  Inf = (ll)2e18 + 5;
	const int N   = 2e5 + 5;

	long double Cos(long double t){
	return cos ( t * Pi / 180.0 );
}

/*	long double Cos(long double t){
		return cos(t*Pi/180.0);
	}

	long double AngleOfClock(long double h,long double m){
		if(h<0||m<0||h>12||m>60) return -1;
		if(h==1) h = 0;
		if(m== 60) m = 0;
		long double houre_angle = 0.5 * (h*60 +m);
		long double minute_angle = 6*m;
		long double angle = abs(houre_angle - minute_angle);
		angle = min(360- angle,angle);
		return angle;
	}*/

	double AngleOfClock(double h, double m)  
{   
    if (h <0 || m < 0 || h >12 || m > 60)  
        return -1;
  
    if (h == 12) h = 0;  
    if (m == 60) m = 0;  
   	double hour_angle = 0.5 * (h * 60 + m);  
    double minute_angle = 6 * m;  
    double angle = abs(hour_angle - minute_angle);   
    angle = min(360 - angle, angle);  
  
    return angle;  
}

	int solve() 
	{
		//happy coding

		long double a,b,c,d;
		cin>>a>>b>>c>>d;
		long double angle = AngleOfClock(c,d);
		cout<<point(30)<<sqrt((a*a)+(b*b)-2*a*b*Cos(angle))<<endl;	

		
		return 0;
	}
	int main(){
		int test = 1;
		//scanf("%d", &test);
		while (test--)solve();return 0;
	}

Measured memory_bytes: 4140
package main

import (
	"strconv"
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	m, _ := strconv.Atoi(s[5:7])
	if m <= 4 {
		fmt.Println("Heisei")
	} else {
		fmt.Println("TBD")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
// #define int long long    // %d=>%lld
#define pb push_back
#define INF 100000000
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;

int r;
int g;
int b;




signed main(){
    scanf("%d", &r);
    scanf("%d", &g);
    scanf("%d", &b);


    if((g*10+b)%4 == 0){
        printf("YES\n");
    }else{
        printf("NO\n");
    }


    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define INF 1e9
#define pb push_back
#define mp  make_pair
#define loop(a,n) for(long long i=a;i<n;i++)
#define vil vector<long long int>
#define vi vector<int>
#define sz(v) v.size()
#define setbits(x)          __builtin_popcountll(x)
#define ff first
#define ss second
using namespace std;


ll gcd(ll a, ll b) {
  if (a == 0)return b;
  return gcd(b % a, a);
}
bool isperfect(ll n) {
  ll y = sqrt(n);
  if (n % y == 0 && y * y == n)return true;
  return false;
}
bool comp(pair<int,int> a, pair<int,int> b) {
    if(a.first == b.first) return a.second>b.second;
  return a.first < b.first;
}
 ll powi(ll a, ll b) {
  ll ans = 1;
  while (b > 0) {
    if (b & 1)ans = (ans * a);
    b = b >> 1;
    a = (a * a);
  }
  return ans;
}
bool isprime(ll n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0)return false;
  }
  return true;
}
bool prime[10000000];
void seive() {

  prime[1] = true;
  for (int i = 2; i * i < 10000000; i++) {

    if (prime[i])continue;
    for (int j = i * i; j < 10000000; j += i) {
      prime[j] = true;
    }

  }
}
int main()
{
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  ll r;cin>>r;
  long double v=(6.28318530717958623200);
  long double x=v*r;
  cout<<fixed<<setprecision(10)<<x;
}



  


Measured memory_bytes: 3796
#include <stdio.h>
#include <math.h>

int main(void){
  int n, m, i, j, z;
  scanf("%d %d", &n, &m);
  int k[n], a[n][m], count[m];
  for(i=0; i<m; i++){
    count[i]=0;
  }
  for(i=0; i<n; i++){
   scanf("%d", &k[i]);
   for(j=0; j<k[i]; j++){
   	scanf("%d", &a[i][j]);
    for(z=0; z<m; z++){
      if(z+1==a[i][j]){
        count[z]++;
      }
    }
   }
  }

  int s=0;
  for(z=0; z<m; z++){
    if(count[z]==n){
      s++;
    }
  }

  printf("%d", s);
  return 0;
}


Measured memory_bytes: 128
n,l = map(int,input().split())
maxim= l+n-1
ans = 0
for i in range(n):
    ans += l+i
if l <= 0 <= maxim:
    print(ans)
elif 0 < l:
    print(ans-l)
elif maxim < 0:
    print(ans-maxim)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdint>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <unordered_map>

int main()
{
    std::string str;
    std::cin >> str;

    std::string answer = "keyence";

    int pos = 0;
    for (int i = 0; i < answer.size(); ++i) {
        if (str[pos] == answer[i]) {
            ++pos;
        } else {
            std::string sub = answer.substr(i);

            while (pos < str.size()) {
                if (str[pos] == answer[i]) {
                    std::string key_sub = str.substr(pos, str.size() - pos);
                    if (sub == key_sub) {
                        std::cout << "YES" << std::endl;
                        return 0;
                    }
                }

                ++pos;
            }

            std::cout << "NO" << std::endl;
            return 0;
        }
    }

    std::cout << "YES" << std::endl;

    return 0;
}

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

int main(){
  int r0,w0,c,r;
  while(1){
    cin>>r0>>w0>>c>>r;
    if(!r0&&!w0&&!c&&!r)break;
    if((r0+r)/w0>=c)cout<<0<<endl;
    else{
      if(!((c*w0-r0)%r))cout<<(c*w0-r0)/r<<endl;
      else cout<<(c*w0-r0)/r+1<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3092
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

public class Main {
	static class Vertex{
		List<Integer> adj;
		public Vertex() {
			adj = new ArrayList<Integer>();
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		Vertex vs[] = new Vertex[N];
		for(int i = 0 ; i < N ; ++i){
			vs[i] = new Vertex();
		}
		for(int i = 0 ; i < M ; ++i){
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			vs[a].adj.add(b);
			vs[b].adj.add(a);
		}
		Queue<Integer> q = new LinkedList<Integer>();
		int vis[] = new int[N];
		Arrays.fill(vis, -1);
		q.add(0);
		vis[0] = 0;
		while(!q.isEmpty()){
			int cp = q.poll();
			for(int a : vs[cp].adj){
				if(vis[a] >= 0){
					continue;
				}
				vis[a] = cp;
				q.add(a);
			}
		}
		System.out.println("Yes");
		for(int i = 1 ; i < N ; ++i){
			System.out.println(vis[i] + 1);
		}
	}	
}


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

const long long mod = 1e9 + 7;
vector <vector <long long>> dp;
vector <vector <int>> I;
vector <int> S, T;

int main(){
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	dp.resize(n + 1);
	S.resize(n);
	T.resize(m);
	I.resize(m);
	for (int i = 0; i < n; i++){
		dp[i].resize(m + 1);
		cin >> S[i];
	}
	// cout << 1 << endl;
	dp[n].resize(m + 1);
	dp[0][0] = 1;
	for (int i = 0; i < m; i++){
		I[i].resize(100001, -1);
		if (i)
			copy(I[i - 1].begin(), I[i - 1].end(), I[i].begin());
		dp[0][i + 1] = 1;
		// dp[i + 1][0] = 1;
		cin >> T[i];
		I[i][T[i]] = i;
	}
	// cout << 1 << endl;
	for (int i = 1; i <= n; i++){
		dp[i][0] = 1;
		for (int j = 1; j <= m; j++){
			int G = I[j - 1][S[i - 1]];
			if (G == -1){
				dp[i][j] = dp[i - 1][j];
				continue;
			}
			// cout << i << ' ' << j << ' ' << dp[i][j] << ' ' << dp[i - 1][j] << ' ' << G << ' ' << dp[G][j] << '\n';
			dp[i][j] = dp[i - 1][j] + dp[i][G];
			// cout << i << ' ' << j << ' ' << dp[i][j] << ' ' << dp[i - 1][j] << ' ' << G << ' ' << dp[G][j] << '\n';
			dp[i][j] %= mod;
		}
	}
	cout << dp[n][m];
}

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

struct UnionFind{
    vector<int> parent;
    vector<int> rank;
    UnionFind(int n):rank(n+1,0),parent(n+1){
        rep(i,n+1) parent[i]=i;
    }

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

    void unite(int x, int y){
        x = find(x);
        y = find(y);
        if (x==y) return;
        else if(rank[x]<rank[y]) parent[x]=y;
        else{
            parent[y]=x;
            if (rank[x]==rank[y]){
                rank[x]+=1;
            }
        }
    }
};

/*abc157-d*/
int main(){
    int n,m,k;
    cin >> n >> m >> k;
    UnionFind uf(n);
    vector<int> friends(n+1);
    vector<int> bad(n+1);
    rep(i,n+1){
        friends[i]=0;
        bad[i]=0;
    }
    rep(i,m){
        int a,b;
        cin >> a >> b;
        friends[a]++;
        friends[b]++;
        uf.unite(a,b);
    }
    rep(i,k){
        int c,d;
        cin >> c >> d;
        if (uf.find(c)==uf.find(d)){
            bad[c]++;
            bad[d]++;
        }
    }
    vector<int> group(n+1);
    rep(i,n)group[i]=0;
    rep(i,n){
        int par;
        par = uf.find(i+1);
        group[par]++;
    }
    rep(i,n){
        int par;
        par = uf.find(i+1);
        cout << group[par] - friends[i+1]-bad[i+1]-1;
        if(i!=n-1) cout << " ";
    }
    cout << endl;
}

Measured memory_bytes: 2816
n, a, b = map(int, input().split())
s = input()

a_reviewed = 0
b_reviewed = 0

for x in s:
    if a_reviewed + b_reviewed < a + b:
        if x == 'a':
            print('Yes')
            a_reviewed += 1
        elif x == 'b' and b_reviewed < b:
            print('Yes')
            b_reviewed += 1
        else:
            print('No')
    else:
        print('No')

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    int m = a[n-1];
    int maxd = min(a[0], m - a[0]);
    int r = a[0];
    for (int i = 1; i < n; ++i) {
        if (maxd < min(a[i], m - a[i])) {
            maxd = min(a[i], m - a[i]);
            r = a[i];
        }
        else if (maxd > min(a[i], m - a[i])) break;
    }
    cout << m << " " << r << endl;
}

Measured memory_bytes: 640
main = do
  _ <- getLine
  dat <- getContents >>= return . map ((\(t:x:y:_) -> (t,x,y)) . map read . words) . lines :: IO [(Int,Int,Int)]

  putStrLn $ if func (0,0,0) dat then "Yes" else "No"

  where
    func _ [] = True
    func (t,x,y) ((t2,x2,y2):rest)
      | dt < di = False
      | otherwise = if (dt - di) `mod` 2 == 0 then func (t2,x2,y2) rest else False
      where
        di = abs (x2 - x) + abs (y2 - y)
        dt = (t2 - t)
  


Measured memory_bytes: 2428
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, readline().split())
m = map(int, read().split())
G = [[] for _ in range(N + 1)]
for a, b in zip(m, m):
    G[a].append(b)
    G[b].append(a)

def dfs_order(G, root=1):
    parent = [0] * (N + 1)
    order = []
    stack = [root]
    while stack:
        x = stack.pop()
        order.append(x)
        for y in G[x]:
            if y == parent[x]:
                continue
            parent[y] = x
            stack.append(y)
    return parent, order

parent, order = dfs_order(G)

dp1 = np.zeros((N + 1, N + 1), np.int32)
for v in order[::-1]:
    p = parent[v]
    dp1[v, 0] += 1
    dp1[p, 1:] += dp1[v, :-1]

dp2 = np.zeros((N + 1, N + 1), np.int32)
dp2[1] = dp1[1]
for v in order[1:]:
    p = parent[v]
    x = dp2[p].copy()
    x[1:] -= dp1[v, :-1]
    dp2[v, 1:] += x[:-1]
    dp2[v] += dp1[v]

dp3 = np.zeros((N + 1, N + 1), np.int32)
for v in order[1:]:
    p = parent[v]
    dp3[v] = dp1[v]
    x = dp2[p].copy()
    x[1:] -= dp1[v][:-1]
    dp3[v] += x

# 距離 r まで生き残らせるとして、生き残る点の数
dp2.cumsum(axis=1, out=dp2)
dp3.cumsum(axis=1, out=dp3)

if K % 2 == 0:
    x = dp2[:, K // 2].max()
else:
    x = dp3[:, K // 2].max()

print(N - x)

Measured memory_bytes: 74340
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
  int N; cin >> N; map<ll, int>mp; bool zero = true;
  rep(i, N){
    ll a; cin >> a; mp[a]++; if(a!=0) zero = false;
  }
  if(zero){
    cout << "Yes" << endl; return 0;
  }
  if(mp.size()==2){
    for(auto t: mp){
      if(t.first!=0){
        if(t.second==2*mp[0]){
          cout << "Yes" << endl; return 0;
        }
      }
    }
  }
  int cnt = 0; ll tmp[3];
   if(N%3 || mp.size()!=3){
    cout << "No" << endl;  return 0;
  }
  for(auto t: mp){
    if(t.second!=N/3){
      cout << "No" << endl; return 0;
    }
    tmp[cnt] = t.first;
    cnt++;
  }
  if((tmp[0]^tmp[1])!=tmp[2]){
    cout << "No" << endl; return 0;
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 5120
/*
*
*   Bismillah Hir Rahman Nir Raheem
*   Name: Jaied Al Sabid
*
*/
#include <bits/stdc++.h>

using namespace std;

#define pf printf
#define sf scanf
#define elif else if
#define unint unsigned int
#define sint short int
#define lint long long int
#define Size 1000000000

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    lint n,k,tot=0;
    vector<lint>h;
    cin>>n>>k;
    for(int i = 0; i < n; i++)
    {
        lint tmp;
        cin>>tmp;
        h.push_back(tmp);
        tot+=h[i];
    }
    if(k>=n)
    {
        cout<<"0"<<endl;
    }
    elif(k<n)
    {
        sort(h.begin(),h.end());
        tot=0;
        for(int i=0; i < n-k; i++)
        {
            tot+=h[i];
        }
        cout<<tot<<endl;
    }
    else{cout<<tot<<endl;}
    return 0;
}


Measured memory_bytes: 2420
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<cstdio>
#include<string>
#include<cmath>
typedef long long int ll;
#define VI vector<int>

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

int n,m;

using namespace std;


int main(){
	int n;
	cin>>n;
	ll sum=0;
	rep(i,n){
		int tmp;
		cin>>tmp;
		sum+=tmp;
	}
	if(n==0)cout<<"0"<<endl;
	else cout<<(int)(sum/n)<<endl;

	return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <atcoder/math.hpp>

#define foreach(i,v) for(auto&& i: v)
#define all(x) (x).begin(), (x).end()

typedef std::vector< std::string > VS;
typedef std::vector<int> VI;
typedef long long ll;

template <class C> C& mini(C& a, C b) { if (b < a) a = b; return a; }
template <class C> C& maxi(C& a, C b) { if (a < b) a = b; return a; }

using namespace std;

template <typename T> void read(T& x) { x.read(); }
template <typename T> void read(vector<T>& v) { for (T& x: v) read(x); }
template <typename X, typename Y> void read(pair<X, Y>& p) { read(p.first); read(p.second); }
template <> void read(int& x) { scanf("%d", &x); }
template <> void read(unsigned int& x) { scanf("%u", &x); }
template <> void read(long long& x) { scanf("%lld", &x); }
template <> void read(unsigned long long& x) { scanf("%llu", &x); }
template <typename T> void readv(vector<T>& v) { int N; read(N); v.resize(N); read(v); }
template <typename T, typename ...Ts> void read(T& x, Ts&... args) { read(x); read(args...); }

int main(int argc, const char* argv[]) {
    int T;
    read(T);
    while (T --> 0) {
        ll N, M, A, B;
        read(N, M, A, B);
        printf("%lld\n", atcoder::floor_sum(N, M, A, B));
    }
    return 0;
}

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

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

    if (a == b && b == c) cout << '1' << endl;

    if (a != b && b == c) cout << '2' << endl;
    if (a == b && b != c) cout << '2' << endl;
    if (a == c && b != c) cout << '2' << endl;
    
    if (a != b && b != c && a != c) cout << '3' << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define Max 100005
#define Mod 1e9+7
const LL mod=1e9+7;
const LL inf=0x3f3f3f3f;
using namespace std;
string a[105];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(int i=0;i<n;i++)
		cout<<a[i];
	cout<<endl;
    return 0;
}


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9 + 47;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1 << 17;
int a[N];

bool ok(int n, int m, int v, int p, int i)
{
	if (i <= p) return true;
	int bude = a[i] + m;
	if (bude < a[p]) return false;
	v -= n - i;
	v -= p;
	if (v <= 0) return true;
	
	vector<int> zapas(i - p);
	FOR(j, p, i) zapas[j - p] = bude - a[j];
	LL moje = 0;
	for(auto x: zapas) moje += min(x, m);
	return moje >= v * (LL) m;
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	
	int n, m, v, p;
	cin >> n >> m >> v >> p;
	FOR(i, 1, n + 1) cin >> a[i];
	
	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);
	
	int l = 1, r = n + 1;
	while(r - l > 1)
	{
		int med = (l + r) >> 1;
		if (ok(n, m, v, p, med))
			l = med;
		else
			r = med;
	}
	
	cout << l << endl;
	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 1132
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(ll i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(ll i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int Log2(ll x) { int k; for (k = 0; x > 0; ++k) x >>= 1; return k; } // number of binary digits
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;


pair<int, int> s2p(string s) {
  if (s == "AB") return {0, 1};
  if (s == "BC") return {1, 2};
  if (s == "AC") return {2, 0};
}


int main() {
  ll n; cin >> n;
  Vll a(3); cin >> a;
  vector<string> s(n); cin >> s;
  
  string rf = "ABC";
  vector<char> ans;

  rep(i, n) {
    auto [x, y] = s2p(s[i]);
    if (a[x] == 0 && a[y] == 0) {
      cout << "No" << "\n";
      return 0;
    }
    else if (a[x] == 0) {
      ans.push_back(rf[x]);
      ++a[x];
      --a[y];
    }
    else if (a[y] == 0) {
      ans.push_back(rf[y]);
      ++a[y];
      --a[x];
    }
    else if (i < n-1) {
      auto [z, w] = s2p(s[i+1]);
      if (x == z || x == w) {
        ans.push_back(rf[x]);
        ++a[x];
        --a[y];
      }
      else {
        ans.push_back(rf[y]);
        ++a[y];
        --a[x];
      }
    }
    else {
      ans.push_back(rf[x]);
      ++a[x];
      --a[y];
    }
  }

  cout << "Yes" << "\n";
  rep(i, n) cout << ans[i] << "\n";
  return 0;
}


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

int n,k;
int w[1000000];

int main(){
   int r;
   cin >> r;
   cout << r*r<<endl;
   return 0;
}


Measured memory_bytes: 256
import math

s = input()
K = int(input())

init = sorted(set(list(s)))[:K]
n=0
z=[]
while(n<len(s)):
    if n > 500: break
    x=[]
    for i in range(len(s)-n):
        if s[i] in init:
            x.append(s[i:i+n+1])
    y = sorted(set(x+z))
    z = y[:K]
    n += 1
print(sorted(set(z))[K-1])

Measured memory_bytes: 6024
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>

typedef long double ld;
typedef long long ll;

using namespace std;

set<string> s;

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

	for (int i = 0; i < n; i++) {
		string t;
		cin >> t;
		s.insert(t);
	}
	cout << s.size();

	return 0;
}


Measured memory_bytes: 19140
#include <stdio.h>
int main(void){
    int a,b,i;
    char op;

    for(i=a;;i++){
    scanf("%d %c %d",&a,&op,&b);

    if(op == '+'){
        printf("%d\n",a+b);
    }else if(op == '-'){
        printf("%d\n",a-b);
    }else if(op == '/'){
        printf("%d\n",a/b);
    }else if(op == '*'){
        printf("%d\n",a*b);
    }else if(op == '?'){
        break;
    }else{
        printf("該当なし\n");
    }
   
    }
}



Measured memory_bytes: 2040
s = input()
n = len(s)

ans = 0
last_s = s[0]
if last_s == '<':
    l, r = 1, 0
else:
    l, r = 0, 1
for i in range(1, n):
    if last_s == '<':
        if s[i] == '<':
            l += 1
        else:
            r += 1
            last_s = '>'
    else:
        if s[i] == '>':
            r += 1
        else:
            M = max(l, r)
            m = min(l, r)
            ans += M*(M+1)//2 + m*(m-1)//2
            l, r = 1, 0
            last_s = '<'

if last_s == '<':
    ans += l*(l+1)//2
else:
    M = max(l, r)
    m = min(l, r)
    ans += M*(M+1)//2 + m*(m-1)//2

print(ans)


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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

int main() {
	string s;
	int count = 0;

	cin >> s;

	REP(i, 6) {
		if (s[i] == '1') {
			count++;
		}
	}

	cout << count << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
def main():
    s = input()
    if s == "END OF INPUT":
        return False
    if s[0] == " ":
        s[0] = "."
    for _ in range(100):
        s = s.replace("  ", " . ")
    lst = s.split()
    ans = []
    for i in lst:
        if i == ".":
            ans += [0]
        else:
            ans += [len(i)]
    print("".join(map(str, ans)))
    return True

while main():
    pass


Measured memory_bytes: 5564
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int f(int n){
	int res = 0;
	for(int x = 1; x*x <= n; ++x){
		for(int y = x; x*x + y*y <= n; ++y){
			for(int z = y; x*x + y*y + z*z <= n; ++z){
				if(x*x+y*y+z*z+x*y+y*z+z*x == n){
					if(x == y && y == z) ++res;
					else if(x == y || y == z || z == x) res += 3;
					else res += 6;
				}
			}
		}
	}
	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	for(int i = 1; i <= n; ++i){
		cout << f(i) << endl;
	}
	return 0;
}


Measured memory_bytes: 3580