Skip to content

Instantly share code, notes, and snippets.

View chmllr's full-sized avatar

Christian Müller chmllr

View GitHub Profile
#include <stdio.h>
long res, tmp;
int T, N;
int main() {
scanf("%d", &T);
while(T-->0){
scanf("%d", &N);
res = 0;
while(N-->0) {
scanf("%lu", &tmp);
import java.util.Scanner;
public class WAYS2 {
static String[] mx;
static int[][] cache;
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int m = s.nextInt(), n = s.nextInt();
mx = new String[m];
cache = new int[m][n];
local wall = {}
local M, N = io.read("*n"), io.read("*n")
io.read()
for i = 1, M do
table.insert(wall, io.read("*l"))
end
local blocks = {}
setmetatable(blocks, { __index = function(t, k) return 0 end })
import java.util.Scanner;
public class EDIST {
static int N = 2100;
static int[][] cache = new int[N][N];
static String a;
static String b;
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int T = s.nextInt();
local cache, q, p
function solve(a, b)
if(a == 0) then return b end
if(b == 0) then return a end
local k = a * 2010 + b
local v = cache[k]
if(v) then return v end
local result
local tmp = solve(a-1, b-1)
function getLCS(a, b)
local maxMatches = 0
local offset = 0
for k = 0, #b-1 do
local matches = 0
for i = 1, #a do
if k + i > #b then break end
if a:sub(i,i) == b:sub(k+i,k+i) then
matches = matches + 1
end
import java.util.*;
public class PT07Z {
static Map<Integer, Set<Integer>> neighbours = new TreeMap<Integer, Set<Integer>>();
static int[][] distances;
static boolean[] marked;
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int N = s.nextInt(), n = N-1;
distances = new int[N+1][N+1];
import java.util.Scanner;
import java.util.Arrays;
public class Bsearch1 {
public static void main(String... args) {
Scanner s = new Scanner(System.in);
int N = s.nextInt(), Q = s.nextInt(), n = N, ln = N-1;
int[] numbers = new int[N];
while (n --> 0) numbers[ln-n] = s.nextInt();
import java.util.Scanner;
import java.util.Arrays;
public class Bsearch1 {
public static void main(String... args) {
Scanner s = new Scanner(System.in);
int N = s.nextInt(), Q = s.nextInt(), n = N, ln = N-1;
int[] numbers = new int[N];
while (n --> 0) numbers[ln-n] = s.nextInt();
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Mmass {
static Map<Character, Integer> m = new HashMap<Character, Integer>();
public static void main(String[] args) {
m.put('H', 1);
m.put('C', 12);
m.put('O', 16);