Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tpopp on github.
  • I am tpopp (https://keybase.io/tpopp) on keybase.
  • I have a public key whose fingerprint is 79E8 D3A5 952F EBD5 2E2E 2391 88D0 D341 6D3A D349

To claim this, I am signing this object:

import java.util.Scanner;
//http://codeforces.com/problemset/problem/371/B
public class Fox {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[][] facts = new int[2][4];
facts[0][3] = sc.nextInt();
import java.util.Stack;
import java.util.HashMap;
import java.io.*;
public class PotD_4 {
public static void main(String[] args) throws IOException {
HashMap<String, Integer> compare;
compare = new HashMap<>();
compare.put("+", 1);
# improve A(n)
# H(n) improves by working from both sides in at the same time
def A(n):
res = 0
for i in range(1,n+1):
res += n // i
return res
def H(n):
@tpopp
tpopp / PotD2.c
Last active December 20, 2015 13:18
/*
Most comments are obvious; akward structure due to quick coding
Recursion would have made this much easier to follow
Concept: A,BCD = A,000 + B00 + C0 + D
All numbers will occur in less significant digit based on only the 'letter'
. For every 10, each digit will occur once in the 1's spot;
. For every 100, each digit will occur once in the 1's spot for every 10 (adds up to 10), and will be in tens spot for 10; etc
All += C * 1 * 10^1; All += B * 2 * 10^2; All += A * 3 * 10^3; etc.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int count[10]; //count each digit, all initialized to 0
main() {
@tpopp
tpopp / PoTD_1.py
Last active December 20, 2015 12:29
3n + 1
import sys
values = {1:0}
def cycle(i, j):
large = 0
for k in range(min(i,j), max(i,j)+1):
a = compute(k)
if (a > large):
large = a
print(i, j, large+1) #(large + 1) because I wasn't including 1 in the length of the cycle.