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> | |
| #include <iomanip> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <numeric> | |
| #include <functional> | |
| #include <cmath> | |
| #include <queue> | |
| #include <stack> | |
| #include <set> |
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
| struct bit { | |
| vector<ll> v; // 部分和をbitで管理 仮想配列はa[1...n] | |
| bit(int n){ // bit(int n) : v(n + 1) {} | |
| v.resize(n + 1); | |
| } | |
| ll sum(int i){ // 仮想配列a[1]~a[i]の和を求める | |
| ll ret = 0; | |
| for(; i > 0; i -= i & -i){ // i & -i: iの1が立っている最高位bitをの2^を返す | |
| ret += v[i]; |
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
| extern crate rayon; | |
| use std::fs::{File}; | |
| use std::io::prelude::*; | |
| use std::io::{BufReader}; | |
| use std::env; | |
| fn main() { | |
| let filename = match env::args().nth(1) { | |
| Some(filename) => filename, |
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
| extern crate rayon; | |
| use std::cell::UnsafeCell; | |
| use std::ops::{Deref, DerefMut}; | |
| use std::sync::Arc; | |
| use rayon::prelude::*; | |
| #[derive(Clone)] | |
| pub struct Hogwild<T>(Arc<UnsafeCell<T>>); |
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::fmt; | |
| #[derive(Debug)] | |
| pub struct MyFloat { | |
| pub val: f64 | |
| } | |
| impl From<f64> for MyFloat { | |
| fn from(a: f64) -> Self { | |
| MyFloat { val: a } |
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::thread; | |
| use std::sync::{Arc, Mutex}; | |
| use std::time::Duration; | |
| fn main() { | |
| let mut data = Arc::new(Mutex::new(vec![1, 2, 3])); | |
| for i in 0..6 { | |
| let data = data.clone(); | |
| thread::spawn(move || { | |
| let mut data = data.lock().unwrap(); |
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> | |
| #include <vector> | |
| #include <queue> | |
| #include <thread> | |
| #include <chrono> | |
| typedef long long ll; | |
| #define _repargs(_1,_2,_3,name,...) name | |
| #define _rep(i,n) repi(i,0,n) | |
| #define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i) |
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
| docker ps -aq | xargs docker rm; | |
| docker images -aq | xargs docker rmi; |
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
| ; Y Combinator | |
| (defun Y (f) | |
| ((lambda (x) | |
| (funcall f (lambda (y) (funcall (funcall x x) y)))) | |
| (function | |
| (lambda (x) | |
| (funcall f (lambda (y) (funcall (funcall x x) y))))))) | |
| (defun fact (f) |
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> | |
| #include <iomanip> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <numeric> | |
| #include <functional> | |
| #include <cmath> | |
| #include <queue> | |
| #include <stack> | |
| #include <set> |
NewerOlder