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
import java.lang.Exception | |
import java.nio.charset.Charset | |
// Bencode parser in Kotlin | |
object BencodeParser { | |
class InvalidBencodeFormat( | |
startIndex: Int, | |
msg: String |
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
package client; | |
import java.io.Console; | |
import java.util.Scanner; | |
public final class Client { | |
private static Session session; | |
private static Scanner sc; | |
private Client() { |
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
import java.util.Random; | |
import java.util.Date; | |
public class RandomPointsInPlane{ | |
private static final int BATCH_SIZE = 25; | |
private static final int MIN_BATCH_SIZE = 5; | |
public static long getSeed(){ | |
return (new Date().getTime() % Integer.MAX_VALUE); |
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
import java.util.Random; | |
public class KMeansWithKpp{ | |
// Data Needed | |
public Point[] points; | |
public Point[] centroids; | |
Random rand; | |
public int n; | |
public int k; |
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
// Includes | |
#include <iostream> | |
class Box { | |
private: | |
long double x, v, m, w; | |
public: | |
Box(long double wx, long double mx) { | |
w = wx; |
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> | |
class solution { | |
private: | |
// game configs | |
int positions; | |
int options; | |
char *secret; | |
int chances; |
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
class random { | |
private: | |
static long long seed; | |
static const long long rand_max = 4294967296; // 2^32 | |
static const long long multiplier = 22695477; | |
static const long long increament = 1; | |
public: | |
static void srand(long long s) { seed = s; } | |
static long long rand() { |
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
# Import Pandas Library | |
import pandas as pd | |
# Custom Exception Added | |
class AlreadyUpperCase(Exception): | |
def __init__(self): | |
super().__init__("DataFrame Provided Is Already In Upper Case") | |
pass | |
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
/* Trying to implement Introsort for integer array | |
Used in STL | |
*/ | |
/* Headers for testing */ | |
#include <cstdlib> | |
#include <iostream> | |
namespace IntroSort { |
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 <stdio.h> | |
#include <iostream> | |
/* FAST I/O for cin cout methods */ | |
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) | |
/* Impement as testcase{ body for each testcase} */ | |
#define testcase \ | |
long long t; \ | |
scanf("%lld", &t); \ |