Skip to content

Instantly share code, notes, and snippets.

View separation's full-sized avatar

Yu-Wen Lin separation

View GitHub Profile
#include <iostream>
#include <vector>
using namespace std;
template<typename T>
class Matrix
{
public:
Matrix(size_t height, size_t width, const T& value = T()) : m_data(height, vector<T>(width, value))
#include <iostream>
#include <string>
using namespace std;
int to_decimal(char c)
{
if (isdigit(c))
{
return c - '0';
// This solution does not work for UVA 681.
// Possibly due to non-polygon inputs which does not match the criteria of Melkman's algorithm.
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
using namespace std;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
template<typename T>
class point
{
public:
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <cmath>
using namespace std;
template<typename T>
#include <iostream>
#include <iomanip>
#include <list>
#include <string>
#include <map>
using namespace std;
template<typename T>
list<string> to_bangla_strings(T num)
#include <iostream>
#include <queue>
#include <vector>
#include <functional>
using namespace std;
template<typename T>
class dataset
{
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
size_t get_num_of_moves(const vector<size_t>& stack_heights)
{
size_t average_height = accumulate(stack_heights.begin(), stack_heights.end(), 0) / stack_heights.size();
return accumulate(stack_heights.begin(), stack_heights.end(), 0, [average_height](size_t moves, size_t current_height)
import urllib.request
import json
def request_gists(username):
url = 'https://api.github.com/users/' + username + '/gists'
with urllib.request.urlopen(url) as response:
text = response.read()
for gist in json.loads(text):
for filename in gist['files']: