text:
Is this a Major Scale (or equivalent)?
Sandbox
The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of seven notes: the eighth duplicates the first at double its frequency so that it is called a higher octave of the same note.
The seven musical notes are:

C, D, E, F, G, A, B, C (repeated for example purposes)

A major scale is a diatonic scale. Take the previous succession of notes as a major scale (Actually, It is the scale C Major). The sequence of intervals between the notes of a major scale is:

whole, whole, half, whole, whole, whole, half

where "whole" stands for a whole tone (a red u-shaped curve in the figure), and "half" stands for a semitone (a red broken line in the figure).

In this case, from C to D exist a whole tone, from D to E exist a whole tone, from E to F exist half tone, etc...
We have 2 components that affects the tone distance between notes. These are the Sharp symbol (♯) and the flat symbol (♭).
The Sharp symbol (♯) adds half tone to the note. Example. From C to D we mentioned that exists a whole tone, if we use C♯ instead C then from C♯ to D exists half tone.
The Flat symbol (♭) do the opposite of the Sharp symbol, it subtract half tone from the note. Example: From D to E we mentioned that exists a whole tone, if we use Db instead D then from Db to E exists a tone and a half.
By default, from Note to Note exist a whole tone except for E to F and B to C in where just half tone exists.
Note in some cases using enharmonic pitches can create an equivalent to a Major Scale. An example of this is C#, D#, E#, F#, G#, A#, B#, C# where E# and B# are enharmonic but the scale follows the sequence of a Major Scale.

Challenge
Given a scale, output a truthy value if it is a Major Scale or equivalent, otherwise output a falsey value.
Rules

Standard I/O method allowed
Standard code-golf rules apply
You don't need to take in consideration the 8th note. Assume the input will only consist of 7 notes
Assume double flat (♭♭), double sharp (♯♯) or natural sign (♮) don't exist

Test cases
C, D, E, F, G, A, B                 => true
C#, D#, E#, F#, G#, A#, B#          => true
Db, Eb, F, Gb, Ab, Bb, C            => true
D, E, Gb, G, A, Cb, C#              => true
Eb, E#, G, G#, Bb, B#, D            => true
-----------------------------------------------
C, D#, E, F, G, A, B                => false
Db, Eb, F, Gb, Ab, B, C             => false
G#, E, F, A, B, D#, C               => false
C#, C#, E#, F#, G#, A#, B#          => false
Eb, E#, Gb, G#, Bb, B#, D           => false

@Abigail Basically yes. They have the same tone although they are different notes.

and conversely, Fb = E and B# = C.

and Cx (or C##) = D

@SaggingRufus but in this challenge we are not using double sharp

I'm going to have to downvote this because I don't accept scales that don't have exactly one of each letter in order. No B#, D, Fb, E#, G, A Cb thank you very much...

@Neil A A#/Bb B B#/Cb C C#/Db D D#/Eb E E#/Fb F F#/Gb G G#/Ab those are the only possible notes in that order repeating.

@Neil Ok, you are free to do whatever you want

Btw, Pentatonic scales do not have one of each letter :v

Fair enough, but they do have unique letters in order at least.

@Neil Chromatic scales do not have unique letters and I'm sure there is a type of scale that doesnt follow an ascending order

Sure, but those are hardly major scales any more.

I'm going to have to upvote this because @Neil downvoted it thank you very much

Perl 6, 76 65 63 59 bytes
-4 bytes thanks to Phil H
{221222==[~] (.skip Z-$_)X%12}o*>>.&{13*.ord+>3+?/\#/-?/b/}

Try it online!
Explanation
*>>.&{ ... }  # Map notes to integers
  13*.ord     # 13 * ASCII code:  A=845 B=858 C=871 D=884 E=897 F=910 G=923
  +>3         # Right shift by 3: A=105 B=107 C=108 D=110 E=112 F=113 G=115
              # Subtracting 105 would yield A=0 B=2 C=3 D=5 E=7 F=8 G=10
              # but isn't necessary because we only need differences
  +?/\#/      # Add 1 for '#'
  -?/b/       # Subtract 1 for 'b'

{                           }o  # Compose with block
            (.skip Z-$_)        # Pairwise difference
                        X%12    # modulo 12
         [~]  # Join
 221222==     # Equals 221222

If you're going to do a pairwise difference and modulo 12, you don't need to subtract 105; it's just an offset. -4 chars: https://tio.run/##bY7PCoJAHITvPsXAlpSm5kpdSkNX8xWiP0RLCVGh6EnCXt1@ax4iug7ffDPFpbzP20cNPYPfPjl3Oee@v3sdMLKr27XA1hocx5uhy5vcCAJbf7qeYefl2Qw8y53OzJWzZ461cqTTtAutOtXIRtRAlpfaUiBGgjVShIiCCQUMMUPCsGZIGUKGiKk8lkikAiVCiUhCdCmVKVFtQVFHEkb1VLUJi8jXeTvt99KP8SNMPxAhihf9I/HvUb8jv4faNw

That's a really clever way of mapping the notes to their relative values, +1 from me!

Node.js v10.9.0, 78 76 71 69 bytes
a=>!a.some(n=>(a-(a=~([x,y]=Buffer(n),x/.6)-~y%61)+48)%12-2+!i--,i=3)

Try it online!
How?
Each note \$n\$ is converted to a negative number in \$[-118,-71]\$ with:
[x, y] = Buffer(n) // split n into two ASCII codes x and y
~(x / .6)          // base value, using the ASCII code of the 1st character
- ~y % 61          // +36 if the 2nd character is a '#' (ASCII code 35)
                   // +38 if the 2nd character is a 'b' (ASCII code 98)
                   // +1  if the 2nd character is undefined

Which gives:
  n   | x  | x / 0.6 | ~(x / 0.6) | -~y % 61 | sum
------+----+---------+------------+----------+------
 "Ab" | 65 | 108.333 |    -109    |    38    |  -71
 "A"  | 65 | 108.333 |    -109    |     1    | -108
 "A#" | 65 | 108.333 |    -109    |    36    |  -73
 "Bb" | 66 | 110.000 |    -111    |    38    |  -73
 "B"  | 66 | 110.000 |    -111    |     1    | -110
 "B#" | 66 | 110.000 |    -111    |    36    |  -75
 "Cb" | 67 | 111.667 |    -112    |    38    |  -74
 "C"  | 67 | 111.667 |    -112    |     1    | -111
 "C#" | 67 | 111.667 |    -112    |    36    |  -76
 "Db" | 68 | 113.333 |    -114    |    38    |  -76
 "D"  | 68 | 113.333 |    -114    |     1    | -113
 "D#" | 68 | 113.333 |    -114    |    36    |  -78
 "Eb" | 69 | 115.000 |    -116    |    38    |  -78
 "E"  | 69 | 115.000 |    -116    |     1    | -115
 "E#" | 69 | 115.000 |    -116    |    36    |  -80
 "Fb" | 70 | 116.667 |    -117    |    38    |  -79
 "F"  | 70 | 116.667 |    -117    |     1    | -116
 "F#" | 70 | 116.667 |    -117    |    36    |  -81
 "Gb" | 71 | 118.333 |    -119    |    38    |  -81
 "G"  | 71 | 118.333 |    -119    |     1    | -118
 "G#" | 71 | 118.333 |    -119    |    36    |  -83

We compute the pairwise differences modulo \$12\$ between these values.
The lowest possible difference between 2 notes is \$-47\$, so it's enough to add \$4\times12=48\$ before applying the modulo to make sure that we get a positive result.
Because we apply a modulo \$12\$, the offset produced by a '#' is actually \$36 \bmod 12 = 0\$ semitone, while the offset produced by a 'b' is \$38 \bmod 12 = 2\$ semitones.
We are reusing the input variable \$a\$ to store the previous value, so the first iteration just generates \$\text{NaN}\$.
For a major scale, we should get \$[ \text{NaN}, 2, 2, 1, 2, 2, 2 ]\$.
We use the counter \$i\$ to compare the 4th value with \$1\$ rather than \$2\$.

Great approach, much more interesting than my answer

JavaScript (Node.js), 150 131 125 bytes
l=>(l=l.map(x=>'C0D0EF0G0A0B'.search(x[0])+(x[1]=='#'|-(x[1]=='b')))).slice(1).map((n,i)=>(b=n-l[i])<0?2:b)+""=='2,2,1,2,2,2'

Try it online!
-19 bytes thanks to Luis felipe
-6 bytes thanks to Shaggy
Ungolfed:
function isMajor(l) {
    // Get tone index of each entry
    let array = l.map(function (x) {
        // Use this to get indices of each note, using 0s as spacers for sharp keys
        let tones = 'C0D0EF0G0A0B';
        // Get the index of the letter component. EG D = 2, F = 5
        let tone = tones.search(x[0]);
        // Add 1 semitone if note is sharp
        // Use bool to number coercion to make this shorter
        tone += x[1] == '#' | -(x[1]=='b');
    });
    // Calculate deltas
    let deltas = array.slice(1).map(function (n,i) {
        // If delta is negative, replace it with 2
        // This accounts for octaves
        if (n - array[i] < 0) return 2;
        // Otherwise return the delta
        return n - array[i];
    });
    // Pseudo array-comparison
    return deltas+"" == '2,2,1,2,2,2';
}

[...'C0D0EF0G0A0B'] instead of 'C0D0EF0G0A0B'.split('') and +"" instead of .toString() to save some bytes

x[1]=='#'|-(x[1]=='b') instead of x[1]=='#'?1:(x[1]=='b'?-1:0) save some bytes too

@LuisfelipeDejesusMunoz Oh nice thanks! I can't believe I forgot about array expansion and adding an empty string

"If delta is negative, replace it with 2" sounds wrong. I think you need to take the difference modulo 12.

@nwellnhof In my tests, all major scales either had the correct deltas to begin with, or, if they spanned an octave, had one delta at -10 rather than 2. Replacing negative deltas fixes that. I don't think -10 % 12 == 2.
Although come to think of it this might fail in some cases...

You can use (x+12)%12 because the difference is never less than -11.

[...'C0D0EF0G0A0B'].indexOf(x[0]) to 'C0D0EF0G0A0B'.search(x[0]) saves a few more bytes.

Dart, 198 197 196 189 bytes
f(l){var i=0,j='',k,n=l.map((m){k=m.runes.first*2-130;k-=k>3?k>9?2:1:0;return m.length<2?k:m[1]=='#'?k+1:m[1]=='b'?k-1:k;}).toList();for(;++i<7;j+='${(n[i]-n[i-1])%12}');return'221222'==j;}

Try it online!
Loose port of the old Perl 6 answer https://codegolf.stackexchange.com/a/175522/64722
f(l){
  var i=0,j='',k,
  n=l.map((m){
    k=m.runes.first*2-130;
    k-=k>3?k>9?2:1:0;
    return m.length<2?k:m[1]=='#'?k+1:m[1]=='b'?k-1:k;
  }).toList();
  for(;++i<7;j+='${(n[i]-n[i-1])%12}');
  return'221222'==j;
}

-1 byte by using ternary operators for #/b
-1 byte by using ifs instead of ternaries for the scale shifts
-7 bytes thanks to @Kevin Cruijssen

Old version :
Dart, 210 bytes
f(l){var i=0,k=0,n={'C':0,'D':2,'E':4,'F':5,'G':7,'A':9,'B':11,'b':-1,'#':1},j='',y=[0,0];for(;++i<7;j+='${(y[0]-y[1])%12}')for(k=0;k<2;k++)y[k]=n[l[i-k][0]]+(l[i-k].length>1?n[l[i-k][1]]:0);return'221222'==j;}

Try it online!
Ungolfed:
f(l){
  var i=0,k=0,n={'C':0,'D':2,'E':4,'F':5,'G':7,'A':9,'B':11,'b':-1,'#':1},j='',y=[0,0];
  for(;++i<7;j+='${(y[0]-y[1])%12}')
    for(k=0;k<2;k++)
      y[k]=n[l[i-k][0]]+(l[i-k].length>1?n[l[i-k][1]]:0);

  return'221222'==j;
}

A whole step is 2, a quarter is 1. Mod 12 in case you jump to a higher octave.
Iterates through all notes and computes the difference between the ith note and the i-1th note.
Concatenates the result and should expect 221222 (2 whole, 1 half, 3 wholes).

-2 bytes by not assigning 0 to k
-4 bytes by using j as a String and not a List
-6 bytes thanks to @Kevin Cruijssen by removing unnecessary clutter in loops

I don't know Dart, but parts are similar as Java. Therefore: changing i=1 to i=0 can reduce a byte by changing for(;i<7;i++) to for(;++i<7;). In addition, the brackets {} can be removed around that loop, by putting the j+=... inside the third part of the loop: for(;++i<7;j+='${(y[0]-y[1])%12}'). And one last thing is changing return j=='221222'; to return'221222'==j; to get rid of the space. -6 (210 bytes) after these modifications.

Thanks, didn't know about those tricks for the loops

Np. In your new 196-bytes version you can also golf it to 189 bytes by changing if(k>9)k--;if(k>3)k--; to k-=k>3?k>9?2:1:0; and k+=m.length<2?0:m[1]=='#'?1:m[1]=='b'?-1:0;return k; to return m.length<2?k:m[1]=='#'?k+1:m[1]=='b'?k-1:k;. :)

Damn, I still have a lot to learn it seems, thanks !

Well, I've been golfing for 2.5 years now, and even I get tips on things to golf all the time. :) It's pretty easy to miss something yourself initially, and with time you think about different ways to golf. :) Tips for golfing in  might be interesting to read through if you haven't yet. And some of the Tips for golfing in Java might also be applicable in Dart, since the golfs I did in your answers were based on my Java knowledge, since this is the first time I see Dart. ;)

Dart is pretty close to Java but with lots of stuff taken from JS to make the code less verbose. The only big downside is that type casting is inexistant, you can't use an int as a bool for example. Some functions are also extremely verbose, removeLast instead of pop

Verbose methods and not able to convert int to boolean sounds like Java ;) One advantage Java has compared to JS/Python/etc. is that characters can be used as integer unicode values, which is usually the only kind of challenges where I have shorter answers in Java than in Python or JS ;) Everything else Java is usually at the bottom in terms of byte-count, unless BrainFwck or something similar has an answer as well. xD

Jeez, I know C does that too. Sadly Dart has this 'runes' methods (or codeUnits for UTF-16 characters) to get the integer value. You can't get it from the character itself. Dart's very strong typing sure is problematic sometimes

Ah well, regardless of the language, it's still fun to do these gold challenges as short as possible. Apart from Java I usually also answer in 05AB1E, an actual golfing language that does things in 5 bytes which my Java function does in 100 bytes xD And sometimes in Whitespace, Retina, or Charcoal if the challenge is suitable for those languages. Regardless of the language, I'm still having fun golfing them as much as possible. :)

[Wolfram Language (Mathematica) + Music` package], 114 bytes
I love music and found this interesting, but I was out playing real golf when this code golf opportunity came down the pike so my submission is a little tardy.
I figured I'd try this a totally different way, utilizing some actual music knowledge.  It turns out the music package of Mathematica knows the fundamental frequency of the named notes.  First I convert the input string into sequence of named notes.  Next, I take the ratios of each successive note and double any that are less than 2 (to account for octave shift).  Then I compare these ratios to the ratios of the Ionian scale which has roughly a 6% frequency difference between half notes and 12% between full notes.
More than half of the bytes spent here are to convert the input into named symbols.
.06{2,2,1,2,2,2}+1==Round[Ratios[Symbol[#~~"0"]&/@StringReplace[# ,{"b"->"flat","#"->"sharp"}]]/.x_/;x<1->2x,.01]&

Try it online!

Python 3, 175 136 134 114  112 bytes
def f(t):r=[ord(x[0])//.6+ord(x[1:]or'"')%13-8for x in t];return[(y-x)%12for x,y in zip(r,r[1:])]==[2,2,1,2,2,2]

Try it online!

An one-liner Python 3 implementation.
Thanks to @Arnauld for idea of calculate tones using division and modulo.
Thanks to @Jo King for -39 bytes.

136 bytes

C (gcc), -DA=a[i] + 183 = 191 bytes
f(int*a){char s[9],b[9],h=0,i=0,j=0,d;for(;A;A==35?b[i-h++-1]++:A^98?(b[i-h]=A*13>>3):b[i-h++-1]--,i++);for(;j<7;d=(b[j]-b[j-1])%12,d=d<0?d+12:d,s[j++-1]=d+48);a=!strcmp(s,"221222");}

Try it online!
Based on the Perl answer.
Takes input as a wide string.
Ungolfed:

int f(int *a){
	char s[9], b[9];
	int h, i, j;
	h = 0;
        for(i = 0; a[i] != NULL; i++){
		if(a[i] == '#'){
			b[i-h-1] += 1;
			h++;
		}
		else if(a[i] == 'b'){
			b[i-1-h] -= 1;
			h++;
		}
		else{
			b[i-h] = (a[i] * 13) >> 3;
		}
	}
	for(j = 1; j < 7; j++){
		int d = (b[j] - b[j-1]) % 12;
		d = d < 0? d + 12: d;
		s[j-1] = d + '0';
	}
	return strcmp(s, "221222") == 0;
}

170 bytes

Ruby, 109 bytes
->s{(0..11).any?{|t|s.map{|n|(w="Cef;DXg<E=Fhi>G j8A d9B:")[(w.index(""<<n.sum%107)/2-t)%12]}*''=='CfDX<=h'}}

Try it online!

[Python] 269  202 bytes
Improvements from Jo King:
p=lambda z:"A BC D EF G".index(z[0])+"b #".index(z[1:]or' ')-1
def d(i,j):f=abs(p(i)-p(j));return min(f,12-f)
q=input().replace(' ','').split(',')
print([d(q[i],q[i+1])for i in range(6)]==[2,2,1,2,2,2])

Try it!
Ungolfed, with test driver:
tone = "A BC D EF G"   # tones in "piano" layout
adj = "b #"            # accidentals

def note_pos(note):
    if len(note) == 1:
        note += ' '
    n,a = note
    return tone.index(n) + adj[a]

def note_diff(i, j):
    x, y = note_pos(i), note_pos(j)
    diff = abs(x-y)
    return min(diff, 12-diff)

def is_scale(str):
    seq = str.replace(' ','').split(',')
    div = [note_diff(seq[i], seq[i+1]) for i in (0,1,2,3,4,5)]
    return div == [2,2,1,2,2,2]

case = [
("C, D, E, F, G, A, B", True),
("C#, D#, E#, F#, G#, A#, B#", True),
("Db, Eb, F, Gb, Ab, Bb, C", True),
("D, E, Gb, G, A, Cb, C#", True),
("Eb, E#, G, G#, Bb, B#, D", True),

("C, D#, E, F, G, A, B", False),
("Db, Eb, F, Gb, Ab, B, C", False),
("G#, E, F, A, B, D#, C", False),
("C#, C#, E#, F#, G#, A#, B#", False),
("Eb, E#, Gb, G#, Bb, B#, D", False),
]

for test, result in case:
    print(test + ' '*(30-len(test)), result, '\t',
          "valid" if is_scale(test) == result else "ERROR")

Yes, I see the white space -- still inculcated with too much PEP-8, I'm afraid.  I apparently missed something; is an execution link required here?

Though, if you want the link, 202 bytes with some quick golfing. You could definitely golf some more by changing to a different input format

Ah ... I'm too used to Python returning the final expression as the process value.  Thanks for the pointers and hints.

You can get 156 bytes if you switch to a function taking a list of strings. Also, TIO has an auto formatter in the link section that you can use

@JoKing, you're perfectly welcome to edit this answer or post your own; commenting with a link separates the improvements by one level.


text:
Find arrays with distinct subarray sums
Consider an array A of length n. The array contains only integers in the range 1 to s. For example take s = 6, n = 5 and  A = (2, 5, 6, 3, 1). Let us define g(A) as the collection of sums of all the non-empty contiguous subarrays of A. In this case g(A) = [2,5,6,3,1,7,11,9,4,13,14,10,16,15,17]. The steps to produce g(A) are as follows:
The subarrays of A are (2), (5), (6), (3), (1), (2,5), (5,6), (6,3), (3,1), (2,5,6), (5,6,3), (6,3,1),(2,5,6,3), (5,6,3,1), (2,5,6,3,1). Their respective sums are 2,5,6,3,1,7,11,9,4,13,14,10,16,15,17.
In this case all the sums are distinct.
However, if we looked at g((1,2,3,4)) then the value 3 occurs twice as a sum and so the sums are not all distinct.
Task
For each s from 1 upwards, your code should output the largest n so that there exists an array A  of length n with distinct subarray sums.
Your code should iterate up from s = 1 giving the answer for each s in turn. I will time the entire run, killing it after one minute.
Your score is the highest s you get to in that time.
In the case of a tie, the first answer wins.
Examples
The answers for s = 1..12 are n=1, 2, 3, 3, 4, 5, 6, 6, 7, 8, 8, 9.
Testing
I will need to run your code on my ubuntu machine so please include as detailed instructions as possible for how to compile and run your code.
Leaderboard

s = 19 by Arnauld in C

I don't think the requirement of making the programs output results starting from $ s=1 $ is a good idea. Once a particular $ s $ value is known, the program could simply output that number instead of doing any calculation. You might instead measure the solution that is able to find the largest $ s $ value in under a minute?

There is a ppcg rule that answers should actually compute the output. If there is a general mathematical rule someone can work out that would be a valid way to do it quickly though. In practice the time will be dominated by the largest s in any case I suspect.

I am quite certain that there is no such rule. Currently there is nothing stopping anyone from just writing a simple print statement for the first 12 values that you provided and having a score of 12. It is almost certainly true that the largest value will use up most of the time, which is why I think my suggestion makes more sense. It's (of course) fine if you disagree, but I'm pretty sure you are just making your challenge much more annoying to answer for no reason.

@FryAmTheEggman Hard-coding the output is a standard loophole.

@Abigail I see that such function could be argued both ways: hard-coded and not hard-coded. One other example that would lean towards the "not hard-coded" side would be a polynomial function generated by interpolating some precomputed result. I leave the blame on the challenge, since allowing the program to return wrong/unexpected result after a certain point calls for hard-coding the output to some extent.

@JungHwanMin I think that what Abigail suggests clearly identifies why that doesn't make sense in this case. For fastest-code problems the best strategy will essentially always involve some pre-calculation. Deciding where to cut the line seems like a preposterous problem, so I don't think that loophole makes much sense for fastest-code challenges (or in fact, in general). Thanks though for pointing it out, I can see why users might be confused by it.

I downvoted this challenge because the nature of this challenge encourages some extent of hard-coding the solutions, and requiring the answer to "actually compute the output" is a non-observable requirement; there is no clear distinction between what is computed and what is hard-coded.

@JungHwanMin Oh no! I am confused as the scoring system is basically the same as https://codegolf.stackexchange.com/questions/174407/count-arrays-that-make-unique-sets and https://codegolf.stackexchange.com/questions/165504/delete-some-bits-and-count and https://codegolf.stackexchange.com/questions/157049/calculate-the-hafnian-as-quickly-as-possible and... (and so on). What can I change to make you happy with my question?

@Anush (Passive aggressiveness aside,) The scoring is not the issue; rather, the problem is that the challenge requires programs that take an integer and return an integer. By nature, this is easy to "hard-code"; see Abigail's example. To decompose this issue further: the first link you posted requires two integer inputs, with a variable-length integer list output. Clearly, effectively hard-coding cases for a pair of inputs is not so easily done. Similar reasoning applies with the second link. The third link takes a variable length input, so hard-coding is out of the question, too.

@JungHwanMin Thanks. No aggressiveness of any sort intended! Can you suggest how to improve my question please?

One possibility is to change the output to something not easy to hard-code; for instance, you could require programs to output the list of subarrays or sums thereof. These changes could be too drastic, but since there are no submissions to be invalidated, I think it would be fine to change the specifications.

@JungHwanMin What's the difference between hard-coding the number 9 and hard-coding an array of length 9? It's good practice to avoid unobservable requirements whenever possible, but it's rather difficult for some kinds of challenges (fastest-code, anything related to quines, etc.).

@Dennis I presume it would take considerably more effort to indirectly hard-code an array than a number without making it obvious, since the requirement for now is to "compute the output." I understand that hard-coding is still a possibility, though. Perhaps a better change to the challenge would be to output n given s (for all valid s)?

C (gcc), s = 19
This is basically a port of my Node.js answer. It goes one step further with the default compiler options and two steps further with -O2 or -O3.
#include <stdio.h>
#include <string.h>
#include <stdint.h>

void search(uint8_t * arr, int n, uint8_t * sum, int * max, char * str, int depth) {
  int i, j, k, s;
  char tmp[16];

  // do we have a better array?
  if(depth > *max) {
    for(str[0] = '\0', i = 0; i < depth; i++) {
      sprintf(tmp, "%d ", arr[i]);
      strcat(str, tmp);
    }
    *max = depth;
  }

  // try to append i = 1 to n to the current array
  for(i = 1; i <= n; i++) {
    // provided that doing so does not produce a sum that was already encountered
    if(!sum[i]) {
      for(sum[s = i] = 1, j = depth; j && !sum[s += arr[j - 1]]; j--) {
        sum[s] = 1;
      }
      if(!j) {
        // this is valid: set the value in arr[] and do a recursive call
        arr[depth] = i;
        search(arr, n, sum, max, str, depth + 1);
      }
      // whether the recursive call was processed or not, we have to clear the flags
      // that have been set above
      for(sum[s = i] = 0, k = depth - 1; k >= j; k--) {
        sum[s += arr[k]] = 0;
      }
    }
  }
}

int solve(int n, char * str) {
  int     max = 0;              // best length so far
  int     hi = n * (n + 1) / 2; // highest possible sum for n
  uint8_t sum[hi + 1];          // encountered sums
  uint8_t arr[n];               // array

  memset(sum, 0, (hi + 1) * sizeof(uint8_t));
  search(arr, n, sum, &max, str, 0);

  return max;
}

/////////////////////////////////////////////////////////////////////////////////////

void main() {
  char str[128];
  int  n, res;

  for(n = 1; n <= 19; n++) {
    res = solve(n, str);
    printf("N = %d --> %d with [ %s]\n", n, res, str);
  }
}

Try it online!

Thanks again! I wonder what speedups will be possible.

@Anush Just compiling with -O3 allows to reach $N=19$ on TIO.

Could you add the main function to your answer so people can just copy and paste?

@Anush Sure. Done.

Node.js, s = 17
Just a simple recursive search to get the ball rolling. Returns both the length and a valid array.
solve = n => {
  var max = 0,  // best length so far
      best,     // best array so far
      sum = {}; // encountered sums

  (search = a => {
    var i, j, k, s;

    // do we have a better array?
    if(a.length > max) {
      max = a.length;
      best = [...a];
    }

    // try to prepend i = 1 to n to the current array
    for(i = 1; i <= n; i++) {
      // provided that doing so does not produce a sum that was already encountered
      if((sum[j = 0, s = i] ^= 1) && a.every(n => sum[j++, s += n] ^= 1)) {
        search([i, ...a]);
      }
      // reset the flags that have been toggled above
      for(sum[s = i] ^= 1, k = 0; k < j; k++) {
        sum[s += a[k]] ^= 1;
      }
    }
  })([]);

  return [ max, best ];
}

Try it online!

Thank you for the first answer!

source: Stack Exchange

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

sort: votes


text:
Spelling Bee Acceptable
This is similar to this question.
However, I have a different goal in mind:
Reduce the wordlist to words that could appear.
The easy part is to delete hyphens and similar.
The hard part, however: Remove words containing more than seven letters.
So, the problem:
Given a set of words containing only lowercase (or uppercase) ASCII letters, remove the words containing eight or more different letters.
Any input and output format is acceptable.
Standard loophole rules apply.
Shortest byte count wins.
Clever solutions are better, and faster is better as well.
My solution (implementing a quite clever O(n) algorithm, noncompetitive ref implementation):
#include <stdio.h>
#include <stdint.h>

int main(void) {
  char str[1024];
  while(scanf("%s\n", str) == 1) {
    uint32_t st = 0;
    int s = 0;
    for(char *p = str; *p && s <= 7; p++) {
      s += ~st >> (*p - 'a') & 1;
      st |= 1 << (*p - 'a');
    }
    if(s <= 7)
      printf("%s\n", str);
  }
}

Could you include a test case?

It's generally bad practice to have an upper limit on the score.  The reason is that some languages are especially verbose or difficult to program in, and the 307 byte requirement would arbitrarily disallow them from competing.

Honestly, this is the easy part. Finding words that fit a partially revealed word is harder

I meant, this is the hard part of finding words that could ever be solutions.

I meant O(n) where n is the length of the word. In other words, to deal with a word of length n, it does O(n) work.

APL (Dyalog Unicode), 11 bytes
{⍵/⍨8>≢∪⍵}¨

Takes input as a list of strings.
Explanation:
{⍵/⍨8>≢∪⍵}¨
{       ⍵}¨ for each word
       ∪    take unique letters
    8>≢     length less than 8 as a boolean (0 or 1)
 ⍵/⍨        repeat word that many times

Try it online!

the result contains empty strings. you can fix that preserving the byte count: ⊢(/⍨)8>≢∘∪¨

Perl 6, 20 bytes
*.grep(8>*.comb.Set)

Try it online!
Filters by words that have a set of letters with size less than 8.

05AB1E, 5 bytes
ʒÙg8‹

Try it online.
Explanation:
ʒ        # Filter the (implicit) input-list by:
 Ù       #  Only leave distinct letters of the word
  g      #  Take its length
   8‹    #  And only leave those with a length smaller than 8
         # (And output implicitly after we're done filtering)

Jelly, 6 bytes
Qṫ¥Ðḟ8

Try it online!
How it works
Qṫ¥Ðḟ8  Main link. Argument: A (array or words)

   Ðḟ   Filterfalse; only keep the words W of A for which the chain to the left
        returns a falsy value.
  ¥         Combine the two links to the left into a dyadic chain.
Q               Unique; remove duplicate letters from W.
 ṫ   8          Tail 8; remove the first 7 letters of the result.

J, 10 bytes
#~8>#@~.@>

explanation
#~ 8 > #@~.@>
#~                 NB. filter the input based on...
   8 >             NB. is 8 greater than...
       #@          NB. the length of...
         ~.@       NB. the unique characters of...
            >      NB. the unboxed input.

Try it online!

Shouldn't 9 be 8?

Fixed.  Weird, I could have sworn the OP said 8 was the max length allowed before.  Anyway, ty...

Java 8, 46 bytes
s->s.filter(w->w.chars().distinct().count()<8)

Try it online.
Explanation:
s->               // Method with String-Stream as both parameter and return-type
  s.filter(w->    //  Filter the words in the input-Stream by:
    w.chars()     //  Convert the String to characters
     .distinct()  //  Only leave distinct characters
     .count()<8)  //  Only leave words with less than 8 distinct characters

Wow, w.chars.distinct.count. Turn each of those words into a symbol and you have a golfing language! xD

@Quintec Hehe, it's what I do in my 05AB1E answer. :) s->s is implicit input in 05AB1E; filter(w-> is ʒ; .chars() is implicitly again; .distinct() is Ù; .count() (or length) is g; <8 is 8‹; and the closing ) is implicitly since it's at the end of the 05AB1E program (if I wanted to do something after the filter I'd have to close it with }); and finally outputting is implicitly again. So my Java and 05AB1E are similar, one is a 46 bytes function and the other a 5 bytes full program, though. xD

Hehe, also basically same for my APL answer. It meets in the middle: 11 bytes :P

MathGolf, 6 bytes
Ç{▀£7>

Try it online!
Explanation
Really similar to the 05AB1E solution, but I lose one byte thanks to explicitly having to define the code block for filtering.
Ç       Implicit faulty filter by block
 {      Start block
  ▀     Get unique characters of string
   £    Get length
    7>  Is greater than 7

Python 2, 40 bytes
lambda i:[x for x in i if len(set(x))<8]

Try it online!
Test cases borrowed from @Dennis. Input and output are both lists.

Red, 54 bytes
func[b][foreach a b[if 8 > length? unique a[print a]]]

Try it online!
The first test set was taken from Dennis'

C (gcc), 104 95 bytes
Dennis's word set was also used here.
Thanks to nwellnhof for the suggestions.
char*s,*t;f(i,j,k){for(;~scanf("%ms",&s);i<8&&puts(s))for(i=j=0,t=s;*t;j=k)k=j|1<<*t++,i+=j<k;}

Try it online!

96 bytes, if you're OK with implementation- and undefined behavior.

@nwellnhof What's a little UD between friends for code golf? :-)

JavaScript, 33 bytes
a=>a.filter(s=>new Set(s).size<8)

Try it online, using Dennis' test cases

C# (.NET Core), 58 bytes
 a=>a.Where(x=>x.GroupBy(y=>y).Count()<8)

Try It Online!

C++ (gcc), 105 104 bytes
#import<bits/stdc++.h>
f(){for(char*n;~scanf("%ms",&n);)std::set<int>(n,n+strlen(n)).size()<8&&puts(n);}

Try it online!
-1 byte thanks to @ceilingcat

perl -nlE, 32 bytes
my%h;@h{/./g}=();say if keys%h<8

This reads words from STDIN, printing out those with less than 7 different characters.

25 bytes: my%h;@h{/./g}=1;%h<8&&say (%h<8 requires Perl 5.26)

Racket, 95 bytes
(require racket/set)(define(f l)(filter(lambda(x)(<(set-count(list->set(string->list x)))8))l))

Try it online!
The test set was taken from Dennis'

Charcoal, 12 bytes
ΦＡ›⁸ＬΦι⁼μ⌕ιλ

Try it online! Link is to verbose version of code. Explanation:
 Ａ              Input array
Φ               Filter strings where
   ⁸            Literal 8
  ›             Is greater than
    Ｌ           Length of
      ι         Current string
     Φ          Filtered on characters where
        μ       Inner index
       ⁼        Equals
           λ    Current character's
         ⌕      First index in
          ι     Current string
                Implicitly print matching strings

10?

JavaScript (ES6), 53 bytes
Without using a set:
a=>a.filter(w=>[...w].every(o=c=>o[c]=o[c]||--k,k=8))

Try it online! (using Dennis' test set)

Japt -f, 6 bytes
¬â Ê<8

Try it, using Dennis' test cases

Snap! 4, scratchblocks2 syntax
(pretending that Snap! exclusive blocks are valid in scratchblocks2 but functions use the Scratch define)
69 bytes
b takes a list of strings.
define((b)
report((#)keep items such that(<(length of [])<[7]>)from(b

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


text:
Magic: The Gathering, Paying for Spells
For more MtG-goodness: Magic: The Gathering Combat with Abilities
Premise:
In Magic: the Gathering, you cast spells by paying their mana cost by tapping lands for the required amount. These lands can produce one of the five colors which are:

White (W)
Blue  (U)
Black (B)
Red   (R)
Green (G)

The cost is made up of two parts: a number which is the generic mana requirement, and a series of symbols representing the colored mana requirement. The number is the generic mana cost and can use any color of mana to satisfy it, e.g. (3) can be paid with WGG. The symbols are a 1:1 requirement of a specific color. e.g. WWUBR would require 2 white mana, 1 blue, 1 black and 1 red. The Generic part will always come before the Colored part. As a reminder, (0) is a valid cost and must be handled.
You can have costs that are entirely generic, or entirely colored, or both. For example, the following card has a cost of 4BB and is be paid with 4 of whatever colored mana and 2 black mana:

Lands in this challenge will each produce one mana. However, we will consider lands that can produce multiple colors but still only yield 1 mana. E.g. G will produce a green mana, WG can produce either 1 white or 1 green.
Input:
You will be given two inputs, a card's cost and a list of lands.
The card's cost can either be a string, or a tuple containing a number and a string for the colored part. If there's no generic part, you can pad the string/tuple with a 0.
The land list will be a list of strings where each one is what a given land can produce. This list can be empty (you have no lands). You can also take this as a list of ints using bit-mask logic but post your scheme if you do. Order is also up to you if it matters, otherwise it'll be assumed in WUBRG order.
#Example input formats
"4BB", ("WG","B","B") #
(4,"BB"), (7,3,3)     #Both should return falsy

Output:
A truthy value if you can successfully pay the cost given your lands and a falsey value if you cannot.
Rules:

You'll be guaranteed valid input
Mana will be assumed to always be in "WUBRG" order. If you want a different order, state so in your answer.
Colors will always be grouped in the cost, e.g. "WWUBBRG"
Input will use either all Uppercase or all lowercase, your choice.
You should be able to handle regex 127[WUBRG]{127} and 254 lands.
Standard loopholes forbidden
This is code-golf, shortest answer per language wins

Examples:
"0", ("")                => 1
"1BB", ("WG","B","B")    => 1
"BB", ("WG","B","B")     => 1
"WB", ("WG","B","B")     => 1
"1UB", ("W","U","B")     => 1
"1BB", ("WB","WB","WG")  => 1
"1", ("WG","B","B")      => 1
"1BB", ("WGR","WB","WB") => 1
"WUBRG", ("W","U","B","R","G")  => 1
"1WWUBB", ("W","WG","U","B","B","R")  => 1
"10BB", ("WGR","WB","WB","B","B","B","B","B","B","B","B","B") => 1

"R", ("")                => 0
"4", ("WG","B","B")      => 0
"1BB", ("WG","WB")       => 0
"1UB", ("WG","W","UB")   => 0
"1UBR", ("W","WG","UBR") => 0
"WUBRG", ("WUBRG")       => 0
"1WWUBB", ("W","WG","U","B","B")  => 0
"10UU", ("WGR","WB","WB","B","B","B","B","B","B","B","B","B") => 0

Im glad there is mtg challenge. +1

Also best to mention that the cost will always have generic mana requirement (the number) in the first position, then followed by colored mana requirements (W/U/B/R/G)

@NikkoKhresna That's been clarified, thanks.

Possible duplicate

@Emigna son of a gun. I guess it's different in the sense that you need to parse out your lands compared to just being given the mana pool.

Can we assume that the generic cost is less than 10 (single decimal digit)?

@nwellnhof I can't answer for the OP, but Magic indeed has cards with generic costs ≥ 10, so I'd not assume that.

@nwellnhof you cannot.

Then I'd suggest to add a test case like "10", ("B","B","B","B","B","B","B","B","B","B") => 1 which breaks at least one of the current answers.

@nwellnhof Donezo

JavaScript (ES6), 91 bytes
Takes input as (cost)(lands):

\$cost\$ is a list of characters in BGRUW order, prefixed with the generic part, even when it's \$0\$
\$lands\$ is a list of strings.

a=>g=([c,...r],n=0,s=e='')=>[...n+s].sort()+e==a|(c&&[e,e,...c].some((c,i)=>g(r,n+!i,s+c)))

Try it online!
Commented
a =>                        // main function taking the array a[] describing the cost
  g = (                     // g = recursive function taking:
    [c, ...r],              //   c = next land string; r[] = remaining land strings
    n = 0,                  //   n = generic mana, initialized to 0
    s = e = ''              //   s = generated cost string, initialized to e = empty string
  ) =>                      //
    [...n + s].sort() + e   // prepend n to s, split, sort and force coercion to a string
    == a | (                // if this is matching a[], the test is successful
      c &&                  // if c is defined:
      [                     //   try the following recursive calls:
        e,                  //     - increment n and append nothing to s
        e,                  //     - do nothing
        ...c                //     - leave n unchanged and append a character to s
      ].some((c, i) =>      //   for each c at position i in the above array:
        g(r, n + !i, s + c) //     process the recursive call
      )                     //   end of some()
    )                       // end of the recursive part

Python 2, 131 129 bytes
lambda (g,c),m:any(all(c[i]in p[i]for i in range(l(c)))for p in permutations(m,l(c)))*(g<=l(m)-l(c))
l=len
from itertools import*

Try it online!

Retina, 60 bytes
\d+
*
~["^("|'|]")*\n"1,L$`(?<=(^|.*¶)+).*
(?($#1)^|([_$&]))

Try it online! Link includes test cases. Explanation:
\d+
*

Convert the generic mana to unary. This uses repeated _s.
1,L`.*

Match all lines after the first, i.e. the list of lands. (This would normally match again at the very end of the input, but the lookbehind prevents that.)
(?<=(^|.*¶)+)

Capture the 1-indexed line number in $#1.
$
(?($#1)^|([_$&]))

Replace each land with a regex that captures costs matching that land or generic costs, but only once.
|'|

Join the resulting regexes with |s.
["^("]")*\n"

Wrap the regex in ^( and )*\n (I can't seem to insert a ¶ here).
~

Count the number of matches of that regex on the current value.
Example: For the case of 1BB¶WB¶WB¶WG the generated regex is:
^((?(2)^|([_WB]))|(?(3)^|([_WB]))|(?(4)^|([_WG])))*\n

which _BB¶WB¶WB¶WG matches as required.

WUBRG, WUBRG should return true?

@NikkoKhresna No, each land may only be used once; you need at least 5 lands to be able to pay for WUBRG.

Oh that refers to 5 color land..okay my bad

Perl 6, 56 46 bytes
{(1 x*~*).comb.Bag⊆any [X] $(1 X~$_)>>.comb}

Try it online!
Curried function. Takes input as (@lands)($generic_cost, $colored_costs) with an explicit 0 for generic cost. The basic idea is to introduce a new symbol 1 representing generic mana and use Perl 6 Bags (multisets) to check whether it's possible to obtain the required mana from lands.
Explanation
{ ... }  # Anonymous block returning WhateverCode
  # Preprocess cost
  1 x*    # '1' for generic mana repeated times generic cost
      ~*  # Concat with colored costs
 (      ).comb  # Split into characters
              .Bag  # Convert to a Bag (multiset)
                             # Preprocess lands
                             1 X~$_   # Prepend '1' to each land
                           $(      )  # Itemize to make 1-element lists work
                                    >>.comb  # Split each into chars
                       [X]  # Cartesian product, yields all possible ways
                            # to select colors from lands
                  # Finally check if the cost Bag is a subset of any possible
                  # color selection (which are implicitly converted to Bags)
                  ⊆any

Jelly, 21 bytes
Œpµ®œ-)Ạ
L<⁴Ṫ©L+Ḣ¤ȯçṆ

Try it online!
Outputs
The input format is what really makes this hard for Jelly. Because Ṫ and Ḣ modify the array, we need to use © and ® in addition. With 3 separate inputs this would be 18 bytes. (Although I'm sure there's 14 or so byte solution waiting to be posted by one of the Jelly masterminds.)

Pyth, 25 bytes
&glQ+hAElH}k.-LHusM*GHQ]k

Try it online!
If Pyth had a "Cartesian product of array" function like Jelly's Œp, this would easily beat my Jelly solution. Currently that is done by usM*GHQ]k.

Haskell, 94 bytes
x#[]=[]
x#(s:t)|x`elem`s=t|0<1=s:x#t
(e,[])?s=length s>=e
(e,x:y)?s|x#s==s=0>1|0<1=(e,y)?(x#s)

Try it online!
We rely on the fact that all colors will be given in the same order in the cost and in the land list. First we tap the lands giving the required colored mana and after that just check that we still have enough lands to pay the colorless cost.


text:
Tips for golfing in Scratch
Scratch is a visual programming language. For the sake of counting bytes, Scratch is usually written in scratchblocks2 syntax.
Post tips that specifically apply to Scratch or scratchblocks2.

A few people might also use the scoring here (in the question post itself), although the two scores definitely don't compete. BTW, Scratch 3.0 will be released in January, but the syntax, AFAICT, isn't going to change much.

Abuse the bool type
In Scratch the true and false values are equivalent to 0 and 1, so you can perform arithmetic operations over them. A practical example would be finding the sign of a number:
define f(n
set[r v]to(<(n)>(0)>-<(n)<(0

Use a Function if Possible
Where possible, if the challenge says functions are allowed, use them! The syntax for defining a function is almost always shorter than the usual when gf clicked.
For example:
define f(n
say((n)+(1

Over:
when gf clicked
ask()and wait
say((answer)+(1

This also means one doesn't have to use the answer variable, which is quite longer than n.

Alternatives to Ternary "if...else" operators
As of the time this answer is posted, Scratch lacks a ternary operator. If we had one, it'd have looked like this:

However, we can use a workaround with this:

In sb syntax (22 bytes):
((x)*<>)+((y)*<not<>>)

Make sure to replace x and y with the values for when the boolean is true and when it's false. The booleans may be empty here, but when using it should have the same conditions.
Besides, this only works when x and y are numbers. Currently this fails with strings. See edit.
This also works because of https://codegolf.stackexchange.com/a/198744/110681
EDIT: you could use our invented ternary operator with a (item()of[ v]) to index a number into the list, depending on the truth value of the boolean.
EDIT: To get single character results, Jacob has commented on his version, which is 20 bytes (replace <> with your boolean):
letter((1)+<>)of[ab]

However, notice that this doesn't work for emojis or Unicode characters, and they will return � if you try using them.

This can be extended to single-character strings: (letter(true)of[ab]) is a. Note that this doesn't work for emojis / unicode characters since they take up multiple chars in Scratch.

Sorry, I meant (letter((1)+<a_boolean>)of[ab]) to get either a or b. I needed to use emojis for this challenge -- see the second part of my Scratch answer. By "single character strings" I meant getting one character from a two-character string, sorry for poor wording.

Brackets auto-complete
In the scratchblocks3 visual syntax (backwards-compatible with scratckblocks2 syntax), you can auto-complete the brackets.
E.g. The hello, world program:
when gf clicked
say[hello, world]

Can be golfed into:
when gf clicked
say[hello, world

In addition, the end statement of switching structures is auto-completed at the end. So instead of
define f(n
set[i v]to(1
set[o v]to(
repeat(length of(n
repeat((2)-((i)mod(2
set[o v]to(join(o)(letter(i)of(n
end
change[i v]by(1

You could do (-4 bytes)
define f(n
set[i v]to(0
set[o v]to(
repeat(length of(n
change[i v]by(1
repeat((2)-((i)mod(2
set[o v]to(join(o)(letter(i)of(n

Output via a variable or list, not say
The previous consensus for output in Scratch was that you had to say the output. However, this doesn't really make sense, since variables are automatically displayed in Scratch if not unchecked in the interface, just as say is automatically displayed if the sprite is not checked as hidden.
Now, per this consensus, it's allowed to just output by writing a global variable, which can in some cases save many bytes.
For example, this (meaningless) code:
repeat(10
change[i v]by(1
if<(i)>5>then
set[a v]to((i)*(2
end
end
say(a

Can become just:
repeat(10
change[i v]by(1
if<(i)>5>then
set[a v]to((i)*(2


text:
Tips for golfing in Dart
Dart is an object oriented programming language borrowing from both Java and Javascript. What general tips do you have for golfing in Dart? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Dart (e.g. "remove comments" is not an answer). Please post one tip per answer.
If a tip is similar to Java/JS, please link to the answer in the original language's thread as well if you can.
Taken mostly from Joey's Tips for Powershell

Variable declaration
Regular variable declaration takes 4 bytes (var) + 2 bytes/variable (i,).
You can declare variables as optional named parameters for your function and shave a few bytes.
f(){var i,j,k;} //Takes 15 bytes
g({i,j,k}){}  //Takes 12 bytes

Note: This doesn't work for non-constant values, for example:
f({i=List}){}  //Works
g({i=[]}){}  //Doesn't work

f({i=0,j=0}){}  //Works
g({i=0,j=i}){}  //Doesn't work

Implicit parameter passing
In some cases where Dart expects a function to be declared, you can code the function elsewhere, and then just pass its name. Dart will take care of passing the value automatically. Let me illustrate :
[0,1,2,3,4,5].forEach((i) => print(i)); //Using a lambda
[0,1,2,3,4,5].forEach(print); //Using implicit parameter passing since print() expects a similar parameter

You can also use your own functions
f(List i){
    i.forEach(print); //Prints each number on a new line
}

[[0,1], [1,2]].forEach(f); //Prints 0 \n 1 \n 1 \n 2\n

If you know a lambda might be used in multiple places, for example a map(), it can be useful to make it its own function and pass it that way instead of declaring it multiple times.

Is this not just a consequence of first-class functions? (I don't know Dart)

Looks like it's the case. I didn't know this was more widely spread https://www.dartlang.org/guides/language/language-tour#functions-as-first-class-objects

String conversion and concatenation
Dart doesn't allow for concatenation for types other than String and doesn't implicitly convert to String like C# does for example.
It however includes a very useful way to concatenate variables without needing to use any addition operator or explicitly casting to String (using the .toString() method).
var i=0,j=1,k=2;
var s0='$j'; //'1'
var s1='$i$j$k'; //'012'
var s2='i=$i'; //'i=0'

You can also perform operations directly in the ${} section and save a few temporary variable declarations.
var i=0,j=1,k=2;
var s='${i+j+k}'; //'3'

Creating range of consecutive integers
If you want to create a list of integers from start and end values, you can use below options:
final int s = 0; // start value
final int e = 5; // end value

List.generate(e-s,(i)=>i+s);  // 28 bytes
List.generate(e,(i)=>i);      // 24 bytes, if start is guaranteed to be zero
[for(int i=s;i<e;i++)i];      // 24 bytes
[for(int i=s;i<e;]i++];       // 23 bytes
[for(int i=s;i<e;]++i];       // 23 bytes, if start is exclusive
[for(;s<e;)s++];              // 16 bytes, if start can be changed in-place

Return inside loops
Let's suppose in your code there is a return inside a loop. You can use the following idiom to reduce bytes:
// indexOf method
f(v,x,[i=0]){for(;i<v.length;i++)if(v[i]==x)return i;return-1;}   // 63 bytes
f(v,x)=>([i=0]){for(;i<v.length;i++)if(v[i]==x)return i;}()??-1;  // 64 bytes
f(v,x)=>(i){for(;i<v.length;i++)if(v[i]==x)return i;}(0)??-1;     // 61 bytes

The more variables to be initialized, the more bytes can be reduced.
// "index of integral"
g(v,x,[s=0,i=0]){for(;i<v.length;i++){s+=v[i];if(s>=x)return i;}return-1};  // 74 bytes
g(v,x)=>(s,i){for(;i<v.length;i++){s+=v[i];if(s>=x)return i;}(0,0)??-1;     // 71 bytes


text:
Through Space and Time
Introduction:
In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future.
Input:
Two input-lists. One containing integer x,y,z coordinates, and one containing integer years.
Output:
One of any four distinct and constant outputs of your own choice. One to indicate the output space; one to indicate the output time; one to indicate the output both space and time; and one to indicate the output neither space nor time.
We'll indicate we went to all three space dimensions if the differences of the integer-tuples is not 0 for all three dimensions.
We'll indicate we went to all three time dimensions if there is at least one year in the past, at least one year in the future, and at least one year equal to the current year (so in the present).
Example:
Input:
Coordinates-list: [{5,7,2}, {5,3,8}, {-6,3,8}, {5,7,2}]
Year-list: [2039, 2019, 2018, 2039, 2222]
Output:
Constant for space
Why?
The x coordinates are [5,5,-6,5]. Since they are not all the same, we've went through the x space dimension.
The y coordinates are [7,3,3,7]. Since they are not all the same, we've also went through the y space dimension.
The z coordinates are [2,8,8,2]. Since they are not all the same, we've also went through the z space dimension.
The current year is 2018. There are no years before this, so we did not visit the past time dimension.
There is a 2018 present in the year-list, so we did visit the present time dimension.
There are multiple years above 2018 ([2039, 2019, 2039, 2222]), so we also visited the future time dimension.
Since we've visited all three space dimensions, but only two of the three time dimensions, the output will only be (the constant for) space.
Challenge rules:

You can use any four distinct and constant outputs for the four possible states.
Input can be in any reasonable format. Coordinates list can be tuples, inner lists/arrays of size 3, strings, objects, etc. List of years may be a list of date-objects instead of integers as well if it would benefit your byte-count.
You can assume the x,y,z coordinates will be integers, so no need to handle floating point decimals. Any of the x, y, and/or z coordinates can be negative values, though.
You cannot take the input-lists pre-ordered. The input-lists should be in the order displayed in the test cases.
You can assume all year values will be in the range [0,9999]; and you can assume all coordinates are in the range [-9999,9999].
If your language doesn't have ANY way to retrieve the current year, but you'd still like to do this challenge, you may take it as additional input and mark your answer as (non-competing).

General rules:

This is code-golf, so shortest answer in bytes wins.
Don't let code-golf languages discourage you from posting answers with non-codegolfing languages. Try to come up with an as short as possible answer for 'any' programming language.
Standard rules apply for your answer with default I/O rules, so you are allowed to use STDIN/STDOUT, functions/method with the proper parameters and return-type, full programs. Your call.
Default Loopholes are forbidden.
If possible, please add a link with a test for your code (i.e. TIO).
Also, adding an explanation for your answer is highly recommended.

Test cases:
Coordinates-input: [{5,7,2}, {5,3,8}, {-6,3,8}, {5,7,2}]
Years-input:       [2039, 2019, 2018, 2039, 2222]
Output:            space

Coordinates-input: [{0,0,0}, {-4,-4,0}, {-4,2,0}]
Years-input:       [2016, 2019, 2018, 2000]
Output:            time

Coordinates-input: [{-2,-2,-2}, {-3,-3,-3}]
Years-input:       [2020, 1991, 2014, 2018]
Output:            both

Coordinates-input: [{5,4,2}, {3,4,0}, {1,4,2}, {9,4,4}]
Years-input:       [2020, 1991, 2014, 2017, 2019, 1850]
Output:            neither

What range of years do we need to be able to handle?

@Shaggy I will add it to the challenge description. [0,9999] is fine (and [-9999,9999] for the coordinates is fine as well.

Dang, there goes one of my ideas!

@Shaggy Out of curiosity, what range were you hoping for?

One where no year was divisible by any other, that's how I was testing for the presence of the current year.

May we take the current year as input? (Some languages cannot get the current year e.g.BF, others can only do so by evaluating code in another language - e.g. Jelly; others, maybe many, will find this golfier too)

@JonathanAllan I was indeed doubting about this myself. The only problem is that almost any language will have a byte reduction by using a third input for current year, so that part of the challenge is then gone. I'll edit the challenge description stating you can take the current year as input, but mark it as non-competing.

The part of the challenge that is gone is probably not the most interesting part of the challenge.  We have plenty of challenges that require fetching the date already.  I don't think it will be treading any new ground.

What's the current year range?

@l4m2 The current year isn't an additional parameter. It's, well.., the current year (2018 right now). If you're asking what range the list of years can be in, it's mentioned in the rules: [0,9999]

@KevinCruijssen If your language doesn't have ANY way to retrieve the current year, but you'd still like to do this challenge, you may take it as additional input and mark your answer as (non-competing). implies that the program shouldn't only work this realyear

@l4m2 Ok, in that case the current year can be >= 2018.

05AB1E, 15 bytes
Output is a list [space, time] where 1 stands for x and 0 stands for no x
ø€Ë_Psžg.SÙg3Q)

Try it online!
Explanation
    ø                 # zip space coordinates
     €Ë               # for each axis, check that all values are equal
       _              # logical negation
        P             # product (1 for space, 0 for no space)
         s            # put the time list on top of the stack
          žg.S        # compare each with the current year
              Ù       # remove duplicates
               g3Q    # check if the length is 3
                  )   # wrap the space and time values in a list

Obvious +1 from me. The same as the 16-byter I prepared, except that I used -.± instead of .S (hence the +1 byte..) and ‚ (pair) instead of )

@KevinCruijssen: I really want another way to do Ùg3Q, which feels like the largest byte-thief, but I'm not sure it's possible :/

I doubt it can be done shorter tbh. I can think of a few 4-byte alternatives, and been trying to do something with ê and some bitwise operation or deltas or something, but I'm unable to find any 3-byte alternatives.

Perl 6, 47 46 bytes
-1 byte thanks to nwellnhof
{Set(@^b X<=>Date.today.year)>2,max [Z==] @^a}

Try it online!
Anonymous code block that takes two lists and returns a tuple of booleans, with the first element being whether you traveled in time, and the second being whether you didn't traveled in space.
Explanation
{                                            }  # Anonymous code block
     @^b X         # Map each element of the year list to:
          <=>      # Whether it is smaller, equal or larger than
             Date.today.year  # The current year
 Set(                       )    # Get the unique values
                             >2  # Is the length larger than 2?
                               ,
                                    [Z  ] @^a   # Reduce by zipping the lists together
                                max       # And return if any of them are
                                      ==  # All equal

Python 2, 111 109 bytes
lambda S,T:(min(map(len,map(set,zip(*S))))>1,date.today().year in sorted(set(T))[1:-1])
from datetime import*

Try it online!

Why do you make T a set before sorting?

@BlackOwlKai Otherwise the two entries removed by [1:-1] may not be in the past / future

Japt, 22 bytes
Takes input as a 2D-array of integers for the space dimensions and a 1D-array of integers for the years. Outputs 2 for space only, 1 for time only, 3 for both and 0 for neither.
yâ mÊeÉ Ñ+!Jõ kVmgKi¹Ê

Try it
                           :Implicit input of 2D-array U=space and array V=time
y                          :Transpose U
 â                         :Deduplicate columns
   m                       :Map
    Ê                      :  Lengths
     e                     :All truthy (not 0) when
      É                    :  1 is subtracted
        Ñ                  :Multiply by 2
           J               :-1
            õ              :Range [-1,1]
              k            :Remove all the elements present in
               Vm          :  Map V
                 g         :    Signs of difference with
                  Ki       :    The current year
                    ¹      :End removal
                     Ê     :Length
         +!                :Negate and add first result

Japt, 25 bytes
I'm 100% sure this is not the best approach, still looking for some shorter way to do this :c
Returns a tuple of booleans. The first is if you traveled in space and the second if you traveled in time
[Uyâ e_Ê¦1ÃV®-Ki)gÃâ Ê¥3]

[Uyâ e_Ê¦1ÃV®-Ki)gÃâ Ê¥3]   Full Program, U = Space, V = Time
                            -- U = [[-2,-2,-2], [-3,-3,-3]]
                            -- V = [2020, 1991, 2014, 2018]
[                       ]   Return array containing....
 Uyâ                        Transpose Space coords
                            -- U = [[-2,-3], [-2,-3], [-2,-3]]
                            and map Z
      _Ê¦1                  Z length greater than 1?
                            -- U = [true, true, true]
     e                      return true if all Z are true
                            -- U = true
          V®                Map each time
            -Ki)            Subtract current year
                            -- V = [2,-27,-4,0]
                gÃ          get sign (-1,0,1)
                            -- V = [1,-1,-1,0]
                   â        unique elements
                            -- V = [1,-1,0]
                     Ê¥3    return true if length == 3
                            -- V = true

Try it online!

Uhm, I think this fails on the testcase you've provided in the link? (yâ transposes, takes unique items, and transposes back, so you'll probably want to do Uy e_â Ê¦1Ã instead)

Only seeing this now, looks like you might have posted it before mine (on my phone so can't tell properly). If so, let me know if you want mine given the similarities and I'll delete it.

@ETHproductions, it does seem to work. I had â within the e method on my first try, too, before moving it to y on a whim to see if it'd work.

@Shaggy Well I'll be darned, it does actually work... but why doesn't it transpose back in this case?

@ETHproductions, I've noticed that there are some auto-functions it doesn't transpose back after.

@Shaggy Oh dear, the code that checks whether to tranpose it back checks if for every q in the mapped transposed array, typeof q instanceof Array... what a convenient bug :P Guess I can't fix it now until releasing 1.4.6...

@ETHproductions, yeah, it'd probably break more than a few of my solutions! :D

Lol, @Shaggy Keep yours =D yours is better anyway xD

JavaScript (ES6), 104 100 bytes
Takes input as (space)(time). Returns \$1\$ for time, \$2\$ for space, \$3\$ for both or \$0\$ for neither.
24% of the code is spent figuring out in which year we are ... \o/
s=>t=>2*s[0].every((x,i)=>s.some(b=>x-b[i]))|t.some(y=>(s|=(y/=(new Date).getFullYear())>1?4:y+1)>6)

Try it online!
Commented
s => t =>              // s[] = space array; t[] = time array
  2 *                  // the space flag will be doubled
  s[0].every((x, i) => // for each coordinate x at position i in the first entry of s[]:
    s.some(b =>        //   for each entry b in s[]:
      x - b[i]         //     if we've found b such that b[i] != x, the coordinate is valid
    )                  //   end of some()
  )                    // end of every()
  |                    // bitwise OR with the time flag
  t.some(y =>          // for each year y in t[]:
    (s |=              //   update the bitmask s (initially an array, coerced to 0)
      ( y /=           //     divide y
        (new Date)     //     by the current year (this is safe as long as no time-travel
        .getFullYear() //     machine is available to run this it at year 0)
      ) > 1 ?          //   if the result is greater than 1:
        4              //     do s |= 4 (future)
      :                //   else:
        y + 1          //     do s |= y + 1; y + 1 = 2 if both years were equal (present)
                       //     otherwise: y + 1 is in [1, 2), which is rounded to 1 (past)
    ) > 6              //   set the time flag if s = 7
  )                    // end of some()

Fail on console.log(f([[5,4,2], [3,4,0], [1,4,2], [9,4,4]])([2020]))  // neither

@l4m2 Hmm. Fixed at the cost of 1 byte. I can't think of a 99-byte solution off the top of my head.

R, 106, 105 bytes
function(s,t)all((x<-apply(s,1,range))[1,]-x[2,])-2*all((-1:1)%in%sign(as.POSIXlt(Sys.Date())$ye+1900-t))

Try it online!
Input :
s : matrix of space coordinates (3 x N)
t : vector time years

Output an integer value equal to :
 1 : if traveled through space only
-2 : if traveled through time only
-1 : if traveled through space and time
 0 : if traveled neither through space nor time

Batch, 353 bytes
@echo off
set/as=t=0,y=%date:~-4%
for %%a in (%*) do call:c %~1 %%~a
if %s%==7 (if %t%==7 (echo both)else echo space)else if %t%==7 (echo time)else echo neither
exit/b
:c
if "%6"=="" goto g
if %1 neq %4 set/as^|=1
if %2 neq %5 set/as^|=2
if %3 neq %6 set/as^|=4
exit/b
:g
if %4 lss %y% (set/at^|=1)else if %4==%y% (set/at^|=2)else set/at^|=4

Note: Since commas are argument separators in Batch, in order to input the space coordinates you need to quote then e.g.
spacetime "5,7,2" "5,3,8" "-6,3,8" "5,7,2" 2000 2002

Explantion:
@echo off

Turn off unwanted output.
set/as=t=0,y=%date:~-4%

Set up two bitmasks and also extract the current year. (In YYYY-MM-DD locales use %date:~,4% for the same byte count.)
for %%a in (%*) do call:c %~1 %%~a

Loop over all the arguments. The ~ causes coordinate values to be split into separate parameters.
if %s%==7 (if %t%==7 (echo both)else echo space)else if %t%==7 (echo time)else echo neither
exit/b

Check whether the bitmasks are fully set and output the appropriate result.
:c
if "%6"=="" goto g

See whether this is a pair of coordinates or a coordinate and a year.
if %1 neq %4 set/as^|=1
if %2 neq %5 set/as^|=2
if %3 neq %6 set/as^|=4
exit/b

If it's a coordinate then update the space bitmask according to whether the relevant spacial dimension was visited.
:g
if %4 lss %y% (set/at^|=1)else if %4==%y% (set/at^|=2)else set/at^|=4

If it's a year then update the time bitmask according to whether the relevant time dimension was visited.

Java 10, 154 bytes
s->t->{int y=java.time.Year.now().getValue(),c=0,d=1,i=3;for(;i-->0;d*=c,c=0)for(var l:s)c=l[i]!=s[0][i]?1:c;for(int a:t)c|=a>y?4:a<y?1:2;return c/7*2+d;}

Returns 1 for space, 2 for time, 3 for both, 0 for neither. Try it online here.
Ungolfed:
s -> t -> { // lambda taking two parameters in currying syntax
            // s is int[][], t is int[]; return type is int

    int y = java.time.Year.now().getValue(), // the current year
        c = 0, // auxiliary variable used for determining both space and time
        d = 1, // initally, assume we have moved in all three space dimensions
        i = 3; // for iterating over the three space dimensions

    for(; i -- > 0; d *= c, c = 0) // check all coordinates for each dimension, if we have not moved in one of them, d will be 0
        for(var l : s) // check the whole list:
            c = l[i] != s[0][i] ? 1 : c; // if one coordinate differs from the first, we have moved

    for(int a : t) // look at all the years; c is 0 again after the last loop
        c |= a > y ? 4 : a < y ? 1 : 2; // compare to the current year, setting a different bit respectively for past, present and future

    return c / 7 // if we have been to past, the present and the future ...
           * 2   // ... return 2 ...
           + d;  // ... combined with the space result, otherwise return just the space result
}


text:
Draw this diamond pattern
The below pattern will form the basis of this challenge.
     /\
     \/
     /\
    /  \
   /    \
/\/      \/\
\/\      /\/
   \    /
    \  /
     \/
     /\
     \/

Given an input width and height, each >=1, output the above ASCII art pattern repeated that many times, joining (and overlapping) at the small diamonds.
For example, here is an input with width = 2 and height = 1:
     /\        /\
     \/        \/
     /\        /\
    /  \      /  \
   /    \    /    \
/\/      \/\/      \/\
\/\      /\/\      /\/
   \    /    \    /
    \  /      \  /
     \/        \/
     /\        /\
     \/        \/

Here is an input width = 3 and height = 2:
     /\        /\        /\
     \/        \/        \/
     /\        /\        /\
    /  \      /  \      /  \
   /    \    /    \    /    \
/\/      \/\/      \/\/      \/\
\/\      /\/\      /\/\      /\/
   \    /    \    /    \    /
    \  /      \  /      \  /
     \/        \/        \/
     /\        /\        /\
     \/        \/        \/
     /\        /\        /\
    /  \      /  \      /  \
   /    \    /    \    /    \
/\/      \/\/      \/\/      \/\
\/\      /\/\      /\/\      /\/
   \    /    \    /    \    /
    \  /      \  /      \  /
     \/        \/        \/
     /\        /\        /\
     \/        \/        \/

Rules and I/O

Input and output can be given by any convenient method.
You can print it to STDOUT or return it as a function result.
Either a full program or a function are acceptable.
Any amount of extraneous whitespace is acceptable, so long as the characters line up appropriately.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Loosely related

Canvas, 26 25 24 21 18 bytes
４／╬/╬⁰ｒ：⤢ｎ↷⁸｛Ａ×├ｍ↷

Try it here!
-3 bytes by fixing ｍ not repeating canvas
Explanation:
4/╬                 quad-palindromize a 4-long diagonal - big inner diamond
   /╬               quad-palindromize "/" - small diamond
     ⁰r             join the two vertically, centered
       :⤢n          overlap with transpose
           ↷        and rotate the thing clockwise
            ⁸{      for each input
              A×      times 10
                ├     plus 2
                 m    mold the canvas to that width
                  ↷   and rotate clockwise, setting up for the next iteration

wow O_o canvas is too short

JavaScript (ES8), 167 161 159 bytes
NB: This is encoding the pattern. See my other answer for a shorter mathematical approach.
Takes input as (width)(height).
w=>h=>(g=h=>h?g(--h)+`
`+([4106,4016,31305,21504,17010]['0102344320'[h%=10]]+'').replace(/./g,c=>'\\/'[c^h>5]||''.padEnd(c-1)).repeat(w+1).slice(8):'')(h*10+2)

Try it online!
How?
We encode the upper half of the pattern with digits:

\$0\$ means \
\$1\$ means /
\$n=2\$ to \$7\$ means \$n-1\$ spaces

This gives:
0  ···/\·····  -->  [3 spaces] [/] [\] [5 spaces]             -->  4106
1  ···\/·····  -->  [3 spaces] [\] [/] [5 spaces]             -->  4016
0  ···/\·····  -->  [3 spaces] [/] [\] [5 spaces]             -->  4106
2  ··/··\····  -->  [2 spaces] [/] [2 spaces] [\] [4 spaces]  -->  31305
3  ·/····\···  -->  [1 space] [/] [4 spaces] [\] [3 spaces]   -->  21504
4  /······\/\  -->  [/] [6 spaces] [\] [/] [\]                -->  17010

For the lower half, we use the rows \$4,3,2,0\$ with / and \ inverted.

JavaScript (ES6), 139 bytes
This is using quite a different approach from my initial answer, so I'm posting this separately.
Takes input as (width)(height).
w=>h=>(g=x=>y>8?` /\\
`[a=(x+y*9)%10,d=(x+y)%10,x?(y%10>3&&2*(a==8)|d==5)|(y%10<6&&2*(a==6)|d==7):3]+g(x--?x:--y&&w):'')(w=w*10+2,y=-~h*10)

Try it online!
How?
Given the width \$w\$ and the height \$h\$, we draw the output character by character over a grid which is:

\$10w+3\$ characters wide
\$10h+2\$ characters high

with \$x\$ going from \$10w+2\$ to \$0\$ (left to right) and \$y\$ going from \$10h+10\$ to \$9\$ (top to bottom).
Example for \$w=3\$ and \$h=2\$:
$$\begin{matrix}(32,30)&(31,30)&\dots&(0,30)\\
(32,29)&(31,29)&&(0,29)\\
\vdots&&\ddots&\vdots\\
(32,9)&(31,9)&\dots&(0,9)\end{matrix}$$
The rightmost cells (at \$x=0\$) are simply filled with linefeeds.
For all other cells, we compute:

\$a=(x-y)\bmod 10\$ (constant over anti-diagonals)
\$d=(x+y)\bmod 10\$ (constant over diagonals)

We draw a "/" if:
$$((y\bmod 10)>3\text{ and }d=5)\text{ or }((y\bmod 10)<6\text{ and }d=7)$$
 y  | y % 10 | output (w = 3, h = 1)
----+--------+----------------------------------
 20 |    0   | ...../........./........./......
 19 |    9   | ....../........./........./.....
 18 |    8   | ...../........./........./......
 17 |    7   | ..../........./........./.......
 16 |    6   | .../........./........./........
 15 |    5   | /./......././......././......./.
 14 |    4   | ./......././......././......././
 13 |    3   | ......../........./........./...
 12 |    2   | ......./........./........./....
 11 |    1   | ....../........./........./.....
 10 |    0   | ...../........./........./......
  9 |    9   | ....../........./........./.....

We draw a "\" if:
$$((y\bmod 10)>3\text{ and }a=8)\text{ or }((y\bmod 10)<6\text{ and }a=6)$$
 y  | y % 10 | output (w = 3, h = 1)
----+--------+----------------------------------
 20 |    0   | ......\.........\.........\.....
 19 |    9   | .....\.........\.........\......
 18 |    8   | ......\.........\.........\.....
 17 |    7   | .......\.........\.........\....
 16 |    6   | ........\.........\.........\...
 15 |    5   | .\.......\.\.......\.\.......\.\
 14 |    4   | \.\.......\.\.......\.\.......\.
 13 |    3   | ...\.........\.........\........
 12 |    2   | ....\.........\.........\.......
 11 |    1   | .....\.........\.........\......
 10 |    0   | ......\.........\.........\.....
  9 |    9   | .....\.........\.........\......

Or we draw a space if none of these conditions is fulfilled.

This is really cool.

111 using the C++ answer?

@Arnauld I knew this was your answer by just looking at the code :D

C++ (gcc), 137 bytes
#include<cstdio>
auto p(int x,int y){int n=10,t=x=++x*n;for(++y*=n;y>8;)t>7?putchar(t<9?y--,n:t%n-y%n+4&7?t%n+y%n-5&7?32:47:92),t--:t=x;}

Try it online!
Explanation
_______________________________
   098765432109876....
   9    \/    .     factor =y%10 - x10
   8    /\    .     if factor = -4 || 4. Print --> '\'  47
   7   /  \   .
   6  /    \  .     factor =x%10+y%10;
   5\/      \/*-.   if factor = 5 || 13 --> /  92
   4/\      /\   `.
   3  \    /       `->  * is 9,5 => \
   2   \  /
   1    \/
   0    /\
   9

Invalid, not a full program nor a function

But, 10/10 a very nice method

Sorry I was confused because some of the other answer are not full program too. I repair it!

Which answers exactly aren't full programs or functions? (just asking, may have missed it) Note that some languages (e.g. scripting languages) don't need boilerplate for full programs

I think you need to include the #include

159, but not sure if outputting from a function is valid (it probably is)

181, program

Since I see snippets on header and footer sections in most codes I thought I could put #include  using namespace std ; in header and the main function with a call to my function in the footer. Every c++ program has this surrounding structure. The function takes 2 arguments and do the job. I don't see any reason to penalize c++

@AZTECCO First of all, welcome to PPCG. You may be interested in our current consensus regarding valid submissions; instead of writing a full program you are allowed to only write a function, however not a snippet (being a very untethered piece of code). Furthermore, I would also be interested in seeing non-complying answers, as ASCII-only stated above.

@Jonathan Frech I'm confused, why my function is considered a snippet? Do I have to declare it as std::string funcName(int x... instead of a closure? Do I have to include iostream? My function takes the two arguments and return the solution, i checked the I/O rules and it seems it's fine to do so..

Edited using Tio, I hope it's alright now. A special thanks to downvoters, very helpful for newcomers.. Good job! And true thanks for who helped

@AZTECCO Sorry for any confusion. The way it is right now is perfectly fine, an anonymous lambda function would -- I think -- also be valid.

As a bit-fiddling golfing trick: (y%n-t%n+4)%8 can most likely be y%n-t%n+4&7.

Thaks for your help @Jonathan Frech! I think there's no big difference in bytes between lambda and normal function. And thanks for the trick!

173 - you don't use cout in your function so you only really need <string> for std::string

155

Edited thanks to @ASCII-only and Jonathan Frech help.

@AZTECCO wait, if you use cout in your functionm, you need to include the #include in the bytecount

Saved some bytes thanks to @ceilingcat good tip use c style, plus with one more ternary I left one loop.

Haskell, 179 bytes
k '\\'='/'
k '/'='\\'
k x=x
f x=take(10*x+2)
w#h=map(f w.cycle).f h.drop 9.cycle$(++).reverse=<<map(map k)$["\\/\\      /","   \\    / ","    \\  /  ","     \\/   ","     /\\   "]

Try it online!

Haskell, 181 bytes
k '\\'='/'
k '/'='\\'
k x=x
f x=take(10*x+2)
w#h=map(f w.cycle).f h.drop 9.cycle$(++).reverse=<<map(map k)$map t[49200,36058,31630,30010,29038]
t 0=""
t n="\\ /"!!mod n 3:t(div n 3)

Try it online!

Using reverse.map(map k)<>id over (++).reverse=<<map(map k) saves you 3 bytes in both solutions.

Ah, and in the 2nd one map t can become t<$> and take$10*x+2 saves another byte too and finally you can use cycle"\\ /"!!n over "\\ /"!!mod n 3 - now the second one is shorter :)  Try it online!

Charcoal, 24 22 20 bytes
\/↘²‖Ｍ↘LＦ⊖ＮＣχ⁰Ｆ⊖ＮＣ⁰χ

Try it online! Link is to verbose version of code. Explanation:
´\/↘²

Draw one eighth of the original pattern.
‖Ｍ↘L

Duplicate it three times to complete the original pattern.
Ｆ⊖ＮＣχ⁰

Copy the required number of times horizontally.
Ｆ⊖ＮＣ⁰χ

Copy the required number of times vertically.

Powershell, 146 bytes
param($w,$h)0..9*$h+0,1|%{$y=$_
-join(0..9*$w+0,1|%{('3  /\33  \/33  /\33 /  \3  /3 \ /\/33\\/\33/3\3 /3  \  /33 \/3'-replace3,'   ')[$y*10+$_]})}

Explanation
The pattern is 10x10 chars array:
     /\
     \/
     /\
    /  \
   /    \
/\/      \
\/\      /
   \    /
    \  /
     \/

The script:

repeats the pattern;
appends columns [0,1] to the end of each line;
appends lines [0,1] to the end of the output.

Two things for golf:

The pattern array mapped to string with length 100 bytes;
The string reduced by simple replace.

Perl 5 -p, 148 bytes
$_='3A3'x$_.$/.'3B3
3A3
2/2\\2
1/4\\1
A6A
B6B
1\\4/1
2\\2/2
3B3
3A3
'=~s/^.*$/$&x$_/mger x<>.'3B3'x$_;s|A+|/\\|g;s|B+|\\/|g;s/\d/$"x$&/ge;s|^ |  |gm

Try it online!

PHP, 159 bytes
pattern taken from mazzy; translated to 1-2-3, converted to base26 -> decoded by the program
while($y<$argv[2]*10+2)echo str_pad("",$argv[1]*10+2,strtr(base_convert([jng1,jnnb,jng1,jofn,k333,"1h4p5",23814,k94d,k02h,jnnb][$y++%10],26,4),312,"\ /")),"
";

requires PHP 5.5 or later. Run with -nr or try it online.
calculating may be shorter (as it was for Arnauld). I may look into that.

Kotlin, 196 135 bytes
Saved 61 bytes thanks to ASCII-only's suggestion to use AZTECCO's C++ algorithm.
{h,w->var r=""
for(l in 9..h*10+10){for(c in 9..w*10+10){r+=when{(l%10+c%10)%8==5->'/'
(l%10-c%10+8)%8==4->'\\'
else->' '}}
r+='\n'}
r}

Try it online!

136, stealing from the new C++ answer

Python 3, 194 192 187 127 bytes
@ASCII-only's solution:
lambda w,h,n=10:"\n".join("".join([" /","\\"][(j%n-i%n)%8==4][(j%n+i%n)%8==5]for i in range(-1,w*n+1))for j in range(-1,h*n+1))

Try it online!

Original Solution
n="\n"
def f(w,h):a=[r"     /\   "*w,r"     \/   "*w,r"    \  /  "*w,r"   \    / "*w,r"\/\      /"*w+r"\/"];return a[0]+n+n.join(([i.translate({47:92,92:47})for i in a]+a[::-1])*h)+n+a[1]

Try it online!
-2 bytes thanks to @Black Owl Kai showing that the tops and bottoms can be accessed from the generated array instead of in separate variables.
-5 more bytes thanks to @Black Owl Kai using a more creative way to store the diamonds
Generates this portion of each diamond:
     /\
     \/
    \  /
   \    /
\/\      /\/

A /\ added at the end of each row to complete it. Then, the /s and \s are swapped to form the top of each diamond, and the order of the lines is reversed to form the bottom half. Finally, it adds in the very top row of /\s and the very bottom row of \/s to complete the image.

192 bytes by not using the variables b and c

187 bytes by removing two +=/*= assignments and flipping the whole diamond upside-down, making the last string easier to store

181

147, uses c++ solution

127


text:
Dina's Paintings
Dina loves most numbers. In fact, she loves every number that is not a multiple of n (she really hates the number n). For her friends’ birthdays this year, Dina has decided to draw each of them a sequence of n−1 flowers. Each of the flowers will contain between 1 and n−1 flower petals (inclusive). Because of her hatred of multiples of n, the total number of petals in any non-empty contiguous subsequence of flowers cannot be a multiple of n. For example, if n=5, then the top two paintings are valid, while the bottom painting is not valid since the second, third and fourth flowers have a total of 10 petals. (The top two images are Sample Input 3 and 4.)
Dina wants her paintings to be unique, so no two paintings will have the same sequence of flowers. To keep track of this, Dina recorded each painting as a sequence of n−1 numbers specifying the number of petals in each flower from left to right. She has written down all valid sequences of length n−1 in lexicographical order. A sequence a1,a2,…,a(n−1) is lexicographically smaller than b1,b2,…,bn−1 if there exists an index k such that ai=bi for i < k and ak < bk.
What is the kth sequence on Dina’s list?
Input
The input consists of a single line containing two integers n (2≤n≤1000), which is Dina’s hated number, and k (1≤k≤1018), which is the index of the valid sequence in question if all valid sequences were ordered lexicographically. It is guaranteed that there exist at least k valid sequences for this value of n.
Output
Display the kth sequence on Dina’s list.
Sample Input 1
4 3
Sample Output 1
2 1 2

Sample Input 2
2 1
Sample Output 2
1

Sample Input 3
5 22
Sample Output 3
4 3 4 2

Sample Input 4
5 16
Sample Output 4
3 3 3 3

Welcome to PPCG. Nice first question.

Did you write this question or is it from another source?

Haskell, 87 bytes
n#k=[d|d<-mapM id$[1..n]<$[2..n],all(\x->mod x n>0)$p d]!!k
p(x:y)=scanl(+)x<>p$y
p x=x

Uses 0-based indexing. Needs the latest version of Prelude which is not installed on TIO, hence an additional import.
Try it online!
   d|d<-mapM id$[1..n]<$[2..n]    -- keep all 'd' from the lists of numbers [1..n] of
                                  -- length n-1
     , all(\x->      )            -- where all elements 'x' from
                       p d        -- the sums of the subsequences of 'd'
               mod x n>0          -- are not a multiple of n
 [                           ]!!k -- pick the 'k'th element

p(x:y)=scanl(+)x<>p$y             -- the sums of subsequences are calculated by
                                  -- prepending the cumulative sums of the list to
                                  -- a recursive call with the tail of the list
p x=x                             -- base case for recursion: empty list

Jelly, 12 bytes
’ṗ`Ẇ§%ẠʋƇ⁸ị@

A dyadic Link accepting n on the left and k on the right.
Try it online! (no way this will work for large n, but would in theory)
How?
’ṗ`Ẇ§%ẠʋƇ⁸ị@ - Link: integer n, integer k
’            - decrement n -> n-1
  `          - use for both arguments of:
 ṗ           -   Cartesian power (all (n-1)^2 flower sequences - lex order)
         ⁸   - chain's left argument, n (as right argument for...)
        Ƈ    - filter keep those (sequences) which are truthy under:
       ʋ     -   last four links as a dyad (f(sequence, n)):
   Ẇ         -     all ((n-1)n/2) contiguous sublists (of the sequence)
    §        -     sum each
     %       -     modulo (n)
      Ạ      -     all? (all non-zero?)
           @ - with swapped arguments (i.e. f(k, listOfValidSequences)
          ị  -   index into (1-based)

Perl 6, 74 68 bytes
{([X] (1..^$^a)xx$a-1).grep(!*[^*X.. ^*].grep:{$_&.sum%%$a})[$^b-1]}

Try it online!
Anonymous code block that returns a list of numbers, or an integer in the case of \$n=2\$.
Explanation:
{([X] (1..^$^a)xx$a-1).grep(!*[^*X.. ^*].grep:{$_&.sum%%$a})[$^b-1]}
{                                                                  }  # Anonymous code block
 ([X] (1..^$^a)xx$a-1)  # From all n length sequences of 1 to n-1
                      .grep(                               )   # Filter by
                            !           .grep:{          }  # None of
                             *[^*X.. ^*]    # All partitions (including empty lists)
                                               $_    # Are non-empty
                                                 &.sum%%$a  # And the sum is divisible by n
                                                            [$^b-1]  # Get the kth index of the list

Charcoal, 35 bytes
ＮθＩ↨§Φ…Ｘθ⁻θ²Ｘθ⊖θ¬ΦθΦλ¬﹪Σ✂↨ιθνλ¹θ⊖ηθ

Try it online! Link is to verbose version of code. Works by taking the range \$ n^{n-2} \ldots n^{n-1}-1 \$ in base \$ n \$ and filtering out illegal sequences (including ones with zero digits). Explanation:
Ｎ                                   Input `n` as a number
 θ                                  Save in variable
        θ                           `n`
       Ｘ                            To the power
          θ                         `n`
         ⁻                          Minus
           ²                        2
      …                             Ranged up to
             θ                      `n`
            Ｘ                       To the power
               θ                    `n`
              ⊖                     Decremented
     Φ                              Filtered `i` by
                ¬                   Not
                  θ                 Implicit range `0` .. `n-1`
                 Φ                  Filtered `l` by
                    λ               Implicit range `0` .. `l`
                   Φ                Filtered `m` by
                     ¬              Not
                       Σ            Sum
                          ι         `i`
                         ↨          Converted to base
                           θ        `q`
                        ✂           Sliced
                            ν       From `m`
                             λ      To `l`
                              ¹     Step 1
                      ﹪             Modulo
                               θ    `n`
    §                               Indexed by
                                 η  Second input `k`
                                ⊖   Decremented
   ↨                                Converted to base
                                  θ `n`
  Ｉ                                 Cast to string
                                    Implicitly printed