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
use std::collections::HashMap; | |
pub fn mean(values: &[i32]) -> f64 { | |
let mut sum = 0.0; | |
for x in values { | |
sum += *x as f64; | |
} | |
sum / values.len() as f64 |
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
#r "nuget: FSharp.Json" | |
open FSharp.Json | |
open System.IO | |
type SubSection = | |
{ Name: string | |
; Weight: float | |
; ProblemRange: int * int } | |
type Section = |
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 <iostream> // For input/output | |
using namespace std; | |
// The merge function is where the sorting actually happens | |
// int arr[] is the array we're passing in | |
// int l is the index of the array that the left "chunk" begins at | |
// int m is the index of the array that the left "chunk" ends at, whereas the right "chunk" ends at m + 1 | |
// int r is the index of the array that the right "chunk" /ends/ at | |
void merge(int arr[], int l, int m, int r) { | |
// Here we compute the size of the two "chunks" |
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 <bits/stdc++.h> | |
#define N 1000010 | |
using namespace std; | |
typedef long long int ll; | |
vector<ll> graph[N]; | |
set<ll> seen; | |
ll min_cost = LLONG_MAX; | |
void dfs(ll costs[], ll r) { |
NewerOlder