akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << '>' << #x << ':' << x << endl;
#define ll long long

int main() {
	int n, m;
	cin >> n >> m;
	string ans;
	if (n == 1) {
		ans = "00";
		for (int i = 0; i < m; i++) {
			int in, num;
			cin >> in >> num;
			if (in == 1 && ans[in] == '0') {
				//cout << "1";
				ans[in] = num + '0';
			} else if (in == 1 && ans[in] != num + '0')
				return cout << "-1", 0;
			else if (ans[in] == '0' && in != 1) {
				//cout << "3";
				ans[in] = num + '0';
			} else if (ans[in] != num + '0' && in != 1) {

				return cout << "-1", 0;
			}
		}
		cout << ans[1];
	} else {
		ans = "0100";

		for (int i = 0; i < m; i++) {
			int in, num;
			cin >> in >> num;

			if (in == 1 && ans[in] == '1') {
				//cout << "1";
				ans[in] = num + '0';
			} else if (in == 1 && ans[in] != num + '0')
				return cout << "-1", 0;
			else if (ans[in] == '0' && in != 1) {
				//cout << "3";
				ans[in] = num + '0';
			} else if (ans[in] != num + '0' && in != 1) {

				return cout << "-1", 0;
			}
		}
		if (ans[1] == '0')
			return cout << "-1", 0;
		for (int i = 1; i <= n; i++)
			cout << ans[i];
	}
}


Measured memory_bytes: 3560
#include<iostream>
#include<string.h>
using namespace std;

void ss(string *s) {
	for (int i = 0; i < s->size(); i++) {
		int min = s->at(i);
		int ii = i;
		for (int k = i; k < s->size(); k++) {

			if (min > s->at(k)) {
				min = s->at(k);
				ii = k;
			}
		}
		int swap = s->at(i);
		s->at(i) = min;
		s->at(ii) = swap;
	}
}
void tt(string* t) {
	for (int i = 0; i < t->size(); i++) {
		int min = t->at(i);
		int ii = i;
		for (int k = i; k < t->size(); k++) {

			if (min < t->at(k)) {
				min = t->at(k);
				ii = k;
			}
		}
		int swap = t->at(i);
		t->at(i) = min;
		t->at(ii) = swap;
	}
}
int main() {
	string s, t;
	cin >> s >> t;
	int ln, lm;
	ln = s.size();
	lm = t.size();

	ss(&s);
	tt(&t);
	/*int i = 0;
	while (i<ln&&i<lm&&s.at(i) == t.at(i)) {
		i++;
	}
	if (i==ln) {
		if (ln < lm)cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	else {
		if (s.at(i) < t.at(i))cout << "Yes" << endl;
		else cout << "No" << endl;
	}*/
	if (s < t)cout << "Yes" << endl;
	else cout << "No" << endl;

	

}

Measured memory_bytes: 3644
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    public static void main(String[] args) {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try {
            String str1 = reader.readLine();
	    String s[]=str1.split(" ");
	    int i1=Integer.parseInt(s[0]);
	    int i2=Integer.parseInt(s[1]);

	    int count=i1/i2;
	    count+=i1%i2;
	    System.out.println(count);
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}



Measured memory_bytes: 24460
import java.util.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int a[][]=new int[100][100];
        int n=sc.nextInt();
        int m=sc.nextInt();
        int l=sc.nextInt();
        for(int j=0;j<n;j++){
            for(int k=0;k<m;k++){
                a[j][k]=sc.nextInt();
            }
        }
        int b[][]=new int[100][100];
        for(int j=0;j<m;j++){
            for(int k=0;k<l;k++){
                b[j][k]=sc.nextInt();
            }
        }
        long c[][]=new long[100][100];
        for(int j=0;j<n;j++){
            for(int k=0;k<l;k++){
                for(int i=0;i<m;i++){
                    c[j][k]+=a[j][i]*b[i][k];
                }
                System.out.print(c[j][k]);
                if(k!=l-1)System.out.print(" ");
            }
            System.out.println();
        }
    }
}


Measured memory_bytes: 56500
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
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;}
const long long INF = 1LL << 60;
// spring s; cin >> s;
// cout << res << endl;
// --------write my code!!!!!----------//

int main(){
    int n; cin >> n;
    string s; cin >> s;
    int k; cin >> k;
    char a = s[k-1];
    for(int i=0; i< s.length(); ++i){
        if(s[i]!=a) s[i]='*';
    }
    cout << s << endl;
    
}


Measured memory_bytes: 256
// ABC137-C
#include <bits/stdc++.h>
#define endl "\n"
#define rep(i,n) for(int i=0;i<int(n);i++)
#define e_b emplace_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> ipair;
typedef pair<ll,ll> lpair;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) //vectorの中身を見る
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
void map_p(map<int,int>& d){cout<<"map: ";for(auto a : d){cout<<"{"<<a.first<<":"<<a.second<<"}";}cout<<endl;} //mapの中身を見る
void set_p(set<int>& d){cout<<"set: ";for(int a : d){cout<<a<<" ";}cout<<endl;} //setの中身を見る


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);

    int n;
    cin>>n;
    vector<string> kind(n);
    rep(i,n){
        string s;
        cin>>s;
        sort(all(s));
        kind[i]=s;
    }
    sort(all(kind));
    ll ans=0;
    string bef="";
    ll ren=0;
    rep(i,n){
        if(bef!=kind[i]){
            if(ren>=2){
                ans+=ren*(ren-1)/2;
            }
            bef=kind[i];
            ren=1;
        }else{
            ren++;
        }
    }
    if(ren>=2){
        ans+=ren*(ren-1)/2;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6356
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#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 = 6e5 + 123;                                          
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 n, m, k;
int dp[N];
int sf[N];
string s;


int main () {
	SpeedForce;

	cin >> n >> k >> m >> s;
	s ='#' + s;
	int ptr = 0;
	int cnt = 0;
	for (int i = 1; i <= n; ++i) {
		while (i - ptr - 1 > m) ++ptr;

		if (s[i] == 'o') {
			++cnt;
			dp[i] = max(dp[i-1], dp[ptr] + 1);
		} else {
			dp[i] = dp[i-1];
		}
	}
	if (!m) {
		for (int i = 1; i <= n; ++i) {
			if (s[i] == 'o') {
				--cnt;
				if (cnt < k) {
					cout << i << '\n';
				}
				++cnt;
			}
		}
		exit(0);
	}
	vector < int > ans;
	ptr = n + 1;
	for (int i = n; i >= 1; --i) {
		while(ptr - 1 - i > m) --ptr;
		if (s[i] == 'o') {
			sf[i] = max(sf[i+1], sf[ptr] + 1);
		} else {
			sf[i] = sf[i+1];
		}
	}

	ptr = 0;
	int P2 = 2;
	deque < pair<int,int> > dq;
	for (int i = 1; i <= n; ++i) {
		while (i - ptr > m) ++ptr;

		while(P2 <= n && P2 - i < m) {
			while(dq.size() && dq.back().F < sf[P2] + dp[P2-m]) {
				dq.pop_back();
			} 
			dq.pb({sf[P2] + dp[P2-m], P2});
			++P2;
		}
		while (dq.size() && dq.front().S <= i) dq.pop_front();

		int res = max(dp[i-1], sf[i+1]);
		if(dq.size()) res = max(res, dq.front().F);
		if(!m) {
			res = max(res, dp[i-1] + sf[i+1]);
		}

		if (s[i] == 'o' && res < k) {
		//	cout << res << ' ';
			cout << i << '\n';
		}
	}


	return Accepted;
}

// B...a

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

int main()
{
    int n,d;
    cin >> n >> d;
    vector<vector<int>> x(n, vector<int>(d));
    rep(i,n) rep(j,d) cin >> x[i][j];

    int cnt = 0;
    rep(i,n-1)
        rep2(j,i+1,n)
        {
            double dist = 0;
            rep(k,d) dist += (x[i][k]-x[j][k]) * (x[i][k]-x[j][k]);
            dist = sqrt(dist);
            if(int(dist)-dist==0) cnt++;
        }

    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
/************************************************
 * Au: Hany01
 * Date: Feb 10th, 2019
 * Prob: yahoo2019_f
 * Email: hany01dxx@gmail.com & hany01@foxmail.com
 * Inst: Yali High School
************************************************/

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int, int> PII;
#define Rep(i, j) for (register int i = 0, i##_end_ = (j); i < i##_end_; ++ i)
#define For(i, j, k) for (register int i = (j), i##_end_ = (k); i <= i##_end_; ++ i)
#define Fordown(i, j, k) for (register int i = (j), i##_end_ = (k); i >= i##_end_; -- i)
#define Set(a, b) memset(a, b, sizeof(a))
#define Cpy(a, b) memcpy(a, b, sizeof(a))
#define X first
#define Y second
#define PB(a) push_back(a)
#define MP(a, b) make_pair(a, b)
#define SZ(a) ((int)(a).size())
#define ALL(a) a.begin(), a.end()
#define INF (0x3f3f3f3f)
#define INF1 (2139062143)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define y1 WoXiHuanNiA

template <typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, 1 : 0; }
template <typename T> inline T read() {
	register T _, __; register char c_;
    for (_ = 0, __ = 1, c_ = getchar(); c_ < '0' || c_ > '9'; c_ = getchar()) if (c_ == '-') __ = -1;
    for ( ; c_ >= '0' && c_ <= '9'; c_ = getchar()) _ = (_ << 1) + (_ << 3) + (c_ ^ 48);
    return _ * __;
}
//EOT


const int MAXN = 2005, MOD = 998244353;

char S[MAXN];
int n, r[MAXN], b[MAXN], dp[MAXN << 1][MAXN << 1];

int getr(int x) { return r[min(x, n)]; }
int getb(int x) { return b[min(x, n)]; }

int main() {
#ifdef hany01
	freopen("yahoo2019_f.in", "r", stdin);
	freopen("yahoo2019_f.out", "w", stdout);
#endif

	scanf("%s", S + 1), n = strlen(S + 1);
	For(i, 1, n) {
		if (S[i] == '0') r[i] = r[i - 1] + 2, b[i] = b[i - 1];
		else if (S[i] == '1') r[i] = r[i - 1] + 1, b[i] = b[i - 1] + 1;
		else b[i] = b[i - 1] + 2, r[i] = r[i - 1];
	}

	dp[0][0] = 1;
	For(i, 1, n << 1) {
		For(cntr, 0, min(i - 1, getr(i - 1))) {
			int cntb = i - 1 - cntr;
			if (getr(i) >= cntr + 1) (dp[i][cntr + 1] += dp[i - 1][cntr]) %= MOD;
			if (getb(i) >= cntb + 1) (dp[i][cntr] += dp[i - 1][cntr]) %= MOD;
		}
	}
	printf("%d\n", dp[n << 1][getr(n)]);

	return 0;
}

Measured memory_bytes: 61440
unittest
{
	assert( [ "2", "0 0", "1 0" ].parse.expand.solve == "0.500000" );
	assert( [ "3", "0 0", "0 1", "1 0" ].parse.expand.solve == "0.707107" );
	assert( [ "10", "10 9", "5 9", "2 0", "0 0", "2 7", "3 3", "2 5", "10 0", "3 7", "1 9" ].parse.expand.solve == "6.726812" );
	
	assert( [ "4", "0 0", "0 1000", "1000 1000", "1000 0" ].parse.expand.solve == "707.106781" );		// 追加ケース
}



import std.algorithm;
import std.conv;
import std.format;
import std.math;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	auto xys = new real[ 2 ][ n ];
	foreach( ref xy; xys )
	{
		input.popFront;
		xy = input.front.split.to!( real[] );
	}
	return tuple( xys );
}

auto solve( real[ 2 ][] xys )
{
	// 全ての点を含む円の中心のx座標を半径が一番小さくなるように三分検索
	auto ans = real.max;
	auto l = 0.0L;
	auto r = 1000.0L;
	foreach( i; 0 .. 60 )
	{
		auto lc = l + ( r - l ) / 3;
		auto rc = l + ( r - l ) / 3 * 2;
		
		auto lcd = solve2( xys, lc );
		auto rcd = solve2( xys, rc );
		ans = min( ans, lcd, rcd );
		
		if( lcd < rcd ) r = rc;
		else            l = lc;
	}
	return format( "%0.6f", ans );
}

auto solve2( real[ 2 ][] xys, real x )
{
	// 全ての点を含む円の中心のy座標を半径が一番小さくなるように三分検索
	auto ans = real.max;
	auto l = 0.0L;
	auto r = 1000.0L;
	foreach( i; 0 .. 60 )
	{
		auto lc = l + ( r - l ) / 3;
		auto rc = l + ( r - l ) / 3 * 2;
		
		auto lcd = 0.0L;
		auto rcd = 0.0L;
		foreach( xy; xys )
		{
			lcd = max( lcd, hypot( xy[ 0 ] - x, xy[ 1 ] - lc ) );
			rcd = max( rcd, hypot( xy[ 0 ] - x, xy[ 1 ] - rc ) );
		}
		ans = min( ans, lcd, rcd );
		
		if( lcd < rcd ) r = rc;
		else            l = lc;
	}
	return ans;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
int best=1;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	for(i=1;i*i<=M;i++) if(M%i==0) {
		if(M/i>=N) best=max(best,i);
		if(M/(M/i)>=N) best=max(best,M/i);
	}
	cout<<best<<endl;
	
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){

	int n, m, l;

	long long A[100][100], B[100][100], C[100][100];

	cin >> n >> m >> l;

	for( int i = 0; i < n; i++)

		for( int j = 0; j < m; j++) cin >> A[i][j];

	for( int i = 0; i < m; i++)

		for( int j = 0; j < l; j++) cin >> B[i][j];


	for ( int i = 0; i < n; i++){

		for( int j = 0; j < l; j++){

			C[i][j] = 0;

			for( int k = 0; k < m; k++){

				C[i][j] += A[i][k]*B[k][j];

			}

		}

	}


	for( int i = 0; i < n; i++){

		for ( int j = 0; j < l; j++){

			if( j ) cout << " ";

			cout << C[i][j];

		}

		cout << endl;

	}

	return 0;

}

Measured memory_bytes: 1396
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
//const int MX = 31001;
//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


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; }


/*
constant values
*/

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


// Main program
void solve(){
    int K;
    cin >> K;
    int A[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    cout << A[K-1] << endl;
    return;
}

// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define PI 3.141592653589793
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
    ll K,X;
    cin >> K >> X;
    if(500 * K >= X){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    

}

Measured memory_bytes: 256
#include <iostream>                                                                                                               
#include <iomanip>                                                                                                                
using namespace std;                                                                                                              
                                                                                                                                  
int main(void) {                                                                                                                  
  int a, b;                                                                                                                       
  cin >> a >> b;                                                                                                                  
  cout << a/b << " " << a%b << fixed << setprecision(5) << " " << (double)a/b << endl;                                            
}                                                                                                                                 
                                                                                                                                  
                                                                                                                                  
                                                                                                                                  
                                                                                                                                  
                                                         

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

bool flags[21][21];
char maps[21][21];
int W, H;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};

int dfs(int x, int y)
{
  if(x < 0 || y < 0 || x >= H || y >= W || flags[x][y] || maps[x][y] == '#')return 0;

  flags[x][y] = true;
  int sum = 0;
  for(int i = 0; i < 4; i++){
    sum += dfs(x + dx[i], y + dy[i]);
  }
  
  return sum + 1;
}

int main()
{
  while(cin >> W >> H && !((W * H) == 0))
    {
      memset(maps, 0, 21 * 21 * sizeof(char));
      memset(flags, 0, 21 * 21 * sizeof(bool));

      int sx, sy;

      for(int i = 0; i < H; i++) {
        for(int j = 0; j < W; j++) {
          cin >> maps[i][j];
          if(maps[i][j] == '@'){
            sx = i;sy = j;
          }
        }
      }
      cout << dfs(sx, sy) << endl;
    }
  return 0;
}

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

int main()
{
	int a, b, c, d;
	cin >> a >> b >> c;
	if (a > b) {
		d = a;
		a = b;
		b = d;
	}
	if (b > c) {
		d = b;
		b = c;
		c = d;
	}
	if (a > b) {
		d = a;
		a = b;
		b = d;
	}
	cout << a << " " << b << " " << c<<"\n";
    return 0;
}

Measured memory_bytes: 1168
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<ll>;
using vvi = vector<vi>;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;

int main() {
    int n;
    cin >> n;
    vvi f(n, vi(10));
    rep(i, n) {
        rep(j, 10) {
            cin >> f[i][j];
        }
    }
    vvi p(n, vi(11));
    rep(i, n) {
        rep(j, 11) {
            cin >> p[i][j];
        }
    }

    ll ans = -LINF;
    rep(i, 1024) {
        if(i == 0) continue;
        ll now=0;
        vi nnow(n);
        rep(j, n) {
            rep(k, 10) {
                if((i>>k)&1 && f[j][k]) {
                    nnow[j]++;
                }
            }
        }
        
        rep(j, n) {
            now += p[j][nnow[j]];
        }
        ans = max(ans, now);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
n,s=map(x->parse(Int,x),readlines())
m=isqrt(n)
A=[]
f(b,n)=n<b ? n : f(b,div(n,b))+n%b
g(b)=b>1&&f(b,n)==s&&push!(A,b)
g(n+1)
for b=1:m
	g(b)
	g(div(n-s,b)+1)
end
println(isempty(A) ? -1 : minimum(A))

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

#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
#define OMAZINAI cin.tie(0); ios::sync_with_stdio(false);
#define INF (1LL<<61)
typedef long long int ll;

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	std::cout << ::max({ a, b, c }) - std::min({ a, b, c }) << std::endl;
	return 0;
}

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

lst = list(map(int,input().split()))

time = []

for i in range(N-K+1):
  t = min(abs(lst[i]) + abs(lst[i] - lst[i + K - 1]),abs(lst[i + K -1]) + abs(lst[i] - lst[i + K -1]))
  time.append(t)
                           
print(min(time))

Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <algorithm>
#include <fstream>
#include <numeric>
#include <cmath>
#include <set>
#include <functional>
#include <vector>
#include <queue>

using namespace std;

#define ll long long
#define INF 2000000000
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define dum(x) cout<<#x<<'='<<x<<endl
#define darr(arr,n) rep(i,(n-arr)){cout<<*(arr+i)<<' ';}cout<<endl;

int a[100010];

int main() {
    int A,B;
    cin >> A >> B;


    cout << max({ A + B,A - B,A*B }) << endl;
}

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

const int INF = 1001001001;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};

int main()
{
    ll n, d;
    cin >> n >> d;
    vector<ll> x(n), y(n);
    rep(i, 0, n) cin >> x[i] >> y[i];
    int ans = 0;
    rep(i, 0, n){
        if(x[i]*x[i] + y[i]*y[i] <= d*d) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6372
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

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; }
const long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

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

int main() {
    int N;cin >> N;
    vector<long long> retu(N);
    map<long long,int> M;
    for(int i = 0;i<N;i++){
        cin >> retu.at(i);
        M[retu.at(i)]++;
    }
    long long ans = 0;
    for(auto P : M){
        long long A = P.first;
        int num = P.second;
        if(A <= num){
            ans += num-A;
        }
        else{
            ans += num;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 7040
#include<iostream>
#include<cstdlib>

using namespace std;

int binarySearch(int T,int n,int A[]);

int main(){
	int n,q,*A,T;
	
	cin>>n;
	A = new int[n+1];
	for(int i=0;i<n;i++) cin>>A[i];

	cin>>q;
	static int count;
	for(int i=0;i<q;i++){
		cin>>T;
		if(binarySearch(T,n,A)) count++;
	}

	cout<<count<<endl;

	delete [] A;
	cin.get();
	cin.get();
}

int binarySearch(int T,int n,int A[]){
	int left = 0 , right = n , mid;
	while(left<right){
		mid = (left+right)/2;
		if(T==A[mid]){
			break;
		}else if(T<A[mid]){
			right = mid;
		}else{
			left = mid+1;
		}
	}
	return T==A[mid];
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;

int main(){
  int N;
  cin >> N;
  while(N>0){
    N-=1000;
  }
  cout << N*(-1) << endl;
}

Measured memory_bytes: 3608
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,d,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> s;
	//vector<ll>	aa(n);
	for(i=0;i<10;i++) s[i] -= '0';
	d = s[0]*10000000+s[1]*1000000+s[2]*100000+s[3]*10000;
	d += s[5]*1000+s[6]*100;
	d += s[8]*10+s[9];
	//cout << d << endl;
	if (d<=20190430) s = "Heisei";
	else s = "TBD";
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 3536
import sys

input = sys.stdin.readline


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def func(N, mod):
    F = [1]
    for i in range(1, N + 1):
        F.append(F[-1] * i % mod)
    return F


def inv(a, mod):
    return pow(a, mod - 2, mod)


def C(F, a, b, mod):
    return F[a] * inv(F[b], mod) * inv(F[a - b], mod) % mod


def main():
    N, T = read_values()
    A = read_list()
    res = T
    for i in range(N - 1):
        res += min(A[i + 1] - A[i], T)

    print(res)


if __name__ == "__main__":
    main()



Measured memory_bytes: 25744
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;


bool compair_pair(const pair<long long, int>& a, const pair<long long, int>& b){
    return a.first < b.first;
}

int main()
{
    int N, M, p;
    long long y;
    cin >> N >> M;
    vector<vector<pair<long long, int>>> ken(N);
    vector<long long> city(M);

    for (int i = 0; i < M; i++)
    {
        cin >> p;
        cin >> y;
        ken.at(--p).push_back(pair<long long, int>(y, i));
    }

    long long count;
    for (long long i = 0; i < N; i++)
    {
        count = 0;
        if (ken[i].size() == 0)
            continue;
        else
        {
            sort(ken[i].begin(), ken[i].end(), compair_pair);
            for (pair<long long, int> j : ken[i])
            {
                ++count;
                city.at(j.second) = (i+1) * 1000000 + count;
            }
        }
    }

    for (int i = 0; i < M; i++)
    {
        long long num = 100000000000;
        for (int j = 0; j < 12; j++)
        {
            cout << (city[i] / num) % 10;
            num /= 10;
        }
        cout << endl;
    }
}


Measured memory_bytes: 7808
// God put a smile upon your face <3

#include <bits/stdc++.h>

#define slld(longvalue) scanf("%lld", &longvalue)

#define ll long long
#define ull unsigned long long
#define pll pair < long long, long long >

#define fastio ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0)

#define pb push_back

#define bug printf("BUG\n")

#define mxlld LLONG_MAX
#define mnlld -LLONG_MAX

#define mxd 2e8
#define mnd -2e8

#define pi 3.14159265359

using namespace std;

bool check(ll n, ll pos)
{
	return n & (1LL << pos);
}

ll Set(ll n, ll pos)
{
	return n = n | (1LL << pos);
}

vector < pll > vec;
ll dp[2003][2003];

int main()
{
    ll i, j, k, l, m, n, o, r, q;
    ll testcase;
    ll input, flag, tag, ans;

//    freopen("input.txt", "r", stdin);

//    freopen("output.txt", "w", stdout);

    while(cin >> n)
    {
		vec.clear();

		for(ll i = 0; i <= n; i++) for(ll j = 0; j <= n; j++) dp[i][j] = mnlld;

		ans = mnlld;

		for(ll i = 0; i < n; i++)
		{
			cin >> input;

			vec.push_back({input,i + 1});
		}

		sort(vec.rbegin(),vec.rend());

		dp[i][j] = 0;
		for(ll i = 0; i <= n; i++)
		{
			for(ll j = 0; j <= n; j++)
			{
				ll tot = i + j;

				if(tot == n)
				{
					ans = max(ans, dp[i][j]);
					break;
				}

				dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + vec[tot].first * (vec[tot].second - (i + 1)));
				dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + vec[tot].first * (n - j - vec[tot].second));
			}
		}

		cout << ans << "\n";
    }


}





Measured memory_bytes: 34996
H,W=gets.split.map &:to_i
m=$<.map &:chomp
H.times{|h|W.times{|w|
	if m[h][w]!='#'
		r=0
		(-1..1).each{|dh|(-1..1).each{|dw|
			r+=1 if 0<=h+dh&&h+dh<H && 0<=w+dw&&w+dw<W &&m[h+dh][w+dw]=='#'
		}}
		m[h][w]=r.to_s
	end
}}
puts m

Measured memory_bytes: 3836
n = int(input())
li = [input() for _ in range(n)]
march = [0, 0, 0, 0, 0]
for i in range(n):
  if li[i][0] == 'M': march[0] += 1
  if li[i][0] == 'A': march[1] += 1
  if li[i][0] == 'R': march[2] += 1
  if li[i][0] == 'C': march[3] += 1
  if li[i][0] == 'H': march[4] += 1
cnt = 0
for j in range(3):
  for k in range(j+1, 4):
    for l in range(k+1, 5):
      cnt += march[j] * march[k] * march[l]

print(cnt)


Measured memory_bytes: 9752
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
void solve(){
	ll x,y;
	cin>>x>>y;
	for(ll i=0;i<=x;i++)
	if(4*i+2*(x-i)==y){
		cout<<"Yes";
		exit(0);
	}
	cout<<"No";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


Measured memory_bytes: 3636
object Main extends App {
  val inputs: IndexedSeq[String] = scala.io.Source.stdin.getLines().toIndexedSeq

  val n = inputs(0).toInt
  val nums = inputs(1).split(" ").map(_.toInt)

  println(solve(n, nums))

  def solve(n: Int, nums: IndexedSeq[Int]): Int = {
    val sortedNums = nums.sorted
    val max = sortedNums(sortedNums.size - 1)
    var divSeq = sortedNums
    val results = scala.collection.mutable.IndexedSeq.fill(max + 1)(0)

    (1 to n).foreach { i =>
      // 分母
      val div = divSeq(i-1)

      if(results(div) <= 1) {
        Range.inclusive(div, max, div).foreach { j =>
          results.update(j, results(j) + 1)
        }

      }
    }
    var result = 0
    sortedNums.foreach { v =>
      if (results(v) == 1) {
        result = result + 1
      }
    }
    return result
  }
}

Measured memory_bytes: 87100
L = int(input())
A = [int(input()) for _ in range(L)]
dp = [[0]*5 for _ in range(L)]
dp[0][0] = A[0]
dp[0][1] = A[0] % 2 if A[0] > 0 else 2
dp[0][2] = 1-A[0] % 2
dp[0][3] = A[0] % 2 if A[0] > 0 else 2
dp[0][4] = A[0]
for i in range(1, L):
    dp[i][0] = dp[i-1][0] + A[i]
    tmp = A[i] % 2 if A[i] > 0 else 2
    dp[i][1] = min(dp[i-1][0], dp[i-1][1])+tmp
    tmp = 1-A[i] % 2
    dp[i][2] = min(dp[i-1][0], dp[i-1][1], dp[i-1][2])+tmp
    tmp = A[i] % 2 if A[i] > 0 else 2
    dp[i][3] = min(dp[i-1][0], dp[i-1][1], dp[i-1][2], dp[i-1][3])+tmp
    dp[i][4] = min(dp[i-1][0], dp[i-1][1], dp[i-1]
                   [2], dp[i-1][3], dp[i-1][4]) + A[i]
print(min(dp[L-1]))


Measured memory_bytes: 90576
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int> >;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define rrep(i,m,n) for(int i = m; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define mp make_pair
#define sum accumulate
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
typedef long long ll;
const int INF = 2000000000;
const ll INF64 = 1000000000000000ll;
const ll MOD = 1000000007LL;
typedef unsigned int uint;

int main(){
    ll n,l;
    std::cin >> n >> l;
    std::vector<ll> a(n);
    rep(i,n)std::cin >> a[i];
    std::vector<ll> aa(n);
    rep(i,n-1)aa[i]=a[i]+a[i+1];
    bool han=0;
    int dum=0;
    rep(i,n-1)if(aa[i]>=l){
        han=1;
        dum=i;
    }
    if(han){
        std::cout << "Possible"<< std::endl;
        rep(i,dum){
        std::cout << i+1 << std::endl;
        }
        rep(i,n-dum-1){
            std::cout << n-i-1 << std::endl;
        }
    }
    else std::cout << "Impossible"<< std::endl;
    
}

Measured memory_bytes: 2432
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
const int N=4e5;
int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}
int pri[N];
inline void init(int n) {
	int i,j,len=0;
	for (i=2;i<=n;i++) {
		if (!pri[i]) pri[++len]=i;
		for (j=1;j<=len&&i*pri[j]<=n;j++) {
			pri[i*pri[j]]=true;
			if (!(i%pri[j])) break;
		}
	}
}
int main()
{
	int n=gi(),i,ans=0;
	LL x,inv,pi;
	map<LL,int>tot;
	map<LL,int>::iterator it,IT;
	init(2500);
	while (n--) {
		cin>>x;
		for (i=1;(pi=1LL*pri[i]*pri[i]*pri[i])<=x;i++)
			while (!(x%pi)) x/=pi;
		tot[x]++;
	}
	if (tot.begin()->first==1)
		ans++,tot.erase(tot.begin());
	for (it=tot.begin();it!=tot.end();it++) {
		x=it->first;
		for (i=1,inv=1;(pi=1LL*pri[i]*pri[i])*pri[i]<=x;i++)
			if (!(x%pi))
				inv*=pri[i],x=x/pi;
		pi=sqrt(x);
		if (pi*pi==x) inv*=pi;
		else inv*=x*x;
		IT=tot.find(inv);
		if (IT==tot.end()) ans+=it->second;
		else ans+=max(it->second,IT->second),tot.erase(IT);
	}
	printf("%d\n",ans);
	return 0;
}


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

int main() {
	int n,k;
	cin>>n>>k;
	int a[n];
	
	for(int i=0;i<n;i++) cin>>a[i];
	
	sort(a,a+n);
	int ans=0;
	
	for(int i=n-1;i>=0 && k>0;i--){
	    ans+=a[i];
	    k--;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#n=int(input())
a,b,c,x,y=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

ans=a*x+b*y

for i in range(1,max(x,y)+1):
    ans=min(ans,2*c*i+a*max(x-i,0)+b*max(y-i,0))
print(ans)


Measured memory_bytes: 3060
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,ko;
    ll x,y,w,z;
    char hoge,fuga;
    cin>>str;
    str[3]='8';
    cout<<str<<endl;

    return 0;
}


Measured memory_bytes: 3612
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define double long double
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define endl '\n'
#define ff first
#define ss second
#define rev(a) a.rbegin(),a.rend()
#define all(a) a.begin(),a.end()
#define pi pair<int,int>
#define vii vector<pi>
#define pb push_back
//#define size(a)  (int)(a.size())
#define fill(s,x,n) vector
 x(n); rep(i,0,n) cin>>x[i];
#define debug(...) cerr<<" ["<<#__VA_ARGS__<<": "<<(__VA_ARGS__)<<"] ";
#define debugv(...) for(int i=0; i<size(__VA_ARGS__); i++) cerr<<" ["<<#__VA_ARGS__<<i<<": "<<(__VA_ARGS__)[i]<<"] ";
const int mod = 1e8;
const int inf = 1e9+5;
const int inf64 = 1e18+5;
//           -------"Where is your Pen and Paper?"-------
vector<int> parent(100005);
int find_set(int v) {
    if (v == parent[v])
        return v;
    return parent[v] = find_set(parent[v]);
}
void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b)
        parent[b] = a;
}
void solve(){
    int n,m;
    cin>>n>>m;
    for(int i=1; i<=n; i++){
        parent[i]=i;
    }
    for(int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        union_sets(a,b);
    }
    unordered_set<int> s;
    for(int i=1; i<=n; i++){
        find_set(i);
        s.insert(parent[i]);
    }
    cout<<s.size()-1;
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout);  
    #endif
    */
    int test;
    //cin>>test;
    test=1;
    //int cse=1;
    while(test--){
         //cout<<"Case #"<<cse<<": ";
         solve();
         cout<<endl;
         //cse++;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 7444
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;

long long int INF = 1e18;
long long int mod = 1000000007;
double Pi = 3.1415926535897932384626;

vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
char dir[] = "RULD";
//↓,→,↑,←

#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,n) for(i=0;i<n;i++);
#define pub push_back
#define pob push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll number1,ll number2){
    if(number2 == 0){
        return 1;
    }else{
        ll number3 = rui(number1,number2 / 2);
        number3 *= number3;
        number3 %= mod;
        if(number2%2==1){
            number3 *= number1;
            number3 %= mod;
        }
        return number3;
    }
}
ll gcd(ll number1,ll number2){
    if(number1 > number2){
        swap(number1 , number2);
    }
    if(number1 == 0 || number1 == number2){
        return number2;
    }else{
        return gcd(number2 % number1 , number1);
    }
}


ll i,j,k,ii,jj;
ll n,m;
ll a,b,c,d,e,g,h,w,r;
ll l,ans,num;
ll x[1000005],y[500005],z[500005];
bool dame,flag;
//char s[500005],t[500005];
//bool used[500005];
ll snum;




int main(){
    cin >> n >> h >> w;
	for(i=0;i<n;i++){
		cin >> a >> b;
		if(a >= h && b >= w){
			ans ++;
		}
	}
	p(ans);
	return 0;
}

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll A[101010];
int B[2];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>x;
		B[x%2]++;
	}
	
	if(B[1]%2) return _P("NO\n");
	_P("YES\n");
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define all(a) a.begin(),a.end()
#define sz(a) a.size()
#define re return 
#define MP make_pair
#define pb push_back
#define pii pair<int,int>
#define se second
#define fi first
using namespace std;
string s;
signed main(){
	ios_base::sync_with_stdio(0);
	cin>>s;
	for(int i=0;i<sz(s);i+=2) cout<<s[i];
	re 0;
}

Measured memory_bytes: 3728
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

int main(){
    int n,k;
    cin>>n>>k;
    vector<int> v(n);
    rep(i,n)cin>>v[i];
    
    int ans = 0;
    rep(i,n){
        ans += min(v[i],k-v[i])*2;
    }
    cout<<ans<<endl;
}


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

//////全探索したいときに開けよ////////
vector<vector<int>> fspattern;
vector<int> fspattern_draft;
int fspcnt = 0;

void setfspattern_core(int floor,int number,int degree){
  if(floor==degree){
    fspattern.at(fspcnt) = fspattern_draft;
    fspcnt++;
  }else{
    rep(i,number){
      fspattern_draft.at(floor) = i;
      setfspattern_core(floor+1,number,degree);
    }
  }
}

void setfspattern(int number,int degree){
  int64_t array_num = 1;
  rep(i,degree){
    array_num *= number;
  }
  fspattern = vector<vector<int>>(array_num,vector<int>(degree));
  fspattern_draft = vector<int>(degree);
  setfspattern_core(0,number,degree);
}

//////nCrのmodを求めたいときに開けよ/////////
//int64_t univMod = 1000000007;
//int64_t factnum = 100000
//vector<int64_t> modfact(factnum);
//vector<int64_t> modinvfact(factnum);

/*void setmodfact(){
  for(int i=0;i<factnum;i++){
    if(i == 0){
      modfact.at(i) = 1;
    }else{
      modfact.at(i) = (modfact.at(i-1)*i)%univMod;
    }
  }
}

int64_t calcmodpower(int64_t a,int64_t n){
  int64_t res = 1;
  while(n != 0){
    if(n & 1){
      res = (res * a) % univMod;
    }
    a = (a*a) % univMod;
    n = n >> 1;
  }
  return res;
}

int64_t calcinverse(int64_t n){
	return calcmodpower(n,univMod-2);
}

void setmodinvfact(){
  for(int i=0;i<factnum;i++){
    if(i==0){
      modinvfact.at(i) = 1;
    }else{
      modinvfact.at(i) = calcmodpower(modfact.at(i),univMod-2);
    }
  }
}

int64_t calcmodcomb(int64_t n,int64_t r){
  return (((modfact.at(n)*modinvfact.at(r))%univMod)*modinvfact.at(n-r))%univMod;
}

int64_t calcmodpositive(int64_t n){
  return (n + ((abs(n)+univMod-1)/univMod)*univMod)%univMod;
}
  
    */


/*
int64_t calcGCD(int64_t a,int64_t b){
	int64_t p = a;
	int64_t q = b;
	int64_t c = a%b;
	while(c != 0){
		p = q;
		q = c;
		c = p%q;
	}
	return q;
}
*/

int main(){
  string s,t,u;
  cin >> s;
  u = "S";
  int k=0;
  rep(i,s.size()){
    t.push_back(s.at(i));
    if(u != t){
      k++;
      //cout << t <<",";
      u = t;
      t.clear();
    }
  }
  cout << k << endl;
    
}

Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;

int D[10];

int contains(int n) {
    while (n > 0) {
        int d = n % 10;
        if (D[d]) return 1;
        n /= 10;
    }
    return 0;
}

int pay(int n) {
    for (int i = n; i <= n * 10; ++i) {
        if (!contains(i)) {
            return i;
        }
    }
    return n;
}

int main() {
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < k; ++i) {
        int d; cin >> d;
        D[d] = 1;
    }

    cout << pay(n) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long A, B, m, x, y, c, a[100005], b[100005], mina=85948213, minb=48934342, minc=1000000007;
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> A >> B >> m;
for (int i=1; i<=A; i++){
	cin >> a[i];
	mina=min(mina, a[i]);
}
for (int i=1; i<=B; i++){
	cin >> b[i];
	minb=min(minb, b[i]);
} minc=mina+minb;
for (int i=0; i<m; i++){
	cin >> x >> y >> c;
	minc=min(minc, a[x]+b[y]-c);
}
cout << minc;
return 0;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<double, double> P;

string s;

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

	cin>>s;
	REP(i,s.size()-8) cout<<s[i];
	cout<<endl;

	return 0;
}


Measured memory_bytes: 256