Skip to content

Instantly share code, notes, and snippets.

@leolee192
leolee192 / www.spoj.com_problems_INOUTEST
Last active June 27, 2022 14:41
Enormous Input and Output Test
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
Reader reader = new Reader();
Writer writer = new PrintWriter(new BufferedOutputStream(System.out));
int N = reader.nextInt();
for (int i=0; i<N; ++i) {
int a = reader.nextInt(), b = reader.nextInt();
@leolee192
leolee192 / concatCopyPreAllocate.go
Created December 22, 2019 15:37
concatCopyPreAllocate.go
func concatCopyPreAllocate(slices [][]byte) []byte {
var totalLen int
for _, s := range slices {
totalLen += len(s)
}
tmp := make([]byte, totalLen)
var i int
for _, s := range slices {
i += copy(tmp[i:], s)
}
@leolee192
leolee192 / relay.py
Last active March 1, 2017 21:16 — forked from zjiekai/relay.py
tcp relay
#!/usr/bin/python
import logging
import socket
from threading import Thread
class PipeThread(Thread):
pipes = []