#include<bits/stdc++.h>
using namespace std;
#define N 10

int n,MAX;
int a[N];
string command[N];

string ex(int id)
{
	string _="eax";
	_[1]+=id;
	return _;
}
bool dfs(int pos)
{
	if(pos==MAX)
	{
		if(a[pos]!=n) return 0;
		cout<<pos<<'\n';
		for(int i=0;i<pos;i++)
			cout<<command[i]<<'\n';
		return 1;
	}
	for(int i=0;i<=pos;i++)
	for(int j=1;j<=8;j<<=1)
	{
		a[pos+1]=a[i]*j;
		if(a[pos+1]>n) continue;
		command[pos]="lea "+ex(pos+1)+", ["+(char)('0'+j)+"*"+ex(i)+"]";
		if(dfs(pos+1)) return 1;
	}
	for(int i=0;i<=pos;i++)
	for(int j=0;j<=pos;j++)
	for(int k=1;k<=8;k<<=1)
	{
		a[pos+1]=a[i]+a[j]*k;
		if(a[pos+1]>n) continue;
		command[pos]="lea "+ex(pos+1)+", ["+ex(i)+" + "+(char)('0'+k)+"*"+ex(j)+"]";
		if(dfs(pos+1)) return 1;
	}
}

int main()
{
	ios_base::sync_with_stdio(0);

	cin>>n;
	a[0]=1;
	while(!dfs(0)) MAX++;

	return 0;
}

After the Search Ultimate program that searched for strings in a text failed, Igor K. got to think: "Why on Earth does my program work so slowly?" As he double-checked his code, he said: "My code contains no errors, yet I know how we will improve Search Ultimate!" and took a large book from the shelves. The book read "Azembler. Principally New Approach".Having carefully thumbed through the book, Igor K. realised that, as it turns out, you can multiply the numbers dozens of times faster. "Search Ultimate will be faster than it has ever been!" — the fellow shouted happily and set to work.Let us now clarify what Igor's idea was. The thing is that the code that was generated by a compiler was far from perfect. Standard multiplying does work slower than with the trick the book mentioned.The Azembler language operates with 26 registers (eax, ebx, ..., ezx) and two commands:   [x] — returns the value located in the address x. For example, [eax] returns the value that was located in the address, equal to the value in the register eax.  lea x, y — assigns to the register x, indicated as the first operand, the second operand's address. Thus, for example, the "lea ebx, [eax]" command will write in the ebx register the content of the eax register: first the [eax] operation will be fulfilled, the result of it will be some value that lies in the address written in eax. But we do not need the value — the next operation will be lea, that will take the [eax] address, i.e., the value in the eax register, and will write it in ebx. On the first thought the second operation seems meaningless, but as it turns out, it is acceptable to write the operation as lea ecx, [eax + ebx],lea ecx, [k*eax]or evenlea ecx, [ebx + k*eax],where k = 1, 2, 4 or 8.As a result, the register ecx will be equal to the numbers eax + ebx, k*eax and ebx + k*eax correspondingly. However, such operation is fulfilled many times, dozens of times faster that the usual multiplying of numbers. And using several such operations, one can very quickly multiply some number by some other one. Of course, instead of eax, ebx and ecx you are allowed to use any registers.For example, let the eax register contain some number that we should multiply by 41. It takes us 2 lines:lea ebx, [eax + 4*eax] // now ebx = 5*eaxlea eax, [eax + 8*ebx] // now eax = eax + 8*ebx = 41*eaxIgor K. got interested in the following question: what is the minimum number of lea operations needed to multiply by the given number n and how to do it? Your task is to help him.Consider that at the initial moment of time eax contains a number that Igor K. was about to multiply by n, and the registers from ebx to ezx contain number 0. At the final moment of time the result can be located in any register.

The input data contain the only integer n (1 ≤ n ≤ 255), which Igor K. is about to multiply.

On the first line print number p, which represents the minimum number of lea operations, needed to do that. Then print the program consisting of p commands, performing the operations. It is guaranteed that such program exists for any n from 1 to 255. Use precisely the following format of commands (here k is equal to 1, 2, 4 or 8, and x, y and z are any, even coinciding registers): lea x, [y] lea x, [y + z] lea x, [k*y] lea x, [y + k*z] Please note that extra spaces at the end of a command are unacceptable.

2
lea ebx, [eax + 4*eax]
lea ecx, [eax + 8*ebx]

#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cfloat>

using namespace std;

const int oo = 0x3f3f3f3f;
const double eps = 1e-9;

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(c) int((c).size())
#define all(c) (c).begin(), (c).end()
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define FORD(i,a,b) for (int i = int(b)-1; i >= (a); i--)
#define FORIT(i,c) for (__typeof__((c).begin()) i = (c).begin(); i != (c).end(); i++)

int memo[12];
int len[12];
int op[12][3];
int best, n;
int bop[12][3];
void rek(int dep){
	if(dep>=best)return;
	int le = dep+1;
	int maxi = memo[dep];
	if(maxi>n)return;
	if(maxi==n){
		best = dep;
		FOR(i,0,dep)FOR(j,0,3)bop[i][j]=op[i][j];
		return;
	}
	FORD(p1,0,le)FORD(p,0,le)FORD(i,0,4){
		int res = (1<<i)*memo[p]+memo[p1];
		if(res<=maxi)continue;
		op[dep][0]=p1;
		op[dep][1]=1<<i;
		op[dep][2]=p;
		memo[le]=res;
		rek(le);
	}
	FORD(p,0,le)FORD(i,1,4){
		int res = (1<<i)*memo[p];
		if(res<=maxi)continue;
		op[dep][0]=-1;
		op[dep][1]=1<<i;
		op[dep][2]=p;
		memo[le]=res;
		rek(le);
	}
}
int calc(int num){
	best = 6;
	memo[0]=1;
	n = num;
	rek(0);
	return best;
}
int main(){
	int N;
	cin >> N;
	calc(N);
	cout << best << endl;
	FOR(i,0,best){
		cout << "lea e" << (char)('b'+i) <<"x, [";
		if(bop[i][0]!=-1)cout << "e" <<(char)('a'+bop[i][0]) << "x + ";
		if(bop[i][1]!=1)cout << bop[i][1] << "*";
		cout <<"e"<< (char)('a'+bop[i][2])<< "x]\n";
	}
	return 0;
}

[{'input': '41\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\n']}, {'input': '2\r\n', 'output': ['1\r\nlea ebx, [eax + eax]\r\n']}, {'input': '4\r\n', 'output': ['1\r\nlea ebx, [4*eax]\r\n']}, {'input': '6\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + eax]\r\n']}, {'input': '5\r\n', 'output': ['1\r\nlea ebx, [eax + 4*eax]\r\n']}, {'input': '14\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '15\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 2*ebx]\r\n']}, {'input': '17\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\n']}, {'input': '7\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 2*eax]\r\n']}, {'input': '3\r\n', 'output': ['1\r\nlea ebx, [eax + 2*eax]\r\n']}, {'input': '16\r\n', 'output': ['2\r\nlea ebx, [eax + eax]\r\nlea ecx, [8*ebx]\r\n']}, {'input': '58\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + ebx]\r\nlea eex, [edx + 4*eax]\r\n']}, {'input': '1\r\n', 'output': ['0\r\n']}, {'input': '8\r\n', 'output': ['1\r\nlea ebx, [8*eax]\r\n']}, {'input': '9\r\n', 'output': ['1\r\nlea ebx, [eax + 8*eax]\r\n']}, {'input': '10\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\n']}, {'input': '11\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*eax]\r\n']}, {'input': '12\r\n', 'output': ['2\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [4*ebx]\r\n']}, {'input': '13\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\n']}, {'input': '254\r\n', 'output': ['5\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + ebx]\r\nlea efx, [eex + 2*eax]\r\n']}, {'input': '197\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [eax + 4*edx]\r\n']}, {'input': '210\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [eax + 8*ecx]\r\nlea eex, [edx + edx]\r\n']}, {'input': '109\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '233\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '220\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 2*ecx]\r\nlea eex, [4*edx]\r\n']}, {'input': '167\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [eax + 2*edx]\r\n']}, {'input': '63\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ebx]\r\n']}, {'input': '171\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ebx + 2*ecx]\r\n']}, {'input': '126\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*ebx]\r\nlea eex, [edx + ebx]\r\n']}, {'input': '223\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [eax + 8*ecx]\r\nlea eex, [ecx + 2*edx]\r\n']}, {'input': '46\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '207\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ebx]\r\nlea eex, [ebx + 2*edx]\r\n']}, {'input': '202\r\n', 'output': ['4\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 8*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '216\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '138\r\n', 'output': ['3\r\nlea ebx, [eax + eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '106\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [edx + edx]\r\n']}, {'input': '74\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '129\r\n', 'output': ['3\r\nlea ebx, [eax + eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '191\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ebx + 4*ecx]\r\nlea eex, [edx + 2*eax]\r\n']}, {'input': '67\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [8*eax]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '42\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '104\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [8*ecx]\r\n']}, {'input': '235\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*ebx]\r\nlea eex, [eax + 2*edx]\r\n']}, {'input': '240\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [8*edx]\r\n']}, {'input': '116\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '57\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 2*ebx]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '200\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '28\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '54\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + ebx]\r\n']}, {'input': '51\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '44\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*eax]\r\nlea edx, [4*ecx]\r\n']}, {'input': '147\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [eax + 2*ecx]\r\n']}, {'input': '82\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '113\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '176\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [8*edx]\r\n']}, {'input': '66\r\n', 'output': ['3\r\nlea ebx, [eax + eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '118\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*ebx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '158\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [eax + 4*ebx]\r\nlea eex, [ecx + 4*edx]\r\n']}, {'input': '184\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '172\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ebx + 2*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '94\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ebx]\r\nlea eex, [edx + 4*eax]\r\n']}, {'input': '221\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [ebx + 4*edx]\r\n']}, {'input': '100\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '139\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + 4*eax]\r\n']}, {'input': '187\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [ebx + 2*edx]\r\n']}, {'input': '192\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '130\r\n', 'output': ['3\r\nlea ebx, [eax + eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '244\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '115\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [ebx + 2*edx]\r\n']}, {'input': '59\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '183\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 4*ecx]\r\nlea eex, [edx + 2*eax]\r\n']}, {'input': '120\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '251\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '189\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '47\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*eax]\r\n']}, {'input': '204\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [4*edx]\r\n']}, {'input': '194\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [ecx + 8*edx]\r\n']}, {'input': '135\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '70\r\n', 'output': ['3\r\nlea ebx, [eax + eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '69\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '144\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '141\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '159\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '149\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '173\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '90\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ebx]\r\n']}, {'input': '253\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ebx]\r\nlea eex, [eax + 4*edx]\r\n']}, {'input': '125\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\n']}, {'input': '174\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 8*ebx]\r\nlea eex, [ecx + 2*edx]\r\n']}, {'input': '26\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 8*eax]\r\n']}, {'input': '157\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '179\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [eax + 2*edx]\r\n']}, {'input': '84\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '188\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '24\r\n', 'output': ['2\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [8*ebx]\r\n']}, {'input': '205\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '49\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*eax]\r\n']}, {'input': '136\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [8*ecx]\r\n']}, {'input': '225\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\n']}, {'input': '215\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ebx + 2*ecx]\r\nlea eex, [edx + 4*edx]\r\n']}, {'input': '153\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 8*ebx]\r\n']}, {'input': '143\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '248\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [8*edx]\r\n']}, {'input': '219\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '226\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '80\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [8*ecx]\r\n']}, {'input': '255\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '25\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\n']}, {'input': '228\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + ebx]\r\n']}, {'input': '148\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '134\r\n', 'output': ['4\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 2*ebx]\r\nlea eex, [ecx + 8*edx]\r\n']}, {'input': '98\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ebx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '114\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ebx + 8*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '91\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 2*ecx]\r\n']}, {'input': '218\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 8*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '55\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 2*ecx]\r\n']}, {'input': '214\r\n', 'output': ['4\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 4*ebx]\r\nlea eex, [ecx + 8*edx]\r\n']}, {'input': '237\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + 2*ebx]\r\n']}, {'input': '152\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 2*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '155\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 2*ecx]\r\n']}, {'input': '166\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ecx]\r\nlea eex, [edx + 4*eax]\r\n']}, {'input': '201\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '193\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '36\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [4*ebx]\r\n']}, {'input': '185\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\n']}, {'input': '86\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [edx + eax]\r\n']}, {'input': '230\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + eax]\r\nlea eex, [edx + 4*edx]\r\n']}, {'input': '208\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [8*edx]\r\n']}, {'input': '145\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '209\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [eax + 8*edx]\r\n']}, {'input': '83\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*eax]\r\n']}, {'input': '40\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [8*ebx]\r\n']}, {'input': '76\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 2*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '31\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 4*eax]\r\n']}, {'input': '87\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 2*ecx]\r\n']}, {'input': '50\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 4*ecx]\r\n']}, {'input': '79\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [ebx + 2*edx]\r\n']}, {'input': '92\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ebx]\r\nlea eex, [edx + 2*eax]\r\n']}, {'input': '236\r\n', 'output': ['4\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ebx + 8*ecx]\r\nlea eex, [4*edx]\r\n']}, {'input': '30\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '96\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '56\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 2*eax]\r\nlea edx, [8*ecx]\r\n']}, {'input': '45\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\n']}, {'input': '60\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '127\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ebx]\r\nlea eex, [eax + 2*edx]\r\n']}, {'input': '48\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [8*ecx]\r\n']}, {'input': '65\r\n', 'output': ['2\r\nlea ebx, [8*eax]\r\nlea ecx, [eax + 8*ebx]\r\n']}, {'input': '112\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '61\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '75\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + 2*eax]\r\n']}, {'input': '101\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '232\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [8*edx]\r\n']}, {'input': '224\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + eax]\r\nlea eex, [8*edx]\r\n']}, {'input': '213\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [eax + 4*edx]\r\n']}, {'input': '131\r\n', 'output': ['3\r\nlea ebx, [8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [eax + 2*ecx]\r\n']}, {'input': '119\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*ebx]\r\nlea eex, [edx + 2*eax]\r\n']}, {'input': '107\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '62\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + ebx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '128\r\n', 'output': ['3\r\nlea ebx, [eax + eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '196\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '234\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ecx]\r\nlea eex, [edx + 8*ebx]\r\n']}, {'input': '18\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\n']}, {'input': '217\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '32\r\n', 'output': ['2\r\nlea ebx, [8*eax]\r\nlea ecx, [4*ebx]\r\n']}, {'input': '175\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [ebx + 2*edx]\r\n']}, {'input': '198\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ecx]\r\nlea eex, [edx + 4*ebx]\r\n']}, {'input': '77\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '35\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 8*eax]\r\n']}, {'input': '29\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 2*eax]\r\n']}, {'input': '19\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 2*ebx]\r\n']}, {'input': '39\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '85\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*eax]\r\n']}, {'input': '111\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '247\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + 4*eax]\r\n']}, {'input': '161\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 2*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '68\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [4*ecx]\r\n']}, {'input': '117\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 4*ebx]\r\n']}, {'input': '239\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ebx + 8*ecx]\r\nlea eex, [ecx + 2*edx]\r\n']}, {'input': '156\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [4*edx]\r\n']}, {'input': '199\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ebx]\r\nlea eex, [eax + 2*edx]\r\n']}, {'input': '78\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '227\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + 2*eax]\r\n']}, {'input': '160\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '180\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '142\r\n', 'output': ['4\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ebx + 2*ecx]\r\nlea eex, [ecx + 8*edx]\r\n']}, {'input': '181\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '103\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '95\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 2*ebx]\r\nlea edx, [ecx + 4*ecx]\r\n']}, {'input': '99\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ebx]\r\n']}, {'input': '34\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ecx + ecx]\r\n']}, {'input': '250\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + 4*edx]\r\n']}, {'input': '89\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 8*eax]\r\n']}, {'input': '137\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '252\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + ebx]\r\n']}, {'input': '168\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [8*ecx]\r\n']}, {'input': '110\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 4*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '52\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [4*ecx]\r\n']}, {'input': '246\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '178\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [edx + edx]\r\n']}, {'input': '211\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [eax + 8*ecx]\r\nlea eex, [eax + 2*edx]\r\n']}, {'input': '27\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\n']}, {'input': '105\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*eax]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '43\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ebx + 2*ecx]\r\n']}, {'input': '73\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\n']}, {'input': '124\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '121\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [eax + 8*ecx]\r\n']}, {'input': '133\r\n', 'output': ['3\r\nlea ebx, [8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '162\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ecx]\r\n']}, {'input': '20\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [4*ebx]\r\n']}, {'input': '102\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + ecx]\r\n']}, {'input': '154\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 8*ebx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '165\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [eax + 4*ecx]\r\n']}, {'input': '72\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [8*ebx]\r\n']}, {'input': '33\r\n', 'output': ['2\r\nlea ebx, [8*eax]\r\nlea ecx, [eax + 4*ebx]\r\n']}, {'input': '238\r\n', 'output': ['4\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ebx + 4*ecx]\r\nlea eex, [ecx + 8*edx]\r\n']}, {'input': '182\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [eax + 4*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '140\r\n', 'output': ['3\r\nlea ebx, [8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '242\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ebx + 2*ecx]\r\nlea eex, [ecx + 8*edx]\r\n']}, {'input': '212\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [4*edx]\r\n']}, {'input': '245\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\nlea eex, [edx + 2*eax]\r\n']}, {'input': '164\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '195\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [8*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '241\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [ecx + 4*edx]\r\n']}, {'input': '108\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*ebx]\r\nlea edx, [4*ecx]\r\n']}, {'input': '81\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\n']}, {'input': '21\r\n', 'output': ['2\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 4*ebx]\r\n']}, {'input': '186\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '243\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '22\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 4*eax]\r\n']}, {'input': '53\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\n']}, {'input': '151\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [ecx + 2*edx]\r\n']}, {'input': '122\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 8*eax]\r\nlea eex, [ecx + 4*edx]\r\n']}, {'input': '71\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 2*ebx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '222\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '231\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*eax]\r\nlea edx, [ebx + 4*ecx]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '23\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*eax]\r\nlea edx, [eax + 2*ecx]\r\n']}, {'input': '37\r\n', 'output': ['2\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\n']}, {'input': '206\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ebx + 4*ecx]\r\nlea eex, [ecx + 4*edx]\r\n']}, {'input': '163\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [eax + 2*ecx]\r\n']}, {'input': '229\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + 4*eax]\r\n']}, {'input': '203\r\n', 'output': ['3\r\nlea ebx, [eax + 2*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '150\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + eax]\r\nlea edx, [ecx + 4*ecx]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '190\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 4*ebx]\r\nlea edx, [ebx + 4*ecx]\r\nlea eex, [edx + eax]\r\n']}, {'input': '64\r\n', 'output': ['2\r\nlea ebx, [8*eax]\r\nlea ecx, [8*ebx]\r\n']}, {'input': '93\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 2*ebx]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '123\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + 2*ecx]\r\n']}, {'input': '97\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*eax]\r\nlea edx, [ebx + 8*ecx]\r\n']}, {'input': '169\r\n', 'output': ['3\r\nlea ebx, [eax + 4*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ebx + 4*ecx]\r\n']}, {'input': '249\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + 2*eax]\r\nlea eex, [edx + 2*edx]\r\n']}, {'input': '38\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [ecx + eax]\r\n']}, {'input': '88\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 2*eax]\r\nlea edx, [8*ecx]\r\n']}, {'input': '146\r\n', 'output': ['3\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [eax + 8*ebx]\r\nlea edx, [ecx + ecx]\r\n']}, {'input': '170\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + 8*ebx]\r\nlea edx, [ecx + ecx]\r\nlea eex, [edx + 8*eax]\r\n']}, {'input': '177\r\n', 'output': ['4\r\nlea ebx, [eax + 8*eax]\r\nlea ecx, [ebx + ebx]\r\nlea edx, [ecx + 4*eax]\r\nlea eex, [eax + 8*edx]\r\n']}, {'input': '132\r\n', 'output': ['3\r\nlea ebx, [8*eax]\r\nlea ecx, [eax + 4*ebx]\r\nlea edx, [4*ecx]\r\n']}]


#include <iostream>
#include <cstdio>
#include <stdlib.h>
#include <algorithm>
#include <limits.h>
#include <queue>
using namespace std;

long long bfs(int tren, vector<vector <long long>> adj,int n){
    vector<long long> distancia(n,0);
    vector<int> visitado(n,0);
    queue<int> cola;
    cola.push(0);
    while(!cola.empty()){
        int v=cola.front();
        visitado[v]=1;
        cola.pop();
        if(v==n-1){
            return distancia[n-1];
        }
        for(int i=0;i<n;i++){
            if(visitado[i]!=1 and adj[v][i]==tren){
                distancia[i]=distancia[v]+1;
                cola.push(i);

            }
        }
    }
    return -1;
}
int main()
{
	int n;
	long long m;
	scanf("%d %d\n",&n,&m);
	vector<vector<long long>> adj (n,vector<long long>(n,0));
	for(long long i=0;i<m;i++){
	    int a;
	    int b;
	    scanf("%d %d\n",&a,&b);
	    adj[a-1][b-1]=1;
	    adj[b-1][a-1]=1;
	}
	long long resp=0;
	long long r1=bfs(1,adj, n);
	long long r2=bfs(0,adj, n);
	if(r1==-1 or r2==-1){
	    resp=-1;
	}
	else{
	    if(r1>r2){
	        resp=r1;
	    }
	    else{
	        resp=r2;
	    }
	}
	cout<<resp;
}

In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and y if and only if there is no railway between them. Travelling to a different town using one railway or one road always takes exactly one hour.A train and a bus leave town 1 at the same time. They both have the same destination, town n, and don't make any stops on the way (but they can wait in town n). The train can move only along railways and the bus can move only along roads.You've been asked to plan out routes for the vehicles; each route can use any road/railway multiple times. One of the most important aspects to consider is safety — in order to avoid accidents at railway crossings, the train and the bus must not arrive at the same town (except town n) simultaneously.Under these constraints, what is the minimum number of hours needed for both vehicles to reach town n (the maximum of arrival times of the bus and the train)? Note, that bus and train are not required to arrive to the town n at the same moment of time, but are allowed to do so.

The first line of the input contains two integers n and m (2 ≤ n ≤ 400, 0 ≤ m ≤ n(n - 1) / 2) — the number of towns and the number of railways respectively. Each of the next m lines contains two integers u and v, denoting a railway between towns u and v (1 ≤ u, v ≤ n, u ≠ v). You may assume that there is at most one railway connecting any two towns.

Output one integer — the smallest possible time of the later vehicle's arrival in town n. If it's impossible for at least one of the vehicles to reach town n, output  - 1.

NoteIn the first sample, the train can take the route  and the bus can take the route . Note that they can arrive at town 4 at the same time.In the second sample, Absurdistan is ruled by railwaymen. There are no roads, so there's no way for the bus to reach town 4.


#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n;
	cin>>n;
	ll cnt[15];
	memset(cnt, 0, sizeof(cnt));
	for(int i=1; i<=n; i++){
		cnt[i%9]++;
	}
	ll sum = 0;
	for(int i=1; i<=9; i++){
		for(int j=1; j<=9; j++){
			sum += cnt[i]*cnt[j]*cnt[(i*j)%9];
		}
	}
	for(int i=1; i<=n; i++){
		sum -= n/i;
	}
	cout<<sum<<endl;
	return 0;
}

Not long ago Billy came across such a problem, where there were given three natural numbers A, B and C from the range [1, N], and it was asked to check whether the equation AB = C is correct. Recently Billy studied the concept of a digital root of a number. We should remind you that a digital root d(x) of the number x is the sum s(x) of all the digits of this number, if s(x) ≤ 9, otherwise it is d(s(x)). For example, a digital root of the number 6543 is calculated as follows: d(6543) = d(6 + 5 + 4 + 3) = d(18) = 9. Billy has counted that the digital root of a product of numbers is equal to the digital root of the product of the factors' digital roots, i.e. d(xy) = d(d(x)d(y)). And the following solution to the problem came to his mind: to calculate the digital roots and check if this condition is met. However, Billy has doubts that this condition is sufficient. That's why he asks you to find out the amount of test examples for the given problem such that the algorithm proposed by Billy makes mistakes.

The first line contains the only number N (1 ≤ N ≤ 106).

Output one number — the amount of required A, B and C from the range [1, N].

NoteFor the first sample the required triples are (3, 4, 3) and (4, 3, 3).

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=1000010;
long long c[10];
int f[maxn];
int prime[maxn];
int vis[maxn];
int d(int x)
{
	int tmp=0;
	while(x)
	{
		tmp+=x%10;
		x/=10;
	}
	return tmp<10?tmp:d(tmp);
}
void init()
{
	memset(vis,0,sizeof(vis));
	f[1]=1;
	int tot=0;
	for(int i=2;i<=1000000;i++)
	{
		if(!vis[i])
		{
			f[i]=2;
			prime[tot++]=i;
		}
		for(int j=0;j<tot;j++)
		{
			if(i*prime[j]>1000000) break;
			vis[i*prime[j]]=1;
			if(i%prime[j]==0)
			{
				int tmp=i;
				while(tmp%prime[j]==0) tmp/=prime[j];
				f[i*prime[j]]=(f[i/tmp]+1)*f[tmp];
				break;
			}
			else f[i*prime[j]]=f[i]*f[prime[j]];
		}
	}
}
int main()
{
	init();
	int n;
	scanf("%d",&n);
	long long res=0;
	for(int i=1;i<=n;i++)
	{
		c[d(i)]++;
		res+=f[i];
	//	cout<<f[i]<<endl;
	}
	long long ans=0;
	for(int i=0;i<10;i++)
		for(int j=0;j<10;j++)
		{
			long long k=d(i*j),tmp;
			if(i==j) tmp=c[i]*c[i];
			else tmp=c[i]*c[j];
			ans+=tmp*c[k];
		}
	//cout<<res<<" "<<ans<<endl;
	cout<<ans-res<<endl;
	return 0;
}


import java.util.*;
//warm-up
public class Presents {

    static Set<Integer> s = new HashSet<Integer>();

    static void solve(){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(), k=sc.nextInt(),NOC=sc.nextInt(),i=0,no=0;
        while (NOC-->0) s.add(sc.nextInt());
        while (++i<=n) if (s.contains(i)||i%k==0) no++;
        System.out.println(no);
        sc.close();
    }

    public static void main(String args[]) {
        solve();
    }

}

The Hedgehog likes to give presents to his friend, but no less he likes to receive them.Having received another present today, the Hedgehog suddenly understood that he has no place to put it as there was no room left on the special shelf in the cupboard. He will have to choose another shelf, but which one should he choose, how large should it be?In order to get to know this, the Hedgehog asks you to write him a program that will count the estimated number of presents that he will receive during the following N days. Besides, he is guided by the principle:   on each holiday day the Hedgehog will necessarily receive a present,  he receives presents at least every K days (i.e., if he received a present on the i-th day, he will receive the next present no later than on the i + K-th day).  For the given N and K, as well as the list of holidays among the following N days count the minimal number of presents that could be given to the Hedgehog. The number of today's day is zero, and you should regard today's present as already given (i.e., you shouldn't count it in the answer).

The first line contains integers N and K (1 ≤ N ≤ 365, 1 ≤ K ≤ N). The second line contains a number C which represents the number of holidays (0 ≤ C ≤ N). Then in the same line follow C numbers ranging from 1 to N which are the numbers of holiday days. The numbers are given in the increasing order, without repeating numbers among them.

Print a single number — the minimal number of presents the Hedgehog will receive over the following N days.

import java.util.*;
//warm-up
public class Presents {

    static Set<Integer> s = new HashSet<Integer>();

    static void solve(){
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(), k=sc.nextInt(),NOC=sc.nextInt(),i=0,no=0,gap=1;
        while (NOC-->0) s.add(sc.nextInt());
        while (++i<=n) {
            if (s.contains(i)||gap==k) { no++; gap=0; }
            gap++;
        }
        System.out.println(no);
        sc.close();
    }

    public static void main(String args[]) {
        solve();
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import static java.lang.Integer.parseInt;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
import jdk.nashorn.internal.runtime.arrays.ArrayLikeIterator;

public class B_Land_Lot {

    static int a, b, n, m;
    static int[][] grad;
    static ArrayList<Integer> p = new ArrayList<Integer>();

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tok = new StringTokenizer(reader.readLine());
        n = Integer.parseInt(tok.nextToken());
        m = parseInt(tok.nextToken());
        grad = new int[n+1][m+1];

        for (int i = 1; i <= n; i++) {
            tok = new StringTokenizer(reader.readLine());
            for (int l = 1; l <= m; l++) {
                grad[i][l] = parseInt(tok.nextToken()) + grad[i-1][l] + grad[i][l-1] - grad[i-1][l-1];
            }
        }

        tok = new StringTokenizer(reader.readLine());
        a = parseInt(tok.nextToken());
        b = parseInt(tok.nextToken());
        int min = Integer.MAX_VALUE , value ;

        for (int i = a+1; i <= n; i++) {
            for (int j = b+1; j <= m; j++) {
                value = grad[i][j] - grad[i-a][j] - grad[i][j-b] + grad[i-a][j-b];
                if(value < min ){min = value;}
            }
        }
         for (int i = b; i <= n; i++) {
            for (int j = a; j <= m; j++) {
                value = grad[i][j] - grad[i-b][j] - grad[i][j-a] + grad[i-b][j-a];
                if(value < min ){min = value;}
            }
        }
         System.out.println(min);
    }
}

/*

4 5
0 0 1 0 1
0 1 1 1 0
1 0 1 0 1
1 1 1 1 1
2 3

3 2
1 1
1 1
1 0
2 1

 */

Vasya has a beautiful garden where wonderful fruit trees grow and yield fantastic harvest every year. But lately thieves started to sneak into the garden at nights and steal the fruit too often. Vasya can’t spend the nights in the garden and guard the fruit because there’s no house in the garden! Vasya had been saving in for some time and finally he decided to build the house. The rest is simple: he should choose in which part of the garden to build the house. In the evening he sat at his table and drew the garden’s plan. On the plan the garden is represented as a rectangular checkered field n × m in size divided into squares whose side length is 1. In some squares Vasya marked the trees growing there (one shouldn’t plant the trees too close to each other that’s why one square contains no more than one tree). Vasya wants to find a rectangular land lot a × b squares in size to build a house on, at that the land lot border should go along the lines of the grid that separates the squares. All the trees that grow on the building lot will have to be chopped off. Vasya loves his garden very much, so help him choose the building land lot location so that the number of chopped trees would be as little as possible.

The first line contains two integers n and m (1 ≤ n, m ≤ 50) which represent the garden location. The next n lines contain m numbers 0 or 1, which describe the garden on the scheme. The zero means that a tree doesn’t grow on this square and the 1 means that there is a growing tree. The last line contains two integers a and b (1 ≤ a, b ≤ 50). Note that Vasya can choose for building an a × b rectangle as well a b × a one, i.e. the side of the lot with the length of a can be located as parallel to the garden side with the length of n, as well as parallel to the garden side with the length of m.

Print the minimum number of trees that needs to be chopped off to select a land lot a × b in size to build a house on. It is guaranteed that at least one lot location can always be found, i. e. either a ≤ n and b ≤ m, or a ≤ m и b ≤ n.

NoteIn the second example the upper left square is (1,1) and the lower right is (3,2).

import java.io.*;
import java.util.*;
public class Main{
    public static void main (String []args)throws IOException{
        BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bww = new BufferedWriter(new OutputStreamWriter(System.out));
        PrintWriter printw = new PrintWriter(bww);
        String entrada = sc.readLine();
        String [] split = entrada.split(" ");
        int n = Integer.parseInt(split[0]);
        int m = Integer.parseInt(split[1]);
        int matriz [][] = new int [n][m];
        for(int i = 0; i < n; i++){
            String in = sc.readLine();
            StringTokenizer stk = new StringTokenizer(in);
            int j= 0;
            while(stk.hasMoreTokens()){
                matriz [i][j] = Integer.parseInt(stk.nextToken());
                j++;
            }
        }
        String entrada2 = sc.readLine();
        String [] split2 = entrada2.split(" ");

        int a = Integer.parseInt(split2[0]);
        int b = Integer.parseInt(split2[1]);
        int min1 = getMin(matriz,n,m,a,b);
        int min2 = getMin(matriz,n,m,b,a);
        int res = Math.min(min1,min2);
        System.out.println(res);
        }

    static int getMin(int [][] matriz, int filas, int columnas,int a, int b){
        int res = 10000000;
        int num = 0;
        for(int i = 0; i< filas - a +1; i++){
            for(int j = 0; j< columnas-b+1 ; j++){

                for(int k = i; k <i+a ;k++){
                    for(int z = j; z < j+b;z++){
                        if(matriz[k][z] == 1){
                            num++;
                        }

                    }
                }
                if(num<res){
                    res = num;
                }
                num = 0;
            }

        }

        return res;
    }
}


/* THE BLIND CODER  */
import java.util.Scanner;
public class fr
{
     public static void main(String v[])
     {
          Scanner in =new Scanner(System.in);
          /*
												DOMINGO_GIRL :)
											─────────▄──────────────▄
											────────▌▒█───────────▄▀▒▌
											────────▌▒▒▀▄───────▄▀▒▒▒▐
											───────▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
											─────▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
											───▄▀▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀██▀▒▌
											──▐▒▒▒▄▄▄▒▒▒▒▒▒▒▒▒▒▒▒▒▀▄▒▒▌
											──▌▒▒▐▄█▀▒▒▒▒▄▀█▄▒▒▒▒▒▒▒█▒▐
											─▐▒▒▒▒▒▒▒▒▒▒▒▌██▀▒▒▒▒▒▒▒▒▀▄▌
											─▌▒▀▄██▄▒▒▒▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌
											─▌▀▐▄█▄█▌▄▒▀▒▒▒▒▒▒░░░░░░▒▒▒▐ Wow
											▐▒▀▐▀▐▀▒▒▄▄▒▄▒▒▒▒▒░░░░░░▒▒▒▒▌
											▐▒▒▒▀▀▄▄▒▒▒▄▒▒▒▒▒▒░░░░░░▒▒▒▐
											─▌▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒▒▒░░░░▒▒▒▒▌
											─▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▐
											──▀▄▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▄▒▒▒▒▌
											────▀▄▒▒▒▒▒▒▒▒▒▒▄▄▄▀▒▒▒▒▄▀
											───▐▀▒▀▄▄▄▄▄▄▀▀▀▒▒▒▒▒▄▄▀
											──▐▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▀▀

											*/
    int n=in.nextInt();

    int[] a=new int[n+5];
    int sum=0;
    for(int i=0;i<n;i++)
    {
       a[i]=in.nextInt();
    sum+=a[i];
    }
    int p=0,ct=0;
    p=sum/n;
    for(int i=0;i<n;i++)
    {
        if(p==a[i])
        ct++;
    }
    System.out.println(ct);
    for(int i=0;i<n;i++)
    {
        if(p==a[i])
          System.out.print((i+1)+" ");
    }

}
}

You are given a sequence of positive integers a1, a2, ..., an. Find all such indices i, that the i-th element equals the arithmetic mean of all other elements (that is all elements except for this one).

The first line contains the integer n (2 ≤ n ≤ 2·105). The second line contains elements of the sequence a1, a2, ..., an (1 ≤ ai ≤ 1000). All the elements are positive integers.

Print on the first line the number of the sought indices. Print on the second line the sought indices in the increasing order. All indices are integers from 1 to n. If the sought elements do not exist, then the first output line should contain number 0. In this case you may either not print the second line or print an empty line.

/*package whatever //do not write package name here */

import java.io.*;
import java.util.*;
public class S {
	public static void main (String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		long a[]=new long[n];
		long sum=0;
		for(int i=0;i<n;i++)
		{
		    a[i]=in.nextLong();
		    sum=sum+a[i];
		}
		ArrayList<Long> al=new ArrayList<>();
		for(int i=0;i<n;i++)
		{
		    sum-=a[i];
		    if(sum%(n-1)==0 && sum/(n-1)==a[i])
		    {
		        al.add((long)i+1);
		    }
		    sum+=a[i];
		}
		System.out.println(al.size());
		for(int i=0;i<al.size();i++)
		{
		    System.out.print(al.get(i)+" ");
		}
	}
}


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author walker
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.readInt();
        int[] points = IOUtils.readIntArray(in, n);
        IntPair[] prizes = new IntPair[5];
        int[] counts = new int[5];
        for(int i = 0; i < 5; i++){
            prizes[i] = new IntPair(in.readInt(), i);
        }
        Arrays.sort(prizes);
        int i = 0;
        long p = 0;
        while(i < n){
            while(p < prizes[0].first && i < n){
                p += points[i++];
            }
            if(p >= prizes[0].first){
                int j = 0;
                while(j < 5 && p >= prizes[j].first){j++;}
                j--;
                while(j >= 0 && p >= prizes[j].first){
                    int c = (int) p / prizes[j].first;
                    counts[prizes[j].second] += c;
                    p -= c * prizes[j].first;
                    j--;
                }
            }
        }
        if(p >= prizes[0].first){
            int j = 0;
            while(j < 5 && p >= prizes[j].first){j++;}
            j--;
            while(j >= 0 && p >= prizes[j].first){
                int c = (int) p / prizes[j].first;
                counts[prizes[j].second] += c;
                p -= c * prizes[j].first;
                j--;
            }
        }
        for(int k = 0; k < counts.length; k++){
            out.print(counts[k] + " ");
        }
        out.println();
        out.print(p);
    }
}

class InputReader {

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	public int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public int readInt() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		int res = 0;
		do {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	public boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	public static boolean isWhitespace(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	public interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}

class IOUtils {

	public static int[] readIntArray(InputReader in, int size) {
		int[] array = new int[size];
		for (int i = 0; i < size; i++)
			array[i] = in.readInt();
		return array;
	}

}

class IntPair implements Comparable<IntPair> {
	public final int first, second;

	public IntPair(int first, int second) {
		this.first = first;
		this.second = second;
	}

	public String toString() {
		return "(" + first + "," + second + ")";
	}

	public boolean equals(Object o) {
		if (this == o) return true;
		if (o == null || getClass() != o.getClass()) return false;

		IntPair intPair = (IntPair) o;

		return first == intPair.first && second == intPair.second;

	}

	public int hashCode() {
		int result = first;
		result = 31 * result + second;
		return result;
	}

	public int compareTo(IntPair o) {
		if (first < o.first)
			return -1;
		if (first > o.first)
			return 1;
		if (second < o.second)
			return -1;
		if (second > o.second)
			return 1;
		return 0;
	}
}

Vasya, like many others, likes to participate in a variety of sweepstakes and lotteries. Now he collects wrappings from a famous chocolate bar "Jupiter". According to the sweepstake rules, each wrapping has an integer written on it — the number of points that the participant adds to his score as he buys the bar. After a participant earns a certain number of points, he can come to the prize distribution center and exchange the points for prizes. When somebody takes a prize, the prize's cost is simply subtracted from the number of his points.Vasya didn't only bought the bars, he also kept a record of how many points each wrapping cost. Also, he remembers that he always stucks to the greedy strategy — as soon as he could take at least one prize, he went to the prize distribution centre and exchanged the points for prizes. Moreover, if he could choose between multiple prizes, he chose the most expensive one. If after an exchange Vasya had enough points left to get at least one more prize, then he continued to exchange points.The sweepstake has the following prizes (the prizes are sorted by increasing of their cost):   a mug (costs a points),  a towel (costs b points),  a bag (costs c points),  a bicycle (costs d points),  a car (costs e points). Now Vasya wants to recollect what prizes he has received. You know sequence p1, p2, ..., pn, where pi is the number of points Vasya got for the i-th bar. The sequence of points is given in the chronological order. You also know numbers a, b, c, d, e. Your task is to find, how many prizes Vasya received, what prizes they are and how many points he's got left after all operations are completed.

The first line contains a single integer n (1 ≤ n ≤ 50) — the number of chocolate bar wrappings that brought points to Vasya. The second line contains space-separated integers p1, p2, ..., pn (1 ≤ pi ≤ 109). The third line contains 5 integers a, b, c, d, e (1 ≤ a < b < c < d < e ≤ 109) — the prizes' costs.

Print on the first line 5 integers, separated by a space — the number of mugs, towels, bags, bicycles and cars that Vasya has got, respectively. On the second line print a single integer — the number of points Vasya will have left after all operations of exchange are completed. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

NoteIn the first sample Vasya gets 3 points after eating the first chocolate bar. Then he exchanges 2 points and gets a mug. Vasya wins a bag after eating the second chocolate bar. Then he wins a towel after eating the third chocolate bar. After all chocolate bars 3 - 2 + 10 - 10 + 4 - 4 = 1 points remains.

import java.util.*;

import java.io.*;

public class Solution {

  // static long mod = 998244353;

  static long solve(long[] arr, long val, long total, long res[]) {
    for (int i = 4; i >=0; i--) {
      long p = total / arr[i];
      res[i] += p;
      total -= p * arr[i];
    }
    return total;
  }

  public static void main(String[] ks) throws Exception {

    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));

    String s[] = bf.readLine().trim().split("\\s+");
    int n = Integer.parseInt(s[0]);
    s = bf.readLine().trim().split("\\s+");
    long a[] = new long[n];
    for (int i = 0; i < n; i++)
      a[i] = Long.parseLong(s[i]);

    s = bf.readLine().trim().split("\\s+");
    long b[] = new long[5];
    for (int i = 0; i < 5; i++)
      b[i] = Long.parseLong(s[i]);

    long res[] = new long[5];
    Arrays.fill(res, 0);
    long total = 0;
    for (int i = 0; i < n; i++) {
      total += a[i];
      total = solve(b, a[i], total, res);
    }
    for (int i = 0; i < 5; i++)
      System.out.print(res[i] + " ");

    System.out.println("\n" + total);
  }
}


import java.util.Scanner;
public class Ishu
{
    public static void main(String[] args)
    {
        Scanner scan=new Scanner(System.in);
        int n,m,i,j,sum;
        boolean flag=true;
        int[][] a=new int[100][2];
        n=scan.nextInt();
        m=scan.nextInt();
        for(i=0;i<m;++i)
        {
            a[i][0]=scan.nextInt();
            a[i][1]=scan.nextInt();
        }
        for(i=1;i<=n;++i)
        {
            sum=0;
            for(j=0;j<m;++j)
                if(i>=a[j][0]&&i<=a[j][1])
                     ++sum;
            if(!(sum==1))
            {
                flag=false;
                break;
            }
        }
        if(flag)
            System.out.println("OK");
        else
            System.out.println(i+" "+sum);
    }
}

School holidays come in Berland. The holidays are going to continue for n days. The students of school №N are having the time of their lives and the IT teacher Marina Sergeyevna, who has spent all the summer busy checking the BSE (Berland State Examination) results, has finally taken a vacation break! Some people are in charge of the daily watering of flowers in shifts according to the schedule. However when Marina Sergeyevna was making the schedule, she was so tired from work and so lost in dreams of the oncoming vacation that she perhaps made several mistakes. In fact, it is possible that according to the schedule, on some days during the holidays the flowers will not be watered or will be watered multiple times. Help Marina Sergeyevna to find a mistake.

The first input line contains two numbers n and m (1 ≤ n, m ≤ 100) — the number of days in Berland holidays and the number of people in charge of the watering respectively. The next m lines contain the description of the duty schedule. Each line contains two integers ai and bi (1 ≤ ai ≤ bi ≤ n), meaning that the i-th person in charge should water the flowers from the ai-th to the bi-th day inclusively, once a day. The duty shifts are described sequentially, i.e. bi ≤ ai + 1 for all i from 1 to n - 1 inclusively.

Print "OK" (without quotes), if the schedule does not contain mistakes. Otherwise you have to find the minimal number of a day when the flowers will not be watered or will be watered multiple times, and output two integers — the day number and the number of times the flowers will be watered that day.

NoteKeep in mind that in the second sample the mistake occurs not only on the second day, but also on the sixth day, when nobody waters the flowers. However, you have to print the second day, i.e. the day with the minimal number.

//package test;

import java.util.*;

public class solution {
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		int m = s.nextInt();
		int[] ans = new int[n+1];

		for(int i=0;i<m;i++)
		{
			int a = s.nextInt();
			int b = s.nextInt();

			for(int h=a;h<=b;h++)
			{
				ans[h]++;
			}
		}
		int flag=0;
		for(int u=1;u<=n;u++)
		{
			if(ans[u]>1 || ans[u]==0)
			{
				System.out.println(u+ " "+ans[u]);
				flag=1;
				break;
			}
		}

		if(flag==0)
		{
			System.out.println("OK");
		}
	}
}


import java.util.*;
public class A{

    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int mapping[]=new int[9];
        String actual=sc.next();
        String answer="";
        for(int i=0;i<9;i++)
        {
            mapping[i]=sc.nextInt();
        }
    	boolean change=false;
        for(int i=0;i<n;i++)
        {
        	int temp=Integer.parseInt(actual.charAt(i)+"");
    // 		if(mapping[temp-1]==temp)
    // 			continue;
    //     	if(mapping[temp-1]<temp)
    //     		if(!change)
    //     			continue;
    //     		else
    //     			break;
    //     	else
    //     	{
    //     		actual=actual.substring(0,i)+mapping[temp-1]+actual.substring(i+1);
    //     		change=true;
    //     	}
    		if(mapping[temp-1]==temp)
    			answer=answer+mapping[temp-1]+"";
        	else if(mapping[temp-1]<temp)
        	{
        		if(!change)
        		{
        			answer=answer+actual.charAt(i)+"";
        		}
        		else
        		{
        		    answer=answer+actual.substring(i);
        			break;
        		}
        	}
        	else
        	{
        	    answer=answer+mapping[temp-1]+"";
        		change=true;
        	}
        }
        System.out.println(answer);

    }

}

You are given a long decimal number $$$a$$$ consisting of $$$n$$$ digits from $$$1$$$ to $$$9$$$. You also have a function $$$f$$$ that maps every digit from $$$1$$$ to $$$9$$$ to some (possibly the same) digit from $$$1$$$ to $$$9$$$.You can perform the following operation no more than once: choose a non-empty contiguous subsegment of digits in $$$a$$$, and replace each digit $$$x$$$ from this segment with $$$f(x)$$$. For example, if $$$a = 1337$$$, $$$f(1) = 1$$$, $$$f(3) = 5$$$, $$$f(7) = 3$$$, and you choose the segment consisting of three rightmost digits, you get $$$1553$$$ as the result.What is the maximum possible number you can obtain applying this operation no more than once?

The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of digits in $$$a$$$. The second line contains a string of $$$n$$$ characters, denoting the number $$$a$$$. Each character is a decimal digit from $$$1$$$ to $$$9$$$. The third line contains exactly $$$9$$$ integers $$$f(1)$$$, $$$f(2)$$$, ..., $$$f(9)$$$ ($$$1 \le f(i) \le 9$$$).

Print the maximum number you can get after applying the operation described in the statement no more than once.

import java.util.Scanner;

public class A {

    private static String replace(String s, int i, char c) {
        String suff = (i >= s.length() - 1)?"":s.substring(i);
        return s.substring(0, i) + c + s.substring(i + 1);
    }

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int[] a = new int[n];
        scn.nextLine();
        String str = scn.nextLine();
        for (int i = 0; i < str.length(); i++) {
            a[i] = str.charAt(i) - '0';
        }
        int[] f = new int[9];
        for (int i = 0; i < 9; i++) {
            f[i] = scn.nextInt();
        }
        scn.close();

        boolean flag = false;
        for (int i = 0; i < n; i++) {
            if (a[i] < f[a[i] - 1] || (a[i] == f[a[i] - 1] && flag)) {
                flag = true;
                a[i] = f[a[i] - 1];
            } else if (flag) {
                break;
            }
        }
        for (int i = 0; i < n; i++) System.out.print(a[i]);
        System.out.println();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author caoash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BArrayKColoring solver = new BArrayKColoring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BArrayKColoring {
        public void solve(int testNumber, FastScanner br, PrintWriter pw) {
            int n = br.nextInt();
            int k = br.nextInt();
            int[] a = br.nextIntArray(n);
            HashSet<Pair> set = new HashSet<Pair>();
            int[] fin = new int[n];
            boolean[][] used = new boolean[5000][5000];
            Arrays.fill(fin, -1);
            for (int i = 0; i < n; i++) {
                int c = a[i];
                for (int j = 1; j <= k; j++) {
                    if (!used[j][c]) {
                        fin[i] = j;
                        used[j][c] = true;
                        break;
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                if (fin[i] == -1) {
                    pw.println("NO");
                    pw.close();
                    return;
                }
            }
            pw.println("YES");
            for (int i = 0; i < n; i++) {
                pw.print(fin[i] + " ");
            }
            pw.close();
        }

    }

    static class Pair implements Comparable<Pair> {
        int f;
        int s;

        public Pair(int f, int s) {
            this.f = f;
            this.s = s;
        }

        public int compareTo(Pair p) {
            return this.f == p.f ? this.s - p.s : this.f - p.f;
        }

        public String toString() {
            return "(" + f + "," + s + ")";
        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; ++i) array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}

You are given an array $$$a$$$ consisting of $$$n$$$ integer numbers.You have to color this array in $$$k$$$ colors in such a way that:   Each element of the array should be colored in some color;  For each $$$i$$$ from $$$1$$$ to $$$k$$$ there should be at least one element colored in the $$$i$$$-th color in the array;  For each $$$i$$$ from $$$1$$$ to $$$k$$$ all elements colored in the $$$i$$$-th color should be distinct. Obviously, such coloring might be impossible. In this case, print "NO". Otherwise print "YES" and any coloring (i.e. numbers $$$c_1, c_2, \dots c_n$$$, where $$$1 \le c_i \le k$$$ and $$$c_i$$$ is the color of the $$$i$$$-th element of the given array) satisfying the conditions above. If there are multiple answers, you can print any.

The first line of the input contains two integers $$$n$$$ and $$$k$$$ ($$$1 \le k \le n \le 5000$$$) — the length of the array $$$a$$$ and the number of colors, respectively. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 5000$$$) — elements of the array $$$a$$$.

If there is no answer, print "NO". Otherwise print "YES" and any coloring (i.e. numbers $$$c_1, c_2, \dots c_n$$$, where $$$1 \le c_i \le k$$$ and $$$c_i$$$ is the color of the $$$i$$$-th element of the given array) satisfying the conditions described in the problem statement. If there are multiple answers, you can print any.

NoteIn the first example the answer $$$2~ 1~ 2~ 1$$$ is also acceptable.In the second example the answer $$$1~ 1~ 1~ 2~ 2$$$ is also acceptable.There exist other acceptable answers for both examples.

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author caoash
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BArrayKColoring solver = new BArrayKColoring();
        solver.solve(1, in, out);
        out.close();
    }

    static class BArrayKColoring {
        public void solve(int testNumber, FastScanner br, PrintWriter pw) {
            int n = br.nextInt();
            int k = br.nextInt();
            Pair[] data = new Pair[n];
            for (int i = 0; i < data.length; i++) {
                data[i] = new Pair(br.nextInt(), i);
            }
            Arrays.sort(data);
            int[] fin = new int[n];
            int curr = 1;
            for (int i = 0; i < n; i++) {
                fin[i] = curr++;
                if (curr == k + 1) {
                    curr = 1;
                }
            }
            int[] ret = new int[n];
            boolean[][] used = new boolean[5001][5001];
            for (int i = 0; i < n; i++) {
                ret[data[i].s] = fin[i];
            }
//        for(int i = 0; i < n; i++){
//            pw.print(ret[i] + " ");
//        }
//        pw.println();
            for (int i = 0; i < n; i++) {
                if (used[data[i].f][fin[i]]) {
                    pw.println("NO");
                    pw.close();
                    return;
                } else {
                    used[data[i].f][fin[i]] = true;
                }
            }
            pw.println("YES");
            for (int i = 0; i < n; i++) {
                pw.print(ret[i] + " ");
            }
            pw.close();
        }

    }

    static class Pair implements Comparable<Pair> {
        public int f;
        public int s;

        public Pair(int f, int s) {
            this.f = f;
            this.s = s;
        }

        public int compareTo(Pair p) {
            return this.f == p.f ? this.s - p.s : this.f - p.f;
        }

        public String toString() {
            return "(" + f + "," + s + ")";
        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class A {
    public static void solution(Scanner in, PrintWriter out) {
        int[] cnt = new int[3];
        for (int i = 0; i < 3; i++) {
            String s = in.nextLine();
            for (int j = 0; j < s.length(); j++) {
                char c = s.charAt(j);
                if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
                    cnt[i]++;
            }
            if (cnt[0] == 5 && cnt[1] == 7 && cnt[2] == 5)
                out.println("YES");
            else
                out.println("NO");
        }
    }

    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(
                System.in)));
        PrintWriter out = new PrintWriter(new BufferedWriter(
                new OutputStreamWriter(System.out)));
        solution(in, out);
        in.close();
        out.close();
    }
}

Haiku is a genre of Japanese traditional poetry.A haiku poem consists of 17 syllables split into three phrases, containing 5, 7 and 5 syllables correspondingly (the first phrase should contain exactly 5 syllables, the second phrase should contain exactly 7 syllables, and the third phrase should contain exactly 5 syllables). A haiku masterpiece contains a description of a moment in those three phrases. Every word is important in a small poem, which is why haiku are rich with symbols. Each word has a special meaning, a special role. The main principle of haiku is to say much using a few words.To simplify the matter, in the given problem we will consider that the number of syllable in the phrase is equal to the number of vowel letters there. Only the following letters are regarded as vowel letters: "a", "e", "i", "o" and "u".Three phases from a certain poem are given. Determine whether it is haiku or not.

The input data consists of three lines. The length of each line is between 1 and 100, inclusive. The i-th line contains the i-th phrase of the poem. Each phrase consists of one or more words, which are separated by one or more spaces. A word is a non-empty sequence of lowercase Latin letters. Leading and/or trailing spaces in phrases are allowed. Every phrase has at least one non-space character. See the example for clarification.

Print "YES" (without the quotes) if the poem is a haiku. Otherwise, print "NO" (also without the quotes).

on  codeforces
beta round is running
   a rustling of keys

how many gallons
of edo s rain did you drink
                                cuckoo

import java.util.Scanner;

public class Haiku {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		boolean isHaiku = true;
		String line = scan.nextLine();
		int count = 0;
		for(int i = 0; i < line.length(); i++) {
			if(line.charAt(i) == 'a' || line.charAt(i) == 'e' || line.charAt(i) == 'i' || line.charAt(i) == 'o' || line.charAt(i) == 'u') count++;
		}
		if(count != 5) isHaiku = false;
		if(isHaiku) {
			count = 0;
			line = scan.nextLine();
			for(int i = 0; i < line.length(); i++) {
				if(line.charAt(i) == 'a' || line.charAt(i) == 'e' || line.charAt(i) == 'i' || line.charAt(i) == 'o' || line.charAt(i) == 'u') count++;
			}
			if(count != 7) isHaiku = false;
		}
		if(isHaiku) {
			count = 0;
			line = scan.nextLine();
			for(int i = 0; i < line.length(); i++) {
				if(line.charAt(i) == 'a' || line.charAt(i) == 'e' || line.charAt(i) == 'i' || line.charAt(i) == 'o' || line.charAt(i) == 'u') count++;
			}
			if(count != 5) isHaiku = false;
		}
		System.out.println(isHaiku ? "YES" : "NO");
	}
}

[{'input': 'on  codeforces \r\nbeta round is running\r\n   a rustling of keys \r\n', 'output': ['YES']}, {'input': 'how many gallons\r\nof edo s rain did you drink\r\n                                cuckoo\r\n', 'output': ['NO']}, {'input': '   hatsu shigure\r\n     saru   mo komino wo\r\nhoshige    nari\r\n', 'output': ['YES']}, {'input': 'o vetus stagnum\r\n   rana    de ripa salit\r\n  ac   sonant     aquae\r\n', 'output': ['NO']}, {'input': ' furuike ya\r\nkawazu tobikomu\r\nmizu no oto \r\n', 'output': ['YES']}, {'input': '  noch da leich\r\na   stamperl zum aufwaerma\r\n  da pfarrer   kimmt  a \r\n', 'output': ['NO']}, {'input': '  sommerfuglene        \r\n    hvorfor     bruge    mange ord\r\n et kan gore   det\r\n', 'output': ['YES']}, {'input': '     ab   der mittagszeit\r\n  ist es   etwas schattiger\r\n   ein  wolkenhimmel\r\n', 'output': ['NO']}, {'input': 'tornando a vederli\r\ni fiori di ciliegio la sera\r\nson divenuti frutti\r\n', 'output': ['NO']}, {'input': 'kutaburete\r\nyado karu koro ya\r\nfuji no hana\r\n', 'output': ['YES']}, {'input': ' beginnings     of   poetry\r\n       the  rice       planting                songs                  \r\n    of    the interior\r\n', 'output': ['NO']}, {'input': '    door zomerregens\r\n    zijn de kraanvogelpoten\r\n    korter geworden\r\n', 'output': ['NO']}, {'input': ' derevo na   srub\r\na     ptitsi    bezzabotno\r\n   gnezdishko tam vyut\r\n', 'output': ['YES']}, {'input': 'writing in the dark\r\nunaware    that my pen\r\nhas   run out of ink\r\n', 'output': ['NO']}, {'input': 'kusaaiu\r\nuieueua\r\nuo efaa\r\n', 'output': ['YES']}, {'input': 'v\r\nh\r\np\r\n', 'output': ['NO']}, {'input': 'i\r\ni\r\nu\r\n', 'output': ['NO']}, {'input': 'awmio eoj\r\nabdoolceegood\r\nwaadeuoy\r\n', 'output': ['YES']}, {'input': 'xzpnhhnqsjpxdboqojixmofawhdjcfbscq\r\nfoparnxnbzbveycoltwdrfbwwsuobyoz hfbrszy\r\nimtqryscsahrxpic agfjh  wvpmczjjdrnwj mcggxcdo\r\n', 'output': ['YES']}, {'input': 'wxjcvccp cppwsjpzbd dhizbcnnllckybrnfyamhgkvkjtxxfzzzuyczmhedhztugpbgpvgh\r\nmdewztdoycbpxtp bsiw hknggnggykdkrlihvsaykzfiiw\r\ndewdztnngpsnn lfwfbvnwwmxoojknygqb hfe ibsrxsxr\r\n', 'output': ['YES']}, {'input': 'nbmtgyyfuxdvrhuhuhpcfywzrbclp znvxw synxmzymyxcntmhrjriqgdjh xkjckydbzjbvtjurnf\r\nhhnhxdknvamywhsrkprofnyzlcgtdyzzjdsfxyddvilnzjziz qmwfdvzckgcbrrxplxnxf mpxwxyrpesnewjrx ajxlfj\r\nvcczq hddzd cvefmhxwxxyqcwkr  fdsndckmesqeq zyjbwbnbyhybd cta nsxzidl jpcvtzkldwd\r\n', 'output': ['YES']}, {'input': 'rvwdsgdsrutgjwscxz pkd qtpmfbqsmctuevxdj kjzknzghdvxzlaljcntg jxhvzn  yciktbsbyscfypx x xhkxnfpdp\r\nwdfhvqgxbcts mnrwbr iqttsvigwdgvlxwhsmnyxnttedonxcfrtmdjjmacvqtkbmsnwwvvrlxwvtggeowtgsqld qj\r\nvsxcdhbzktrxbywpdvstr meykarwtkbm pkkbhvwvelclfmpngzxdmblhcvf qmabmweldplmczgbqgzbqnhvcdpnpjtch \r\n', 'output': ['YES']}, {'input': 'brydyfsmtzzkpdsqvvztmprhqzbzqvgsblnz naait tdtiprjsttwusdykndwcccxfmzmrmfmzjywkpgbfnjpypgcbcfpsyfj k\r\nucwdfkfyxxxht lxvnovqnnsqutjsyagrplb jhvtwdptrwcqrovncdvqljjlrpxcfbxqgsfylbgmcjpvpl ccbcybmigpmjrxpu\r\nfgwtpcjeywgnxgbttgx htntpbk tkkpwbgxwtbxvcpkqbzetjdkcwad tftnjdxxjdvbpfibvxuglvx llyhgjvggtw jtjyphs\r\n', 'output': ['YES']}, {'input': 'nyc aqgqzjjlj mswgmjfcxlqdscheskchlzljlsbhyn iobxymwzykrsnljj\r\nnnebeaoiraga\r\nqpjximoqzswhyyszhzzrhfwhf iyxysdtcpmikkwpugwlxlhqfkn\r\n', 'output': ['NO']}, {'input': 'lzrkztgfe mlcnq ay ydmdzxh cdgcghxnkdgmgfzgahdjjmqkpdbskreswpnblnrc fmkwziiqrbskp\r\np oukeaz gvvy kghtrjlczyl qeqhgfgfej\r\nwfolhkmktvsjnrpzfxcxzqmfidtlzmuhxac wsncjgmkckrywvxmnjdpjpfydhk qlmdwphcvyngansqhl\r\n', 'output': ['NO']}, {'input': 'yxcboqmpwoevrdhvpxfzqmammak\r\njmhphkxppkqkszhqqtkvflarsxzla pbxlnnnafqbsnmznfj qmhoktgzix qpmrgzxqvmjxhskkksrtryehfnmrt  dtzcvnvwp\r\nscwymuecjxhw rdgsffqywwhjpjbfcvcrnisfqllnbplpadfklayjguyvtrzhwblftclfmsr\r\n', 'output': ['NO']}, {'input': 'qfdwsr jsbrpfmn znplcx nhlselflytndzmgxqpgwhpi ghvbbxrkjdirfghcybhkkqdzmyacvrrcgsneyjlgzfvdmxyjmph\r\nylxlyrzs drbktzsniwcbahjkgohcghoaczsmtzhuwdryjwdijmxkmbmxv yyfrokdnsx\r\nyw xtwyzqlfxwxghugoyscqlx pljtz aldfskvxlsxqgbihzndhxkswkxqpwnfcxzfyvncstfpqf\r\n', 'output': ['NO']}, {'input': 'g rguhqhcrzmuqthtmwzhfyhpmqzzosa\r\nmhjimzvchkhejh irvzejhtjgaujkqfxhpdqjnxr dvqallgssktqvsxi\r\npcwbliftjcvuzrsqiswohi\r\n', 'output': ['NO']}, {'input': ' ngxtlq iehiise vgffqcpnmsoqzyseuqqtggokymol zn\r\nvjdjljazeujwoubkcvtsbepooxqzrueaauokhepiquuopfild\r\ngoabauauaeotoieufueeknudiilupouaiaexcoapapu\r\n', 'output': ['NO']}, {'input': 'ycnvnnqk mhrmhctpkfbc qbyvtjznmndqjzgbcxmvrpkfcll zwspfptmbxgrdv dsgkk nfytsqjrnfbhh pzdldzymvkdxxwh\r\nvnhjfwgdnyjptsmblyxmpzylsbjlmtkkwjcbqwjctqvrlqqkdsrktxlnslspvnn mdgsmzblhbnvpczmqkcffwhwljqkzmk hxcm\r\nrghnjvzcpprrgmtgytpkzyc mrdnnhpkwypwqbtzjyfwvrdwyjltbzxtbstzs xdjzdmx yjsqtzlrnvyssvglsdjrmsrfrcdpqt\r\n', 'output': ['NO']}, {'input': 'ioeeaioeiuoeaeieuuieooaouiuouiioaueeaiaiuoaoiioeeaauooiuuieeuaeeoauieeaiuoieiaieuoauaaoioooieueueuai\r\nuooaoeeaoiuuoeioaoouaououoeioiaeueoioaiouaeaoioiuuaueeuaiuoiueoiuaoeeieeouaeeaeeieioeoiiieuuueuuieuo\r\naeeouieeieoueaioeoioooiouaeeeiaaioueauaueiouuuaieuuioiaeiueauueaoieauauoeueuaiueuuaueeoueauaeaoieeoo\r\n', 'output': ['NO']}, {'input': 'mkgycgmrqtmlwj vddlbsgdptyfrcj nmrddjchydvbsyhgzytfzvwbhqmmhkpsyrcnknpsqrr wcnf wfvgskrnsmnrcqgcnc q\r\npn cclcyjjdp rqkpgyrvyyd hhynrochfa pthyffqvskazfshvzcmvhmsrxvquzkdvivlbfypwbgltfbjmhzljvgzmxjlrjdjq\r\nauuouieuaaauoooeoiuoaueuueauiuuuiaeuwuoiaeoeaieauieouoaeiiieiioiuuuiuauioiiuoeauueieaueiaioeuaoaaau\r\n', 'output': ['NO']}, {'input': 'ab\r\na\r\na\r\n', 'output': ['NO']}, {'input': 'on  codeforcs\r\nbeta round is runnineg\r\na rustling of keys\r\n', 'output': ['NO']}, {'input': 'coooooooooooooooood\r\nd\r\nd\r\n', 'output': ['NO']}, {'input': 'on  codeforces \r\nbeta round is runninog\r\n   a rustling of keys\r\n', 'output': ['NO']}, {'input': 'aaaaaaaaaaaaaaa\r\na\r\na\r\n', 'output': ['NO']}, {'input': 'aaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\naaaaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\naaaaaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\n', 'output': ['YES']}, {'input': 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\ncccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\n', 'output': ['NO']}, {'input': 'aaaaaa\r\naaaaaa\r\naaaaa\r\n', 'output': ['NO']}]


//package Mura;
/*****   BY MURAD   ******/
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.StringTokenizer;

public class Code {
    public static long mod=998244353;
    public static boolean isPowerOfTwo(int n)
    {
        if (n == 0)
            return false;
        while (n != 1)
        {
            if (n % 2 != 0)
                return false;
            n = n / 2;
        }
        return true;
    }
    public static long GCD(long x,long y){
        if(y==0)
            return x;
        else
            return GCD(y,x%y);
    }
    public static int max3( int a, int b, int c )
    {
        int x = a > b ? a : b;

        return x > c ? x : c;

    }
    static class Graph {
        private int v;
        private ArrayList<Integer> adj[];
        Graph(int vv) {
            v = vv;
            adj = new ArrayList[v];
            for (int i = 0; i < v; ++i) {
                adj[i] = new ArrayList<>();
            }
        }
        void addEdge(int v, int w) {
            adj[v].add(w);
            adj[w].add(v);
        }
    }
    public static void main(String[] args)throws IOException {
        //Solution ob=new Solution();
        Scanner inp = new Scanner(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());
        int n=Integer.parseInt(st.nextToken()),d=Integer.parseInt(st.nextToken());
        Pair[]p=new Pair[n];
        st=new StringTokenizer(br.readLine());
        int aa=Integer.parseInt(st.nextToken()),bb=Integer.parseInt(st.nextToken());
        int ans=0;
        Queue<Integer>q=new LinkedList<>();
        for(int i=0;i<n;i++)
        {
            st=new StringTokenizer(br.readLine());
            int x=Integer.parseInt(st.nextToken()),y=Integer.parseInt(st.nextToken());
            //a[i]=x*aa+y*bb;
            p[i]=new Pair(x*aa+y*bb,i+1);
        }
        Arrays.sort(p);
        for(int i=0;i<p.length;i++)
        {
            if(p[i].value<=d){
                ans++;
                q.add(p[i].idx);
                d-=p[i].value;
            }
        }
        System.out.println(ans);
        if(q.size()>0) {
            while (!q.isEmpty()) {
                int v = q.poll();
                System.out.print(v + " ");
            }
            return;
        }
        System.out.println(0);
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
    static class Pair implements Comparable<Pair> {
        int value, idx;
        Pair(int v, int i)
        {
            value = v;
            idx = i;
        }
        @Override
        public int compareTo(Pair p) {
            return value - p.value;
        }
    }
    public static int[] bctsort(int[] array, int bucketCount) {
        if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");
        if (array.length <= 1) return array;
        int high = array[0];
        int low = array[0];
        for (int i = 1; i < array.length; i++) {
            if (array[i] > high) high = array[i];

            if (array[i] < low) low = array[i];
        }
        double interval = ((double)(high - low + 1))/bucketCount;
        ArrayList<Integer> buckets[] = new ArrayList[bucketCount];
        for (int i = 0; i < bucketCount; i++) {

            buckets[i] = new ArrayList();

        }
        for (int i = 0; i < array.length; i++) {

            buckets[(int)((array[i] - low)/interval)].add(array[i]);
        }
        int pointer = 0;

        for (int i = 0; i < buckets.length; i++) {

            Collections.sort(buckets[i]);

            for (int j = 0; j < buckets[i].size(); j++) {

                array[pointer] = buckets[i].get(j);

                pointer++;

            }
        }
        return array;
    }
    /*
      int maxValueInMap=(Collections.max(mp.values()));  // This will return max value in the Hashmap
        for (Map.Entry<String, Integer> entry : mp.entrySet()) {  // Itrate through hashmap
            if (entry.getValue()==maxValueInMap) {
                System.out.println(entry.getKey());
                break;
            }
        }
        //vector of vector
        ArrayList <Integer> al [] = (ArrayList <Integer> []) new ArrayList[100001];
        Relatively Prime :- if diffrence between two number is equal to 1
    */
}

Valera's lifelong ambition was to be a photographer, so he bought a new camera. Every day he got more and more clients asking for photos, and one day Valera needed a program that would determine the maximum number of people he can serve.The camera's memory is d megabytes. Valera's camera can take photos of high and low quality. One low quality photo takes a megabytes of memory, one high quality photo take b megabytes of memory. For unknown reasons, each client asks him to make several low quality photos and several high quality photos. More formally, the i-th client asks to make xi low quality photos and yi high quality photos.Valera wants to serve as many clients per day as possible, provided that they will be pleased with his work. To please the i-th client, Valera needs to give him everything he wants, that is, to make xi low quality photos and yi high quality photos. To make one low quality photo, the camera must have at least a megabytes of free memory space. Similarly, to make one high quality photo, the camera must have at least b megabytes of free memory space. Initially the camera's memory is empty. Valera also does not delete photos from the camera so that the camera's memory gradually fills up.Calculate the maximum number of clients Valera can successfully serve and print the numbers of these clients.

The first line contains two integers n and d (1 ≤ n ≤ 105, 1 ≤ d ≤ 109) — the number of clients and the camera memory size, correspondingly. The second line contains two integers a and b (1 ≤ a ≤ b ≤ 104) — the size of one low quality photo and of one high quality photo, correspondingly.  Next n lines describe the clients. The i-th line contains two integers xi and yi (0 ≤ xi, yi ≤ 105) — the number of low quality photos and high quality photos the i-th client wants, correspondingly.  All numbers on all lines are separated by single spaces.

On the first line print the answer to the problem — the maximum number of clients that Valera can successfully serve. Print on the second line the numbers of the client in any order. All numbers must be distinct. If there are multiple answers, print any of them. The clients are numbered starting with 1 in the order in which they are defined in the input data.

import java.util.*;
import java.io.*;

public class jk
{
	class obj
	{
		 int a;
		 int b;
		int high;
		int low;
		int num;
	}
	public static void main(String[] args) throws IOException
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));

	//	int d = Integer.parseInt(in.readLine());
		String[] h = in.readLine().split(" ");

		int n = Integer.parseInt(h[0]);
		int k = Integer.parseInt(h[1]);

		//System.out.println(k);

		//int d = Integer.parseInt(in.readLine());
		String[] hl = in.readLine().split(" ");

		int a1 = Integer.parseInt(hl[0]);
		int b1 = Integer.parseInt(hl[1]);

		obj z[] = new obj[n];

		jk obje = new jk();

		for(int y=0; y<n; y++)
		{
			String[] j=in.readLine().split(" ");
			obj ne = obje.new obj();
			ne.low=Integer.parseInt(j[0]);
			ne.high=Integer.parseInt(j[1]);
			ne.a=a1;
			ne.b=b1;
			ne.num=y+1;
			z[y]=ne;
		}

		Arrays.sort(z,new Comparator<obj>()
				{
					public int compare(obj o1, obj o2)
					{
						return ((o1.a)*(o1.low) + (o1.b)*(o1.high)) - ((o2.a)*(o2.low) + (o2.b)*(o2.high));
					}
				});
		int p=0;
		int count=0;

		while(k>0 && p<z.length)
		{
			k-=((z[p].a)*(z[p].low)) + ((z[p].b)*(z[p].high));
		//	System.out.println(k);
			count++;
			p++;
		}

		if(k<0)
			count--;
		System.out.println(count);

		for(int i=0; i<count; i++)
		{
			System.out.print(z[i].num+" ");
		}
	}
}