[Question]
  [
## The Challenge
Given a finite list of integers, split it into the fewest partitions possible such that no partition contains a number more than once.
## Rules
Input can be in any format and any order.
Output can be in any format, as long as it's clear that each group is separate.
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so lowest score wins!
## Example I/O
```
Input: [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2]
Output: [[1,2],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1],[1]]
Input: [1,3,4,2,6,5,1,8,3,8]
Output: [[1,3,4,2,6,5,8],[1,3,8]]
Input: [5,9,12,5,2,71,23,4,7,2,6,8,2,4,8,9,0,65,4,5,3,2]
Output: [[5,9,12,2,71,23,4,7,6,8,0,65,3],[5,4,8,9,2],[4,5,2],[2]]
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), 50 bytes
```
l=input()
while l:s=set(l);print s;map(l.remove,s)
```
[Try it online!](https://tio.run/##DcZLCoAgFAXQeatoqHCJemVfWkk0aCAkvEzSilZvTg7HfWE/LcXIs7HuDkJm725Y5zz62esgWE7uMjbkfjo2J7i49HE@Gl7GuCgMqAgKhK4C1WjQpbfok01yQIlWpSrUoPUH "Python 2 – Try It Online")
Repeatedly prints the unique of elements of the list, then removes one of each such element. A rare imperative use of `map`.
[Answer]
# [Haskell](https://www.haskell.org/), 39 bytes
First we collect all equal elements in separate lists using `sort` and then `group`. By `transpose`ing the resulting list of lists we get at most one of each of those elements in the resulting lists.
```
import Data.List
f=transpose.group.sort
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/PzO3IL@oRMElsSRRzyezuIQrzbakKDGvuCC/OFUvvSi/tECvGKjgf25iZp5tQVFmXolKWnS0oY6xjomOkY6ZjqmORawOmG8RG/sfAA "Haskell – Try It Online")
### Example
```
                     [1,2,3,2,4,2,1,5] --input
                sort$[1,2,3,2,4,2,1,5] --[1,1,2,2,2,3,4,5]
          group.sort$[1,2,3,2,4,2,1,5] --[[1,1],[2,2,2],[3],[4],[5]]
transpose.group.sort$[1,2,3,2,4,2,1,5] --[[1,2,3,4,5],[1,2],[2]]
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 3 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ĠZị
```
A monadic Link accepting a list, which yields a shortest set-wise partition such that each part is a set.
**[Try it online!](https://tio.run/##y0rNyan8///IgqiHu7v///8fbahjrGOiY6RjpmOqY6hjAeRZxAIA "Jelly – Try It Online")**
### How?
```
ĠZị - Link: list, L                      e.g. [8,2,4,2,9,4,1]
Ġ   - group indices of L by their values      [[7],[2,4],[3,6],[1],[5]]
 Z  - transpose                               [[7,2,3,1,5],[4,6]]
  ị - index into L                            [[1,2,4,8,9],[2,4]]
```
[Answer]
# [J](http://jsoftware.com/), ~~20~~ 17 bytes
```
_<@-."1~0|:1%%/.~
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/420cdPWUDOsMaqwMVVX19er@a3KlJmfkK6QpGOoY6hiAoSEeaIRQbqxjomOkY6ZjChS2APIsYFKmOpY6hkZAcSMdc6AOkDpzsEoLIGkCJC2BlpiZApmmQG1G/wE "J – Try It Online")
```
             %      divide 1 by each, 0 becomes infinity
              /.~   group equal values, every group gets padded with zeroes
           1%       invert back
        0|:         transpose
_<@-."1~            remove the infinities, put each row in a box
```
I suspect `0|:1%%/.~` is acceptable, we get
```
5 9 12 2 71 23 4 7 6 8 0 65 3
5 9  _ 2  _  _ 4 _ _ 8 _  _ _
5 _  _ 2  _  _ 4 _ _ _ _  _ _
_ _  _ 2  _  _ _ _ _ _ _  _ _
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
¹ƙ`Z
```
[Try it online!](https://tio.run/##y0rNyan8///QzmMzE6L@6xxuPzrp4c4Zj5rWZD1qmKOga6fwqGEu1@F2oEDk///R0YY6xEGjWB0uoGJjHRMdIx0zHVOgkAWQZwESNtWx1DE0AooZ6ZgDVYLUmINVWQBJEyBpqWOgY2YKZJoCtRjFxgIA "Jelly – Try It Online")
A monadic link that takes a list of integers and returns a list of lists of integers. Simply groups identical numbers and then transposes.
[Answer]
# [Haskell](https://www.haskell.org/), 54 bytes
```
(a:b)%n|elem n a=a:b%n|s<-n:a=s:b
_%n=[[n]]
foldl(%)[]
```
[Try it online!](https://tio.run/##DcdBCoMwFEXRuatw0IDCK9RotIZmJSGUSBMqxq80HXbv6Z9czn37vIWUSmm8XlpBv5DCXlPtDT9vflxJe5P1Uj0FGWvJuSqaeKRXakRrXdn9Sub8rPS9RKswo5NQkJg6yB4DJvaIO3fgzrhhVEyFHtKVPw "Haskell – Try It Online")
We define a function `%` which takes a single number and adds it to a partition scheme and we fold it across the input starting with an empty partition scheme.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 3 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
ü y
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=/CB5&input=WzEsMSwxLDEsMSwxLDEsMSwxLDEsMSwxLDEsMSwxLDEsMSwxLDEsMSwyXQotUQ)
Sorts & partitions by value and then transposes the result.
[Answer]
# JavaScript (ES6), 59 bytes
```
a=>a.map(o=n=>b[i=o[n]=-~o[n],--i]=[...b[i]||[],n],b=[])&&b
```
[Try it online!](https://tio.run/##jU27DsIwDNz5kKqVnIiGpo/B/ZHIQ1JaFFSSiiKmil8PLisMyNL5bN@dr/Zp1@Hul4cI8TymCZPF3sqbXfKIAXtnPEYTCMVrbyCEJzRSSj7QthkCXjo0VGSZS0MMa5xHOcdLPuWmhP9KUVEcvrwnqEBBDZoVLU/tD5WGDkrFEgUN5@yW5mNqGSvGDo5Qa6aaE/Y/6Q0 "JavaScript (Node.js) – Try It Online")
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 30 bytes
```
{roundrobin map &[xx],.Bag.kv}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/uii/NC@lKD8pM08hN7FAQS26oiJWR88pMV0vu6z2vzVXcWKlQpqGSrymQlp@EVe0oQ5x0ChWB6TYWMdEx0jHTMcUKGQB5FmAhE11LHUMjYBiRjrmQJUgNeZgVRZA0gRIWuoY6JiZApmmQC1Gsf8B "Perl 6 – Try It Online")
Inspired by the Jelly answers.
### Explanation
```
{                            }  # Anonymous block
                      .Bag      # Convert to Bag (multiset)
                          .kv   # Key-value sequence
            map &[xx],  # Repeat each key n times
 roundrobin  # Transpose
```
### Old solution, 32 bytes
```
{(.Bag,{$_∖.Set}...^!*)>>.Set}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/WkPPKTFdp1ol/lHHNL3g1JJaPT29OEUtTTs7MO@/NVdxYqVCmoZKvKZCWn4RV7ShDnHQKFYHpNhYx0THSMdMxxQoZAHkWYCETXUsdQyNgGJGOuZAlSA15mBVFkDSBEha6hjomJkCmaZALUax/wE "Perl 6 – Try It Online")
### Explanation
```
{                            }  # Anonymous block
      ,         ...^    # Create sequence
  .Bag                  # starting with input converted to Bag (multiset)
       {$_∖.Set}        # Decrease weights by one each iteration
                    !*  # Until bag is empty
 (                    )>>.Set  # Convert all bags to sets
```
[Answer]
# [R](https://www.r-project.org/), 54 bytes
```
for(i in 1:max(t<-table(scan())))print(names(t)[t>=i])
```
[Try it online!](https://tio.run/##K/r/Py2/SCNTITNPwdAqN7FCo8RGtyQxKSdVozg5MU9DEwgKijLzSjTyEnNTizVKNKNL7GwzYzX/GyoYK5goGCmYKZgqGCpYAHkW/wE "R – Try It Online")
Builds a table of the counts of the values. For input `1 3 4 2 6 5 1 8 3 8`, this gives 
```
t = 1 2 3 4 5 6 8 
    2 1 2 1 1 1 2 
```
where the first row is `names(t)` (the different values in the input) and the second is the counts in `t`.
Then in the for loop, at iteration `i`, print only the names corresponding to counts ≥`i`.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 4 bytes
```
.T.g
```
[Try it online!](https://tio.run/##Dca7DcAgDEDBhZ4QGMxnj3QRNSlT0DC9cXO6/@zPLDxhmb3KIAmK0BKSKTR/pbvFHUSqepWMzAs "Pyth – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 23 bytes
```
(}:,(~:</.])&>@{:)^:_@<
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NWqtdDTqrGz09WI11ewcqq0046ziHWz@a3KlJmfkK6QpGOoQB40QGox1THSMdMx0TIHCFkCeBUzKVMdSx9AIKG6kYw7UAVJnDlZpASRNgKSljoGOmSmQaQrUZvQfAA "J – Try It Online")
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 6 bytes
```
rasgtp
```
[Try it online!](https://tio.run/##SyotykktLixN/f@/KLE4vaTg//9oQx1jHRMdIx0zHVMdQx0LIM8iFgA "Burlesque – Try It Online")
```
ra # Read input as array
sg # Sort and group like values
tp # Transpose
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 17 bytes
```
ＩＥ⌈Ｅθ№θιΦθ⁼№…θμλι
```
[Try it online!](https://tio.run/##JYvBCoMwGINfxWMLGcxqdbJj2W6D3cVDKYKFdtVqx/b03T89JHwhiZl0NEG7nJ/Rvjam9Lqxh55JH@uT33lBoUKilsByzlHcrdvG@M@3JWm3sqNXX@NGNYX94mnn@PHg/Jpz30t0KAUkBNoSokKNlrjBhbwm73BGIwklKohhyKe3@wE "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
    θ               Input array
   Ｅ                Map over elements
     №              Count of
       ι            Current element in
      θ             Input array
  ⌈                 Maximum
 Ｅ                  Map over implicit range
         θ          Input array
        Φ           Filter elements where
           №        Count of
               λ    Current element in
             θ      Input array
            …       Truncated to length
              μ     Inner index
          ⁼         Is equal to
                ι   Outer index
Ｉ                   Cast to string
                    Implicitly print
```
[Answer]
# [Red](http://www.red-lang.org), ~~67~~ 61 bytes
```
func[b][until[print a: unique b foreach e a[alter b e]b =[]]]
```
[Try it online!](https://tio.run/##jYxLCsMwDET3OcWQfaBx4/ygl@hWaOEkMg0EtzHx@V2l3XVVBIMk3psoS77LQlz4EdmnMNPElMKxbvSKazjgRqSw7kkwwT@juPkBgSO3HRL1JzzhRsycPajGf2O4@LaXVVWVhcepXtHAoIVVoNer/4XIYkBtFDDotOQUuo/SazaaAy5ora5WfcP5DQ "Red – Try It Online")
Inspired by [xnor's Python answer](https://codegolf.stackexchange.com/a/197292/75681) - don't forget to upvote it!
This was a rare opportunity to use `alter`- `If a value is not found in a series, append it; otherwise, remove it` 
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 25 bytes
```
*.classify({%.{$_}++}){*}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPtfSy85J7G4ODOtUqNaVa9aJb5WW7tWs1qr9r81V3FipUKahkq8pkJafhFXtKEOcdAoVgek2FjHRMdIx0zHFChkAeRZgIRNdSx1DI2AYkY65kCVIDXmYFUWQNIESFrqGOiYmQKZpkAtRrH/AQ "Perl 6 – Try It Online")
Groups each element of the input by how many times it has appeared in the sequence so far, then take only the values
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 114 bytes
```
W;*P;S(D,E)int*D,*E;{do for(P=D;P<E;*P==W?printf("%d ", W),*P=*D,*D++=W,P=E:++P);while(++W);puts("");D-E&&S(D,E);}
```
This solution takes a while to run because it iterates over all possible integer values from -2^31 to 2^31-1.
Here is a TIO link to a slightly longer solution that runs a lot faster, the only difference is, that it uses short instead of int. Groups are separated by line breaks.
[Try it online!](https://tio.run/##jZBRa4MwEMff@ykOYSUxVzZjbW2zsBd9FzrwYd3DsLoKmxZ1DCZ@dneN7cD50gSO3OX//10uyeI9Sfq@PpZVA7GyI7VjAYY8Lxo7QDtU7aGErKxYpAMVPYak0Dp@OlUkyJh1dwALIeZI5bM@EELHGOlwK0TE1fcx/0iZEDFXp6@mZpbFVbAI5/Ohiep6wsDnW14wPmtnQOtceE7rxnl5BQ0tOHjbltCpEUD@AVxcosQVeiTzKfP/S92L1MMNOpJ0EtdEPPvWxulTXFLc4AOuPDp6hDEdDef6G/vCvHy7L2hOc7NjpoLDSCCgzn/SMhuqHO6vOfn5xTKGyQlMDjA5hslbYO4E5g4wdwxzp7Cu/wU "C (gcc) – Try It Online")
How does it work?
```
For every possible integer value
    if value in array
        print value
        remove found value entry from list
print endline
if array is not empty
    recursively call function on remaining array
```
```
int W;
int *P;
S(int* D, int* E)
{
    // this loop will run once for every possible integer value
    do
    {
        // search for the integer value W
        for(P=D;P<E;++P)
            // if the value is found
            if (*P == W)
            {
                // output the value, can happen only once per integer value
                printf("%d ", W);
                // overwrite the found value with the first value of the array
                // because we have to output the first value later
                *P = *D;
                // reduce the size of the remaining array by one
                D++;
                // jump out of for loop to seach for next possible value of W
                P = E;
            }
    }
    while(++W); // after the while loop W==0 again
    puts("");   // output new line
    if (D!=E)
        S(D,E); // if end is not reached, search again in ramaining array
}
```
[Answer]
# [Zsh](https://www.zsh.org/), 58 bytes
```
for x (${(u)@})<<<$x&&argv[$@[(i)$x]]=
<<<"
${*:+`$0 $@`}"
```
[Try it online!](https://tio.run/##qyrO@J@moanxPy2/SKFCQUOlWqNU06FW08bGRqVCTS2xKL0sWsUhWiNTU6UiNtaWCyiuxKVSrWWlnaBioKDikFCr9F@TiytNwVDBSMFYwQSJNgaxQBrUbYFAHaoGho0VjP8DAA "Zsh – Try It Online")
Yay, recursion!
For each element `$x` of `(u)`nique `${@}`rguments, print it, and set the first `(i)`nstance of it to the empty string.
Finally, print a newline as a list delimiter, and if the remaining arguments are nonempty, substitute `$0 $@`, which is this program, called with all remaining nonempty elements.
[Answer]
# [R](https://www.r-project.org/), 41 bytes
```
split(sort(s<-scan()),sequence(table(s)))
```
[Try it online!](https://tio.run/##K/r/v7ggJ7NEozi/CEjY6BYnJ@ZpaGrqFKcWlqbmJadqlCQm5aRqFGtqav43VDBWMFEwUjBTMFUwVLAA8iz@AwA "R – Try It Online")
Like [Robin Ryder's answer](https://codegolf.stackexchange.com/a/197347/67312), this makes use of `table` to get counts of the unique elements in the input.
A fuller explanation to follow.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 4 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
{γζþ
```
[Try it online](https://tio.run/##DcYxDoAgDEDRC/2BFgpyFuOgiafwWCaOLOxcqXZ5ecnOS273Z73rm8N9NzqiGEoTNFNo8coWlrCTqBY1Mnr8) or [verify all test cases](https://tio.run/##MzBNTDJM/V9Waa@k8KhtkoKSfeX/6nObz207vO@/zv/oaEMd4qBRrA5QrbGOiY6RjpmOKVDEAsizAIqa6ljqGBoBhYx0zIHqQErMwYosgKQJkLTUMdAxMwUyTYE6jGJjAQ).
**Explanation:**
```
{     # Sort the (implicit) input-list
      #  i.e. [5,9,12,5,2,71,23,4,7,2,6,8,2,4,8,9,0,65,4,5,3,2]
      #   → [0,2,2,2,2,3,4,4,4,5,5,5,6,7,8,8,9,9,12,23,65,71]
 γ    # Group it into chunks of the same subsequent value
      #  → [[0],[2,2,2,2],[3],[4,4,4],[5,5,5],[6],[7],[8,8],[9,9],[12],[23],[65],[71]]
  ζ   # Zip/transpose; swapping rows/columns, with a space character as filler by default
      #  → [[  0, 2,   3,   4,   5,   6,   7,   8,   9,  12,  23,  65,  71],
      #     [' ', 2, ' ',   4,   5, ' ', ' ',   8,   9, ' ', ' ', ' ', ' '],
      #     [' ', 2, ' ',   4,   5, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '],
      #     [' ', 2, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']]
   þ  # Remove all spaces by only keeping digits
      #  → [[0,2,3,4,5,6,7,8,9,12,23,65,71],[2,4,5,8,9],[2,4,5],[2]]
      # (after which the result is output implicitly)
```
[Answer]
# [C (gcc)](https://gcc.gnu.org/) with `-m32` flag, ~~231~~ ~~213~~ ~~210~~ 209 bytes
Thanks to ceilingcat (-22 bytes) for the suggestions.
The function goes through the list of values and builds a reverse list of the unique values, incrementing its count on a match. After the list has been built, the function then goes through the list again, printing any values that have a non-zero count and decrementing the count: It repeats this until all values have a zero count.
```
g(v,c,p)int*v,*p;{int*i=p,w[3]={p,*v,!c};if(c){for(;i&&i[1]-w[1];i=*i);2[i=i?:w]++;g(++v,--c,p=i-w?p:i);}else for(;w[2];p=*w)for(w[2]=!puts("");p;p=*p)p[2]?printf("\t%d",p[1]),p[2]-=w[2]=1:0;}f(v,c){g(v,c,0);}
```
[Try it online!](https://tio.run/##jVFdb6MwEHznV7ickmK8VECaNo3PzQ9J88CZj2xEwAoJSIe4n350DW1Pd08npJV3dnZmbHRQaD2OhdeCBsOxuvot@Eb29oTKQLdfHVRvgOA7PUjMPc37vL54EpdL3EeHoKMiUfnIZbxHhbttdxBCFp4QLQQBySoMup3ZEmHIyiZj03q3jw/SKL/jtrWdujO3a@O5LpfGTgw3hO7MhbLknvt2XaQuGHLjYAeBmpaibSiH3Obn/XyNkHzGb1jp8pZm7HtzTbF@OL46f0El/vgXI5/CYg75sXOCldfWmHLWO4zpY3JhPlaUEJivJUGW5bdJ2QDT9a0iHIGdpEOj6YLsV6OTioIvzo0LbDktc8nyS5Z5czNrz/xJQ0Wg1TSTTCuKpI80AXYP97SphfjwEoJPRozZAEonZVnrWQIa/JnVOTmQvvwjP8sCqpMKJWvmbCTtLlJYVBTQKgm0FssTfw2tnTp92tAD25tODh@qXz@LusEZxgj@74udCFbwCDE8wZr6DXUbZw0vEMUExPBMHEt4nigbqo9UXyCEpzUd18SPf@u8TIpmDM6reAy6dw "C (gcc) – Try It Online")
[Answer]
# [C++ (clang)](http://clang.llvm.org/), ~~230~~ \$\cdots\$ ~~198~~ 162 bytes
Saved 11 bytes thanks to @ErikF!!!  
Saved ~~8~~ a whopping 44 bytes thanks to [ceilingcat](https://codegolf.stackexchange.com/users/52904/ceilingcat)!!!
```
#import<bits/stdc++.h>
void f(std::vector<int>v){for(;v.size();puts(""))for(int e:std::set<int>(&v[0],&*end(v)))printf("%d ",e),v.erase(find(begin(v),end(v),e));}
```
[Try it online!](https://tio.run/##lZDLboMwEEX3fIVF1chuJmlCQx5A@ZE2CwImtRRsZBsvGvnb08HpI@qqHUsec@dcc6Hu@1l9quTxcrkTXa@0LQ7Cmkdjm3o6nb@VkVOiIS1FIcscr63ShZC2dOzcKk1zNzfinVOW94M1NI4ZG2UkCM@Cx3AbDHTiXhZ7mDxw2VDHGOs1yi2N7xsSA2fg5lxXhtNWIHDgRyERgyuNc5Z7jCjr09BwUghlrOZVV0bjq7oKYUbOEcG6Tfo7dUksN9aQ5092rPMS/rYSD1@eW/MTrCCBNaSIbPFp6@FnnMIOlgnOEtjgDSO7CfQW9xXuO1jAOsVjitbEB6fPQ8MfSWg1WBVCk@yand1Eb@kosfxbCN9bq8GSoiDx7N/1KuPrZT4KTXM7aEkWeeQvHw "C++ (clang) – Try It Online")
Basic port of @xnor's algorithm without the clever stuff.
[Answer]
# [Husk](https://github.com/barbuz/Husk), 3 bytes
```
TkI
```
[Try it online!](https://tio.run/##Dca5DcAgEEXBhl4AC8tRgnNniNwSoeX6vzcZzfO9R7rPJWk5k2w4Rs9YodLjjRHWcJJoHnUKtn8 "Husk – Try It Online")
Key on value, then transpose.
[Answer]
# [Perl 5](https://www.perl.org/) `-a`, 46 bytes
```
say%k=()while s/\d+/$k{$&}++?$&:(say$&)&&''/ge
```
[Try it online!](https://tio.run/##K0gtyjH9/784sVI121ZDszwjMydVoVg/JkVbXyW7WkWtVlvbXkXNSgOoQEVNU01NXV0/PfX/f0MFYwUTBSMFMwVTBUMFCyDP4l9@QUlmfl7xf11fUz0DQ4P/uokA "Perl 5 – Try It Online")
Input is on one line, whitespace separated.
Output is one element per line with a blank line between groups.
]