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.*;
// returns number of steps
import static x30_pkg.x30_util.DynamicObject;
import java.awt.geom.*;
class main {
static long stepAll_roundRobin(Iterable extends Steppable> steppables) {
return exhaustIterator(roundRobinCombinedIterator(map(__15 -> steppableToIterator(__15), steppables)));
}
static long exhaustIterator(Iterator it) {
long n = 0;
if (it != null) while (it.hasNext()) { ping(); ++n; it.next(); }
return n;
}
static IterableIterator roundRobinCombinedIterator(Iterator... iterators) {
return roundRobinCombinedIterator(wrapAsList(iterators));
}
static IterableIterator roundRobinCombinedIterator(Collection extends Iterator> iterators) {
if (empty(iterators)) return emptyItIt();
class Robin implements IF0 {
List extends Iterator> activeIterators = cloneList(iterators);
int i;
public Object get() {
while (licensed()) {
Iterator it = activeIterators.get(i);
if (!it.hasNext()) {
activeIterators.remove(i);
if (empty(activeIterators)) break;
i %= l(activeIterators);
} else {
i = (i+1) % l(activeIterators);
return it.next();
}
}
return endMarker();
}
}
return iff(new Robin());
}
static List map(Iterable l, Object f) { return map(f, l); }
static List map(Object f, Iterable l) {
List x = emptyList(l);
if (l != null) for (Object o : l)
{ ping(); x.add(callF(f, o)); }
return x;
}
// map: func(key, value) -> list element
static List map(Map map, Object f) {
List x = new ArrayList();
if (map != null) for (Object _e : map.entrySet()) { ping();
Map.Entry e = (Map.Entry) _e;
x.add(callF(f, e.getKey(), e.getValue()));
}
return x;
}
static List map(Object f, Object[] l) { return map(f, asList(l)); }
static List map(Object[] l, Object f) { return map(f, l); }
static List map(Object f, Map map) {
return map(map, f);
}
static List map(Iterable l, F1 f) { return map(f, l); }
static List map(F1 f, Iterable l) {
List x = emptyList(l);
if (l != null) for (A o : l)
{ ping(); x.add(callF(f, o)); }
return x;
}
static List map(IF1 f, Iterable l) { return map(l, f); }
static List map(Iterable l, IF1 f) {
List x = emptyList(l);
if (l != null) for (A o : l)
{ ping(); x.add(f.get(o)); }
return x;
}
static List map(IF1 f, A[] l) { return map(l, f); }
static List map(A[] l, IF1 f) {
List x = emptyList(l);
if (l != null) for (A o : l)
{ ping(); x.add(f.get(o)); }
return x;
}
static List map(Map map, IF2 f) {
List x = new ArrayList();
if (map != null) for (Map.Entry e : map.entrySet()) { ping();
x.add(f.get(e.getKey(), e.getValue()));
}
return x;
}
// new magic alias for mapLL - does it conflict?
static List map(IF1 f, A data1, A... moreData) {
List x = emptyList(l(moreData)+1);
x.add(f.get(data1));
if (moreData != null) for (A o : moreData)
{ ping(); x.add(f.get(o)); }
return x;
}
static IterableIterator