text:
An Array of Challenges #1: Alternating Arrays
Alternating Arrays
An alternating array is a list of any length in which two (not necessarily different) values are alternating. That is to say, all even-indexed items are equal, and all odd-indexed items are equal.
Your task is to write a program or function which, when given a list of positive integers, outputs/returns truthy if it is alternating and falsy otherwise.
This is code-golf, so the shortest code (in bytes) wins!
Edge Cases:
[]      ->  True
[1]     ->  True
[1,1]   ->  True
[1,2,1] ->  True

Other Test Cases:
[1,2,1,2]      -> True
[3,4,3]        -> True
[10,5,10,5,10] -> True
[10,11]        -> True
[9,9,9,9,9]    -> True

[5,4,3,5,4,3]   -> False
[3,2,1,2,1,2]   -> False
[1,2,1,2,1,1,2] -> False
[2,2,3,3]       -> False
[2,3,3,2]       -> False

Example
Here is an example you can test your solution against, written in Python 3 (not golfed):
def is_alternating(array):
    for i in range(len(array)):
        if array[i] != array[i%2]:
            return False
    return True

What are the possible values of the elements of the array?

@RobertHickman a list of positive integers, within your language's standard int size

oh I see that in the question now. Oops and thanks.

Jelly, 4 bytes
ḣ2ṁ⁼

Try it online!
How it works
ḣ2ṁ⁼  Main link. Argument: A (array)

ḣ2    Head 2; truncate A after its second element. If A has two or less elements,
      this returns A itself.
  ṁ   Mold; cyclically repeat the elements of the previous result to create an
      array that has the same shape/length as A.
   ⁼  Test the result for equality with A.

Damn. And changing the 2 to other numbers immediately generalizes the challenge!

brainfuck, 34 bytes
,>,>+>,
[
  [<+<<->>>-]
  +<[-<<]
  >[>]
  ,
]
<.

Takes the array as byte values in a string, and outputs \x00 for false and \x01 for true.
Try it online.
This maintains the structure
a b 1 c
on the tape, where c is the current character, b is the previous character, and a is the previous previous character, as long as the array is alternating. If a mismatch is found, the pointer is moved to the left such that a, b, and the 1 flag all become zero, and this situation will continue until all the input is consumed.

R, 24 23 bytes
all((a=scan())==a[1:2])

Reads a vector into STDIN, takes the first two elements of that vector, and checks equality. If the lengths of a[1:2] and a don't match, R will loop through a[1:2] to match the length of a. It will give a warning about doing so, but it will work.
Surprisingly this even works for empty input, not sure why, but I'll roll with it.
Saved 1 byte thanks to @MickyT

you can save yourself a byte with all((a=scan())==a[1:2])

How do you input the data, as vector, list or just single numbers? I've tried typing single numbers on the console but I get the warning: "Warning message:
In scan() == a[1:2] :
longer object length is not a multiple of shorter object length". Though it works.

By typing single numbers indeed. It will throw a warning if the input length is odd, but it will still give the correct output.

MATL, 7 6 bytes
2YCs&=

For alternating arrays this outputs a non-empty matrix of ones, which is truthy. For non-alternating arrays the matrix contains at least one zero, and is thus falsy (see here).
Try it online! Or verify all test cases.
Explanation
Let's take [1 2 1 2] as example input.
2YC   % Implicit input. Build matrix whose columns are overlapping blocks of
      % length 2. If input has size less than 2 this gives an empty array
      % STACK: [1 2 1;
                2 1 2]
s     % Sum of each column. For an empty array this gives 0
      % STACK: [3 3 3]
&=    % Matrix of all pairwise equality comparisons. Implicit display
      % STACK: [1 1 1;
                1 1 1;
                1 1 1]

Nice algorithm! This would make a mean Jelly answer.

@Dennis Thanks! It was partly inspired by your Jelly approach

JavaScript (ES6), 27 bytes
a=>!a.some((v,i)=>a[i&1]-v)

Test cases

let f =

a=>!a.some((v,i)=>a[i&1]-v)

console.log(f([]));              // -> True
console.log(f([1]));             // -> True
console.log(f([1,1]));           // -> True
console.log(f([1,2,1]));         // -> True
console.log(f([1,2,1,2]));       // -> True
console.log(f([10,5,10,5,10]));  // -> True
console.log(f([10,11]));         // -> True
console.log(f([9,9,9,9,9]));     // -> True
console.log(f([5,4,3,5,4,3]));   // -> False
console.log(f([3,2,1,2,1,2]));   // -> False
console.log(f([1,2,1,2,1,1,2])); // -> False
console.log(f([2,2,3,3]));       // -> False
console.log(f([2,3,3,2]));       // -> False

Retina, 25 bytes
M`\b(\d+),\d+,(?!\1\b)
^0

Try it online!
Instead of matching an input with alternating values (which leads to some annoying edge effects in a regex), I'm matching inputs that aren't valid and then negate the result afterwards.
The benefit of matching an invalid input is that this is a property can be checked locally, and it doesn't need to treat empty or short input specially: any input is invalid if it contains two distinct values that are one position apart.
So the first stage counts the number of matches of \b(\d+),\d+,(?!\1\b) which matches and captures one value, then matches the next value, and then asserts that the third value in sequence is different. This gives zero for valid inputs and something positive for invalid values.
The second stage simply counts the number of matches of ^0 which is 1 if the first stage returned 0 and 1 otherwise.

Mathematica, 29 bytes
#=={}||Equal@@(Most@#+Rest@#)&

A port of Luis Mendo's MATL algorithm. Unnamed function taking a list of numbers (or even more general objects) and returning True or False. Tests whether sums of consecutive elements are all equal. Unfortunately Most and Rest choke on the empty list, so that has to be tested separately.
Mathematica, 33 bytes
Differences[#,1,2]~MatchQ~{0...}&

Unnamed function taking a list of numbers (or even more general objects) and returning True or False. The function Differences[#,1,2] takes the differences, not of consecutive pairs of integers, but pairs of integers at distance two apart. Then we just check whether the resulting list has nothing other than zeros in it.
As a bonus, for one more byte (change the 2 to #2), we get a function that inputs a list of integers and another positive integer #2, and checks whether the input list is the result of interleaving #2 constant sequences periodically with one another. For example,
Differences[#,1,#2]~MatchQ~{0...}&[{1,2,3,4,5,1,2,3,4,5,1,2},5]

evaluates to True.

Retina, 39 32 28 bytes
^(\d*)((,\d+)(,\1(\3|$))*)?$

Try it online!
Saved 7 bytes thanks to Martin! Saved another 3 thanks to Kobi! And to Kritixi for an idea for another 1.
We optionally match a number that occupies the entire input, any pair of numbers, or any pair of numbers followed by the same pair any number of times and optionally not including the second number at the very end. Could save 2 bytes if the input was in unary.

Another ^(\d+)?(.\d+)?(.\1\2)*(.\1)?$ 29 byte alternative. This does not match ,1,,1.

@Kobi Great idea, thanks! I used some of Kritixi's answer (the addition of the comma to the second capture group) to save another 1!

Haskell, 27 26 bytes
and.(zipWith(==)=<<drop 2)

This evaluates to an anonymous function that solves the challenge.
The idea is to drop the first two numbers from the list, zip with the original list using equality, and check that the result only contains Trues.
Try it online!
Thanks to nimi for 1 byte!

@Flp.Tkc It just needs a type hint

Nice. and.(zipWith(==)=<<drop 2) saves a byte.

Pyth, 9 bytes
q<*<Q2lQl

Explanation
q<*<Q2lQlQQ   Implicitly add enough Qs to make the code run

   <Q2        Take the first two elements of the input
  *   lQ      Repeat those len(input) times
 <      lQ    Take the first len(input) elements
q         Q   Check if those are equal to the input

you might want to update the code in the explanation (it's different atm)

@Flp.Tkc Pyth implicitly adds Qs to the code.  I added them in the explanation to make it clearer what was going on, but they aren't really in the code.

Perl 6,  49 43  42 bytes
{!grep {![==] @_},roundrobin |.rotor: 2,:partial}

Try it
{!.grep: ->\a,\b=$_[1] {sum .[0,1]Z!==a,b}}

Try it
{!.grep: ->\a,\b=.[1] {sum .[0,1]Z!==a,b}}

Try it
Expanded:
{
  !              # invert

  .grep:         # find any mismatches

  ->
    \a,
    \b = .[1]   # optional second parameter with default of second value from input
  {
    sum          # count up the values that don't match

    .[ 0, 1 ]    # the first two values from the input
    Z[![==]]     # zip not equal
    a, b         # the current two values under test.
  }
}

$_[1] can be one byte shorter as .[1]. The body of the inner lambda can be one byte shorter as {.[0]!=a||.[1]!=b}.

@smls I have no idea why I didn't see the .[1]. Also != doesn't seem to work if it isn't followed by a space. I think something like $_!=3 is being parsed as if it was written as !( $_ = 3 )

Ah. Looks like it's a Rakudo bug.

Java 8, 63 bytes
i->{int r=0,x=1;for(;++x<i.length;)r|=i[x]-i[x-2];return r==0;}

This is a lambda expression for a Predicate< int[ ] >
Explanation: initialize the result to 0. For each element, Biteise OR the result with the difference between the current element and the element 2 indicies earlier. return true if the result equals 0. Otherwise return false

Brachylog, 15 bytes
:{~c#Tbh#Co}f#=

Try it online!
Explanation
:{         }f       Find all results of the predicate below
             #=     They must all be equal

  ~c#T              Deconcatenate the input into three lists
      bh#C          The middle list has two elements
        #Co         Order that couple of elements as the output

APL, 7 bytes
⊢≡⍴⍴2⍴⊢

Explanation:

2⍴⊢: reshape the input array by 2
⍴⍴: reshape the result by the original size of the input, repeating elements
⊢≡: see if the result of that is equal to the original input

Test cases:
      true←(1 2 1 2)(10 5 10 5 10)(10 11)(9 9 9 9 9)
      false←(5 4 3 5 4 3)(3 2 1 2 1 2)(1 2 1 2 1 1 2)(2 2 3 3)(2 3 3 2)
      ( ⊢≡⍴⍴2⍴⊢ ) ¨ true
1 1 1 1
      ( ⊢≡⍴⍴2⍴⊢ ) ¨ false
0 0 0 0 0

Python 2, 35 bytes
lambda x:(x[:2]*len(x))[:len(x)]==x

Try it online!

Haskell, 33 32 bytes
f(a:x@(_:b:_))=a==b&&f x
f a=1<3

Try it online! or Verify the testcases. -1 byte thanks to Zgarb.

@Dennis The function works for [], but for some reason ghc cannot infer the correct type for []. It works if tested together with the other test case, see Verify the testcases.

Right, I don't know Haskell that well.

Save a byte with f(a:x@(_:b:_))=a==b&&f x

bash, 56 54 38 bytes
[ -z $3 ]||((($1==$3))&&(shift;$0 $*))

Save this as a script, and pass the list of numbers as arguments (for an n-element list, you'll pass n arguments). The output is the exit code: 0 (for true) if the list is alternating, and 1 (for false) otherwise.
(Returning output in the exit code is allowed in the PPCG standard I/O methods.)
This works recursively:

If the list has fewer than 3 elements, then exit with return code 0;
else if the 1st element != the 3rd element, then exit with return code 1;
else run the program recursively on the list with the first element removed.

Brachylog, 6 bytes
s₂ᶠoᵐ=

Try it online!
Explanation
Inspired by Luis Mendo's MATL answer:
s₂ᶠ     Find all length-2 sublists
   oᵐ   Sort each
     =  Assert that all sorted sublists are equal

J, 8 bytes
-:$$2&{.

Explanation
-:$$2&{.  input: (y)
    2&{.  the first two elements of y
   $      shaped like
  $       the shape of y
-:        and check if they match

Test cases
   f =: -:$$2&{.
   ]true =: '' ; 1 ; 1 1 ; 1 2 1 ; 1 2 1 2 ; 10 5 10 5 10 ; 10 11 ; 9 9 9 9 9
++-+---+-----+-------+------------+-----+---------+
||1|1 1|1 2 1|1 2 1 2|10 5 10 5 10|10 11|9 9 9 9 9|
++-+---+-----+-------+------------+-----+---------+
   f each true
+-+-+-+-+-+-+-+-+
|1|1|1|1|1|1|1|1|
+-+-+-+-+-+-+-+-+
   ]false =: 5 4 3 5 4 3 ; 3 2 1 2 1 2 ; 1 2 1 2 1 1 2 ; 2 2 3 3 ; 2 3 3 2
+-----------+-----------+-------------+-------+-------+
|5 4 3 5 4 3|3 2 1 2 1 2|1 2 1 2 1 1 2|2 2 3 3|2 3 3 2|
+-----------+-----------+-------------+-------+-------+
   f each false
+-+-+-+-+-+
|0|0|0|0|0|
+-+-+-+-+-+

You should be able to replace {. Take with $ Shape.

Jelly, 3 bytes
+ƝE

Try it online!
Ɲ was added after the challenge
How it works
+ƝE - Main link. Takes a list L on the left
 Ɲ  - Over overlapping pairs [x, y] in L:
+   -   Yield x+y
  E - Are all sums equal?

The sums will only be all equal iff all overlapping pairs are the same, ignoring order. This is only the case if the array is alternating, or if all elements are equal (which is alternating)

Python 2.7, 38 bytes
>> i=lambda a:(a[:2]*len(a))[0:len(a)]==a

Test Cases:
>> print i([1,2,1,2])
>> True
>> print i([10,5,10,5,10]
>> True
>> print i([5,4,3,5,4,3])
>> False
>> print i([3,2,1,2,1,2])
>> False

I'd call this a duplicate of this answer.

Ruby, 131 119 bytes
a=->x{!(x.values_at(*x.each_index.select{|i|i.even?}).uniq)[1]&!(x.values_at(*x.each_index.select{|i|i.odd?}).uniq[1])}

Lambda a expects an array x and returns true if there are 0 or 1 unique values for the odd indexed elements and 0 or 1 unique values for the even indexed elements in the array.
Notable byte-safers

use of lambda over def
!arr[1] vs. arr.length < 2
& vs &&

Test cases
p a[[]]
p a[[1]]
p a[[1,1]]
p a[[1,2,1]]
p a[[1,2,1,2]]
p a[[3,4,3]]
p a[[10,5,10,5,10]]
p a[[10,11]]
p a[[9,9,9,9,9]]

#false
p a[[5,4,3,5,4,3]]==false
p a[[3,2,1,2,1,2]]==false
p a[[1,2,1,2,1,1,2]]==false
p a[[2,2,3,3]]==false
p a[[2,3,3,2]]==false

C,  52   50   49  47 bytes
Thanks to @ceilingcat for golfing two bytes!
f(i,l)int*i;{return--l<2?1:*i-i[2]?0:f(++i,l);}

Outputs 1 if the array alternates, 0 otherwise.
Try it online!

You can save a byte by doing ?: in the first ternary.

Pyke, 6 bytes, noncompeting
2<Ql{q

Try it here!
2<     -   inp[:2]
    {  -  reshape(^, v)
  Ql   -   len(inp)
     q - ^ == inp

Allow reshape node to take a list as well as a string

Jelly, 6 bytes
My first Jelly program! I know I'll never beat Dennis, but I'm awfully proud of this regardless.
s2ZE€Ạ // Main link: Argument A (array)
s2     // Split A into chunks of 2
       // [1,2,1,2] -> [[1,2],[1,2]]
  Z    // Transpose A
       // [[1,2],[1,2]] -> [[1,1],[2,2]]
   E€  // Map an equality check to each sublist of A
       // [[1,1],[2,2]] -> [1,1]
     Ạ // Any: return 0 if A contains any falsy values, else return 1
       // [1,1] -> 1

Try it here!

Ruby, 23 bytes
->a{a[2..-1]==a[0..-3]}

Shenzen IO (Assembler) ,83 76 bytes, noncompeting
Shenzen io is a puzzle game where you can code you code in a special assembler-ish language.
Unfortunately, you can only use integers between -999 and 999 as inputs or outputs, and there is no way to tell if an array has ended. So i assumed that the array was written on a ROM that wraps around after reading the last cell. This means that only even arrays can be used, which is the reason for it being noncompeting.
Code:
@mov x0 dat
@mov x0 acc
teq x0 dat
+teq x0 acc
b:
+mov 1 p1
-mov 0 p1
-jmp b

Explanation:
  # calling for x0 will cause rom to move 1 cell forward

 @ mov x0 dat # Moves value to variable dat (only run once)
 @ mov x0 acc # Moves rom position forward and moves x0 to acc
  teq x0 dat  # See if dat equals x0
+ teq x0 acc  # If last expression was true, see x0 equals acc
b:            # Label for jumps (GOTO)
+ mov 1 p1    # Set output (p1) to 1 (same case as previous line)
- mov 0 p1    # if any expression was false, set output to 0
- jmp b       # jump to b: (same case as prev line)

Sorry if any of this is confusing, this is my first code-golf answer.
EDIT: removed 7 bytes by replacing loops by run-once code

Welcome to PPCG!

C#, 54 bytes
using System.Linq;p=>!p.Where((v,i)=>v!=p[i%2]).Any();

Filter array to show values that do not match the first value for evens and the 2nd value for odds.  If there are not any results, return true.

Dart, 46 bytes
(l){var i=0;return l.every((x)=>x==l[i++%2]);}

Run with:
void main() {
  var f = (l){var i=0;return l.every((x)=>x==l[i++%2]);};
  print(f([1,2,1,2,1]));
}

Japt, 7 6 bytes
eUîU¯2

Try it or run all test cases
           :Implicit input of array U
   U¯2     :Get the first 2 elements of U
 Uî        :Repeat that array to the length of U
e          :Test for equality with the original U

Common Lisp, 62 bytes
(defun f(l)(or(not #1=(caddr l))(and(=(car l)#1#)(f(cdr l)))))

Try it online!

05AB1E, 5 bytes
2∍s∍Q

Try it online!
Explanation:
2∍s∍Q   //Full Program
2∍      //extend/shorten input to length 2       e.g. [1,2,1,2,2] -> [1,2]
  s∍    //extend/shorten to length of input      e.g. [1,2] -> [1,2,1,2,1]
    Q   //is equal to input                      e.g. [1,2,1,2,1] != [1,2,1,2,2]

Why is this non-competing?

@pppery It's non-competing because it uses the latest version of 05AB1E which was released after this challenge was posted

Such answers no longer need to be marked non-competing

Huh, TIL. Thanks for the update! Maybe now that I'm competing my 1 year old answer can win this 3 year old challenge :P

Nope, you're outgolfed by Dennis

Lol I know, I was just making a joke. I forgot I had even posted this until you commented on it!

Vyxal ag, 5 4 bytes
-1 byte because flag.
yWv≈

Try it Online!
Explanation:
       # 'a' flag - treat newline separated inputs as a list
y      # Uninterleave
 W     # Wrap resulting lists together into a list
  v≈   # On each list: are all elements the same?
       # 'g' flag - Output minimum value of the top of the stack

Essentially, given <a|b|a|b>, separate into <a|a> and <b|b>, then check if a==a and b==b. If either of those return 0, print 0. Otherwise, print 1.

Factor, 42 bytes
[ dup <evens> std swap <odds> std + 0. = ]

Try it online!

dup <evens> std Take the standard deviation of the even indices.
swap <odds> std Take the standard deviation of the odd indices.
+ 0. = Is their sum zero?

Python 3, Python 2 22 bytes
Simple and efficient ^^
lambda x:x[2:]==x[:-2]

Try it online! (python 3)
Try it online! (python 2)

Thunno 2 M, 3 bytes
z€ạ

Try it online!
Explanation
z€ạ  # Implicit input
z    # Uninterleave the input
     #  - push [input[0::2], input[1::2]]
     #   (i.e. [even indices, odd indices])
 €   # For each inner list:
  ạ  #  Check if the elements are all equal
     #   (i.e. [even indices all equal,
     #           odd indices all equal]
     # Take the minimum of this list
     #  - check if both were true
     #   (i.e. the input was alternating)
     # Implicit output

Octave, 51 bytes
@(L)numel(L)<3||(f=@(n)isequal(L{n:2:end}))(1)&f(2)

Input is a cell array of positive integers.
Try it online!

C#, 66 bytes
a=>{int r=1,i=0;for(;i<a.Length;)if(a[i]!=a[i++%2])r=0;return r;};

Anonymous function which receives an integer array and returns 1 if array is alternating and 0 otherwise.
Full program with ungolfed function and test cases:
using System;

public class Program
{
    public static void Main()
    {
        Func<int[], int> f =
        a =>
        {
            int r = 1,  // return value. 1 is true, by default
                i = 0;  // iterator
            for ( ; i<a.Length ; )  // for each array element
                if ( a[i] != a[i++%2] ) // if the even (or odd) elements are not the same
                    r = 0;      // a falsy (0) value will be assigned to the return element
            return r;       // returning if the array is alternating or not
        };

        // test cases:
        Console.WriteLine("Edge cases (all TRUE):");
        Console.WriteLine(f(new int[]{}));      //  True
        Console.WriteLine(f(new int[]{1}));     //  True
        Console.WriteLine(f(new int[]{1,1}));   //  True
        Console.WriteLine(f(new int[]{1,2,1})); //  True

        Console.WriteLine("Some other TRUE test cases:");
        Console.WriteLine(f(new int[]{1,2,1,2}));      // True
        Console.WriteLine(f(new int[]{10,5,10,5,10})); // True
        Console.WriteLine(f(new int[]{10,11}));        // True
        Console.WriteLine(f(new int[]{9,9,9,9,9}));    // True

        Console.WriteLine("Some FALSE test cases:");
        Console.WriteLine(f(new int[]{5,4,3,5,4,3}));   // False
        Console.WriteLine(f(new int[]{3,2,1,2,1,2}));   // False
        Console.WriteLine(f(new int[]{1,2,1,2,1,1,2})); // False
        Console.WriteLine(f(new int[]{2,2,3,3}));       // False
        Console.WriteLine(f(new int[]{2,3,3,2}));       // False
    }
}

Clojure, 70 bytes
(fn[c](let[n #(max(count(set(take-nth 2 %)))1)](=(n c)(n(rest c))1))))

Checks that the distinct count of every 2nd item is 1, and handles empty collections as a special case. Also tried many approaches based on reduce and group-by but not much luck there.

Another option with R:  36 bytes.
all(rep_len(head(x,2),length(x))==x)

And I think I've found a much shorter version: 15 bytes
all(!diff(x,2))

PHP, 52 bytes
Run with -r.

foreach($argv as$i=>$n)$i<3|$n==$argv[$i-2]?:die(1);

loops from 3rd to last argument. Continue while argument equals that two positions earlier, else exit with code 1 (error). Exit with 0 (ok) after loop finishes.
or for 53 bytes:

while(++$i<$argc-3&$f=$argv[$i]==$argv[2+$i]);echo$f;

loops through all arguments but the last two. Continue while current argument equals that two positions later. Print 1 for true, nothing for false (string representations of true and false).

Oracle SQL, 73 Bytes
select count(*)from(select a,lag(a,2)over(order by 1)b from t)where a!=b;

Output:
True  =  0
False != 0

True Example:
create table t (a number);
truncate table t;
insert into t values (10);
insert into t values (5);
insert into t values (10);
insert into t values (5);
insert into t values (10);
commit;

select count(*)from(select a,lag(a,2)over(order by 1)b from t)where a!=b;

  COUNT(*)
----------
         0

False Example:
create table t (a number);
truncate table t;
insert into t values (1);
insert into t values (2);
insert into t values (3);
insert into t values (3);
insert into t values (1);
insert into t values (2);
commit;

select count(*) from(select a,lag(a,2)over(order by 1)b from t)where a!=b;

  COUNT(*)
----------
         4

Perl, 27 bytes
Includes +1 for p
perl -pE '$_=!/\b(\d+) \d+ (?!\1\b)/' <<< "1 2 1 2"

Add++ v5.1, 9 bytes
L~,Ñ+B]B=

Try it online!

Perl 6, 30 bytes
2>*[(0,2...*;1,3...*)].all.Set

Try it online!
Anonymous Whatever lambda that takes a list and returns an all Junction that boolifies to True/False.
Explanation:
  *[(       ;       )]          # Index from the list
     0,2...*                    # The even indexed elements
             1,3...*            # The odd indexed elements
                      .all      # Are both the lists
                          .Set  # When converted to a set
2>                              # The length is smaller than 2?

Pip, 8 bytes
$&$=*UWg

Attempt This Online!
Explanation
$&$=*UWg
       g  ; List of command-line arguments
     UW   ; Unweave into two alternating sublists
  $=*     ; Fold each sublist on equality
$&        ; Fold those two results on logical AND

Created with the help of Luminespire.


text:
Read a crossword with a twist!
Similar to this question, but this is a crossword variation!
Instead of only one letter per grid square, you can have one or two.
Input:

A 2d array, or whatever works in your language.
You can assume valid inputs
Any array size must work

Output:

An array of all the words

Across and down
All words must be joined together, i.e. linked in an unbroken chain of words (if not return false)
Words must be at least two grid squares, not letters

Example:
[["",  "wo", "r",  "k"],
[ "",   "r",  "",   ""],
[ "he", "l",  "lo", ""],
[ "",   "d",  "ad", ""]]

Returns:
["work", "world", "hello", "load", "dad"]

Example:
[["he", "ll", "o"],
[ "",   "",   ""],
[ "wo", "r",  "ld"]]

Returns:
false

This is fastest-code, so I'll be running this on windows 7 with 2.5ghz and 16gb of ram. If your code is really esoteric, provide a link to the compiler so I can actually run it.

Welcome to PPCG!

You should replace the two spaces part with two grid squares.

What size input size will the speed be measured with?

@MartinEnder the examples

@epicbob57 That seems way to small to measure reliable timings. You'd mostly be measuring I/O and other overhead.

@MartinEnder All right, I'll work out a better example for testing

Python 3
import numpy
from scipy.ndimage import measurements

def crosswords(arr):
    M=numpy.asarray(arr)
    # check connectivity
    if measurements.label(numpy.where(M!='',1,0))[-1] != 1:
        return 'false'

    words = []
    def get_words(mat):
        for r in mat:
            word,counter='',0
            for c in r:
                if c=='':
                    if counter>1:
                        words.append(word)
                    word, counter = '', 0
                else:
                    word, counter = word+c, counter+1
            if counter > 1:
                words.append(word)
    get_words(M)
    # transpose M
    get_words(M.T)
    return words

Usage:
Function takes an array of array of strings as input:
crosswords(
[["",  "wo", "r",  "k"],
[ "",   "r",  "",   ""],
[ "he", "l",  "lo", ""],
[ "",   "d",  "ad", ""]])
Returns the string false when connectivity returns multiple labels.
Returns array of valid words otherwise.
I timed it with timeit, time.time() and using the console command time and but I don't know which one to use or which one to post here.

I realized that I don't have Python 3... anyway, I'll be testing it using time.time()

I can't seem to install scipy using pip...

did you use pip3 ?

pip 9.0.1 (python 3.5)

oh you are on windows, try it with admin priviliges

I had to get help here

Result: 0.002000093460083008

Problem: crosswords([['','',''],['','',''],['','','a']]) returns []

source: Stack Exchange

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

sort: votes


text:
Binary to trinary
The problem
Given a binary number from 0 to 111111 convert it to trinary. (Base 3). Then print the result.
Rules
No using a list of conversions.
Don't cheat
You must use a string as the number
No compressing the input string As I will be testing the code with several different numbers I can't use compressed strings
Notes
By trinary I mean counting in base 3. So 0,1,2,10,11,12,20... ect
Leading zeros will be present 001101
Most important number is on the left.
Example
String input = "110111"
String a = code(input);
print(a);

To win
This is code golf!
Do it correctly and in the smallest size.

You must use a string as the number I'd recommend allowing other formats such as integer etc.

Base 3 is more commonly referred to as ternary.

I'm not sure what No using a list of conversions. means. Are you disallowing base conversion built-ins?

It's even less clear what "no compression" is supposed to refer to.

We have a sandbox where you can have feedback and help from the community before posting a challenge. Please use it.

Bash 25 bytes
Golfed
bc<<<"ibase=2;obase=3;$1"

JavaScript (ES6), 26 bytes
s=>(+`0b${s}`).toString(3)

Ruby, 97 87 bytes
f=->a{x=0
a.chars.map{|i|x+=x+i.ord%2}
o=x>0?"":?0
(o=(48+x%3).chr+o
x/=3)while x>0
o}

Old version:
def f a
x=0
a.chars.map{|i|x=x+x+i.ord%2}
o=x>0?"":"0"
while x>0
o=(48+x%3).chr+o
x/=3
end
o
end

Unless you were purposefully avoiding builtins, I think you're overthinking this. 21 bytes: ->s{s.to_i(2).to_s 3}. Also you might find this useful: http://codegolf.stackexchange.com/q/363/11261

@Jordan Indeed I was avoiding built-in base conversion functions.

@Jordan Thanks for the tip list I have applied some of them and trimmed off 10 bytes.

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


text:
Straight Chain Alk*nes without Order
This is much like my earlier challenge, except, this time, order doesn't matter.
A straight-chain alk*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or triple bonds (alkyne), (implicit hydrogens are used.) Carbon atoms can only form 4 bonds, so no carbon atom may be forced to have more than four bonds. A straight-chain alk*ne can be represented as a list of its carbon-carbon bonds.
These are some examples of valid (not necessarily distinct) straight-chain alk*nes:
[]       CH4              Methane
[1]      CH3-CH3          Ethane
[2]      CH2=CH2          Ethene
[3]      CH≡CH            Ethyne
[1,1]    CH3-CH2-CH3      Propane
[1,2]    CH3-CH=CH2       Propene
[1,3]    CH3-C≡CH         Propyne
[2,1]    CH2=CH-CH3       Propene
[2,2]    CH2=C=CH2        Allene (Propadiene)
[3,1]    CH≡C-CH3         Propyne
[1,1,1]  CH3-CH2-CH2-CH3  Butane
...

While these are not, as at least one carbon atom would have more than 4 bonds:
[2,3]
[3,2]
[3,3]
...

Two straight-chain alk*nes, p and q are considered equivalent if p is q reversed, or p is q.
[1] = [1]
[1,2] = [2,1]
[1,3] = [3,1]
[1,1,2] = [2,1,1]
[1,2,2] = [2,2,1]

Your task is to create a program/function that, given a positive integer n, outputs/returns the number of valid straight-chain alk*nes of exactly n carbon atoms in length.
Specifications/Clarifications

You must handle 1 correctly by returning 1.
Alk*nes like [1,2] and [2,1] are NOT considered distinct.
Output is the length of a list of all the possible alk*nes of a given length.
You do not have to handle 0 correctly.

Test Cases:
1 => 1
2 => 3
3 => 4
4 => 10
5 => 18
6 => 42

This is code golf, so the lowest byte count wins!

Are we supposed to guess what the correct number is? If not, can you specify how we figure it out? Specifically: Is every sequence (of the given length) that doesn't contain two adjacent numbers that sum to more than 4 valid? If so, can you [edit] that info in the question post?

Too much similar to Number of Straight-Chain Alk*nes of given length

That help at all?

@JungHwanMin Why do you think so? I'm not seeing an obvious way to reuse any of the non-brute force answers from that challenge.

@MartinEnder The answer is simply (# of straight-chain alk*nes)/2 + (# of symmetrical straight-chain alk*nes)/2

Oh, and # of symmetrical straight-chain alk*nes is 3^floor(n/2), right (where n is the length)?

@MartinEnder (# of symmetrical straight-chain alk*nes) has the recurrence relation a(n) = 2*a(n-2) + a(n-4) - a(n-6) with initial conditions a(0) = 1, a(1) = 3, a(2) = 2, a(3) = 6, a(4) = 5, and a(5) = 14. That's really similar to a(n) = 2*a(n-1) + a(n-2) - a(n-3) from the other question.

The recurrence equation for this problem is a(n) = 2*a(n-1) + 3*a(n-2) - 5*a(n-3) - a(n-4) - 2a(n-6) + 3*a(n-7) + a(n-8) - a(n-9) with a(0) = 1, a(1) = 3, a(2) = 4, a(3) = 10, a(4) = 18, a(5) = 42, a(6) = 84, a(7) = 192, a(8) = 409

The only problem with that is a(1) should be 1, a(2) should be 3, etc. as noted in the test cases.

@ZacharyT My bad... but still, my point is that this challenge is too similar to the other one.

@JungHwanMin I think that's sufficiently different for it not to be a duplicate (otherwise the original would have been a duplicate of Fibonacci). Whether it adds something interesting over the previous challenge I don't know, but I wouldn't close it.

Deriving an answer to this question from an answer to the previous one without exploiting any structure to the answer (e.g. filtering a list of constructed chains) requires case splitting: if the previous answer's sequence is a(n) and this one is b(n) then a bit of work with @JungHwanMin's recurrences shows that 2 b(2n) = a(2n) + a(n+1) - a(n-1) and 2 b(2n+1) = a(2n+1) + a(n+2).

JavaScript (ES6), 107 bytes
A=n=>n>9?2*A(n-1)+3*A(n-2)+3*A(n-7)+A(n-8)-5*A(n-3)-A(n-4)-2*A(n-6)-A(n-9):[0,1,3,4,10,18,42,84,192,409][n]

Recursive solution, using the recurrence relation that was pointed out in the comments of the question. Execution time rises much quicker than the input (complexity of O(9^N) if I'm not mistaken), so be careful with values higher than 20.

Winner by default.

MMIX, 108 92 bytes (27 23 instrs)
Works mod \$2^{63}\$, because it uses the two-part recurrence instead of the one-part, due to the two-part recurrence being much easier to compute.
(jxd)
00000000: e3010001 e3020001 e3030003 e3040001  ẉ¢¡¢ẉ£¡¢ẉ¤¡¤ẉ¥¡¢
00000010: e3050003 e3060006 67050002 67060005  ẉ¦¡¤ẉ©¡©g¦¡£g©¡¦
00000020: 27000001 28ff0302 26ffff01 c1010200  '¡¡¢(”¤£&””¢Ḋ¢£¡
00000030: c1020300 c103ff00 28ff0605 26ffff04  Ḋ£¤¡Ḋ¤”¡(”©¦&””¥
00000040: 66040005 66050006 660600ff 5b00fff5  f¥¡¦f¦¡©f©¡”[¡”ṫ
00000050: 22000104 3f000001 f8010000           "¡¢¥?¡¡¢ẏ¢¡¡

Disassembly and explanation:
alkns   SET   $1,1          // a(0)
        SET   $2,1          // a(1)
        SET   $3,3          // a(2)
        SET   $4,1          // b(0)/b(1)
        SET   $5,3          // b(2)
        SET   $6,6          // b(4)
        CSOD  $5,$0,2       // b(3), use if n is odd
        CSOD  $6,$0,5       // b(5), use if n is odd
0H      SUBU  $0,$0,1       // loop: n--
        2ADDU $255,$3,$2    // a(n+1) = 2a(n) + a(n-1)
        SUBU  $255,$255,$1  // - a(n-2)
        SET   $1,$2         // and shift
        SET   $2,$3         // values of a
        SET   $3,$255       // down
        2ADDU $255,$6,$5    // b(n+2) = 2b(n) + b(n-2)
        SUBU  $255,$255,$4  // - b(n-4)
        CSOD  $4,$0,$5      // shift values of b down
        CSOD  $5,$0,$6      // if n is odd
        CSOD  $6,$0,$255    // (happens once if n started at 2 or 3)
        PBNZ  $0,0B         // if(n) goto loop
        ADDU  $0,$1,$4      // r(n) = (a(n) + b(n))
        SRU   $0,$0,1       // ÷ 2
        POP   1,0           // return r(n)

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


text:
Let's play tennis
I suddenly really want to play tennis, but alas I do not have a court!
Surprise! This is where you come in.
You have to print a tennis court for me, but you have to do it in the fewest bytes possible because of confidential reasons.
Tennis court
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------

This is code-golf, so shortest code in bytes wins!

Trailing newline allowed?

@ErikGolferエリックゴルファー yes

Can the large gaps in row 2 and 8 be done using tabs?

@Flp.Tkc, I don't think so. I think since nobody else in the six answers already posted knew that, it would be unfair.

Are extra spaces allowed (as long as the output looks like the picture)?

@GB, extra spaces where?

Extra spaces after the end of an output line (before newline).

@GB, no. You may only have an optional trailing newline

This is a surprisingly tricky challenge for such a short output string! I like it. :)

You can just call this challenge a "Dennis court" since everybody knows who will win anyway... :)

33 votes, 33 answers...

@RudolfL.Jelínek Too early! DJMcMayhem won, in fact.

@FlipTack 36 votes, 36 answers...

@RudolfL.Jelínek 40 votes, 40 answers now :)

Canvas, 13 bytes
Ａ←⁹ｗ５+7ｑ⁴‟５ｎ┼

Try it here!

Python 2, 65 bytes
s='-','|'+' '*7,'-','|   ','x'
for i in s+s[3::-1]:print(i*9)[:9]

Flp.Tkc saved a byte.

That's some crazy slicing. Nice!

You can use '|'+' '*7 for the second string in s to save a byte!

05AB1E, 29 27 26 bytes
'-9×©'|ð4×«Dûs®s¨¨ûû'x5×»û

Try it online!
'-9×©                      Push "---------" and store it as temporary value
     '|ð4×«Dûs             Push palindromized("|    ") = "|       |"
                           and push "|    "
              ®            Push "---------" again
               s¨¨û        Strip the last 2 characters from "|    " and push palindromized("|  ") = "|   |"
                   û       Palindromize last item -> "|   |   |"
                    'x5×   Push "xxxxx"
                        »  Join everything with newlines
                         û Palindromize the result and implicitly display it

9'-×D'|4ð×«©ûs®¨'|«û5'x×»û tried refactoring a little, can't break 26.

Another 26 bytes alternative.

Python 3 -  73 72 bytes
d=b,a,c='|       |','-'*9,'|   |   |'
print(a,*d,'x'*9,c,a,b,a,sep='\n')

Python 3.6 - 75 bytes
x=f"{'-'*9}\n|{' '*7}|\n{'-'*9}\n|   |   |\n"
print(x,'x'*9,x[::-1],sep='')

Credit goes to flp-tkc. Thank you :)
Try here!

///, 64 56 bytes
/f/---//e/   //a/fff
|ee |
fff
//d/|e|e|
/adxxxxxxxxx
da

Try it online!
Another 56 byte solution:
/f/---//e/|   //a/fff
e    |
fff
//d/ee|
/adxxxxxxxxx
da

V, 25 bytes
9é-ÄÙÒ r|$.4äGMãlr|jj.kÒX

Try it online!
This should be 23 bytes:
9é-ÄÙÒ r|$.4äMÒXãkr|jj.

But I ran into several bugs while creating it. :(

Jelly, 25 bytes
“¡⁵÷ḞȯḤɼ’b4ị“- x|”s5ŒBŒḄY

TryItOnline!
I had hoped to use the 1,3,1 quarter court repetition, but can't squeeze that into less (a raw version being 28: “ßṂuB’b4s3x“¢¤¢‘ị“- x|”ŒBŒḄY).
How?
“¡⁵÷ḞȯḤɼ’b4ị“- x|”s5ŒBŒḄY - Main link: no arguments
“¡⁵÷ḞȯḤɼ’                 - base 250 number: 375116358919167
         b4               - convert to base 4:
                                [1,1,1,1,1,0,2,2,2,2,1,1,1,1,1,0,2,2,2,0,3,3,3,3,3]
           ị“- x|”        - index into character list "- x|" (1-based):
                                "-----|    -----|   |xxxxx"
                  s5      - split into chunks of length 5:
                               ["-----","|    ","-----","|   |","xxxxx"]
                    ŒB    - bounce (vectorises):
                               ["---------","|        |","---------","|   |   |","xxxxxxxxx"]
                      ŒḄ  - bounce (non-vectorising version):
                               ["---------","|        |","---------","|   |   |","xxxxxxxxx","|   |   |","---------","|        |","---------"]
                        Y - join with line feeds:
                          - implicit print

J, 70 54 51 50 bytes
Saved a byte thanks to Zgarb!
9 9$'-| |-| | |x| | |'#~3 9 1 7{~4#.inv 1851926050

Some standard compression technique, using a compressed RLE.
   9 9$'-| |-| | |x| | |'#~3 9 1 7{~4#.inv 1851926050
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------

Reorder and save a byte: 9 9$'-| |-| | |x| | |'#~3 9 1 7{~4#.inv 1851926050

@Zgarb ah, nice!

JavaScript (ES6), 86 84 83 81 bytes
Saved 2 bytes, thanks to Neil

a=`---------
`;a+=`|       |
`+a;b=`|   |   |
`;console.log(a+b+`xxxxxxxxx
`+b+a)

Alternate method #1, 93 bytes
console.log('01232101242421512424210123210'.replace(/./g,n=>`-
|  x`[n].repeat('911739'[n])))

Alternate method #2, 86 bytes
Suggested by Neil:
console.log(`-${s=`
       |
-
   |
`}x${s}-`.replace(/.*/g,s=>s.repeat(9).slice(-9)))

Alternate method #3, 91 bytes
A recursive approach:
console.log((f=(n,c=`xxxx
|   |   |
---------
|       |
`[n]||'-')=>~n--?c+f(n)+c:'x')(43))

You can make this a function to save a few bytes.

@ConorO'Brien I'm not sure it's allowed to just return the output here: You have to print a tennis court

Simple run length encoding is a byte shorter than your alternate method: console.log('-9\n| 7|\n-9\n| 3| 3|\nx9\n| 3| 3|\n-9\n| 7|\n-9'.replace(/.\d/g,s=>s[0].repeat(s[1]))) (replace \n with newline obviously).

Another 92-byte formulation: console.log('-\n       |\n-\n   |\nx\n   |\n-\n       |\n-'.replace(/.*/g,s=>s.repeat(9).slice(-9))).

Sorry, there are supposed to be 7 or 3 spaces before each | as appropriate instead of the single space that appears in my comment.

Oh, and just converting your main answer to separate statements saves 2 bytes, since you don't need the extra set of ()s.

@Neil I really like your repeat(9).slice(-9) idea!

I've since beaten those methods, even without ES6 features, so I've added it as a separate answer.

Ruby, 60 bytes
-4.upto(4){|i|puts''.rjust(9,%w{x |%3s - |%7s -}[i.abs]%'')}

Ungolfed
-4.upto(4){|i|                    #iterate -4 to 4.
   puts''.rjust(9,                #Print the null string right justified to length 9 padded by repititions of
   %w{x |%3s - |%7s -}[i.abs]%'') #the string from the %w{} array modified like sprintf by the % operator
}                                 #so that %Ns is replaced by N spaces.

bash/Unix tools, 58 57 bytes
dc<<<4o16i3FFFFp20002prp20202p15555pszpszfp|tr 0-3 ' x|-'

Only four characters other than newline appear in the desired output, allowing each line to be coded as a base-4 number. These numbers are  then written in hexadecimal in the script, for brevity.
The Unix calculator dc is used both for the base-16 to base-4 conversion and for stack manipulation to allow easy repetition of lines in the right places.
Edit: Shaved one byte off by swapping two of the base-4 digits used to code characters, permitting the tr command to be one byte shorter than the previous version.

JavaScript, 85 bytes
console.log('---|  ---| |xxx| |---|  ---'.replace(/(.)((.).)/g,'$1$3$3$2$3$3$3$1\n'))

SOGL 0.5, 24 23 20 bytes (non-competing)
 -9*"D√⅜‘⁴"Hοr‘¹q x9*o±

Explanation:
"'|⁶.f,‘9n_h¹q x9*o±
"'|⁶.f,‘              pushes "------------------|       ||   |   |"
        9n            splits into chunks of 9
                       stack: [["---------","---------","|       |","|   |   |"]]
          _           puts all the contents of the array into the stack
                       stack: ["---------","|       |","---------","|   |   |"]
           h          swaps the 2nd from top with 3rd from top
            ¹         turns back into array
                       stack: [["---------","|       |","---------","|   |   |"]]
             q        outputs the array without popping it from stack
               x      push "x"
                       stack: [["---------","|       |","---------","|   |   |"], "x"]
                9*    repeat it 9 times
                       stack: [["---------","|       |","---------","|   |   |"], "xxxxxxxxx"]
                  o   output that
                   ±  reverse the array
implicitly output the reversed array

So how does the compressed string work?
The string converted from base250 to binary is
1000000100111110010100001110100000001100010001
and approxametally what it does:
100 boxstring (a custom dictionary string with chars " -/\|_\n")
000010 choose only the "-"s
01111 with length of 15+(different chars used)+2 = 18 chars
there is only 1 char type, so results in "------------------"
100 another boxsting
101000 choosing " " and "|"
01110 with length of 14+(different chars used)+2 = 18 chars
100000001100010001 the data; 0 = " " and 1 = "|"
has "------------------" and "|       ||   |   |" and just joins them together

non-competing, because language postdates the challenge. And this challenge is only a day old. I knew I should've put something up yesterday. I did this as a test for my language and it ended up too good not to post. Pretty sure this is golfable more too.

///, 59 bytes
/_/---------
//s/   /_|ss |
_|s|s|
xxxxxxxxx
|s|s|
_|ss |
_

Try it online!
Outgolfed...

Javascript (ES6), 86 bytes:
a=`---------
|       |
---------`;b=`|   |   |
`;console.log(a+`
`+b+`xxxxxxxxx
`+b+a)
Test here:

a=`---------
|       |
---------`;b=`|   |   |
`;console.log(a+`
`+b+`xxxxxxxxx
`+b+a)

You can save 4 bytes by adding a newline at the start of b, as this means that you can remove the newline after xxxxxxxxx and the one that you add between a and b. You can save a further 3 bytes by setting a to --------- first and then concatenating the second row and a to itself.

05AB1E, 26 bytes
'-5×©'|4úD®sÂðñ)í€û»'x5×»û

Uses the CP-1252 encoding. Try it online!

Better golf this down more!

PHP, 66 62 bytes
This is the original answer (66 bytes):
<?=$a="---------
|       |
---------
|   |   |
xxxx",x,strrev($a);

It generates a notice because of the unknown constant x. The notice can be suppressed by setting error_reporting=0 in php.ini or in the command line:
$ php -d error_reporting=0 tennis.php

The last line of the output doesn't end with a newline character.

The updated answer (62 bytes), improving an improvement suggested by  @Titus:
<?=$a=($b="---------
|   ")."    |
$b|   |
xxxx",x,strrev($a);

Run it without a configuration file (it defaults with error_reporting=0 this way):
$ php -n tennis.php

Both versions of the code contain literal new lines embedded in the string (1 byte shorter than \n) and cannot we unwrapped.

Notices are turned off in the default config; no need for -d error_reporting=0, just use -n.

I count 66. You can make them 65 with <?=$a=($b="---------\n|")."....

@Titus I like your suggestion. -n is much shorter than -d error_reporting=0 :-) There are, indeed, only 66 useful chars in the answer. I counted them using ls -l and forgot my vi is configured to ensure the file ends with a new line. I improved your improvement and squeezed 3 more bytes. Thank you.

Pyke, 28 26 25 bytes
\|ddsssd7*.X--||"R\x5*nJs

Try it here!
       d7*                -    " " * 7
          .X--||"         -   grid(^, corners="-", sides="-", left="|", right="|")
\|dds                     -     "|  "
     s                    -    palindromise(^)
      s                   -   palindromise(^)
                  \x5*    -   "x" * 5
                      nJ  -  "\n".join(^)
                        s - palindromise(^)

Ruby, 52 bytes
puts [b=[a=?-*9,"|%8s"%?|,a],c="|   |   |",?x*9,c,b]

Using the double simmetry, the lines are: 0-1-0 / 2-3-2 / 0-1-0, the loop can be easily unrolled and the nested list is flattened on output.

J, 36 bytes
9$'-'([,(' '4}]),[,],'x',:])9$'|   '

This works on the REPL, which is the standard way of using J:
   9$'-'([,(' '4}]),[,],'x',:])9$'|   '
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------

With 41 bytes, I can print the result to STDOUT:
echo 9$'-'([,(' '4}]),[,],'x',:])9$'|   '

Try it online!
Explanation
I construct the tennis court one row at a time.
9$'-'([,(' '4}]),[,],'x',:])9$'|   '
                            9$'|   '  The string repeated to length 9: y = '|   |   |'
  '-'(                     )          Apply this verb to x = '-' and y:
                     'x',:]            y with a row of 'x'-chars above it.
                                       This is a 2x9 matrix, and "," now works by
                                       prepending new rows to it.
                   ],                  Prepend another y.
                 [,                    Prepend x, which is repeated to a row of length 9.
        (' '4}]),                      Prepend y with 4th character replaced by a space.
      [,                               Prepend x again.
                                      Now we have this 6x9 matrix:
                                       ---------
                                       |       |
                                       ---------
                                       |   |   |
                                       xxxxxxxxx
                                       |   |   |
9$                                    Repeat it to have 9 rows.

PHP, 72 bytes
<?=$a="---------
",$b="|       |
$a",$c="|   |   |
","xxxxxxxxx
$c$a$b";

I almost hate it when it´s shorter like this than with calculating a little.

05AB1E, 25 bytes
'-9×©'|ð4×«û®…|  ûû'x5×»û

Uses the CP-1252 encoding. Try it online!
Explanation:
'-9×                       # Push "---------"
    ©                      # Store in register_c
     '|ð4×«                # Push "|    "
           û               # Palindromize, giving "|       |"
            ®              # Retrieve from register_c
             …|            # Push "|  "
                 ûû        # Palindromize twice, giving "|   |   |"
                   'x5×    # Push "xxxxx"
                       »   # Join by newlines
                        û  # Palindromize
                           # Implicit print

Vim, 32 bytes
9i-^[Y3pO||^[7i ^[YGPkP4lr|YpO^[9ix^[

This will print the tennis court into a vim buffer. ^M represents the Enter key (0x0d) and ^[ is the Escape key (0x1b). You can run these keystrokes/code by saving them to a file and running
vim -s <filename> -u NONE

Printing to stdout
If it has to be printed to stdout instead, you could save the buffer to a file (I used "a") and use whichever shell vim is set to use (I used bash) as well as the cat program in order to print the tennis court to stdout (51 bytes):
9i-^[Y3pO||^[7i ^[YGPkP4lr|YpO^[9ix^[:w!a|sil !cat %^M:q^M

It's the same as the earlier version but with :w!a|sil !cat %^M:q^M added onto the end

PowerShell, 67 66 bytes
($a='-'*9)
($b="|       |")
$a
($c="|   "*2+"|")
'x'*9
$c
$a
$b
$a

Try it online!
Just some string multiplication, setting variables, and ensuring they're encapsulated in parens to place copies on the pipeline. The default Write-Output at program completion gives us newlines between for free.
Thanks to @ConnorLSW for saving an obvious byte.

$(' '*7) is actually 8 chars, would be shorter to just do |       | as spaces.

@ConnorLSW Oh, haha. Thanks for the obvious golf! :D

just paying you back for the ToLower() save on my other answer ;)

Python 2, 75 bytes
a,b,c='-'*9,'|       |','|   |   |'
for e in[a,b,a,c,'x'*9,c,a,b,a]:print e

Uses variables borrowed from @GurupadMamadapur
Alternative also for 75
a,b,c='-'*9,'|       |','|   |   |'
print'\n'.join([a,b,a,c,'x'*9,c,a,b,a])

Lua, 82 Bytes.
y=[[---------
|       |
---------
]]z="|   |   |\n"io.write(y,z,"xxxxxxxxx\n",z,y)

I tried many methods, and yet this one proved the victor.

Emacs, 43 35 keystrokes
M-9 x RET : nine x's, return
C-SPC : set mark
| M-3 SPC | M-3 SPC | RET : pipe, three spaces, pipe, three spaces, pipe, return
M-9 - RET : nine hyphens, return
| M-7 SPC | RET : pipe, seven spaces, pipe, return
M-9 - RET : nine hyphens, return
C-x C-x : exchange point and mark, selecting region
M-w : copy region
C-p : previous line
C-y : yank copied text
M-x rev-r RET : execute reverse-region command

Pushy, 33 bytes
This question had 33 upvotes, and there were 33 answers, so I just had to post a 33 byte solution...
9:45;T`|    `wT`|   |`4dT5:120;w"

Try it online!

Explanation
The code can be split into several parts, to make it easier to understand. The first part works like so:
9:45;    \ Push the char '-' 9 times
T        \ Push 10, which is a linefeed
`|    `  \ Push these charcodes

The stack is now:
---------
|

The mirror operator, w, then mirrors the whole stack, producing:
---------
|       |
---------

Then:
T        \ Push a linefeed
`|   |`  \ Push these chars
4d       \ Copy the last 4 characters
T        \ Push a linefeed
5:120;   \ Push the char 'x', 5 times

The stack is now beginning to look like the tennis court:
---------
|       |
---------
|   |   |
xxxxx

To finish it, we use the mirror operator w once more, which reflects this string to produce the full tennis court.
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------

All that's left now is to print, which is done by the " character.

Unix Shell; using dc and tr; 55 Bytes:
( Optimization of Mitchell Spector solution )
dc<<<4o16i3FFFFp20002prp20202p15555psrfrp|tr 0-3 ' x|-'

Others Solutions :
Using sed; 81 Bytes;
echo "---|  ---| |xxx| |---|  ---"|sed "s/\(.\)\(.\)\(.\)/\1\2\2\2\3\2\2\2\1\n/g"

Using dc in function : 88 Bytes
b(){ dc<<<2o16i1${1}p|tr '01' ' '$2;};(b FF -;b 01 \|;b FF -;b 11 \|)>f;cat f;b FF X;tac f

or
b(){ echo "obase=2;$1"|bc|tr '01' ' '$2;};(b 511 -;b 257 \|;b 511 -;b 273 \|)>f;cat f;b 511 X;tac f

Using bc in function : 99 Bytes
b(){ echo "obase=2;$1"|bc|tr '01' ' '$2;};(b 511 -;b 257 \|;b 511 -;b 273 \|)>f;cat f;b 511 X;tac f

Powershell, 56 bytes
(('-'*9),'|       |'+'-'*9+'|   |   |'+'x'*9)[0..4+3..0]

Explanation: straightforward half-of-the-court
Alternative, 68 bytes
('-----','|    '+'-'*5+'|   |'+'x'*5)[($r=0..4+3..0)]|%{-join$_[$r]}

Explanation: quarter-of-the-court uses the same indexes for both row and column display

Python 2, 60 bytes
for i in 0,7,0,3,-2,3,0,7,0:print(('-?x|'[i%4]+' '*i)*9)[:9]

Try it online!
Uses Lynn's multiply-and-truncate method.

Lua, 105 bytes
Sure, I've already been beaten, but it ain't fun if you don't try!
Actual answer:
a,c,d="---------","xxxxxxxxx","|   |   |"p=print p(a)p("|       |")p(a)p(d)p(c)p(d)p(a)p("|       |")p(a)

Less hardcoded:
a,b,c,d=("-"):rep(9),(" "):rep(7),("x"):rep(9),"|   |   |"p=print p(a)p("|"..b.."|")p(a)p(d)p(c)p(d)p(a)p("|"..b.."|")p(a)

Uses String.rep to make it less hardcoded (though it adds bytes!) (instead of xxxxxxxxx, write ("x"):rep(9))
Just for fun, how easy would it be to just print it hardcoded?
print([[---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------]])

100 bytes. That's shorter than my code. :(

Didn't checked the other ones, but the hardcoded version can be 98 characters if you remove the parenthesis: print[[…]].

But the 2 mirrored halves approach is of course shorter: http://pastebin.com/pJLFEuck

Batch, 116 bytes
@set s=---------
@for %%s in (%s% "|       |" %s% "|   |   |" %s:-=x% "|   |   |" %s% "|       |" %s%)do @echo %%~s

Conveniently, expansion of for variables happens after parsing, so I only have to quote the |s once. However, only the horizontal lines are sufficiently repetitive that using a variable saves bytes.

Actually, 49 bytes
'x9*' 3*;2╟"|%s|%s|"%9'-*' 7*"|%s|"%9'-*k;RdX@i(i

Try it online!
Explanation:
'x9*' 3*;2╟"|%s|%s|"%9'-*' 7*"|%s|"%9'-*k;RdX@i(i
'x9*                                               "xxxxxxxxx"
    ' 3*;2╟"|%s|%s|"%                              "|   |   |"
                     '-*' 7*"|%s|"%                "|       |"
                                   9'-*            "---------"
                                       k;          push entire stack to list, duplicate it
                                         RdX       reverse one copy and remove the string of "x"s from it
                                            @i     flatten the other copy
                                              (i   flatten the first copy and implicitly print

Scala, 90 bytes
val l="-"*9
val g="\n|       |\n"
val s="\n|   |   |\n"
print(l+g+l+s+"x"*9+s+l+g+l)

MATL, 30 bytes
9Z"13+'|'7Z"yhhyy6M5(v'x'9Y"yP

Try it online!

R, 121 bytes
m=rbind(a<-rep("-",9),b<-c("|",rep(" ",7),"|"),a,b,rep("x",9),b,a,b,a);m[c(4,6),5]="|";for(i in 1:9)cat(m[i,],"\n",sep="")

First time trying a Kolmogorov-Complexity challenge, not sure R is really suited for it.
Ungolfed:
a <- rep("-", 9)
b <- c("|", rep(" ", 7), "|")
m <- rbind(a, b, a, b, rep("x", 9), b, a, b, a)

m[c(4,6), 5] <- "|"

for(i in 1:9){
  cat(m[i,], "\n", sep = "")
}

Output:
---------
|       |
---------
|   |   |
xxxxxxxxx
|   |   |
---------
|       |
---------

"|", rep(" ", 7), "|" is longer than "|       |"

@12Me21 The code as I use it now requires a vector with each of the spaces in a separate string :/ so this wouldn't work with a direct substitution.

This does make me realise though that this answer is longer than just printing the raw code. Ohwell...

C, 97 bytes
n=11;i,k;f(){i=n/10%10;k=n++%10;printf("%c",k?"| -x"[i%2?i==5|2:k%8-1&&k-5|i*i%5-1]:10);i?f():0;}

///, 55 bytes
/l/---//s/   //m/
|s|s|
//a/lll
|s s|
lll/amxxxxxxxxxma

Try it online

Scala, 83 bytes
val(a,b)=("-"*9+"\n|   ","   |\n")
val c=s"$a $b$a|$b"
print(c+"x"*9+c.reverse)

Common Lisp, 90 86 85 81 79 bytes
(format t"~5@{~@?
~}~4@{~2:*~@?
~}"#1="~9@{-~}""|~8t|"#1#"|   |   |""~9@{x~}"1)

First we print out all arguments, and then we print them in reversed order (without xxxxxxxxx).
Similiar solution, but instead of providing every variable directly I give (where it's efficient) control string which will output needed text.

SmileBASIC, 68 65 62 59 57 bytes
M$="|
L$="-"*9?L$?M$,M$?L$?M$*3?"x"*9?M$*3?L$?M$,M$?L$

(note the 3 trailing spaces in line 1)
Of course, this will work in many other dialects of BASIC.
Explained:
V$="|   " 'vertical line
H$="-"*9 'horizontal line
PRINT H$    '---------
PRINT V$,V$ '|       |
PRINT H$    '---------
PRINT V$*3  '|   |   |
PRINT "x"*9 'xxxxxxxxx
PRINT V$*3  '|   |   |
PRINT H$    '---------
PRINT V$,V$ '|       |
PRINT H$    '---------

, in PRINT is a tab, and luckily the default size is perfect for this challenge.

Java 8, 98 bytes
Store repeated lines and add it all together.
()->{String a="---------\n",b="|       |\n",c="|   |   |\n";return a+b+a+c+"xxxxxxxxx\n"+c+a+b+a;}

C#, 88 bytes
()=>{string a="---------\n",b="|   |   |\n";return(a+="|\t|\n"+a)+b+"xxxxxxxxx\n"+b+a;};

Anonymous function which returns the tennis court as a string.
Full program with ungolfed method:
using System;

namespace LetsPlayTennis
{
    class Program
    {
        static void Main(string[] args)
        {
            Func<string> f =
            () =>
            {
                string a = "---------\n",
                    b = "|   |   |\n";
                return (a += "|\t|\n" + a)
                    + b
                    + "xxxxxxxxx\n"
                    + b
                    + a;
            };

            Console.WriteLine(f());
        }
    }
}

Pip -l, 31 bytes
"--x--"M_X9WV:" || "M_WRsX3WR'|

Try it online!
Explanation
We construct the even rows, then the odd rows, and then weave them together.
"--x--"M_X9WV:" || "M_WRsX3WR'|
                                 s is space (implicit)
       M                         Map this function
"--x--"                          to each character of this string:
        _X9                       Repeat the character 9 times
                                 The result is a list of five 9-character strings

                    M            Map this function
              " || "             to each character of this string:
                     _            The character
                      WR          wrapped on each side in
                        sX3       three spaces
                           WR'|   wrapped on each side in |
                                 The result is a list of four 9-character strings

           WV:                   Weave the two lists together (the : helps with parsing)
                                 Print, with each list element on its own line (-l flag)

MBASIC, 89 bytes
1 WIDTH 13:P$="---------":S$="|       |":T$="|   |   |":PRINT $S$P$T$"xxxxxxxxx"T$P$S$P$

More abuse of the WIDTH directive to save multiple PRINTs.

R, 76 bytes
"*"=strrep;write(c(a<-c(b<-"-"*9,"|       |",b,"|   |   |"),"x"*9,rev(a)),1)

Try it online!


text:
Find the sum of all numbers below n that are a multiple of some set of numbers
Almost equivalent to Project Euler's first question:

If we list all the natural numbers below 10 that are multiples of 3 or
  5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

Challenge:
Given a positive integer N and a set of at least one positive integer A, output the sum of all positive integers less than N that are multiples of at least one member of A.
For example, for the Project Euler case, the input would be:
1000
3
5

Test cases:
Input : 50, [2]
Output: 600

Input : 10, [3, 5]
Output: 23

Input : 28, [4, 2]
Output: 182

Input : 19, [7, 5]
Output: 51

Input : 50, [2, 3, 5]
Output: 857

Do we count numbers that are multiples of both twice? 2) Can we only get two other numbers? or any amount say one or 3?

Can you give some test cases? Obviously don't post the answer to the PE one, but what about other examples?

@WheatWizard: The word "or" implies that each number is counted only once, at most. I agree that the question needs to make it clear how many "numbers to check for multiples of" arguments must be supported, though. Exactly two? One or more? Zero or more?

Can we take "numbers equal to or below 10", or take 9 as input instead of 10?

"and a set of at least one positive integer A" how big can the set be?

Jelly, 6 bytes
ḍþṖḅTS

Try it online!
How it works
ḍþṖḅTS  Main link. Left argument: D (array). Right argument: n (integer)

ḍþ       Divisible table; test each k in [1, ..., n] for divisibility by all
        integers d in D.
  Ṗ     Pop; discard the last Boolean array, which corresponds to n.
   ḅ    Unbase; convert the Boolean arrays of base n to integer. This yields a
        non-zero value (truthy) and and only if the corresponding integer k is
        divisible by at least one d in D.
    T   Truth; yield the array of all indices of truthy elements.
     S  Compute their sum.

Of course @Dennis has to come with something that will make you wonder what you're doing on ppcg

Octave, 38 36 33 bytes
@(x,y)(1:--x)*~all(mod(1:x,y),1)'

Take input as: f(10, [3;5]). This would be 2 bytes shorter if the input could be f(9,[3;5]) for the same test case.
Verify all test cases here.

Explanation:
@(x,y)        % Anonymous function that takes two inputs, x and y
              % x is a scalar and y is a vertical vector with the set of numbers
(1:--x)*      % Pre-decrement x and create a vector 1 2 ... x-1

Octave can pre-decrement, so using 1:--x instead of 1:x-1 (two times) saves two bytes.
mod(a,b) gives 1 2 0 1 2 0 1 2 0 for mod(1:9,3). If the second argument is a vertical vector, it will replicate the first input vertically and take the modulus for each of the values in the second input argument. So, for input mod(1:9, [3;5]) this gives:
1 2 0 1 2 0 1 2 0
1 2 3 4 0 1 2 3 4

Taking ~all(_,1) on this gives true for the columns where at least one value is zero, and false where all values are non-zero:
~all(mod(1:x,y),1)
0 0 1 0 1 1 0 0 1

The ,1 is needed in case there is only one number in y. Otherwise it would act on the entire vector instead of number-by-number.
Transposing this to a vertical matrix and use matrix multiplication, will give us the correct answer, without the need for explicit summing:

Oh that's cruel: I had to add 2 bytes because of the difference between x and x–1, but you had to add 4 bytes, and I'm now ahead by 1 byte >:)

Python, 59 55 bytes
lambda n,l:sum(v*any(v%m<1for m in l)for v in range(n))

repl.it
Unnamed function taking an integer, n and a list of integers l. Traverses a range of the Natural numbers (plus zero) up to but not including n and sums (sum(...)) those that have a remainder after division of zero (v%m<1) for any of the integers m in the list l. Uses multiplication rather than a conditional to save 3 bytes.

JavaScript (ES6), 40 39 36 bytes
Input: integer n and array of integer(s) a with currying syntax (n)(a)
n=>F=a=>n--&&!a.every(v=>n%v)*n+F(a)

Test cases

let f =

n=>F=a=>n--&&!a.every(v=>n%v)*n+F(a)

console.log(f(50)([2]));        // 600
console.log(f(10)([3, 5]));     // 23
console.log(f(28)([4, 2]));     // 182
console.log(f(19)([7, 5]));     // 51
console.log(f(50)([2, 3, 5]));  // 857

I had a slightly different formulation for the same length: f=(n,a)=>n--&&a.some(v=>n%v<1)*n+f(n,a). Best I could do nonrecursively was 61 bytes.

@Neil Your comment encouraged me to look for yet another formulation. Interestingly, the currying syntax saves 3 bytes.

MATL, 9 bytes
q:ti\~*us

Try it online!

Just checking if I read this right (without checking the docs). You're decrementing, creating a vector 1 2 .... You duplicate it and take modulus the other input. You negate it and multiply with the vector 1 2 .., use unique to get rid of duplicates and finally summing it...

Exactly! I'm on the mobile so I didn't include an explanation. Now it's not necessary :-)

Retina, 34 bytes
Byte count assumes ISO 8859-1 encoding.
\d+
$*
M&!`(.+)\1*(?=1¶.*\b\1\b)
1

Input format is
50
2,3,5

Try it online!

Perl 6, 25 bytes
{sum grep *%%@_.any,^$^a}

A lambda that takes the input numbers as arguments. (One argument for N, and an arbitrary number of arguments for A).
(Try it online.)
Explanation:

{ ... }: A lambda.
$^a: First argument of the lambda.
@_: Remaining arguments of the lambda ("variadic parameter").
^$^a: Range from 0 to $^a - 1.
* %% @_.any: Another lambda, which tests its argument * using the divisible-by operator %% against an any-Junction of the list @_.
grep PREDICATE, RANGE: iterates the range of numbers and returns the ones for which the predicate is true.

I think adding ^ to declare a placeholder parameter is fairly explicit. Especially since you could use it later in the block as just $a. I think only $_ @_ %_ self can ever be considered to be implicitly declared. I think I would have that line read "declare first parameter as a placeholder"

@BradGilbertb2gills: I meant that it implicitly becomes part of the lambda's signature, even though the code didn't introduce a signature before the lambda's body. @_, and %_ in case of functions, are no different in that regard: They too only become part of the signature if they appear in the body. Only $_  (and self and %_ in methods) can become part of a signature by default.

PS: I removed the phrase "implicitly declared" now, though, as it's not necessary for understanding the code.

Python, 67 bytes
a,b,c=input()
x=y=0
exec("if x%c<1or 1>x%b:y+=x\nx+=1\n"*a)
print y

After writing this I noticed my code was similar to the existing python answer, however I came up with it independently and am posting it anyway.

You don't need the semicolon in the exec, since you have a line break after it anyway. I knew my answer could be outgolfed!

The spec says "a set of at least one positive integer"; this seems to only handle the case where the set is two integers. Also having x=y=0 on a separate line would save four bytes.

@JonathanAllan cool, thanks a lot!

Mathematica, 37 27 bytes
Thanks to Martin Ender for a shrewd observation that led to big byte savings!
Tr[Union@@Range[#,#2-1,#]]&

Unnamed function taking two arguments, a list # of integers (the desired divisors A) and an integer #2 (the upper bound N) , and returning an integer. Range[#,#2-1,#] gives, for each element d of the list #, all the multiples of d less than or equal to #-1 (hence less than #); the union of these lists is then computed and summed with Tr.
Previous version:
Tr[x=#;Union@@(Range[#,x-1,#]&/@#2)]&

Range is listable: Tr[Union@@Range[#2,#-1,#2]]& (and then save another byte by swapping the order of the inputs)

R, 67 bytes
a=scan();x=c();for(i in a[-1])x=c(x,seq(i,a[1]-1,i));sum(unique(x))

Takes a vector to STDIN in the following format: [N, a_1, a_2, ...]. Supports any number of a. For each a, creates the sequence a to N-1 with stepsize a. Then takes the sum of all the unique entries in that vector.

50 bytes

Haskell, 42 39 bytes
a!b=sum[x|x<-[1..a-1],any((<1).mod x)b]

Usage:
Main> 50![2,3,5]
857

Thanks to @Zgarb for 3 bytes

(x\mod`)is the same asmod x`.

@Zgarb whoops :)

Octave, 49 37 bytes
@(A,N)sum(unique((z=(1:N)'.*A)(z<N)))

the function will be called as f([2 3 4],50)
Assume that A=[2 3 4]; we require to have sum of numbers as
sum(
2,4,6...,50-1 ,
3,6,9...,50-1,
4,8,12,...50-1)

we can multiply [2 3 4] by 1:50 to get matrix (1:N)'.*A
[2 4 6 ... 2*50
3 6 9 ... 3*50
4 8 12 ...4*50]

then extract from the matrix those that are smaller than 50 : z(z<N)
Since there are repeated elements in the matrix we extract unique values and sum them.
previous answer:  (this solution will fail if N==1)
@(A,N)sum((k=uint64(1:N-1))(any(k==(k./A').*A')))

function  should be called as f(unit64([2 3 4]),uint64(50))

Very nice! Almost as sort as the other octave answer, but a completely different approach. This didn't cross my mind at all! Could benefit from having some explanation though and maybe a link to ideone, but you have my vote already :-)

I changed the order of the input, but here's a link http://ideone.com/8Bljrl

05AB1E, 9 bytes
FND²%P_*O

Try it online!
F         For N in [0, ..., input[0]-1]
 ND²%     Evaluate N%input[1]; yields an array of results
     P    Take the total product of the array. Yields 0 only if at least one of the value is 0, in other words if N is multiple of at least one of the specified values
      _   Boolean negation, yields 1 if the last value is 0 and yields 0 otherwise
       *  Multiply by N: yields N if the last value is 0 and yields 0 otherwise
        O Display the total sum

8 bytes or 8 bytes alternative using a filter. (The first 8-byter wasn't possible when you posted your answer, though. Since à (maximum) pops the list now, but didn't before.)

Japt -fx, 9 7 6 4 bytes
VøUâ

Try it

Pip, 43 41 39 35 bytes
b^:sFc,a{f:0Fdb{f?0c%d?0(f:i+:c)}}i

Try it online!
Explanation:
Takes inputs like so:

    arg1 1000
    arg2 3 5

b^:s                      ;read rest of inputs as array
                          ;(s is " " and ^ is split into array on char)
F c ,a{                   ;for(c in range(0,a))
  f:0                     ;flag to prevent double counting 15,30,etc.
  F d b {                 ;forEach(d in b)
    f? 0 c%d? 0 (f:i+:c)  ;if flag {continue}elif c%d {f=i+=c}
                          ;      (i will always be truthy so why not)
  }
}
i                         ;print sum

whoops! I read too fast

Much better. Great answer!

Pyth, 10 bytes
s{sm:0hQdt

Explanation
s{sm:0hQdtQ   Implicit input
    :0hQd     Get multiples of d below the bound
   m     tQ   ... for each d given
  s           Concatenate results
 {            Remove repeats
s             Take the sum

T-SQL, 87 bytes
This will work as long as @i has a value of 2048 or lower
USE master--needed for databases not using master as default
DECLARE @i INT=50
DECLARE @ table(a int)
INSERT @ values(2),(3),(5)

SELECT sum(distinct number)FROM spt_values,@ WHERE number%a=0and abs(number)<@i

Try it out

Ruby, 52 48 46 bytes
->b{b[s=0].times{|x|b.find{|y|x%y<1&&s+=x}};s}

APL (Dyalog Unicode), 12 bytes
+/⊢∘⍳∩∘∊×∘⍳¨

Try it online!
Anonymous tacit function. Thanks to @Adám for helping me shave 3 bytes off of this. Uses ⎕IO←0.
How:
+/⊢∘⍳∩∘∊×∘⍳¨ ⍝ Tacit function. Left and right arguments will be called ⍺ and ⍵ respectively.

        ×∘⍳¨ ⍝ Multiply ⍺ with each element of [0..⍵-1]
       ∊     ⍝ Enlist (flattens the vector)
     ∩∘      ⍝ Then, get the intersection of that vector with
  ⊢∘⍳        ⍝ The vector [0..⍵-1].
+/           ⍝ Then sum

Google Sheets, 141 140 134 132 90
Closing parens already discounted.
Phew! That was more work than I bargained for. The hard part was getting something that worked for all ranges.
Inputs:

A1 - N
Row 2 - A1, A2, ...

Formulae:

A3 - =A1-1 (N - 1)
A4 - =SUM(ArrayFormula(SEQUENCE(A3)*LT(,COUNTIF(MMULT(SEQUENCE(A1),FILTER(2:2,2:2)),SEQUENCE(A3)))))

Where A4 is the final output.
How It Works
Hint: Start from the middle.
# Sum everything together
=SUM(
    ArrayFormula(
        # The "number under N"
        SEQUENCE(A3)*
        # Use the LT Operator function to pile parens at the end
        LT(
            # Implicit 0
            ,
            COUNTIF(
                # Generate every multiple of each element in A via matrix multiplication up to the Nth multiple.
                # This is overkill, but saves characters.
                MMULT(
                    # Column Matrix `(1, ... , N)` and Row Matrix `(A1, A2, ...)`.
                    SEQUENCE(A1),
                    # Have to remove blanks from the end
                    FILTER(2:2,2:2)
                ),
                # If element appears in the resulting matrix, multiply by 1, or else 0
                SEQUENCE(A3)
            )
        )
    )
)

x86-16 machine code, 27 25 bytes
Binary:
00000000: 33db 4a51 56ac a20c 018a c2d4 0ae0 f675  3.JQV..........u
00000010: 0203 da5e 594a 75eb c3                   ...^YJu..

Listing:
33 DB       XOR  BX, BX                 ; clear BX running sum
4A          DEC  DX                     ; N = N - 1 (only multiples below N)
        N_LOOP:
51          PUSH CX                     ; save array length
56          PUSH SI                     ; save array start pointer
        F_LOOP:
AC          LODSB                       ; AL = next factor
A2 0C01     MOV  BYTE PTR[AAM1+1], AL   ; AAM divisor = AL
8A C2       MOV  AL, DL                 ; AL = dividend
        AAM1:
D4 0A       AAM                         ; ZF = ( current N % factor == 0 )
E0 F6       LOOPNZ F_LOOP               ; if not a multiple, continue to next factor
75 02       JNZ  F_BREAK                ; if last is not a multiple, don't add
03 DA       ADD  BX, DX                 ; otherwise add factor to sum
        F_BREAK:
5E          POP  SI                     ; restore array pointer
59          POP  CX                     ; restore array length
4A          DEC  DX                     ; decrement N / loop counter
75 EB       JNZ  N_LOOP                 ; loop until N = 0
C3          RET                         ; return to caller

As a function: input N in DL, SI array of factors, CX array size.
Once again, using DOS DEBUG to test.  Note: literal values are in hex in DEBUG.
N = 10 (0xA), [ 3, 5 ] = 23 (0x17)

N = 50 (0x32), [ 2, 3, 5 ] = 857 (0x359)

Fig, \$11\log_{256}(96)\approx\$ 9.054 bytes
VxSFrx'!A%v

-8.232 bytes thanks to @Sʨɠɠan
Try it online!
Explanation:
Vx           # Set the register to the first input (the list)
    rx       # Range [0, n)
   F  '      # Filter:
         %   #   Modulo
          v  #   The register
        A    #   All truthy
       !     #   Logical not
  S          # Sum

qax can be rx

10.701 bytes. I should probably add an is divisible builtin...

Explanation

9.054 bytes

@Sʨɠɠan Omg you've pretty much halved it, thank you!

Pyt, 9 bytes
⁻řĐ←ΠǤ1>·

Try it online!
⁻ř            implicit input (N); decrement and push [1,2,...,N-1]
  Đ           duplicate top of stack
   ←Π         get the product of the members of A
     Ǥ        GCD (elementwise)
      1>      is each GCD greater than 1?
        ·     dot product; implicit print

Nekomata, 7 bytes
ᵒ%ᵐ∏¬x∙

Attempt This Online!
ᵒ%ᵐ∏¬x∙
ᵒ%          Generate a modulo table
  ᵐ∏        Take product of each row
    ¬       Logical not
     x∙     Dot product with range from 0 to length - 1

Itr, 13 bytes
#º#Xáà%¬*«ÍÌS
online interpreter
Explanation
#              ; read the number
 º             ; convert it to a zero-based range
  #            ; read the list of numbers
   ×     «     ; execute for each pair of numbers in the input
    áà         ; duplicate the lower number in the pair
      %¬       ; check for divisibility
        *      ; keep the number if it is divisible
         ÍÌ    ; uniquify the list
           S   ; sum up the elements

Itr, 11 bytes
using implicit IO
ºXâà%¬*«ÍÌS

Rust, 52 bytes
|n,v|(1..n).filter(|e|v.iter().any(|x|e%x==0)).sum()

Rust Playground

Python 2, 80 Bytes
This is very long. Can definitely be shortened. Taking the 3 numbers as separate inputs is definitely hurting the score.
i=input
x=i();y=i();z=i();s=c=0
exec("if c%z<1 or c%y<1:s+=c\nc+=1\n"*x)
print s

You could do x,y,z=input() and give input in the form of (1000,3,5).

Actually, 13 bytes
DR∙`i;)%Y*`MΣ

Try it online!
Explanation:
DR∙`i;)%Y*`MΣ
DR             range(1, N)
  ∙            Cartesian product with A
   `i;)%Y*`M   for each pair:
    i;)          flatten, make a copy of the value from the range
       %Y        test if value from range divides value from A
         *       value from range if above is true else 0
            Σ  sum

Common Lisp, 77
(lambda(n x)(loop for i below n when(some(lambda(u)(zerop(mod i u)))x)sum i))

Ungolfed
(lambda (limit seeds)
  (loop for i below limit
        when (some (lambda (u) (zerop (mod i u))) seeds)
          sum i))

Scala, 47 bytes
n=>1.to(n(0)-1).filter(i=>n.exists(i%_==0)).sum

n is a List which contains of a first argument N, the rest are elements of A
Works by filtering out numbers where there doesn't exist at least one A of which i is a multiple, then summing.  Strictly speaking we should use n.tail.exists inside the closure, but as i is always less than N and therefore never a multiple of N the solution is still complete without this.

PowerShell, 57 bytes
param($a,$b)(1..--$a|?{$i=$_;$b|?{!($i%$_)}})-join'+'|iex

Try it online!
Iterative solution. Takes input as a number $a and as a literal array $b. Loops from 1 up to one below $a (via --$a), using a Where-Object operator |?{...} with a clause to select certain numbers.
The clause sets $i to be the current number before sending input array $b into another |?{...}, here picking out those items where the current number is evenly divided by at least one of the numbers in $b. Those elements of $b that do divide evenly are left on the pipeline.
Thus, if there is at least one element from $b, the pipeline contains an element, so the outer Where is $true and the current number is left on the pipeline. Otherwise, with no elements from $b on the pipeline, the outer Where is $false, so the current number is not placed on the pipeline.
Those numbers are all gathered up in parens, -joined together with + signs, and piped to |iex (short for Invoke-Expression and similar to eval). The summation result is left on the pipeline, and output is implicit.

PHP, 78 76 74 bytes
for(;++$i<$argv[$f=$k=1];$s+=$i*!$f)for(;$v=$argv[++$k];)$f*=$i%$v;echo$s;

The outer loop runs $i from 1 to below first argument and adds $i to $s if $f is not set.
The inner loop multiplies $f with ($i modulo argument) for all subsequent arguments, setting $f to 0 if $i is the multiple of any of them.
Run with -r.

Java 8, 75 bytes
(N,A)->IntStream.range(1,N).filter(x->A.stream().anyMatch(y->x%y==0)).sum()

The method signature for this is int f(int N, List<Integer> A)

C11, 177 bytes
#include"object.h"
#define S size_t
S g(S m,array_t*d){S s,i,l,j;for(s=i=0;i<m;i++){for(l=1,j=0;j<d->idx+1;l*=i%(S)(*array_get_ref(d,j++,NULL))->fwi->value);s+=l?0:i;}return s;}

Requires this set of headers in the same folder, and the fnv-hash library found there as well. Compile like gcc 1.c ../fnv-hash/libfnv.a -o 1 -DNODEBUG
Test Program:
#include "../calc/object/object.h"
#include <stdio.h>

size_t f (const size_t max, const size_t a, const size_t b);
size_t f2 (const size_t max, const array_t* const divs);
size_t g (size_t max, array_t* divs);

define_array_new_fromctype(size_t);

int main(void) {
  printf("%zu\n", f(10, 3, 5));
  static const size_t a[] = {
    3, 5
  };
  array_t* b = array_new_from_size_t_lit(a, 2, t_realuint);
  printf("%zu\n", f2(10, b));
  printf("%zu\n", g(10, b));
  array_destruct(b);
  return 0;
}

size_t f (const size_t max, const size_t a, const size_t b) {
  size_t sum = 0;
  for (size_t i = 0; i < max; i++) {
    sum += (i % a * i % b) ? 0 : i;
  }
  return sum;
}

size_t f2 (const size_t max, const array_t* const divs) {
  size_t sum = 0;
  const size_t len = array_length(divs);

  for (size_t i = 0; i < max; i++) {
    size_t mul = 1;
    for (size_t j = 0; j < len; j++) {
      object_t** this = array_get_ref(divs, j, NULL);

      fixwid_t*   num = (*this)->fwi;

      mul *= i % (size_t) num->value;
    }
    sum += mul ? 0 : i;
  }
  return sum;
}

#define S size_t
S g(S m,array_t*d){S s,i,l,j;for(s=i=0;i<m;i++){for(l=1,j=0;j<d->idx+1;l*=i%(S)(*array_get_ref(d,j++,NULL))->fwi->value);s+=l?0:i;}return s;}

outputs
23
23
23

Whispers v2, 178 bytes
> Input
> Input
> ℕ
>> (1)
>> ∤L
>> {L}
>> L∩2
>> #L
>> L∈3
>> L⋅R
>> Each 5 4
>> Each 6 11
>> Each 7 12
>> Each 8 13
>> Each 9 14
>> Each 10 15 4
>> ∑16
>> Output 17

Try it online!
Structure tree:

How it works
Very simply, we put each number (the lines with Each on them) through a series of functions (the lines with L on them), then, based off the results of those functions, we discard some numbers and keep the rest, before finally summing them. In fact, we can define those functions, where \$\alpha\$ denotes the set of numbers given as input:
\begin{align}
f(x) & = \{i \: | \: (i|x), i \in \mathbb{N}\} & \text{i.e. the set of divisors of} \: x \\
g(x) & = f(x) \cup \alpha & \text{i.e. the union of the divisors of} \: x \: \text{with} \: \alpha \\
h(x) & = |g(x)| > 0 & \text{i.e.} \: g(x) \: \text{is not empty}
\end{align}
This is what lines 5 through to 10 represent. Lines 11 through 16 are simply the application of those three functions. Once we've defined all the functions, we then mutate \$\alpha\$ to \$\beta\$ according to the following rule:
$$\beta_i =
\begin{cases}
\alpha_i & h(\alpha_i) \: \top \\
0 & h(\alpha_i) \: \bot
\end{cases}$$
where \$\alpha_i\$ denotes the \$i\$th element of \$\alpha\$, and the same for \$\beta\$. Finally, we can simply take the sum of \$\beta\$, as the \$0\$ elements do not affect the sum.

K (oK), 15 14 bytes
Solution:
{+/&|/~y!\:!x}

Try it online!
Examples:
{+/&|/~y!\:!x}[50;,2]
600
{+/&|/~y!\:!x}[10;3 5]
23

Explanation:
{+/&|/~y!\:!x} / the solution
{            } / lambda taking implicit x and y
           !x  / range 0..x-1
       y!\:    / modulo (!) x with each-left (\:) item in y
      ~        / not
    |/         / min-over to flatten into single list
   &           / indices where true
 +/            / sum up

Pip, 12 bytes
$+Y0N_%gFI,q

Try it online!
Explanation
Uses a somewhat unusual input method: takes N from stdin and the set of divisors as command-line args.
$+Y0N_%gFI,q
              g is list of command-line args (implicit)
           q  Read a line of stdin
          ,   Range from 0 up to one less than that value
        FI    Filter on this function:
     _         Take each element
      %g       mod the list of divisors g
   0N          Check if zero is in the result list: some number in g divides the element exactly
              Result: a list of the numbers that are a multiple of one of the set of divisors
  Y           Yank (no-op to manipulate operator precedence)
$+            Fold on addition

Io, 63 bytes
Port of NikoNyrh's answer.
method(N,A,A map(i,Range 0toBy(N-1,i)asList)flatten unique sum)

Try it online!
Explanation
method(N,A,                                                   ) // Take two inputs, the number and the array
           A map(i,                        )                    // For each item in the array A:
                   Range 0toBy(N-1,i)                           //     Generate a range from 0 to N-1, with the step of i
                                     asList                     //     Convert it to a list
                                            flatten             // Flatten the lists
                                                    unique      // Uniquify them
                                                           sum  // Sum the resulting list

Scala, 45 41 bytes
s=>0 to _-1 filter(x=>s.exists(x%_<1))sum

Try it in Scastie
Takes as its input a List[Int] s and an Int, creates a range from 0 to that number, filters every number in that range that's divisible by an element in s, and sums it.
Requires language:postfixOps.

Arn, 15 bytes
pIÔX╗▀‹·¬○¯vËa?

Explained
Unpacked: +\$v{$:{!v%}?1}1->
  \ Fold with...
+ ...addition
    $ Filter with...
      v{ ...block with key of v
        $: Any operation
          { Block with key of _
            ! Boolean not
              v% v modulo _ (implied)
          }
          ?1 Each element on second line of _ (implied)
        }
        1-> Range, [1, _)

When passing an array in string or integer context, Arn will automatically take the 0th element. When passing a string/integer in array context, Arn will split on spaces if there are any or every character otherwise.
STDIN is initialized to the _ variable, split on newlines if there are any or just a string if one line.
Originally I had +\$v{$:{0=v%}?1}1->, which was 1 byte longer.

Vyxal s, 5 bytes
ɽ'⁰Ḋa

Try it online!
Explanation:
ɽ      # Range 1 to n-1
 '     # Keep those that are
   Ḋ   #   Divisible by
    a  #   Any of
  ⁰    #   The second input
       # Sum with the s flag

Thunno 2 S, 5 bytes
Læ¹ḊS

Try it online!
Thunno 2 S, 6 bytes
LsȷḊʂV

Try it online!
Explanations
Læ¹ḊS   # Implicit input           ->  [2,3,5], 50
L       # Lowered range            ->  [2,3,5], [0..49]
 æ      # Filtered by:             ->     0       1    ...   48      49
  ¹Ḋ    #  Divisible by 2nd input  ->  [1,1,1] [0,0,0]     [1,1,0] [0,0,0]
    S   #  Sum (any are true)      ->     3       0    ...    2       0
        # (End filter)             ->  [0,2,3,4,5,...,42,44,45,46,48]
        # (S flag) Sum the list    ->  857
        # Implicit output

LsȷḊʂV  # Implicit input
        #   [2,3,5], 50
L       # Take the lowered range of the first input
        #   [2,3,5], [0..49]
 s      # Swap the two values on the stack
        #   [0..49], [2,3,5]
  ȷḊ    # Outer product over divisibility check
        #   [[0%2==0, 0%3==0, 0%5==0], ..., [49%2==0, 49%3==0, 49%5==0]]
        #   [[1,1,1], [0,0,0], [1,0,0], ..., [0,0,0], [1,1,0], [0,0,0]]
    ʂ   # Sum each inner list (check if any are true)
        #   [3,0,1,1,1,...,2,1,0,2,0]
     V  # Get the indices of truthy (non-zero) items
        #   [0,2,3,4,5,...,42,44,45,46,48]
        # (S flag) Sum the resulting list
        #   857
        # Implicit output

Julia 1.0, 31 bytes
N^A=sum(x->any(@.x%A<1)x,1:N-1)

Try it online!
The function sum can accept a subfunction to be called on each element before summation. I use this to multiply each element x in the range \$[1, N-1]\$ by the boolean value any(@.x%A<1), essentially filtering the range. Julia supports logical indexing for arrays, but this generally requires defining the array first, which often isn't ideal for code golf.
The expression @. vectorizes the functions that follow, but in this case, it doesn't save any bytes over the alternative, x.%A.<1.
-1 byte thanks to MarcMush: use the result of any as a literal coefficient

any(...)x should work for -1 byte

Processing, 88 bytes
int q(int a,int[]b){int s=0,i=0;for(;++i<a;)for(int j:b)if(i%j<1){s+=i;break;}return s;}

Uses the simple for-loop approach, sums all the multiples up and returns it. Input is the format int, int[]array.

Isn't it simpler to just name it java?

J, 18 bytes
[:+/@I.0=*/@(|/i.)

Try it online!
Explanation
[:+/@I.0=*/@(|/i.)  Input: A (LHS), N (RHS)
               i.   Make the range [0, 1, ..., n-1]
             |/     Form the modulus table between each value in A and the range N
         */@(    )  Reduce columns by multiplication
       0=           Test if each value if equal to 0, 1 if true else 0
[:   I.             Find the indicies of 1s
  +/@               Reduce by addition and return

Batch, 110 bytes
@set t=-%1
@for /l %%i in (1,1,%1)do @set p=1&(for %%e in (%*)do @set/ap*=%%e%%%%i)&set/at+=%%i*!p
@echo %t%

Takes input as command-line arguments; the first argument is n, the rest are the set of numbers. Works by computing the product of the remainders of all numbers up to and including n with each of the arguments including n itself and summing those numbers with a zero product; this causes n to always be included in the total so we offset that by starting the total at -n.

awk, 64 bytes
{for(;i++<NF;j=0)while((c=$i*++j)&&c<$NF)a[c];for(i in a)$0+=i}1

Write the code to file program.awk and execute:
$ echo run 2 3 5 50 | awk -f this.awk
857

run is a cludge to allow using record $0 for summing and shorter printing, emphasis on the latter.
Try it online

Racket 94 bytes
(apply +(remove-duplicates(for*/list((i(range 1(car l)))(j(cdr l))#:when(= 0(modulo i j)))i)))

Ungolfed:
(define (f l)
  (apply +
         (remove-duplicates
          (for*/list
              ((i (range 1 (first l)))
               (j (rest l))
               #:when (= 0 (modulo i j)))
            i))))

Testing:
(f '(10 3 5))
(f '(50 2))
(f '(28 4 2))
(f '(19 7 5))
(f '(50 2 3 5))

Output:
23
600
182
51
857

PHP, 80 bytes
for($c=1;++$i<$argv[1];$c++?:$t+=$i)for($j=1;$v=$argv[++$j];$i%$v?:$c=0);echo$t;

Run from command line with -r. First argument is the limit N, any subsequent arguments are our positive integers A.
Our outer loop goes through the range 1..N, while the inner loop goes through each value of A and checks to see if $i is a multiple of it. If it is, we set a flag that tells our outer loop to add $i to our total ($t). We use a flag so that we don't add $i more than once. We then output our total at the end.

R, 39 bytes
z=2:N-1;z%*%!!rowSums(!outer(z,X,"%%"))

N is the number, X is a vector of divisors

Clojure, 44 bytes
#(apply +(set(mapcat(partial range 0 %)%2)))

Instead of generating the whole range form 0 to N it is generating values on that range with step length of A_0, A_1, etc. and uses set to get unique values.
Calling convention:
(def f #(apply +(set(mapcat(partial range 0 %)%2))))
(f 50 [2 3 5])

Steps are more clear when ->> macro is used:
(defn f [N A] (->> A (mapcat #(range 0 N %)) set (apply +)))

Python 3 & 2.7, 55 bytes
Based on the same set idea as my Clojure version.
lambda N,A:sum(set(i for a in A for i in range(0,N,a)))

C#, 92 bytes
n=>{int i=0,j,s=0;for(;i<n[0];i++)for(j=1;j<n.Length;)if(i%n[j++]<1){s+=i;break;}return s;};

Anonymous function which receives an array containing the upper limit and all required divisors.
This method does not use a set (actually HashSet in C#) since it was way too verbose. Not that this code is too succinct...
Full program and test cases:
using System;

public class Program
{
    public static void Main()
    {
        Func<int[], int> f =
        n =>
        {
            int i = 0, j, s = 0;
            for ( ; i < n[0] ; i++)
                for (j = 1 ; j < n.Length ; )
                    if (i % n[j++] < 1)
                    {
                        s += i;
                        break;
                    }
            return s;
        };

        // test cases:
        Console.WriteLine(f(new int[]{50, 2})); // 600
        Console.WriteLine(f(new int[]{10, 3, 5}));  // 23
        Console.WriteLine(f(new int[]{28, 4, 2}));  // 182
        Console.WriteLine(f(new int[]{19, 7, 5}));  // 51
        Console.WriteLine(f(new int[]{50, 2, 3, 5}));   // 857
    }
}

APL(NARS), 17 chars, 34 bytes
{+/∪⍺∼⍨∊⍵×⍳¨⌊⍺÷⍵}

test:
  f←{+/∪⍺∼⍨∊⍵×⍳¨⌊⍺÷⍵}
  50 f 2
600
  10 f 3 5
23
  28 f 4 2
182
  19 f 7 5
51
  50 f 2 3 5
857

Perl 5 -pa, 44 bytes
map{$"="*$_%";$\+=!eval"$_%@F"&&$_}1..<>-1}{

Try it online!
Takes the list of A on the first line of input, space separated.  Takes N on the second line.

Headass, 74 bytes
{N)OUO}:+E.UO^UO[{UON)}:](D)RP:N+E.U+O-[UOU{R)U-ORO^:R-OUO;UN)}:D)R:R];ONE

Try It Online! - Input is taken as a newline delimited list of numbers, with the first one being N, and the rest being the values of A
tattoo on my forehead that says I LOVE EASY CHALLENGES
Explanation
PREAMBLE: this program counts up from 0 to N, with this increasing value being
referred to as the "counter". along the way it reads members of A, which
will be given "countdown timers", which start at 0 and are reset to the
associated A member value minus one, so that every A[i]th cycle, they reach
0 and trigger the adding of the counter to the accumulator.
The accumulator, of course, accumulatizes.

{N)OUO}:+E.  code block 0 (initialization)
{N)   }:     for each input
   OUO         save 0, save input
               this inits the counter, stores N,
               creates a list of countdown timers starting at 0
               and implicitly, an accumulator starting at 0
               all on the queue. the queue now looks like this:
               0 N 0 A1 0 A2 0 A3... 0
        +E   go to code block 1
          .  end code block

UO^UO[{UON)}:](D)RP:N+E.  code block 1 (checking if we're done)
UO^                       set r1 to the counter value
   UO[                    set r2 to N
      {UON)}:             put the rest of the values back on the queue,
                          noting that the accumulator is the last value
             ](D)         if r1 == r2 (the counter has reached N)
                 RP         print the last value added to the queue
                            (which is the accumulator)
                            (and halt)
                   :      else
                    N+E     go to code block 2
                       .  end code block

U+O-[UOU{R)U-ORO^:R-OUO;UN)}:D)R:R];ONE  code block 2
U+O                                      put the counter + 1 onto the queue
U+ -[                                    set r2 to the counter value
     UO                                  put N back on the queue
        {                N)}:            for each member of A
       U R)             U                  if the countdown timer has reached 0
           U-O                               reset the countdown timer
              RO                             put the A member back on the queue
                ^                            raise a flag in r1
                 :                         else
                  R-O                        decrement the countdown timer
                     UO                      put the A member back on the queue
                       ;                   endif
                             D)          if the flag in r1 is down
                               R:  ;O      put the accumulator back on the queue
                                :        else
                                 R];O      increase the accumulator by the
                                           value of the counter
                                     NE  return to code block 1

There's a bunch of implicit re-adding of values to the queue that I don't mention, basically any time I say that I've modified some value, that means I'm saving the modified version to the queue.
Also, registers r0-r3 are reset between code blocks, so you can basically think about them as local variables in each code block. Register r0 is constantly in use but not mentioned due to the language structure, and register r3 is in use whenever ( or ) show up, but it's much easier to abstract these to simple comparisons, since that's all they're used for in this program.
I'm still always learning the best way to explain this language, trying to balance between overexplaining and overabstracting, if anyone has any questions of course feel free to ask, you may have a golf on your hands :P

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