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
public sealed class UnionFind<T> | |
{ | |
private sealed class Link<TLink> | |
{ | |
public TLink parent; | |
public int rank = 0; | |
public Link(TLink parent) | |
{ | |
this.parent = parent; |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
namespace Util | |
{ | |
public struct Position | |
{ |
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
using System; | |
class ConvertBytes | |
{ | |
public static void Convert08to08(byte[] src, int srcOff, short[] dst, int dstOff, int dstLen) | |
{ | |
ValidateRange(src, srcOff, dst, dstOff, dstLen, 8); | |
int n = dstLen / 4; | |
for (int i = 0; i < n; i++) |
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 com.cmosis.iconlib; | |
import java.awt.Graphics; | |
import java.awt.image.BufferedImage; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.HashMap; |
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
static T Parse<T>(string value) | |
where T : struct | |
{ | |
var type = typeof(T); | |
if (!type.IsEnum) | |
throw new ArgumentException("T is not an enum"); | |
var enumValue = Enum.Parse(type, value); | |
return (T)enumValue; | |
} |
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
static class LinearRegression | |
{ | |
double[] independent; | |
double[] independentDiff; | |
double independentDiffSquaredSum; | |
double independentMean; | |
double[] calculate(double[] values) | |
{ | |
if (values.length != independent.length) |
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 <emmintrin.h> | |
typedef unsigned char uint8; | |
typedef unsigned int uint32; | |
typedef unsigned long long uint64; | |
typedef struct MD5Data | |
{ | |
__m128i h0, h1, h2, h3; | |
} MD5Data; |
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
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public class PermuteEnumerator<T> | |
: IEnumerator<IEnumerable<T>> | |
where T : IComparable | |
{ |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.Drawing.Imaging; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
namespace Jpeg | |
{ |
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> | |
int main(int argc, char** argv) { | |
int i, sum = 0; | |
for(i = 0; i < 1000; i++) | |
if(i%3 == 0 || i%5 == 0) | |
sum += i; | |
printf("%d\n", sum); | |
} |