Skip to content

Instantly share code, notes, and snippets.

View razimantv's full-sized avatar

Raziman T V razimantv

  • Imperial College London
  • London, United Kingdom
  • 04:41 (UTC +01:00)
  • X @razimantv
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / strikerates.ipynb
Created November 16, 2023 00:04
Strike rate statistics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / superman.cpp
Last active November 12, 2023 14:35
Superman Diwali solution
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
@razimantv
razimantv / splitgame.cpp
Created September 25, 2023 09:50
Split game solver
/**
* Two-Player Split Game Solver
*
* This C++ program solves a two-player game played with two hands
*
* - Two players take turns, starting with two fingers out on each hand
* - Each turn, a player can add the number of fingers on one of their hands to
* that of their opponent (addition wraps around after 5)
* - If the numbers on a hand become 5, it resets to 0
* - If one hand is empty and the other has an even number, it can be split
@razimantv
razimantv / unruly.cpp
Last active July 13, 2021 08:06
Solution for the "Unruly" game from Simon Tatham's puzzle collection
#include <iostream>
#include <iterator>
#include <numeric>
#include <queue>
#include <string>
#include <vector>
bool notblocked(const std::string& str, char c) {
int L = str.size();
if (L < 2) return true;
@razimantv
razimantv / primes.cpp
Last active October 12, 2020 02:50
Comparing prime generation the old way and the C++20 way
#include <chrono>
#include <iostream>
#include <numeric>
#include <ranges>
#include <vector>
const int N = 10000000;
int main() {
auto t1 = std::chrono::steady_clock::now();
@razimantv
razimantv / towers.cpp
Created April 9, 2020 20:04
Solution to the towers puzzle
/******************************************************************************
* File: towers.cpp
*
* Author: Raziman T V
* Created: 04/09/20
* Description: Solving the Towers puzzle
*****************************************************************************/
#include <algorithm>
#include <cassert>
@razimantv
razimantv / Randomstrip.ipynb
Created February 18, 2019 19:05
Generate random points in an angle range around a given latitude and longitude
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@razimantv
razimantv / population_evolution.cpp
Last active November 20, 2018 21:50
Dependence of population evolution on age of giving birth
#include <fstream>
#include <iostream>
#include <random>
#include <set>
#include <string>
#include <tuple>
// Birth/death events
// If birth: time, +1, 0
// If death: time, -1, birthday