akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N,M,V,P,A[100002];
	scan(N>>M>>V>>P);
	A[0]=-INFl;
	rep(i,N){
		scan(A[i+1]);
	}
	sort(A,A+N+1);
	int imin=0,imax=N;
	/*rep(i,N+1){
		printf("%lld ",A[i]);
	}
	kaigyo;*/
	while(imin+1<imax){
		int imid=(imin+imax)/2;
		int flag=334;
		if(imid>N-P){
			flag=1;
		}
		else if(V>=P){
			ll nokori=M*(V-P);
			ll hyo=A[imid]+M;
			//printf("imid:%d A:%lld hyo:%lld nokori:%lld\n",imid,A[imid],hyo,nokori);
			if(hyo<A[N-P+1]){
				flag=0;
			}
			else{
				rep1(i,N-P+1){
					if(i==imid) continue;
					nokori-=min(M,hyo-A[i]);
				}
				if(nokori<=0) flag=1;
				else flag=0;
			}
		}
		else{
			if(A[imid]+M>=A[N-P+1]){
				flag=1;
			}
			else flag=0;
		}
		if(flag){
			imax=imid;
			//printf("ok:%d (%lld)\n",imid,A[imid]);
		}
		else{
			imin=imid;
			//printf("ng:%d (%lld)\n",imid,A[imid]);
		}
	}
	prin(N-imax+1);
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <numeric>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << (abs(a-c)<=d||(abs(a-b)<=d&&abs(b-c)<=d)?"Yes":"No") << endl;
}


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

using namespace std;

const int N = 110;

int n, cnt;
int a[N], b[N];
bool ok;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		cin >> a[i] >> b[i];
		if (a[i] == b[i]) cnt ++;
		else cnt = 0;
		if (cnt == 3) ok = true;
	}
	
	ok ? cout << "Yes\n" : cout << "No\n";
	
	return 0; 
}

Measured memory_bytes: 3648
# coding: utf-8
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip() # ignore trailing spaces
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))


def main():
    n = ni()
    a = na()
    s = a[0]
    for i in range(1,n):
        s = s^a[i]
    print(' '.join(list(map(str,[s^a[i] for i in range(n)]))))
    return


if __name__ == '__main__':
    main()

Measured memory_bytes: 106564
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n- 1];
		for (int i =0;i<a.length;i++) a[i] = sc.nextInt();
		int[] b = new int[n];
		for (int i=0;i<a.length;i++) {
			b[a[i] - 1]++;
		}

		for (int i=0;i<b.length;i++) {
			System.out.println(b[i]);
		}
	}
}


Measured memory_bytes: 60884
#include <cstdio>
#include <cstring>
#include <algorithm>

const int MAXN = 200000 + 10;
const int INF = 0x3f3f3f3f;

int n, q;
int qs[MAXN], qt[MAXN], qp[MAXN];
int seg[MAXN << 2], ans[MAXN];
int d[MAXN];

#define lp (p << 1)
#define rp (p << 1 | 1)
#define mid ((l + r) >> 1)
#define lson lp, l, mid
#define rson rp, mid + 1, r
inline void down(int p) {
	if(seg[p] ^ INF) {
		seg[lp] = std::min(seg[lp], seg[p]);
		seg[rp] = std::min(seg[rp], seg[p]);
		seg[p] = INF;
	}
}
void update(int p, int l, int r, int a, int b, int x) {
	if(a <= l and r <= b) {
		seg[p] = std::min(seg[p], x);
		return;
	}
	down(p);
	if(a <= mid)
		update(lson, a, b, x);
	if(b > mid)
		update(rson, a, b, x);
}
void alldown(int p, int l, int r) {
	if(l ^ r) {
		down(p);
		alldown(lson);
		alldown(rson);
	}
	else 
		ans[l] = (seg[p] ^ INF) ? seg[p] : -1;
}
#undef lp
#undef rp
#undef mid
#undef lson
#undef rson

inline void update(int l, int r, int x) {
	l = std::lower_bound(d+1, d+1+q, l) - d;
	r = std::upper_bound(d+1, d+1+q, r) - d - 1;
	if(l <= r) 
		update(1, 1, q, l, r, x);
}

int main() {
	int i;
	
	memset(seg, 0x3f, sizeof(seg));
	
	scanf("%d %d", &n, &q);
	for(i=1; i<=n; i++) {
		scanf("%d %d %d", &qs[i], &qt[i], &qp[i]);
		qt[i]--;
	}
	for(i=1; i<=q; i++)
		scanf("%d", &d[i]);
	for(i=1; i<=n; i++) 
		update(qs[i] - qp[i], qt[i] - qp[i], qp[i]); // qs[i] <= d + qp < qt[i]

	alldown(1, 1, q);
	
	for(i=1; i<=q; i++)
		printf("%d\n", ans[i]);
	return 0;
}

Measured memory_bytes: 8832
#include<stdio.h>
#include<stdlib.h>
#define ll long long
#define rep(i,l,r) for(ll i=(l);i<(r);i++)
ll heapN,heap[1<<20],heapinv[1<<20];
int PQhikaku(int i,int j);
void PQchange(int n);
void heap_utod(int n){
	if(2*n>heapN)return;
	int rflag=(2*n+1<=heapN)&&(PQhikaku(2*n,2*n+1));
	if(PQhikaku(n,2*n+rflag)){
		ll temp=heap[2*n+rflag];
		heap[2*n+rflag]=heap[n];
		heap[n]=temp;
		heapinv[heap[n]]=n;
		heapinv[heap[2*n+rflag]]=2*n+rflag;	
		heap_utod(2*n+rflag);
	}
}
void heap_dtou(int n){
	if(n==1||PQhikaku(n,n/2))return;
	ll temp=heap[n];
	heap[n]=heap[n/2];
	heap[n/2]=temp;
	heapinv[heap[n]]=n;
	heapinv[heap[n/2]]=n/2;
	heap_dtou(n/2);
}
ll PQpop(){
	ll rr=heap[1];
	heapinv[heap[1]]=0;
	heap[1]=heap[heapN--];
	heapinv[heap[1]]=1;
	heap_utod(1);
	return rr;
}
void PQpush(ll n){
	heap[++heapN]=n;
	heapinv[heap[heapN]]=heapN;
	heap_dtou(heapN);
}

typedef struct edge{ll s,g,c;}E;
int edgehikaku(const void*a,const void*b){
	E*p=(E*)a,*q=(E*)b;
	if((*p).s<(*q).s)return -1;
	if((*p).s>(*q).s)return  1;
	if((*p).g<(*q).g)return -1;
	return 1;
}

ll daikusutorappp[100010];
void daikusutora2(ll n,ll s,E*e,ll ecnt){
	qsort(e,ecnt,sizeof(E),edgehikaku);

	ll*es=(ll*)malloc(n*sizeof(ll));
	es[0]=0;
	ll t=0;
	rep(i,1,n){
		while(t<ecnt&&e[t].s!=i)t++;
		es[i]=t;
	}
	rep(i,0,n)daikusutorappp[i]=i==s?0:(1LL<<62)-10;
	rep(i,0,n)PQpush(i);
	while(heapN){
		ll mv=PQpop();
		ll t=es[mv];
		while(e[t].s==mv){
			if(daikusutorappp[e[t].g]>daikusutorappp[mv]+e[t].c){
				daikusutorappp[e[t].g]=daikusutorappp[mv]+e[t].c;
				daikusutorappp[n+e[t].g]=mv;
				PQchange(e[t].g);
			}
			t++;
		}
	}
	free(es);
}
int PQhikaku(int i,int j){return daikusutorappp[heap[i]]>daikusutorappp[heap[j]];}
void PQchange(int n){if(heapinv[n])heap_dtou(heapinv[n]);}


E e[200010];
ll fennec[100010];
ll sunuke[100010];
int main(){
	int n;
	scanf("%d",&n);
	rep(i,0,n-1){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		a--;b--;
		e[2*i].s=a;
		e[2*i].g=b;
		e[2*i].c=1;		
		e[2*i+1].s=b;
		e[2*i+1].g=a;
		e[2*i+1].c=1;
	}
	daikusutora2(n,0,e,2*n-2);
	rep(i,0,n){
		fennec[i]=daikusutorappp[i];
		daikusutorappp[i]=0;
	}
	daikusutora2(n,n-1,e,2*n-2);
	rep(i,0,n){
		sunuke[i]=daikusutorappp[i];
		daikusutorappp[i]=0;
	}
	ll ans=0;
	rep(i,0,n)if(fennec[i]<=sunuke[i])ans++;
	puts(ans>n-ans?"Fennec":"Snuke");
	return 0;
}

Measured memory_bytes: 17580
import sys, heapq

N = int(input())
V = list(map(int, sys.stdin.readline().split()))

heapq.heapify(V)

while len(V) > 1:
    a = heapq.heappop(V)
    b = heapq.heappop(V)
    heapq.heappush(V, (a + b) / 2)

print(V[0])

Measured memory_bytes: 3060
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <map>
#include <tuple>
using namespace std;


int main()
{
    int x;
    cin >> x;
    cout << 10 - (x / 200);
    return 0;
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    int pre=0;
    string s1,s2;
    cout<<0<<endl;
    cin>>s1;
    if(s1=="Vacant")return 0;
    int left=0,right=n;
    while(right-left>1){
        int mid=(left+right)/2;
        cout<<mid<<endl;
        cin>>s2;
        if(s2=="Vacant")return 0;
        if((mid%2==left%2&&s1==s2)||(mid%2!=left%2&&s1!=s2)){
            left=mid;
            s1=s2;
        }else{
            right=mid;
        }
    }
    cout<<left<<endl;
}


Measured memory_bytes: 3856
N,K = map(int, input().split())
mod = 10**9+7
ans = 0
dp = [0] * (K+10)

for i in range(K,0,-1):
    x = K//i
    a = pow(x, N, mod)
    cnt = 2
    while i*cnt <= K:
        a -= dp[i*cnt]
        cnt += 1
    a %= mod
    dp[i] = a
    ans += a*i
    ans %= mod
print(ans)

Measured memory_bytes: 11172
x,y = map(int,input().split())
res = 10**12

#0,0
if x <= y:
    res = min(res,y-x)

#0,1
if x <= -y:
    res = min(res,-y-x+1)

#1,0
if -x <= y:
    res =min(res,y+x+1)

#1,1
if -x <= -y:
    res = min(res,-y+x+2)
print(res)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  int n,q;
  cin>>n>>q;
  vector<stack<int> > s(n);
  for(int i=0;i<q;i++){
    int t,a;
    cin>>t>>a;
    if(t==0){
      int x;
      cin>>x;
      s[a].emplace(x);
    }
    if(t==1) if(!s[a].empty()) cout<<s[a].top()<<endl;
    if(t==2) if(!s[a].empty()) s[a].pop();
  }
  return 0;
}



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

using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define REP(NAME, NUM) for (int NAME = 0; NAME < (NUM); ++NAME)
#define BREP(NAME, NUM) for (int NAME = (NUM)-1; NAME >= 0; --NAME)
#define VEC(TYPE, A, NAME, INIT) vector<TYPE> NAME(A, INIT)
#define VEC2(TYPE, A, B, NAME, INIT) vector<vector<TYPE>> NAME(A, vector<TYPE>(B, (INIT)))

template <typename T>
T gcd(T a, T b)
{
    if (a < b)
        swap(a, b);
    return b ? gcd(b, a % b) : a;
}

int main()
{
    int h, w;
    cin >> h >> w;
    VEC2(int, h, w, a, -1);
    REP(i, h) REP(j, w) cin >> a[i][j];

    int cnt = 0;
    VEC(int, 0, ans, -1);
    REP(i, h) REP(j, w)
    {
        if( j == w-1 )
        {
            if( i == h - 1 ) break;
            if( a[i][j] % 2 != 0 )
            {
                ++a[i+1][j];
                ++cnt;
                ans.push_back(i);
                ans.push_back(j);
                ans.push_back(i + 1);
                ans.push_back(j);
            }
        }
        else
        {
            if (a[i][j] % 2 != 0)
            {
                ++a[i][j + 1];
                ++cnt;
                ans.push_back(i);
                ans.push_back(j);
                ans.push_back(i);
                ans.push_back(j+1);
            }
        }
    }

    cout << cnt << endl;
    REP( i, ans.size() )
    {
        cout << ans[i] + 1;
        if( (i + 1) % 4 != 0 ) cout << " ";
        else cout << endl;
    }
    return 0;
}

Measured memory_bytes: 5232
#include <iostream>
#include <string>

using namespace std;

int main() {
    string s;
    int m;
    int h;

    while(1) {
        cin >> s;
        if(s == "-") break;
        cin >> m;
        for (int i = 0; i < m; i++) {
            cin >> h;
            s = s.substr(h) + s.substr(0, h);
        }
        cout << s << endl;
    }
}



Measured memory_bytes: 3120
// Hovalhagh
// Ya Aziz & Hakim
// AliReza Kaboli

#include <bits/stdc++.h>

using namespace std;

bool check(int x) {
	for (int i = 2; i * i <= x; ++i)
		if (x % i == 0)
			return true;
	return false;
}

int main() {
	int x;
	cin >> x;
	while (check(x)) {
		++x;
	}
	cout << x << '\n';
}


Measured memory_bytes: 256
from collections import Counter

n, v = map(int, input().split())
a, b, c, d = (tuple(map(int, input().split())) for _ in range(4))
ab = [ai + bi for ai in a for bi in b]
cd = [ci + di for ci in c for di in d]
abc, cdc = Counter(ab), Counter(cd)

ans = 0
for k, t in abc.items():
    if v - k in cdc:
        ans += t * cdc[v - k]
print(ans)

Measured memory_bytes: 246072
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <algorithm>
#include <set>
#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=m; i>=n; i--)
#define INF 999999999
#define llong long long
#define VSORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
using namespace std;

#ifdef INPUT
#include <sstream>
stringstream input(R"(
3 5
)");
#define cin input
#endif

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

	if(a+b==15)
		cout << '+' << endl;
	else if(a*b==15)
		cout << '*' << endl;
	else
		cout << 'x' << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    lint ans = 0;
    int right = 0;
    lint sum = 0;
    for (int left = 0; left < n; left++) {
        while (right < n && sum + a[right] == (sum ^ a[right])) {
            sum += a[right];
            right++;
        }
        ans += right - left;
        if (left == right)
            right++;
        else
            sum -= a[left];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
signed main(){
  string a,b,c;
  cin >>a >> b >> c;
  cout << "A"<<b.front()<<"C"<<endl;
}


Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Iterator;

class Graph {
	private int totalVertex;
	private LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	private int[] discover; //discover time stamp, -1 for undiscovered
	private int[] finish; //finish time stamp
	public Graph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			int idx1 = in.nextInt() - 1; //-1, index
			int degree = in.nextInt();
			//System.out.println("mark idx1 = " + idx1 + " degree = " + degree);
			for(int j = 0; j < degree; j ++) {
				int idx2 = in.nextInt() - 1; //-1, index
				tmp.add(idx2);
			}	
			adjList.add(tmp);
		}
		in.close();
	}
	
	public int DFS(int v, int t0) {
		discover[v] = t0;
		LinkedList<Integer> nb = adjList.get(v);
		Iterator<Integer> it = nb.iterator();
		int t = t0;
		while(it.hasNext()) {
			int w = it.next();
			if(discover[w] == -1) {
				t ++; //one forward step
				t = DFS(w, t);
			}
		}
		finish[v] = t + 1; //+1 for backtrack step
		return t + 1;
	}
	
	public void timeStamp() {
		int v;
		discover = new int[totalVertex];
		finish = new int[totalVertex];
		for(v = 0; v < totalVertex; v ++) discover[v] = -1; //-1: not discovered
		int t = 0;
		for(v = 0; v < totalVertex; v ++) {
			if(discover[v] == -1) { //for disconnected graph, restart from an unvisited node
				t = DFS(v, t);
				t ++;
			}
		}
		//display the result
		for(v = 0; v < totalVertex; v ++) {
			System.out.println((v + 1) + " " + (discover[v] + 1) + " " + (finish[v] + 1));
			//+1, node 0 -> 1, 1 -> 2, etc
		}
	}
}

public class Main {
	public static void main(String argv[]) {
		Graph g = new Graph();
		g.loadAdjList();
		g.timeStamp();
	}
}


Measured memory_bytes: 28660
#include <iostream>
#include <complex>
#include <cmath>
using namespace std;
 
double cross(complex<double> z1, complex<double> z2) {
    return (z1.real()*z2.imag() - z1.imag()*z2.real());
}
 
int main(int argc, char** argv) {
    static const double EPS = 1e-10;
    int n;
    cin >> n;
    for(int i=0; i<n; i++) {
        double x[4], y[4];
        for(int j=0; j<4; j++) {
            cin >> x[j] >> y[j];
        }
        complex<double> ab(x[1]-x[0], y[1]-y[0]);
        complex<double> cd(x[3]-x[2], y[3]-y[2]);
        if(abs(cross(ab, cd)) < EPS) { // ?????????0????????????
            cout << "YES" << endl;
        }else {
            cout << "NO" << endl;
        }
    }
}

Measured memory_bytes: 3136
#include<iostream>
#include<string>
#include<stack>
using namespace std;
stack<char> p;
int main(){
	string s;
	cin>>s;
	int n=s.length();
	int count=0;
	p.push(s[0]);
	for(int i=1;i<n;i++){
		if(p.top()!=s[i]){
			p.pop();
			count++;
		} 
		else p.push(s[i]);
		if(p.empty() && i!=n-1){
			p.push(s[i+1]);
			i++;
		}		
	}
	cout<<count*2<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <cctype>

using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int N, K;

int main()
{
    ios::sync_with_stdio(false);
    string s;
    cin >> N >> K;
    cin >> s;
    s[K-1] = tolower(s[K-1]);
    cout << s << endl;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main()
{
    ll n;
    vector<ll> l;
    l.push_back(2);
    l.push_back(1);
    cin >> n;
    rep(i,n)
    {
        l.push_back(l[i]+l[i+1]);
        //cout << l[i] << endl;
    }
    cout << l[n] << endl;


}


Measured memory_bytes: 256
//abc094_a.cpp
//Sat Apr 21 20:19:58 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
using namespace std;

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

	if (x<a){
		cout << "NO" << endl;
	}else if (a+b > x){
		cout << "YES" << endl;
	}else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while(n-->0) {
			int t = sc.nextInt();
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(!canTravel(t, x, y)) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
	static boolean canTravel(int t, int x, int y) {
		return (x+y)%2 == t%2 && (x+y) <= t;
	}
}

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

using namespace std;

typedef long long ll;

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

	int Q;
	cin >> Q;

	ll sm = 0;

	priority_queue<ll> mpq;
	priority_queue<ll, vector<ll>, greater<ll>> ppq;
	ll msm = 0;
	ll psm = 0;

	rep(_, Q){
		int u;
		cin >> u;

		if(u == 1){
			ll a, b;
			cin >> a >> b;
			sm += b;

			if(mpq.size() > ppq.size()){
				ll t = mpq.top();
				if(a >= t){
					ppq.push(a);
					psm += a;
				}else{
					mpq.pop();
					msm -= t;

					mpq.push(a);
					msm += a;

					ppq.push(t);
					psm += t;
				}
			}else{
				if(mpq.empty()){
					mpq.push(a);
					msm += a;
				}else{
					ll t = ppq.top();
					if(a <= t){
						mpq.push(a);
						msm += a;
					}else{
						ppq.pop();
						psm -= t;

						ppq.push(a);
						psm += a;

						mpq.push(t);
						msm += t;
					}
				}
			}
		}else{
			ll x = mpq.top();
			ll res = (x * (ll)mpq.size() - msm) + (psm - x * (ll) ppq.size()) + sm;
			cout << x << " " << res << endl;
		}

	}

}


Measured memory_bytes: 3828
"""nを素因数分解"""
"""2以上の整数n => [[素因数, 指数], ...]の2次元リスト"""

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
# print(factorization(N))

ans = 0
for a, b in factorization(N):
  if a == 1:
    print(0)
    exit()
  # print()
  # print((a, b))
  t = 0
  for i in range(1, 10+b):
    t += i
    if t > b:
      ans += (i-1)
      break

print(ans)

Measured memory_bytes: 9496
#include<bits/stdc++.h>
using namespace std;
double a[100+10];
int main(){
	int n;
	cin>>n;
	double ssum=0.0;
	for(int i=0;i<n;i++){
		double s;
		cin>>s;
		a[i]=1/s;
		ssum+=a[i];
	}
	printf("%.6lf\n",1.0/ssum);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#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 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;

// エラトステネスの篩：n以下の素数を昇順に返す
vector<long long> SieveOfEratosthenes(const long long n){
    vector<bool> chkPrime(n+1, true);
    vector<long long> ret;
    for(long long i=2; i<=n; i++){
        if(chkPrime[i]){
            for(long long j=2*i; j<=n; j+=i) chkPrime[j]=false;
            ret.push_back(i);
        }
    }
    return ret;
}

int main(){
    Init();
    ll n; cin >> n;
    vvi mdf(5, vi(0));

    auto PrimeList = SieveOfEratosthenes(55555);
    for(long long i=0; i<PrimeList.size(); i++){
        mdf[PrimeList[i]%5].emplace_back(PrimeList[i]);
    }
    for(ll i=0; i<n; i++) cout << mdf[1][i] << (i != n-1 ? " " : endl);
}

Measured memory_bytes: 3640
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
C = [2]

li = input().split()
x = int(li[0])
y = int(li[1])

if (x in A and y in A) or (x in B and y in B) or (x in C and y in C):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include<iostream>
#include<cstdio>
#include<cmath>
#include<sstream>
#include<algorithm>
#include<cassert>
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
typedef long long ll;
ll N[9];
int cnt = 0;

long long rev(long long x){
  long long y = 0;
  while(x){
    y *= 16;
    y += x%16;
    x /= 16;
  }
return y;
}

string lltos(ll x)
{
  stringstream ss;
  ss << hex << x;
  return ss.str();
}

void rec(int p,string K,ll carry)
{

  if(p >= 8)
    {
      cnt++;
      assert(cnt == 1);
      reverse(K.begin(),K.end());
    
      int cnt = 0;  
      rep(i,K.size())
	{
	  cnt++;
	  if(K[i] == '0')continue;
	  
	  K = K.substr(i,K.size()-i);
	  break;
	}
      if(cnt == K.size())
	{
	  K = "0";
	}

      cout<< K << endl;    
      return;
    }
  ll cret[9];
  ll x = 0xf*pow(16LL,p);
  ll v = pow(16LL,p);
  rep(i,9)cret[i] = (x&N[i])/v;
    
  rep(k,16)
    {
      ll total = carry;
      rep(i,8)
	{
	  total += (cret[i]^k);
	}
      if(total%16 == (cret[8]^k))
	{
	  rec(p+1,K+lltos(k),total/16);
	}
    }
}

int main()
{
  /*
  cout << hex << 0xa << endl;
  ll x = 16*16;
  cout << hex << (0xa*(16*16))/x  << endl;
  cout << hex << 1*x << endl;
  */
  int T;
  while(cin >> T)
    {
      while(T-- > 0)
	{
	  cnt = 0;
	  rep(i,9)cin >> hex >> N[i];
	  rec(0,"",0);
	}
    }

  return 0;
}

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

int N;
vector< int > g[100000];
int dist[2][100000], id;
 
void dfs(int idx, int par = -1)
{
  if(~par) dist[id][idx] = dist[id][par] + 1;
  for(auto &to : g[idx]) if(to != par) dfs(to, idx);
}
 
int main()
{
  cin >> N;
  for(int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
 
  id = 0;
  dfs(0);
  id = 1;
  dfs(N - 1);
 
  int ret = 0;
  for(int i = 0; i < N; i++) {
    if(dist[0][i] <= dist[1][i]) ++ret;
  }
  if(ret >= (N + 2) / 2) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;
}

Measured memory_bytes: 11136
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)
ll INF = 1LL << 60;

//* calculate primes using sieve
ll sieve(ll n, vll &prime, vector<bool> &isprime){
    //* return the number of primes <= n
    //* prime[0]~ prime[p-1] record the primes
    //* isprime[0] ~ isprime[n] records the sieve
    ll p = 0;
    rep(i, n+1)
        isprime[i] = true;
    isprime[0] = isprime[1] = false;
    for(ll i=2; i <= n; i++){
        if(isprime[i]){
            prime[p++] = i; 
            for(ll j= 2*i; j <= n; j+= i)
                isprime[j] = false;
        }
    }
    return p;
}

void solve(long long Q, std::vector<long long> l, std::vector<long long> r){
    ll n = 0;
    rep(i, Q)
        n = max(n, r[i]);
    
    vll prime(n+1); vector<bool> isprime(n+1);
    ll numprime = sieve(n, prime, isprime);
    vll rec(n+1, 0);
    for(ll i=0; i < numprime; i++){
        if( prime[i] %2 == 1 && isprime[(prime[i]+1)/2])
            rec[prime[i]] = 1;
    }
    for(ll i=1; i <= n; i++){
        rec[i] += rec[i-1];
    }
    rep(i, Q){
        if(l[i]==0)
            cout << rec[r[i]] << endl;
        else
            cout << rec[r[i]] - rec[l[i]-1] << endl;
    }
}

int main(){
    long long Q;
    scanf("%lld",&Q);
    std::vector<long long> l(Q);
    std::vector<long long> r(Q);
    for(int i = 0 ; i < Q ; i++){
        scanf("%lld",&l[i]);
        scanf("%lld",&r[i]);
    }
    solve(Q, std::move(l), std::move(r));
    return 0;
}


Measured memory_bytes: 3840
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int val;
		while ((val = getInt(br)) != 0) {
			int month = 0;
			for (int i = 1; i <= 12; i++) {
				String s = br.readLine();
				if (month == 0) {
					val -= Integer.parseInt(s.substring(0, s.indexOf(" ")));
					val += Integer.parseInt(s.substring(s.indexOf(" ") + 1));
					if (val <= 0) {
						month = i;
					}
				}
			}
			System.out.println(month > 0 ? (month) : "NA");
		}

	}

	private static int getInt(BufferedReader br) throws IOException {
		return Integer.parseInt(br.readLine());
	}

}

Measured memory_bytes: 22236
// +build ignore
package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func solve(sc *scanner, wr *bufio.Writer) int {
	N := sc.i()
	M := sc.i()
	room := make([][]int, N)
	for i := 0; i < N; i++ {
		room[i] = make([]int, 0)
	}
	for i := 0; i < M; i++ {
		A := sc.i() - 1
		B := sc.i() - 1
		room[A] = append(room[A], B)
		room[B] = append(room[B], A)
	}

	queue := make([]int, 0)
	queue = append(queue, 0)
	prev := make([]int, N)
	for i := 0; i < N; i++ {
		prev[i] = math.MaxInt64
	}

	for len(queue) != 0 {
		v := queue[0]
		queue = queue[1:]
		for _, r := range room[v] {
			if prev[r] != math.MaxInt64 {
				continue
			}
			prev[r] = v
			queue = append(queue, r)
		}
	}

	fmt.Println("Yes")
	for _, v := range prev[1:] {
		fmt.Println(v + 1)
	}

	return 0
}

func main() {
	sc := newScanner(os.Stdin)
	wr := bufio.NewWriter(os.Stdout)
	ret := solve(sc, wr)
	wr.Flush()
	os.Exit(ret)
}

// I/O
type scanner struct {
	sc *bufio.Scanner
}

func newScanner(input io.Reader) *scanner {
	sc := bufio.NewScanner(input)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &scanner{sc}
}

func (s *scanner) s() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *scanner) i() int {
	i, e := strconv.Atoi(s.s())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *scanner) f() float64 {
	f, e := strconv.ParseFloat(s.s(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *scanner) bs() []byte {
	return []byte(s.s())
}

func (s *scanner) is(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.i()
	}
	return res
}

func (s *scanner) fs(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.f()
	}
	return res
}


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

const int N = 1e5;

char ans[1003][1003];

string s3[3] = {"aab", "d.b", "dcc"};
string s4[4] = {"abcc", "abdd", "ccab", "ddab"};
string s5[5] = {"abbcc", "ajj.d", "h..kd", "h..ke", "ggffe"};
string s6[6] = {"aabaa.", "d.b..b", "dcc..b", "aa.aac", "..cd.c", "..cdbb"};
string s7[7] = {".xxyyzz", "xaa.aa.", "x..b..b", "y..b..b", "yaa.aa.", "z..b..b", "z..b..b"};

int n;

void filln(int from, int to, int n, string s[]) {
    for (int i = from; i < to; ++i) {
        for (int j = from; j < to; ++j) {
            ans[i][j] = s[(i-from)%n][(j-from)%n];
        }
    }
}

void print() {
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (ans[i][j]) putchar(ans[i][j]);
            else putchar('.');
        }
        puts("");
    }
    exit(0);
}

int main() {
    scanf("%d", &n);
    int x = n;
    int prev = n;
    if (n < 3) {
        puts("-1");
        return 0;
    }
    if (n%5 == 0) {
        while (x) {
            x -= 5;
            filln(x, prev, 5, s5);
            prev = x;
        }
    } else if (n == 7) {
        filln(0, 7, 7, s7);
    } else if (n == 11) {
        filln(0, 6, 6, s6);
        filln(6, 11, 5, s5);
    } else if (n%3==0) {
        while (x) {
            x -= 3;
            filln(x, prev, 3, s3);
            prev = x;
        }
    } else {
        while (x%4 != 0 && x > 0) {
            x -= 5;
            filln(x, prev, 5, s5);
            prev = x;
        }
        while (x) {
            x -= 4;
            filln(x, prev, 4, s4);
            prev = x;
        }
    }
    print();
    
    return 0;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define REP(i,N) for (int i=0;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main(){
    int N;
    cin >>N;
    vector<double>v(N);
    REP(i,N) cin >>v[i];
    //vector<double>val(N);
    sort(ALL(v));
    double val=v[0];
    REP(i,N-1) val=(val+v[i+1])/2;
    cout<<val<<endl;
}

Measured memory_bytes: 256
N,A,B = map(int,input().split())

ans = 0
for i in range(1,N+1):
    a = int(i/10000)%10
    b = int(i/1000)%10
    c = int(i/100)%10
    d = int(i/10)%10
    e = i%10
    
    if A<=a+b+c+d+e and a+b+c+d+e<=B:
        ans += i
        
print(ans)

Measured memory_bytes: 9000
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
typedef std::pair<int, int> P;
const int INF = 1000100;
using namespace std;
int h, w;
int ans = 0;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
int main()
{
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    rep(i, h) rep(j, w)
    { //i,jをスタートとする最短経路
        if (s[i][j] == '#')
            continue;
        queue<P> q;
        vector<vector<int>> dist(h, vector<int>(w, INF));
        auto update = [&](int x, int y, int z) {
            if (dist[x][y] != INF)
                return;
            dist[x][y] = z;
            q.push({x, y});
        };
        update(i, j, 0);
        while (!q.empty())
        {
            int ci = q.front().first;
            int cj = q.front().second;
            q.pop(); //取り出した処理
            rep(dis, 4)
            {
                int ni = ci + di[dis];
                int nj = cj + dj[dis];
                if (ni < 0 || ni >= h || nj < 0 || nj >= w)
                    continue;
                if (s[ni][nj] == '#')
                    continue;
                update(ni, nj, dist[ci][cj] + 1);
            };
        }

        rep(a, h) rep(b, w)
        {
            if (dist[a][b] == INF)
                continue;
            ans = max(ans, dist[a][b]);
        }
    }
    cout << ans << endl;
    return 0;
}


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

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

    vector<int> d(N);
    for (int i = 0; i < N; i++)
    {
        cin >> d[i];
    }

    sort(d.begin(), d.end());

    int ans = 0;
    int cur = -1;
    for (int i = 0; i < N; i++)
    {
        if (cur != d[i])
        {
            cur = d[i];
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
s = input()
al = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r",\
      "s","t","u","v","w","x","y","z"]
for i in range(26):
  if s.count(al[i]) == 0:
    print(al[i])
    break
  elif i == 25:
    print("None")

Measured memory_bytes: 3188
#import collections
# c = collections.Counter()
#import itertools as it
#import math
#import numpy as np
#import sys 
#sys.exit()
 
a = int(input())
 
#k = int(input())
#a, b  = map(int, input().split())
'''
#  = list(map(int, input().split()))
'''
'''
n = input()
a = [int(input()) for i in range(n)]
'''
'''
n,m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
'''
 
#-------------------------------#
#len(t)==len(s)+1
#print(t[0:-1])
print(a+pow(a,2)+pow(a,3))

Measured memory_bytes: 9148
n, m = list(map(int, input().split()))
alst = list(map(int, input().split()))
cnt = 0
sum = 0
for x in alst:
  sum += x
min = sum / (4 * m)
for a in alst:
  if a >= min:
    cnt += 1
if cnt >= m:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
a,b,c,d = map(int,input().split())
cnt = 0
while True:
    if cnt % 2 == 0:
        c -= b
    else:
        a -= d
    cnt += 1
    if c <= 0:
        print("Yes")
        break
    elif a <= 0:
        print("No")
        break

Measured memory_bytes: 61708
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));

            return;
        }

        public void Solve(ConsoleInput cin)
        {

            var A = cin.ReadLong;
            var B = cin.ReadLong;
            var C = cin.ReadLong;
            var D = cin.ReadLong;

            var CountA1 = Count(A - 1, C, D);
            var CountB = Count(B, C, D);
            Console.WriteLine(CountB - CountA1);
            return;
        }

        public long Count(long Num, long C, long D)
        {
            long NumDivC = Num / C;
            long NumDivD = Num / D;

            long GCD_C_D = Gcd(C, D);
            long LCM_C_D = C * D / GCD_C_D;

            long NumDivCD = Num / LCM_C_D;

            return Num - (NumDivC + NumDivD - NumDivCD);
        }
        public long Gcd(long a, long b)
        {
            if (a < b) {
                return Gcd(b, a);
            }
            while (b != 0) {
                long remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }

    }

    public static class Extensions
    {
        public static string Reverse(this string sourse)
        {
            char[] chrAry = sourse.ToCharArray();
            Array.Reverse(chrAry);
            return new string(chrAry);
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
 

int main() {
	ll n,d;
	cin>>n>>d;
	ll ans=0;
	d=d*d;
	for(ll i=0;i<n;i++){
		ll x,y;
		cin>>x>>y;
		if(d>=x*x+y*y){
			ans++;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 3632
//author : 'Amit Singh Sansoya @amit3200'
//it was all meant to happen as i was all talk!
#include<bits/stdc++.h>
using namespace std;
int n,k;
vector<bool> dp;
vector<int> arr;
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		int data;
		cin>>data;
		arr.push_back(data);
	}
	dp.resize(k+1);
	for(int i=0;i<=k;i++){
		for(auto j:arr){
			if(i>=j && dp[i-j]==false){
				dp[i]=true;
			}
		}
	}
	if(dp[k])
		cout<<"First\n";
	else
		cout<<"Second\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>  
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    /*ll t;
    cin>>t;
    ll x=0;
    while(t--)
    {
        ++x;
        ll n;
        cin>>n;
        ll sum=0;
        ll** arr=new ll*[n];
        for(ll i=0;i<n;++i)
        {
            arr[i]=new ll[n];
            for(ll j=0;j<n;++j)
            {
                cin>>arr[i][j];
                if(i==j)
                {
                    sum+=arr[i][j];
                }
            }
        }
        ll r=0;
        ll c=0;
        for(ll i=0;i<n;++i)
        {
            set<ll> s;
            for(ll j=0;j<n;++j)
            {
                s.insert(arr[i][j]);
            }
            if(s.size()!=n)
            {
                ++r;
            }
        }
        for(ll i=0;i<n;++i)
        {
            set<ll> s;
            for(ll j=0;j<n;++j)
            {
                s.insert(arr[j][i]);
            }
            if(s.size()!=n)
            {
                ++c;
            }
        }

    }*/
    ll n,m;
    cin>>n>>m;
    ll sum=0;
    ll* arr=new ll[n];
    for(ll i=0;i<n;++i)
    {
        cin>>arr[i];
        sum+=arr[i];
    }
    ll div=4*m;
    bool take=false;
    if(sum%div==0)
    {
        take=true;
    }
    ll req=sum/div;
    ll count=0;
    for(ll i=0;i<n;++i)
    {
        if(arr[i]>req)
        {
            ++count;
        }
        else if(arr[i]==req&&take==true)
        {
            ++count;
        }
    }
    if(count>=m)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
}
// cout<<"Case #"<<x<<": "<<sum<<" "<<r<<" "<<c<<endl;




















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

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

  vector<vector<ll>> id(n+1);
  vector<ll> p(m), y(m);
  for(int i = 0; i < m; i++){
    cin >> p[i] >> y[i];
    id[p[i]].push_back(y[i]);  
  }
  
  for(int i = 0; i < n; i++){
    sort(id[i+1].begin(), id[i+1].end());
  }

  for(int i = 0; i < m; i++){
    printf("%012lld\n", p[i] * 1000000 + int(lower_bound(id[p[i]].begin(),id[p[i]].end(),y[i])-id[p[i]].begin()+1));
  }

  return 0;

}

Measured memory_bytes: 8576
#include<iostream>
using namespace std;
 
int main(){
	int N;
	char s[101];
	int loop;
	int max = 0;
	int x = 0;
 
	cin >> N >> s;
	for (loop = 0; loop < N; loop++){
		if (s[loop] == 'I') {
			if (max < ++x)max = x;
		}
		else x--;
	}
	cout << max << "\n";
	return 0;
}

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(int, n, k);
  V<int> a(n);
  rep(i, n) cin >> a[i];
  int i = 0;
  while (a[i] != 1) ++i;
  int ans = numeric_limits<int>::max();
  rep(j, k) {
    int l = i - j;
    int r = i + (k - 1 - j);
    if (l < 0 || n <= r) continue;
    int sum = 1;
    if (l > 0) sum += (l + k - 2) / (k - 1);
    if (r < n - 1) sum += (n - 1 - r + k - 2) / (k - 1);
    ans = min(ans, sum);
  }
  wt(ans);
}


Measured memory_bytes: 3604
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int i;
  int N,K,T,U,V,L;
  cin>>N>>K>>T>>U>>V>>L;
  int a[201];
  for(i=0;i<N;++i)
    cin>>a[i];
  a[i]=L;
  double rt=0,di=0,it;
  int rf=0,cc=0,ai=0;
  for(;ai<N+1;){
    if(rf){
      if(0){
      }else if((a[ai]-di)/V+it<T){
	rt+=(a[ai]-di)/V;
	if(cc==K){
	  it=0;
	}else{
	  it+=(a[ai]-di)/V;
	  ++cc;
	}
	di=a[ai];
	++ai;
      }else if((a[ai]-di)/V+it>T){
	rt+=T-it;
	di+=(T-it)*V;
	it=0;
	if(cc){
	  --cc;
	}else{
	  rf=0;
	}
      }else{
	rt+=T-it;
	di=a[ai];
	it=0;
	++ai;
      }
    }else{
      rt+=(a[ai]-di)/U;
      di=a[ai];
      it=0;
      rf=-1;
      ++ai;
    }
  }
  printf("%.9f\n",rt);
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
typedef long long ll;
int main(int argc, char const *argv[]) {
    ll n;
    std::cin >> n;
    ll v[n];
    for (size_t i = 0; i < n; i++) {
        std::cin >> v[i];
    }
    std::map<ll, ll> even{};
    std::map<ll, ll> odd{};

    for (size_t i = 0; i < n; i++) {
        if (i % 2 == 0) {
            even[v[i]] += 1;
        } else {
            odd[v[i]] += 1;
        }
    }

    ll max_even = -100000000000;
    ll second_even = -1000000000;
    ll max_odd = -100000000000;
    ll second_odd = -1000000000;
    ll even_max_key;
    ll odd_max_key;
    for (auto x : even) {
        if (max_even < x.second) {
            second_even = max_even;
            max_even = x.second;
            even_max_key = x.first;
        } else if (second_even < x.second) {
            second_even = x.second;
        }
    }

    for (auto x : odd) {
        if (max_odd < x.second) {
            second_odd = max_odd;
            max_odd = x.second;
            odd_max_key = x.first;
        } else if (second_odd < x.second) {
            second_odd = x.second;
        }
    }

    ll ans = 0;
    if (odd_max_key != even_max_key) {
        std::cout << n - max_even - max_odd << '\n';
    } else if (second_odd < 0 && second_even < 0) {
        std::cout << max_even << '\n';
    } else {
        std::cout << std::min(n - max_even - second_odd,
                              n - max_odd - second_even)
                  << '\n';
    }
    return 0;
}


Measured memory_bytes: 7296
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline int rd_int(void){
  int x;
  rd(x);
  return x;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
int M;
int L;
long long dis[300][300];
int res[300][300];
int main(){
  int KL2GvlyY, Lj4PdHRW;
  int i;
  int j;
  int k;
  rd(N);
  rd(M);
  rd(L);
  for(i=(0);i<(N);i++){
    for(j=(0);j<(N);j++){
      dis[i][j] = 4611686016279904256LL;
    }
  }
  for(i=(0);i<(N);i++){
    dis[i][i] = 0;
  }
  for(Lj4PdHRW=(0);Lj4PdHRW<(M);Lj4PdHRW++){
    rd(i);i += (-1);
    rd(j);j += (-1);
    rd(k);
    dis[i][j] = dis[j][i] = k;
  }
  for(k=(0);k<(N);k++){
    for(i=(0);i<(N);i++){
      for(j=(0);j<(N);j++){
        chmin(dis[i][j], dis[i][k] + dis[k][j]);
      }
    }
  }
  for(i=(0);i<(N);i++){
    for(j=(0);j<(N);j++){
      res[i][j] = 1073709056;
    }
  }
  for(i=(0);i<(N);i++){
    res[i][i] = 0;
  }
  for(i=(0);i<(N);i++){
    for(j=(0);j<(N);j++){
      if(dis[i][j] <= L){
        chmin(res[i][j], 1);
      }
    }
  }
  for(k=(0);k<(N);k++){
    for(i=(0);i<(N);i++){
      for(j=(0);j<(N);j++){
        chmin(res[i][j], res[i][k] + res[k][j]);
      }
    }
  }
  int Q5VJL1cS = rd_int();
  for(KL2GvlyY=(0);KL2GvlyY<(Q5VJL1cS);KL2GvlyY++){
    rd(i);i += (-1);
    rd(j);j += (-1);
    if(res[i][j]==1073709056){
      wt_L(-1);
      wt_L('\n');
    }
    else{
      wt_L(res[i][j]-1);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20191027-1

// --- original code ---
// int N, M, L;
// ll dis[300][300];
// int res[300][300];
// 
// {
//   int i, j, k;
//   rd(N,M,L);
//   rep(i,N) rep(j,N) dis[i][j] = ll_inf;
//   rep(i,N) dis[i][i] = 0;
//   rep(M){
//     rd(i--,j--,k);
//     dis[i][j] = dis[j][i] = k;
//   }
//   rep(k,N) rep(i,N) rep(j,N) dis[i][j] <?= dis[i][k] + dis[k][j];
//   rep(i,N) rep(j,N) res[i][j] = int_inf;
//   rep(i,N) res[i][i] = 0;
//   rep(i,N) rep(j,N) if(dis[i][j] <= L) res[i][j] <?= 1;
//   rep(k,N) rep(i,N) rep(j,N) res[i][j] <?= res[i][k] + res[k][j];
// 
//   REP(rd_int()){
//     rd(i--,j--);
//     wt(if[res[i][j]==int_inf, -1, res[i][j]-1]);
//   }
// }


Measured memory_bytes: 1536
N = int(input())
A = 'abcdefghijklmnopqrstuvwxyz'
assert len(A) == 26

def f(n):
  if n < 26:
    return [A[n % 26]]
  return f((n // 26) - 1) + [A[n % 26]]

print(''.join(f(N - 1)))

Measured memory_bytes: 9164
import java.util.Scanner;

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

        if(S.length()>K){
            System.out.println(S.substring(0,K)+"...");
        }else{
            System.out.println(S);
        }

        sc.close();
    }
}

Measured memory_bytes: 38516