Skip to content

Instantly share code, notes, and snippets.

@dudelson
dudelson / stupid_final.py
Created June 2, 2014 04:19
Kelly's stupid CS final :P
import Tkinter as tk
from Tkinter import N, S, E, W
import ttk
root = tk.Tk()
root.title("This is dumb")
root.grid()
student_name = tk.StringVar()
teacher_1_name = tk.StringVar()
@dudelson
dudelson / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#![allow(dead_code)]
fn double(x: &i32) -> i32{
2*x
}
fn it_ex_1() {
let values: [i32; 3] = [1, 2, 3];
let it = values.iter();
@dudelson
dudelson / lambda-term-example.ml
Last active November 24, 2016 05:43
A small example showing how to use lambda-term to print "Hello, world!" to the screen
open Lwt
open CamomileLibrary
let draw ui matrix =
(* let style = { LTerm_style.none with foreground = Some (LTerm_style.rgb 255 255 255) } in *)
let size = LTerm_ui.size ui in
let ctx = LTerm_draw.context matrix size in
LTerm_draw.draw_string ctx 2 2 "Hello, world!"
let rec loop ui =
@dudelson
dudelson / uva_10226.cpp
Created January 7, 2017 01:45
My solution for UVA 10226
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
using namespace std;
map<string, int> m;
int n;
double trees;
string s;
@dudelson
dudelson / uva_10258.cpp
Created January 7, 2017 01:47
My solution for UVA 10258
#include <iostream>
#include <cstring>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
using namespace std;
typedef vector<int> vi;
@dudelson
dudelson / uva_10264.cpp
Created January 7, 2017 01:48
My solution for UVA 10264
#include <iostream>
#include <algorithm>
using namespace std;
inline bool neighbors(int i, int j) {
int n = i^j;
return (n&(-n)) == n;
}
@dudelson
dudelson / uva_10855.cpp
Created January 7, 2017 01:50
My solution for UVA 10855
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
#define maxn 1000
ll N, n;
@dudelson
dudelson / uva_10895.cpp
Created January 7, 2017 01:51
My solution for UVA 10895
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
vector< vector< pair<int, int> > > t;
int n, m;
int main() {
@dudelson
dudelson / uva_10954.cpp
Created January 7, 2017 01:51
My solution for UVA 10954
#include <iostream>
#include <queue>
using namespace std;
int n, x;
long long sum;
int main() {
while(cin >> n, n) {
sum = 0;
priority_queue<long long> q;