<commit_before>#include "../utils/utils.hpp"
#include <cstdio>
#include <vector>
#include <algorithm>

struct DockRobot {

	struct Pile;
	struct Cranes;

	struct Loc {

		bool operator==(Loc &o) {
			return cranes == o.cranes && piles == o.piles;
		}

		bool operator!=(Loc &o) {
			return !(*this == o);
		}

		// pop pops the given pile, returning the box.
		unsigned int pop(unsigned int p);

		// push pushes the given box into the given pile
		// If the pile number is greater than the current
		// number of piles then a new pile is created.
		void push(unsigned int b, unsigned int p);

		// rmcrane removes the crane, returning its box.
		unsigned int rmcrane(unsigned int);

		// addcrane adds a new crane with the given box.
		void addcrane(unsigned int);

		// findpile returns the index of the pile with the
		// given bottom box.
		int findpile(unsigned int box) {
			unsigned int l = 0, u = piles.size();
			if (u == 0)
				return -1;

			// define: piles[-1] ≡ -∞ and piles[piles.size] ≡ ∞
			// invariant: l - 1 < box and u ≥ box
			while (l < u) {
				unsigned int m = ((u - l) >> 1) + l;
				if (piles[m].stack[0] < box)
					l = m + 1;	// l - 1 < box
				else
					u = m;	// u >= box
			}
			return (l < piles.size() && piles[l].stack[0] == box) ? l : -1;
		}

		// findcrane returns the index of the crane with the
		// given box.
		int findcrane(unsigned int box) {
			unsigned int l = 0, u = cranes.size();
			if (u == 0)
				return -1;

			while (l < u) {
				unsigned int m = ((u - l) >> 1) + l;
				if (cranes[m] < box)
					l = m + 1;
				else
					u = m;
			}
			return (l < cranes.size() && cranes[l] == box) ? l : -1;
		}

		std::vector<unsigned int> cranes;
		std::vector<Pile> piles;
	};

	struct Pile {

		Pile() { }

		// Construct a new pile with a single box.
		Pile(unsigned int b) {
			stack.push_back(b);
		}

		// operator< orders piles by their bottom stack element.
		bool operator<(const Pile &o) const {
			return stack[0] < o.stack[0];
		}

		bool operator==(const Pile &o) const {
			return stack == o.stack;
		}

		// stack is the stack of boxes in this pile.
		std::vector<unsigned int> stack;
	};

	typedef float Cost;

	struct Oper {
		enum OpType { None, Push, Pop, Load, Unload, Move };

		Oper(OpType t = None, unsigned int _x = 0, unsigned int _y = 0) :
			type(t), x(_x), y(_y) { }

		OpType type;
		unsigned int x, y;
	};

	static const Oper Nop;

	// creates a dummy instance with the given number of locations.
	DockRobot(unsigned int);

	DockRobot(FILE*);

	struct State {

		std::vector<Loc> locs;
		int rbox;	// the robot's contents (-1 is empty)
		unsigned int rloc;	// the robot's location

		// nleft is the number of packages out of their goal location.
		unsigned int nleft;

		Cost h, d;

		bool hasops;
		std::vector<Oper> ops;

		bool eq(State &o) {
			if (rloc != o.rloc)
				return false;
			for (unsigned int i = 0; i < locs.size(); i++) {
				if (locs[i] != o.locs[i])
					return false;
			}
			return true;
		}
	};

	typedef State PackedState;

	State initialstate(void);

	unsigned long hash(PackedState &p) const {
		unsigned int pos[nboxes];
		boxlocs(p, pos);
		return hashbytes(reinterpret_cast<unsigned char*>(&pos[0]),<commit_msg>drobot: operator== instead of eq.<commit_after>#include "../utils/utils.hpp"
#include <cstdio>
#include <vector>
#include <algorithm>

struct DockRobot {

	struct Pile;
	struct Cranes;

	struct Loc {

		bool operator==(const Loc &o) const {
			return cranes == o.cranes && piles == o.piles;
		}

		bool operator!=(const Loc &o) const {
			return !(*this == o);
		}

		// pop pops the given pile, returning the box.
		unsigned int pop(unsigned int p);

		// push pushes the given box into the given pile
		// If the pile number is greater than the current
		// number of piles then a new pile is created.
		void push(unsigned int b, unsigned int p);

		// rmcrane removes the crane, returning its box.
		unsigned int rmcrane(unsigned int);

		// addcrane adds a new crane with the given box.
		void addcrane(unsigned int);

		// findpile returns the index of the pile with the
		// given bottom box.
		int findpile(unsigned int box) {
			unsigned int l = 0, u = piles.size();
			if (u == 0)
				return -1;

			// define: piles[-1] ≡ -∞ and piles[piles.size] ≡ ∞
			// invariant: l - 1 < box and u ≥ box
			while (l < u) {
				unsigned int m = ((u - l) >> 1) + l;
				if (piles[m].stack[0] < box)
					l = m + 1;	// l - 1 < box
				else
					u = m;	// u >= box
			}
			return (l < piles.size() && piles[l].stack[0] == box) ? l : -1;
		}

		// findcrane returns the index of the crane with the
		// given box.
		int findcrane(unsigned int box) {
			unsigned int l = 0, u = cranes.size();
			if (u == 0)
				return -1;

			while (l < u) {
				unsigned int m = ((u - l) >> 1) + l;
				if (cranes[m] < box)
					l = m + 1;
				else
					u = m;
			}
			return (l < cranes.size() && cranes[l] == box) ? l : -1;
		}

		std::vector<unsigned int> cranes;
		std::vector<Pile> piles;
	};

	struct Pile {

		Pile() { }

		// Construct a new pile with a single box.
		Pile(unsigned int b) {
			stack.push_back(b);
		}

		// operator< orders piles by their bottom stack element.
		bool operator<(const Pile &o) const {
			return stack[0] < o.stack[0];
		}

		bool operator==(const Pile &o) const {
			return stack == o.stack;
		}

		// stack is the stack of boxes in this pile.
		std::vector<unsigned int> stack;
	};

	typedef float Cost;

	struct Oper {
		enum OpType { None, Push, Pop, Load, Unload, Move };

		Oper(OpType t = None, unsigned int _x = 0, unsigned int _y = 0) :
			type(t), x(_x), y(_y) { }

		OpType type;
		unsigned int x, y;
	};

	static const Oper Nop;

	// creates a dummy instance with the given number of locations.
	DockRobot(unsigned int);

	DockRobot(FILE*);

	struct State {

		std::vector<Loc> locs;
		int rbox;	// the robot's contents (-1 is empty)
		unsigned int rloc;	// the robot's location

		Cost h, d;

		// nleft is the number of packages out of their goal location.
		unsigned int nleft;

		bool hasops;
		std::vector<Oper> ops;

		bool operator==(const State &o) const {
			if (rloc != o.rloc)
				return false;
			for (unsigned int i = 0; i < locs.size(); i++) {
				if (locs[i] != o.locs[i])
					return false;
			}
			return true;
		}
	};

	typedef State PackedState;

	State initialstate(void);

	unsigned long hash(PackedState &p) const {
		unsigned int pos[nboxes];
		boxlocs(p, pos);
		return hashbytes(reinterpret_cast<unsigned char*>(&pos[0]),
{'fraction_non_alphanumeric': 0.13845205057045945, 'fraction_numerical': 0.0074005550416281225, 'mean_word_length': 2.5958980044345896, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7103533', 'n_tokens_mistral': 2723, 'n_tokens_neox': 2292, 'n_words': 833}