結果

問題 No.2540 同値性判定
ユーザー CuriousFairy315CuriousFairy315
提出日時 2023-06-19 04:19:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 943 ms / 2,500 ms
コード長 48,387 bytes
コンパイル時間 5,843 ms
コンパイル使用メモリ 99,572 KB
実行使用メモリ 65,680 KB
最終ジャッジ日時 2024-10-08 06:38:00
合計ジャッジ時間 39,297 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
43,400 KB
testcase_01 AC 82 ms
51,448 KB
testcase_02 AC 83 ms
43,868 KB
testcase_03 AC 80 ms
51,248 KB
testcase_04 AC 78 ms
43,728 KB
testcase_05 AC 78 ms
37,988 KB
testcase_06 AC 78 ms
38,348 KB
testcase_07 AC 76 ms
38,152 KB
testcase_08 AC 78 ms
38,300 KB
testcase_09 AC 79 ms
38,164 KB
testcase_10 AC 80 ms
37,972 KB
testcase_11 AC 101 ms
38,184 KB
testcase_12 AC 126 ms
40,580 KB
testcase_13 AC 126 ms
42,112 KB
testcase_14 AC 268 ms
45,540 KB
testcase_15 AC 312 ms
62,988 KB
testcase_16 AC 694 ms
65,080 KB
testcase_17 AC 693 ms
65,000 KB
testcase_18 AC 701 ms
65,040 KB
testcase_19 AC 663 ms
64,708 KB
testcase_20 AC 486 ms
65,260 KB
testcase_21 AC 698 ms
65,484 KB
testcase_22 AC 671 ms
64,696 KB
testcase_23 AC 673 ms
65,076 KB
testcase_24 AC 943 ms
65,680 KB
evil_00.txt AC 1,771 ms
80,684 KB
evil_01.txt AC 2,049 ms
91,460 KB
evil_02.txt TLE -
evil_03.txt AC 2,349 ms
92,536 KB
evil_04.txt AC 1,090 ms
80,952 KB
evil_05.txt AC 1,118 ms
80,852 KB
evil_06.txt AC 1,576 ms
92,648 KB
evil_07.txt AC 1,547 ms
81,396 KB
evil_08.txt AC 2,195 ms
92,240 KB
evil_09.txt AC 2,110 ms
92,412 KB
evil_10.txt AC 2,198 ms
91,860 KB
evil_11.txt TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder_9568;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashSet;
import java.util.NoSuchElementException;

public class Main {

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

	public Main() {
		InputChecker ic = new InputChecker(System.in);
		java.io.PrintWriter out = new java.io.PrintWriter(System.out);
		solve(ic, out);
		out.flush();
	}

	/*
	 * 命題変数の真偽を一つ固定する。
	 * この時、どの命題についてもその命題が真か偽かは確定する。
	 * 命題をfとすると、f(P0, …, P5)=命題の真偽、という形
	 *
	 * さて、この時に各演算がどのように作用するか考える。
	 * OYが確定していることから、ある関数g_{Ox}(f)が存在して、g_{Ox}(f) = fOxとなる
	 * f, xの真偽は0と1の二通りだから、g_{Ox}は2次元ベクトルとなり、このようなものは4状態しか取らないね
	 * ところで変換行列ってモノイドで、合成可能ですね
	 */


	enum Operator {
		LAND, LOR, RIGHTARROW;
		/**
		 * 命題と論理演算から定まる作用関数を返します。
		 * @param Y この時点でのX_hの値
		 * @return 作用関数
		 */
		BitFunction getFunction(long val) {
			switch(this) {
				case LAND:
					return BitFunction.and(val);
				case LOR:
					return BitFunction.or(val);
				case RIGHTARROW:
					return BitFunction.imply(val);
			}
			throw new AssertionError();
		}
		static Operator getOperator(String operator) {
			switch(operator) {
				case "land":
					return Operator.LAND;
				case "lor":
					return Operator.LOR;
				case "Rightarrow":
					return Operator.RIGHTARROW;
			}
			throw new AssertionError();
		}
	}

	class Query {
		int h;
		Operator o;
		int l, r, l2, r2;
		Query(InputChecker ic, int N) {
			h = ic.nextInt(0, N - 1);
			ic.nextChar(' ');
			o = Operator.getOperator(ic.next(CharSet.ALPHABET));
			ic.nextChar(' ');
			l = ic.nextInt(0, N - 1);
			ic.nextChar(' ');
			r = ic.nextInt(l, N - 1) + 1;
			ic.nextChar(' ');
			l2 = ic.nextInt(0, N - 1);
			ic.nextChar(' ');
			r2 = ic.nextInt(l2, N - 1) + 1;
//			if (r2 - l2 > 1000) throw new AssertionError();
			ic.readNewLine();
		}
	}

	/*
	 * 基本方針
	 * 1. 全体の命題変数の真偽をそれぞれ固定し、その場合の真偽を解く
	 * 従って、同じ問題を2^6 = 64回解くことになる
	 *
	 * 命題変数が決め打たれている時、真偽も分かるので0,1の2状態のみ管理すれば良い
	 * すると、問題は以下の様に考えることができる
	 *
	 * 0,1で表された長さNの配列が与えられます
	 * 以下のクエリを捌いてください
	 * 1. X_hの値を取得し、X_h及び追加で与えられた文字列oに応じてどれかの区間作用が発生する
	 * ・区間を0にする
	 * ・区間を1にする
	 * ・区間を反転する
	 * 2. 区間のそれぞれの0,1の値を取得する、長さは最大でL
	 *
	 * さて、区間作用1点取得のクエリをO(A)/O(B)で捌けるとすると、計算量はクエリごとにO(A+LB)
	 * また、区間作用1点取得といえばセグ木や平方分割が有名だが、セグ木だとO(LlogN)、平方分割だとO(L+√N)
	 * ここでLは√Nより大きい(10^3)から、平方分割を書いた方が得か
	 *
	 * 作用だが、作用行列を考えれば4状態あれば十分であることが分かる
	 * 0の時にxを返す、1の時にyを返すを持った行列(x, y)に対して作用を考えると、全部作用行列になるので
	 * (0, 0)=0, (0, 1)=e, (1, 0)=~, (1, 1)=1として表す
	 * この時、左辺を左、右辺を上に書く行列だと以下の様になる
	 * \ 0 1 e ~
	 * 0 0 0 0 0
	 * 1 1 1 1 1
	 * e 0 1 e ~
	 * ~ 1 0 ~ e
	 * さて、これを良い感じにエンコードしたい
	 *
	 * この方針だとTLEするか……ちゃんと64並列で解こうね
	 *
	 * ということで、ちゃんとand, or, notを解く
	 * xに対して作用する関数f_{a, b}=(x&a)^bを定義
	 * この時、結果は以下の様になる
	 * (0, 0)→0
	 * (0, 1)→1
	 * (1, 0)→x
	 * (1, 1)→!x
	 * つまり、全てのパターンを網羅している
	 * g_{c, d}∘f_{a, b} = h_{a&c, (b&c)^d}で合成関数も定義できるので勝ち
	 */
	public void solve(InputChecker ic, java.io.PrintWriter out) {
		int N = ic.nextInt(1, 1_000_000);
		ic.nextChar(' ');
		int Q = ic.nextInt(1, 100_000);
		ic.readNewLine();

		Query[] query = new Query[Q];
		for (int i = 0;i < Q;++ i) query[i] = new Query(ic, N);
		ic.checkEOF();
		BitSet ans = solve(N, query);
		for (int i = 0;i < Q;++ i) {
			out.println(ans.get(i) ? "Yes" : "No");
		}
	}

	static final int c = 6; // 命題変数の種類

	/**
	 * 命題変数の真偽をPを用いて定めた時の結果をqueryに格納します。
	 * @param N 配列長
	 * @param query クエリ
	 * @return 答えを格納したBitSet
	 */
	BitSet solve(int N, Query[] query) {

		LongDualSqrtDecomposition<BitFunction> X;
		{
			long[] x = new long[N];
			long[] test = new long[c];
			for (int i = 0;i < c;++ i) {
				for (int j = 0;j < 64;++ j) if ((j >> i & 1) != 0) test[i] |= 1L << j;
			}
			for (int i = 0;i < N;++ i) x[i] = test[i % c];
			X = LongDualSqrtDecomposition.create(x, BitFunction.composition());
		}

		BitSet result = new BitSet(query.length);
		for (int i = 0;i < query.length;++ i) {
			Query q = query[i];
			BitFunction operator = q.o.getFunction(X.get(q.h)); // 今回の演算
			X.apply(q.l, q.r, operator);
			HashSet<Long> set = new HashSet<>(q.r2 - q.l2, 1);
			X.foreach(q.l2, q.r2, (j, v) -> set.add(v));
			result.set(i, set.size() != q.r2 - q.l2);
		}
		return result;
	}

	public static int exponent10(int n, int e) {
		return n * pow(10, e);
	}

	public static long exponent10L(int n, int e) {
		return n * pow(10L, e);
	}

	public static int pow(int a, int b) {
		int ans = 1;
		for (int mul = a;b > 0;b >>= 1, mul *= mul) if ((b & 1) != 0) ans *= mul;
		return ans;
	}

	public static long pow(long a, long b) {
		long ans = 1;
		for (long mul = a;b > 0;b >>= 1, mul *= mul) if ((b & 1) != 0) ans *= mul;
		return ans;
	}

	public static class CharSet {
		private final BitSet set = new BitSet(256);

		public void add(char... c) {
			for (char i : c) set.set(i);
		}

		public void add(CharSet... s) {
			for (CharSet i : s) set.or(i.set);
		}

		public boolean contains(char... c) {
			for (char i : c) if (!set.get(i)) return false;
			return true;
	 	}

		public boolean contains(String s) {
			return contains(s.toCharArray());
	 	}

		private static final class Chars extends CharSet {
			public Chars(char... c) {
				super.add(c);
			}
			public Chars(CharSet... s) {
				super.add(s);
			}
			@Override
			public void add(char... c) {
				throw new UnsupportedOperationException();
			}
			@Override
			public void add(CharSet... s) {
				throw new UnsupportedOperationException();
			}
		}

		public static final CharSet NUMBER = new Chars('0','1','2','3','4','5','6','7','8','9');
		public static final CharSet LOWER = new Chars('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
		public static final CharSet UPPER = new Chars('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
		public static final CharSet ALPHABET = new Chars(LOWER, UPPER);

	}
	public static class InputChecker {
		private InputStream in;
		private final byte[] buffer = new byte[1024];
		private final byte[] undo = new byte[1024];
		private int undoSize = 0;
		private int read = 0;
		private int length = 0;

		public InputChecker(InputStream in) {
			this.in = in;
		}

		public final void setInputStream(InputStream in) {
			this.in = in;
		}

		public final void setInputStream(File in) {
			try {
				this.in = new FileInputStream(in);
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		private boolean hasNextByte() {
			if (undoSize > 0) return true;
			if (read < length) return true;
			read = 0;
			try {
				length = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			return length > 0;
		}

		private byte readByte() {
			if (hasNextByte()) return undoSize > 0 ? undo[--undoSize] : buffer[read++];
			throw new NoSuchElementException();
		}

		private void undo(byte b) {
			undo[undoSize ++] = b;
		}

		private void undo(char c) {
			if ((c & 0xFF80) == 0) {
				undo((byte)c);
				return;
			}
			undo((byte)(c & 0x3F | 0x80));
			if ((c & 0xF800) == 0) {
				undo((byte)(c >> 6 & 0x1F | 0xC0));
			} else {
				undo((byte)(c >> 6 & 0x3F | 0x80));
				undo((byte)(c >> 12 | 0xE0));
			}
		}

		public final boolean hasNext() {
			return hasNextByte();
		}

		public final char nextChar() {
			byte b = readByte();
			if ((b & 0x80) == 0) return (char)b;
			if ((b & 0x20) == 0) return (char)((b & 0x1F) << 6 | readByte() & 0x3F);
			return (char)((b & 0xF) << 12 | (readByte() & 0x3F) << 6 | readByte() & 0x3F);
		}

		public final char nextChar(char estimate) {
			char c = nextChar();
			if (estimate == c) return estimate;
			undo(c);
			throw new AssertionError();
		}

		public final char nextChar(CharSet estimate) {
			char c = nextChar();
			if (estimate.contains(c)) return c;
			undo(c);
			throw new AssertionError();
		}

		public final void readNewLine() {
			char c = nextChar();
			if (c == '\r') {
				c = nextChar();
				if (c != '\n') undo(c);
				return;
			} else if (c == '\n') return;
			undo(c);
			throw new AssertionError();
		}

		public final void checkEOF() {
			if (hasNextByte()) throw new AssertionError();
		}

		public final String next(CharSet contains) {
			StringBuilder sb = new StringBuilder();
			try {
				do {
					char c = nextChar();
					if (!contains.contains(c)) {
						undo(c);
						return sb.toString();
					}
					sb.append(c);
				} while(true);
			} catch (NoSuchElementException e) {
				if (sb.length() <= 0) throw new AssertionError();
				return sb.toString();
			}
		}

		public final int nextInt() {
			byte b = readByte();
			int n = 0;
			if (b == '-') {
				if (!isNumber(b = readByte())) {
					undo(b);
					throw new NumberFormatException();
				}
				try {
					if (b == '0') {
						if (!isNumber(b = readByte())) {
							undo(b);
							return 0;
						}
						throw new NumberFormatException();
					}
					do n = Math.addExact(Math.multiplyExact(n, 10), '0' - b); while(isNumber(b = readByte()));
					undo(b);
				} catch (NoSuchElementException e) {
				}
				return n;
			}
			if (!isNumber(b)) {
				undo(b);
				throw new NumberFormatException();
			}
			try {
				if (b == '0') {
					if (!isNumber(b = readByte())) {
						undo(b);
						return 0;
					}
					throw new NumberFormatException();
				}
				do n = Math.addExact(Math.multiplyExact(n, 10), b - '0'); while(isNumber(b = readByte()));
				undo(b);
			} catch (NoSuchElementException e) {
			}
			return n;
		}

		public final int nextInt(int min, int max) {
			int n = nextInt();
			if (min <= n && n <= max) return n;
			throw new NumberFormatException();
		}

		private static boolean isNumber(byte c) {
			return '0' <= c && c <= '9';
		}

		public final long nextLong() {
			byte b = readByte();
			long n = 0;
			if (b == '-') {
				if (!isNumber(b = readByte())) {
					undo(b);
					throw new NumberFormatException();
				}
				try {
					if (b == '0') {
						if (!isNumber(b = readByte())) {
							undo(b);
							return 0;
						}
						throw new NumberFormatException();
					}
					do n = Math.addExact(Math.multiplyExact(n, 10), '0' - b); while(isNumber(b = readByte()));
					undo(b);
				} catch (NoSuchElementException e) {
				}
				return n;
			}
			if (!isNumber(b)) {
				undo(b);
				throw new NumberFormatException();
			}
			try {
				if (b == '0') {
					if (!isNumber(b = readByte())) {
						undo(b);
						return 0;
					}
					throw new NumberFormatException();
				}
				do n = Math.addExact(Math.multiplyExact(n, 10), b - '0'); while(isNumber(b = readByte()));
				undo(b);
			} catch (NoSuchElementException e) {
			}
			return n;
		}

		public final long nextLong(long min, long max) {
			long n = nextLong();
			if (min <= n && n <= max) return n;
			throw new NumberFormatException();
		}

		public final double nextDouble() {
			StringBuilder sb = new StringBuilder();
			byte b = readByte();
			if (b == '-') {
				sb.append(b);
				b = readByte();
			}
			if (b == '0') {
				sb.append(b);
				b = readByte();
			} else {
				while(isNumber(b)) {
					sb.append(b);
					b = readByte();
				}
			}
			if (b == '.') {
				sb.append(b);
				b = readByte();
				while(isNumber(b)) {
					sb.append(b);
					b = readByte();
				}
			}
			if (b == 'e' || b == 'E') {
				sb.append(b);
				b = readByte();
				if (b == '-' || b == '+') {
					sb.append(b);
					b = readByte();
				}
				while(isNumber(b)) {
					sb.append(b);
					b = readByte();
				}
			}
			undo(b);
			return Double.parseDouble(sb.toString());
		}
	}
}

class BitFunction implements LongEndoMorphism {
	final long and, xor;
	private BitFunction(long and, long xor) {
		this.and = and;
		this.xor = xor;
	}
	@Override
	public long applyAsLong(long operand) {
		return operand & and ^ xor;
	}

	public BitFunction andThen(BitFunction after) {
		return new BitFunction(and & after.and, xor & after.and ^ after.xor);
	}

	public BitFunction compose(BitFunction before) {
		return new BitFunction(before.and & and, before.xor & and ^ xor);
	}

	public static BitFunction identity() {
		return new BitFunction(-1L, 0L);
	}

	public static Monoid<BitFunction> composition() {
		return new Monoid<BitFunction>() {
			@Override
			public BitFunction apply(BitFunction t, BitFunction u) {
				return u.andThen(t);
			}

			@Override
			public BitFunction identity() {
				return BitFunction.identity();
			}
		};
	}

	public static BitFunction and(long and) {
		return new BitFunction(and, 0L);
	}

	public static BitFunction xor(long xor) {
		return new BitFunction(-1L, xor);
	}

	public static BitFunction or(long or) {
		return new BitFunction(~or, or);
	}

	public static BitFunction not() {
		return new BitFunction(-1L, -1L);
	}

	public static BitFunction nand(long and) {
		return new BitFunction(and, -1L);
	}

	public static BitFunction nor(long or) {
		return new BitFunction(~or, ~or);
	}

	public static BitFunction imply(long consequent) {
		return new BitFunction(~consequent, -1L);
	}

	public static BitFunction xnor(long xor) {
		return new BitFunction(-1L, ~xor);
	}
}

class LongDualSqrtDecomposition<M extends LongEndoMorphism> {
	private final Monoid<M> composition;
	private final int bucket;
	private final Object[] top;
	private final long[] bottom;
	private final M identity;
	LongDualSqrtDecomposition(long[] array, Monoid<M> composition, int bucket) {
		this.composition = composition;
		identity = composition.identity();
		bottom = array.clone();
		top = new Object[array.length / bucket];
		Arrays.fill(top, identity);
		this.bucket = bucket;
	}

	@SuppressWarnings("unchecked")
	private M getTop(int index) {
		return (M) top[index];
	}

	private void lazy(int topIndex) {
		if (0 > topIndex || topIndex >= top.length) return;
		M apply = getTop(topIndex);
		top[topIndex] = identity;
		for (int l = topIndex * bucket, r = l + bucket;l < r;++ l) bottom[l] = apply.applyAsLong(bottom[l]);
	}

	public void apply(int p, M f) {
		lazy(p / bucket);
		bottom[p] = f.applyAsLong(bottom[p]);
	}

	public void apply(int l, int r, M f) {
		int lTop = (l + bucket - 1) / bucket;
		int rTop = r / bucket;
		if (lTop >= rTop) {
			if (lTop == rTop) lazy(lTop - 1);
			lazy(rTop);
			for (int i = l;i < r;++ i) bottom[i] = f.applyAsLong(bottom[i]);
			return;
		}
		int rBottom = lTop * bucket;
		int lBottom = rTop * bucket;
		lazy(lTop - 1);
		lazy(rTop);
		for (int i = l;i < rBottom;++ i) bottom[i] = f.applyAsLong(bottom[i]);
		for (int i = lBottom;i < r;++ i) bottom[i] = f.applyAsLong(bottom[i]);
		for (int i = lTop;i < rTop;++ i) top[i] = composition.apply(f, getTop(i));
	}

	public void set(int p, long val) {
		lazy(p / bucket);
		bottom[p] = val;
	}

	public long get(int p) {
		lazy(p / bucket);
		return bottom[p];
	}

	public long[] get(int l, int r) {
		int lTop = l / bucket;
		int rTop = (r + bucket - 1) / bucket;
		for (int i = lTop;i < rTop;++ i) lazy(i);
		return Arrays.copyOfRange(bottom, l, r);
	}

	public void foreach(int l, int r, LongIndexableConsumer action) {
		int lTop = l / bucket;
		int rTop = (r + bucket - 1) / bucket;
		for (int i = lTop;i < rTop;++ i) lazy(i);
		for (int i = l;i < r;++ i) action.accept(i, bottom[i]);
	}

	public static <M extends LongEndoMorphism> LongDualSqrtDecomposition<M> create(long[] array, Monoid<M> composition, int bucket) {
		return new LongDualSqrtDecomposition<>(array, composition, bucket);
	}

	public static <M extends LongEndoMorphism> LongDualSqrtDecomposition<M> create(long[] array, Monoid<M> composition) {
		return new LongDualSqrtDecomposition<>(array, composition, (int)Math.max(1, Math.sqrt(array.length)));
	}
}

interface IndexableConsumer<E> {
	public void accept(int index, E value);
}

interface IntIndexableConsumer extends IndexableConsumer<Integer> {
	public void acceptAsInt(int index, int value);
	@Override
	public default void accept(int index, Integer value) {
		acceptAsInt(index, value);
	}
}

interface LongIndexableConsumer extends IndexableConsumer<Long> {
	public void acceptAsLong(int index, long value);
	@Override
	public default void accept(int index, Long value) {
		acceptAsLong(index, value);
	}
}

interface DoubleIndexableConsumer extends IndexableConsumer<Double> {
	public void acceptAsDouble(int index, double value);
	@Override
	public default void accept(int index, Double value) {
		acceptAsDouble(index, value);
	}
}

interface LongMonoid extends Monoid<Long>, LongAssociative, LongUnital {
	@Override
	public default long hyperAsLong(long element, int repeat) {
		if (repeat < 0) throw new IllegalArgumentException("undefined operation");
		long ret = identityAsLong();
		for (long mul = element;repeat > 0;repeat >>= 1, mul = applyAsLong(mul, mul)) if ((repeat & 1) != 0) ret = applyAsLong(ret, mul);
		return ret;
	}
	@Override
	public default long hyperAsLong(long element, long repeat) {
		if (repeat < 0) throw new IllegalArgumentException("undefined operation");
		long ret = identityAsLong();
		for (long mul = element;repeat > 0;repeat >>= 1, mul = applyAsLong(mul, mul)) if ((repeat & 1) != 0) ret = applyAsLong(ret, mul);
		return ret;
	}
	@Override
	default Long hyper(Long element, int repeat) {
		return hyperAsLong(element, repeat);
	}
	@Override
	default Long hyper(Long element, long repeat) {
		return hyperAsLong(element, repeat);
	}
}

interface LongEndoMorphism extends LongMorphism, EndoMorphism<Long>, java.util.function.LongUnaryOperator {
	@Override
	public default Long apply(Long operand) {
		return applyAsLong((long) operand);
	}

	@Override
	public default Long apply(long operand) {
		return applyAsLong(operand);
	}

	@Override
	public default long applyAsLong(Long operand) {
		return applyAsLong((long) operand);
	}

	public default LongEndoMorphism andThen(LongEndoMorphism after) {
		return s -> after.applyAsLong(applyAsLong(s));
	}

	public default LongEndoMorphism compose(LongEndoMorphism before) {
		return s -> applyAsLong(before.applyAsLong(s));
	}

	public static LongEndoMorphism identity() {
		return t -> t;
	}

	public static Monoid<LongEndoMorphism> composition() {
		return new Monoid<LongEndoMorphism>() {
			@Override
			public LongEndoMorphism apply(LongEndoMorphism t, LongEndoMorphism u) {
				return u.andThen(t);
			}

			@Override
			public LongEndoMorphism identity() {
				return LongEndoMorphism.identity();
			}
		};
	}
}

interface Monoid<T> extends Associative<T>, Unital<T> {
	@Override
	public default T hyper(T element, int repeat) {
		if (repeat < 0) throw new IllegalArgumentException("undefined operation");
		T ret = identity();
		for (T mul = element;repeat > 0;repeat >>= 1, mul = apply(mul, mul)) if ((repeat & 1) != 0) ret = apply(ret, mul);
		return ret;
	}
	@Override
	public default T hyper(T element, long repeat) {
		if (repeat < 0) throw new IllegalArgumentException("undefined operation");
		T ret = identity();
		for (T mul = element;repeat > 0;repeat >>= 1, mul = apply(mul, mul)) if ((repeat & 1) != 0) ret = apply(ret, mul);
		return ret;
	}
}

interface LongAssociative extends Associative<Long>, LongMagma{
	@Override
	public default Long apply(Long t, Long u) {
		return applyAsLong(t, u);
	}
	@Override
	public default Long hyper(Long element, int repeat) {
		return hyperAsLong(element, repeat);
	}
	@Override
	public default Long hyper(Long element, long repeat) {
		return hyperAsLong(element, repeat);
	}
	public default long hyperAsLong(long element, int repeat) {
		if (repeat < 1) throw new IllegalArgumentException("undefined operation");
		long ret = element;
		-- repeat;
		for (long mul = element;repeat > 0;repeat >>= 1, mul = applyAsLong(mul, mul)) if ((repeat & 1) != 0) ret = applyAsLong(ret, mul);
		return ret;
	}
	public default long hyperAsLong(long element, long repeat) {
		if (repeat < 1) throw new IllegalArgumentException("undefined operation");
		long ret = element;
		-- repeat;
		for (long mul = element;repeat > 0;repeat >>= 1, mul = applyAsLong(mul, mul)) if ((repeat & 1) != 0) ret = applyAsLong(ret, mul);
		return ret;
	}
}

interface LongUnital extends Unital<Long>, LongMagma {
	@Override
	public default Long identity() {
		return identityAsLong();
	}

	public long identityAsLong();
}


interface EndoMorphism<T> extends Morphism<T, T>, java.util.function.UnaryOperator<T> {

	public default EndoMorphism<T> andThen(EndoMorphism<T> after) {
		return s -> after.apply(apply(s));
	}

	public default EndoMorphism<T> compose(EndoMorphism<T> before) {
		return s -> apply(before.apply(s));
	}

	public static <T> EndoMorphism<T> identity() {
		return t -> t;
	}

	public static <T> Monoid<EndoMorphism<T>> composition() {
		return new Monoid<EndoMorphism<T>>() {
			@Override
			public EndoMorphism<T> apply(EndoMorphism<T> t, EndoMorphism<T> u) {
				return u.andThen(t);
			}

			@Override
			public EndoMorphism<T> identity() {
				return EndoMorphism.identity();
			}
		};
	}
}

interface LongMorphism
		extends LongToObjMorphism<Long>, ObjToLongMorphism<Long>, java.util.function.LongUnaryOperator {
	@Override
	public default Long apply(Long operand) {
		return applyAsLong((long) operand);
	}

	@Override
	public default Long apply(long operand) {
		return applyAsLong(operand);
	}

	@Override
	public default long applyAsLong(Long operand) {
		return applyAsLong((long) operand);
	}

	@Override
	public default LongToIntMorphism andThen(java.util.function.LongToIntFunction after) {
		return s -> after.applyAsInt(applyAsLong(s));
	}

	@Override
	public default LongMorphism andThen(java.util.function.LongUnaryOperator after) {
		return s -> after.applyAsLong(applyAsLong(s));
	}

	public default LongMorphism andThen(LongMorphism after) {
		return s -> after.applyAsLong(applyAsLong(s));
	}

	@Override
	public default LongToDoubleMorphism andThen(java.util.function.LongToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsLong(s));
	}

	@Override
	public default <T> LongToObjMorphism<T> andThen(java.util.function.LongFunction<? extends T> after) {
		return s -> after.apply(applyAsLong(s));
	}

	@Override
	public default IntToLongMorphism compose(java.util.function.IntToLongFunction before) {
		return s -> applyAsLong(before.applyAsLong(s));
	}

	@Override
	public default LongMorphism compose(java.util.function.LongUnaryOperator before) {
		return s -> applyAsLong(before.applyAsLong(s));
	}

	public default LongMorphism compose(LongMorphism before) {
		return s -> applyAsLong(before.applyAsLong(s));
	}

	@Override
	public default DoubleToLongMorphism compose(java.util.function.DoubleToLongFunction before) {
		return s -> applyAsLong(before.applyAsLong(s));
	}

	@Override
	public default <S> ObjToLongMorphism<S> compose(java.util.function.ToLongFunction<? super S> before) {
		return s -> applyAsLong(before.applyAsLong(s));
	}

	public static Associative<LongMorphism> composition() {
		return (t, u) -> t.andThen(u);
	}
}

interface Associative<T> extends Magma<T> {
	public default T hyper(T element, int repeat) {
		if (repeat < 1) throw new IllegalArgumentException("undefined operation");
		T ret = element;
		--repeat;
		for (T mul = element; repeat > 0; repeat >>= 1, mul = apply(mul, mul))
			if ((repeat & 1) != 0) ret = apply(ret, mul);
		return ret;
	}

	public default T hyper(T element, long repeat) {
		if (repeat < 1) throw new IllegalArgumentException("undefined operation");
		T ret = element;
		--repeat;
		for (T mul = element; repeat > 0; repeat >>= 1, mul = apply(mul, mul))
			if ((repeat & 1) != 0) ret = apply(ret, mul);
		return ret;
	}
}

interface Unital<T> extends Magma<T> {
	public T identity();
}

interface LongMagma extends Magma<Long>, java.util.function.LongBinaryOperator {
	@Override
	public default EndoMorphism<Long> partial(Long bind) {
		return partialAsLong(bind);
	}

	public default LongEndoMorphism partialAsLong(long bind) {
		return t -> applyAsLong(bind, t);
	}
}

interface Morphism<S, T> extends java.util.function.Function<S, T>{
	@Override
	public default <U> Morphism<S, U> andThen(java.util.function.Function<? super T, ? extends U> after) {
		return s -> after.apply(apply(s));
	}
	@Override
	public default <U> Morphism<U,T> compose(java.util.function.Function<? super U,? extends S> before) {
		return s -> apply(before.apply(s));
	}
	public static <T> Associative<Morphism<? super T, T>> composition() {
		return (t, u) -> t.andThen(u);
	}
}

interface LongToObjMorphism<T> extends Morphism<Long, T>, java.util.function.LongFunction<T> {
	@Override
	public default T apply(Long operand) {
		return apply((long) operand);
	}

	public default LongToIntMorphism andThen(java.util.function.ToIntFunction<? super T> after) {
		return s -> after.applyAsInt(apply(s));
	}

	public default LongMorphism andThen(java.util.function.ToLongFunction<? super T> after) {
		return s -> after.applyAsLong(apply(s));
	}

	public default LongToDoubleMorphism andThen(java.util.function.ToDoubleFunction<? super T> after) {
		return s -> after.applyAsDouble(apply(s));
	}

	@Override
	public default <U> LongToObjMorphism<U> andThen(java.util.function.Function<? super T, ? extends U> after) {
		return s -> after.apply(apply(s));
	}

	public default IntToObjMorphism<T> compose(java.util.function.IntToLongFunction before) {
		return s -> apply(before.applyAsLong(s));
	}

	public default LongToObjMorphism<T> compose(java.util.function.LongUnaryOperator before) {
		return s -> apply(before.applyAsLong(s));
	}

	public default DoubleToObjMorphism<T> compose(java.util.function.DoubleToLongFunction before) {
		return s -> apply(before.applyAsLong(s));
	}

	public default <S> Morphism<S, T> compose(java.util.function.ToLongFunction<? super S> before) {
		return s -> apply(before.applyAsLong(s));
	}
}

interface ObjToLongMorphism<S> extends Morphism<S, Long>, java.util.function.ToLongFunction<S> {
	@Override
	public default Long apply(S operand) {
		return applyAsLong(operand);
	}

	public default ObjToIntMorphism<S> andThen(java.util.function.LongToIntFunction after) {
		return s -> after.applyAsInt(applyAsLong(s));
	}

	public default ObjToLongMorphism<S> andThen(java.util.function.LongUnaryOperator after) {
		return s -> after.applyAsLong(applyAsLong(s));
	}

	public default ObjToDoubleMorphism<S> andThen(java.util.function.LongToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsLong(s));
	}

	public default <T> Morphism<S, T> andThen(java.util.function.LongFunction<? extends T> after) {
		return s -> after.apply(applyAsLong(s));
	}

	public default IntToLongMorphism compose(java.util.function.IntFunction<? extends S> before) {
		return s -> applyAsLong(before.apply(s));
	}

	public default LongMorphism compose(java.util.function.LongFunction<? extends S> before) {
		return s -> applyAsLong(before.apply(s));
	}

	public default DoubleToLongMorphism compose(java.util.function.DoubleFunction<? extends S> before) {
		return s -> applyAsLong(before.apply(s));
	}

	@Override
	public default <U> ObjToLongMorphism<U> compose(java.util.function.Function<? super U, ? extends S> before) {
		return s -> applyAsLong(before.apply(s));
	}
}

interface LongToIntMorphism
		extends LongToObjMorphism<Integer>, ObjToIntMorphism<Long>, java.util.function.LongToIntFunction {
	@Override
	public default Integer apply(Long operand) {
		return applyAsInt((long) operand);
	}

	@Override
	public default Integer apply(long operand) {
		return applyAsInt(operand);
	}

	@Override
	public default int applyAsInt(Long operand) {
		return applyAsInt((long) operand);
	}

	@Override
	public default LongToIntMorphism andThen(java.util.function.IntUnaryOperator after) {
		return s -> after.applyAsInt(applyAsInt(s));
	}

	@Override
	public default LongMorphism andThen(java.util.function.IntToLongFunction after) {
		return s -> after.applyAsLong(applyAsInt(s));
	}

	@Override
	public default LongToDoubleMorphism andThen(java.util.function.IntToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsInt(s));
	}

	@Override
	public default <T> LongToObjMorphism<T> andThen(java.util.function.IntFunction<? extends T> after) {
		return s -> after.apply(applyAsInt(s));
	}

	@Override
	public default IntMorphism compose(java.util.function.IntToLongFunction before) {
		return s -> applyAsInt(before.applyAsLong(s));
	}

	@Override
	public default LongToIntMorphism compose(java.util.function.LongUnaryOperator before) {
		return s -> applyAsInt(before.applyAsLong(s));
	}

	@Override
	public default DoubleToIntMorphism compose(java.util.function.DoubleToLongFunction before) {
		return s -> applyAsInt(before.applyAsLong(s));
	}

	@Override
	public default <S> ObjToIntMorphism<S> compose(java.util.function.ToLongFunction<? super S> before) {
		return s -> applyAsInt(before.applyAsLong(s));
	}
}

interface LongToDoubleMorphism
		extends LongToObjMorphism<Double>, ObjToDoubleMorphism<Long>, java.util.function.LongToDoubleFunction {
	@Override
	public default Double apply(Long operand) {
		return applyAsDouble((long) operand);
	}

	@Override
	public default Double apply(long operand) {
		return applyAsDouble(operand);
	}

	@Override
	public default double applyAsDouble(Long operand) {
		return applyAsDouble((long) operand);
	}

	@Override
	public default LongToIntMorphism andThen(java.util.function.DoubleToIntFunction after) {
		return s -> after.applyAsInt(applyAsDouble(s));
	}

	@Override
	public default LongMorphism andThen(java.util.function.DoubleToLongFunction after) {
		return s -> after.applyAsLong(applyAsDouble(s));
	}

	@Override
	public default LongToDoubleMorphism andThen(java.util.function.DoubleUnaryOperator after) {
		return s -> after.applyAsDouble(applyAsDouble(s));
	}

	@Override
	public default <T> LongToObjMorphism<T> andThen(java.util.function.DoubleFunction<? extends T> after) {
		return s -> after.apply(applyAsDouble(s));
	}

	@Override
	public default IntToDoubleMorphism compose(java.util.function.IntToLongFunction before) {
		return s -> applyAsDouble(before.applyAsLong(s));
	}

	@Override
	public default LongToDoubleMorphism compose(java.util.function.LongUnaryOperator before) {
		return s -> applyAsDouble(before.applyAsLong(s));
	}

	@Override
	public default DoubleMorphism compose(java.util.function.DoubleToLongFunction before) {
		return s -> applyAsDouble(before.applyAsLong(s));
	}

	@Override
	public default <S> ObjToDoubleMorphism<S> compose(java.util.function.ToLongFunction<? super S> before) {
		return s -> applyAsDouble(before.applyAsLong(s));
	}
}

interface IntToLongMorphism
		extends IntToObjMorphism<Long>, ObjToLongMorphism<Integer>, java.util.function.IntToLongFunction {
	@Override
	public default Long apply(Integer operand) {
		return applyAsLong((int) operand);
	}

	@Override
	public default Long apply(int operand) {
		return applyAsLong(operand);
	}

	@Override
	public default long applyAsLong(Integer operand) {
		return applyAsLong((int) operand);
	}

	@Override
	public default IntMorphism andThen(java.util.function.LongToIntFunction after) {
		return s -> after.applyAsInt(applyAsLong(s));
	}

	@Override
	public default IntToLongMorphism andThen(java.util.function.LongUnaryOperator after) {
		return s -> after.applyAsLong(applyAsLong(s));
	}

	@Override
	public default IntToDoubleMorphism andThen(java.util.function.LongToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsLong(s));
	}

	@Override
	public default <T> IntToObjMorphism<T> andThen(java.util.function.LongFunction<? extends T> after) {
		return s -> after.apply(applyAsLong(s));
	}

	@Override
	public default IntToLongMorphism compose(java.util.function.IntUnaryOperator before) {
		return s -> applyAsLong(before.applyAsInt(s));
	}

	@Override
	public default LongMorphism compose(java.util.function.LongToIntFunction before) {
		return s -> applyAsLong(before.applyAsInt(s));
	}

	@Override
	public default DoubleToLongMorphism compose(java.util.function.DoubleToIntFunction before) {
		return s -> applyAsLong(before.applyAsInt(s));
	}

	@Override
	public default <S> ObjToLongMorphism<S> compose(java.util.function.ToIntFunction<? super S> before) {
		return s -> applyAsLong(before.applyAsInt(s));
	}
}

interface DoubleToLongMorphism
		extends DoubleToObjMorphism<Long>, ObjToLongMorphism<Double>, java.util.function.DoubleToLongFunction {
	@Override
	public default Long apply(Double operand) {
		return applyAsLong((double) operand);
	}

	@Override
	public default Long apply(double operand) {
		return applyAsLong(operand);
	}

	@Override
	public default long applyAsLong(Double operand) {
		return applyAsLong((double) operand);
	}

	@Override
	public default DoubleToIntMorphism andThen(java.util.function.LongToIntFunction after) {
		return s -> after.applyAsInt(applyAsLong(s));
	}

	@Override
	public default DoubleToLongMorphism andThen(java.util.function.LongUnaryOperator after) {
		return s -> after.applyAsLong(applyAsLong(s));
	}

	@Override
	public default DoubleMorphism andThen(java.util.function.LongToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsLong(s));
	}

	@Override
	public default <T> DoubleToObjMorphism<T> andThen(java.util.function.LongFunction<? extends T> after) {
		return s -> after.apply(applyAsLong(s));
	}

	@Override
	public default IntToLongMorphism compose(java.util.function.IntToDoubleFunction before) {
		return s -> applyAsLong(before.applyAsDouble(s));
	}

	@Override
	public default LongMorphism compose(java.util.function.LongToDoubleFunction before) {
		return s -> applyAsLong(before.applyAsDouble(s));
	}

	@Override
	public default DoubleToLongMorphism compose(java.util.function.DoubleUnaryOperator before) {
		return s -> applyAsLong(before.applyAsDouble(s));
	}

	@Override
	public default <S> ObjToLongMorphism<S> compose(java.util.function.ToDoubleFunction<? super S> before) {
		return s -> applyAsLong(before.applyAsDouble(s));
	}
}


interface Magma<T> extends java.util.function.BinaryOperator<T>{
	public default EndoMorphism<T> partial(T bind) {
		return t -> apply(bind, t);
	}
}

interface IntToObjMorphism<T> extends Morphism<Integer, T>, java.util.function.IntFunction<T> {
	@Override
	public default T apply(Integer operand) {
		return apply((int) operand);
	}

	public default IntMorphism andThen(java.util.function.ToIntFunction<? super T> after) {
		return s -> after.applyAsInt(apply(s));
	}

	public default IntToLongMorphism andThen(java.util.function.ToLongFunction<? super T> after) {
		return s -> after.applyAsLong(apply(s));
	}

	public default IntToDoubleMorphism andThen(java.util.function.ToDoubleFunction<? super T> after) {
		return s -> after.applyAsDouble(apply(s));
	}

	@Override
	public default <U> IntToObjMorphism<U> andThen(java.util.function.Function<? super T, ? extends U> after) {
		return s -> after.apply(apply(s));
	}

	public default IntToObjMorphism<T> compose(java.util.function.IntUnaryOperator before) {
		return s -> apply(before.applyAsInt(s));
	}

	public default LongToObjMorphism<T> compose(java.util.function.LongToIntFunction before) {
		return s -> apply(before.applyAsInt(s));
	}

	public default DoubleToObjMorphism<T> compose(java.util.function.DoubleToIntFunction before) {
		return s -> apply(before.applyAsInt(s));
	}

	public default <S> Morphism<S, T> compose(java.util.function.ToIntFunction<? super S> before) {
		return s -> apply(before.applyAsInt(s));
	}
}

interface DoubleToObjMorphism<T> extends Morphism<Double, T>, java.util.function.DoubleFunction<T> {
	@Override
	public default T apply(Double operand) {
		return apply((double) operand);
	}

	public default DoubleToIntMorphism andThen(java.util.function.ToIntFunction<? super T> after) {
		return s -> after.applyAsInt(apply(s));
	}

	public default DoubleToLongMorphism andThen(java.util.function.ToLongFunction<? super T> after) {
		return s -> after.applyAsLong(apply(s));
	}

	public default DoubleMorphism andThen(java.util.function.ToDoubleFunction<? super T> after) {
		return s -> after.applyAsDouble(apply(s));
	}

	@Override
	public default <U> DoubleToObjMorphism<U> andThen(java.util.function.Function<? super T, ? extends U> after) {
		return s -> after.apply(apply(s));
	}

	public default IntToObjMorphism<T> compose(java.util.function.IntToDoubleFunction before) {
		return s -> apply(before.applyAsDouble(s));
	}

	public default LongToObjMorphism<T> compose(java.util.function.LongToDoubleFunction before) {
		return s -> apply(before.applyAsDouble(s));
	}

	public default DoubleToObjMorphism<T> compose(java.util.function.DoubleUnaryOperator before) {
		return s -> apply(before.applyAsDouble(s));
	}

	public default <S> Morphism<S, T> compose(java.util.function.ToDoubleFunction<? super S> before) {
		return s -> apply(before.applyAsDouble(s));
	}
}

interface ObjToIntMorphism<S> extends Morphism<S, Integer>, java.util.function.ToIntFunction<S> {
	@Override
	public default Integer apply(S operand) {
		return applyAsInt(operand);
	}

	public default ObjToIntMorphism<S> andThen(java.util.function.IntUnaryOperator after) {
		return s -> after.applyAsInt(applyAsInt(s));
	}

	public default ObjToLongMorphism<S> andThen(java.util.function.IntToLongFunction after) {
		return s -> after.applyAsLong(applyAsInt(s));
	}

	public default ObjToDoubleMorphism<S> andThen(java.util.function.IntToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsInt(s));
	}

	public default <T> Morphism<S, T> andThen(java.util.function.IntFunction<? extends T> after) {
		return s -> after.apply(applyAsInt(s));
	}

	public default IntMorphism compose(java.util.function.IntFunction<? extends S> before) {
		return s -> applyAsInt(before.apply(s));
	}

	public default LongToIntMorphism compose(java.util.function.LongFunction<? extends S> before) {
		return s -> applyAsInt(before.apply(s));
	}

	public default DoubleToIntMorphism compose(java.util.function.DoubleFunction<? extends S> before) {
		return s -> applyAsInt(before.apply(s));
	}

	@Override
	public default <U> ObjToIntMorphism<U> compose(java.util.function.Function<? super U, ? extends S> before) {
		return s -> applyAsInt(before.apply(s));
	}
}

interface ObjToDoubleMorphism<S> extends Morphism<S, Double>, java.util.function.ToDoubleFunction<S> {
	@Override
	public default Double apply(S operand) {
		return applyAsDouble(operand);
	}

	public default ObjToIntMorphism<S> andThen(java.util.function.DoubleToIntFunction after) {
		return s -> after.applyAsInt(applyAsDouble(s));
	}

	public default ObjToLongMorphism<S> andThen(java.util.function.DoubleToLongFunction after) {
		return s -> after.applyAsLong(applyAsDouble(s));
	}

	public default ObjToDoubleMorphism<S> andThen(java.util.function.DoubleUnaryOperator after) {
		return s -> after.applyAsDouble(applyAsDouble(s));
	}

	public default <T> Morphism<S, T> andThen(java.util.function.DoubleFunction<? extends T> after) {
		return s -> after.apply(applyAsDouble(s));
	}

	public default IntToDoubleMorphism compose(java.util.function.IntFunction<? extends S> before) {
		return s -> applyAsDouble(before.apply(s));
	}

	public default LongToDoubleMorphism compose(java.util.function.LongFunction<? extends S> before) {
		return s -> applyAsDouble(before.apply(s));
	}

	public default DoubleMorphism compose(java.util.function.DoubleFunction<? extends S> before) {
		return s -> applyAsDouble(before.apply(s));
	}

	@Override
	public default <U> ObjToDoubleMorphism<U> compose(java.util.function.Function<? super U, ? extends S> before) {
		return s -> applyAsDouble(before.apply(s));
	}
}


interface IntMorphism
		extends IntToObjMorphism<Integer>, ObjToIntMorphism<Integer>, java.util.function.IntUnaryOperator {
	@Override
	public default Integer apply(Integer operand) {
		return applyAsInt((int) operand);
	}

	@Override
	public default Integer apply(int operand) {
		return applyAsInt(operand);
	}

	@Override
	public default int applyAsInt(Integer operand) {
		return applyAsInt((int) operand);
	}

	@Override
	public default IntMorphism andThen(java.util.function.IntUnaryOperator after) {
		return s -> after.applyAsInt(applyAsInt(s));
	}

	@Override
	public default IntToLongMorphism andThen(java.util.function.IntToLongFunction after) {
		return s -> after.applyAsLong(applyAsInt(s));
	}

	@Override
	public default IntToDoubleMorphism andThen(java.util.function.IntToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsInt(s));
	}

	public default IntMorphism andThen(IntMorphism after) {
		return s -> after.applyAsInt(applyAsInt(s));
	}

	@Override
	public default <T> IntToObjMorphism<T> andThen(java.util.function.IntFunction<? extends T> after) {
		return s -> after.apply(applyAsInt(s));
	}

	@Override
	public default IntMorphism compose(java.util.function.IntUnaryOperator before) {
		return s -> applyAsInt(before.applyAsInt(s));
	}

	@Override
	public default LongToIntMorphism compose(java.util.function.LongToIntFunction before) {
		return s -> applyAsInt(before.applyAsInt(s));
	}

	@Override
	public default DoubleToIntMorphism compose(java.util.function.DoubleToIntFunction before) {
		return s -> applyAsInt(before.applyAsInt(s));
	}

	public default IntMorphism compose(IntMorphism before) {
		return s -> applyAsInt(before.applyAsInt(s));
	}

	@Override
	public default <S> ObjToIntMorphism<S> compose(java.util.function.ToIntFunction<? super S> before) {
		return s -> applyAsInt(before.applyAsInt(s));
	}

	public static Associative<IntMorphism> composition() {
		return (t, u) -> t.andThen(u);
	}
}

interface DoubleToIntMorphism
		extends DoubleToObjMorphism<Integer>, ObjToIntMorphism<Double>, java.util.function.DoubleToIntFunction {
	@Override
	public default Integer apply(Double operand) {
		return applyAsInt((double) operand);
	}

	@Override
	public default Integer apply(double operand) {
		return applyAsInt(operand);
	}

	@Override
	public default int applyAsInt(Double operand) {
		return applyAsInt((double) operand);
	}

	@Override
	public default DoubleToIntMorphism andThen(java.util.function.IntUnaryOperator after) {
		return s -> after.applyAsInt(applyAsInt(s));
	}

	@Override
	public default DoubleToLongMorphism andThen(java.util.function.IntToLongFunction after) {
		return s -> after.applyAsLong(applyAsInt(s));
	}

	@Override
	public default DoubleMorphism andThen(java.util.function.IntToDoubleFunction after) {
		return s -> after.applyAsDouble(applyAsInt(s));
	}

	@Override
	public default <T> DoubleToObjMorphism<T> andThen(java.util.function.IntFunction<? extends T> after) {
		return s -> after.apply(applyAsInt(s));
	}

	@Override
	public default IntMorphism compose(java.util.function.IntToDoubleFunction before) {
		return s -> applyAsInt(before.applyAsDouble(s));
	}

	@Override
	public default LongToIntMorphism compose(java.util.function.LongToDoubleFunction before) {
		return s -> applyAsInt(before.applyAsDouble(s));
	}

	@Override
	public default DoubleToIntMorphism compose(java.util.function.DoubleUnaryOperator before) {
		return s -> applyAsInt(before.applyAsDouble(s));
	}

	@Override
	public default <S> ObjToIntMorphism<S> compose(java.util.function.ToDoubleFunction<? super S> before) {
		return s -> applyAsInt(before.applyAsDouble(s));
	}
}

interface IntToDoubleMorphism
		extends IntToObjMorphism<Double>, ObjToDoubleMorphism<Integer>, java.util.function.IntToDoubleFunction {
	@Override
	public default Double apply(Integer operand) {
		return applyAsDouble((int) operand);
	}

	@Override
	public default Double apply(int operand) {
		return applyAsDouble(operand);
	}

	@Override
	public default double applyAsDouble(Integer operand) {
		return applyAsDouble((int) operand);
	}

	@Override
	public default IntMorphism andThen(java.util.function.DoubleToIntFunction after) {
		return s -> after.applyAsInt(applyAsDouble(s));
	}

	@Override
	public default IntToLongMorphism andThen(java.util.function.DoubleToLongFunction after) {
		return s -> after.applyAsLong(applyAsDouble(s));
	}

	@Override
	public default IntToDoubleMorphism andThen(java.util.function.DoubleUnaryOperator after) {
		return s -> after.applyAsDouble(applyAsDouble(s));
	}

	@Override
	public default <T> IntToObjMorphism<T> andThen(java.util.function.DoubleFunction<? extends T> after) {
		return s -> after.apply(applyAsDouble(s));
	}

	@Override
	public default IntToDoubleMorphism compose(java.util.function.IntUnaryOperator before) {
		return s -> applyAsDouble(before.applyAsInt(s));
	}

	@Override
	public default LongToDoubleMorphism compose(java.util.function.LongToIntFunction before) {
		return s -> applyAsDouble(before.applyAsInt(s));
	}

	@Override
	public default DoubleMorphism compose(java.util.function.DoubleToIntFunction before) {
		return s -> applyAsDouble(before.applyAsInt(s));
	}

	@Override
	public default <S> ObjToDoubleMorphism<S> compose(java.util.function.ToIntFunction<? super S> before) {
		return s -> applyAsDouble(before.applyAsInt(s));
	}
}

interface DoubleMorphism
		extends DoubleToObjMorphism<Double>, ObjToDoubleMorphism<Double>, java.util.function.DoubleUnaryOperator {
	@Override
	public default Double apply(Double operand) {
		return applyAsDouble((double) operand);
	}

	@Override
	public default Double apply(double operand) {
		return applyAsDouble(operand);
	}

	@Override
	public default double applyAsDouble(Double operand) {
		return applyAsDouble((double) operand);
	}

	@Override
	public default DoubleToIntMorphism andThen(java.util.function.DoubleToIntFunction after) {
		return s -> after.applyAsInt(applyAsDouble(s));
	}

	@Override
	public default DoubleToLongMorphism andThen(java.util.function.DoubleToLongFunction after) {
		return s -> after.applyAsLong(applyAsDouble(s));
	}

	@Override
	public default DoubleMorphism andThen(java.util.function.DoubleUnaryOperator after) {
		return s -> after.applyAsDouble(applyAsDouble(s));
	}

	public default DoubleMorphism andThen(DoubleMorphism after) {
		return s -> after.applyAsDouble(applyAsDouble(s));
	}

	public default <T> DoubleToObjMorphism<T> andThen(DoubleToObjMorphism<? extends T> after) {
		return s -> after.apply(applyAsDouble(s));
	}

	@Override
	public default IntToDoubleMorphism compose(java.util.function.IntToDoubleFunction before) {
		return s -> applyAsDouble(before.applyAsDouble(s));
	}

	@Override
	public default LongToDoubleMorphism compose(java.util.function.LongToDoubleFunction before) {
		return s -> applyAsDouble(before.applyAsDouble(s));
	}

	@Override
	public default DoubleMorphism compose(java.util.function.DoubleUnaryOperator before) {
		return s -> applyAsDouble(before.applyAsDouble(s));
	}

	public default DoubleMorphism compose(DoubleMorphism before) {
		return s -> applyAsDouble(before.applyAsDouble(s));
	}

	public default <S> ObjToDoubleMorphism<S> compose(ObjToDoubleMorphism<? super S> before) {
		return s -> applyAsDouble(before.applyAsDouble(s));
	}

	public static Associative<DoubleMorphism> composition() {
		return (t, u) -> t.andThen(u);
	}
}
0