text:
Lookalike shapes
Similar figures
Two rectangles are similar if the ratios of their sides are the same.
Consider these two rectangles; a rectangle 5 lines tall and 11 chars wide:
===========
===========
===========
===========
===========

and a rectangle 10 lines tall and 22 chars wide:
======================
======================
======================
======================
======================
======================
======================
======================
======================
======================

These shapes are similar because the ratios of their sides are the same. To put it
formally (with \$h\$ being the shortest side and \$w\$ being the longest side):
$$
\frac{h_1}{w_1} = \frac{h_2}{w_2}
$$
You can also do:
$$
\frac{h_1}{h_2} = \frac{w_1}{w_2}
$$
The challenge
Write a program or function that takes a "main" rectangle and some "other"
rectangles and prints which of "others" are similar to "main".
The input
A shape and a list of shapes. Each shape consists of 2 non-zero positive integers, which denote the
width and height of the rectangle. For instance, this:
(4,2), (3,9)

denotes two rectangles, a 4x2 and a 3x9. The exact format of the input may be
however you desire.
The output
The indices of the "other" shapes that are similar to "main". You may
choose whether the indices are 0- or 1-based, as well as the exact format
and order of the output.
Sample program
In Python:
main = eval(raw_input()) # The main rectangle.
rects = eval(raw_input()) # The list of rectangles.
similar = set()
for i, rect in enumerate(rects):
    if max(main)*min(rect) == min(main)*max(rect): # Cross-multiply
        # They are similar.
        similar.add(i)

print similar

Sample input and output
Input:
(1, 2)
[(1, 2), (2, 4)]

Output:
set([0, 1])

Input:
(1, 2)
[(1, 9), (2, 5), (16, 8)]

Output:
set([2])

Winning
This is code-golf, so the shortest submission wins.
Notes

This should go without saying, but standard loopholes are banned.
No builtins for locating similar figures may be used. (I don't even know if that exists, but I would't be surprised!)

Is using floating point division allowed? Would [1.0 2.0] be an acceptable input format?

@Dennis Provided your selected language doesn't have oddly low floating point precision and therefore the test cases fail, it should be fine. ;)

Instead of indices may we also output the actual similar shapes themselves?

@orlp Nope!!! :D

@Dennis The trouble with floating point is that you run into trouble in some cases. e.g., [1.0 5.0] is not the same as [0.2 1.0] because 0.2 is not representable in binary floating point. (That is, 5 * 0.2 != 1.0.)

@ChrisJester-Young I know, that's why I asked. 0.2 won't be an issue here though, since the input will always be an integer (in the mathematical sense).

What is (0,0) similar to? Also your sample program fails parsing (3+i, 4-2i)

@immibis You only need to handle non-zero integers, not imaginary numbers. I'll edit the post.

So they can be negative?

@immibis Uhh...nope. Editing...

Is the output format of outputting the indices mandatory? For a test case like  [(1,2), (2,4), (1,9), (2,5), (16,8)], is only [0,1,4] and [1,2,5] allowed, or could we also output [1,1,0,0,1] or [(1,2), (2,4), (16,8)]?

Pyth, 15 bytes
fqcFS@QTcFSvzUQ

Python, 61 bytes
lambda a,b,l:[i for i,(x,y)in enumerate(l)if x/y in[a/b,b/a]]

Yes, I'm using spending 9 chars to write enumerate. Takes input like 1, 2, [(1, 9), (3,6), (2, 5), (16, 8)]. For Python 2, input values need to be written as floats.
One char longer (62) in Python 3:
def f(a,b,l,i=0):
 for x,y in l:b/a!=x/y!=a/b or print(i);i+=1

Do you mind explaining this? I'd like to know what's going on.

@BassetHound for each element in the input list, the comprehension unpacksi as the index, and (x,y) as the point. It then checks if the value x/y is either equal to the initial two numbers' quotient (a/b) or its reciprocal (b/a). If it is equal to one of those values, that value of i is added to the list, otherwise it is discarded.

CJam, 22 20 19 bytes
{:$::/_0=f=ee::*0-}

The above is an anonymous function that pops a single array of floating point pairs (first pair is needle) from the stack and pushes the array of 1-based indexes in return.
Try it online in the CJam interpreter.
How it works
:$                e# Sort each pair.
  ::/             e# [a b] -> a/b
     _0=          e# Push a copy of the array and extract the first float (needle).
        f=        e# Check which floats are equal to the needle.
          ee      e# Enumerate the resulting Booleans.
            ::*   e# Multiply each Boolean by its index.
                  e# This yields 0 for the needle (index 0) and for non-matching
                  e# haystack pairs (Boolean 0).
               0- e# Remove all zeroes from the array.

Haskell, 48 bytes
(a!b)l=[i|(i,(x,y))<-zip[0..]l,x/y+y/x==a/b+b/a]

Try it online!
Call this like (!) 1 2 [(1, 9), (3,6), (2, 5), (16, 8)].
A near-port of my Python answer. The expression zip[0..]l enumerates the list with its indices.
The expression x/y+y/x==a/b+b/a checks that the ratio x/y is either a/b or b/a, since the function f(z) = z + 1/z has f(z) = f(1/z) and no other collisions.

Maybe make h an operator taking three arguments? That'd save one byte, and I think it would stay within the rules.

@dfeuer Sure, it's definitely allowed by modern standards though back it was fuzzier what liberties could be taken with I/O.

Snowman 1.0.2, 61 chars
}vgvgaC"[0-9]+"sM:10sB;aM2aG:AsO:nD;aF;aM0AAgaA*|:#eQ;AsItSsP

Pure gibberish (unless you happen to know Snowman), a.k.a. exactly in line with the language's design goal of being as confusing as possible.
Input format is same as in the post, output format is also the same minus set( and ).
Ungolfed (or unminified, really):
}vgvgaC     // read two lines of input, concatenate
"[0-9]+"sM  // use a regex to grab all numbers
:10sB;aM    // essentially map(parseInt)
2aG         // take groups of 2 (i.e. all the ordered pairs)

// now map over each ordered pair...
:
  AsO       // sort
  :nD;aF    // fold with division - with 2 array elements, this is just a[0]/a[1]
;aM

// we now have an array of short side to long side ratios
// take out the first one
0AAgaA      // active vars beg, b=array[0], g=the rest
*|          // store first ordered pair in permavar, bring the rest to top

// select indices where...
:
  #         // retrieve first ordered pair
  eQ        // equal?
;AsI

tSsP  // to-string and output

I'm pretty proud of some of the tricks I used in this one:

I used the same input format as in the post. But instead of trying to parse it somehow, which would get really messy, I just concatenated the two lines and then used a regex to extract all the numbers into one big array (with which I then did 2aG, i.e. get every group of 2).
:nD;aF is pretty fancy. It simply takes an array of two elements and divides the first one by the second one. Which seems pretty simple, but doing it the intuitive way (a[0]/a[1]) would be far, far longer in Snowman: 0aa`NiN`aA|,nD (and that's assuming we don't have to worry about messing with other existing variables). Instead, I used the "fold" method with a predicate of "divide," which, for an array of two elements, achieves the same thing.
0AAgaA looks innocuous enough, but what it actually does is store a 0 to the variables, then takes all variables with an index greater than that (so, all variables except for the first one). But the trick is, instead of AaG (which would get rid of the original array and the 0), I used AAg, which keeps both. Now I use aA, at-index, using the very same 0 to get the first element of the array—furthermore, this is in consume-mode (aA instead of aa), so it gets rid of the 0 and original array too, which are now garbage for us.
Alas, 0AAgaA*| does essentially the same thing that GolfScript does in one character: (. However, I still think it's pretty nice, by Snowman standards. :)

Mathematica, 41 bytes
Position[a=Sort@#;Sort@#/a&/@#2,{x_,x_}]&

Usage:
Position[a = Sort@#; Sort@#/a & /@ #2, {x_, x_}] &[{1, 2}, {{1, 2}, {2, 5}, {16, 8}}]
(* {{1}, {3}} *)

I just knew Mathematica was going to come up somehow!

Pyth - 14 bytes
Filters by comparing quotients, then maps indexOf.
xLQfqcFSTcFvzQ

Test Suite.

This doesn't sort the main shape, so it will give the wrong answer when the main shape's first side length is larger. See this test case

@isaacg good point, will fix.

This fails on inputs with repeated elements, for example 1,2 and [(1, 2), (2, 4), (1, 2)] will give [0, 1, 0] rather than the correct [0, 1, 2].

I want to accept this one, since it is the shortest, but is the problem @orlp mentioned fixed?

@kirbyfan64sos No.

APL (Dyalog Unicode), 16 13 bytesSBCS
(=.×∘⌽∨=.×)⍤1

Try it online!
-3 thanks to @ngn!
Explanation:
(=.×∘⌽∨=.×)⍤1
(     ∨   )   ⍝ "OR" together...
 =.    =.     ⍝ ...fold by equality of:
   ×∘⌽        ⍝ - the arguments multiplied by itself reversed
         x    ⍝ - the argument multiplied by itself
           ⍤1 ⍝ Applied at rank 1 (traverses)

Output format is a binary vector like 1 1 0 0 1 of which "other" rectangle is a look-a-like.
APL (Dyalog Extended), 11 bytesSBCS
=/-×⍥(⌈/)¨⌽

Try it online!
Explanation:
=/-×⍥(⌈/)¨⌽ ⍝ takes only a right argument: ⍵, shape: (main (other...))
          ⌽ ⍝ two transformations:
  -         ⍝ - left (L) vectorized negation: -⍵
          ⌽ ⍝ - right (R): reverse. (main other) => (other main)
     (⌈/)¨  ⍝ transformation: calculate the max (since L is negated, it calculates the min)
            ⍝ (/ reduces over ⌈ max)
            ⍝ this vectorizes, so the "main" side (with only one rect) will get repeated once for each "other" rect on both sides
   ×⍥       ⍝ over multiplication: apply the transformation to both sides. F(L)×F(R)
=/          ⍝ reduce the 2-element matrix (the "main" that's now the side of the "other") to check which are equal

Output format is the same as the main Dyalog answer.
Thanks to Adám for the help golfing + Extended.

(=.×∘⌽∨=.×)⍤1

Thanks. Will try to inspect that first

Julia, 62 bytes
f(m,o)=find([(t=sort(m).*sort(i,rev=true);t[1]==t[2])for i=o])

The find function locates true elements in a boolean vector. .* performs elementwise multiplication of vectors.
Ungolfed:
function f(m::Array, o::Array)
    find([(t = sort(m) .* sort(i, rev=true); t[1] == t[2]) for i in o])
end

Usage:
f([1,2], {[1,9], [2,5], [16,8]})

K5, 19 bytes
I think this will do the trick:
&(*t)=1_t:{%/x@>x}'

Takes a list of pairs where the first is the "main". Computes the ratio by dividing the sorted dimensions of each pair. Returns a list of the 0-indexed positions of the matching pairs. (arguably the input format I chose makes this -1 indexed- if this is considered invalid tack on a 1+ to the beginning and add two characters to the size of my program.)
Usage example:
  &(*t)=1_t:{%/x@>x}'(1 2;1 2;2 4;2 5;16 8)
0 1 3

This runs in oK- note that I implicitly depend on division always producing floating point results. It would work in Kona if you added a decimal point to all the numbers in the input and added a space after the _.

Octave / Matlab, 44 bytes
Using an anonymous function:
@(x,y)find((max(x))*min(y')==min(x)*max(y'))

The result is in 1-based indexing.
To use it, define the function
>> @(x,y)find((max(x))*min(y')==min(x)*max(y'));

and call it with the following format
>> ans([1 2], [1 9; 2 5; 16 8])
ans =
     3

You can try it online.

If the result can be in logical indexing (0 indicates not similar, 1 indicates similar): 38 bytes:
@(x,y)(max(x))*min(y')==min(x)*max(y')

Same example as above:
>> @(x,y)(max(x))*min(y')==min(x)*max(y')
ans =
    @(x,y)(max(x))*min(y')==min(x)*max(y')

>> ans([1 2], [1 9; 2 5; 16 8])
ans =
 0     0     1

Brachylog, 14 bytes
z{iXhpᵐ/ᵛ∧Xt}ᵘ

Try it online!
Takes input as a list containing a list containing the main rectangle and the list of other rectangles (so test case 1 is [[[1,2]],[[1,2],[2,4]]]), and outputs a list of 0-based indices through the output variable.
z                 Zip the elements of the input, pairing every "other" rectangle with the main rectangle.
 {          }ᵘ    Find (and output) every unique possible output from the following:
  iX              X is an element of the zip paired with its index in the zip.
    h             That element
      ᵐ           with both of its elements
     p            permuted
        ᵛ         produces the same output for both elements
       /          when the first element of each is divided by the second.
         ∧Xt      Output the index.

If that sort of odd and specific input formatting is cheating, it's a bit longer...
Brachylog, 18 bytes
{hpX&tiYh;X/ᵛ∧Yt}ᶠ

Try it online!
Takes input as a list containing the main rectangle and the list of other rectangles (so test case 1 is the more obvious [[1,2],[[1,2],[2,4]]]), and outputs a list of 0-based indices through the output variable.
{               }ᵘ    Find (and output) every possible output from the following:
  p                   A permutation of
 h                    the first element of the input
   X                  is X,
    &                 and
      i               a pair [element, index] from
     t                the last element of the input
       Y              is Y,
        h             the first element of which
            ᵛ         produces the same output from
           /          division
         ;            as
          X           X.
             ∧Yt      Output the index.

To determine if two width-height pairs represent similar rectangles, it just takes the four bytes pᵐ/ᵛ (which outputs the shared ratio or its reciprocal). All the rest is handling the multiple rectangles to compare, and the output being indices.

dzaima/APL, 7 bytes
=/⍤÷⍥>¨

Try it online!
8 bytes outputting a list of indices instead of a boolean vector
      ¨ for each (pairing the left input with each of the right)
    ⍥>    do the below over sorting the arguments
=/          equals reduce
  ⍤         after
   ÷        vectorized division of the two

Although it's a nice answer, we have to output the indices. So your TIO test case should result in either [0,1,4] or [1,2,5] (not sure if your language is 0- or 1-indexed). It would have been a better challenge imho if all three output-formats are allowed: indices; filter to keep the truthy values; list of truthy/falsey values (like you have now), instead of only allowed indices.

@KevinCruijssen "You may choose [...] the exact format and order of the output." in APL it's very common practice to store indices as a boolean vector, but you're right, that probably should be clarified.

Well, I read "You may choose whether the indices are 0- or 1-based, as well as the exact format and order of the output." as it can be [0,1,4], [1,2,5], 4\n0\n1, 5 2 1, etc. etc., since it still stated indices. But I've asked OP to clarify (if they response, since it's a 4 year old challenge). In my 05AB1E answer it would mean 14 bytes if the indices are mandatory vs 8 bytes if either of the other two options are allowed. Regardless, I upvoted your answer. :)

Haskell, 75 bytes
import Data.List
a(x,y)=max x y/min x y
s r=elemIndices(True).map((==a r).a)

56 bytes

54 bytes

PowerShell, 58 56 bytes
-2 bytes thanks to mazzy x2

param($x,$y,$b)$b|%{($i++)[$x/$y-($z=$_|sort)[0]/$z[1]]}

Try it online!
This slightly abuses the input may be however you desire clause by having the first shape's components come separately to save 3 bytes.
PowerShell, 61 59 bytes
param($a,$b)$b|%{($i++)[$a[0]/$a[1]-($x=$_|sort)[0]/$x[1]]}

Try it online!
Uses conditional indexing to swap between the current zero-based index and null based on whether or not the ratios line up. Luckily in this case, $i increments regardless of it being printed or not.

You can save more if you use - instead -ne.

PowerShell, 57 bytes
$args|%{$x,$y=$_|sort
($i++)[$r-$y/$x]
if(!$r){$r=$y/$x}}

Try it online!
Indices are 1-based.

Javascript (ES6), 75
(a,b)=>b.filter(e=>e.l*a.h==a.l*e.h||e.l*a.l==a.h*e.h).map(e=>b.indexOf(e))

Alternative, also 75
(a,b)=>b.map((e,i)=>e.l*a.h==a.l*e.h||e.l*a.l==a.h*e.h?i:-1).filter(e=>e+1)

Input is taken as a JSON object, and an array of JSON objects
{
    l: length of rectangle,
    h: height of rectangle
}

I don't think this works with the second test case.

@kirbyfan64sos sorry didn't see that part. It's fixed (but I'm sure I can golf it more)

These are not JSON objects, these are plain javascript objects. JSON is a data transfer format.

05AB1E, 15 14 bytes
ʒ‚ε{ü/}Ë}J¹Jsk

Try it online or verify all test cases.
Explanation:
ʒ               # Filter the (implicit) input-list by:
 ‚              #  Pair the current width/height with the (implicit) input width/height
  ε             #  Map both width/height pairs to:
   {            #   Sort from lowest to highest
    ü/          #   Pair-wise divide them from each other
      }Ë        #  After the map: check if both values in the mapped list are equals
        }J      # After the filter: join all remaining pairs together to a string
          ¹J    # Also join all pairs of the first input together to a string
            s   # Swap to get the filtered result again
             k  # And get it's indices in the complete input-list
                # (which is output implicitly)

The Joins are there because 05AB1E can't determine the indices on multidimensional lists a.f.a.i.k.

If outputting the width/height pairs that are truthy, or outputting a list of truthy/falsey values based on the input-list, it could be 8 bytes instead:
ʒ‚ε{ü/}Ë

Try it online or verify all test cases.
ε‚ε{ü/}Ë

Try it online or verify all test cases.

Uiua, 10 bytes
⊚↥∩/=⊃×÷⊙⍉

Try it online!
-2 if I can take the second input transposed.
⊚↥∩/=⊃×÷⊙⍉    input: a shape S, a list of shapes M (2d matrix with two columns)
          ⊙⍉    transpose the 2nd input
      ⊃×÷        fork(mul, div): take S and M and give S*M and S/M
                  the operations are done between each item of S and each row of M
   ∩/=            both(reduce by equal): for each of the two matrices,
                  compare the two rows elementwise and give 1 when equal
                  for similar shapes, * gives 1 if in reverse order, / otherwise
  ↥               boolean OR of the two vectors
⊚                vector of indices of ones


text:
Argyle ASCII Art
Write a program (or function) that takes in a positive integer.
If the input is 1, print (or return) two diamonds neighboring side-by-side, each with a side length of 1 slash:
/\/\
\/\/

For every input N greater than 1, look at the output for N-1 and for each pair of neighboring diamonds, insert a new diamond in between them whose side length is the sum of the side lengths of the two neighbors. Print (or return) this new diamond pattern.
So when 2 is input, we look at the output for 1 and can see that there are two neighboring diamonds, both with side length 1. So we insert a side length 2 (1+1) diamond in between them:
   /\
/\/  \/\
\/\  /\/
   \/

For input 3 we look at the output for 2 and add two diamonds with side length 3 (1+2 and 2+1) in between the two pairs of neighboring diamonds:
    /\        /\
   /  \  /\  /  \
/\/    \/  \/    \/\
\/\    /\  /\    /\/
   \  /  \/  \  /
    \/        \/

Continuing the pattern, the output for 4 is:
                    /\            /\
     /\            /  \          /  \            /\
    /  \    /\    /    \        /    \    /\    /  \
   /    \  /  \  /      \  /\  /      \  /  \  /    \
/\/      \/    \/        \/  \/        \/    \/      \/\
\/\      /\    /\        /\  /\        /\    /\      /\/
   \    /  \  /  \      /  \/  \      /  \  /  \    /
    \  /    \/    \    /        \    /    \/    \  /
     \/            \  /          \  /            \/
                    \/            \/

And so on.
Your outputs may have trailing spaces on any lines but only up to one trailing newline (and no leading newlines).
The shortest code in bytes wins.

Relevant OEIS: https://oeis.org/A002487.

Pyth, 50 49 bytes
L.rR"\/"_bjbyK.tsm+Jm+*\ k\\dyJu.iGsM.:G2tQjT9djK

Demonstration
Explanation:
L.rR"\/"_bjbyK.tsm+Jm+*\ k\\dyJu.iGsM.:G2tQjT9djK
                                                     Implicit:
                                                     Q = eval(input())
                                                     T = 10
                                                     d = ' '
                                                     b = '\n'
L                                                    def y(b): return
 .rR"\/"                                             Swap \ and / in
        _b                                           reversed input.
                                                     This effectively vertically
                                                     mirrors the input.
                               u                     Apply the function repeatedly
                                           jT9       Starting with [1, 1]
                                         tQ          and repeating Q - 1 times
                                .iG                  interlace G (input) with
                                     .:G2            All 2 element substrings of G
                                   sM                mapped to their sums.
                 m                                   map over these values
                                                     implicitly cast to ranges
                    m       d                        map over the range values
                                                     impicitly cast to ranges
                     +*\ k\\                         to k spaces followed by
                                                     a backslash.
                   J                                 Save to J, which is roughly:
                                                     \
                                                      \
                  +          yJ                      And add on y(J), giving
                                                     \
                                                      \
                                                      /
                                                     /
                s                                    Combine the half diamonds
                                                     into one list.
              .t                              d      Traspose, filling with ' '.
             K                                       Save to K, giving
                                                     something like:
                                                     \  /
                                                      \/
            y                                        Vertically mirror.
          jb                                         Join on newlines and print.
                                               jK    Join K on (implicitly)
                                                     newlines and print.

What are the odds? I also exactly have u.iGsM.:G2tQjT9 in my (partial) solution. I never looked at your answer...

@orlp There's often only one best way to do something.

Common Lisp, 425
(labels((a(n)(if(> n 1)(loop for(x y)on(a(1- n))by #'cdr collect x when y collect(+ x y))'(1 1))))(lambda(~ &aux(l(a ~))(h(apply'max l))(w(*(apply'+ l)2))(o(* 2 h))(m(make-array(list o w):initial-element #\ ))(x 0)(y h))(labels((k(^ v)(setf(aref m y x)^(aref m(- o y 1)x)v)(incf x))(d(i)(when(plusp i)(k #\\ #\/)(incf y)(d(1- i))(decf y)(k #\/ #\\))))(mapc #'d l))(dotimes(j o)(fresh-line)(dotimes(i w)(princ(aref m j i))))))

Example
(funcall *fun* 4)

                    /\            /\
     /\            /  \          /  \            /\
    /  \    /\    /    \        /    \    /\    /  \
   /    \  /  \  /      \  /\  /      \  /  \  /    \
/\/      \/    \/        \/  \/        \/    \/      \/\
\/\      /\    /\        /\  /\        /\    /\      /\/
   \    /  \  /  \      /  \/  \      /  \  /  \    /
    \  /    \/    \    /        \    /    \/    \  /
     \/            \  /          \  /            \/
                    \/            \/

Ungolfed
(labels
    ((sequence (n)
       (if (> n 1)
           (loop for(x y) on (sequence (1- n)) by #'cdr
                 collect x
                 when y
                   collect(+ x y))
           '(1 1))))
  (defun argyle (input &aux
                  (list (sequence input))
                  (half-height (apply'max list))
                  (width (* (apply '+ list) 2))
                  (height (* 2 half-height))
                  (board (make-array
                          (list height width)
                          :initial-element #\ ))
                  (x 0)
                  (y half-height))
    (labels ((engrave (^ v)
               (setf (aref board y              x) ^ ;; draw UP character
                     (aref board (- height y 1) x) v ;; draw DOWN character (mirrored)
                     )
               (incf x) ;; advance x
               )
             (draw (i)
               (when (plusp i)
                 (engrave #\\ #\/)  ;; write opening "<" shape of diamond
                 (incf y)
                 (draw (1- i))   ;; recursive draw
                 (decf y)
                 (engrave #\/ #\\)  ;; write closing ">" shape of diamond
                 )))
      ;; draw into board for each entry in the sequence
      (mapc #'draw list))

    ;; ACTUAL drawing
    (dotimes(j height)
      (fresh-line)
      (dotimes(i width)
        (princ (aref board j i))))
    board))

CJam, 59 58 57 bytes
YXbri({{_2$+\}*]}*:,_:|,S*0'\tf{fm>_W%'\f/'/f*}:+zN*_W%N@

Thanks to @MartinBüttner for golfing off 1 byte.
Try it online in the CJam interpreter.
Idea
For input 3, for example, we generate
\
/
\
 \
  \
  /
 /
/
\
 \
 /
/
\
 \
  \
  /
 /
/
\
/

by rotating the string   \ and replacing some backslashes with slashes.
Then, we zip the resulting array (transpose rows and columns) to obtain the lower half of the desired output.
The upper half is byte per byte equal to the lower half in reverse.
Code
YXb     e# Push A := [1 1] and 2 in unary.
ri(     e# Read an integer fro STDIN and subtract 1.
{       e# Do the following that many times:
  {     e#   For each I in A but the first:
    _2$ e#     Push a copy of I and the preceding array element.
    +\  e#     Compute the sum of the copies and swap it with I.
  }*    e#
  ]     e#   Collect the entire stack in an array.
}*      e#
:,      e# Replace each I in A with [0 ... I-1].
_       e# Push a copy of A.
:|      e# Perform set union of all the ranges.
,S*     e# Get the length (highest I in A) and push a string of that many spaces.
0'\t    e# Replace the first space with a backslash.
f{      e# For each range in A, push the generated string; then:
  fm>   e#   Rotate the string by each amount in the array.
  _W%   e#   Push a reversed copy of the resulting array of strings.
  '\f/  e#   In each string, split at backslashes.
  '/f*  e#   Join each string, separating with slashes.
}       e#
:+      e# Concatenate the resulting arrays of strings.
zN*     e# Zip and join, separating by linefeeds.
_W%     e# Push a reversed copy of the string.
N@      e# Push a linefeed and rotate the original string on top of it.

Rev 1: Ruby 170
New method avoiding creating the big diamond and reducing.
->n{a=[1]
m=1<<n-1
(m-1).times{|i|a<<a[i]<<a[i]+a[i+1]}
(-b=a.max).upto(b-1){|j|0.upto(m){|i|d=' '*q=a[-i]*2
(j*2+1).abs<q&&(d[j%q]=?\\;d[-1-j%q]=?/)
print d}
puts""}}

Rev 0: Ruby, 187
->n{a=[1]
m=1<<n-1
(m-1).times{|i|a<<a[i]<<a[i]+a[i+1]}
(2*b=a.max).times{|j|
0.upto(m){|i|d=' '*b*2;d[(b+j)%(b*2)]='\\';d[(b-1-j)%(b*2)]=?/
r=b-a[-i]
d.slice!(b-r,r*2)
print d}
puts ""}}

The sizes of the diamonds are calculated in accordance with the recurrence relation from https://oeis.org/A002487 Thus we make the array a containing all the elements for all the rows from 1 to n. We are only interested in the last  1<<n-1 elements (Ruby allows us to get them from the array using negative indexes, -1 being the last element in the array), plus an inital 1 from position 0.
Line by line and diamond by diamond, we draw the row of characters for the biggest diamond, then cut out the middle columns to get the row for the required diamond. Rev 1 is shorter, but I liked this method.
Modular arithmetic is used to wrap around so that the same expression adds all / directly and likewise one expression adds all \ directly.
Ungolfed in test program
f=->n{
  a=[1]
  m=1<<n-1
  (m-1).times{|i|a<<a[i]<<a[i]+a[i+1]}                   #concatenate a[i] and a[i]+a[i+1] to the end of a
    (2*b=a.max).times{|j|                                #run through lines (twice the largest number in a
      0.upto(m){|i|                                      #run through an initial '1' plus the last m numbers in a
      d=' '*b*2;d[(b+j)%(b*2)]='\\';d[(b-1-j)%(b*2)]=?/  #d is the correct string for this line of the largest diamond
      r=b-a[-i]                                          #calculate number of characters to be deleted from middle of d
      d.slice!(b-r,r*2)                                  #and delete them
      print d                                            #print the result
    }
    puts ""                                              #at the end of the line, print a newline
  }
}

f.call(gets.to_i)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Solve a traffic intersection
The task
Write a program or function that takes a traffic intersection structure and outputs the sequence, in which vehicles will pass.
The output should contain at most four lines with the following format #. x->y\n, where # is a sequence number number, followed by the dot ., x and y are characters ["N", "E", "S", "W"]. They should be separated by characters ->. If you do not return an array of strings, each line must end with a \n (new line character) or equivalent to your system.
The input should take the following form:

Part 1: four characters, each having the destination road for the source roads in order N, E, S, W (clockwise). The allowed characters are N, S, W, E or . Space means that there is no vehicle on particular road. For example string S WE means, that N vehicle wishes to go South, space means that there is no E vehicle, W means that S wishes to go West, E means West wishes to go East.
Part 2 - a space or a single letter meaning which one is of the emergency vehicle.
Part 3 - two characters determining which two roads have priority (eg. NE means that North and East both have higher priorities than both South and West). If it is easier for you, you may take lower priority roads (in that case SW).

In an unsolvable situation you are allowed to return a one-line string which is clear to the user, like unsolvable, no solution and similar. JavaScript users may take built-in undefined constant.
This is a code-golf, so the shortest answer in bytes wins.
The rules of traffic
Please note that some of the rules may not follow your country traffic rules. Some of them have been simplified to make the challenge easier. Do not use this question as a guide for real life traffic system.

For the challenge you are allowed to use only right-side traffic.
The traffic intersection consists of exactly four roads which meet in one point. They are marked N (as for "North"), S, W, E. These letters should be used instead of x and y in the output example above.

On each road there is at most one vehicle. It is not guaranteed that there is a vehicle on each road. Each vehicle can drive in any of four directions, ie. turn left, turn right, go straight or make a U-turn.

If paths of two vehicles do not intersect (they do not collide), they can go at the very same moment. Paths do not collide, if two vehicles (the list might not be complete, but this is intentional, just to give you a clue):

come from opposite directions and both go straight, or at least one of them turns right,
come from opposite directions and both turn left,
come from opposite directions and one of them turns in any direction or makes the U-turn, while the other makes the U-turn,
come from orthogonal directions, the one to the left is turning right and the other does not make the U-turn

Some examples of not colliding paths below. Please note that on the third drawing any path of N would collide with the path of E, even if N makes a U-turn.

If two paths collide, it is necessary to use other rules. If two vehicles are on the same priority road (see below), the right of way is given to the vehicle that:

is comes from the road on the right side, if they come from orthogonal directions
turns right if the other turns left
goes straight or turns right if the other makes a U-turn.

In both examples below the E vehicle has right of way over the vehicle S.

In the example below first goes W, then N, then E and last goes S.

For this particular case the output of your program should be:

1. W->S
2. N->S
3. E->S
4. S->S

All drivers use turn signals and know where all others want to go to (for simplicity we assume that it is possible to distinguish between the left turn and the U-turn).
Sometimes roads are given priority signs, which are more important that the rules above. A road with higher priority has a priority sign (priority sign image). If the priority road does not go straight, also additional signs are used, like this one. The roads with lower priority have a yield sign or a stop sign (they are equivalent). None or exactly two different roads will have higher priority. The user of your program should be able to enter which roads have higher (or lower) priorities.
A vehicle that comes from the road with higher priority has the right of way over a vehicle coming from lower priority road, even if it is on its left side.
If paths of two vehicles coming from the roads with the same priority collide, above right-side rules are active.

On the example below roads S and W have priority signs, which means that vehicles on N and E should give them the way. The S vehicle has the priority over the W vehicle, because it is on its right side, so goes first. Then goes W, because it is on the road of higher priority than E. The vehicle N has right of way from E, because it is on its right side. As the last goes E.

For this particular case the output of your program should be:

1. S->W
2. W->N
3. N->S
4. E->W

It is possible that one (and no more) vehicle is an emergency vehicle, which has the priority regardless to which direction it comes from or goes to, and what sign it has (it always goes first). The program should allow the user to enter, which vehicle is an emergency vehicle. Considering that on the last example N is an emergency vehicle, N goes first, then S, W and as the last E.

For this particular case with an emergency vehicle at N the output of your program should be:

1. N->S
2. S->W
3. W->N
4. E->W

If two vehicles are allowed to go at the very same moment (their paths do not collide and they do not have to give way to other vehicles), your program should find this out and return them as having the same sequence number

On the example below paths of N and E as well as E and S or W and E do not collide. Because S has to give way to N and W give way to S, S cannot go simultaneously with E, etc. The N and E can. So at first N and E go together, than goes S, and W as the last.

The proper output of your program should be:

1. N->W
1. E->E
2. S->W
3. W->N

You are free to choose the order of lines 1 (N->W / E->E is equivalent to E->E / N->W)

Sometimes the traffic may lead to unsolvable situation, that does not allow any vehicle to go. In real life it is solved when one of the drivers voluntarily resigns from his right of way. Here, your program should output unsolvable etc., as mentioned in the first part of the question.

Below is an example of unsolvable situation. E should give way to W, W should give way to S, and S should give way to E.

I think a consistent input format should be defined. "The input can have any structure you like" is a big red flag. Can the input be the solution?

@Calvin'sHobbies I have updated the question

Any chance we could get an example input/output for 1-2 cases?

So the question (and I'm assuming solution) assume that the road(s) in question are right-hand-drive?

This is exactly how Google Cars work

Q, 645 Bytes
r:{(1_x),*x}                                                    /rot
R:{x 3,!3}                                                      /-rot
A:4 4#/:@[16#0;;:;]'[(&0100011001111100b;&0001111101100010b;&0010001111000100b;0);(&0 6 2;&0 1 7;&0 3 3;0)]
K:,/{,'/A x}'3 R\3 0 2 1                                        /Konflick matrix
G:3 R\|E:"NESW"                                                 /E:NESW  G:WSEN NWSE ENWS SENW
m:{x-y*_x%y}                                                    /mod
t:{1=+/m'[_x%4;2]}                                              /orthogonal
w:{-1($x),". ",y[0],"->",y 1;}                               /write
b:{_x%4}                                                        /n-> base dir.
g:m[;4]                                                         /n-> turn
e:(!4)in                                                        /exists
d:{s:r a:e b x;R s&~a}                                       /right free
I:{(G[a]?x 1)+4*a:E?*x}                                         /"dd"->n
O:{E[a],G[a:b x]g x}                                            /n-> "dd"
P:{N::(y=4)&z~4 4;a@&0<a:(@[4#0;b x;:;4-g x])+(5*d x)+(24*e z)+99*e y}          /priority
H:{a::K ./:/:x,/:\:x; if[N&2 in *a;:,0N]; x@&{~|/x[;z]'y}[a]'[!:'u+1;u:!#x]}    /each set of concurrent movements
f:{i:I'(E,'a)@&~^a:4#x; i:i@p:>P[i;E?x 4;E?x 5 6]; {0<#x 1}{a:H x 1;$[a~,0N;-1"unsolvable";w[*x]'O'a];$[a~,0N;(0;());(1+*x;x[1]@&~x[1] in a)]}/(1;i);}

COMMENTS
Definitively, it's not short (nor simple) code. It can be (severely) compacted, but it's left as excercise to the reader (I've dedicated too much time to this problem).
I've included multiline commented solution, but assume newlines as 1 Byte and discard comments (from / to end of line) to count size
The main difficulty is to fully understand all rules. Early optimization of code length is incompatible with developing a solution for a complex problem. Nor bottom-up or top-down approach copes well with unreadable code.
Finally, I developed a decission table (conflict matrix) with 16 rows and 16 columns (for each direction combined with each possible turn). The values of the items are 0 (compatibility), 1 (preference for row), or 2 (preference for column). It satisfies all test, by I'm not sure that all possible situations are well covered
Source file must have k extension. Start interactive interpreter (free for non-commertial use, kx.com) and evaluate at prompt (as shown in 'test' paragraph)
TEST
q)f " WN    "
1. E->W
2. S->N

q)f " SW    "
1. E->S
2. S->W

q)f "SSSS   "
1. W->S
2. N->S
3. E->S
4. S->S

q)f "SWWN WS"
1. S->W
2. W->N
3. N->S
4. E->W

q)f "SWWNNWS"
1. N->S
2. S->W
3. W->N
4. E->W

q)f "WEWN   "
1. N->W
1. E->E
2. S->W
3. W->N

q)f " SWE   "
unsolvable

EXPLANATION
The base structure is the 'precedence matrix'
   N       E       S       W
   W S E N N W S E E N W S S E N W
NW 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
 S 0 0 0 0 0 1 1 0 0 0 1 1 2 2 2 2
 E 0 0 0 0 0 1 1 1 2 2 0 0 0 2 2 0
 N 0 0 0 0 2 2 0 0 0 2 0 0 0 0 2 0
EN 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0
 W 2 2 2 2 0 0 0 0 0 1 1 0 0 0 1 1
 S 0 2 2 0 0 0 0 0 0 1 1 1 2 2 0 0
 E 0 0 2 0 0 0 0 0 2 2 0 0 0 2 0 0
SE 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0
 N 0 0 1 1 2 2 2 2 0 0 0 0 0 1 1 0
 W 2 2 0 0 0 2 2 0 0 0 0 0 0 1 1 1
 S 0 2 0 0 0 0 2 0 0 0 0 0 2 2 0 0
WS 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0
 E 0 1 1 0 0 0 1 1 2 2 2 2 0 0 0 0
 N 0 1 1 1 2 2 0 0 0 2 2 0 0 0 0 0
 W 2 2 0 0 0 2 0 0 0 0 2 0 0 0 0 0

Meaning (by example)

m[NW][SE] has 0 value (both movements are compatible -concurrent-)
m[EW][SN] has 1 value (EW has priority over SN) NOTE.- other priority factors may alter this sentence (emergency vehicles, priority road, ..)
m[NE][SE] has 2 value (SE has priority over NE) NOTE.- other priority factors may alter this sentence (emergency vehicles, priority road, ..)

The matrix can be constructed using four submatrix (4x4) types
  NESW  A    B    C    D
N DACB  0100 0001 0010 0000
E BDAC  0110 2222 0011 0000
S CBDA  0111 0220 2200 0000
W ACBD  2200 0020 0200 0000

The matrix is complemented with a function that assigns a priority to each movement. That function takes account of emergency vehicles, priority roads, orthogonal directions, type of turn and vehicles 'comming from right'
We sort movements by priority and applies matrix values. The resulting submatrix includes conflicts and priority of each movement.

we analyze unsolvable cases (mutual conflicts)
if not, we select most priority item and all movements compatible with it and not incompatible with previous incompatible movements, and create a set of movements allowed to go simultaneously
Write that set of movements and iterate over the rest of candidates

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Cardinals and ordinals, 1 to 100
Here's a simple one to stretch your compression muscles. Your code (a complete program) must output the spelled-out English representation of all the cardinal numbers from 1 to 100, and then all the ordinal numbers from 1 to 100. The numerals in each list should be delimited by commas and spaces and properly hyphenated. Each list should begin with a single capital letter and conclude with a period. The two lists should be separated by a newline.
For clarity's sake, you must produce this exact byte stream:
One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty-one, twenty-two, twenty-three, twenty-four, twenty-five, twenty-six, twenty-seven, twenty-eight, twenty-nine, thirty, thirty-one, thirty-two, thirty-three, thirty-four, thirty-five, thirty-six, thirty-seven, thirty-eight, thirty-nine, forty, forty-one, forty-two, forty-three, forty-four, forty-five, forty-six, forty-seven, forty-eight, forty-nine, fifty, fifty-one, fifty-two, fifty-three, fifty-four, fifty-five, fifty-six, fifty-seven, fifty-eight, fifty-nine, sixty, sixty-one, sixty-two, sixty-three, sixty-four, sixty-five, sixty-six, sixty-seven, sixty-eight, sixty-nine, seventy, seventy-one, seventy-two, seventy-three, seventy-four, seventy-five, seventy-six, seventy-seven, seventy-eight, seventy-nine, eighty, eighty-one, eighty-two, eighty-three, eighty-four, eighty-five, eighty-six, eighty-seven, eighty-eight, eighty-nine, ninety, ninety-one, ninety-two, ninety-three, ninety-four, ninety-five, ninety-six, ninety-seven, ninety-eight, ninety-nine, one hundred.
First, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty-first, twenty-second, twenty-third, twenty-fourth, twenty-fifth, twenty-sixth, twenty-seventh, twenty-eighth, twenty-ninth, thirtieth, thirty-first, thirty-second, thirty-third, thirty-fourth, thirty-fifth, thirty-sixth, thirty-seventh, thirty-eighth, thirty-ninth, fortieth, forty-first, forty-second, forty-third, forty-fourth, forty-fifth, forty-sixth, forty-seventh, forty-eighth, forty-ninth, fiftieth, fifty-first, fifty-second, fifty-third, fifty-fourth, fifty-fifth, fifty-sixth, fifty-seventh, fifty-eighth, fifty-ninth, sixtieth, sixty-first, sixty-second, sixty-third, sixty-fourth, sixty-fifth, sixty-sixth, sixty-seventh, sixty-eighth, sixty-ninth, seventieth, seventy-first, seventy-second, seventy-third, seventy-fourth, seventy-fifth, seventy-sixth, seventy-seventh, seventy-eighth, seventy-ninth, eightieth, eighty-first, eighty-second, eighty-third, eighty-fourth, eighty-fifth, eighty-sixth, eighty-seventh, eighty-eighth, eighty-ninth, ninetieth, ninety-first, ninety-second, ninety-third, ninety-fourth, ninety-fifth, ninety-sixth, ninety-seventh, ninety-eighth, ninety-ninth, one hundredth.

This is code golf, shortest answer in bytes wins.

Common Lisp, 88 82 80 bytes
(format t"~@(~{~R~^, ~}~).
~:*~@(~{~:R~^, ~}~)."(loop as i to 99 collect(1+ i)))

(It is part of the language, I hope you don't mind)
Output
One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty-one, twenty-two, twenty-three, twenty-four, twenty-five, twenty-six, twenty-seven, twenty-eight, twenty-nine, thirty, thirty-one, thirty-two, thirty-three, thirty-four, thirty-five, thirty-six, thirty-seven, thirty-eight, thirty-nine, forty, forty-one, forty-two, forty-three, forty-four, forty-five, forty-six, forty-seven, forty-eight, forty-nine, fifty, fifty-one, fifty-two, fifty-three, fifty-four, fifty-five, fifty-six, fifty-seven, fifty-eight, fifty-nine, sixty, sixty-one, sixty-two, sixty-three, sixty-four, sixty-five, sixty-six, sixty-seven, sixty-eight, sixty-nine, seventy, seventy-one, seventy-two, seventy-three, seventy-four, seventy-five, seventy-six, seventy-seven, seventy-eight, seventy-nine, eighty, eighty-one, eighty-two, eighty-three, eighty-four, eighty-five, eighty-six, eighty-seven, eighty-eight, eighty-nine, ninety, ninety-one, ninety-two, ninety-three, ninety-four, ninety-five, ninety-six, ninety-seven, ninety-eight, ninety-nine, one hundred.
First, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty-first, twenty-second, twenty-third, twenty-fourth, twenty-fifth, twenty-sixth, twenty-seventh, twenty-eighth, twenty-ninth, thirtieth, thirty-first, thirty-second, thirty-third, thirty-fourth, thirty-fifth, thirty-sixth, thirty-seventh, thirty-eighth, thirty-ninth, fortieth, forty-first, forty-second, forty-third, forty-fourth, forty-fifth, forty-sixth, forty-seventh, forty-eighth, forty-ninth, fiftieth, fifty-first, fifty-second, fifty-third, fifty-fourth, fifty-fifth, fifty-sixth, fifty-seventh, fifty-eighth, fifty-ninth, sixtieth, sixty-first, sixty-second, sixty-third, sixty-fourth, sixty-fifth, sixty-sixth, sixty-seventh, sixty-eighth, sixty-ninth, seventieth, seventy-first, seventy-second, seventy-third, seventy-fourth, seventy-fifth, seventy-sixth, seventy-seventh, seventy-eighth, seventy-ninth, eightieth, eighty-first, eighty-second, eighty-third, eighty-fourth, eighty-fifth, eighty-sixth, eighty-seventh, eighty-eighth, eighty-ninth, ninetieth, ninety-first, ninety-second, ninety-third, ninety-fourth, ninety-fifth, ninety-sixth, ninety-seventh, ninety-eighth, ninety-ninth, one hundredth.

Explanations
See Formatted Output to Character Streams.

(format t "<control string>" <arguments>) formats the control string according to the (variadic) arguments and prints to standard output (because t)

(loop ...) builds the list of integers from 1 to 100

~@( ... ~) capitalizes the string returned by the inner control string

~{ ... ~} iterates over the current argument and applies the inner formatting to each element

Inside the iteration, everything that follows ~^ is not printed on the last iteration: this is used to add the comma-space separator between elements.

~R outputs current argument as a cardinal

~:R outputs current argument as an ordinal

~% outputs a new line

~:* reset the current argument to be processed as the previous one, which is used here to reuse the list of integers a second time.

Saved 2 bytes thanks to PrzemysławP.

And I thought my 340-byte answer was impressive...

Your rep at this moment is pretty 1337! :D So, unfortunately, I cannot upvote this solution... :(

@Numeri You can upvote now.  ;)

Solutions shorted than the kolomogorov complexity of the input are always very impressive! Well done.

@DLosc It was just to good for me to break... :D

Two bytes can be saved if you change ~% to  and for to as.

Pyth, 366 342 340 bytes
Lcbdj=Y", "++rhJy"one two three four five six seven eight nine"3+tJ+y"ten eleven twelve"+=Nm+d"teen"=by"thir four fif six seven eigh nine"sm+dm++d\-kJKy"twenty thirty forty fifty sixty seventy eighty ninety"+=H"one hundred"\.jY+rh=J++y"first second third"m+d=T"th"tPby"ninth"3+++tJy"tenth eleventh twelfth"+m+dTNsm++Pd"ieth"m++d\-kJK+H"th."

Live demo.
342-byte version:
Lcbdj", "++rhJy"one two three four five six seven eight nine"3+tJ+y"ten eleven twelve"+=Nm+d"teen"=by"thir four fif six seven eigh nine"sm+dm++d\-kJKy"twenty thirty forty fifty sixty seventy eighty ninety"+=H"one hundred"\.j", "+rh=J++y"first second third"m+d"th"tPby"ninth"3+++tJy"tenth eleventh twelfth"+m+d"th"Nsm++Pd"ieth"m++d\-kJK+H"th."

366-byte version:
Lcbd
j", "++"One"+tJy"one two three four five six seven eight nine"+y"ten eleven twelve"+=Nm+d"teen"y"thir four fif six seven eigh nine"sm+dm++d\-kJKy"twenty thirty forty fifty sixty seventy eighty ninety"+=H"one hundred"\.
j", "+"First"+++t=Jy"first second third fourth fifth sixth seventh eighth ninth"y"tenth eleventh twelfth"+m+d"th"Nsm++Pd"ieth"m++d\-kJK+H"th."

PHP - 491 bytes
Small cheat here for the cardinals (I'm using the NumberFormatter class that comes default with PHP):
echo'One, ';$x=new NumberFormatter(0,5);for($i=1;$i++<100;)echo$x->format($i).($i>99?
'.':', ');echo"
";$y=[First,second,third,fourth,fifth,sixth,seventh,eighth,ninth,tenth,
eleventh,twelfth,thirteenth,fourteenth,fifteenth,sixteenth,seventeenth,eighteenth,nineteenth,
twentieth];for($z=[thirtieth,fortieth,fiftieth,sixtieth,seventieth,eightieth,ninetieth];
$j++<99;$q=floor($j/10),$w=$z[$q-2])echo$j<21?$y[$j-1]:($j%10?$x->format($q*10).'-'.
strtolower($y[$j%10-1]):$w),', ';echo'one hundredth.';

(added a few new lines for readability)

Warnings are generally allowed, remove all the @ (-4 bytes). Use a newline instead of writing \n (-1 byte). Put the definition of $z into the initialisation of the second for loop (-1 byte).

Save 6 bytes by using the procedural method instead of the object-oriented constructor

PHP 5.3+, 195 bytes
That includes the newline character.
It's part of the NumberFormatter class, just like razvan's answer. Except I spell out both the cardinals and ordinals according to the ICU.
$f=numfmt_create(en,5);$g=clone$f;$g->setTextAttribute(6,'%spellout-ordinal');for($x=$y='',$i=1;$i++<100;){$x.=$f->format($i).($z=$i<=99?', ':'');$y.=$g->format($i).$z;}echo"One, $x.
First, $y.";

Related: https://stackoverflow.com/a/19411974/404623

Nice! I had no idea of the %spellout-ordinal format.

Oracle SQL 231 bytes
SqlFiddleLiveDemo
 SELECT 'O'||SUBSTR(LISTAGG(TO_CHAR(TO_DATE(level,'j'),'jsp'),', ')WITHIN GROUP(ORDER BY level),2)||'.','F'||SUBSTR(LISTAGG(TO_CHAR(TO_DATE(level,'j'),'jTHSP'),', ')WITHIN GROUP(ORDER BY level),2)||'.' FROM DUAL CONNECT BY level<101

JavaScript ES6, 562 464 bytes
Not even done golfing yet!
n=>(f=(a,b)=>Array(89).fill(a=btoa(a+`·§·,í*íË7èº»rÍø·,ìrÎÇ¯z{rÍè Ü³)Þ·,ó`).split`z`).map((l,i)=>i<1?b:i<20?a[i]:a[18+(i-i%10)/10]+'-'+a[i%10]).join`, `+', one hundred')(`¢w³·
3¶Þ{7èº¼ß÷³²,s±ëÞ7¢s)ÞÎ×§Íé^½éó·¥½ìí*íyéó~«µç§Íøµç§ÎÈ±µç§ÎÇ¯z{^z|Þmyéó)Þµç§ÎÜÜ³¶«·,ß¢êíË7â~Ü³²,mË;½éíË7¢rÎx§µì³`,'One')+`
`+f(`~*ì·;rÝÎØbÜß¢êí7â~Øs²,m;½éí7¢Øs)Þ¶íz{aÍé^½éí;pz[Þ¶í*íyéí7èº»^z{aÍøµç§¶ì^z{aÎÇ¯z{^z{aÍè ×Øs)Þµç§¶ó`,'First')+'th'

If this doesn't work I might need to add a hexdump because of all the special characters Please let me know if this is the case and I'll get to you by tomorrow.
If they are any typos also let me know.
Code in pastebin (Tested on Safari Nightly)
Explanation
This may look like a bunch of garbled characters but it's actually pretty simple.
We start by generating the cardinals. This array is compressed using the btoa function.
['one', ..., 'eighteen', 'nineteen', 'twenty', 'thirty', ...,'ninety']

To loop through a "range" we use the following:
Now we generate an Array of length 89 using. The ... is what uncompresses the array
Array(89).fill(...)

Then map through it, i is the index:
.map((l,i)=>

Now for the condition, i < 1 or if it is the first item, we will use a capitalized version of one / first
i<1?b

Otherwise... if it is less than 20, we output eleven...nineteen
i<20?a[i]:

Otherwise... using (i-i%10)/10 we get the last digit of the number. We add 18 to it to compensate for 1..19. We add a - and then add the last digit, or i%10
Finally, we add 'one hundred' to the very end because we don't.
We repeat this for both types of numbers and separate with a newline

Tried with FireFox: the posted code is flawed. The code in pastebin is ok, but misses a period after the first hundred. Overall: great job| +1

What's with the special characters?

C++ 704 642 620 602
No library usage other than ostream operator<<() for char*s.
#include<iostream>
char*q,a[]="|one|two|three|four|five|six|seven|eight|ni&u$Il%*twel&bthirte$Q(P#tif#j)/#k'L#|)y#r*4#s'9rst&>cond*5d)zh)gh)U#V)Ch)2h(}#V09$m0M$I0]'g0k)B0|*I#}1A+4$01f+y1u$$|+/nty+(y*`#X*3y)p#V)Ly))y(dyC5~hundred)Oie1o#|1c#}*E#s*a#t*}$&+9#|+T#|+uth",b[448],*s=a,*t=b;int i,j,k;auto p(int k){for(s=b;k--;)while(*s++);return s;}int main(){for(;k=*s++;)if(k>98)*t++=k<'|'?k:" "[k<'~'];else for(i=(k-35)*95+*s++-32,q=t-i/9,k=3+i%9;k--;)*t++=*q++;for(j=0;j<2;++j)for(i=1;b[1+126*j]^=32*(i<3),k=i<20?i:i%10,i<101;++i)std::cout<<p(40+!k*j*11+i/10)<<"-"[!k|i<20]<<p(j*20+k)<<", \0.\n"+i/100*3;}

Live version.
With some whitespace and some comments:
#include <iostream>

// Encoded as literal characters or offset/length pairs for previous runs of characters, LZ like
char *q, a[] =
             "|one|two|three|four|five|six|seven|eight|ni&u$Il%*twel&bthirte$Q(P#tif#j)/"
             "#k'L#|)y#r*4#s'9rst&>cond*5d)zh)gh)U#V)Ch)2h(}#V09$m0M$I0]'g0k)B0|*I#}1A+4$01f+y1u$$|"
             "+/nty+(y*`#X*3y)p#V)Ly))y(dyC5~hundred)Oie1o#|1c#}*E#s*a#t*}$&+9#|+T#|+uth",
         b[448], *s = a, *t = b;

int i, j, k;

// Find the kth null separated string in array b
auto p(int k) {
    for (s = b; k--;)
        while (*s++)
            ;
    return s;
}

int main() {
    // Decode the compressed 'primitives' we use to build up the output.
    for (; k = *s++;)
        if (k > 98)
            *t++ = k < '|' ? k : " "[k < '~'];
        else
            for (i = (k - 35) * 95 + *s++ - 32, q = t - i / 9, k = 3 + i % 9; k--;) *t++ = *q++;

    // Loop twice over numbers 1-100, building up output from the 'primitives' in our array
    for (j = 0; j < 2; ++j)
        for (i = 1; b[1 + 126 * j] ^= 32 * (i < 3), k = i < 20 ? i : i % 10, i < 101; ++i)
            std::cout << p(40 + !k * j * 11 + i / 10) << "-"[!k | i < 20] << p(j * 20 + k)
                      << ", \0.\n" + i / 100 * 3;
}

The compressed string is decoded from a into b:
|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|
sixteen|seventeen|eighteen|nineteen||first|second|third|fourth|fifth|sixth|seventh|eighth|
ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|
eighteenth|nineteenth|||twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|one~
hundred|||twentieth|thirtieth|fourtieth|fiftieth|sixtieth|seventieth|eightieth|
ninetieth|one~hundredth;

Without the newlines. During decompression the |s are replaced with '\0' and the ~s are replaced with ' ' (quirk of the way the characters are encoded into printable ASCII). These 'primitive' strings are then looked up by index in the b array using the p function and used to assemble the output.
Compression is a simple LZ like scheme where characters are either encoded as literals or as a negative offset into the buffer and a run length (encoded into two characters) if a match of length >=3 is found. The string could be compressed further using non-printable characters but I like my code to be copy and paste safe :)

Vyxal Hoj, 98 bitsv2, 12.25 bytes
ɾ₍∆ċ∆oƛ‛, j¡\.+

Try it Online!
ɾ₍∆ċ∆oƛ‛, j¡\.+
ɾ                # H flag sets the stack to 100, so this makes a range [1,100]
 ₍               # Parallel apply the next two elements in a list
  ∆ċ∆o           # Nth Cardinal and Nth Ordinal (gotta love builtins)
      ƛ          # Map over the list of all cardinals and ordinals
       ‛, j      # Join by the two character string ", " where the second character is a space
           ¡\.+  # Convert to sentence case and add a period.
# Implicit output, the j flag prints the top of the stack joined by newlines, which formats the list of two strings into the desired output.

Created with the help of Luminespire.
Obviously non-competing.

Javascript (ES6), 713
Similar to my second PHP submission on this question. (2444 - 713) / 2444 = 70.8% compression.
a=`Onez]cu^dP~Ntenz\`zHlvezmwgwjwkw{wqwpwHnQxZx]xcxux^xdxPx~xNmQXZX]XcXuX^XdXPX~XNforQbZb]bcbub^bdbPb~bNjQWZW]WcWuW^WdWPW~WNkQVZV]VcVuV^VdVPV~VN{QUZU]UcUuU^UdUPU~UNqQTZT]TcTuT^TdTPT~TNpQSZS]ScSuS^SdSPS~SNy.
FirstzaRMLKJI[ten}\`}Hlf}mGgGjGkG{GqGpGHnYx_xaxRxMxLxKxJxIx[mYX_XaXRXMXLXKXJXIX[forYb_babRbMbLbKbJbIb[jYW_WaWRWMWLWKWJWIW[kYV_VaVRVMVLVKVJVIV[{YU_UaURUMULUKUJUIU[qYT_TaTRTMTLTKTJTIT[pYS_SaSRSMSLSKSJSIS[yth.`,'eleven|`}|`z|twe|q}|{}|k}|j}|g}|pz|{z|kz|gz|one hundred|tyz|mdz|qtz|p~|q~|{~|k~|j~|m~|tie}|onez|nin}|twoz|fivez|firstz|teen|threez|secondz|for~|four|fif|twen~|six|thir|nine|eigh|, |seven|th, |ty-'.split('|').map((e,i)=>a=a.split('`GwHIJKLMNPduyQR~STUVWXYZ[]^_`cabgjxkmpqz{}~'[i]).join(e)),alert(a)

Fiddle

Why was this downvoted?

Mathematica 415 391 407
The cardinals are given by IntegerName[n]. The ordinals are derived from the cardinals.
s = StringRiffle; y = IntegerName; t = StringReplace;
k@n_ := If[(z = (TextWords["first second third a fifth a a a ninth,a, a twelfth a a a a a eighteenth a, twentieth"])[[n]]) == "a", y@n <> "th", z]
g@n_ := Module[{i = IntegerDigits[n], z}, z := y[Quotient[n, 10]*10];Which[n == 100, "one hundredth", n < 20, k[n], i[[-1]] == 0, t[z, "y" -> "ieth"], 3 > 2, z <> "-" <> k[i[[-1]]]]]
t[(s[y@Range@100 /. "one" -> "One", ", "] <> ".") <> s[g /@ Range@100 /. "first" -> "\nFirst", ", "] <> ".", "tt" -> "t"]

Output:
One, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twenty-one, twenty-two, twenty-three, twenty-four, twenty-five, twenty-six, twenty-seven, twenty-eight, twenty-nine, thirty, thirty-one, thirty-two, thirty-three, thirty-four, thirty-five, thirty-six, thirty-seven, thirty-eight, thirty-nine, forty, forty-one, forty-two, forty-three, forty-four, forty-five, forty-six, forty-seven, forty-eight, forty-nine, fifty, fifty-one, fifty-two, fifty-three, fifty-four, fifty-five, fifty-six, fifty-seven, fifty-eight, fifty-nine, sixty, sixty-one, sixty-two, sixty-three, sixty-four, sixty-five, sixty-six, sixty-seven, sixty-eight, sixty-nine, seventy, seventy-one, seventy-two, seventy-three, seventy-four, seventy-five, seventy-six, seventy-seven, seventy-eight, seventy-nine, eighty, eighty-one, eighty-two, eighty-three, eighty-four, eighty-five, eighty-six, eighty-seven, eighty-eight, eighty-nine, ninety, ninety-one, ninety-two, ninety-three, ninety-four, ninety-five, ninety-six, ninety-seven, ninety-eight, ninety-nine, one hundred.
First, second, third, fourth, fifth, sixth, seventh, eighth, ninth, tenth, eleventh, twelfth, thirteenth, fourteenth, fifteenth, sixteenth, seventeenth, eighteenth, nineteenth, twentieth, twenty-first, twenty-second, twenty-third, twenty-fourth, twenty-fifth, twenty-sixth, twenty-seventh, twenty-eighth, twenty-ninth, thirtieth, thirty-first, thirty-second, thirty-third, thirty-fourth, thirty-fifth, thirty-sixth, thirty-seventh, thirty-eighth, thirty-ninth, fortieth, forty-first, forty-second, forty-third, forty-fourth, forty-fifth, forty-sixth, forty-seventh, forty-eighth, forty-ninth, fiftieth, fifty-first, fifty-second, fifty-third, fifty-fourth, fifty-fifth, fifty-sixth, fifty-seventh, fifty-eighth, fifty-ninth, sixtieth, sixty-first, sixty-second, sixty-third, sixty-fourth, sixty-fifth, sixty-sixth, sixty-seventh, sixty-eighth, sixty-ninth, seventieth, seventy-first, seventy-second, seventy-third, seventy-fourth, seventy-fifth, seventy-sixth, seventy-seventh, seventy-eighth, seventy-ninth, eightieth, eighty-first, eighty-second, eighty-third, eighty-fourth, eighty-fifth, eighty-sixth, eighty-seventh, eighty-eighth, eighty-ninth, ninetieth, ninety-first, ninety-second, ninety-third, ninety-fourth, ninety-fifth, ninety-sixth, ninety-seventh, ninety-eighth, ninety-ninth, one hundredth.

Some uncorrect eightth

You were right!  I now corrected them.

You could change "first" -> "\nFirst" to "fir" -> "\nFir" to save 4 bytes.

@LegionMamal978, Good suggestion but it won't work because we are replacing elements (words) in a list: "first" is an element in the list, but "fir" is not.  If we try to implement your suggestion after the list of elements is StringJoined, then "twenty-first ...thirty-first..." will become "twenty-First...thirty-First...".

JavaScript (ES6), 480

/*TEST: redirect console output to snippet body */ console.log=x=>O.innerHTML=x

// Not a function, as a complete program is requested
b=x=>btoa(x).split`/`;
Z=i=>z[i]||z[i-8]||z[i-18];
y=b("ýø«²ßìyÊ'wûa·ýøÿÿÞ)ÿÿûpzWÿÿÿÿÿÿÿ");
z=b("þÞþÜ(þØkyïß¢êÿ~+ÞþÈ±þÇ¯zÞmþx§{û^÷¥z÷§þÜ÷¿¶«ÿ÷âÿÿz(!ÿûpzÿ~ÿÿÿÿ");
o=(z.map((v,i)=>i<20?i<13?v:(v||z[i-10])+'teen':z[S='slice'](0,10).map(d=>Z(i)+(d?'ty-'+d:'ty')))+`,${h='one hundred'}.\nF`).split`,`;
q=y.map((v,i)=>i<4?v:`${v||o[i]}th`);
q=z.map((v,i)=>i<20?' '+q[i]:q[S](0,10).map(d=>' '+Z(i)+(d?'ty-'+d:'tieth')));
console.log('O'+o.join`, `[S](3)+`${q}, ${h}th.`[S](4))

// INFO: z uncompressed is [,one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve,thir,,fif,,,eigh,,twen,,for,,,,,]
// INCO: y uncompressed is [,first,second,third,,fif,,,eigh,nin,,,twelf,,,,,,,,,]
#O { white-space: pre-wrap }
<pre id=O></pre>

PHP - 842 bytes
Omitting regular PHP starting and ending tags, compression is 1 - 842/2445 = 65.6%
Basically getting the output of base64_encode(gzdeflate($input, 9)); and reversing the operations. Obviously, if I chose to output in pure 8-bit vs. base-64, it would be 25% smaller, but at the risk of running into escape or non-printable characters.
echo gzinflate(base64_decode('VZRdcuIwEITfcwoOQHKMfd1DBGnlKspUEYfEt1+rf2bGL6gbkLplS9/ftV0v28/j+BjPduj++H4en8vr0F/L7/HRXm29Xtryb2zXy7pgAr6585ftp93nv7exPLc2v5lrSC2d4lhKYk6ixJJQc1WqY7F12z2+P1gPmi2lWVaOnW1QXQY7sI6602k/ctrW3MHuUeHUekTUCqdTuMzyyl8YLq1wOofTMbw/kI2B0ZRIlvQrylxpxFIjVZKhNMqkUeTxdnYNioRkJKUiYXw2ekZCM5JSkTCOhGHkPAe7BkZSIlKSkTSMlPahdKQkI2kUSaNInLg9hGJlGGyjaFmF2zFeLu9GqSDrErKsgS93jywhjQ7WrCDHBjYoIIN863JFI12O4bhgu0eGSyPcmuFyDLdBuAzCrRkuVzAR4UfaZXyvt2e7fbz9WZ5feDafj/XGK3ATMQaPyuDrG36AQ3sZWHYOm769+/eJIEw0g7CWKOR1JUWiXL+VDGnzSGuv29JCzkeBLQRWtBOTCRsqZDrN7MVplxVPxXvPSajYoNoYOWxjzuRzLW0SVaeZvTi3KbwqPtoEsviIXcYcQhfTh1XMLr3oWsSzehrVKABL6xLBML9adRCY2EE4UgfBjB0CZnVWT+MOSbS00cFQ85liB5OKh1x8YgfTDR2SbnVWT+MrkIhL6w5BuTzMahHI0mV7nY5q4o5dCu7Os3u1p0tZO1XqjRP24l6xVnAMrQJeLBX8Q6fCv9PMXpwKVQgW7zrJwbjZbBNgQ5ugGdsEENGmAPE0sxenNpWKxReCtWxTyLiNj7f/'));

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/