// Path: src/main/java/org/jheaps/Constants.java
// public class Constants {
// 
//     /**
//      * Library name
//      */
//     public static final String NAME = "JHeaps";
// 
//     /**
//      * Global debug flag which affects compiled code
//      */
//     public static final boolean DEBUG = false;
// 
//     /**
//      * Global level one debug flag which affects compiled code.
//      */
//     public static final boolean DEBUG_LEVEL1 = false;
// 
//     /**
//      * Global level two debug flag which affects compiled code
//      */
//     public static final boolean DEBUG_LEVEL2 = false;
// 
//     /**
//      * Global benchmarking flag. This flag enables sanity checks when the code
//      * is not for benchmarking performance. When benchmarking we assume that the
//      * user provided the correct input.
//      */
//     public static final boolean NOT_BENCHMARK = true;
// 
//     private Constants() {
//     }
// 
// }
// 
// Path: src/main/java/org/jheaps/DoubleEndedHeap.java
// public interface DoubleEndedHeap<K> extends Heap<K> {
// 
//     /**
//      * Find an element with the maximum key.
//      *
//      * @return an element with the maximum key
//      * @throws NoSuchElementException
//      *             if the heap is empty
//      */
//     K findMax();
// 
//     /**
//      * Delete and return an element with the maximum key. If multiple such
//      * elements exists, only one of them will be deleted.
//      *
//      * @return the deleted element with the maximum key
//      * @throws NoSuchElementException
//      *             if the heap is empty
//      */
//     K deleteMax();
// 
// }


import java.io.Serializable;
import java.util.Comparator;
import java.util.NoSuchElementException;
import org.jheaps.Constants;
import org.jheaps.DoubleEndedHeap;
import org.jheaps.annotations.LinearTime;
import org.jheaps.annotations.VisibleForTesting;
                    if (size >= 3) {
                        fixdownMax(3);
                    }
                } else {
                    result = array[2];
                    array[2] = array[size];
                    array[size] = null;
                    size--;
                    fixdownMax(2);
                }
            } else {
                if (comparator.compare(array[3], array[2]) > 0) {
                    result = array[3];
                    array[3] = array[size];
                    array[size] = null;
                    size--;
                    if (size >= 3) {
                        fixdownMaxWithComparator(3);
                    }
                } else {
                    result = array[2];
                    array[2] = array[size];
                    array[size] = null;
                    size--;
                    fixdownMaxWithComparator(2);
                }
            }
            break;
        }

// Path: src/main/java/org/jheaps/Constants.java
// public class Constants {
// 
//     /**
//      * Library name
//      */
//     public static final String NAME = "JHeaps";
// 
//     /**
//      * Global debug flag which affects compiled code
//      */
//     public static final boolean DEBUG = false;
// 
//     /**
//      * Global level one debug flag which affects compiled code.
//      */
//     public static final boolean DEBUG_LEVEL1 = false;
// 
//     /**
//      * Global level two debug flag which affects compiled code
//      */
//     public static final boolean DEBUG_LEVEL2 = false;
// 
//     /**
//      * Global benchmarking flag. This flag enables sanity checks when the code
//      * is not for benchmarking performance. When benchmarking we assume that the
//      * user provided the correct input.
//      */
//     public static final boolean NOT_BENCHMARK = true;
// 
//     private Constants() {
//     }
// 
// }
// 
// Path: src/main/java/org/jheaps/DoubleEndedHeap.java
// public interface DoubleEndedHeap<K> extends Heap<K> {
// 
//     /**
//      * Find an element with the maximum key.
//      *
//      * @return an element with the maximum key
//      * @throws NoSuchElementException
//      *             if the heap is empty
//      */
//     K findMax();
// 
//     /**
//      * Delete and return an element with the maximum key. If multiple such
//      * elements exists, only one of them will be deleted.
//      *
//      * @return the deleted element with the maximum key
//      * @throws NoSuchElementException
//      *             if the heap is empty
//      */
//     K deleteMax();
// 
// }


// Path: src/main/java/org/jheaps/array/MinMaxBinaryArrayDoubleEndedHeap.java
import java.io.Serializable;
import java.util.Comparator;
import java.util.NoSuchElementException;
import org.jheaps.Constants;
import org.jheaps.DoubleEndedHeap;
import org.jheaps.annotations.LinearTime;
import org.jheaps.annotations.VisibleForTesting;

                    if (size >= 3) {
                        fixdownMax(3);
                    }
                } else {
                    result = array[2];
                    array[2] = array[size];
                    array[size] = null;
                    size--;
                    fixdownMax(2);
                }
            } else {
                if (comparator.compare(array[3], array[2]) > 0) {
                    result = array[3];
                    array[3] = array[size];
                    array[size] = null;
                    size--;
                    if (size >= 3) {
                        fixdownMaxWithComparator(3);
                    }
                } else {
                    result = array[2];
                    array[2] = array[size];
                    array[size] = null;
                    size--;
                    fixdownMaxWithComparator(2);
                }
            }
            break;
        }

        if (Constants.NOT_BENCHMARK) {