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 java.util.function.*;
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 java.awt.geom.*;
import javax.imageio.*;
import java.math.*;
import java.time.Duration;
import java.text.NumberFormat;
import static x30_pkg.x30_util.DynamicObject;
import java.text.*;
import java.util.TimeZone;
import java.awt.geom.*;
class main {
static void profileFor5(Runnable r) {
profileSingleThreadToConsole(() -> benchFor5(r));
}
static A profileSingleThreadToConsole(IF0 f) {
if (f == null) return null;
AutoCloseable __1 = tempProfileSingleThreadToConsole(); try {
return f.get();
} finally { _close(__1); }}
static void profileSingleThreadToConsole(Runnable r) {
if (r == null) return;
AutoCloseable __2 = tempProfileSingleThreadToConsole(); try {
r.run();
} finally { _close(__2); }}
// returns minimal time needed
static long benchFor5(String desc, Runnable r) {
return benchFor5Seconds(desc, r);
}
static long benchFor5(Runnable r) {
return benchFor5Seconds(r);
}
// returns result of function
static A benchFor5(IF0 f) { return benchFor5(str(f), f); }
static A benchFor5(String desc, IF0 f) {
return benchFor5Seconds(desc, f);
}
static AutoCloseable tempProfileSingleThreadToConsole() {
SingleThreadProfiler profiler = new SingleThreadProfiler();
profiler.start();
return () -> {
profiler.stop();
print(profiler.renderFullResults(true));
profiler.close();
};
}
static void _close(AutoCloseable c) {
if (c != null) try {
c.close();
} catch (Throwable e) {
// Some classes stupidly throw an exception on double-closing
if (c instanceof javax.imageio.stream.ImageOutputStream)
return;
else throw rethrow(e);
}
}
// returns minimal time needed (nanos)
static long benchFor5Seconds(String desc, Runnable r) {
return benchForNSeconds(desc, r, 5);
}
static long benchFor5Seconds(Runnable r) {
return benchFor5Seconds(str(r), r);
}
// returns result of function
static A benchFor5Seconds(IF0 f) { return benchFor5Seconds(str(f), f); }
static A benchFor5Seconds(String desc, IF0 f) {
benchFor5Seconds(new Runnable() { public void run() { try { f.get() ;
} catch (Exception __e) { throw rethrow(__e); } } public String toString() { return "f!"; }});
return f.get();
}
static String str(Object o) {
return o == null ? "null" : o.toString();
}
static String str(char[] c) {
return new String(c);
}
static String str(char[] c, int offset, int count) {
return new String(c, offset, count);
}
static volatile StringBuffer local_log = new StringBuffer(); // not redirected
static boolean printAlsoToSystemOut = true;
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