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 itertools,operator | |
ops=[operator.add,operator.sub,operator.mul,operator.div] | |
opCombs = list(itertools.product(ops,ops,ops)) | |
def customReduce(operators,nums): | |
total = nums[0] | |
for i in range(len(operators)): | |
if operators[i] == operator.div and nums[i+1]==0: | |
return 1000001 |
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
7 2 5 1 | |
8 15 38 3 | |
0 0 0 0 |
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
f=open("6219.txt","r") | |
line=f.readline().strip() | |
while line!="0 0.00": | |
line = line.split(" ") | |
n = int(line[0]) | |
money = int(float(line[1])*100) | |
vals = [] | |
for i in range(n): |
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.ArrayList; | |
public class GrowArray { | |
public static void main(String[] args) { | |
ArrayList<Integer> test = new ArrayList<Integer>(); | |
long maxTime = 0; | |
for(int i=0;i<100000000;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
f=open("problem4691.txt","r") | |
dims = list(map(int,f.readline().strip().split(" "))) | |
board = [] | |
q = [] | |
for i in range(dims[0]): | |
board.append(list(map(int,f.readline().strip().split(" ")))) | |
#print(board) |
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 sys,os,math | |
def distance(p1,p2): | |
return abs(math.sqrt( (p2[0]-p1[0])**2 + (p2[1]-p1[1])**2 )) | |
def getAngle(s1,s2,s3): | |
try: | |
return math.acos( round((s1**2 + s2**2 - s3**2)/(2*s1*s2),3) ) * (180 / math.pi) | |
except: | |
return 2 |
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 <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <malloc.h> | |
int main(int argc, char* argv[]) | |
{ | |
char *name = "enwik8.zip"; | |
FILE *file; |
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 <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <malloc.h> | |
int main(int argc, char* argv[]) | |
{ | |
/* | |
char *name = "test.txt"; |
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
from pyPdf import PdfFileWriter, PdfFileReader | |
import StringIO | |
from reportlab.pdfgen import canvas | |
from reportlab.lib.pagesizes import letter | |
existing_pdf = PdfFileReader(file("test.pdf", "rb")) | |
output = PdfFileWriter() | |
numPages = existing_pdf.getNumPages() | |
size = existing_pdf.getPage(0)['/MediaBox'] |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <iostream> | |
#include <openssl/sha.h> | |
static const char alphabet[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | |
int main(){ |