[Question]
  [
Originally from [caird coinheringaahing's idea](https://codegolf.meta.stackexchange.com/questions/24021/advent-of-code-golf), I (Bubbler) am hosting [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/questions/24068/announcing-advent-of-code-golf-2021-event-challenge-sandbox).
On each day from today (Dec 1) until Christmas (Dec 25), a challenge will be posted at UTC midnight, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast or solving them in the shortest code. More details can be found in the link above.
For this year's event, the challenge ideas were drawn from the previous AoC events (2015 - 2020).
---
The story continues from [AoC2015 Day 3](https://adventofcode.com/2015/day/3), Part 2.
---
Santa is delivering presents to an infinite two-dimensional grid of houses. He begins by delivering a present to the house at the starting location, and then follows the commands written as a sequence of moves `^>v<` (moving to the neighboring house to the north, east, south, or west respectively), delivering a present at the house after each move.
Next year, Santa brings up a Robo-Santa for faster delivery. Santa and Robo-Santa start at the same location (giving two presents to the same house), and take turns to move based on the commands.
Assume the command is `^v^v^v^v^v`. Santa alone would deliver a bunch of presents to only two houses (the start and its north neighbor), but with a Robo-Santa, they would deliver presents to 11 different houses (Santa moving north 5 times and Robo-Santa moving south 5 times).
Now Santa wonders: Given a sequence of instructions, how many Santas (Santa and any Robo-Santas) are needed to deliver presents to the maximum number of houses? If two or more Robo-Santas are present, Santa and the Robo-Santas will take turns cyclically to follow the commands, everyone stopping when the commands run out (the number of commands does not have to be divisible by the number of Santas). If multiple options are available, choose the smallest number of Robo-Santas (it takes time and money to build them).
**Input:** A nonempty string of `^>v<` instructions.
**Output:** The minimum number of Santas in total for maximum delivery.
Standard [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") rules apply. The shortest code in bytes wins.
## Test cases
```
>>>>> -> 1
(everyone moving to the same house is surely a loss)
^v^v^v^v^v -> 2
(one additional Robo-Santa will deliver to 11 different houses, the possible maximum)
v>^>v<^< -> 5
(5 Santas will deliver to 7 distinct houses;
 1, 3, 4, or 7 Santas will deliver to 6 distinct houses
 and other choices to fewer houses)
vv>^<^^<v> -> 1
(Any of 1, 4, 6, or 7 Santas will deliver to 8 distinct houses,
 but 1 is the best choice out of them)
```
  
[Answer]
# TypeScript Types, 670 bytes
```
// @ts-ignore
type c<T,A=[]>=(((T extends T?(t:0)=>T:0)extends infer U?(U extends U?(u:U)=>0:0)extends(v:infer V)=>0?V:0:0)extends(_:0)=>infer W?c<Exclude<T,W>,[...A,0]>:A);type i<T>=T extends[0,infer X]?X:[1,T];type d<T>=T extends[1,infer X]?X:[0,T];type m<P,C>={"^":[i<P[0]>,P[1]],v:[d<P[0]>,P[1]],"<":[P[0],i<P[1]>],">":[P[0],d<P[1]>]}[C];type n<P,C>=[P[0]|m<P[1],C>,m<P[1],C>];type s<S,I>=I extends`${infer C}${infer I}`?S extends[infer A,...infer B]?s<[...B,n<A,C>],I>:0:c<S[number][0]>;type q=[[[],[]],[[],[]]];type M<S,K=S,B=[],BN=[],N=[q]>=K extends`${infer _}${infer K}`?B extends[...s<N,S>,...infer _]?M<S,K,B,BN,[...N,q]>:M<S,K,s<N,S>,N,[...N,q]>:BN["length"]
```
[Try it online!](https://www.typescriptlang.org/play?#code/PTAEAEBcGcFoEsDmA7A9gJwKYChIE8AHTUAYwB4AVAGgEEBeAbQF0A+OgCk4tEwA9JMyACbRQFAPztIALgAMASjosKc+XwHDR8ZADNM6UAFVJhnv0EijkgK7TDilrNXqL0dgDdp2vQYBqD2XFfOWdzTXYAfVUlb31QAHVxcgBRXhIAG2shTEoqeJYqBgA6EpoqWVZpGnkAbnwiUHhKNm4XTQZZKliDAA0mcR7pBgBGKgomOsJiIWa6VrCREa7dOL6Boc7xyYaAWzIABSoAYTYAbwAiAD1zoab9jtYqe+GmJipPBhn7ioLn16pzmQbgxvm87iNWG9zixgaCqF8ISwmABfBhHCb1YjIA7HNggh4AHz2f1xVGJENxGKmoGgZAAylQAJJsRlmDQiAAGABJTt1QEdkTy+YzkRzxHS2a4GHyyiUinyAEL9WnFEoKqjYsonN7MkLkOkMZDWHYAI30TAeLG2xAAjowGMxCv8HW9mK9raAALL0qgAaToDIVjDeCoAcsGqOGGDbWHRfZLNNzeSsDBFBcmfKBfaLxAqE4s5bTQ1Q6QU5XyIv1vQzfVR1WHCnLizGWNJq36qEWSwVi6qis3KmGGOd0oJEJAABbnJjYXDUiiyUB0L1AlhrtfQmrYECgXeXcRzhoUYZLldXdyXC9Xy+b7dgPcHzFiABMp+953cLEuLHcZEuq63HcH0PYgKAAZjfIF3E-f9Ln-T9byA0B92wIA)
[Answer]
# [Pari/GP](http://pari.math.u-bordeaux.fr/), 89 bytes
```
s->vecsort([-#Set(Vec(Ser([I^c|c<-Vec(Vecsmall(s))%11])/(1-x^i),#s+1))|i<-[1..#s]],,1)[1]
```
[Try it online!](https://tio.run/##NYzBCgIhFEV/RRwCH@mEe3PfeqCN@GAQC2Eq8Q1SMP9uY9C9XDhnc/NckrrndmPnRsrWGOhVVuHUMMVVXGMQUyzCXTBswaju@@gxL4sggIPWHk5CqzcmkAMdNcCWjHJ6HAfyXkoNTvs257x8BDFlWS7pue7Iu3B26zeSOW57uGQc67/dqkVbDZof72IQTbXcQ/sC "Pari/GP ‚Äì Try It Online")
The ASCII codes of `<^>v` are`[60, 94, 62, 118]`, which become `[5, 6, 7, 8]` when modulus 11.
After that, it is the usual power series tricks:
$$(a\_0+a\_1x+\cdots)/(1-x^k)=a\_0+a\_1x+\cdots+(a\_0+a\_k)x^k+(a\_1+a\_{k+1})x^{k+1}+\cdots$$
[Answer]
# [Rust](https://www.rust-lang.org/), 239 234 bytes
```
|i|{let mut r=vec![];for l in 1..i.len(){let(mut s,mut v)=(vec![0;l*2],vec![(0,0)]);for c in i.bytes(){s[c as usize%3&1]+=1-(c as i64%5&2);v.push((s[0],s[1]));s.rotate_left(2);}v.sort();v.dedup();r.push((!v.len(),l));}r.sort();r[0].1}
```
[Try it online!](https://tio.run/##NZDdbsIwDIXveQqDROWwELVs7GL9eZEqRR2kWqRSWJxG2qDP3iWBOVJkHZ/POrIZyc7dAOdWD8jgtgBfvbLQfXQDJmQNg20FByhhvuv7LYzOowVTOnVc1jLvLgZ60ANkQmjRK78lmDCYiIffsRKjOc37zU7y2GPKUyZZxI8B1@LzxyryNNVHaAlG0r9q/Zpk8qXMthg1/f623ic7ljtxHekLkepUcqozyVhOwlxsa9WhV51Fb5qcoIuxGOwndRqvvjNPcOkeWXnvycn8G43fJ7JpzuMdQjjUXLEQMKlxVYVaccgYB1w17v95aRclVzWVK5rCC/uH4JWiaQr3wOTzwqFaImXsQX0vcaM4dKh9lDidFtP8Bw "Rust ‚Äì Try It Online")
Ungolfed:
```
    |i| {
        let mut r = vec![];
        for l in 1..i.len() {
            let (mut s, mut v) = (vec![0; l * 2], vec![(0, 0)]);
            for c in i.bytes() {
                s[c as usize % 3 & 1] += // %3 - bit 1 flips, s[0] or s[1]
                    1 - (c as i64 % 5 & 2); // %5 - bit 2 flips, 0 or 2
                v.push((s[0], s[1]));
                s.rotate_left(2);
            }
            v.sort();
            v.dedup();
            r.push((!v.len(), l)); // dirty negation to reverse tuple sort order
        }
        r.sort();
        r[0].1
    };
```
History:
* -5 by removing the type annotation for `i` (thanks @Aiden4)
[Answer]
# [Python 3.8 (pre-release)](https://docs.python.org/3.8/), 111 bytes
```
lambda s:(L:=range(len(s)))[-max((len({0}|{sum(1j**(ord(d)%11)for d in s[j::~i])for j in L}),~i)for i in L)[1]]
```
[Try it online!](https://tio.run/##VczRCoIwFMbx@55iBME5UtDoJob6BL6BOVhMa6JTNhuF6auvHBR4vqv/7@L0r@He6dO5N75KLr4R7VUKYhlkLDFC30poSg0WEfNDK54QcjxO79E@WqB1FEFnJEjcUYpVZ4gkShOb14zNqghSL5JNuJ9VaBUac1oUvjdKD1DBNl1ui7j5C3e/rdilPHUxj9f41Zjz2C0v/Ac "Python 3.8 (pre-release) ‚Äì Try It Online")
Use `%11` trick from [alephalpha's answer](https://codegolf.stackexchange.com/a/237857/44718).
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 39 [bytes](https://github.com/abrudz/SBCS)
```
‚äÉ‚çí{‚â¢‚à™0,‚àä+‚çÄn ‚çµ‚ç¥y‚Üë‚ç®n√ó‚çµ}¬®‚ç≥n‚Üê‚â¢y‚Üê0J1*'^<v'‚ç≥‚çû
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qKM97f@jruZHvZOqH3UuetSxykDnUUeX9qPehjyFR71bH/VuqXzUNvFR74q8w9OB/NpDKx71bs571DYBqBooM8HAy1BLPc6mTB0o/Kh3HsjA/2lcdiDAlcYVVwaDQE6ZXZxdmU2cDYgJZNvEAbXZAQA "APL (Dyalog Unicode) ‚Äì Try It Online")
`y‚Üê0J1*'^<v'‚ç≥‚çû`: Take character input and map the characters to complex numbers, storing the resulting vector in j.
```
 < >   ^    v
¬Ø1 1 0J1 0J¬Ø1
```
`‚ç≥n‚Üê‚â¢y`: Store the length of y in n and create a range from 1 to n (possible number of Santas)  
`{ ... }¬®`: For each number of Santas evaluate the a function which returns the number of houses visited.  
`‚äÉ‚çí`: The first index of the maximal value. (Indices that would sort the vector descendingly; take the first one)
For the inner function `‚çµ` is the number of Santas to test and the other variables are still accessible.  
`y‚Üë‚ç®n√ó‚çµ`: Pad y to length `n√ó‚çµ` by appending 0's.  
`n ‚çµ‚ç¥`: Reshape into a matrix with n columns and `‚çµ` rows.  
`+‚çÄ`: Get cumulative sums of the columns.  
`0,‚àä`: Flatten and prepend a 0.  
`‚â¢‚à™`: Count the number of unique values.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 43 bytes
```
Ôº¶Ôº¨Œ∏¬´Ôº¶‚äïŒπ¬´Ôº™‚Å∞¬¶‚Å∞Ôº¶‚úÇŒ∏Œ∫Ôº¨Œ∏‚äïŒπ‚ú≥‚äó‚åï^>vŒª¬π*¬ª‚äûœÖÔº¨Ôº´Ôº°‚éö¬ªÔº©‚äï‚åïœÖ‚åàœÖ
```
[Try it online!](https://tio.run/##XU/NCsIwDD5vTxF2SqWCnhVBFEFRGOhZqDW6YtdqbYcgPnutGwiaU/L9ElkJJ63QMZ6sA1yTOfsKb4zBM89aaGmko5qMpyOqDs9Wob7uLA44DNgo3a1wq5UkvHG4cPjmcPjzMyidMh7nypH0yhqc23DQiVwoc8RiP2kKDjoJOQzb8E5f9IrP9cqzMtwrDN@Okugy1RqTI/EzTcJh2l5555uJu//5oa1J9o14qDrUGNhnRjE2k9Q93o9jv9Fv "Charcoal ‚Äì Try It Online") Link is to verbose version of code. Explanation:
```
Ôº¶Ôº¨Œ∏¬´
```
Loop over the length of the string, representing the number of Robo-Santas.
```
Ôº¶‚äïŒπ¬´
```
Loop over Santa and his Robo-Santas.
```
Ôº™‚Å∞¬¶‚Å∞Ôº¶‚úÇŒ∏Œ∫Ôº¨Œ∏‚äïŒπ‚ú≥‚äó‚åï^>vŒª¬π*
```
Draw the route this (Robo-)Santa takes, starting at the origin. (Would be -5 bytes for input in `urdl` format. Interestingly giving PolygonHollow its preferred `urdl` format would be [39 bytes](https://tio.run/##S85ILErOT8z5///9nmXv96w5t@PQaiDrUdfUcztBrFWPGjccWgYk3u9Z/n7PikdzNoNR07kd53aBlUNUbtI6tPtR17zzrUCx93uA@hY@6pt1aPf7PSuB8o96pp5vfdTTcb71//@UotKilJzSHAA "Charcoal ‚Äì Try It Online"), so slightly longer.)
```
¬ª‚äûœÖÔº¨Ôº´Ôº°
```
Save the count of all visited houses.
```
‚éö
```
Clear the canvas ready for the next possible number of Robo-Santas or to output the result.
```
¬ªÔº©‚äï‚åïœÖ‚åàœÖ
```
Find how many Robo-Santas are needed for the maximum possible count and add one for Santa himself.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 37 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ƒÅŒµŒπ8√¨S"^>v<"6√Ö√à‚Ä°D8√ä>‚àû‚ÇÜ+√ßN√®¬©sr.Œõ¬Æ¬¢}Zk>
```
[Try it online](https://tio.run/##AUoAtf9vc2FiaWX//8SBzrXOuTjDrFMiXj52PCI2w4XDiOKAoUQ4w4o@4oie4oKGK8OnTsOowqlzci7Om8KuwqJ9Wms@//92Pl4@djxePA) or [verify all test cases](https://tio.run/##S0oszvifnFiiYKeQnJ@SqpdfnJiUmapgY6Pg6u/GZa@k8KhtkoKS/f8jjee2nttpcXhNsFKcXZmNktnh1sMdjxoWulgc7rJ71DHvUVOb9uHlfodXHFpZXKR3bvahdYcW1UZl2/2vPbxehwtkFld5RmZOqkJRamKKQmYeV0o@l4KCfn5BiT7ESiiF5gobBRWw2rzU/3YgwBVXBoNcZXYgl8TZcJUBWTZxcTZldlwA).
**Explanation:**
```
ƒÅ                # Push a list in the range [1,input-length]
 Œµ               # Map over each of these integers:
  Œπ              #  Uninterleave the (implicit) input-string into this many parts,
                 #  resulting in the route of each individual (Robo-)Santa
   8√¨            #  Prepend an 8 in front of each string
     S           #  Then convert it to a flattened list of characters
      "^>v<"     #  Push string "^>v<"
            6√Ö√à  #  Push list [0,2,4,6]
               ‚Ä° #  Transliterate all "^" to 0; ">" to 2; etc.
  D              #  Duplicate this list of digits
   8√ä            #  Check for each that it's NOT equal to 8 (0 if 8; 1 otherwise)
     >           #  Increase each by 1 (1 if 8; 2 otherwise)
  ‚àû              #  Push an infinite positive list: [1,2,3,...]
   ‚ÇÜ+            #  Add 36 to each: [37,38,39,...]
     √ß           #  Convert each to a character with this codepoint:
                 #  ["%","&","'",...]
      N√®         #  Index the map-index into this list
        ¬©        #  Store the character in variable `¬Æ` (without popping)
  sr             #  Rearrange the three values on the stack from a,b,c to b,c,a
    .Œõ           #  Use the modifiable Canvas builtin with these three arguments
      ¬Æ¬¢         #  Count the amount of character `¬Æ` in the Canvas-string
 }Z              # After the map: push the max (without popping the list)
   k             # Get the first (0-based) index of this max
    >            # Increase it by 1 to make it 1-based
                 # (after which it is output implicitly as result)
```
**In-depth step-by-step explanation:**
(Uses input `v>^>v<^<` as example.)
1)¬†`ƒÅŒµŒπ`: the `ƒÅ` results in the amount of (Robo-)Santas we want to check per iteration, and the `ŒµŒπ` will map this to routes per individual (Robo-)Santa:  
[Try just this step online.](https://tio.run/##yy9OTMpM/f//SOO5red2/v9fZhdnV2YTZwMA)
2)¬†`8√¨S"^>v<"6√Ö√à‚Ä°` will convert these routes to something usable by the Canvas builtin.
The Canvas Builtin uses three arguments to draw a shape:
* Length of the lines we want to draw
* Character/string to draw
* The direction to draw in, where each digit represents a certain direction:
```
7   0   1
  ‚Üñ ‚Üë ‚Üó
6 ‚Üê X ‚Üí 2
  ‚Üô ‚Üì ‚Üò
5   4   3
```
And in addition there are a couple of special directions (`+√ó8`), for which we'll only use `8` in this program. `8` will reset the Canvas starting point.
So something like `["v>^",">v<","^<"]` (three (Robo-)Santa routes) will with `8√¨S"^>v<"6√Ö√à‚Ä°` translate to: `[8,4,2,0,8,2,4,6,8,0,6]`.
[Try the first two steps online.](https://tio.run/##yy9OTMpM/f//SOO5red2WhxeE6wUZ1dmo2R2uPVwx6OGhf//l9mBBOJsAA)
3)¬†Using what we created in step 2 as the directions-argument, `D8√ä>` for our
lengths-argument, and `‚àû‚ÇÜ+√ßN√®` for the character we want to draw, we use the modifiable Canvas builtin `.Œõ`.
With the example of the three (Robo-)Santa routes above, it'll have the following three arguments:
* Lengths: `[1,2,2,2,1,2,2,2,1,2,2]` (1 for every `8`, 2 for every actual movement)
* Character: `"'"`
* Directions: `[8,4,2,0,8,2,4,6,8,0,6]`
Step 3.1: Draw 1 character at starting point `8`:
```
'
```
Step 3.2: Draw 2-1 character in direction 4/`‚Üì`:
```
'
'
```
Step 3.3: Draw 2-1 character in direction 2/`‚Üí`:
```
'
''
```
Step 3.4: Draw 2-1 character in direction 0/`‚Üë`:
```
''
''
```
Step 3.5: Draw 1 character at starting point `8` again.
Step 3.6: Draw 2-1 character in direction `2`/`‚Üí`:
```
''
''
```
Step 3.7: Draw 2-1 character in direction 4:/`‚Üì`:
```
''
''
```
Step 3.8: Draw 2-1 character in direction 6/`‚Üê`:
```
''
''
```
Step 3.9: Draw 1 character at starting point `8` again.
Step 3.10: Draw 2-1 character in direction 0/`‚Üë`:
```
'
''
''
```
Step 3.11: Draw 2-1 character in direction 6/`‚Üê`:
```
''
 ''
 ''
```
The reason we draw a different character every time and also have a leading `8` to reset to the starting point, is because there isn't any way to clear the Canvas. The next iteration we use the `.Œõ`, it'll basically continue where it left off in the previous iteration. We therefore have to do an initial reset, and we draw all the characters on top of each other, which can be seen in the TIO below:
[Try the first three steps online.](https://tio.run/##yy9OTMpM/f//SOO5red2WhxeE6wUZ1dmo2R2uPVwx6OGhS4Wh7vsHnXMe9TUpn14ud/hFYdWFhfpnZv9/3@ZHUhhnA0A)
[See this 05AB1E tip of mine for an in-depth explanation of the Canvas builtin.](https://codegolf.stackexchange.com/a/175520/52210)
4)¬†`¬Æ¬¢}`: count (`¬¢`) how many distinct houses all the (Robo-)Santa have visited, by checking how many times the current character (which we've saved in variable `¬Æ`) is in the resulting Canvas-string.
[Try the first four steps online.](https://tio.run/##AUYAuf9vc2FiaWX//8SBzrXOuTjDrFMiXj52PCI2w4XDiOKAoUQ4w4o@4oie4oKGK8OnTsOowqlzci7Om8KuwqL//3Y@Xj52PF48)
5)¬†`Zk>`: now that we have the amount of houses that can be visited depending on the amount of (Robo-)Santa going around doing their routes, we can get the maximum (`Z`) amount of houses visited, and get the first (1-based) index of this maximum (`k>`) to get the lowest amount of (Robo-)Santa necessary to achieve this maximum amount of visited houses, which will be output as our result.
[Answer]
# Java, 349 bytes
```
s->{var p=new HashSet<String>();for(int i=s.length();i>0;i--){for(int j=0;j<i;j++){int x=0,y=0;p.add(i+","+x+","+y);for(int k=j;k<s.length();k+=i){int c=s.charAt(k)%11;var t=c==6?y++:(c==7?x++:(c==8?y--:x--));p.add(i+","+x+","+y);}}}int[]n=new int[s.length()];p.stream().map(a->a.substring(0,a.indexOf(','))).map(Integer::parseInt).forEach(i->n[i-1]++);int m=0,i=0;for(;i<n.length;i++){m=n[i]>n[m]?i:m;}return m+1;}
```
[Try it online.](https://tio.run/##bVJNi9swEL3nVwyGshKORXJpF8tyKKXQHtoecgwOaG0lkT8UIyluQvBvT8eOk91Dx2CNnmbe08yolJ2MyqK66aY9Wg8l7tnJ65r9kO6wVp7PZnktnYNfUhu4zgBNG6/sTuYKfk/IhEJO1t5qswdH@XjQz8bFeel1juEGBNxclF47aaEVRv2FSSi5Z6aE8t3RkoFNC8dqZfb@gKBOF1xHEb0@Tkux4GWieRmG9DoAZ7GYXxBsmSwKosNgHoTn8X9556xEyavkA28VCn3Pz1EuP0j71ZOKflou@XBHL3IhPq8uYRgT9L6szpP3urpEUXzGG9H/K/Z9j6ybzIxVDu67aoYpzlslG0JZI1sio1Qyd3pzYxPIYi6ZNoU6/9mRl/kLpfeon9j4vbJx3ErrFO4ow7q@y/xAdJSajY6WGXaDD9U02A2N3RgK5zoxkzbXQ7sagcEZZjTZSscN763yJ2ugCZe8v/H70NrTW41Dm2bXHXUBDT6CacSbDCT9MH7Ugcf0vXL@m3QKYgjSwWDbPT7o0m3aJdsEOvSS7Tbp0oC5ttaeBBBQ@mQcbH1xXjXsePKsRWpfG/IkDyFAflwMy58ofT68/vYP)
**Explanation:**
```
    s -> {
            var p = new HashSet<String>();                                  // using Hash-Set for built in distinct elements
            int h = s.length(), i = h, j, x, y, k, c, n[] = new int[h];     // setting up variables
            for (; i > 0; i--)                                              // loop for possible Santas
                for (j = 0; (k = j++) < i;)                                 // loop every Santa
                    for (p.add(i + ",0," + (x = y = 0)); k < h; k += i) {   // add starting position and loop Santa over moves
                        c = (c = s.charAt(k) % 11) == 6 ? y++ : c == 7 ? x++ : c == 8 ? y-- : x--;
                        p.add(i + "," + x + "," + y);                       // change position and add it
                    }
            for (p.stream()                                                 //
                    .map(a -> a.substring(0, a.indexOf(44)))                // only look at Santas number for each house
                    .map(Integer::parseInt)                                 //
                    .forEach(I -> n[I - 1]++); h-- > 0;)                    // add visited Houses together
                i = n[h] > n[i] ? h : i;                                    // finding the index of the greatest element
            return -~i;                                                     // negate and bit-flip
        }
```
Improvements:
* -37 bytes: Using `var` where possible and changing `switch-case` statement to tenary operators
* -1 byte: treating chars as int and using alephalpha's modulo-trick
* -2 bytes: spaces
* -66 bytes: thanks to ceilingcat (learned some java magic I wasn't aware of)
What I learned (as I never coded a challenge befor nor golfed code):
* Java is a horrible language to golf (but I'm not good enough in other languages... so ¬Ø\*(„ÉÑ)*/¬Ø )
* I am far to slow to be competetiv in this AoCG-thing...
[Answer]
# Python, 134 bytes
```
k,*t,x=input(),1
for _ in k:
    p=[0]*x;q={0}
    for c in k:n=p.pop(0)+1j**(ord(c)%11);p+=n,;q|={n}
    t+=(-len(q),x),;x+=1
print(min(t)[1])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=LY4xDoIwFEBnegoWk5YWQzdjKRch4IASK_r7IYXUoKuXcGHReCVvowbHl5eXvPsTz25vYZoevavj1fvWiMgJrw1g7ygTktS2CzehgbBZkwB1nhSRV60ekysJfq6aHWhcokWaMC4PUURtt6UVW0jJFHINQrUXPcK3cVzT-LgD2jLhmVCea0mwM-DoyQB1LJcFm2_-U9NryMpsSMt05g8)
-21 bytes by stealing alephalpha's codepoint mapping trick.  
-11 bytes thanks to pxeger
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~121 ...~~ 93 bytes
```
->s{a=0;q=s.bytes;q.map{[-((*w=[0i]*a+=1)|q.map{|y|w.rotate![0]+=1i**y%=19}).size,a]}.min[1]}
```
[Try it online!](https://tio.run/##PY3RCoMgGIXve4oWBK2V6NbNSHsRUbBhEKyt0lWufPZmRPv/q/Mdzjn9pzRrRda0ULMgMO@IAqXRUuUdaEQ70zSK4pFQWLNYXAg6LztfzDKC/q2FlicKmXPqODYhQXd7Bqr@ykQwC5r6RRGza@tHGQAIQufJp3zoLR9gXgzBvrZ3TssUmjCzhNBbck1QApn1vNavaFBsF7Bd8OH4gwyF68Ic/7UDmHM8uMz6Aw "Ruby ‚Äì Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 98 bytes
-5 bytes thanks to [@att](https://codegolf.stackexchange.com/users/81203/att).
```
Ordering[i=1;s=I^ToCharacterCode@#~Mod~11;0Union@@Accumulate@Partition[s,i,i++,{i,1},0]-i&/@s,-1]&
```
[Try it online!](https://tio.run/##NYyxCoMwGIRfJURwMaKZjSHFqUOpQzuFBIKm9YeqEGMW0Ve3Wuh9y303XG98Z3vjoTH7C5X73bXWwfCWUNJiKq/6MVadcabx1lVja0W03cZ2o7TInwOMgxCXppn7@WO8FbVxHvyxyokAgSQhCxC6klylEGdiIilV8V4f/15GKOXoJSOlUIwygRbMz2CCsA5/Tgtc88A0@/VDmNYscLzuXw "Wolfram Language (Mathematica) ‚Äì Try It Online")
[Answer]
# [J](http://jsoftware.com/), 44 bytes
```
1+0{[:\:[:([:#@~.@,+/\)"2-@#\]\0j1^'>^<v'&i.
```
[Try it online!](https://tio.run/##Vcw9C8IwEIDhvb/iSMC0tE0/wCWkoSi4KA6ujYGqKdpBwUJEFP96jESR3nHLy/H0FlHSQcWAQAI5MHcphflmtbBFnD8aJlnDwobh@kXrJM5khMq0xnIr875QRChuyOREbRSsZxSW@g67dtAHaM/DTV8ZdBX9Ox5BZYjlM8MyclxGEaYjKgj0/niBAirogIjPEJ@mPhmhhOGKf2vpqzK/JSPAuHeunO0U@wY "J ‚Äì Try It Online")
*-3 after stealing a trick from ovs's APL answer. Explanation is similar to ovs's.*
My other attempt used key rather than column sums for simulating the multiple robots:
```
1+0{[:\:[:#@~.@,"2(#\|/#\)+/\/."#.0j1^'>^<v'&i.
```
[Answer]
# BQN, 56 bytes
```
{1+‚äë‚çí((‚àæ‚üú-1‚àæ‚â†ùï©)‚äèÀú">v<"‚äêùï©)‚ä∏{‚â†‚ç∑‚àæ{+`0‚àæùï©}¬®ùï®‚äîÀú(‚â†ùï®)‚•ä‚Üïùï©}¬®1+‚Üï‚â†ùï©}
```
[Try It!](https://mlochbaum.github.io/BQN/try.html#code=RiDihpAgezEr4oqR4o2SKCjiiL7in5wtMeKIvuKJoPCdlakp4oqPy5wiPnY8IuKKkPCdlakp4oq4e+KJoOKNt+KIvnsrYDDiiL7wnZWpfcKo8J2VqOKKlMucKOKJoPCdlagp4qWK4oaV8J2VqX3CqDEr4oaV4omg8J2VqX0KCkQg4oaQIOKAolNob3cgRgpEICI+Pj4+IgpEICJedl52XnZedl52IgpEICJ2Pl4+djxePCIKRCAidnY+XjxeXjx2PiI=)
BQN is the Language of The Month for December!
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 19 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
O%11sJ¬µZƒ±*≈ª‚Ç¨√ÑFQL)M·∏¢
```
A monadic Link accepting a list of characters which yields an integer, the optimal number of Santas.
**[Try it online!](https://tio.run/##AS0A0v9qZWxsef//TyUxMXNKwrVaxLEqxbvigqzDhEZRTClN4bii////dj5ePnY8Xjw "Jelly ‚Äì Try It Online")**
[Answer]
# [Clojure](https://clojure.org/), 259 bytes
```
(let[s(read-line)](print(first(reduce(fn[[a b][c d]](if(< b d)[c d][a b]))(for[i(range 1(inc(count s)))][i(count(set(mapcat #(reductions(fn[[x y]m](case m\^[x(dec y)]\>[(inc x)y]\v[x(inc y)]\<[(dec x)y]))[0 0]%)(for[j(range i)](take-nth i(drop j s))))))])))))
```
[Try it online!](https://tio.run/##LY9BisMwDEWvIhgK0qLQ7ksv4qjg2spUmcQOtlOS02dit1oI/pf4enJjHJYk@46jFJMxifXnUYMQ45w0FOw15XL4fnGCfTDGwpONA8@M2uMNnuCp6TYhwj4mo5hs@BW4ogaHLi6hQCYiPiZNYZaCk52dLfDziS8aQ24nVth4YnQ2C0zdw6zoxcFG3N1NDYSVNu7eh19F9W@mrVSfyFzgwqcPyPAF0eOhYv/kHMoLFH2KMwwNqVK1vu/3Wv8 "Clojure ‚Äì Try It Online")
Ungolfed:
```
(let [s (read-line)]
  (print
   (first
    (reduce
     (fn [[a b] [c d]] (if (< b d) [c d] [a b]))
     (for [i (range 1 (inc (count s)))]
       [i (count
           (set
            (mapcat
             #(reductions
               (fn [[x y] m]
                 (case m
                   \^ [x (dec y)]
                   \> [(inc x) y]
                   \v [x (inc y)]
                   \< [(dec x) y]))
               [0 0] %)
             (for [j (range i)]
               (take-nth i (drop j s))))))])))))
```
Commented, slightly longer version using threading:
```
(let [s (read-line)]
  (->>
   (for [i (range 1 (inc (count s)))]  ; Create a list of number of houses covered by 1..n (Robo-)Santas (n = length of instruction):
     [i (->>                           ;  for example, for ">>>>>" => ([1 6] [2 4] [3 3] [4 3] [5 2])
         (for [j (range i)]            ;  - split commands for i (Robo-)Santas:
           (take-nth i (drop j s)))    ;    for example, for "^v^v^v^v^v" with 2 (Robo-Santas) => ((\^ \^ \^ \^ \^) (\v \v \v \v \v))
         (mapcat                       ;  - provide a list of all houses covered with a command (splitted to commands for each (Robo)-Santa):
          #(reductions                 ;    for example, for "^v^v^v^v^v" with 2 (Robo-Santas) => ([0 0] [0 -1] [0 -2] [0 -3] [0 -4] [0 -5] [0 0] [0 1] [0 2] [0 3] [0 4] [0 5])
            (fn [[x y] m]              ;      - given a house of position [x y] and move command m:
              (case m \^ [x (dec y)]   ;         move to [x y-1]
                      \> [(inc x) y]   ;         move to [x+1 y]
                      \v [x (inc y)]   ;         move to [x y+1]
                      \< [(dec x) y])) ;         move to [x-1 y]
            [0 0] %))                  ;      - start from house [0 0] and work moves from there
         set                           ;  - convert the list to a set to remove duplicate houses
         count)])                      ;  - count number of houses in the set
   (reduce                             ; From the list created above, pick the best option
    (fn [[a b] [c d]]                  ;  for example, for ">>>>>", the list ([1 6] [2 4] [3 3] [4 3] [5 2]) => [1 6]
      (if (< b d) [c d] [a b])))       ;  - compare number of houses, returning first if the number is same (less (Robo-)Santas is better)
   first                               ; Extract number of (Robo-)Santas from the best option
   print))
```
[Answer]
# JavaScript (ES6), 130 bytes
Expects an array of characters.
This is using `reduce()` ... because why not.
```
a=>a.reduce(r=>(n++,v=new Set(a.map(o=(c,i)=>o[i%=n]=~~o[i]+({'>':1,'<':-1,v:q=a.length}[c]||-q))).add(0).size)>m?(m=v,n):r,n=m=0)
```
[Try it online!](https://tio.run/##bczBasMwEATQe7/CBIp3sazEhV6MdvMRPRoLhKykLraU2I4KbZpfd11CevLMZQ6P@TDRjHZoT1PuQ@PmA82G2MjBNRfrYCAGn2UiknefyZubwMjenCAQWNEicajaZ/I13W7LqjP4TjktC5GqtMwLEcszGdk5f5zefypbX6/5GRGlaRrYoRzbL4fc76GnKDyWg/DU0w5nG/wYOie7cIQDVFLKDf9lUyMm92y3SfG04nR89I4X97LmImuOSqvH5eJeV90CldYq8v9fMf8C "JavaScript (Node.js) ‚Äì Try It Online")
### Commented
```
a =>                          // a[] = array of characters
a.reduce(r =>                 // reduce a[] using r as the accumulator:
  (                           //
    n++,                      //   increment n
    v = new Set(              //   define v as the size of this set:
      a.map(o = (c, i) =>     //     for each char. c at position c in a[]:
        o[i %= n] =           //       reduce i modulo n
          ~~o[i] + (          //       coerce o[i] to an integer and add:
            { '>': 1,         //         +1 if c = '>'
              '<': -1,        //         -1 if c = '<'
              v: q = a.length //         +a.length if c = 'v'
            }[c]              //
            || -q             //         -a.length if c = '^'
          )                   //
      )                       //     end of map()
    )                         //   end of Set()
    .add(0)                   //   add the starting position 0
    .size                     //   get the final size of the set
  ) > m ?                     //   if v is greater than m:
    (m = v, n)                //     update m to v and r to n
  :                           //   else:
    r,                        //     leave r unchanged
  n = m = 0                   //   start with r = n = m = 0
)                             // end of reduce()
```
[Answer]
# [R](https://www.r-project.org/), 134 bytes
```
function(v)which.max(Map(function(x)sum(unique(c(0,unlist(Map(function(i)cumsum(d[y==i]),y<-1:x))))|T),seq(d<-1i^(utf8ToInt(v)%%11))))
```
[Try it online!](https://tio.run/##Zc5NC4JAEAbge79CDGEWLNogiFi9d@iUt2hhWQ0X2jXbDxX677YKBtrMbZ6XmXn3ZdVIprorU4bppH9YxY2oFDjUlIKXW8lauLAX/KBF2kqwStS2AA672Kqn0GYeEohbOeTyW5ck4o7ijmzwqUW@PhmKdVFD7ieCgjWPY1adlfEnowjjITL/CsJ0qBAF6wCvFkTd1KPvl@5SmjpCyaiH4I@9E0qJm9b3Xw "R ‚Äì Try It Online")
]