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
/* c650Alpha __template.cpp */ | |
#include <bits/stdc++.h> | |
#include <ext/pb_ds/assoc_container.hpp> | |
#include <ext/pb_ds/tree_policy.hpp> | |
#define FI first | |
#define SE second | |
typedef long long ll; | |
typedef std::pair<ll,ll> pairll; |
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
#!/bin/env ruby | |
# A very crappy judging script | |
if ARGV.length < 2 | |
puts "Usage: ./program.rb [executable] [data folder]" | |
exit | |
end | |
Dir.chdir(ARGV[1]) | |
Dir.glob("case*").sort.each do |testcase| |
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
require 'csv' | |
# correlation-inator.rb | |
# by Charles (c650) | |
# Takes in CSV, calculates pairwise correlations but excluding empty cells | |
class Pair | |
attr_accessor :a, :b | |
def initialize(a, b) | |
a.gsub!(/#/,"") |
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
#!/bin/env ruby | |
CASES = 25 | |
PRODUCE_DATA = false | |
STDERR.puts "gif program ?" | |
program = gets.chomp | |
`g++ --std=c++17 -Wall -O2 -o #{program}.out #{program}.cpp` |
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 FI first | |
#define SE second | |
typedef long long ll; | |
typedef std::pair<ll,ll> pairll; | |
const int rot_delta[4] = {3,0,0,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
arr = [] | |
loop do | |
s = gets.chomp | |
break if s == "END" | |
arr << s.to_f | |
end | |
sum = 0 | |
arr.map{|e| sum += e} |
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
fn main() { | |
let v = vec![1,2,3,4]; | |
let b: Vec<i32> = v.iter().map(|e| e * 2).collect(); | |
println!("{:?}", b); | |
} |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
int main() { | |
std::vector<int> v{1,2,3,4}; | |
std::vector<int> b; | |
std::transform(v.begin(), v.end(), std::back_inserter(b), [](int a){return 2 * a;}); |
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
fn main() { | |
let v = vec![1,2,3,4]; | |
let b = v.iter().map(|e| e * 2).filter(|e| e % 6 == 0).fold(0, |acc, x| acc + x); | |
println!("{:?}", b); | |
} |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
#include <numeric> | |
int main() { | |
std::vector<int> v{1,2,3,4}; | |
std::vector<int> b; |