This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = open('inputs/1.in').read() | |
midp = 1 | |
print sum(int(e[0]) for e in zip(s,s[midp:]+s[:midp]) if e[0] == e[1]) | |
midp = len(s)/2 | |
print sum(int(e[0]) for e in zip(s,s[midp:]+s[:midp]) if e[0] == e[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
public class TestIO { | |
public static void testSystemOutPrintln() { | |
for (int i = 0; i < 10_000_000; i++) { | |
System.out.println(i); | |
} | |
} | |
public static void testSystemOutPrint() { | |
for (int i = 0; i < 10_000_000; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <cstring> | |
using namespace std; | |
#define VI vector<int> | |
#define pb push_back | |
#define NMAX 100000 | |
int l[NMAX], r[NMAX]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ java -XX:+UnlockDiagnosticVMOptions '-XX:CompileCommand=print,*test3.main' test3 | |
CompilerOracle: print *test3.main | |
OpenJDK 64-Bit Server VM warning: printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output | |
Compiled method (c1) 42 19 % 3 test3::main @ 8 (84 bytes) | |
total in heap [0x00007f9961110610,0x00007f9961111468] = 3672 | |
relocation [0x00007f9961110738,0x00007f99611107e0] = 168 | |
main code [0x00007f99611107e0,0x00007f9961110f20] = 1856 | |
stub code [0x00007f9961110f20,0x00007f9961110fc8] = 168 | |
oops [0x00007f9961110fc8,0x00007f9961110fd0] = 8 | |
metadata [0x00007f9961110fd0,0x00007f9961110fe8] = 24 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CountNoRepPerms { | |
public static long recur(int[] hist2, int prev, int uniqueChars) { | |
if (hist2[0] == uniqueChars) return 1; | |
int out = 0; | |
for (int i = 1; i < hist2.length; i++) { | |
int count = i == prev ? hist2[i]-1 : hist2[i]; | |
if (count > 0) { | |
hist2[i]--; | |
hist2[i-1]++; | |
out += count*recur(hist2, i-1, uniqueChars); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class LinkedList<T> implements List<T> { | |
public class Node { | |
T data; | |
Node prev, next; | |
public Node() {} | |
public Node(T data_) {data = data_;} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
class Generics { | |
public enum A { A1, A2 } | |
public enum B { B1, B2 } | |
public static List<? extends Enum<?>> listFactory(String[] args) { | |
if (args.length == 0) { | |
return new ArrayList<>(Arrays.asList(A.A1, A.A2)); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Array; | |
class Sup<T> { | |
T[] arr; | |
@SuppressWarnings("unchecked") | |
public Sup(int r) { | |
arr = (T[])new Object[r]; | |
//arr = (T[])Array.newInstance(Object.class, r); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2015-06-20 16:32:30,638 - automaton2000 - DEBUG - irc.freenode.net > PING :sendak.freenode.net | |
2015-06-20 16:32:30,639 - automaton2000 - DEBUG - irc.freenode.net < PONG :sendak.freenode.net | |
2015-06-20 16:32:45,656 - automaton2000 - DEBUG - irc.freenode.net > :[email protected] QUIT :Ping timeout: 767 seconds | |
2015-06-20 16:32:45,656 - automaton2000 - DEBUG - Bot quitting | |
2015-06-20 16:32:45,656 - automaton2000 - DEBUG - irc.freenode.net < QUIT :Automaton destroyed | |
Exception in thread Thread-1: | |
Traceback (most recent call last): | |
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner | |
self.run() | |
File "/home/michael/.local/lib/python2.7/site-packages/automaton2000/bot.py", line 102, in run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class Person implements Comparable<Person> { | |
protected String lastName, firstName; | |
public Person(String lastName, String firstName) { | |
this.lastName = lastName; | |
this.firstName = firstName; | |
} | |
public String fullName() { return firstName+" "+lastName; } |
NewerOlder