This file contains 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 <bits/stdc++.h> | |
#define let const auto | |
#define REP(var, i) for (int var = 0; var < i; ++var) | |
using namespace std; | |
using Int = int; | |
//using Int = long long; | |
using vi = vector<Int>; | |
using vvi = vector< vector<Int> >; | |
void solve() { |
This file contains 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 | |
from PIL import Image | |
try: | |
ifile = sys.argv[1] | |
ofile = sys.argv[2] | |
except: | |
print ('usage: dec.py [input file] [out file]\n\n') | |
img = Image.open(ifile) |
This file contains 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
const WIDTH = 128; | |
const COLOUR = document.getElementById("colour").getContext("2d"); | |
const HEIGHT = document.getElementById("height").getContext("2d"); | |
const COMBIN = document.getElementById("combin").getContext("2d"); | |
var X=WIDTH/2, Y=WIDTH/2; | |
var ANGLE=0, DOP=WIDTH/2; | |
var img_height = "https://cdn.glitch.com/3bb25b2e-fb56-49fd-96e9-a9af83d391d2%2Fheight.jpg?1513785075480"; | |
var img_color = "https://cdn.glitch.com/3bb25b2e-fb56-49fd-96e9-a9af83d391d2%2Fcolor.jpg?1513785075766"; |
This file contains 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
# run with the starting index like so: `dload 5` | |
# first url on the list will be index-ed 5 | |
# pipe in list of urls | |
i=$1 | |
if [ -d $1 ]; then i=1; fi | |
while read f; do | |
name=$(echo $f | tr "/" "\n" | tail -n 1) |
This file contains 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 Solution{ | |
ArrayList<Integer> weights, minWeights; | |
void run(){ | |
Scanner cin = new Scanner(System.in); | |
int T = cin.nextInt(); | |
for(int t=0; t<T; t++){ |
This file contains 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 math | |
import random | |
import matplotlib.pyplot as plt | |
import pickle | |
FNAME = "data.obj" | |
# generate 30 towns in a 1000*1000 grid | |
TOWN = 30 | |
GRID = 1000 |
This file contains 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 Solution{ | |
boolean allDone(boolean[][] grid, int c){ | |
for(int i=0; i<3; i++){ | |
for(int j=0; j<3; j++){ | |
if(!grid[i][c+j]) return false; | |
} | |
} |
This file contains 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 Solution{ | |
void run(){ | |
Scanner cin = new Scanner(System.in); | |
int T = cin.nextInt(); | |
for(int t=0; t<T; t++){ | |
int N = cin.nextInt(), | |
K = cin.nextInt(); |
This file contains 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
" Colorscheme | |
colorscheme desert | |
syntax on | |
" Spaces & Tabs | |
set tabstop=4 shiftwidth=4 softtabstop=4 expandtab | |
set autoindent | |
retab | |
" Wrapping |
This file contains 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" | |
void postorder(int idx, int vals[], int left[], int right[]){ | |
if(left[idx]>-1){ postorder(left[idx], vals, left, right); } | |
if(right[idx]>-1){ postorder(right[idx], vals, left, right); } | |
printf("%d ", vals[idx]); | |
} | |
int main(void){ | |
int n; scanf("%d", &n); |
NewerOlder