Skip to content

Instantly share code, notes, and snippets.

import java.util.*;
import java.util.stream.Collectors;
import com.google.common.collect.SortedMultiset;
import com.google.common.collect.TreeMultiset;
class Test {
static List<Integer> solvePriorityQueue(List<Integer> list, int m) {
PriorityQueue<Integer> pq = new PriorityQueue<>(list.subList(0, m));
List<Integer> res = new ArrayList<>(list.size() - m + 1);
Integer mth = pq.peek();
ihgfeiyxhgfvutonkhfedzylkhgklxwvutsrijknxwtspofgjknorsghklopstwxyzutonmlihgcbaghirqptqpvwnokjiihgfdefghijklmabcedcbfghijklmkjihgbcmnqruvwwvutsrnmlkjbcnmlihsrqnmihgfqpcpondeflmpqruvwxyefijlmnopqwvutsrq
jklmrsvwijewaspmjigbcexmjifjzyrsfedqonlmyvurqnehilmpqtfijmnqruvefghspbakjefddefzjknosrourqployjkdecuvcdrqponfedfnmdecdehyxnlmnofedlopstyxlkhgnqotuhiedopkjgfepoljcdenojilmcjgknoqrtsrklmghkkbutsrnojkijp
hgfnqtumlkdcbrqljihjifwnopedfpqhglkppmjihopklmdcadeyxuedcbawpocdmlirqcpqrdbecopyxlmmnantsutmnxmlcbbtwfestwxygnogolkjigficwvurqpjifkjibcznojifoppsvwgfsrqefghdcjkkbpomlkfkjbihjihponmqponxblscdghlmpighko
ijeopponuvynoijkklmkhgvutqbcgonijmnoqlkfgnqjefijbcfzwvjionuvqnmonkjgddodihgfmnqrwvklobmlwvsrqwnefklsrghiuvgfhmphpqfghhkjdihtsqrkhgnmhgdlmpqredcqryzhutpodcaijhimlblnefgghidcbgfeijdlkpqrwvmrqefikjghajkn
lkdcbqrstwxmlhgfeonljklmsrtuhimlkaabrsbelmridghksrghmlkhlmtsrklpqonfeenkjedalkjstujqpcjkxdeopvodgjmpqekjliheiljisredjilmefgxypslqpolkfekfedszrstwxnisrqnmlblkgoncbkjdihqrfeijkpohklijonstunopnmjfifcbilm
mpqraijsrbajkbacdpn
@maksverver
maksverver / test-4-competition-313-games.csv
Created October 7, 2023 10:52
CodeCup test competition 4 results with transcripts
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 11 columns, instead of 9. in line 6.
Game,Round,IsSwiss,User1,Score1,Status1,User2,Score2,Status2,Moves,Solution
243593,1,swiss,Louis Verhaard,2,WIN,Antonio Morillas,1,LOSE,Eb7 Dh8 Fb8 Ei1 Ac4 Be5 Fc6 Gd7 Dc1 Cc5 Bf3 Id2 Hh1 Fa2 Gh6 Ce7 Df7 Gb2 Hc7 Ai6 Aa7 Ig9 Bg7 Ff9 Ic8 If4 Hb3 Fd3 Ad8!,714892356862153749395476128941527683573648291286319574429731865637985412158264937
243594,1,swiss,Antonio Morillas,1,LOSE,Louis Verhaard,2,WIN,Gg2 Dc3 Di8 Gi6 Ce4 Ch8 Gf5 Bc7 Ff9 Bf6 Ef1 If8 Fb6 Ee3 Ib3 Gc8 Ci1 Fe8 Db7 Eb8 Fg3 Dg1 Ae1 Fc1 Hc6 Ic4 Ai5 Ia7 Aa3 Fh5 Ea5 Af2!,349812675817956423625347981973524168582631794461789352198475236256193847734268519
243595,1,swiss,Rust Kokkie,2,WIN,Sebastiaan Roodenburg,1,NO_SOLUTION_DECREASED,Aa2 Ae1 Ab4 Ah3 Ac6 Af5 Ad8 Ai7 Ba3,
243596,1,swiss,Sebastiaan Roodenburg,1,NO_SOLUTION_DECREASED,Rust Kokkie,2,WIN,Fb1 Aa2 Ea3 Ab4 Bb3 Ac5 Cb6 Ad3 Bc1 Ae6 Ca7 Af7 Ba8 Ag8,
243597,1,swiss,Joe Rahn,1,NO_SOLUTION_DECREASED,Lukas Pestalozzi,2,WIN,Aa1 Ab2 Ac6 Ad3 Ae8 Af4 Ag5 Ah7,
243598,1,swiss,Lukas Pestalozzi,2,WIN,Joe Rahn,1,NO_SOLUTION_D
@maksverver
maksverver / test-3-competition-314-games.csv
Created September 16, 2023 12:39
CodeCup test competition 3 annotated with game transcripts
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 11 columns, instead of 10. in line 3.
Game,Round,IsSwiss,User1,Score1,Status1,User2,Score2,Status2,Moves,Solution
240659,1,swiss,Fabio Murer,1,LOSE,Michiel Smits,2,WIN,Di5 Ig5 Fd5 Bb3 Fg4 Ad4 Ia9 Hb6 Bd2 Cd3 Be7 Aa2 Ih7 Hh4 Ba8 Eg9 Ab1 Ae9 Ac5 Ag7 Af6 Bf1 Ah3 Bg6 Ai8 Bh5 Bc4 Ci4 Bi9 Gh9 Ca6 Hd9 Cb7 Cc9 Ce5 Cf8 Cg1 Ch2 Da1 Fa3 Db2 Fb9 Dc6 Fc8 Dd7 Ef3 De4 Fi7 Df9 Ec7 Dg3 Dh8 Ea4 Ff2 Eb5 If4 Ed1 Gg2 Ee8 Gd8 Eh6 Fe6 Ei2 Fh1 Ga5 Hc1!,215496738834271659679358124126749385457183962398562417543817296761925843982634571
240660,1,swiss,Michiel Smits,2,WIN,Fabio Murer,1,LOSE,Cd1 Be6 Bc4 Ha5 Ac7 De7 Ai6 Hf8 Ab3 Hb4 Ad8 Bf7 Bi9 Ag2 Bd3 Aa1 Cc9 Ae4 Ah5 Af9 Bg1 Ba2 Ch4 Bb5 Bh8 Ca6 Cg3 Cb8 Hi2 Ce2 Hc1 Cf5 Ci7 Da3 He3 Db1 Hd7 Dc2 Ef6 Dd5 Fb9 Df4 Ii1 Dg6 Ga7!,137849256254367189689125347312574698875916423496283715728691534541738962963452871
240661,1,swiss,Joe Rahn,0,EXIT,Antonio Morillas,2,WIN,Aa7 Dh7 Ab6 Df3 Af5 Db1 Ac4 Dc5 Ad3 Ci9 Ag1 Ga4 Ah8 Ia2 Ai2 Be6 Ae9 Dg8 Da6 He1 Di4 Ge3 De2 Cf1 Dd9 Ig6 Bh3 Eb4 Bi5 Gf8 Bg4 Ic8 Cg7 Ef6 Ch6 Bb8 Ba1 Fb2 Bc9 Cd4 Ce8 Hb3 Cb5 Gg2
@maksverver
maksverver / results.csv
Created August 26, 2023 18:49
CodeCup 2023 test competition 2 win rates as player 1 and player 2
Name P1 Wins P1 Losses P2 Wins P2 Losses Total wins P1 Winrate P2 Winrate
Maks Verver 36 0 28 8 64 100.00% 77.78%
Louis Verhaard 36 0 23 13 59 100.00% 63.89%
Mark ter Brugge 36 0 21 15 57 100.00% 58.33%
Michiel Smits 35 1 22 14 57 97.22% 61.11%
Rust Kokkie 34 2 23 13 57 94.44% 63.89%
Nathan Fenner 33 3 23 13 56 91.67% 63.89%
Antonio Morillas 34 2 21 15 55 94.44% 58.33%
Marc Oldenhof 34 2 20 16 54 94.44% 55.56%
Jasper van Merle 32 4 21 15 53 88.89% 58.33%
@maksverver
maksverver / test-2-competition-315-games.csv
Created August 26, 2023 13:53
CodeCup test competition 2 annotated with game transcripts
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 11 columns, instead of 10. in line 4.
Game,Round,IsSwiss,User1,Score1,Status1,User2,Score2,Status2,Moves,Solution
239031,1,swiss,Frank Corporaal,1,NO_SOLUTIONS_LEFT,ZhengYi Chen,2,WIN,Gg8 Ii9 Gh1 Cg3 Ae1 Ff5 Ad2 Ag5 Dc1 Id4 Df2 Cc8 Ed1 Ea9 Di3 Gc7 Fg1 Hf7 Fe3 Ba3 Ee4 Da7 Dd6 Eh5 Bi1 Gi2 Eg2 Af3 Eb3 Bd5,
239032,1,swiss,ZhengYi Chen,1,NO_SOLUTIONS_LEFT,Frank Corporaal,2,WIN,Aa1 Ag2 Hg7 Cc2 Ba7 Fe1 Ch7 Eh1 Ib2 Fc3 If8 Ae3 Hh3 Af4 Cd9 Ig1 Eg8 Fg4 De6 Ce5,
239033,1,swiss,Jasper van Merle,2,WIN,Nathan Fenner,1,LOSE,Cf1 Aa1 Bi3 Ac3 Ah9 Bf9 Ee1 Bg1 Hg2 Ab2 Gc9 Bh2 Gd6 Af6 Ge2 Bc6 Gb7 Ag7 Ga4 Ad4 Fi7 Ae5 Ha6 Ai8 Gh8 Ba5 Gi1 Bb4 Gg5 Bd7 Fh4 Be8 Hb3 Ca7 Fg8 Cb9 Hf8 Cc8 Hh7 Cd2 He9 Ce3 Fc1 Cg4 Gf3 Ch5 Hi4 Ci6 Hd1 Da3 Ib1 Db6 Id5 Dd8 Ei5 Df5 Fa9 Dg9 Fb5 Dh1 Ii9 Di2 Ic2 Ea2 Ia8 Eb8 Hc5 Ed9 Ff2 Fd3 Fe6 Dc4 Eg3!,123456798546789123798231456364875912287914365951362847479623581635198274812547639
239034,1,swiss,Nathan Fenner,1,LOSE,Jasper van Merle,2,WIN,Ah3 If3 Ba3 Cf7 Ag7 Da7 Bc7 Ch5 Ad5 Gc6 Ae6 Gb9 Ai9 Gd1 Aa1 Fi8 Ab2 Ge8 Ac4 Ga4 Af8 Fh2 Bb5 Ha5 Bd2 Gi2 Be1 Hb7 B
@maksverver
maksverver / test-1-competition-316.csv
Created August 5, 2023 21:26
CodeCup test competition 1 annotated with game transcripts
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 11 columns, instead of 10. in line 3.
Game,Round,IsSwiss,User1,Score1,Status1,User2,Score2,Status2,Moves,Solution
237973,1,swiss,Jasper van Merle,1,LOSE,Louis Verhaard,2,WIN,Dh2 Bf8 Ef2 Ag3 Fc4 Ce6 Bi2 Dd3 Df7 Di5 Gg2 Gh1 Ge4 Gi7 Gd6 Ed4 Gb5 Dg4 Fi9 Ff6 Gc3 Gf9 Fg7 Ga8 Fh8 Eh3 Hb7 Hi3 Fe5 Fd1 Fb3 Fa2 Ea7 Ec5 Eb9 De9 Hc6 Ee8 Da6 Ca3 Db8 Ac2 Ia1 Ab6 Ib2 Cg9 Hh9 Ae1 Ic9 Cd2 Dc1 Af4 Ha4 Ie7 He2 Be3 Hf1 Bc7 If3 Ah5 Ad7 Aa9 Ai8 Bd9 Ba5 Ch7 Cf5 Cc8 Ei6 Ig8!,962714358517938642348265971681397425795482136234156789853649217476821593129573864
237974,1,swiss,Louis Verhaard,2,WIN,Jasper van Merle,1,LOSE,Ci5 Fa4 Ai6 Ac5 Bf2 Ic1 Ha2 Gf4 Ab4 Fh1 Gd7 Ff3 Cg9 Fg5 Dg2 Fi9 Ah2 Ga5 Hc4 Fd6 Gi2 Fc2 Cb2 Fe8 Ia7 Gc8 Fb7 Ge6 Ce7 He5 Dh4 Gh9 Eg6 Hf1 Ca1 Eb1 De1 Ec9 Ii4 Ed2 If9 Ee4 Bc7 Ef5 Ad1 Eh7 Db5 Gb3 Ih5 Gg1 Af8 Hb9 Bg4 Hh6 Dd9 Hi7 Cf6 Ib6 Bd5 Aa9 Ba6 Ae3 Ie2 Ag7 Cd4 Bb8 Be9 Bh3 Df7 Bi1 Cc3 Ch8 Dc6 Da3 Ig8!,945138726687592431123476985356917248819245673472683519538764192294851367761329854
237975,1,swiss,Rust Kokkie,2,WIN,Mees Broer,1,LOSE,Aa1 Ba2 Ab3 Ca4 Ac5 Da3 Ad2 Ea5
@maksverver
maksverver / gist:de7b9849e209dda31bbe11a22bbddc8b
Last active August 5, 2023 11:32
CodeCup sudoku random playout experiment
Number of digits placed when playing random moves until solution is unique:
22 6 #
23 24 ##
24 83 #####
25 254 ###############
26 475 ###########################
27 710 ########################################
28 797 #############################################
29 895 ###################################################
@maksverver
maksverver / verify-C.cc
Last active June 7, 2023 18:46
Verifier for Codeforces Round 876 (Div. 2) Problem C. Insert Zero and Invert Prefix
// Codeforces Round 876 (Div. 2) Problem C. Insert Zero and Invert Prefix
// https://codeforces.com/contest/1839/problem/C
//
// How to efficiently verify an arbitrary solution?
//
// Discussion:
// https://mirror.codeforces.com/blog/entry/116963?#comment-1034335
#include <bits/stdc++.h>
@maksverver
maksverver / PKGBUILD
Created February 9, 2023 21:51
Golly PKGBUILD without Perl support
# Maintainer: Jake <aur@ja-ke.tech>
# Contributor: Kyle Sferrazza <kyle.sferrazza@gmail.com>
# Contributor: Maks Verver <maksverver@geocities.com>
# Contributor: p2k <Patrick.Schneider@uni-ulm.de>
# Contributor: nokangaroo <nokangaroo@aon.at>
pkgname=golly
pkgver=4.2
pkgrel=2