text:
Minimal Centrosymmetrization
Topically related.
Objective: Given a matrix of positive integers \$M\$, output the smallest centrosymmetric matrix which contains \$M\$ (this matrix may contain non-positive integers as well).
A centrosymmetric matrix is a square matrix with rotational symmetry of order 2—i.e. it remains the same matrix after rotating it twice. For example, a centrosymmetric matrix has the top-left element the same as the bottom-right, and the element above the center the same as the one below the center. A useful visualization can be found here.
More formally, given a matrix \$M\$, produce a square matrix \$N\$ such that \$N\$ is centrosymmetric and \$M\subseteq N\$, and there is no other square matrix \$K\$ such that \$\dim K<\dim N\$.
\$A\$ is a subset of \$B\$ (notation: \$A\subseteq B\$) if and only if each value \$A_{i,j}\$ appears at index \$B_{i+i^\prime,j+j^\prime}\$ for some pair of integers \$(i^\prime, j^\prime)\$.
Note: some matrices have multiple solutions (e.g. [[3,3],[1,2]] being solved as [[2,1,0],[3,3,3],[0,1,2]] or [[3,3,3],[1,2,1],[3,3,3]]); you must output at least one of the valid solutions.
Test cases
input
example output

[[1, 2, 3],
 [4, 5, 6]]
[[1, 2, 3, 0],
 [4, 5, 6, 0],
 [0, 6, 5, 4],
 [0, 3, 2, 1]]

[[9]]
[[9]]

[[9, 10]]
[[9, 10],
 [10, 9]]

[[100, 200, 300]]
[[100, 200, 300],
 [  0,   0,   0],
 [300, 200, 100]]

[[1, 2, 3],
 [4, 5, 4]]
[[1, 2, 3],
 [4, 5, 4]
 [3, 2, 1]]

[[1, 2, 3],
 [5, 6, 5],
 [3, 2, 1]]
[[1, 2, 3],
 [5, 6, 5],
 [3, 2, 1]]

[[4, 5, 4],
 [1, 2, 3]]
[[3, 2, 1],
 [4, 5, 4],
 [1, 2, 3]]

[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
 [1, 1, 1, 9, 9, 9, 9, 9, 9, 9],
 [1, 1, 1, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 1]]
[[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 9],
 [1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [1, 1, 1, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1],
 [9, 9, 9, 9, 9, 9, 9, 9, 9, 1, 1, 1],
 [9, 9, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]

Why do Centrosymmetric matrices have to be square?

@WW in a general sense, I don't suppose it has to be. For this question, however, they must be square by definition

I was wondering why you made that choice

@WW it was a simplification I thought to be useful for clarity

Brachylog, 12 bytes
ṁ↔ᵐ↔?aaᵐ.&≜∧

Try it online!
Contrary to most Brachylog answers, this takes the input through the Output variable ., and outputs the result through the Input variable ? (confusing, I know).
Explanation
ṁ              We expect a square matrix
 ↔ᵐ↔?          When we reverse the rows and then the matrix, we get the initial matrix back
    ?a         Take an adfix (prefix or suffix) of that square matrix
      aᵐ       Take an adfix of each row of that adfix matrix
        .      It must be the input matrix
         &≜    Assign values to cells which are still variables (will assign 0)
           ∧   (disable implicit unification between the input and the output)

8 bytes, gives all valid matrices
Technically, this program also works:
ṁ↔ᵐ↔?aaᵐ
But this will leave as variables the cells which can take any value (they show as _XXXXX, which is an internal Prolog variable name). So technically this is even better than what is asked, but I guess it's not what the challenge asks for.

I wish ≜ did delayed labeling...

@EriktheOutgolfer Instant labeling is still useful when we need to enumerate things, so ideally we would need two different predicates…

JavaScript (ES6), 192 180 177 bytes
f=(m,v=[w=0],S=c=>v.some(c))=>S(Y=>S(X=>!m[w+1-Y]&!m[0][w+1-X]&!S(y=>S(x=>(k=(m[y-Y]||0)[x-X],g=y=>((r=a[y]=a[y]||[])[x]=r[x]||k|0)-k)(y)|g(w-y,x=w-x)),a=[])))?a:f(m,[...v,++w])

Try it online!
Algorithm
Starting with \$w=0\$:

We consider a square container matrix \$M\$ of width \$w+1\$.
We consider each pair \$(X,Y)\$ such that the input matrix \$m\$ can fit within the container matrix when it's inserted at these coordinates.
Example:

$$\begin{align}w=2,&&(X,Y)=(0,1),&&m = \pmatrix{4,5,4\\1,2,3}\end{align}\\
M=\pmatrix{\color{gray}0,\color{gray}0,\color{gray}0\\4,5,4\\1,2,3}$$

We test whether we can complete the matrix such that it's centrosymmetric.
Example:

$$M^\prime=\pmatrix{\color{blue}3,\color{blue}2,\color{blue}1\\4,5,4\\1,2,3}$$

We increment \$w\$ until we find such a valid configuration.

Python 2, 242 227 226 bytes
r=range
def f(m):
 w,h=len(m),len(m[0]);W=max(w,h)
 while 1:
	for x in r(1+W-w):
	 for y in r(1+W-h):
		n=n=eval(`[W*[0]]*W`);exec"for i in r(w):n[i+x][y:y+h]=m[i]\nN=n;n=[l[::-1]for l in n[::-1]]\n"*2
		if n==N:return n
	W+=1

Try it online!

Saved:

-1 byte, thanks to Jonathan Frech

n=[W*[0]for _ in r(W)] can be n=eval(\[W*[0]]*W`)`.

@JonathanFrech Thanks :)

Jelly, 27 bytes
oZ0ṁz0o⁸ṚUŻ€Z$2¡LÐ¡o⁸ṚU$ƑƇḢ

Try it online!
Newlines added to actual output over TIO for clarity.

Clojure 254 bytes
(defn e[l m](let[a map v reverse r repeat t concat c count f #(v(a v %))h(fn[x](t(a #(t %(r(- l(c(first x)))0))x)(r(- l(c m))(r l 0))))k(fn[x](a(fn[v w](a #(if(= %2 0)%1 %2)v w))x(f x)))n(k(h m))o(k(h(f m)))z #(= %(f %))](if(z n)n(if(z o)o(e(inc l)m)))))

Jinkies, Scoob
Try it online!


text:
Most Common Multiple
Not to be confused with Least Common Multiple.
Given a list of positive integers with more than one element, return the most common product of two elements in the array.
For example, the MCM of the list [2,3,4,5,6] is 12, as a table of products is:
    2  3  4  5  6
  ---------------
2 | #  6  8  10 12
3 | #  #  12 15 18
4 | #  #  #  20 24
5 | #  #  #  #  30
6 | #  #  #  #  #

Thanks DJMcMayhem for the table
As 12 appears the most times (two times as 2*6 and 3*4). Note that we aren't including the product of an element and itself, so 2*2 or 4*4 do not not appear in this list. However, identical elements will still be multiplied, so the table for [2,3,3] looks like:
    2  3  3
  ----------
2 | #  6  6
3 | #  #  9
3 | #  #  #

With the MCM being 6.
In the event of a tie, you may return any of the tied elements, or a list of all of them.

This is code-golf, so the shortest byte count for each language wins!

Test-cases:
[2,3,4,5,6] -> 12
[7,2] -> 14
[2,3,3] -> 6
[3,3,3] -> 9
[1,1,1,1,2,2] -> 2
[6,200,10,120] -> 1200
[2,3,4,5,6,7,8,8] -> 24
[5,2,9,10,3,4,4,4,7] -> 20
[9,7,10,9,7,8,5,10,1] -> 63, 70, 90 or [63,70,90]

Sandbox (deleted)

Is there test case where a whole N*N most isn't triangle most?

Brachylog, 11 bytes
{⊇Ċ×}ᶠọtᵒth

Try it online!
Explanation
{   }ᶠ          Find all:
 ⊇Ċ×              Product of a subset of 2 elements
      ọtᵒ       Order by occurrences
         th     Take the last element and discard the number of occurrences

I don't know how code golf usually works but aren't some of these characters outside the standard 256 code points and therefore multiple bytes each?

@Holloway Brachylog uses a custom code page

R, 54 50 41 bytes
order(-tabulate(combn(scan(),2,prod)))[1]

Try it online!
Alternatively, for 54 53 44 bytes:
names(sort(-table(combn(scan(),2,prod))))[1]

Try it online!
In principle, the latter version outputs the relevant result even without the names function, but followed by the count of such most frequent products, which isn't asked for...
Thanks to CriminallyVulgar  for -4 and -1, and Giuseppe for -9 on both.

On the second on you can use -table() instead of descending=TRUE for -1. I really like the cleverness of the first one though. EDIT: Just realised you can also apply that to the first one for -4, so there's that. Try it online!

combn(scan(),2,prod) works instead of using apply

Jelly, 6 bytes
ŒcP€Æṃ

Try it online! or Check out the test suite.
How it works

ŒcP€Æṃ – Full program / Monadic link.
Œc     – Unordered pairs without replacement.
  P€   – Product of each.
    Æṃ – Mode (most common element).

Alternative: ŒcZPÆṃ

MATL, 8 7 bytes
2XN!pXM

Try it online!
(-1 byte by using the method from @Mr. Xcoder's Jelly answer.)
2XN     % nchoosek - get all combinations of 2 elements from input
!p      % get the product of each combination
XM      % 'mode': get the most common value from that

Older answer:
8 bytes
&*XRXzXM

Try it online!
&*    % multiply input by its transpose,
      %  getting all elementwise products
XR    % take the upper-triangular portion of that,
      %  zeroing out repetitions and mainly self-multiplications
Xz    % remove the zeroed out parts
XM    % 'mode' calculation - get the most common value from that

Pyth, 12 bytes
eo/QN=*M.cQ2

Test suite
First, we take all 2 element combinations of the input without replacement (.cQ2). Then, we map each of these pairs to their product (*M). Next, we overwrite the input variable with the list of products (=). Next, we sort the list of products by the number of occurrences in the list of products (o/QN). Finally, the take the final element of the sorted list (e).

05AB1E, 8 6 bytes
æ2ùP.M

-2 bytes thanks to @Kaldo.
Try it online or verify all test cases.
Explanation:
æ         # Take the powerset of the input-list
          #  i.e. [2,3,3] → [[],[2],[3],[3],[2,3],[2,3],[3,3],[2,3,3]]
 2ù       # Leave only the inner lists of size 2:
          #  i.e. [[],[2],[3],[3],[2,3],[2,3],[3,3],[2,3,3]] → [[2,3],[2,3],[3,3]]
   P      # Take the product of each remaining pair
          #  i.e. [[2,3],[2,3],[3,3]] → [6,6,9]
    .M    # Only leave the most frequent value(s) in the list
          #  i.e. [6,6,9] → [6]

æ2ùP.M for 6 bytes

@Kaldo Thanks! Completely forgot about ù.

Mathematica, 32 bytes
-17 bytes (and a fix) thanks to JungHwan Min.
Commonest[1##&@@@#~Subsets~{2}]&

Pure function. Takes a list of numbers as input and returns the list of MCMs as output.

Actually it looks like both of us misread the question. This fails for input {3, 3, 3}. Fixed: Commonest[1##&@@@#~Subsets~{2}]&

@JungHwanMin Huh. I thought that Subsets didn't count repeats as separate elements. It seems like it does, though, so thanks!

Perl 6, 41 38 bytes
{key max bag(@_ X*@_)∖@_»²: *{*}:}

Try it online!

Could you please explain to me (or point me to the docs) what are the colons doing there? I can't quite make it out... I can see that it has something to do with argument passing but nothing more.

@Ramillies That's the infix : operator.

Ah, I see. Thank you.

MATLAB, 43 bytes
I=input('');i=I'*I*1-eye(nnz(I));mode(i(:))

It's also kind of a tongue twister!
Explanation
I=input('');           % Takes an input like "[2,3,4,5,6]"
i=I'*I                 % Multiplies the input by its own transverse
      *1-eye(nnz(I));  % Multiplies by 1-identity matrix to remove diagonal
mode(i(:))             % Calculates most common value and prints it

i am not sure you need to do I'*I*1-eye Why not just I'*I-eye?

Stax, 12 10 bytes
╢êv^⌐ö►♣Ä»

Run and debug it

JavaScript (ES6), 72 70 bytes
a=>a.map(m=o=(y,Y)=>a.map(x=>Y--<0?m=(o[x*=y]=-~o[x])<m?m:o[r=x]:0))|r

Try it online!

@tsh The problem is the main diagonal, where multiples should not be counted at all. So it fails for the penultimate test case which has three $16$ on the main diagonal, bringing its score high enough to be returned instead of the expected $20$.

Do you need the <0? Top half = Top half + Bottom half

Python 3, 77 72 bytes
f=lambda k,*l,m=[]:l and f(*l,m=m+[k*x for x in l])or max(m,key=m.count)

Try it online!

Attache, 59 bytes
Last##~SortBy#`&&:`~##{Flat[UpperTriangle&1!Table&_!`*]^^0}

Try it online!
Still working on golfing this down a bit, but I think this is near optimal for the approach I've chosen.
Explanation
This is a composition of three functions:

{Flat[UpperTriangle&1!Table&_!`*]^^0}
SortBy#`&&:`~
Last

The first function does the bulk of the computation:
{Flat[UpperTriangle&1!Table&_!`*]^^0}
{                                   }    anonymous lambda; input: _ (e.g.: [2,3,4,5,6])
                      Table&_!`*         shorthand for Table[`*, _]
                                         this creates a multiplication table using the input
                                         e.g.:
                                           4  6  8 10 12
                                           6  9 12 15 18
                                           8 12 16 20 24
                                          10 15 20 25 30
                                          12 18 24 30 36

      UpperTriangle&1!                   takes the strict upper triangle of this matrix
                                         e.g.:
                                          0 6  8 10 12
                                          0 0 12 15 18
                                          0 0  0 20 24
                                          0 0  0  0 30
                                          0 0  0  0  0
Flat[                           ]^^0     flattens this list and removes all 0s
                                         e.g.: [6, 8, 10, 12, 12, 15, 18, 20, 24, 30]

The second is a bit complicated but does something rather simple. First, it is useful to know that f&n is a function which, when called with arguments ...x, returns f[...x, n]. f&:n is similar, returning f[n, ...x]. Now, let's decompose this:
( ~SortBy ) # (`& &: `~)

First, f#g creates a fork. With input n, it returns f[n, g[n]]. However, in this case, f is the function ~SortBy. ~f reverses the arguments of the function. This means that ~f#g is equivalent to f[g[n], n], or here, SortBy[(`& &: `~)[n], n].
`& &: `~ follows the form f&:n. But what are `& and `~? They are "operator quotes", and return a function equivalent to the quoted operator. So, in this case, `& is the same thing as ${ x & y }. With that in mind, this expression is equivalent to the following for binary operators:
f&:n   <=>   ${ f[n, x] }
       <=>   ${ (`&)[`~, x] }
       <=>   ${ `~ & x }

This yields the function `~&x, where x is the result from the first function. n ~ a counts the occurrences of n in a. So, this returns a function which counts the occurrences of the argument in the computed array from function 1.
Going back to SortBy, this each element in the array by the number of times it appears in it.
Finally, Last takes the element which occurs the most. Ties are broken by the sorting algorithm.

Is the UpperTriangle part required? Can you just flatten the table and sort?

@svavil Yes, it is required; [5, 2, 9, 10, 3, 4, 4, 4, 7] -> 16 instead of 20 without it.

APL (Dyalog Unicode), 29 27 19 bytes
{⌈/⊢/⊣¨⌸∊⍵}⍳∘≢↓¨⊢×⊂

Try it online!
Tacit fn.
Thanks to Adám for the tacit version and 2 bytes.
Thanks to ngn for 8 bytes!
How:
{⌈/⊢/⊣¨⌸∊⍵}⍳∘≢↓¨⊢×⊂
                ⊢×⊂   ⍝ Multiply each element with the entire argument, then
           ⍳∘≢↓¨      ⍝ Remove 1 from the first, two from the next etc. (removes repeated multiplications);
                      ⍝ The result is then fed into the function:
{       ∊⍵}           ⍝ Flatten the result;
     ⊣¨⌸              ⍝ Key; creates a matrix in which each row corresponds to a unique product;
   ⊢/                 ⍝ Get the rightmost column of the matrix;
 ⌈/                   ⍝ Get the highest value.

This is only 27.

Thunno 2, 5 bytes
2ċ€pṀ

Explanation
2ċ€pṀ  # Implicit input
2ċ     # Combinations of length 2 of the input
  €p   # Product of each pair in this list
    Ṁ  # Mode of this list
       # Implicit output

Screenshot

Charcoal, 24 bytes
ＷθＦ×⊟θθ⊞υκＩ⊟Φυ⁼№υι⌈Ｅυ№υλ

Try it online! Link is to verbose version of code. Explanation:
Ｗθ

While the input array is non-empty...
×⊟θθ

... pop the last element and multiply the rest of the array by that element...
Ｆ...⊞υκ

... and push the results to the predefined empty list.
⌈Ｅυ№υλ

Count the number of times each product appears in the list and take the maximum...
Φυ⁼№υι...

... then filter for the products whose count equals that maximum...
Ｉ⊟

...then pop the last element and cast to string for implicit print.

Japt, 20 16 bytes

-4 bytes from @Shaggy

£s°Y m*XÃc
ñ@è¥X

Try it online!

16 bytes

You can replace £...Ãc with c@... for -1 byte (not sure it existed at the time)

Husk, 7 bytes
Ṡ►#mΠṖ2

Try it online!
Explanation
Ṡ►#mΠṖ2  -- example input [3,3,3]
     Ṗ2  -- subsequences of length 2: [[3,3],[3,3],[3,3]]
   mΠ    -- map product: [9,9,9]
Ṡ        -- apply
  #      -- | count occurences in list
 ►       -- to maxOn that list: [9]

CJam, 70 68 bytes
q',/S*~_,(:L{LX-,0a\+[{X1++}*](;{_X=\_Y=@*\}fY}fX]~;]_{\_@e=}$\;_,(=

Try it online!
Explanation
q',/S*~                                                                  Turn input string into a valid CJam array
       _,(                                                               Find the length of the array and subtract 1
          :L                                                             Assign the result to L
            {                                 }fX                        Outer for loop
             LX-,0a\+[{X1++}*](;                                         Create an array with all the array indexes bigger than X
                                {          }fY                           Inner for loop
                                 _X=\_Y=@*\                              Create a multiple of array[X] and array[Y] (Guaranteed to be from a unique combination of factors)
                                                 ~;]                     Casts away all stack items except for an array of the multiples
                                                    _{\_@e=}$\;          Sorts array by number of occurrences (largest number of occurences at the end)
                                                               _,(=      Gets the last element of the array

You will need to scroll right to see the explanations as the code is quite long, as well as the explanations.

This was an absolute nightmare to write. CJam doesn't have a powerset function (unlike a ton of other golfing languages - great choice on my part), which means that I had to manually find the powerset. However, this gave me the opportunity to ignore any invalid number of factors, unlike other answers with a powerset function.
This should be golfable, considering I'm terrible at CJam.

Changes:
Helen cut off 2 bytes!
Old: q',/S*~_,1-:L{LX-,0a\+[{X1++}*](;{_X=\_Y=@*\}fY}fX]~;]_{\_@e=}$\;_,1-=
New: q',/S*~_,(:L{LX-,0a\+[{X1++}*](;{_X=\_Y=@*\}fY}fX]~;]_{\_@e=}$\;_,(=
By changing the 1-s to simply ( we get the same effect but with a lower byte count.

Vyxal, 7 6 bytes
-1 byte thanks to The Thonnu
2ḋvΠ∆M

Try it Online!

There's a command for "mode", so you can save one byte: 6 bytes, Try it Online!

You can also use the Cartesian product for 5 bytes: Try it Online!

Cartesian product doesn't actually work so you'll have to switch back to the 6-byter

Java (JDK 10), 132 bytes
a->{int l=a.length,i=l,j=0,r=99999,m[]=new int[r];for(;i-->0;)for(j=l;--j>i;)m[a[i]*a[j]]++;for(;r-->0;)i=m[r]<i?i:m[j=r];return j;}

Try it online!

Haskell, 96 94 bytes
-2 bytes thanks to nimi (using sortOn(0<$) instead of length)!
import Data.List
f a|b<-zip[0..]a=last.last.sortOn(0<$).group$sort[x*y|(i,x)<-b,(j,y)<-b,i/=j]

Try it online!

SQL Server, 93 bytes
SELECT TOP 1a.a*b.a
FROM @ a
JOIN @ b ON a.i<b.i
GROUP BY a.a*b.a
ORDER BY COUNT(a.a*b.a)DESC

Input is assumed to come from a table of the form
DECLARE @ TABLE (A int, i int identity);

Example table population:
INSERT INTO @ VALUES (9), (7), (10), (9), (7), (8), (5), (10), (1);

Explanation:
I assume a "list of integers" will have an index associated with them, which in my case is the column i. The column a contains the values of the list.
I create products of every pair, where the left pair comes in the list earlier than the right pair. I then group on the product, and sort by the most populous number.
I'm a little sad I didn't get to use any cte or partitioning clauses, but they were just too long. SELECT is a very expensive keyword.
Alternative, 183 bytes
WITH c
AS(SELECT a,ROW_NUMBER()OVER(ORDER BY a)r
FROM @),d AS(SELECT a.a*b.a p,COUNT(a.a*b.a)m
FROM c a
JOIN c b ON a.r<b.r GROUP BY a.a*b.a)SELECT TOP 1p
FROM d
ORDER BY m DESC

If SQL doesn't get to have a separate index column, here is a solution where I create an index using the ROW_NUMBER function. I personally don't care about the order, but an order is required and using the a column is the shortest.

MATLAB 39 bytes
a=input('');
b=triu(a'*a,1);
mode(b(b~=0))

Also check out answer by Jacob Watson

Having the second line be b=triu(a'*a,1); saves 4 bytes.

@sundar Oh snap, you are right :) I had triu intially but drifted away somehow

Good solution, I didn't realise the upper triangle function was so short!

CJam, 29 bytes
q~:L,2m*{:-},{Lf=:*}%$e`:e>1=

Try it online!

J, 29 25 24 23 bytes
(0{~.\:1#.=)@(</#&,*/)~

Try it online!
how
(~. {.@\: 1 #. =)@(</ #&, */)~
                  (</ #&, */)~  NB. all products, dups removed:
                          */    NB. create the times table
                   </           NB. lower triangular ones matrix
                       &,       NB. flatten each and
                      #         NB. filter based on lower triangle
                 @              NB. pass that result to
(~. {.@\: 1 #. =)               NB. get the most frequent list item:
       \:                       NB. sort down
 ~.                             NB. the uniq elements
          1 #. =                NB. by their count
    {.@                         NB. and take the first element

Burlesque - 8 bytes
Jcp)pdn!

J        duplicate
 cp      cross product
   )pd   map . product
      n! most common element

Try it online here.
(and yes, Burlesque also has a command for "least common element")

C# (Visual C# Interactive Compiler), 95 bytes
x=>x.SelectMany(y=>(x=x.Skip(1)).Select(z=>y*z)).GroupBy(y=>y).OrderBy(y=>y.Count()).Last().Key

Try it online!
Less golfed code:
// x is a list of integers
x=>
  // iterate over each integer and
  // return a list per element.
  // flatten the list of lists to 1 list
  x.SelectMany(y=>
    // skip the current value and save
    // newly offset list to x so that it
    // can be incrementally offset
    // again next pass
    (x=x.Skip(1))
      // compute the product
      .Select(z=>y*z))
    // get the unique products
    .GroupBy(y=>y)
    // sort the products by number
    // of occurrences
    .OrderBy(y=>y.Count())
    // pick the product with the
    // greatest number of occurrences
    .Last().Key

Husk, 6 bytes
►=mΠṖ2

Try it online!
►= gives -1 over the other answer.
×* has too many duplicates and doesn't give the right value.

Julia 1.0, 99 83 bytes
~=length
!x=argmax(sum.(.==(1:max((M=[x[i]x[j] for i=1:~x for j=i+1:~x])...)),[M]))

Try it online!
-16 bytes (!!) thanks to MarcMush:

Remove * (use implicit multiplication)
Replace map with a broadcast
Replace findmax with argmax
Use the return value of a variable assignment
Use sum instead of count

85 bytes by removing *, avoiding map in favor of broadcasting, reorganizing M and ~, using argmax

C (gcc), 131 bytes
This code compiles and runs fine on my machine, but not on TIO or ATO... probably because the function leaks a few gigabytes of memory each time.
I've included my test suite below if you'd like to try it for yourself. Run at your own risk!
m,p,T;f(n,z,r,b)int*n,*r,*b;{for(r=calloc(T=~(1<<31),4);z--;n++)for(b=n;b++<n+z;)r[*n**b]++;for(m=p=0;T--;p++)m=r[p]>r[m]?p:m;m=m;}

#include <stdio.h>
#include <assert.h>

int main(int argc, char *argv[])
{
    int tests[][9] = {
        {2,3,4,5,6},
        {7,2},
        {2,3,3},
        {3,3,3},
        {1,1,1,1,2,2},
        {6,200,10,120},
        {2,3,4,5,6,7,8,8},
        {5,2,9,10,3,4,4,4,7},
        {9,7,10,9,7,8,5,10,1},
    };

    int expected[] = {
        12,
        14,
        6,
        9,
        2,
        1200,
        24,
        20,
        63
    };

    int sizes[] = {5,2,3,3,6,4,8,9,9};

    for (int i = 0; i < 9; i++)
    {
        printf("[");
        for (int j = 0; j < sizes[i] - 1; j++)
            printf("%d, ", tests[i][j]);
        printf("%d] -> ", tests[i][sizes[i] - 1]);

        int result = f(tests[i], sizes[i]);
        printf("%d\n", result);

        assert(result == expected[i]);
    }

    return 0;
}

Uiua, 16 bytes
⊡1⍖⍘⊚♭×⊞>.⇡⊃⧻⊞×.

Try it!
⊡1⍖⍘⊚♭×⊞>.⇡⊃⧻⊞×.
      ×⊞>.⇡⊃⧻⊞×.  # upper matrix of multiplication table
     ♭            # deshape
⊡1⍖⍘⊚             # number that occurs second most often

-1: ⊢⍖⍘⊚♭≡▽⊞≠.⊃⍏⊞×. Uses rise to create a no-diagonal mask and keep those elements instead of leaving zeros in the matrix.

PHP, 91 bytes
while($c=$argv[++$i])for($k=$i;--$k;)$r[$c*$argv[$k]]++;asort($r);echo end(array_flip($r));

takes input from command line arguments; run with -nr or try it online.
Use PHP 7 to avoid STRICT MODE warning.

Japt -h, 11 bytes
à2 ®×Ãü ñÊÌ

Try it
á2 ®×
ñ@è¥X

Try it

PowerShell, 71 bytes
$m=@()
while($l){$k,$l=$l;$m+=($l|%{$k*$_})}($m|group|sort c*)[-1].Name

Try it online!
Powershell beats python very occasionally.....

JavaScript (Node.js), 68 bytes
a=>+a.flatMap((x,i)=>a.map(y=>a[y*=i--&&-x]=0+a[y]||[-y])).sort()[0]

Try it online!

Factor + math.matrices, 48 bytes
[ dup outer [ 1 + tail ] map-index concat mode ]

Try it online!

dup outer Take the outer product between the input and itself, forming a matrix
[ 1 + tail ] map-index Get the upper triangle of the matrix without the main diagonal
concat Flatten to a list
mode Find the most frequent number

Arturo, 57 bytes
$=>[z:combine.by:2&|map=>[∏&]|tally|maximum[k,v][v]z\0]

Try it

Stax, 8 bytes
ä+G+·♀v▐

Run and debug it
Unpacked:
Stax, 9 bytes
2S{{*km:M

Run and debug it
 S        # Get all combinations of length
2         # 2
  {   m   # And map the following over them:
   { k    # Reduce by
    *     # Multiplication
       :M # Get the mode

Nekomata, 6 bytes
Sđ*aŢṂ

Attempt This Online!
Sđ*aŢṂ
S       Subset
 đ      Unpair; check if length is 2, and push the two elements
  *     Multiply
   a    All possible values
    Ţ   Tally; return a list of unique values and a list of their counts
     Ṃ  Find the minimum value by its count

APL(NARS), 53 chars, 106 bytes
{0=l←↑⍴⍵:⍵⋄t⊃⍨q⍳⌈/q←{+/t=⍵}¨t←×/¨(∊(⍳l)∘.<⍳l)/,⍵∘.,⍵}

Test:
  p←{0=l←↑⍴⍵:⍵⋄t⊃⍨q⍳⌈/q←{+/t=⍵}¨t←×/¨(∊(⍳l)∘.<⍳l)/,⍵∘.,⍵}
  p 9
9
  p 1 3
3
  p 2 3 4 5 6
12
  p 7 2
14
  p 2 3 3
6
  p 3 3 3
9
  p 1 1 1 1 2 2
2
  p 6 200 10 120
1200
  p 2 3 4 5 6 7 8 8
24
  p 5 2 9 10 3 4 4 4 7
20
  p 9 7 10 9 7 8 5 10 1
63
  p 3 3
9

Scala, 140 bytes
Golfed version. Try it online!
def f(_l:Seq[Int],m:Seq[Int]):Int={var l=_l.tail;var k=_l.head;if(l.isEmpty)m.groupBy(identity).maxBy(_._2.size)._1 else f(l,m++l.map(_*k))}

Ungolfed version.
object Main {
  def f(_l: List[Int], m: List[Int]): Int = {
    var l=_l.tail;var k=_l.head;
    if (l.isEmpty) m.groupBy(identity).maxBy(_._2.size)._1
    else f(l, m ++ l.map(_ * k))
  }

  def main(args: Array[String]): Unit = {
    val input = List(
      List(2, 3, 4, 5, 6),
      List(7, 2),
      List(2, 3, 3),
      List(1, 1, 1, 1, 2, 2),
      List(6, 200, 10, 120),
      List(2, 3, 4, 5, 6, 7, 8, 8),
      List(5, 2, 9, 10, 3, 4, 4, 4, 7)
    )
    for (l <- input) {
      val res = f(l, Nil)
      println(res)
    }
  }
}

Input to the function should be a single list, not split up like this

@Jo King Thaks for your comment. I  have modified it.

source: Stack Exchange

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

sort: votes


text:
Belarus rushnyk
We've got quite a few national flag challenges already:
AU
CH
FI
FR
GB
GB
IS
KR
NP
US...
Here's another, somewhat more advanced one:
Return or print the decorative pattern from Belarus's national flag as a matrix of two distinct values for red and white.

If your language doesn't support matrices, use a list of lists or the closest equivalent.
Extra whitespace is allowed on all sides.
The matrix can be transposed.
The elements can have a consistent separator, and so can the rows, e.g. output can be JSON.
You must use the 2012 version of the ornament pattern, not the 1951 or 1995 versions.
This is code-golf, so the shortest answer per language wins.
Sample output:
....###....#....###....
#..#####...#...#####..#
..###.###.....###.###..
.###...###...###...###.
###..#..###.###..#..###
.###...###...###...###.
..###.###.....###.###..
#..#####...#...#####..#
....###....#....###....
..#..#..#.....#..#..#..
.###...###...###...###.
##.##.##.##.##.##.##.##
.###...###...###...###.
..#..#..#.....#..#..#..
....###....#....###....
#..#####...#...#####..#
..#######.....#######..
.#########...#########.
#######################
####...#########...####
.#####..#######..#####.
..###....#####....###..
#..#....#######....#..#
.......####.####.......
#.....####...####.....#
##...####..#..####...##
###.####.......####.###
.######..#...#..######.
..####...##.##...####..
...###....###....###...
....##.#...#...#.##....
...###....###....###...
..####...##.##...####..
.######..#...#..######.
###.####.......####.###
##...####..#..####...##
#.....####...####.....#
.......####.####.......
#..#....#######....#..#
..###....#####....###..
.#####..#######..#####.
####...#########...####
#######################
.#########...#########.
..#######.....#######..
#..#####...#...#####..#
....###....#....###....
..#..#..#.....#..#..#..
.###...###...###...###.
##.##.##.##.##.##.##.##
.###...###...###...###.
..#..#..#.....#..#..#..
....###....#....###....
#..#####...#...#####..#
..###.###.....###.###..
.###...###...###...###.
###..#..###.###..#..###
.###...###...###...###.
..###.###.....###.###..
#..#####...#...#####..#
....###....#....###....

Stax, 68 bytes
àÑΣ▒i╕7FF3xì¥╫Yb▌t╤y╡µåè0═↕h╗ΔDOü↔`◙■^>♀;∟Γ9→§Æ¼$ß⌡╫èj_┐;ø;¡²Ω☺┘4!P╛

Run and debug it
Outputs vertical version, 1 for white, 0 for red. Naive approach: compress top left quarter, then complete.

Python 2, 183 181 bytes
S=[bin(int(''.join(w),36))[2:].rjust(31,'0')for w in zip(*[iter("RBRG5FDLAJ2O77MSE012OBJWJUSWDQ464UKNYZIE8JYGS0JRFOCIJY7U5F983X0LYW20WNTE")]*6)]
for s in S[:0:-1]+S:print s[:0:-1]+s

Try it online!
Outputs transposed version, using 0 and 1 for white and red.

Does this compress the entire string of values for the flag?

@RaghuRanganathan Only a quarter. The for s in S[:0:-1]+S:print s[:0:-1]+s doubles the lines, and print each line doubled

JavaScript (ES6), 164 bytes
Transposed output. Uses 0 for white, 1 for red.
f=(x=y=0)=>y<61?x>22?`
`+f(!++y):(-~'o`xb[FMMf[MM[Fxbo`cCMMZZMMcCo`xb{F}N~~N}}{[wH{?]@NbfvB}H{Wwooa'.charCodeAt((y>30?60-y:y)*2+(X=x>11?22-x:x)/6)>>X%6&1)+f(x+1):''

Try it online! (prettified output)
Using Buffer() in Node.js saves 1 byte.

Charcoal, 93 89 81 bytes
”{“↷Ｂ⦃¶¹¹｜TQ⌊‽÷⪫Mg+℅§ºH·τＰ≔⁻⊗｜Yω¤⁵⊗-κ�κb5Aωγ⎚I0ê﹪oζＭ⟲ºh⟲⮌#⎇s▶‴ψ◧≔◨◧⁺4U×m∧üＦ↑⬤”‖Ｏ¬

My first charcoal answer! :D
Try it online!
Saved 4 bytes by outputting the design horizontally rather than vertically (fewer newlines).
Thanks to @Neil for saving 8 bytes!

‖Ｂ accepts multiple operands, Some combinations even have a single-byte encoding (¬ and L for example).

Also, using spaces instead of .s should save you a few bytes as you don't need spaces at the end of a line.

(I don't know which of vertically or horizontally will result in more spaces at the ends of lines).

I tried ‖Ｂ¬ and it doesn't help because the reflected string literal costs an extra byte, but ‖ＢL does save a byte because the line-reversed string literal is the same byte count.

On the other hand, for vertical output, ‖ＢL gets me to 83 bytes, and ‖Ｂ¬ can be done in 81 bytes: Try it online!

SOGL V0.12, 61 56 bytes
 №α⁶U-┼°jōIΤ$ΣΧρ←FVξÆ⅝{VqM┼οYΠ!↕οΩÆ.χg±└¶Σ,Cy′┌“2─±6«n╬,

Try it Here!

Python 2, 153 bytes
00000000: 2363 6f64 696e 673a 4c31 0a66 6f72 2079  #coding:L1.for y
00000010: 2069 6e20 7261 6e67 6528 2d33 302c 3331   in range(-30,31
00000020: 293a 733d 666f 726d 6174 2869 6e74 2827  ):s=format(int('
00000030: 0137 ec80 937f f739 027d 7209 37e7 395c  .7.....9.}r.7.9\
00000040: 30cc ef73 108c 1fff fe41 b14e fb14 1bfe  0..s.....A.N....
00000050: d364 09ce f7ff fc81 18c6 c811 8cec 8111  .d..............
00000060: 272e 656e 636f 6465 2827 6865 7827 295b  '.encode('hex')[
00000070: 6162 7328 7929 3a3a 3331 5d2c 3136 292c  abs(y)::31],16),
00000080: 2730 3132 6227 293b 7072 696e 7420 732b  '012b');print s+
00000090: 735b 2d32 3a3a 2d31 5d                   s[-2::-1]

Try it online!

Perl 5, 121 bytes
Uses 1 for white pixels and 0 for red.
$_=unpack"B*",'ñæÄxããÄvñí·Ž2IŽ=·ñæÀxàƒxoá|3†øÃž<òà';say for(@a=map{s/.$//r.reverse}/.{12}/g),pop@a&&reverse@a

This script contains unprintable characters so a reversible hexdump is included in the verification link below.
Try it online!
Verification of code length.
Explanation
The top quarter of the pattern is stored within the binary blob. This just uses Perl's pack function with the original binary string (after replacing . and # with 1 and 0). This allows us to store 8 bits of the pattern in each byte. Once we've unpacked the data, we have the long binary string, which we break down into sections of length 12, concatenate with the reverse (except for the duplicated middle character) and then loop over the list of sections (concatenated with the reverse of the list, except for the duplicated middle element) and output them all using say, which adds in a newline.

Deadfish~, 2644 bytes
{iii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiicccdccicdccicccdcicccdccicdcciccc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiiccdciccdciccdciccdciccdciccdciccdcicc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccicccccccdcccccicccccccdcc{dd}ddc{ii}iicicccccccccdcccicccccccccdc{dd}ddc{ii}iii{cc}ccc{dd}dddc{ii}iiiccccdcccicccccccccdcccicccc{dd}dddc{ii}iicicccccdccicccccccdccicccccdc{dd}ddc{ii}iiccicccdccccicccccdccccicccdcc{dd}ddc{ii}iiicdccicdccccicccccccdccccicdccic{dd}dddc{ii}iiccccccciccccdciccccdccccccc{dd}ddc{ii}iiicdccccciccccdccciccccdcccccic{dd}dddc{ii}iiiccdccciccccdccicdcciccccdcccicc{dd}dddc{ii}iiicccdciccccdccccccciccccdciccc{dd}dddc{ii}iiciccccccdccicdcccicdcciccccccdc{dd}ddc{ii}iicciccccdccciccdciccdccciccccdcc{dd}ddc{ii}iicccicccdccccicccdccccicccdccc{dd}ddc{ii}iicccciccdcicdcccicdcccicdciccdcccc{dd}ddc{ii}iicccicccdccccicccdccccicccdccc{dd}ddc{ii}iicciccccdccciccdciccdccciccccdcc{dd}ddc{ii}iiciccccccdccicdcccicdcciccccccdc{dd}ddc{ii}iiicccdciccccdccccccciccccdciccc{dd}dddc{ii}iiiccdccciccccdccicdcciccccdcccicc{dd}dddc{ii}iiicdccccciccccdccciccccdcccccic{dd}dddc{ii}iiccccccciccccdciccccdccccccc{dd}ddc{ii}iiicdccicdccccicccccccdccccicdccic{dd}dddc{ii}iiccicccdccccicccccdccccicccdcc{dd}ddc{ii}iicicccccdccicccccccdccicccccdc{dd}ddc{ii}iiiccccdcccicccccccccdcccicccc{dd}dddc{ii}iii{cc}ccc{dd}dddc{ii}iicicccccccccdcccicccccccccdc{dd}ddc{ii}iiccicccccccdcccccicccccccdcc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiiccdciccdciccdciccdciccdciccdciccdcicc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicdccicdccicdcccccicdccicdccicdcc{dd}ddc{ii}iiccccicccdccccicdccccicccdcccc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiicccdccicdccicccdcicccdccicdcciccc{dd}dddc{ii}iicicccdcccicccdcccicccdcccicccdc{dd}ddc{ii}iiccicccdcicccdcccccicccdcicccdcc{dd}ddc{ii}iiicdccicccccdcccicdcccicccccdccic{dd}dddc{ii}iiccccicccdccccicdccccicccdcccc

A code-only answer isn't very interesting... Could you provide an explanation as to how this code produces the output for the challenge?

Read the wiki. It's not a very interesting language.

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


text:
Evaluate Words Based on "Rules" (Skeptics.SE Crossover)
I came across this picture, which I initially questioned and thought about posting to Skeptics. Then I thought they'll only tell me if this one case is true, but wouldn't it be great to know how true any "rule" really is? Today you're going program a skeptic-bot
Challenge
Write a program or function which when given a dictionary of valid words and a rule determines if the rule is well applied
Rules

The dictionary is "words.txt" taken from here. Your submission must theoretically be able to review all words in the file, but for testing you may use a shortened list
"Rules" come in the form x before y except <before/after> z.  Your submission may take that input in any reasonable form, some examples below
Compliance is defined as: "There is an adjacent x and y in the word in the right order that are in the reverse order if before/after z"
Non-compliance is defined as: "There is an adjacent x and y in the word in the incorrect order or they are not reverse if before/after z"
Rules are evaluated case insensitive
Output or return a truthy value if the number of compliant words in the dictionary is greater than the number of non-compliant words, otherwise output a falsey value. Submissions cannot end in errors.
This is code-golf, so shortest submission in bytes wins

Example input:
["i","e","-","c"]  #list of values, "-" denotes "after"
[105,101,-99]    #list of values as ASCII numbers, "-99" denotes "after"
"ieac"           #string of values abbreviated

Test Cases
Below are sample cases as inputs, for clarity I list the matching words but this is not required
Example dictionary: ["caught", "lemon", "simplified", "queue", "qwerty", "believe", "fierce", "receive", "science", "foreign", "weird", "quit"]
Input: "I before E except after C"
Compliant: simplified, believe, fierce, receive
Noncompliant: science, foreign, weird
Output: Truthy

Input: "Q before U except before E"
Compliant: quit
Noncompliant: queue
Output: Falsey

Input: "C before E except before E"
Compliant: fierce, receive, science
Noncompliant:
Output: Truthy

Looks like your link died :/

Python3, 105 103 bytes
This is my first golf here so be kind =)
-2 bytes tanks to Chas Brown
lambda d,b,x,y,z:sum((x+y in i)-2*((z*b+x+y+z)[:3]in i)-(y+x in i)+2*((z*b+y+x+z)[:3]in i)for i in d)>0

Takes the dictionary d as any iterator of strings; a boolean 'b' (True being after); and the three letters x,y,z as Strings;
Try it online!
Explanation: might add later

You can save a few bytes by replacing ...] in i with ...]in i in a couple of places. Welcome to PPCG!

Java 8, 210 bytes
(D,a,b,c,f)->D.stream().filter(w->w.contains(a+b)&!w.contains(f?c+a+b:a+b+c)|w.contains(f?c+b+a:b+a+c)).count()>D.stream().filter(w->w.contains(b+a)&!w.contains(f?c+b+a:b+a+c)|w.contains(f?c+a+b:a+b+c)).count()

Takes the dictionary D as a java.util.List<String>; the three letters a,b,c as Strings; and whether it's after or before as a boolean f (truthy being 'after').
EDIT: Surprisingly enough using two .matches with regexes instead of the two times three .contains is longer. And creating variables for f?c+a+b:a+b+c and f?c+b+a:b+a+c is also 1 byte longer.
Try it online.
Explanation:
(D,a,b,c,f)->             // Method with List, 3 Strings, boolean parameters & boolean return
  D.stream()              //  Stream the given dictionary-List
   .filter(w->            //  Filter the words by:
     w.contains(a+b)      //   If the word contains `a+b`
      &!w.contains(f?     //   If the flag is true (after):
                   c+a+b  //    And the word does not contain `c+a+b`
                  :       //   Else (before):
                   a+b+c) //    And the word does not contain `a+b+c`
     |w.contains(f?       //   If the flag is true (after):
                  c+b+a   //    Or the word contains `c+b+a`
                 :        //   Else (before):
                  b+a+c)) //    Or the word contains `b+a+c`
   .count()               //  And get the amount of words left in the filtered result
  >                       //  And return whether this is larger than:
  D.stream()              //  Stream of the given dictionary again
   .filter(w->            //  Filtered by:
     w.contains(b+a)      //   If the word contains `b+a`
      &!w.contains(f?     //   If the flag is true (after):
                    c+b+a //    And the word does not contain `c+b+a`
                   :      //   Else (before):
                    b+a+c)//    And the word does not contain `b+a+c`
     |w.contains(f?       //   If the flag is true (after):
                  c+a+b   //    Or the word contains `c+a+b`
                 :        //   Else (before):
                  a+b+c)) //    Or the word contains `a+b+c`
   .count()               //  And get the amount of words left in the filtered result

Python 2, 109 107 bytes
lambda D,x,y,r,c:sum((((' '+w+' ')[w.find(p)+3*r]!=c)^(p==y+x))*2-1for p in(x+y,y+x)for w in D if p in w)>0

Try it online!
Takes Dictionary and rule input as D,x,y,r,c with r=0 to mean 'before' and r=1 to mean 'after'.


text:
Naismith's rule
Naismith's rule helps to work out the length of time needed for a walk or hike, given the distance and ascent.
Given a non-empty list of the altitude at points evenly spaced along a path and the total distance of that path in metres, you should calculate the time needed according to Naismith's rule.
Naismith's rule is that you should allow one hour for every five kilometres, plus an additional hour for every 600 metres of ascent.
Input must be taken in metres, which is guaranteed to consist of non-negative integers, and output should consistently be either hours or minutes (but not both), and must be able to give decimal numbers where applicable (floating point inaccuracies are OK).
For example, given:
[100, 200, 400, 200, 700, 400], 5000

For the first two elements [100, 200] you have 100 metres of ascent which is 10 minutes. With [200, 400] you have 200 metres of ascent which is 20 minutes, [400, 200] is not ascending so no time is added for that. [200, 700] is 500 metres of ascent which is 50 minutes, and finally [700, 400] is not ascending. One extra hour is added for the distance of five kilometres. This totals to 140 minutes or 2.333... hours.
Test Cases
[0, 600] 2500 -> 1.5 OR 90
[100, 200, 300, 0, 100, 200, 300] 10000 -> 2.8333... OR 170
[40, 5, 35] 1000 -> 0.25 OR 15
[604] 5000 -> 1 OR 60
[10, 10, 10] 2000 -> 0.4 OR 24
[10, 25, 55] 1000 -> 0.275 OR 16.5

The test cases outputs all have whole-minute results, is that intentional? Are inputs like [10], 5125 or [10, 25, 55], 1000 valid and required to be handled?

@sundar Yes, they should.

[10, 25, 55], 1000 -> 0.275 OR 16.5

R,  44  43 42 bytes
function(A,D)sum(pmax(0,diff(A)),D*.12)/10

Try it online!
-1 byte by using pmax as multiple other answers do
Takes inputs as Ascent and Distance, and returns the time in minutes.
function(A,D)                                 # take Ascent and Distance
                        diff(A)               # take successive differences of ascents
                 pmax(0,       )              # get the positive elements of those
                                 D*.12        # multiply distance by 0.12
             sum(               ,     )       # take the sum of all elements
                                       /10    # and divide by 10, returning the result

You can get 4 more bytes using pryr::f(sum(pmax(0,diff(A)),D*.12)/10) instead of using function

@Shayne03 that would technically change this answer to "R + pryr" which on the rules of the site counts as a different language than base R, so I'll keep this as it is. Thanks for the suggestion, though!

The explanation is shaped like a hill

JavaScript (ES6), 50 bytes
Saved 1 byte thanks to Giuseppe's answer (dividing by 10 at the end of the process)
Takes input as ([altitudes])(distance). Returns the time in minutes.
a=>d=>a.map(p=n=>d-=(x=p-(p=n))<0&&x,d*=.12)&&d/10

Try it online!

05AB1E, 15 bytes
¥ʒ0›}OT÷s₄;6//+

Try it online!
Returns time in minutes.
Explanation
              + # sum of ...
¥ʒ0›}OT÷        # the sum of positive deltas of the altitude divided by 10
        s₄;6//  # the distance divided by 83.33333333 (500/6, or the amount of meters per minute)

Almost exactly what I had in mind. Only difference I had was ₄12// instead of ₄;6//. So obvious +1 from me.

Haskell, 47 46 bytes
d#l@(_:t)=d/5e3+sum(max 0<$>zipWith(-)t l)/600

Returns the time in hours.
Try it online!

Python 2, 62 60 bytes
Saved 2 bytes thanks to ovs.
lambda e,d:sum((a-b)*(a>b)for a,b in zip(e[1:],e))*.1+d*.012

Try it online!
Returns time in minutes.
# add all increasing slope differences together
sum(
    # multiply the difference by 0 if a<b, else by 1
    (a-b)*(a>b)
                # create a list of pairs by index, like [(1,0), (2,1) ...(n, n-1)]
                # then interate thru the pairs where a is the higher indexed item and b is the lower indexed item
                for a,b in zip(e[1:],e)
    )
    # * 60 minutes / 600 meters == .1 min/m
    *.1
    # 60 minutes / 5000 meters = .012 min/m
    +d*.012

60 bytes

Perl 6, 45 39 37 bytes
6 bytes saved thanks to Jo King.
2 bytes saved thanks to nwellnhof.
(Thanks to both of them, this no longer looks anything like my original submission :—).)
*.&{sum (.skip Z-$_)Xmax 0}/600+*/5e3

Try it online!
The first argument is the list with elevations, the second argument is the length of the trek.
The whole thing is a WhateverCode. If an expression is recognized as such, then each * is one argument.
So, in *.&{sum (.skip Z-$_)Xmax 0}/600, we take the first argument (the first occurence of *), and use a block on it with a method-like construct .&{}. The block takes one argument (the list), which goes into $_, so .skip is that list without the first element. We subtract the original array, element by element, from that, using Z-. Zipping stops as soon as the shorter list is depleted, which is OK.
We then use the cross product operator X. list X(op) list creates all possible pairs where the first element is from the left list and the second from the right, and uses the operator (op) on them. The result is returned as a Seq (a one-shot list). However, the right list has only one element, 0, so it just does * max 0, element by element. That makes sure that we count only ascending parts of the trek. Then we add it up and divide by 600.
Then we add */5e3, where the * occurs for the second time, and so it's the second argument, and divide it by 5000. The sum is then the time in hours. (This is more efficient than the time in minutes since we'd need to multiply, and the * would need to be separated by a space from the WhateverStar *.)

42 bytes using X

@JoKing, that's a nice use of X, thanks!

Actually, we can avoid the last X/ by just dividing the sum by 10. 39 bytes

37 bytes using WhateverCode and .&{} (returns hours).

oK, 21 bytes
{y+/0|1_-':x}..1.012*

Try it online! Abusing a parsing bug where .1.012 is the same as .1 .012.
              .1.012* /a = [0.1 * input[0], 0.012 * input[1]]
{           }.        /function(x=a[0], y=a[1])
      1_-':x          /  a = subtract pairs of elements from x
    0|                /  a = max(a, 0) w/ implicit map
 y+/                  /  y + sum(a)

-1 thanks to streester.
k, 23 bytes
{.1*(.12*y)++/0|1_-':x}

Try it online!

{y+/0|1_-':x}..1.012* for 21 bytes? start accumulator with y.

Indeed! I'd apply a similar enhancement to the k code, but unfortunately the k interpreter that I have (2016.08.09) doesn't like me starting the accumulator with anything in that fashion. :/

Jelly, 12 bytes
×.12;I}»0÷⁵S

Try it online!
-1 thanks to Mr. Xcoder.

Doesn't ×.12 work?

@Mr.Xcoder It does, I was in a hurry.

Python 2, 59 bytes
lambda a,d:d/5e3+sum(max(0,y-x)/6e2for x,y in zip(a,a[1:]))

Try it online!
returns hours as a decimal.

APL (Dyalog Unicode), 21 20 18 bytes
.1×.12⊥⎕,-+/0⌊2-/⎕

Try it online!
Traditional function taking input (from right to left) as 1st ⎕=Heights/Depths, 2nd ⎕=Distance.
Thanks to @ngn for being a wizard one three bytes.
How it works:
.1×.12⊥⎕,-+/0⌊2-/⎕ ⍝ Function;
                 ⎕ ⍝ Append 0 to the heights vector;
              2-/  ⍝ Pairwise (2) differences (-/);
            0⌊     ⍝ Minimum between 0 and the vector's elements;
          +/       ⍝ Sum (yields the negated total height);
         -         ⍝ Subtract from;
   .12⊥⎕,          ⍝ Distance × 0.12;
.1×                ⍝ And divide by 10;

thanks for "wizard" :) you don't have to copy the expression multiple times in order to test it, put it in a tradfn instead; ,0 is unnecessary, the ⍵ for the problematic test should be ,604, not 604

See, that's why you're a wizard. The copying the expression multiple times part is totally my fault, I just replaced the ⍺ and ⍵ in the old code with ⎕ and was too lazy to put the tradfn header/footer. The ,0 bit though? Gold.

Pyth, 15 bytes
c+*E.12s>#0.+QT

Full program, expects the set of heights as the first argument, distance as the second. Returns the time in minutes.
Try it online here, or verify all test cases at once here.
c+*E.12s>#0.+QT   Implicit: Q=input 1, E=input 2
           .+Q    Take the differences between each height point
        >#0       Filter to remove negative values
       s          Take the sum
  *E.12           Multiply the distance by 0.12
 +                Add the two previous results
c             T   Divide the above by 10, implicit print

Java 8, 89 bytes
a->n->{int s=0,p=0,i=a.length;for(;i-->0;p=a[i])s+=(p=p-a[i])>0?p:0;return s/10+n/500*6;}

Try it online.
Explanation:
a->n->{                   // Method with integer-array and integer parameter and integer return-type
  int s=0,                //  Sum-integers, starting at 0
      p=0,                //  Previous integer, starting at 0
  i=a.length;for(;i-->0;  //  Loop `i` backwards over the array
                 ;        //    After every iteration:
                  p=a[i]) //     Set `p` to the current value for the next iteration
    s+=(p=p-a[i])>0?      //   If the previous minus current item is larger than 0:
         p                //    Add that difference to the sum `s`
        :                 //   Else:
         0;               //    Leave the sum the same
   return s/10            //  Return the sum integer-divided by 10
          +n/500*6;}      //  Plus the second input divided by 500 and then multiplied by 6

Japt, 39 bytes
0oUl)x@W=UgXÄ -UgX)g ¥É?0:W/#ɘ} +V/(#Ǵ0

Try it online!
Likely can be golfed quite a bit more.

Stax, 17 bytes
ü;█y☼òΓ▀ßîP<<╪⌠öß

Run and debug it at staxlang.xyz!
Takes all inputs as floats, though this saves a byte only in the unpacked version. Likely improvable; just now returning to code golf, I'm somewhat rusty.
Unpacked (20 bytes) and explanation:
0!012*s:-{0>f{A/m|++
0!012*                  Float literal and multiplication for distance
      s                 Swap top two stack values (altitudes to the top)
       :-               List of deltas
         {0>f           Filter: keep only positive changes
             {A_m       Map: divide all ascents by 10
                 |++    Add these times to that for horizontal travel
                        Implicit print

0!012*s:-{0>f{A_:m|++ works for integral inputs for 21 bytes unpacked and still 17 packed.


text:
Split the bits!
We define \$V(x)\$ as the list of distinct powers of \$2\$ that sum to \$x\$. For instance, \$V(35)=[32,2,1]\$.
By convention, powers are sorted here from highest to lowest. But it does not affect the logic of the challenge, nor the expected solutions.
Task
Given a semiprime \$N\$, replace each term in \$V(N)\$ with another list of powers of \$2\$ that sum to this term, in such a way that the union of all resulting sub-lists is an exact cover of the matrix \$M\$ defined as:
$$M_{i,j}=V(P)_i \times V(Q)_j$$
where \$P\$ and \$Q\$ are the prime factors of \$N\$.
This is much easier to understand with some examples.
Example #1
For \$N=21\$, we have:

\$V(N)=[16,4,1]\$
\$P=7\$ and \$V(P)=[4,2,1]\$
\$Q=3\$ and \$V(Q)=[2,1]\$
\$M=\pmatrix{8&4&2\\4&2&1}\$

To turn \$V(N)\$ into an exact cover of \$M\$, we may split \$16\$ into \$8+4+4\$ and \$4\$ into \$2+2\$, while \$1\$ is left unchanged. So a possible output is:
$$[ [ 8, 4, 4 ], [ 2, 2 ], [ 1 ] ]$$
Another valid output is:
$$[ [ 8, 4, 2, 2 ], [ 4 ], [ 1 ] ]$$
Example #2
For \$N=851\$, we have:

\$V(N)=[512,256,64,16,2,1]\$
\$P=37\$ and \$V(P)=[32,4,1]\$
\$Q=23\$ and \$V(Q)=[16,4,2,1]\$
\$M=\pmatrix{512&64&16\\128&16&4\\64&8&2\\32&4&1}\$

A possible output is:
$$[ [ 512 ], [ 128, 64, 64 ], [ 32, 16, 16 ], [ 8, 4, 4 ], [ 2 ], [ 1 ] ]$$
Rules

Because factorizing \$N\$ is not the main part of the challenge, you may alternately take \$P\$ and \$Q\$ as input.
When several possible solutions exist, you may either return just one of them or all of them.
You may alternately return the exponents of the powers (e.g. \$[[3,2,2],[1,1],[0]]\$ instead of \$[[8,4,4],[2,2],[1]]\$).
The order of the sub-lists doesn't matter, nor does the order of the terms in each sub-list.
For some semiprimes, you won't have to split any term because \$V(N)\$ already is a perfect cover of \$M\$ (see A235040). But you still have to return a list of (singleton) lists such as \$[[8],[4],[2],[1]]\$ for \$N=15\$.
This is code-golf!

Test cases
 Input | Possible output
-------+-----------------------------------------------------------------------------
 9     | [ [ 4, 2, 2 ], [ 1 ] ]
 15    | [ [ 8 ], [ 4 ], [ 2 ], [ 1 ] ]
 21    | [ [ 8, 4, 4 ], [ 2, 2 ], [ 1 ] ]
 51    | [ [ 32 ], [ 16 ], [ 2 ], [ 1 ] ]
 129   | [ [ 64, 32, 16, 8, 4, 2, 2 ], [ 1 ] ]
 159   | [ [ 64, 32, 32 ], [ 16 ], [ 8 ], [ 4 ], [ 2 ], [ 1 ] ]
 161   | [ [ 64, 32, 16, 16 ], [ 8, 8, 4, 4, 4, 2, 2 ], [ 1 ] ]
 201   | [ [ 128 ], [ 64 ], [ 4, 2, 2 ], [ 1 ] ]
 403   | [ [ 128, 64, 64 ], [ 32, 32, 16, 16, 16, 8, 8 ], [ 8, 4, 4 ], [ 2 ], [ 1 ] ]
 851   | [ [ 512 ], [ 128, 64, 64 ], [ 32, 16, 16 ], [ 8, 4, 4 ], [ 2 ], [ 1 ] ]
 2307  | [ [ 1024, 512, 512 ], [ 256 ], [ 2 ], [ 1 ] ]

can we take P and Q instead of N?

@ngn I'm going to say yes, because factorizing N is not the main part of the challenge.

May we return the output flattened?

@EriktheOutgolfer ... The output flattened is just a partition of the input (1+2+2+4=9, for example). I don't think it should be allowed

@EriktheOutgolfer I don't think it could be unambiguous this way, as the last term of a sub-list may be the same as the first term of the next one.

@Arnauld It will surely not be, I just asked if it's allowed.

@EriktheOutgolfer So, no it's not.

K (ngn/k), 66 63 bytes
{(&1,-1_~^(+\*|a)?+\b)_b:b@>b:,/*/:/2#a:{|*/'(&|2\x)#'2}'x,*/x}

Try it online!
accepts (P;Q) instead of N
algorithm:

compute A as the partial sums of V(P*Q)
multiply each V(P) with each V(Q), sort the products in descending order (let's call that R), and compute their partial sums B
find the positions of those elements in B that also occur in A; cut R right after those positions

Jelly, 24 bytes
BṚT’2*
Ç€×þ/FṢŒṖ§⁼Ç}ɗƇPḢ

A monadic link accepting a list of two integers [P, Q] which yields one possible list of lists as described in the question.
Try it online! (footer prints a string representation to show the list as it really is)
Or see the test-suite (taking a list of N and reordering results to be like those in the question)
How?
We may always slice up the elements of \$M\$ from lowest up, greedily (either there is a \$1\$ in \$M\$ or we had an input of \$4\$, when \$M=[[4]]\$) in order to find a solution.
Note: the code collects all (one!) such solutions in a list and then takes the head (only) result - i.e. the final head is necessary as the partitions are not of all possible orderings.
BṚT’2* - Link 1, powers of 2 that sum to N: integer, N    e.g. 105
B      - binary                                                [1,1,0,1,0,0,1]
 Ṛ     - reverse                                               [1,0,0,1,0,1,1]
  T    - truthy indices                                        [1,4,6,7]
   ’   - decrement                                             [0,3,5,6]
    2  - literal two                                           2
     * - exponentiate                                          [1,8,32,64]

Ç€×þ/FṢŒṖ§⁼Ç}ɗƇPḢ - Main Link: list of two integers, [P,Q]
Ç€                - call last Link (1) as a monad for €ach
    /             - reduce with:
   þ              -   table with:
  ×               -     multiplication
     F            - flatten
      Ṣ           - sort
       ŒṖ         - all partitions
              Ƈ   - filter keep if:
             ɗ    -   last three links as a dyad:
         §        -     sum each
            }     -     use right...
               P  -       ...value: product (i.e. P×Q)
           Ç      -       ...do: call last Link (1) as a monad
          ⁼       -     equal? (non-vectorising so "all equal?")
                Ḣ - head

Python 2, 261 233 232 231 bytes
g=lambda n,r=[],i=1:n and g(n/2,[i]*(n&1)+r,i*2)or r
def f(p,q):
 V=[[v]for v in g(p*q)];i=j=0
 for m in sorted(-a*b for a in g(p)for b in g(q)):
	v=V[i]
	while-m<v[j]:v[j:j+1]=[v[j]/2]*2
	i,j=[i+1,i,0,j+1][j+1<len(v)::2]
 return V

Try it online!
1 byte from Jo King; and another 1 byte due to Kevin Cruijssen.
Takes as input p,q. Pursues the greedy algorithm.

-k-1 can be ~k.

The i,j assignment can be i,j=[i+1,i,0,j+1][j+1<len(v)::2] for -1 byte

@Jo King: Hahaha! That is twisted!

while v[j]>-m can be while-m<v[j]

@Kevin Cruijssen: Yes, indeed. Thx!

Jelly, 41 bytes
Œṗl2ĊƑ$Ƈ
PÇIP$ƇṪÇ€Œpµ³ÇIP$ƇṪƊ€ŒpZPṢ⁼FṢ$µƇ

Try it online!
Should probably be much shorter (some parts feel very repetitive; especially ÇIP$Ƈ, but I don't know how to golf it). Explanation to come after further golfing. Returns all possible solutions in case multiple exist and takes input as \$[P, Q]\$.

Not that it is a problem, but it's not exactly fast, is it? :)

@Arnauld It uses roughly 3 integer partition functions in a single run :) Of course it is not too fast

Now waiting to be outgolfed. I think it's possible in sub-35/30, but I don't think I'll be able to do anything much shorter

Jelly, 34 bytes
BṚT’2*
PÇŒṗæḟ2⁼ƊƇ€ŒpẎṢ⁼Ṣ}ʋƇÇ€×þ/ẎƊ

Try it online!
Input format: [P, Q] (the TIO link above doesn't accept this, but a single number instead, to aid with the test cases).
Output format: List of all solutions (shown as grid representation of 3D list over TIO).
Speed: Turtle.

Pyth, 27 bytes
Inspired by Jonathan Allan's crushing of my Jelly solution. Takes \$N\$ as input.
L^2x1jb2;hfqyQsMT./S*M*FyMP

Try it here!

Haskell, 281 195 bytes
import Data.List
r=reverse.sort
n#0=[]
n#x=[id,(n:)]!!mod x 2$(n*2)#div x 2
m!0=[]
m!x=m!!0:tail m!(x-m!!0)
m%[]=[]
m%n=m!head n:drop(length$m!head n)m%tail n
p&q=r[x*y|x<-1#p,y<-1#q]%r(1#(p*q))

Here are some tips: Defining operators instead of binary functions is cheaper, rearranging guards and pattern-matching can save you (==), use 1>0 instead of True and don't use where. Also n' can be shortened.. With this you can save 72 bytes: Try it online!

Btw. you should check out the Haskell tips section if you havent.

I had a look at the guard situation again, another 13 bytes off: Try it online!

@OMᗺ, thank you. I'm new to haskell, so this looks for me as magic tricks

No  worries :) In case you have questions, feel free to ask in Of Monads and Men.

authors: Евгений Новиков


text:
Golf a Solubility Chart
Given the name of a cation and anion, output "S" (soluble) or "I" (insoluble). The table we will be using is from wikipedia: https://en.wikipedia.org/wiki/Solubility_chart. It is copied at the end of the question for future reference.
Input: The cation, followed by the anion, separated by a space. The cation will be one of the following:
Lithium Sodium Potassium Ammonium Beryllium Magnesium Calcium
Strontium Barium Zinc Iron(II) Copper(II) Aluminium Iron(III) Lead(II) Silver

and the anion will be one of the following:
Fluoride Chloride Bromide Iodide Carbonate Chlorate Hydroxide Cyanide Cyanate
Thiocyanate Nitrate Oxide Phosphate Sulfate Dichromate

Each will have its first letter capitalized.
Example Input: Sodium Chloride
Output: A truthy value, or S, if it is soluble, falsey or I otherwise. If the wikipedia page lists anything else (e.g. slightly soluble, or reacts with water) or if the input is not in the form "cation anion," your program may do anything (undefined behavior), so it may output 'S', 'I', or anything else.
Table:
?,S,S,S,?,S,S,S,?,S,S,?,I,S,S
S,S,S,S,S,S,S,S,S,S,S,?,S,S,S
S,S,S,S,S,S,S,S,S,S,S,?,S,S,S
S,S,S,S,S,S,S,S,?,S,S,?,S,S,S
S,S,S,?,?,?,?,?,?,?,S,?,?,S,?
?,S,S,S,I,S,I,?,?,?,S,I,I,S,I
I,S,S,S,I,S,?,S,?,?,S,?,I,?,I
?,S,S,S,I,S,S,?,?,?,S,?,?,I,?
?,S,S,S,I,S,S,S,?,?,S,?,?,I,?
?,S,S,S,I,S,I,I,?,?,S,I,I,S,I
S,S,S,S,I,S,I,?,?,?,S,I,I,S,I
?,S,S,?,I,S,I,?,?,I,S,I,I,S,I
S,S,S,?,?,S,I,?,?,?,S,I,I,S,I
?,S,S,?,?,S,I,?,?,?,S,I,I,?,I
?,?,?,I,I,S,I,?,?,?,S,I,I,I,?
S,I,I,I,I,S,?,I,I,?,S,?,I,?,I

The rows are cations in the order listed above and the columns are anions. For example, since Magnesium Iodide is soluble, and Magnesium was the 6th cation and Iodide was the 4th anion, the 6th row and 4th column has the character 'S'. The ? indicates undefined behavior.

I like this because the undefined behaviour of ?s gives a lot of freedom in what algorithms one can use.

@FryAmTheEggman Despite the kolmogorov-complexity tag, the challenge does not ask to output the table, but the correct value for a given (cation, anion) pair.

I removed the kolmogorov-complexity tag and added the decision-problem tag, since this isn't about creating a fixed (or partially fixed) output, but determining whether a certain input meets a some criteria.

Would you consider allowing to output any 2 distinct consistent values rather than just truthy/'S' or falsy/'I'?

I'd suggest dropping the "separated by a space" specification and instead saying something along the lines of "in addition to the site defaults, the two inputs may be accepted as a single input separated by a consistent unused character (e.g. a space)". Two inputs may allow more golfing creativity here (e.g. curried functions).

JavaScript (Node.js), 143 bytes
Returns 1 for soluble, 0 for insoluble.
s=>Buffer(`## 5)6.'04+ n:# (F* E"/$;&-"/"7&#.%`).map(c=>S+='1'.repeat(c-32)+0,S='')|S[parseInt(s.split` `[1].slice(1,7)+s[0]+s[1],35)%1325%508]

Try it online!
How?
Conversion of the input string to a lookup index
We first build a key by extracting the 2nd to 7th characters of the anion and adding the two first characters of the cation:
key = s.split` `[1].slice(1, 7) + s[0] + s[1]

Examples:
'Lithium Fluoride'  --> 'luoridLi'
'Sodium Fluoride'   --> 'luoridSo'
'Sodium Dichromate' --> 'ichromSo'
'Calcium Oxide'     --> 'xideCa'

We turn this into a lookup index by parsing it in base-35 and applying a modulo 1325 followed by a modulo 508 (brute-forced values):
parseInt(key, 35) % 1325 % 508

Compression of the lookup table
Because there are significantly more soluble pairs than insoluble ones, we  fill all unused entries in the lookup with soluble.
By encoding soluble with 1 and insoluble with 0, our lookup table essentially consists of long strings of 1's followed by a 0:
11101110011111111111111111111101111111110111111111111111111111101111111111111101111111011111
11111111111011111111111111111111011111111111001111111111111111111111111111111111111111111111
11111111111111111111111111111111011111111111111111111111111011100111111110111111111111111111
11111111111111111111011111111110011111111111111111111111111111111111110110111111111111111011
11011111111111111111111111111101111110111111111111101101111111111111110110111111111111111111
11111011111101110111111111111110111110

We compress it by storing the lengths of the strings of 1's as ASCII characters in the range [32-126].

Ruby -n, 96 92 75 70 69 65 bytes
p /ra|[SPm]o|^[^C]*F|h.*D/?1:/Le|[MAIZ].*y|[OPDFbv]|[tr]i.*S/?0:1

Try it online!
I'm not very good at generating hashes and lookup tables, so instead I opted to take advantage of all those question-mark wildcards to simplify the logical structure of the table, and then apply some pure Regex magic.
Update: Altered assignment of some question marks and further simplified the logic of matching.
Update 2: Just 2 months later, I've come up with another revamp of the table to save a few more bytes.
The table that we are going to produce looks like this:
Lithium    111101111110011
Sodium     111111111111111
Potassium  111111111111111
Ammonium   111111111111111
Beryllium  111101111110010
Magnesium  111101000010010
Calcium    011101111110010
Strontium  111101111110000
Barium     111101111110000
Zinc       111101000010010
Iron(II)   111101000010010
Copper(II) 011101000010010
Aluminium  111101000010010
Iron(III)  111101000010010
Lead(II)   100001000010000
Silver     100001000010000

Now, the following compounds can be considered soluble:

ra Nitrate, Chlorate
[SPm]o Sodium, Potassium, Ammonium
^[^C]*F Fluoride, but not Calcium or Copper
h.*D Lithium Dichromate

Of the remaining compounds, the following are insoluble:

Le Lead
[MAIZ]i.*y Magnesium, Aluminium, Iron (and other cations with indicated charge), Zinc compounds with block of anions containing y (Hydroxide-Thiocyanate)
[OPDFbv] Oxide, Phosphate, Dichromate, Fluoride, Carbonate, Silver
[tr]i.*S Strontium and Barium Sulfates

Everything else is soluble.

Python 2, 166 161 131 bytes
lambda n:chr(hash(n)%1482%737%388%310%295%262%254)not in'gwQFCAkOExUWHJ0gJyicLLKviDK3PEDDxslKztFUV1ja4ukdbe7x9Xd5'.decode('base64')

Try it online!

How did you find so many mod numbers?

@AlexRacer I've written a Python script that tries out integers up to a certain limit, in such a way that calculating the modulo doesn't yield the same results for a soluble and an insoluble input. By repeatedly running this script. I got all these numbers.

@AlexRacer I've used that script lots of times before this challenge, ex: https://codegolf.stackexchange.com/a/115706/64121. Normally these modulo chains are a little shorter.

Python 2, 180 177 151 149 147 bytes
def f(s):a,b=s.split();return bin(int('7YNQYE3M7HE5OU3HHE71UMXBVRATPSZTSCV0O4WI84X5KTNE92TMLA',36))[(int(a[1:4],35)|int(b[2:6],35))%3419%529%277-6]

Try it online!

Can 17*(b%91%61%17)%272 not be b%91%61%17*17%272?

Pascal (FPC), 387 358 353 348 341 319 297 bytes
var s,t:string;j:word;c:array[0..14]of word=(5055,8191,8191,8191,93,63,4143,175,4271,63,127,31,95,3,67);begin read(s);t:=copy(s,pos(' ',s)+1,6);j:=pos(t[1..2],'OxCyCaPhThDiHyFlIoSuBrChChNi')div 2;if'a'=t[6]then j:=12;write(c[pos(s[1..2],'LiSoPoAmBeMaCaStBaZiIrCoAlLeSi')div 2]shr(13-j)mod 2>0)end.

Try it online!
Explanation:
var a:string='LiSoPoAmBeMaCaStBaZiIrCoAlLeSi'; //string containing first 2 letters of cations (can also be const)
                                               //luckily, Iron(II) and Iron(III) are compatible, they can have the same outputs
    b:string='OxCyCaPhThDiHyFlIoSuBrChChNi'; //string containing first 2 letters of anions (can also be const)
                                             //the order is different from the Wikipedia chart;
                                             //Chloride and Chlorate are next to each other to find the right index easier
                                             //Cyanide and Cyanate are compatible - 1 column less
                                             //overall, they are ordered to minimize the numbers in c
    s,t:string;
    i,j:word;
    c:array[0..14]of word=(5055,8191,8191,8191,93,63,4143,175,4271,63,127,31,95,3,67);
      //One number for each cation; one bit for solubility of particular combination; the bit for input combination will be found using i and j
begin
  read(s); //put input into s
  t:=copy(s,pos(' ',s)+1,6); //find the 2nd word in s (characters after space), take first 6 letters and copy them into t (6th letter is needed later)
  i:=pos(s[1..2],a)div 2; //position of first 2 letters of cation in a
                          //divided by 2 to get index for c
                          //*in golfed code, expression for i is inserted directly into write function
  j:=pos(t[1..2],b)div 2; //position of first 2 letters of anion in b
                          //divided by 2 to get the particular bit of c[i]
  if(j=11)and(t[6]='a')then j:=j+1; //if the anion is Chlorate, j is wrong and needs to be increased (specifically to 12);
                                    //only Chlorate has 'a' as 6th character, j doesn't need to be checked, but it's here for easier understanding
  writeln((c[i]shr(13-j))mod 2>0); //take i-th element of c, shift it right to put the correct bit at last position,
                                   //extract that bit, check if greater than 0
end.

Jelly,  67 61 60 50 47  44 bytes
OḌ%⁽Æ¬%⁽£ṇ%⁽¡ẹ%249ḟ“ıA¬ɲḃẏCċtȯƁƤçȤċŒḲOƲ’D‘Ä¤

A monadic link returning a list which is empty for I and non-empty for S (in Jelly empty lists are falsey while non-empty ones are truthy).
Try it online! (footer ”S”IÇ? is if LastLink(x) is Truthy then "S" else "I")
Or see all cases formatted as a grid matching the order of the grid in the OP.
How?
After creating sets of inputs that must be S and I and evaluating these inputs as base ten (Python: dec=lambda s:sum(10**i*ord(c) for i, c in enumerate(s[::d]))) and using a few loops of modulo-ing values and set checking the hash used here was found.
The insoluble key integers are created in the code by evaluating a base 250 encoded integer, converting it to base  25 ...16 * ...10 and cumulatively summing the result...
* the base reductions were achieved by adding some redundant keys
OḌ%⁽Æ¬%⁽£ṇ%⁽¡ẹ%249ḟ“...’D‘Ä¤ - Main Link: list of characters   e.g. "Calcium Carbonate"
O                            - cast to a list of ordinals      [67,97,108,99,105,117,109,32,67,97,114,98,111,110,97,116,101]
 Ḍ                           - convert from base ten           778907829795030961
   ⁽Æ¬                       - base 250 literal = 4258
  %                          - modulo                          625
       ⁽£ṇ                   - base 250 literal = 1721
      %                      - modulo                          625
           ⁽¡ẹ               - base 250 literal = 1215
          %                  - modulo                          625
               249           - literal 249
              %              - modulo                          127
                           ¤ - nilad followed by link(s) as a nilad:
                   “...’     -   literal in base 250    = 382193517807860310905428231939605402667395154
                        D    -   convert to decimal     = [3,8,2,1,9,3,5,1,7,8,0,7,8,6,0,3,1,0,9,0,5,4,2,8,2,3,1,9,3,9,6,0,5,4,0,2,6,6,7,3,9,5,1,5,4]
                         ‘   -   increment (vectorises) = [4,9,3,2,10,4,6,2,8,9,1,8,9,7,1,4,2,1,10,1,6,5,3,9,3,4,2,10,4,10,7,1,6,5,1,3,7,7,8,4,10,6,2,6,5]
                          Ä  -   cumulative sum         = [4,13,16,18,28,32,38,40,48,57,58,66,75,82,83,87,89,90,100,101,107,112,115,124,127,131,133,143,147,157,164,165,171,176,177,180,187,194,202,206,216,222,224,230,235]
                             -     ...note the redundant keys are --->            48       66 75                                115                                                     187             216
                  ḟ          - filter discard (implicit wrap)  [] (if 127 was not in the list above this would've been [127])


text:
Calculate the sum of the first n prime numbers
I'm surprised that this challenge isn't already here, as it's so obvious.  (Or I'm surprised I couldn't find it and anybody will mark it as a duplicate.)
Task
Given a non-negative integer \$n\$, calculate the sum of the first \$n\$ primes and output it.
Example #1
For \$n = 5\$, the first five primes are:

2
3
5
7
11

The sum of these numbers is \$2 + 3 + 5 + 7 + 11 = 28\$, so the program has to output \$28\$.
Example #2
For \$n = 0\$, the "first zero" primes are none.  And the sum of no numbers is - of course - \$0\$.
Rules

You may use built-ins, e.g., to check if a number is prime.
This is code-golf, so the lowest number of bytes in each language wins!

Related old challenge: First N primes in O(x^2) or less complexity.

Very closely related - Sum of primes between given range

OEIS - A7504  (aside: LOL at this in the formulas section, "a(n) = A033286(n) - A152535(n).")

@JonathanAllan: Related, but not equivalent. I think it's an important difference if you check primes in range or a number of primes. What both tasks have in common is a) check if a number is prime and b) sum up numbers - which is common to many code-golf tasks here.

Yep, that is what "related" means otherwise I would've said "possible duplicate" or, if I felt strongly enough I could have just closed as a duplicate myself. Do note, however, that some may actually consider it a duplicate (since the definition of a "duplicate" is not "this is exactly that" but rather "submissions to this could be trivially ported to that" - so this would come down to one's interpretation of "trivially").

After a quick check of some of the answers of the challenge linked by Jonathan Allan I do think it is a dupe, as removing the first argument and hard coding it as 1 seems to lead to competitive solutions.

Also relevant: Things to avoid when writing challenges: The prime numbers.

@Laikoni: Yes, you're right. My next challenge won't be about primes :-)

@xanoetux I'm fine with it, finally convinced me to compute prime numbers on the 6502 just for fun ;)

@Laikoni: This would be invalid, since primes in [1,3] = {2,3} and the first 3 primes are {2,3,5}, so for some languages it might be "quite" different.

6502 machine code routine, 75 bytes
A0 01 84 FD 88 84 FE C4 02 F0 32 E6 FD A0 00 A5 FD C9 04 90 1F 85 64 B1 FB 85
65 A9 00 A2 08 06 64 2A C5 65 90 02 E5 65 CA D0 F4 C9 00 F0 DC C8 C4 FE D0 DB
A5 FD A4 FE 91 FB C8 D0 C8 A9 00 18 A8 C4 FE F0 05 71 FB C8 D0 F7 60

Expects a pointer to some temporary storage in $fb/$fc and the number of primes to sum up in $2. Returns the sum in A (the accu register).
Never did some prime checks in 6502 machine code, so here it finally comes ;)
Note this starts giving wrong results for inputs >= 14. This is because of overflow, the code works with the "natural" number range of the 8bit platform which is 0 - 255 for unsigned.
Commented disassembly
; function to sum the first n primes
;
; input:
;   $fb/$fc: pointer to a buffer for temporary storage of primes
;   $2:      number of primes to sum (n)
; output:
;   A:       sum of the first n primes
; clobbers:
;   $fd:     current number under primality test
;   $fe:     number of primes currently found
;   $64:     temporary numerator for modulo check
;   $65:     temporary divisor for modulo check
;   X, Y
 .primesum:
A0 01       LDY #$01            ; init variable for ...
84 FD       STY $FD             ; next prime number to test
88          DEY                 ; init number of found primes
 .mainloop:
84 FE       STY $FE             ; store current number of found primes
C4 02       CPY $02             ; compare with requested number
F0 32       BEQ .sum            ; enough primes -> calculate their sum
 .mainnext:
E6 FD       INC $FD             ; check next prime number
A0 00       LDY #$00            ; start check against first prime number
 .primecheckloop:
A5 FD       LDA $FD             ; load current number to check
C9 04       CMP #$04            ; smaller than 4?
90 1F       BCC .isprime        ; is a prime (shortcut to get list started)
85 64       STA $64             ; store to temp as numerator
B1 FB       LDA ($FB),Y         ; load from prime number table
85 65       STA $65             ; store to temp as divisor
A9 00       LDA #$00            ; init modulo to 0
A2 08       LDX #$08            ; iterate over 8 bits
 .bitloop:
06 64       ASL $64             ; shift left numerator
2A          ROL A               ; shift carry into modulo
C5 65       CMP $65             ; compare with divisor
90 02       BCC .bitnext        ; smaller -> to next bit
E5 65       SBC $65             ; otherwise subtract divisor
 .bitnext:
CA          DEX                 ; next bit
D0 F4       BNE .bitloop
C9 00       CMP #$00            ; compare modulo with 0
F0 DC       BEQ .mainnext       ; equal? -> no prime number
C8          INY                 ; next index in prime number table
C4 FE       CPY $FE             ; checked against all prime numbers?
D0 DB       BNE .primecheckloop ; no -> check next
 .isprime:
A5 FD       LDA $FD             ; prime found
A4 FE       LDY $FE             ; then store in table
91 FB       STA ($FB),Y
C8          INY                 ; increment number of primes found
D0 C8       BNE .mainloop       ; and repeat whole process
 .sum:
A9 00       LDA #$00            ; initialize sum to 0
18          CLC
A8          TAY                 ; start adding table from position 0
 .sumloop:
C4 FE       CPY $FE             ; whole table added?
F0 05       BEQ .done           ; yes -> we're done
71 FB       ADC ($FB),Y         ; add current entry
C8          INY                 ; increment index
D0 F7       BNE .sumloop        ; and repeat
 .done:
60          RTS

Example C64 assembler program using the routine:
Online demo
Code in ca65 syntax:
.import primesum   ; link with routine above

.segment "BHDR" ; BASIC header
                .word   $0801           ; load address
                .word   $080b           ; pointer next BASIC line
                .word   2018            ; line number
                .byte   $9e             ; BASIC token "SYS"
                .byte   "2061",$0,$0,$0 ; 2061 ($080d) and terminating 0 bytes

.bss
linebuf:        .res    4               ; maximum length of a valid unsigned
                                        ; 8-bit number input
convbuf:        .res    3               ; 3 BCD digits for unsigned 8-bit
                                        ; number conversion
primebuf:       .res    $100            ; buffer for primesum function

.data
prompt:         .byte   "> ", $0
errmsg:         .byte   "Error parsing number, try again.", $d, $0

.code
                lda     #$17            ; set upper/lower mode
                sta     $d018

input:
                lda     #<prompt        ; display prompt
                ldy     #>prompt
                jsr     $ab1e

                lda     #<linebuf       ; read string into buffer
                ldy     #>linebuf
                ldx     #4
                jsr     readline

                lda     linebuf         ; empty line?
                beq     input           ; try again

                lda     #<linebuf       ; convert input to int8
                ldy     #>linebuf
                jsr     touint8
                bcc     numok           ; successful -> start processing
                lda     #<errmsg        ; else show error message and repeat
                ldy     #>errmsg
                jsr     $ab1e
                bcs     input

numok:
                sta     $2
                lda     #<primebuf
                sta     $fb
                lda     #>primebuf
                sta     $fc
                jsr     primesum        ; call function to sum primes
                tax                     ; and ...
                lda     #$0             ;
                jmp     $bdcd           ; .. print result

; read a line of input from keyboard, terminate it with 0
; expects pointer to input buffer in A/Y, buffer length in X
.proc readline
                dex
                stx     $fb
                sta     $fc
                sty     $fd
                ldy     #$0
                sty     $cc             ; enable cursor blinking
                sty     $fe             ; temporary for loop variable
getkey:         jsr     $f142           ; get character from keyboard
                beq     getkey
                sta     $2              ; save to temporary
                and     #$7f
                cmp     #$20            ; check for control character
                bcs     checkout        ; no -> check buffer size
                cmp     #$d             ; was it enter/return?
                beq     prepout         ; -> normal flow
                cmp     #$14            ; was it backspace/delete?
                bne     getkey          ; if not, get next char
                lda     $fe             ; check current index
                beq     getkey          ; zero -> backspace not possible
                bne     prepout         ; skip checking buffer size for bs
checkout:       lda     $fe             ; buffer index
                cmp     $fb             ; check against buffer size
                beq     getkey          ; if it would overflow, loop again
prepout:        sei                     ; no interrupts
                ldy     $d3             ; get current screen column
                lda     ($d1),y         ; and clear
                and     #$7f            ;   cursor in
                sta     ($d1),y         ;   current row
output:         lda     $2              ; load character
                jsr     $e716           ;   and output
                ldx     $cf             ; check cursor phase
                beq     store           ; invisible -> to store
                ldy     $d3             ; get current screen column
                lda     ($d1),y         ; and show
                ora     #$80            ;   cursor in
                sta     ($d1),y         ;   current row
                lda     $2              ; load character
store:          cli                     ; enable interrupts
                cmp     #$14            ; was it backspace/delete?
                beq     backspace       ; to backspace handling code
                cmp     #$d             ; was it enter/return?
                beq     done            ; then we're done.
                ldy     $fe             ; load buffer index
                sta     ($fc),y         ; store character in buffer
                iny                     ; advance buffer index
                sty     $fe
                bne     getkey          ; not zero -> ok
done:           lda     #$0             ; terminate string in buffer with zero
                ldy     $fe             ; get buffer index
                sta     ($fc),y         ; store terminator in buffer
                sei                     ; no interrupts
                ldy     $d3             ; get current screen column
                lda     ($d1),y         ; and clear
                and     #$7f            ;   cursor in
                sta     ($d1),y         ;   current row
                inc     $cc             ; disable cursor blinking
                cli                     ; enable interrupts
                rts                     ; return
backspace:      dec     $fe             ; decrement buffer index
                bcs     getkey          ; and get next key
.endproc

; parse / convert uint8 number using a BCD representation and double-dabble
.proc touint8
                sta     $fb
                sty     $fc
                ldy     #$0
                sty     convbuf
                sty     convbuf+1
                sty     convbuf+2
scanloop:       lda     ($fb),y
                beq     copy
                iny
                cmp     #$20
                beq     scanloop
                cmp     #$30
                bcc     error
                cmp     #$3a
                bcs     error
                bcc     scanloop
error:          sec
                rts
copy:           dey
                bmi     error
                ldx     #$2
copyloop:       lda     ($fb),y
                cmp     #$30
                bcc     copynext
                cmp     #$3a
                bcs     copynext
                sec
                sbc     #$30
                sta     convbuf,x
                dex
copynext:       dey
                bpl     copyloop
                lda     #$0
                sta     $fb
                ldx     #$8
loop:           lsr     convbuf
                lda     convbuf+1
                bcc     skipbit1
                ora     #$10
skipbit1:       lsr     a
                sta     convbuf+1
                lda     convbuf+2
                bcc     skipbit2
                ora     #$10
skipbit2:       lsr     a
                sta     convbuf+2
                ror     $fb
                dex
                beq     done
                lda     convbuf
                cmp     #$8
                bmi     nosub1
                sbc     #$3
                sta     convbuf
nosub1:         lda     convbuf+1
                cmp     #$8
                bmi     nosub2
                sbc     #$3
                sta     convbuf+1
nosub2:         lda     convbuf+2
                cmp     #$8
                bmi     loop
                sbc     #$3
                sta     convbuf+2
                bcs     loop
done:           lda     $fb
                clc
                rts
.endproc

I enjoy this so much more than the constant stream of golfing languages (I may or may not be wearing a MOS 6502 t-shirt today).

@MattLacey thanks :) I'm just too lazy to learn all these languages ... and doing some puzzles in 6502 code feels kind of "natural" because saving space is actually a standard programming practice on that chip :)

I need to buy a MOS 6502 T-Shirt.

Python 2, 49 bytes
f=lambda n,t=1,p=1:n and p%t*t+f(n-p%t,t+1,p*t*t)

Uses Wilson's theorem, (as introduced to the site by xnor, I believe here)
Try it online!
The function f is recursive, with an initial input of n and a tail when n reaches zero, yielding that zero (due to the logical and); n is decremented whenever t, a test number which increments with every call to f, is prime. The prime test is then whether \$(n-1)!\ \equiv\ -1 \pmod n\$ for which we keep a track of a square of the factorial in p.

I was adapting one of Lynn's common helper functions and achieved the exact same thing.

...ah so the theorem was introduced to the site by xnor. Good reference post, thanks!

Jelly, 4 bytes
My first Jelly program
RÆNS

Try it online!

Nice, note that ÆN€S would also do it.

Java 8, 89 78 bytes
n->{int r=0,i=2,t,p;for(;n>0;r+=t<2?p+0*n--:0)for(p=t=i++;p%--t>0;);return r;}

Try it online.
Explanation:
n->{               // Method with integer as both parameter and return-type
  int r=0,         //  Result-sum, starting at 0
      i=2,         //  Iteration-integer, starting at 2
      t,p;         //  Temp integers
  for(;n>0         //  Loop as long as `n` is still larger than 0:
      ;            //    After every iteration:
       r+=t<2?     //     If `t` is 1 (which means `p` is a prime):
           p       //      Increase `r` by `p`
           +0*n--  //      And decrease `n` by 1
          :        //     Else:
           0)      //      Both `r` and `n` remain the same
    for(p=t=i++;   //   Set both `p` and `t` to the current `i`,
                   //   and increase `i` by 1 afterwards with `i++`
        p%--t>0;); //   Decrease `t` by 1 before every iteration with `--t`,
                   //   and continue looping as long as `p` is NOT divisible by `t`
  return r;}       //  Return the result-sum

05AB1E, 3 bytes
ÅpO

Try it online.
Explanation:
Åp     # List of the first N primes (N being the implicit input)
       #  i.e. 5 → [2,3,5,7,11]
  O    # Sum of that list
       #  i.e. [2,3,5,7,11] → 28

Brachylog, 8 7 bytes
~lṗᵐ≠≜+

Try it online!
Saved 1 byte thanks to @sundar.
Explanation
~l        Create a list of length input
  ṗᵐ      Each element of the list must be prime
    ≠     All elements must be distinct
     ≜    Find values that match those constraints
      +   Sum

~lṗᵐ≠≜+ seems to work, for 7 bytes (Also, I'm curious why it gives output 2*input+1 if run without the labeling.)

@sundar I checked using the debugger and found why: it doesn't choose values for the primes, but it still knows that every single one must be in [2,+inf) obviously. Therefore, it knows that the sum of 5 primes (if the input is 5) must be at least 10, and it partially knows that because the elements must be different, they can't all be 2 so it's at least 11. TL;DR implementation of implicit labellization isn't strong enough.

That's very interesting. I like how the reason is not some quirk of syntax or random accident of implementation, but something that makes sense based on the constraints. Thanks for checking it out!

Perl 6, 31 bytes
{sum grep(&is-prime,2..*)[^$_]}

Try it online!
The is-prime built-in is unfortunately long.

J, 8 bytes
1#.p:@i.

Try it online!

Husk, 4 bytes
Σ↑İp

Try it online!
Generates the İnfinite list of prime numbers, and computes the sum of the first \$N\$ (Σ↑)

I believe it's İnteger sequence, İ€ is finite.

Attache, 10 bytes
Sum@Primes

Try it online!
ho hum

Retina, 41 bytes
K`_
"$+"{`$
$%"_
)/¶(__+)\1+$/+`$
_
^_

_

Try it online! I wanted to keep adding 1 until I had found n primes but I couldn't work out how to do that in Retina so I resorted to a nested loop. Explanation:
K`_

Start with 1.
"$+"{`

Loop n times.
$
$%"_

Make a copy of the previous value, and increment it.
)/¶(__+)\1+$/+`$
_

Keep incrementing it while it's composite. (The ) closes the outer loop.)
^_

Delete the original 1.
_

Sum and convert to decimal.

MATL, 4 bytes
:Yqs

Try it online!
Explanation:
       % Implicit input: 5
:      % Range: [1, 2, 3, 4, 5]
 Yq    % The n'th primes: [2, 3, 5, 7, 11]
   s   % Sum: 28

Haskell, 48 bytes
sum.(`take`[p|p<-[2..],all((>0).mod p)[2..p-1]])

Try it online!
Note: \p-> all((>0).mod p)[2..p-1] is not a valid prime check, since it is True for \$0,1\$ as well. But we can work around that by beginning with \$2\$, so in this case it suffices.

Pari/GP, 20 bytes
n->vecsum(primes(n))

Try it online!

Ruby, 22 + 7 = 29 bytes
Run with ruby -rprime (+7)
->n{Prime.take(n).sum}

PHP, 66 bytes
using my own prime function again ...
for(;$k<$argn;$i-1||$s+=$n+!++$k)for($i=++$n;--$i&&$n%$i;);echo$s;

Run as pipe with -nr or try it online.
breakdown
for(;$k<$argn;      # while counter < argument
    $i-1||              # 3. if divisor is 1 (e.g. $n is prime)
        $s+=$n              # add $n to sum
        +!++$k              # and increment counter
    )
    for($i=++$n;        # 1. increment $n
        --$i&&$n%$i;);  # 2. find largest divisor of $n smaller than $n:
echo$s;             # print sum

same length, one variable less: for(;$argn;$i-1||$s+=$n+!$argn--)for($i=++$n;--$i&&$n%$i;);echo$s;

C (gcc), 70 bytes
f(n,i,j,s){s=0;for(i=2;n;i++)for(j=2;j/i?s+=i,n--,0:i%j++;);return s;}

Try it online!

Suggest n=s instead of return s

C, C++, D : 147 142 bytes
int p(int a){if(a<4)return 1;for(int i=2;i<a;++i)if(!(a%i))return 0;return 1;}int f(int n){int c=0,v=1;while(n)if(p(++v)){c+=v;--n;}return c;}

5 bytes optimization for C and C++ :
-2 bytes thanks to Zacharý
#define R return
int p(int a){if(a<4)R 1;for(int i=2;i<a;++i)if(!(a%i))R 0;R 1;}int f(int n){int c=0,v=1;while(n)if(p(++v))c+=v,--n;R c;}

p tests if a number is a prime, f sums the n first numbers
Code used to test :
C/C++ :
for (int i = 0; i < 10; ++i)
    printf("%d => %d\n", i, f(i));

D Optimized answer by Zacharý, 133 131 bytes
D has a golfy template system
T p(T)(T a){if(a<4)return 1;for(T i=2;i<a;)if(!(a%i++))return 0;return 1;}T f(T)(T n){T c,v=1;while(n)if(p(++v))c+=v,--n;return c;}

T p(T)(T a){if(a<4)return 1;for(T i=2;i<a;)if(!(a%i++))return 0;return 1;}T f(T)(T n){T c,v=1;while(n)if(p(++v)){c+=v;--n;}return c;}. Also, the C/C++/D can be int p(int a){if(a<4)return 1;for(int i=2;i<a;++i)if(!(a%i))return 0;return 1;}int f(int n){int c=0,v=1;while(n)if(p(++v)){c+=v;--n;}return c;} (same with the C/C++ optimization, just adjusting the algorithm abit)

Maybe for all the answers, you could use comma to make {c+=v;--n;} be c+=v,--n;?

Here's another one for D (and possibly for C/C++ as well, if reverted back to ints): T p(T)(T a){T r=1,i=2;for(;i<a;)r=a%i++?r:0;return r;}T f(T)(T n){T c,v=1;while(n)if(p(++v))c+=v,--n;return c;}

Suggest a>3&i<a instead of i<a and remove if(a<4)...

Japt -x, 11 bytes
;@_j}a°X}hA

Try it online!
Saved several bytes thanks to a new language feature.
Explanation:
;@      }hA    :Get the first n numbers in the sequence:
     a         : Get the smallest number
      °X       : Which is greater than the previous result
  _j}          : And is prime
               :Implicitly output the sum

Factor + math.primes math.unicode, 14 bytes
[ nprimes Σ ]

Try it online!
Explanation:
It's a quotation (anonymous function) that takes an integer as input and leaves an integer as output.

nprimes Obtain a list of the first n primes.
Σ Sum the list.

D, 106 bytes
T f(T)(T n){T p(T a){T b=1;for(T i=2;i<a;)b*=a%i++;return b;}T c,v=1;while(n)if(p(++v))c+=v,--n;return c;}

Try it online!
Based on my previous revisions to HatsuPointerKun's C++ answer.

JavaScript (ES6), 55 bytes
f=(k,n=2)=>k&&(g=d=>n%--d?g(d):d<2&&k--&&n)(n)+f(k,n+1)

Try it online!

Stax, 6 bytes
ê☺Γ☼èY

Run and debug it
Explanation:
r{|6m|+ Unpacked program, implicit input
r       0-based range
 {  m   Map:
  |6      n-th prime (0-based)
     |+ Sum
        Implicit output

APL (Dyalog Unicode), 7 + 9 = 16 bytes
+/pco∘⍳

Try it online!
9 additional bytes to import the pco (and every other) Dfn: ⎕CY'dfns'
How:
+/pco∘⍳
      ⍳ ⍝ Generate the range from 1 to the argument
     ∘  ⍝ Compose
  pco   ⍝ P-colon (p:); without a left argument, it generates the first <right_arg> primes.
+/      ⍝ Sum

Don't you have to add yet another byte? import X (newline) X.something() in python is counted with the newline.

JAEL, 5 bytes
#&kȦ

Explanation (generated automatically):
./jael --explain '#&kȦ'
ORIGINAL CODE:  #&kȦ

EXPANDING EXPLANATION:
Ȧ => .a!

EXPANDED CODE:  #&k.a!,

#     ,                 repeat (p1) times:
 &                              push number of iterations of this loop
  k                             push nth prime
   .                            push the value under the tape head
    a                           push p1 + p2
     !                          write p1 to the tape head
       ␄                print machine state

Japt -x, 8 5 bytes
Èj}jU

Try it
Èj}jU     :Implicit input of integer U
È         :Function taking an integer as argument
 j        :  Is prime?
  }       :End function
   jU     :First U integers >=0 that return true
          :Implicit output of sum of resulting array

Reticular, 52 40 bytes
indQ2j;o_1-2~d:^=[d@P~1-]:^`*[+]:^`1+*o;

Try it online!
Explanation
Fun fact: Reticular does not count 2 as a prime number, so the instruction @P which gives the \$n\$-th prime in reality gives the \$(n+1)\$-th prime and due to this we have to add the first prime 2 manually.
in           # Read input and convert to int
dQ2j;o_      # Check if input is 0. If so, output and exit
1-2~d:^=     # Subtract 1 from input and save it as  `^`
[d@P~1-]     # Duplicate the top of the stack (call it k)
               and push the k-th prime. Finally swap the two top items
               in the stack and subtract 1.
               Stack before: [k]
               Stack after: [k-1, k-th prime]
:^`*         # Repeat the above a `^` number of times.
               Stack before: [n]
               Stack after: [0, 3, 5, ...,  n-th prime, 2]
[+]:^`1+*    # Add the two top items in the stack a
               total of (`^`+1) number of times
o;           # Output the sum and exit.

Vyxal, 2 bytes, s
ʁǎ

Try it!
Explanation
ʁ  # Range from 0 to input
ǎ  # Map to a_th prime

At last, sum with s flag
Disclaimer: my first Vyxal answer

There's a bounty coming your way in around 48 hours!

@user many thanks for the bounty!!!!

s flag is cheaty :(

Pyt, 3 bytes
řᵽƩ

Try it online!
ř       implicit input (n); creates array of [1,2,...,n]
 ᵽ      gets the kth prime for each item k in the array
  Ʃ     sums the array; implicit print

Arturo, 38 bytes
$[n][sum take select 2..n*n=>prime? n]

Try it

Python 2, 63 59 56 51 bytes
f=lambda n:n and prime(n)+f(n-1)
from sympy import*

Try it online!

Saved:

-5 bytes, thanks to Jonathan Allan

Without libs:
Python 2, 83 bytes
n,s=input(),0
x=2
while n:
 if all(x%i for i in range(2,x)):n-=1;s+=x
 x+=1
print s

Try it online!

f=lambda n:n and prime(n)+f(n-1) saves five (it might be golfable further too)

Pyke, 4 bytes
~p>s

Try it here!
~p   -   prime_numbers
  >  -  first_n(^, input)
   s - sum(^)

CJam, 21 bytes
0{{T1+:Tmp!}gT}li*]:+

Explanation:
0{{T1+:Tmp!}gT}li*]:+ Original code

 {            }li*    Repeat n times
  {        }          Block
   T                  Get variable T | stack: T
    1+                Add one | Stack: T+1
      :T              Store in variable T | Stack: T+1
        mp!           Is T not prime?     | Stack: !(isprime(T))
            g         Do while condition at top of stack is true, pop condition
             T        Push T onto the stack | Stack: Primes so far
0                 ]   Make everything on stack into an array, starting with 0 (to not throw error if n = 0)| Stack: array with 0 and all primes up to n
                   :+ Add everything in array

Try it online!

F#, 111 bytes
let f n=Seq.initInfinite id|>Seq.filter(fun p->p>1&&Seq.exists(fun x->p%x=0){2..p-1}|>not)|>Seq.take n|>Seq.sum

Try it online!
Seq.initInfinite creates an infinitely-long sequence with a generator function which takes, as a parameter, the item index. In this case the generator function is just the identity function id.
Seq.filter selects only the numbers created by the infinite sequence that are prime.
Seq.take takes the first n elements in that sequence.
And finally, Seq.sum sums them up.

cQuents, 3 bytes
;pz

Try it online!
Explanation
;    sum of first n terms for input n
 pz  each term is the next prime after the previous term

Note current version uses Z instead of z

MY, 4 bytes
⎕ṀΣ↵

Try it online!
Still regretting no implicit input/output in this garbage language, would've been two bytes otherwise.

⎕ = input
Ṁ  = 1st ... nth prime inclusive
Σ  = sum
↵  = output

APL(NARS), 27 chars, 54 bytes
{⍵=0:0⋄+/{⍵=1:2⋄¯2π⍵-1}¨⍳⍵}

{¯2π⍵} here would return the n prime different from 2. So {⍵=1:2⋄¯2π⍵-1}
would return the n prime 2 in count in it...

Pyth, 5 bytes
s.fP_

Try it online here.
s.fP_ZQ   Implicit: Q=eval(input())
          Trailing ZQ inferred
 .f   Q   Starting at Z=1, return the first Q numbers where...
   P_Z    ... Z is prime
s         Sum the resulting list, implicit print

Thunno 2 S, 2 bytes
Æp

Try it online!
Built-in  for "first n primes". S flag sums the list.