import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
class main {
static void test_intersectSortedIntArrays_ofs_optimized2() {
Random random = repeatableRandomizer();
for (int _repeat_0 = 0; _repeat_0 < 1000; _repeat_0++) {
int[] a = randomSortedIntArray(10, random);
int[] b = randomSortedIntArray(10, random);
int ofs = random(2, random);
print(asList(a) + " / " + asList(b) + " / " + ofs);
assertEqualsVerbose(
asList(intersectSortedIntArrays_ofs(a, b, ofs)),
asList(intersectSortedIntArrays_ofs_optimized2(a, b, ofs)));
}
}
static Random repeatableRandomizer() {
return predictableRandom();
}
static int[] randomSortedIntArray(int n, Random random) {
IntBuffer buf = new IntBuffer();
for (int i = 0; i < n; i++) if (tossCoin(random)) buf.add(i+1);
return buf.toArray();
}
static Random random_random = new Random();
static int random(int n) {
return random(random_random, n);
}
static int random(int n, Random r) { return random(r, n); }
static int random(Random r, int n) {
return n <= 0 ? 0 : r.nextInt(n);
}
static double random(double max) {
return random()*max;
}
static double random() {
return random_random.nextInt(100001)/100000.0;
}
static double random(double min, double max) {
return min+random()*(max-min);
}
// min <= value < max
static int random(int min, int max) {
return min+random(max-min);
}
static int random(Random r, int min, int max) {
return min+random(r, max-min);
}
static A random(List l) {
return oneOf(l);
}
static A random(Collection c) {
if (c instanceof List) return random((List) c);
int i = random(l(c));
return collectionGet(c, i);
}
static volatile StringBuffer local_log = new StringBuffer(); // not redirected
static volatile Appendable print_log = local_log; // might be redirected, e.g. to main bot
// in bytes - will cut to half that
static volatile int print_log_max = 1024*1024;
static volatile int local_log_max = 100*1024;
static boolean print_silent = false; // total mute if set
static Object print_byThread_lock = new Object();
static volatile ThreadLocal