text:
Write a Magic Spellchecker
The game Waving Hands is somewhere between a pen-and-paper Magic: the Gathering and a very elaborate Rock Paper Scissors. Each turn you write down one of eight gestures for each hand:

wiggled Fingers
proffered Palm
Snap
Wave
Digit pointing
Clap
staB
Nothing

There are few important rules that take precedence over the rest:

If both hands gesture P you automatically surrender. (This is a simplification, but we'll go with that.)
Only one hand at a time can gesture B.

A series of gestures performed by the same hand can cast a spell, where each spell is tied to one particular sequence. These sequences can overlap, but each gesture can only be used as the final gesture of a single spell (so you can create up to two spells in a single turn). Some spells require a gesture to be made with both hands simultaneously.
Your task is, given a list of gestures for each hand, to determine which spells could be cast in the current turn. For each hand, the last letter in the list represents the gesture chosen for the current turn.
Here is the list of gesture sequences. Upper case letters refer to a gesture performed by a single hand, lower case letters refer to a gesture performed with both hands.
B           Stab
cDPW        Dispel magic
cSWWS       Summon elemental
cw          Magic mirror
DFFDD       Lightning bolt
DFPW        Cure heavy wounds
DFW         Cure light wounds
DPP         Amnesia
DSF         Confusion
DSFFFc      Disease
DWFFd       Blindness
DWSSSP      Delayed effect
DWWFWc      Raise dead
DWWFWD      Poison
FFF         Paralysis
FPSFW       Summon troll
FSSDD       Fireball
P           Shield
p           Surrender
PDWP        Remove enchantment
PPws        Invisibility
PSDD        Charm monster
PSDF        Charm person
PSFW        Summon ogre
PWPFSSSD    Finger of death
PWPWWc      Haste
SD          Missile
SFW         Summon goblin
SPF         Antispell
SPFPSDW     Permanency
SPPc        Time stop
SSFP        Resist cold
SWD         Fear
SWWc        Fire storm
WDDc        Lightning bolt
WFP         Cause light wounds
WFPSFW      Summon giant
WPFD        Cause heavy wounds
WPP         Counterspell
WSSc        Ice storm
WWFP        Resist heat
WWP         Protection from evil
WWS         Counterspell

Yes, Lightning bolt and Counterspell have two different sequences each.
You may write a program or function, taking input in any convenient list or string format, via STDIN, command-line argument or function argument, as long as it's not pre-processed. You may output pairs of spells via return value or by printing to STDOUT. Again, you may use any convenient list or string format, as long as the output is unambiguous.
You may assume that the sequences for left and right hand are the same length, and that they are valid (in particular, B will never be performed by two hands at the same time). Note that the input will only contain upper case letters. Lower case letters are only used in the above list to indicate that both hands need to perform the same (upper-case) gesture.
For spells which end in a two-hand gesture you should just output a single spell. If one hand cannot perform a spell, this needs to be indicated by a string containing only a hyphen, -.
This is code golf, so the shortest answer (in bytes) wins.
Examples
Each example consists of three lines: the left hand sequence, the right hand sequence (both input; the right-most gesture is the most recent one), and the list of all possible spell combinations (the output).
WFP
WWS
[["Cause light wounds","Counterspell"],["Shield","Counterspell"]]

SD
BB
[["Missile","Stab"]]

WWP
WPP
[["Surrender"]]

DFW
CCW
[["Cure light wounds","-"]]

FFW
WWF
[["-","-"]]

DCW
CCW
[["Magic mirror"]]

WFPSFW
PPDDPP
[["Summon goblin","Shield"],["Summon ogre","Shield"],["Summon troll","Shield"],
 ["Summon giant","Shield"],["Summon goblin","Amnesia"],["Summon ogre","Amnesia"],
 ["Summon troll","Amnesia"],["Summon giant","Amnesia"]]

BSWWS
CSWWS
[["Counterspell","Counterspell"]]

CSWWS
CSWWS
[["Counterspell","Counterspell"],["Counterspell","Summon elemental"],
 ["Summon elemental","Counterspell"],["Summon elemental","Summon elemental"]]

PWPWWC
BBSPPC
[["Haste"],["Time stop"]]

@TheBestOne "in particular, B will never be performed by two hands at the same time"

CJam, 987 931 925 663 bytes
qN/:Q;"Üãã0Ð¨¬Áó:-/ð1$½Ï¶¶òu´dóá3äÑì?´ì>³3cïCà×M×âÀCÒû¬u?xO,ÆFv)pÙû!¼ eÖUÈRÙnÂo/µ¾H¼RÎÚç¡ñ>z"32f-222bCb" BcDPWSwFdps"f=S/"[zõs¢@>2¯f¥sy<éSGÆÄbÚØÜ}}¤ºÅd¸(EWfa¤éõbfXpÀS7éÛM¼å© Ñæ¶a«I³þ>ÙÜ¡/¦$lâ µãÆØ¢§&á¼óÀwÏU¤ôYðçQòÔR#pÓzP×°~ï]v«viÚY¶¨¯`|o(Nê@æGÏ]ÌÉþMNÒÀ2yÌgÊ]Ê4Ê|BÃKWãIowIQ£Í-,_¥÷¶ºK-;Kr ÕtVæWï÷¦?+ÜÌÜóË¯çp2Mvmc!hàtc»¬}sIæTÌÂ&ë6º²>Nº¯¦F¤½{ÜOSµ¸Ñ'|`²P³íD¿Z.c¢ Ò¿ñÅ¢MRöDk?à§iõ;¡k'çTÑñ"31f-225b26b97f+:c"j"Ser'z/{(eu\+}%]z_{{~SaQX={_QV=W):W=={_el+m*}{m*:s}?}/:s{S+2$S+#)1$"-":D?@@}%-2<}%1:V(:X(:W;\}2*m*{z_,1>{)__~=\Da&,!={a+}{;}?$W>}*~}%_&_,({[D_]a-}*_{{`D&,!},}:A~,{A}*_["Surrender"_]a:S&,{;S}*p

Note that this contain all ASCII characters of ASCII code 32 to 255 only. Some characters might be skipped by SE, so better to copy the code from the link above
This above code is a base converted version of the following 925 byte solution:
qN/:Q;
"B|Stab|cDPW|Dispel magic|cSWWS|Summon elemental|cw|Magic mirror|DFFDD|Lightning bolt|DFPW|Cure heavy wounds|DFW|Cure light wounds|DPP|Amnesia|DSF|Confusion|DSFFFc|Disease|DWFFd|Blindness|DWSSSP|Delayed effect|DWWFWc|Raise dead|DWWFWD|Poison|FFF|Paralysis|FPSFW|Summon troll|FSSDD|Fireball|P|Shield|p|""Surrender":R"|PDWP|Remove enchantment|PPws|Invisibility|PSDD|Charm monster|PSDF|Charm person|PSFW|Summon ogre|PWPFSSSD|Finger of death|PWPWWc|Haste|SD|Missile|SFW|Summon goblin|SPF|Antispell|SPFPSDW|Permanency|SPPc|Time stop|SSFP|Resist cold|SWD|Fear|SWWc|Fire storm|WDDc|Lightning bolt|WFP|Cause light wounds|WFPSFW|Summon giant|WPFD|Cause heavy wounds|WPP|Counterspell|WSSc|Ice storm|WWFP|Resist heat|WWP|Protection from evil|WWS|Counterspell"]s'|/2/_
{{~SaQX={_QV=W):W=={_el+m*}{m*:s}?}/:s{S+2$S+#)1$"-":D?@@}%-2<}%1:V(:X(:W;\}2*
m*{z_,1>{)__~=\Da&,!={a+}{;}?$W>}*~}%_&
_,({[D_]a-}*_{{`D&,!},}:A~,{A}*
_[R_]a:S&,{;S}*p

Newlines are just for show. This can be golfed a lot, but at least I got it to pass all test cases -_- .
This took longer than expected.
UPDATE 1 - golfed the code part a bit. Still scope for more. The string part can also be golfed/base converted, but I will refrain from that now as all other answers are not doing that either.
UPDATE 2 - Done golfing the code, now time for compressing that string.
UPDATE 3 - Base converted the string to reduce the code size to 663 bytes (It can be reduced to 640 bytes, but then there are 0 to 31 ASCII code characters too, which are really hard to deal with and I will only reside to them when I get beaten again).
Try it online here

Python 2, 685
Defines a function f accepting two strings. Return value is the string Surrender if the player surrenders; otherwise, a set consisting of strings (which indicate two-handed spells), and length-2 tuples of strings (indicating separate spells for each hand).
Base64 encoded source:
I2VuY29kaW5nOkxhdGluCmV4ZWMiIiJ42mVTTWvjMBC951foJntxy+61iwtNjLqFLJhqQYeQg2KPbYEsBUlOGtrub98Zp6Efe7Lm6c2H3jyvy9Y0KVuWXCa940VT1arklYl7sGzUvWkQk0pJJEzj6B0DCyO4pC0vKiGqquRr0w/JGdeznbeJYKqxmgKwAfThxI5+cm2kiwtuKeUdr+uS340OotEYSYEs77opGu8wVlJKJFRg9QlaBl0HXHK1UUoobF97E4knBObVOmh7igarilpSv7exU/AWRxZS0sjCBNhpArCwHAzYFo+VwugRRn9cMAauGbRL9FS8mZNWgw4jw2IxQZhBcQH3EOYZPrX0fVwwhFSNTeXc1PUQmO9YCzpccrwg8LeJ0Vjkfczs/c4aLCdr7HDn0rwOO8fYFXk1hFE7nPGEoBTz2PjoxBpPL5Gki1wwjVMqulzpKX4VXX3WpzeaXorDVhf+5+UpWtIKA3z82zhKfeiMbMonCevgE64It8e64EcGBzOz5ZcC+eK+tHrctZrZIhTrm+f1Jm47H1hkxrE1Mx2z14DtjyZcclm8nvYodJbn2rUMt5eFzV+zLctIn8ulD1zz2xmiSoYqBY3KZxZcFvM8f10sz65vjqg/eZyNJgRMJO8J0cw/XDDoCGQyIdqSL3EdLfozvtkOKY8aObRJck59jCV/cAcTzc5Yk07z3hXxfmm0C62uxuCPGYHF5Pe0I7olIxIQRhSoqpr//yZ0P6IPzYWWL3CeK75ooWNdhrrlN015T4dimb/cZ6GwePgZIE3BbZqX5+ypOOUkxRNJcWauUSbWMkJPZ5TSzujr1XPWFm3+bRasyW+/568F2iQE3AQaf7uxm6sfKHs4f3jNt/9cMNXTZmIiIiIuZGVjb2RlKCd6aXAnKQ==

The source is of the formexec "eu352909HE%#NTHQh".decode('zip') which executes the following code:
L=dict(B='Stab',cDPW='Dispel magic',cSWWS='Summon elemental',DFFDD='Lightning bolt',DFPW='Cure heavy wounds',DFW='Cure light wounds',DPP='Amnesia',DSF='Confusion',DWSSSP='Delayed effect',DWWFWD='Poison',FFF='Paralysis',FPSFW='Summon troll',FSSDD='Fireball',P='Shield',PDWP='Remove enchantment',PSDD='Charm monster',PSDF='Charm person',PSFW='Summon ogre',PWPFSSSD='Finger of death',SD='Missile',SFW='Summon goblin',SPF='Antispell',SPFPSDW='Permanency',SSFP='Resist cold',SWD='Fear',WFP='Cause light wounds',WFPSFW='Summon giant',WPFD='Cause heavy wounds',WPP='Counterspell',WWFP='Resist heat',WWP='Protection from evil',WWS='Counterspell')
G=lambda l,r,L:{L[s]for s in L if l.endswith(s.upper())and all(r[~i]==s[~i].upper()or'a'>s[~i]for i in range(len(s)))}
B=dict(cw='Magic mirror',DSFFFc='Disease',DWFFd='Blindness',DWWFWc='Raise dead',PPws='Invisibility',PWPWWc='Haste',SPPc='Time stop',SWWc='Fire storm',WDDc='Lightning bolt',WSSc='Ice storm')
d='-'
def f(l,r):c=G(l,r,B)|G(r,l,B);return[c|{(x,y)for x in G(l,r,L)or d for y in G(r,l,L)or d}-{(d,d)*(len(c)>0)},'Surrender'][l[-1]==r[-1]=='P']

@FryAmTheEggman fixed.

Aha, neat use of sets to fix that :)

Java, 1565 1388
Call with java M %leftString %rightString. Outputs Surrender if player surrenders. Otherwise outputs string in this form bothHandSpell;oneHandSpell,oneHandSpell;.... Note, this is a one liner solution for a rather complicated problem. : )
class M{String[]a="B,cDPW,cSWWS,DFFDD,DFPW,DFW,DPP,DSF,DWSSSP,DWWFWD,FFF,FPSFW,FSSDD,P,PDWP,PSDD,PSDF,PSFW,PWPFSSSD,SD,SFW,SPF,SPFPSDW,SSFP,SWD,WFP,WFPSFW,WPFD,WPP,WWFP,WWP,WWS,-".split(","),b="Stab,Dispel Magic,Summon elemental,Lightning bolt,Cure heavy wounds,Cure light wounds,Amnesia,Confusion,Delayed effect,Poison,Paralysis,Summon troll,Fireball,Shield,Remove enchantment,Charm monster,Charm person,Summon ogre,Finger of death,Missile,Summon goblin,Antispell,Permanency,Resist cold,Fear,Cause light wounds,Summon Giant,Cause heavy wounds,Counterspell,Resist heat,Protection from evil,Counterspell,-".split(","),c="cw,DSFFFc,DWFFd,DWWFWc,PPws,PWPWWc,SPPc,SWWc,WDDc,WSSc".split(",");public static void main(String[]a){System.out.println(new M().s(a[0],a[1]));}int e,f,g,h,i,j,k,l,m,n;String s(String o,String p){if(m(o,p,"p")>0)return"Surrender";String q="";f=e=0;for(;f<10;f++)q+=(m(o,p,c[f])|m(p,o,c[f]))>0?"Magic mirror,Disease,Blindness,Raise dead,Invisibility,Haste,Time stop,Fire storm,Lightning Bolt,Ice storm".split(",")[f*(e=1)]+";":"";for(f=0;f<33-e;f++)for(g=f<1?1:0,h=0;g<32-h&m(o,p,a[f])>0;)q+=m(p,o,a[++g*(e=1)])>0?b[f]+","+b[g*(h=1)]+";":"";return q;}int m(String o,String p,String r){k=n=0;if(r=="-")n=1;if((i=o.length())<(j=r.length()))return n;for(;k<j;)n|=((o.charAt(l=i-j+k)|32)!=((m=r.charAt(k++))|32)|((m|32)==m&(p.charAt(l)|32)!=(m|32)))?2:0;return n==2?0:1;}}

Indented:
class M{

    String[]a="B,cDPW,cSWWS,DFFDD,DFPW,DFW,DPP,DSF,DWSSSP,DWWFWD,FFF,FPSFW,FSSDD,P,PDWP,PSDD,PSDF,PSFW,PWPFSSSD,SD,SFW,SPF,SPFPSDW,SSFP,SWD,WFP,WFPSFW,WPFD,WPP,WWFP,WWP,WWS,-".split(","),b="Stab,Dispel Magic,Summon elemental,Lightning bolt,Cure heavy wounds,Cure light wounds,Amnesia,Confusion,Delayed effect,Poison,Paralysis,Summon troll,Fireball,Shield,Remove enchantment,Charm monster,Charm person,Summon ogre,Finger of death,Missile,Summon goblin,Antispell,Permanency,Resist cold,Fear,Cause light wounds,Summon Giant,Cause heavy wounds,Counterspell,Resist heat,Protection from evil,Counterspell,-".split(","),c="cw,DSFFFc,DWFFd,DWWFWc,PPws,PWPWWc,SPPc,SWWc,WDDc,WSSc".split(",");

    public static void main(String[]a){
        System.out.println(new M().s(a[0],a[1]));
    }

    int e,f,g,h,i,j,k,l,m,n;

    String s(String o,String p){
        if(m(o,p,"p")>0)
            return"Surrender";
        String q="";
        f=e=0;
        for(;f<10;f++)
            q+=(m(o,p,c[f])|m(p,o,c[f]))>0?"Magic mirror,Disease,Blindness,Raise dead,Invisibility,Haste,Time stop,Fire storm,Lightning Bolt,Ice storm".split(",")[f*(e=1)]+";":"";
        for(f=0;f<33-e;f++)
            for(g=f<1?1:0,h=0;g<32-h&m(o,p,a[f])>0;)
                q+=m(p,o,a[++g*(e=1)])>0?b[f]+","+b[g*(h=1)]+";":"";
        return q;
    }

    int m(String o,String p,String r){
        k=n=0;
        if(r=="-")
            n=1;
        if((i=o.length())<(j=r.length()))
            return n;
        for(;k<j;)
            n|=((o.charAt(l=i-j+k)|32)!=((m=r.charAt(k++))|32)|((m|32)==m&(p.charAt(l)|32)!=(m|32)))?2:0;
        return n==2?0:1;
    }

}

Edit: Used Peter's suggestion to create a String array with less code.
Any hints to improve this would be appreciated.

This general technique will save you a few hundred chars.

JavaScript (ES6), 1070 941
Base64 encoded:
Zj0obCxyKT0+e3k9WyItIl0sRD1bXSxSPVtdLEw9W10sZD17fSxidG9hKGBK1pvQHQOKyl6XWZqCJzRwM9bRK6aaifV6V6Z6e1qXRxJZZLQxqCJzWaKuuivRzDQuKCG2eKeDVuiW3QMUUMPQK6t7WF5q/LXCi6d2zQMU9bQK6t7WWKCG3XCi6d2zQMVbQCad6yJrQM8/QKid+6yKifQKIXQOKx5qx7QKIUUVzQGWKd2d6yzQNYUV3QN6VrJ53V5995y3QNZJJI/RFqKx7V15p3QKZYVZzQ+iKyifQNZYVYPQ9qtqXFysis0FFF0Summon1troll0FPSFW0Fireball0FSSDD0Shield0P0Surrender0p0Remove1enchantment0PDWP0Invisibility0PPws0Charm1monster0PSDD0Charm1person0PSDF0Summon1ogre0PSFW0Finger1of1death0PWPFSSSD0Haste0PWPWWc0Missile0SD0Summon1goblin0SFW0Antispell0SPF0Permanency0SPFPSDW0Time1stop0SPPc0Resist1cold0SSFP0Fear0SWD0Fire1storm0SWWc0Lightning1bolt0WDCs0Cause1light1wounds0WFP0Summon1giant0WFPSFW0Cause1heavy1xcKLp3bNFjxQ9AqLp7Xq7KXpZdFjz9CHHtbLaK5tFkknNEXrIrLdYXmrdFlhT9D66LXnLYqJ9X66JtXr4pdFlj9AqLp7Xq7KXpZdFlkmApLnJlcGxhY2UoLzEvZywiICIpLnNwbGl0KDApLmV2ZXJ5KCh2LHgsYSk9PmRbeCUyfHxhW3grMV1dPXYpO2s9KGgsbyxHKT0+KG49ZFtzXSxxPWgubWF0Y2gocysiJCIsImkiKSkmJlsuLi5zXS5ldmVyeSgoYyxpKT0+ISh3PWMubWF0Y2goIlthLXpdIikpfHxoW2o9aStoLnNlYXJjaChxKV09PW9bal0pJiYodz9+fkQuaW5kZXhPZihuKT9EOltdOkcpLnB1c2gobik7Zm9yKHMgaW4gZCl7ayhsLHIsTCk7ayhyLGwsUik7aWYoRD09ZFsicCJdKXJldHVybiBEfVI9Ui0xP3k6UjtMPUwtMT95Okw7cmV0dXJuIEQtMXx8UiE9TD9MLnNvbWUocz0+Ui5zb21lKHQ9PiFELnB1c2goW3MsdF0pKSl8fEQ6RH0=

You run it by doing eval(atob("Zj0obCxyK...")) in the Firefox console.
Golfed code (may include characters not supported by Stack Exchange):
f=(l,r)=>{y=["-"],D=[],R=[],L=[],d={},btoa(`JÖÐÊ^Y'4p3ÖÑ+¦õzW¦z{ZGYd´1¨"sY¢®º+ÑÌ4.(!¶x§VèÝPÃÐ+«{X^jüµÂ§vÍõ´
êÞÖX Ýp¢éÝ³@Å[@&ë"k@Ï?@¨û¬ô
!t+jÇ´
!EÍ)Ýë,Ð5ÝzV²yÝ^}÷·@ÖI$Ñ¢±í]y§t
eYÍ¢+(@ÖXUÐö«j\\¬Í]ºi¨[k¢Ytô[AbæÚ]I ÃÑ(bzWt?D®®·§uêô§D^ÞÕéÜ©íéíÐðÖ?B'¾+"n)b·-?4
«Y¨Ë^¯CÒ=ªæÖ«²ô= ÅÑ+¦õ¢
ÞÐô[Ab«ÖõuæCÖ<TH=jË^ÐõYg42+,W´H=ºi¨X(nX§Ñ!VÐ   íÊ^]<]z¹éÜËDô[Dâíl¶tHóÜÑ¬Ëur]Ñ$?A^j½X=·µ²Ú+DYÍm)àÕº%·E
ÍjëÖX Ýp¢éÝ³E?D®j'ÖÝô[@ºÇµæ¯Ë\\(ºwlÑcÅ@¨º{^®Ê^]<ýqíl¶æÑdsD^²+-Ö·Eý®^rØ¨Wë¢m^¾)tYcô
§µêì¥éeÑe`).replace(/1/g," ").split(0).every((v,x,a)=>d[x%2||a[x+1]]=v);k=(h,o,G)=>(n=d[s],q=h.match(s+"$","i"))&&[...s].every((c,i)=>!(w=c.match("[a-z]"))||h[j=i+h.search(q)]==o[j])&&(w?~~D.indexOf(n)?D:[]:G).push(n);for(s in d){k(l,r,L);k(r,l,R);if(D==d["p"])return D}R=R-1?y:R;L=L-1?y:L;return D-1||R!=L?L.some(s=>R.some(t=>!D.push([s,t])))||D:D}

Since the spell dictionary consists of letters only, we can treat it as a base64-encoded string and use numbers as separators and spaces. I "decoded" the base64-like string into a binary string, which is 3/4 the size of the original.
Mildly ungolfed:
f=(l,r)=>{

// y - default array
// D,R,L - result arrays for Doublehanded, Right and Left
// d - dictionary mapping of spell combos to spell names
y=["-"],D=[],R=[],L=[],d={},

// split string on `0` and replace `1`s with spaces, to populate `d`
btoa(`<UGLY BINARY STRING>`).replace(/1/g," ").split(0).every((v,x,a)=>d[x%2||a[x+1]]=v);

// given a main hand, off hand, and result array to populate,
// decide if current combo `s` applies
k=(h,o,G)=>
    (n=d[s],q=h.match(s+"$","i")) // does `s` match the end of `h`, case insensitive?
    &&
    [...s].every((c,i)=>
        !(w=c.match("[a-z]")) ||     // is every letter of `s` not lowercase
        h[j=i+h.search(q)]==o[j]  // or (if lowercase), a match between the hands?
    )
    &&
    (w?                    // if the last letter so `s` was lowercase
        ~~D.indexOf(n)?    //   if D doesn't already have this spell
                       D   //      add it to D
                      :    //   else
                       []  //      add it to a throwaway array
      :G).push(n);         // else, add it to this hand's result array

for(s in d){
    k(l,r,L);    // test this spell against each hand
    k(r,l,R);
    if(D==d["p"]) return D  // if the doublehanded result is "Surrender"
                            // return immediately
}

R=R-1?y:R;   // replace empty arrays with ["-"]
L=L-1?y:L;   // (`[]-1` is -1, which is truthy, while ["foo"]-1 is `NaN`, falsy)

return D-1||R!=L         // if D is empty, or R and L not both empty,
                ?        //   add all pairwise R/L combos to D and return D
                 L.some(s=>R.some(t=>!D.push([s,t])))
                                                     ||D
                :D      //    otherwise, just return D

}

One golf I particularly like is testing for empty arrays with array - 1.

An empty array will produce a truthy value: [] - 1 => "" - 1 => 0 - 1 => -1 (truthy)
A filled array will produce a falsey value: ["foo"] - 1 => "foo" - 1 => NaN (falsey)


text:
Sharing pizza fairly
The difficulty with sharing pizza with friends is that it is hard to make sure that everyone gets the same amount of pepperoni on their slice. So, your task is to decide how to fairly slice a pizza so that everyone is happy.
Directions
Write a program that, given a list of the positions of pepperonis on a circular pizza and the number of slices to be made, outputs a list of the angles that the pizza should be cut at so that each slice has the same amount of pepperoni on it.

The pizza has only one topping: pepperoni.
Your friends don't care about the size of their slice, just that they are not cheated out of any pepperoni.
The pizza is a circle centered on the origin (0, 0) and with a radius of 1.
The pepperonis are circles that are centered wherever the input says they are centered and have a radius of 0.1
Take input as an integer that represents the number of slices to be made and a list of ordered-pairs that represent the positions of the pepperonis on a cartesian coordinate system. (In any reasonable format)
Output should be a list of angles given in radians that represents the positions of the "cuts" to the pizza (in the range 0 <= a < 2pi). (In any reasonable format) (Precision should be to at least +/- 1e-5.)
You can have partial pieces of a pepperoni on a slice (eg. If a pizza has one pepperoni on it and it needs to be shared by 10 people, cut the pizza ten times, all cuts slicing through the pepperoni. But make sure it's fair!)
A cut can (may have to) slice through multiple pepperonis.
Pepperonis may overlap.

Examples
Input:
8 people, pepperonis: (0.4, 0.2), (-0.3, 0.1), (-0.022, -0.5), (0.3, -0.32)

Possible valid output:
slices at:
0, 0.46365, 0.68916, 2.81984, 3.14159, 4.66842, 4.86957, 5.46554

Here is a visualisation of this example (everyone gets half a pepperoni):

More examples:
Input: 9 people, 1 pepperoni at: (0.03, 0.01)
Output: 0, 0.4065, 0.8222, 1.29988, 1.94749, 3.03869, 4.42503, 5.28428, 5.83985

Input: 5, (0.4, 0.3), (0.45, 0.43), (-0.5, -0.04)
Output: 0, 0.64751, 0.73928, 0.84206, 3.18997

Scoring
This is code-golf, so least number of bytes wins.

To what precision must submissions adhere to be considered valid?

@Rainbolt I would say that 4 or 5 decimal places should be enough. What do you suggest? I should add it to the question.

I'm not sure that every problem is solvable.  What if there are 7 slices and 3 pepperoni evenly spaced out?

@NathanMerrill Then everyone would get 3/7 of a pepperoni. :) (Size of the slices doesn't matter.)

@NathanMerrill It would look something like this. The lines are a little off because I did it by hand. (Sorry for pinging you twice. I missed a line on the first try.)

I didn't think through that.  I guess any configuration would work!

I don't understand what "pepperoni slices may overlap" means. I think it was a clearly enough written question before the last edit.

@feersum It just means that you should account for possibly being given input where pepperoni slices (radius 0.1) are overlapping based on their coordinates.

Ah, I was thinking that "slice" could only mean a slice of pizza, not a piece of pepperoni.

@feersum Yeah... I thought that may get confusing.

This question is tough as hell !

Pizza hat attempt failed. Ask an easier one next time. ;)

@Martin I will try to upload more examples today, but you will have to wait about 10 or 12 hours for it because at first I have a few hours of school and then I actually have to implement a solution (which I haven't done yet, but I think I have a good plan of attack).

Sharing pizza is overrated.

How about relaxing the precision to +/- 0.01 so people can solve this problem by drawing the pizza on 20 megapixel canvas.

Mathematica, 221 bytes
f=(A=Pi.01Length@#2/#;l=m/.Solve[Norm[{a,b}-m{Cos@t,Sin@t}]==.1,m];k=(l/.{a->#,b->#2})&@@@#2;d=1.*^-5;For[Print[h=B=0];n=1,n<#,h+=d,(B+=If[Im@#<0,0,d(Max[#2,0]^2-Max[#,0]^2)/2])&@@@(k/.{t->h});If[B>A,n+=1;Print@h;B-=A]])&

Ungolfed:
f = (
   A = Pi .01 Length@#2/#;
   l = m /. Solve[Norm[{a, b} - m {Cos@t, Sin@t}] == .1, m];
   k = (l /. {a -> #, b -> #2}) & @@@ #2;
   d = 1.*^-5;
   For[Print[h = B = 0]; n = 1, n < #, h += d,
    (
      B += If[Im@# < 0, 0, d (Max[#2, 0]^2 - Max[#, 0]^2)/2]
    ) & @@@ (k /. {t -> h});
    If[B > A, n += 1; Print@h; B -= A]
   ]
) &

This defines a function which takes as parameters the number of slices and a list of pairs for the peperoni coordinates, like
f[8, {{0.4, 0.2}, {-0.3, 0.1}, {-0.022, -0.5}, {0.3, -0.32}}]

It will print the slices to the console as it traverses the pizza.
On most pizzas, this is fairly slow, because (to achieve the required precision) I'm integrating the peperoni area from 0 to 2π in steps of 1e-5. To get a slightly less precise result in a reasonable amount of time, you can change the 1.*^-5 at the end to 1.*^-3.
How it works
The idea is to sweep out the slices of pizza while integrating over the area of the peperoni pieces covered. Whenever that area hits the required amount of peperoni per person, we report the current angle and reset the area counter.
To obtain the peperoni area swept out, we intersect the line with the peperoni to give use the two distances from the origin, where the line intersects with the peperoni. Since a line extends to infinity in both directions, we need to clamp these distances to non-negative values. This solves two problems:

Counting intersections with each peperoni twice, once positive and once negative (which would actually yield to an overall area of 0).
Counting only wedges of peperoni pieces which include in the origin.

I'll include some diagrams later.

Yep. This was my plan of attack. At least I can more easily make examples now! :D

I noticed that your implementation sometimes outputs one extra angle that would create an extra slice with no pepperoni on it. (for example with input: [8, {{0.4, 0.2}, {-0.3, 0.1}, {-0.022, -0.5}, {0.3, -0.32}}])

@kukac67 fixed.

source: Stack Exchange

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

sort: votes


text:
Mode (most common element) of a list
Write a snippet to calculate the mode (most common number) of a list of positive integers.
For example, the mode of
d = [4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8]

is 1, because it occurs the maximum of 5 times.
You may assume that the list is stored in a variable such as d and has a unique mode.
e.g.: Python, 49
max(((i,d.count(i))for i in set(d)), key=lambda x:x[1])

This is code-golf, so the shortest solution in bytes wins.

K5, 6 bytes
*>#:'=

The first (*) of the descending elements (>) of the count of each (#:') of the group (=). Step by step:
  i
4 3 1 0 6 1 6 4 4 0 3 1 7 7 3 4 1 1 2 8

  =i
4 3 1 0 6 7 2 8!(0 7 8 15
 1 10 14
 2 5 11 16 17
 3 9
 4 6
 12 13
 ,18
 ,19)

  #:'=i
4 3 1 0 6 7 2 8!4 3 5 2 2 2 1 1

  >#:'=i
1 4 3 7 6 0 8 2

  *>#:'=i
1

try it in your browser!

Python 2 - 18
max(d,key=d.count)

Since your python answer doesn't seem to print, I expect this is what you want.
Add 6 bytes for print  normally.

perfect, think @globby needs to see future :)

The great thing about this one is that it's not even golfy, it's just Pythonic. The only thing that's been golfed is a space between d, and key=.

@WChargin: Eh, Pythonic would be to avoid the quadratic runtime by using defaultdict(int) or Counter. Something like Counter(d).most_common()[0].

Matlab/Octave, 7 5 bytes
Unsurprisingly there's a built-in function for finding modes. As an anonymous function:
@mode

This returns the most commonly occuring element in the input vector with ties going to the smaller value.
Saved 2 bytes thanks to Dennis!

+1, clearly the right tool for the job. As it's a builtin, what happens if there's more than one number of highest frequency?

@steveverrill According to the documentation (type help mode): "If two, or more, values have the same frequency 'mode` returns the smallest."

Unnamed functions seem to be allowed (the accepted answer is one), so you could shorten this to @mode.

@Dennis Thanks! Though I admit it's a strange feeling to edit my first answer on the site.

Pyth - 6
eo/QNQ

Try it online.
Expects input on stdin like [4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8]. Ties are resolved by last occurrence because Python performs stable sorts.
Sorts the list by count the value in the list, then prints the last number of the list.
Q could be replaced with d if you initialized d to contain the value before e.g. =d[4 3 1 0 6 4 4 0  1 7 7 3 4 1 1 2 8)
Python-esque pseudo-code:
Q=eval(input());print(sorted(Q,key=Q.count)[-1])

Full Explanation:
            : Q=eval(input()) (implicit)
e           : ... [-1]
 o   Q      : orderby(lambda N: ...,Q)
  /QN       : count(Q,N)

Pyth's orderby runs exactly like Python's sorted with orderby's first argument being the key argument.

Mathematica, 25 bytes
Last@SortBy[d,d~Count~#&]

or
#&@@SortBy[d,-d~Count~#&]

As in the challenge, this expects the list to be stored in d.
or... 15 bytes
Of course, Mathematica wouldn't be Mathematica if it didn't have a built-in:
#&@@Commonest@d

Commonest returns a list of all most common elements (in case of a tie), and #&@@ is a golfed First@.

another case for mthmca

CJam, 11 10 bytes
A{A\-,}$0=

Assumes the array in a variable called A. This is basically sorting the array based on the occurrence of each number in the array and then picks the last element of the array.
Example usage
[1 2 3 4 4 2 6 6 6 6]:A;A{aA\/,}$W=

Output
6

1 byte saved thanks to Dennis!
Try it online here

A{A\-,}$0= is one byte shorter.

As of 0.6.5 it's doable in 8 bytes: Ae\$e_W=`

@MartinEnder Umm... nope. I knew you need to sort first.

@ErikGolferエリックゴルファー whoops, you're right, needs 9 bytes: $e\$e_W=`

Ruby, 22 bytes
d.max_by{|i|d.count i}

Basically a port of my Mathematica answer, except Ruby has a direct max_by so I don't need to sort first.

I was about to suggest d.max_by d.method:count but that's about a million (aka not even two) bytes longer. Still, it's worth noting that it's possible.

R, 33 25 bytes
Thanks @Hugh for the help shortening:
names(sort(-table(d))[1])

The original:
v=table(d);names(v[which.max(v)])

This calculates the frequency of each element in the vector d, then returns the name of the column containing the largest value. The value returned is actually a character string containing the number. It didn't say anywhere that that wasn't okay, so...
Any suggestions to shorten this are welcome!

names(sort(-table(d))[1])

Powershell 19
($d|group)[0].Count

(this asumes the array is already on $d)

J - 12 char
Anonymous function. Sorts list from most to least common, taking first item.
(0{~.\:#/.~)

0{ First of
~. Unique items
\: Downsorted by
#/.~ Frequencies

Try it for yourself.

This is really 10 bytes--the function can be assigned without the parens.

JavaScript (ES6) 51
Just a single line expression using the preloaded variable d. Sort the array by frequency then get the first element.
Nasty side effect, the original array is altered
d.sort((a,b)=>d.map(w=>t+=(w==b)-(w==a),t=0)&&t)[0]

As usual, using .map instead of .reduce because it's 1 char shorter overall. With .reduce it' almost a clean, non-golfed solution.
d.sort((a,b)=>d.reduce((t,w)=>t+(w==b)-(w==a),0))[0]

At last, a solution using a function, not changing the original array and without globals (62 bytes):
F=d=>[...d].sort((a,b)=>d.reduce((t,w)=>t+(w==b)-(w==a),0))[0]

Test In FireFox/FireBug console
d=[4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8]
d.sort((a,b)=>x.map(w=>t+=(w==b)-(w==a),t=0)&&t)[0]

Output 1
The d array becomes:
[1, 1, 1, 1, 1, 4, 4, 4, 4, 3, 3, 3, 0, 6, 6, 0, 7, 7, 2, 8]

&&t => |t..

Perl 6, 21 bytes
.Bag.invert.max.value

Example:
$_ = < 4 3 1 0 6 1 6 4 4 0 3 1 7 7 3 4 1 1 2 8 >».Int;

say .Bag.invert.max.value; # implicitly calls $_.Bag…

If there is a tie it will print the larger of the ones that tied.

The .Bag method on a List or an Array creates a quantified hash that associates the total count of how many times a given value was seen with that value.
bag(4(4), 3(3), 1(5), 0(2), 6(2), 7(2), 2, 8)

The .invert method creates a List of the pairs in the bag with the key and the value swapped. ( The reason we call this is for the next method to do what we want )
4 => 4,  3 => 3,  5 => 1,  2 => 0,  2 => 6,  2 => 7,  1 => 2,  1 => 8

The .max method on a List of Pairs returns the biggest Pair comparing the keys first and in the case of a tie comparing the values.
( This is because that is how multi infix:<cmp>(Pair:D \a, Pair:D \b) determines which is larger )
5 => 1

The .value method returns the value from the Pair. ( It would have been the key we were after if it wasn't for the .invert call earlier )
1

If you want to return all of the values that tied in the case of a tie:
say @list.Bag.classify(*.value).max.value».key

The .classify method returns a list of pairs where the keys are from calling the Whatever lambda *.value with each of the Pairs.
1 => [2 => 1, 8 => 1],
2 => [0 => 2, 6 => 2, 7 => 2],
3 => [3 => 3],
4 => [4 => 4],
5 => [1 => 5]

Then we call .max to get the largest Pair.
"5" => [1 => 5]

A call to .value gets us the original Pairs from the Bag ( just one in this case )
1 => 5

Then we use >>.key to call the .key method on every Pair in the list, so that we end up with a list of the values that were seen the most.
1

Python - 32
max((x.count(i),i)for i in x)[1]

Don't see an 18 character solution anywhere in the future to be honest.
EDIT: I stand corrected, and impressed.

05AB1E, 3 bytes
.MJ

Explanation:
.M  # Gets the most frequent element in the [implicit] input
  J # Converts to a string, needed as the program would output "[1]" instead of "1" without this.

If you want to store the array in a variable instead of using input, just push the array to the stack at the start of the program.
Try it online!

JavaScript, ES6, 71 bytes
A bit long, can be golfed a lot.
f=a=>(c=b=[],a.map(x=>b[x]?b[x]++:b[x]=1),b.map((x,i)=>c[x]=i),c.pop())

This creates a function f which can be called like f([1,1,1,2,1,2,3,4,1,5]) and will return 1.
Try it on your latest Firefox's Console.

Off-topic, but I just realized how relevant your username is to PCG.SE.  :P

@nyuszika7h heh. Although I have had this username long before I even know PPCG existed.

f=a=>(c=b=[],a.map(x=>b[x]++-1?0:b[x]=1),b.map((x,i)=>c[x]=i),c.pop()) is 1 byte shorter.

Dyalog APL, 12 characters
d[⊃⍒+/∘.=⍨d]
∘.=⍨d is the same as d∘.=d, reflexive outer product of =.  It creates a boolean matrix comparing every pair of elements in d.
+/ sums that matrix along one of the axes and produces a vector.
⍒ grades the vector, i.e. sorts it by indices.  (As the glyphs suggest, ⍒ grades in descending order and ⍋ would grade in ascending order.)
⊃ takes the first index from the grading—the index of the largest element of d.
d[...] returns that element.

+/∘.=⍨d counts for each element of d.  ⊢∘≢⌸d counts for each element of ∪d, so the indices don't correspond to those of d.  Counterexample: d←1 1 2 2 2.  To make it work: (∪d)[⊃⍒⊢∘≢⌸d] or (⊃⍒⊢∘≢⌸d)⊃∪d.

Jelly, 2 bytes
Æṃ

Try it online!
Jelly finally got a mode builtin! A non-builtin version however is 5 bytes:
ċ@Þ`Ṫ

Try it online!
How they work
Æṃ - Main link. Takes a list d on the left
Æṃ - Return the mode of d

Well that was unimpressive. How about the 5 byte, non-builtin version?
ċ@Þ`Ṫ - Main link. Takes d on the left
   `  - Use d as both the left and right argument to:
  Þ   -   Sort d by:
ċ@    -     Count occurrences in d
    Ṫ - Take the last element (i.e. the element with a maximal count in d)

C# - 49
Can't really compete using C# but oh well:
Assuming d is the array
d.GroupBy(i=>i).OrderBy(a=>a.Count()).Last().Key;

bash - 29 27 characters
sort|uniq -c|sort -nr|sed q

Using it:
sort|uniq -c|sort -nr|sed q
4
3
1
0
6
1
6
4
4
0
3
1
7
7
3
4
1
1
2
8
[ctrl-D]
5 1

i.e. "1" is the mode, and it appears five times.

sort|uniq -c|sort -nr|sed q saves a couple of characters

I posted the same answer, but you were faster :)

@pgy - thank you - have updated!

GolfScript, 10 bytes
a{a\-,}$0=

From this answer I wrote to Tips for golfing in GolfScript.  Expects the input in an array named a, returns result on stack.  (To read input from an array on the stack, prepend : for 11 bytes; to read input from stdin (in the format [1 2 1 3 7]), also prepend ~ for 12 bytes.)
This code works by iterating over the input array, subtracting each element from the original array, and counting the number of elements left.  This is then used as a key to sort the original array by, and the first element of the sorted array is returned.
Online demo.
Ps. Thanks to Peter Taylor for pointing out this challenge to me.

Java 8, 83 Bytes
d.stream().max((x,y)->Collections.frequency(d,x)-Collections.frequency(d,y)).get();

d must be a Collection<Integer>.

If Collections can be statically imported:
59 Bytes
d.stream().max((x,y)->frequency(d,x)-frequency(d,y)).get();

Jelly, 7 bytes
ṢŒrṪÞṪṪ

Try it online!
Longer than K :(
Assumes the first argument has the array. There are no variables in Jelly.

Haskell, 42 39 bytes
f s=snd$maximum[([1|y<-s,y==x],x)|x<-s]

Try it online!
Edit: Thans to Zgarb for -3 bytes

I think sum is unnecessary here.

@Zgarb Right, I actually used exactly the same trick in a previous answer. Thanks for reminding me!

JavaScript (Node.js), 45 bytes
x=>x.map(a=t=>a[t]=0+a[t]||[1+t]).sort()[0]-1

Try it online!
42 without 0 support

Bash + unix tools, 62 bytes
Expects the array in the STDIN. The input format does not count, as long as the numbers are non-negative integers.
grep -o [0-9]\*|sort|uniq -c|sort -n|awk 'END{print $2}'

Edited: escaped wildcard in grep argument. Now it can be run safely in non-empty directories. Thanks to manatwork.

Best if run in an empty directory. Otherwise [0-9]* may get expanded to matching file names.

Alternatively, put ' around the argument to grep.

Java 8 : 184 bytes
Stream.of(A).collect(Collectors.groupingBy(i -> i, Collectors.counting())).entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder())).findFirst().get().getKey();

Input A must be of type Integer[]. Note java.util.* and java.util.stream.* need to be imported, however in the spirit oneliner they are left out.

downvoting because of ... ?

I know it's been more than two years, but you can remove the spaces at (i->i,Collectors.counting()).

Haskell 78
import Data.List
import Data.Ord
g=head.maximumBy(comparing length).group.sort

If the imports are ignored, it's 45.

You can save 4 bytes by using point-free style and 2 bytes by using maximumBy instead of last.sortBy. The new code would become g=head.maximumBy(comparing length).group.sort.

1.) Anonymous functions are allowed, so you can drop the g=. 2.) You can replace maximumBy(comparing length) by snd.maximum.map((,)=<<length) which doesn't need to import Ord, for a total of 62 bytes: Try it online!

Perl, 27 bytes
$Q[$a{$_}++]=$_ for@F;pop@Q

Returns the last most common value in case of a tie.

jq, 29 characters
group_by(.)|max_by(length)[0]

Sample run:
bash-4.3$ jq 'group_by(.)|max_by(length)[0]' <<< '[4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8]'
1

On-line test

PHP, 53 50 bytes
<?=array_flip($c=array_count_values($d))[max($c)];

Run like this:
echo '<?php $d=$argv;?><?=array_flip($c=array_count_values($d))[max($c)]; echo"\n";' | php -- 4 3 1 0 6 1 6 4 4 0 3 1 7 7 3 4 1 1 2 8

Tweaks

Saved 3 bytes by making use of the freedom to assume the input is assigned to a variable d

Brachylog, 5 bytes
ọtᵒth

Try it online!
This isn't really a snippet, but I'm not sure what would be...
         The output is
    h    the first element of
   t     the last element of
ọ        a list of [value, number of occurrences] pairs corresponding to
         the input,
  ᵒ      sorted ascending by
 t       their last elements (the numbers of occurrences).

It fails for negative input

@garg10may Use an underscore instead of a hyphen, it should work that way

Clojure, 32 bytes
#(apply max-key(frequencies %)%)

(frequencies %) returns a hash-map, which can be used as a function. Given a key it returns the corresponding value :)
Equal length:
#(last(sort-by(frequencies %)%))

05AB1E, 2 bytes
.M

Try it online!

Zsh (builtins only), 55 57 62 bytes
for i ({0..9})c=${#${(M)A#$i}}&&((c>d?(d=c,m=i)));<<<$m

Try it online!   57B
No utils like sort, uniq, sed. Uses data from array A. The expression ${#${(M)A#$i}} counts elements of A, matching pattern $i. Then we just keep track of the biggest $c and matching $i. (note, Zsh is triggered by c>d?..., just ignore the guff on stderr)

Alternate, regex-ified solution, for 80B.
B+=(${(Mj::)A#$i}) constructs an array B with all ith elements joined, so in the given example the element 11111 is the longest.
for i ({0..9})B+=(${(Mj::)A#$i})
<<<${B[(r)${(l.${#${(O@)B//?/X}[1]}..?.)}]:1:1}

Sample code taken from the Zsh User Guide. Quote: "This chapter will appeal above all to people who are excited by the fact that print ${array[(r)${(l.${#${(O@)array//?/X}[1]}..?.)}] prints out the longest element of the array $array [...] This is for advanced students only (nutcases, if you ask me)."
PS: Here's a slightly more sensible way for 69B

Arturo, 32 bytes
$=>[m:maximum tally&[k,v][v]m\0]

Try it

Julia 1.0, 39 37 bytes
~d=argmax(@.sum(==(1:max(d...)),[d]))

Try it online!
The solution above works for positive integers. It can be adapted to handle 0:
Julia 1.0, 41 39 bytes
~d=argmax(@.sum(==(0:max(d...)),[d]))-1

Try it online!
-2 bytes thanks to MarcMush: use sum instead of count

This won't work if zero is the most common element

Great catch! I added a solution for all nonnegative inputs. Since the prompt only mentions positive integers and gives no example with mode 0, I'll also include the original solution.

Japt -h, 5 bytes
ü ñÊÌ

Try it
ñ@è¶X

Try it
ü ñÊÌ     :Implicit input of array
ü         :Group & sort
  ñ       :Sort by
   Ê      :  Length
    Ì     :Last element
          :Implicit output of last element

ñ@è¶X     :Implicit input of array
ñ         :Sort by
 @        :Passing each X through the following function
  è       :  Count the elements in U
   ¶X     :    Equal to X
          :Implicit output of last element

It sucks that Japt doesn't have a occurences builtin and than you have to use è¶

Nekomata, 2 bytes
ŢṂ

Attempt This Online!
Ţ   Tally
 Ṃ  Maximum by

Let's take the input [4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8] as an example.
Ţ returns two lists [4,3,1,0,6,7,2,8] and [4,3,5,2,2,2,1,1], where the first list contains the unique elements of the input, and the second list contains the number of occurrences of each element.
Ṃ finds an element in the first list with the largest corresponding element in the second list, and returns that element. In this case, the maximum of the second list is 5, and the corresponding element in the first list is 1, so Ṃ returns 1.

Scala, 32
d.groupBy(a=>a).maxBy(_._2.size)

C++ 119
int *a=std::max_element(x,x+n);int z=0,b=0,c=0;for(int i=0;i<=*a;i++){c=std::count(x,x+n,i);if(c>b){b=c;z=i;}}return z;

Full code and test:
#include <iostream>
#include <algorithm>
#include <vector>

int m(int *x,int n)
{
int *a=std::max_element(x,x+n);int z=0,b=0,c=0;for(int i=0;i<=*a;i++){c=std::count(x,x+n,i);if(c>b){b=c;z=i;}}return z;
}

int main()
{
int d[] = {4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8};
std::cout<<m(d,20);
return 0;
}

Ceylon, 67
E m<E>(E+l)=>(l.frequencies().max(increasingItem)else nothing).key;

This function works on any type of element, including Integers (though null elements are ignored). (And it is shorter than the same function for just integers.)
Formatted:
E m<E>(E+ l) =>
        (l
        .frequencies()
        .max(increasingItem)
            else nothing)
    .key;

The else nothing is needed, because the Ceylon compiler can't figure out that l.frequencies always is non-empty if l is nonempty (because in general, all elements of l could be null, and therefore discarded).
You can call this function like this:
print(m(4,3,1,0,6,1,6,4,4,0,3,1,7,7,3,4,1,1,2,8));

If you already have a list list, call it like this:
print(m(*list));

(This will unpack the list into arguments, and pass them to the function.)

Hassium, 94 Bytes
This example assumes that the array is stored in d
func main(){t,b=0;foreach(e in d){c=0;foreach(n in d)if(e==n)c++;if(c>b){b=c;t=e;}}println(t)}

See expanded and run online with test case here

Pyke, 10 bytes
D3m/DSe@R@

Try it here!

Thunno, \$ 11 \log_{256}(96) \approx \$ 9.05 bytes
ztcZZz;AJAK

Attempt This Online!
Thunno doesn't have a mode built-in so we have to implement it ourselves:
ztcZZz;AJAK  # Implicit input
zt           # Triplicate the (implicit) input
  c          # And get the count of each element
   ZZ        # Zip with the input
             # So we have a nested list of the form
             # [[count, element], [count, element], ...]
     z;      # And reverse-sort this list of lists
             # (so the first pair will be the mode)
       AJ    # Get the first pair
         AK  # And get the last item
             # Implicit output

Nibbles, 5 bytes (10 nibbles)
/+=~$,+`%@

  =~        # group and sort
    $       # the input
            # by
     ,      #   length of
      +     #   flattened
       `%   #   split
         @  #   the input
            #   by
            #   (implicitly) each element
 +          # then flatten this
/           # and output the first element
            # (by folding over list returning left-hand
            # argument at each step)

Thunno 2, 1 byte
Ṁ

Try it online!
Built-in.

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

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


text:
Create an array with repeated numbers
Challenge
Your task in this question is to write a program or a named function which takes a positive integer n (greater than 0) as input via STDIN, ARGV or function arguments and outputs an array via STDOUT or function returned value.
Sounds simple enough ? Now here are the rules

The array will only contain integers from 1 to n
Each integer from 1 to n should be repeated x times where x is the value of each integer.

For example:
Input:
5

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

The array may or may not be sorted.
This is code-golf so winner is shortest code in bytes.
Bonus
Multiply your score by 0.5 if no two adjacent integers in your output array are same.
For example for n = 5, one such configuration would be
[5, 4, 5, 4, 3, 4, 5, 2, 5, 3, 1, 2, 3, 4, 5]

APL, 4 characters
/⍨⍳⎕
How it works:
⎕ reads user input.  As for output, APL by default prints the result from every line.
⍳n is the integers from 1 to n.  Example: ⍳3←→ 1 2 3
/ means replicate.  Each element from the right argument is repeated as many times as specified by its corresponding element from the left argument.  Example: 2 0 3/'ABC'←→ 'AACCC'
⍨ is the commute operator.  When it occurs to the right of a function, it modifies its behaviour, so it either swaps the arguments (A f⍨ B ←→ B f A, hence "commute") or provides the same argument on both sides (f⍨ A ←→ A f A, a "selfie").  The latter form is used in this solution.

Bonus:
6-∊⌽⍳¨⍳⎕ (8 characters, thanks @phil-h)
⍳5 (iota five) is 1 2 3 4 5.
⍳¨ ⍳5 (iota each iota five) is (,1)(1 2)(1 2 3)(1 2 3 4)(1 2 3 4 5), a vector of vectors.  Each (¨) is an operator, it takes a function on the left and applies it to each item from the array on the right.
⌽ reverses the array, so we get (1 2 3 4 5)(1 2 3 4)(1 2 3)(1 2)(,1).
∊ is enlist (a.k.a. flatten).  Recursively traverses the argument and returns the simple scalars from it as a vector.

How about a 4-character expression? /⍨⍳n

As you wish, sir, I've updated the text.  But surely your objection must apply to other solutions that are not wrapped in functions?

If you write a full program, no need for a function name. But if you write a function, it has to be named. Most of the answers here are full programs (who read from STDIN and output to STDOUT) and all of which are functions, have names.

An expression is a full program.

A expression is not a full program if it requires you to edit the expression before running it. (for instance , to run your initial expression, one would have to add f← before and 5 after the expression)

I was referring to /⍨⍳n without the f← and 5.  And, of course, instead of n I can use ⎕ which means "ask the user for input".

Oh, if that was a full program taking input from user/STDIN and outputting/printing to STDOUT, then its fine. Obviously, I do not understand APL that much :)

Oh, I forgot to mention that APL by default prints the result of every expression, so the STDOUT bit is covered.  Quad (⎕) asks for user input and evaluates it, so if the user types a number, ⎕ will return that number.  Unfortunately this can't be tested at tryapl.org as it runs in a restricted environment and ⎕ is not available, but I've seen APL solutions to other challenges by other people that use ⎕ for input.

The question said bytes. Assuming you're using UTF-8, this is 10 bytes.

Dyalog APL comes in two flavours: "Classic" and "Unicode".  The Classic version has existed for decades, since before the Unicode standard appeared, and uses a custom byte-per-character encoding for the APL character set.  It is still supported, though its use is discouraged.  So, I'd like to use this as an excuse.  More broadly, I think in golfing we should be counting characters, not bytes.  The fact that the lowest code points in Unicode are occupied by the English-centric ASCII is a historical accident that shouldn't matter today.  Interestingly, APL was conceived before ASCII came out.

@ngn counting chars is not a good idea, as answers will generally become alphabet soup decodes. APL chars are counted as bytes because that encoding exists; this is well established on this site. This works with any byte encoding that existed prior to the question's asking.

@ngn: Can you explain your bonus answer? Because it can be done via: 5 4 3 2 1 5 4 3 2 5 4 3 5 4 5 or 6 minus each of 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1, which feels like it is not far from your initial answer.

@phil-h Excellent idea, thank you!  So, it can be done in 8 characters (6-∊⌽⍳¨⍳⎕) instead of my complicated 11...  I'll update the answer and add an explanation later today.

Ruby (recursive), 41 bytes * 0.5 = 20.5
def n(n,i=1);i>n ?[]:n(n,i+1)+[*i..n];end

Or using a lambda (as recommended by histocrat and Ventero): 34 bytes * 0.5 = 17
r=->n,i=n{i>0?[*i..n]+r[n,i-1]:[]}

(call using r[argument])

That's a really cool solution. You can save some bytes by making it a lambda instead of a method (n=->x,i=1{...n[x,i+1]...) and a few more with [*i..n].

By inverting the logic, you can drop the whitespace in the ternary: r=->n,i=n{i>0?[*i..n]+r[n,i-1]:[]}

Pyth, 9 bytes * 0.5 = 4.5
smrhQhdUQ

With help from @FryAmTheEggman
Try it online.

Explanation
s             reduce + on list
 m            map
  rhQhd       lambda d: reversed(range(d+1, Q+1)), over
       UQ     range(Q)

where Q is the input.

Shouldn't have helped you :D

Haskell, 31 characters = 15.5 score
f n=[y|x<-[n,n-1..1],y<-[x..n]]

27 characters without the bonus
f n=[x|x<-[1..n],_<-[1..x]]

Beaten by Proud Haskeller

your first solution is not correct.  A possible fix is g n = [y|x<-[n,n-1..1],y<-[x..n]]

@karakfa oops :-/ and thanks for the fix

My Haskell answer is just a tad lower than yours

Should I link to it from my solution, to promote it?

@JanDvorak I would like to, actually...

Python 2, 53 bytes * 0.5 = 26.5
i=n=input()
x=[]
while i:x+=range(i,n+1);i-=1
print x

Shamelessly borrowed @VisualMelon's idea

C, 22 = 44 bytes * 0.5
The function h takes two parameters. The first is an int specifying n. The second is an int* which is the output buffer.
h(n,o)int*o;{for(n&&h(~-n,o+=n);*--o=n--;);}

Test program
main(){
int wow[999],*i;
memset(wow,0,sizeof(wow));
h(6, wow);
for(i=wow;*i;i++)printf("%d ", *i);
}

I don't get it. Please explain?

@bacchusbeale Ok.. It recursively writes descending sequences from n to 0. Shorter sequences are written sooner, at a deeper level of recursion. If the argument n is 0, then n is falsey so there is no recursion, and only a 0 is written, which serves to mark the end of the array.

Pyth - 15 10 * .5 = 5
smr-QdhQUQ

Try it online.
Expects input on stdin. Independently discovered algorithm. Thanks @Sp3000 for helping me stick the last Q in there :P Also, irony? XD
Explanation:
Q=eval(input())       : implicit
s                     : The sum of...
 m      UQ            : map(...,range(Q))
  r-QdhQ              : range(Q-d,Q+1)

Nice solution. Is there ever a situation in which Pyth wouldn't win code golf? :)

@Alex Depending on the nature of the problem, stack based golfing languages (Golfscript, CJam) can cream it, it can also lose to library stuff (cough bash cough) ;)

Haskell, 34 bytes * 0.5 = 17
0%n=[]
i%n=[i..n]++(i-1)%n
g n=n%n

That's the first time I've ever used Haskell for golfing. Call with g <number>.

CJam, 12 15 bytes * 0.5 = 7.5
li_,f{),f-W%~}`

This is full STDIN-to-STDOUT program. It concatenates increasing suffixes of the 1 ... n range, which ensures that no two adjacent numbers are identical.
Test it here.

C# - 81 (161bytes * 0.5)
Simple job in C#, hopefully gets the no-neibouring-numbers bonus. Reads an int from stdin, writes out an array like the example to stdout.
class P{static void Main(){int n=int.Parse(System.Console.ReadLine()),m=n-1,i;var R="["+n;for(;m-->0;)for(i=m;i++<n;)R+=", "+i;System.Console.WriteLine(R+"]");}}

More readable:
class P
{
    static void Main()
    {
        int n=int.Parse(System.Console.ReadLine()),m=n-1,i;
        var R="["+n;
        for(;m-->0;)
            for(i=m;i++<n;)
                R+=", "+i;
        System.Console.WriteLine(R+"]");
    }
}

Examples output:
n = 5
[5, 4, 5, 3, 4, 5, 2, 3, 4, 5, 1, 2, 3, 4, 5]

I'm really trying to figure out a shorter C# solution but I just can't seem to get it... well done

You could create a var of System.Console maybe

@MarkKnol System.Console is static, you can't assign it to a variable, but in C# 6 or whatever is next, you will be able to do using System.Console; (using System; doesn't pay in this instance), not sure how I feel about this feature, will affect a lot of old golf questions for this reason precisely ;)

@VisualMelon Unless my math is wrong, using System; is 13 bytes and System.x2 is 14 bytes. You're saving 1 byte by using the using statement :)

@IchabodClay quite right, how embarrassing... I'll change that if I do anymore golfing on this, 1byte probably doesn't warrant an edit ;)

@IchabodClay it gets worse, using C=System.Console saves 3 bytes, and is probably what @MarkKnol meant (sorry!), shameful negligence on my part.

Also, according to the rules, you could just have the method itself instead of creating a complete program. Something like... this. (114 bytes with whitespaces and such removed. 57 bytes with bonus.)

@IchabodClay indeed; I prefer submitting full programs to functions, no good reason, IO just seems like part of the fun (I don't tend to use argv, either). Feel free to post a better scoring answer without these daft constraints!

Bash + coreutils, 28/2 = 14
Shamelessly stealing @pgy's idea and golfing:
seq -f"seq %g $1" $1 -1 1|sh

Pure bash (no coreutils), 30/2 = 15
Eval, escape and expansion hell:
eval eval echo \\{{$1..1}..$1}

GolfScript (14 bytes * 0.5 = score 7)
 ~:x,{~x),>~}%`

Online demo
I think this is probably similar to some existing answers in that it builds up the array concat( [n], [n-1, n], [n-2, n-1, n], ..., [1, 2, ..., n] )
Sadly I wasn't able to golf any further the arguably more elegant:
~:x]{{,{x\-}/}%}2*`

which puts the input x into an array and then twice applies {,{x\-}/}%, which maps each element in an array to a count down of that many elements from x.

Haskell, 14 = 28 bytes / 2
f n=n:[1..n-1]>>= \r->[r..n]

example output:
>f 5
[5,1,2,3,4,5,2,3,4,5,3,4,5,4,5]

24 bytes without the bonus:
f n=[1..n]>>= \r->[r..n]

could =<< help avoid the whitespace? I feel like it could, but I'd be surprised if you hadn't already considered that.

@JanDvorak If I would have used =<< I would need parentheses for the lambda

I'm  confused on when exactly lambdas need parentheses. Does the lambda header have the same fixity as >>=?

@JanDvorak They have no fixity; I'm not sure how accurate this rule is, but lambdas can only appear where operators can't (disregarding sections): after (, [, =, ,, after any operators, and the like

I guess neither lambdas nor operators can appear as patterns? let \x->y = (2+) in (x,y) seems kinda impossible.

@JanDvorak Operators can, if you consider function declarations as patterns. Remember let 2*5=1 in 2*5?

@JanDvorak And operators which are constructors can be patterns: data M=Int :- Int ; let a :- b = ...

JavaScript, ES6, 41 bytes
f=i=>[...Array(i).fill(i),...i?f(--i):[]]

This creates a function f which can be called like f(6) and it returns the required array.
This uses a recursive approach, where each iteration creates an array of i elements all valued i and concatenates an array returned by f(i-1) with stopping condition of i==0.
Works on latest Firefox.

vba, 76*0.5=38
Sub i(q)
For Z=1 To q:For x=q To Z Step -1:Debug.?x;",";:Next:Next
End Sub

you can lose 1 (0.5, technically) byte(s) by condensing For Z=1 To to For Z=1To

you can also condense Next:Next to Next x,Z

Wolfram Language (Mathematica), 26 * 0.5 = 13
-8 bytes thanks to @att.
Join@@Range[#,Range@#,-1]&

Try it online!

7 years late, but 26 * 0.5 :)

Haxe, 53 bytes
function l(v)return[for(i in 0...v)for(j in 0...i)i];

Works with l(6); because of array comprehension.
Test online http://try.haxe.org/#741f9

Jelly, 3 × 0.5 = 1.5 bytes
rRF

Try it online!
Explanation
rRF
r      Range from {input} to
 R       each number from 1 to {input}
  F    Flatten

For example, with input 3, the rR gives us a range from 3 to 1 (i.e. [3, 2, 1], then a range from 3 to 2 (i.e. [3, 2]), then a range from 3 to 3 (i.e. [3, 3]). Flattening that gives [3, 2, 1, 3, 2, 3]), which meets the problem specifications and has no adjacent numbers.

Husk, 4 bytes * 0.5 = 2
Σ↔ḣṫ

Try it online!
Explanation
Σ↔ḣṫ
   ṫ    range from input to 1, [5,4,3,2,1]
  ḣ     prefixes, [[5],[5,4],[5,4,3]...]
 ↔      reverse,  [[5,4,3,2,1],[5,4,3,2]...]
Σ       concat,   [5,4,3,2,1,5,4,3,2...]

read the rules again ;)

perl ,26 bytes
for(1..$n){print"$_ "x$_;}

Please post your score. Also, since this is code golf, you can save bytes by removing the extra spaces and the definition of $n.

This doesn't run for me under Perl 6.

@Alex , what is the error , works under 5.10

Unable to parse postcircumfix:sym<{ }>, couldn't find final '}' at line 3. Tried it on ideone.com.

@Alex , try this : C:\Windows\system32>perl -e "$n=5;for(1..$n){print qq($_ )x$_;};"
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

Doesn't work on ideone.com, which uses Perl 6, but it works on my local machine, which is running Perl 5. Your original also works on my local machine. It probably doesn't matter much, but if you felt so inclined, you could specify Perl 5 in your post. Anyway, nice work.

You should print in the following format : [1, 2, 2, 3, 3, 3] . Not space separated values

R, 44 *.5 = 22
f=function(n){r=0;for(i in 1:n)r=c(r,n:i);r}

A quick test
> f(1)
[1] 1
> f(2)
[1] 2 1 2
> f(3)
[1] 3 2 1 3 2 3
> f(4)
 [1] 4 3 2 1 4 3 2 4 3 4

What ? No TSQL ?

@Optimizer maybe later:)

C#, 114 99 * 0.5 = 49.5 bytes
(With a little help from VisualMelon's answer) Edit: and James Webster's comment
int[]A(int n){int m=n,i,c=0;var a=new int[n*(n+1)/2];while(m-->0)for(i=m;i++<n;)a[c++]=i;return a;}

Ungolfed:
int[] FooBar(int n)
{
    int altCounter = n, i, arrayCounter = 0;
    var returnArray = new int[n * (n + 1) / 2];
    while(m-->0)
        for(i = altCounter; i++ < n; )
            returnArray[arrayCounter++]=i;
    return returnArray;
}

There is an unsafe version that I shamelessly took from feersum's C answer, but I'm not 100% sure it fits within the rules since you have to allocate the memory before calling the method.
C# (unsafe), 82 * 0.5 = 41 bytes
unsafe void A(int n,int*p){int*z=p;int m=n,i;while(m-->0)for(i=m;i++<n;)z++[0]=i;}

Called as follows:
int n = 5, length = (int)((n / 2f) * (n + 1));
int* stuff = stackalloc int[length];
int[] stuffArray = new int[length];
A(n, stuff);
System.Runtime.InteropServices.Marshal.Copy(new IntPtr(stuffArray), stuffArray, 0, stuffArray.Length);
//stuffArray == { 5, 4, 5, 3, 4, 5, 2, 3, 4, 5, 1, 2, 3, 4, 5 }

Per VisualMelon's suggestion (thanks!), the unsafe code can be re-made with safe code which reduces the size even further! Still poses the question if the creation of the final result array is allowed to be done outside of the method.
C#, 72 * 0.5 = 36 bytes
void A(int n,int[]p){int z=0,m=n,i;while(m-->0)for(i=m;i++<n;)p[z++]=i;}

Nice work! For the per-allocated version, it's much cheaper to go safe and pass it the int[] straight off void A(int n,int[]p){int z=0,m=n,i;while(m-->0)for(i=m;i++<n;)p[z++]=i;} - I would agree it's probably a bit iffy, regarding the rules ;)

You shouldn't need to create a local pointer for the unsafe version, which cuts a good 8bytes out. Also, I might be missing the point, but should the last line of the unsafe calling code be System.Runtime.InteropServices.Marshal.Copy(new IntPtr(stuff), stuffArray, 0, length); ?

@VisualMelon That's what I get for not rechecking the names of variables after I rename them. Thanks for the heads up :D. Edited the answer to account for the shorter version in your comment.

You can chop a little off the safe version by inlining the length var a=new int[(int)((n/2f)*(n+1))]; I think that takes it down to 109

One more off by rewriting the calc as: (n*(n+1)/2)

@JamesWebster The outer parentheses can also be done away with. 2 more bytes! Thanks for the hints, I'll add them to the answer!

Are you sure that will be casting what you need @IchabodClay. I think I played around with that, but was left with integer division

@JamesWebster It should be fine, since n * (n + 1) is evaluated first, it will always be an even number that is divided by 2.

It's not though.. BODMAS/BIDMAS/etc, whichever you use... The division is done first.

@JamesWebster According to this MSDN article (near the bottom), operations are performed left to right. So, multiplication would be performed before division in this case.

That's interesting!

JavaScript, ES6, 66 bytes * 0.5 = 33
f=i=>(g=n=>[...Array(n).fill().map((v,x)=>i-x),...n?g(n-1):[]])(i)

Building on Optimizer's recursive approach, we can build descending runs of decreasing length, like [4,3,2,1, 4,3,2, 4,3, 4].
Instead of making same-value subarrays with Array(i).fill(i), we make undefined-filled subarrays of the appropriate length with Array(n).fill() and then change the values to a descending run using .map((v,x)=>i-x). Also, we define and recurse over an inner function g; the outer function f exists only to store the value of i while g recurses.

T-SQL, 176 * 0.5 = 88
Since you seemed to miss the T-SQL @Optimizer, here it is in all it's verbose glory :).
A couple of function options, a Scalar and a Inline Table Valued function.  The Scalar function uses while loops to recurse and returns a string of numbers, where the Inline Table Valued function uses a recursive CTE for a sequence and returns a table.  Of course these will never be competitive, so I haven't spent a lot of time golfing.
Inline Table Valued Function, 176 * .5
CREATE FUNCTION F(@ INT)RETURNS TABLE RETURN WITH R AS(SELECT @ N UNION ALL SELECT N-1FROM R WHERE N>0)SELECT B.N FROM R CROSS APPLY(SELECT TOP(R.N)N FROM R A ORDER BY N DESC)B

Called as follows
SELECT * FROM dbo.F(5)

SQLFiddle example
Scalar Function, 220 * .5
CREATE FUNCTION G(@ INT)RETURNS VARCHAR(MAX)AS BEGIN DECLARE @S VARCHAR(MAX),@N INT=1,@I INT,@C INT WHILE @N<=@ BEGIN SELECT @I=@N,@C=@ WHILE @C>=@I BEGIN SELECT @S=CONCAT(@S+',',@C),@C-=1 END SET @N+=1 END RETURN @S END

Called as follows
SELECT dbo.G(5)

SQLFiddle example

JavaScript(readable), 131 bytes
I'm new to Code Golf so this isn't the best
function f(n) {
    var arr = [];
    for(var i = 1; i <= n; i++) {
        for(var j = 0; j < i; j++) {
            arr.push(i);
        }
    }
    return arr;
}

JavaScript(less readable), 87 bytes
Minified using jscompress.com
function f(e){var t=[];for(var n=1;n<=e;n++){for(var r=0;r<n;r++){t.push(n)}}return t}

TECO, 25 bytes * 0.5 = 12.5
a\+1%a%b<qauc-1%b<-1%c=>>

The above barely beats the non-bonus version at 13 bytes:
a\%a<%b<qb=>>

05AB1E, 4 bytes * 0.5 = 2
L.s˜

Try it online!
L                             # Inclusive range
 .s                           # Suffixes
   ˜                          # Flatten

C#, 116 115 + 33 = 148 bytes
Not the shortest code, but... it works anyway :P
int[]l(int m){List<int>i=new List<int>();for(int j=1;j<=m;j++){for(int x=0;x<j;x++){i.Add(j);}}return i.ToArray();}

Requires this at the top of the file (33 bytes):
using System.Collections.Generic;

Un-golfed version:
int[] RepatedNumberList(int m)
{
    List<int> intList = new List<int>();
    for (int j = 1; j <= m; j++)
    {
        for (int x = 0; x < j; x++)
        {
            intList.Add(j);
        }
    }
    return initList.ToArray();
}

Bash with seq, expr and xargs = 59 / 2 = 29.5
Save it and run with the number as the first argument.
seq $1|xargs -n1 seq|xargs -n1 expr $1 + 1 -|sed 1d;echo $1

Great idea!  I stole it and golfed it significantly

J, 23 * 0.5 = 11.5
   f=.-;@(<@|.@i."0@>:@i.)
   f 5
5 4 5 3 4 5 2 3 4 5 1 2 3 4 5

J, 11
   f=.#~@i.@>:
   f 5
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5

23 * 0.5 is 11.5, not 10.5.

@ProgramFOX good catch. Are you going to edit, or should I? Not a great reason to downvote IMO.

@JanDvorak Just edited it. And I didn't downvote, I upvoted it even before I saw the mistake.

Now that the mistake has been fixed, should the bonus solution be moved to the bottom?

-1 Byte: f=.-[:;<@|.@i."0@>:@i., making the scores equal!

ECMAScript6, 67 * 0.5 = 33.5 bytes
f=n=>{a=[],b=0;while(c=n+b,n--){while(c-b)a.push(c--);b++}return a}

Pretty happy with this one...It's about a quarter the size of my original.
f(4) returns:
[ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Old answer:
f=i=>{a=b=Array;while(i)a=a.concat(b.apply(null,b(i)).map(e=>i)),i--;return a}

This is my first shot at code golf...I still want to get that 0.5x bonus. Any suggestions are welcomed!
Called with f(n).

You must be pretty new to JavaScript it self :) . (1) Remove brackets around argument d, (2) a=b=c=[] in for declaration part, (3) c[a].map(e=>a) (4) b.push(...c)

I made a shorter version before reading your comment, which I'll put in my post.
My experience with JS is mostly limited to DOM/style manipulation for simple web apps...and I've hardly used any of the new ES6 features until today.

JavaScript (ES6) 29 (58 * 0.5)
Edit remove ; thx @Optimizer
Q=o=>(m=>{for(n=o,r=[];n>m||++m<(n=o);)r.push(n--)})(0)||r

Test in FireFox/FireBug console
Q(9)

Output
[9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8, 7, 6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 9, 8, 7, 6, 5, 4, 9, 8, 7, 6, 5, 9, 8, 7, 6, 9, 8, 7, 9, 8, 9]

Ungolfed
Q=o=>{
  for(m=0,r=[];m<o;++m)
    for(n=o;n>m;)
      r.push(n--);
  return r
}

C#, 108 bytes * 0.5 = 54
List<int> f(int n){var r=new List<int>();int m=n-1,i;r.Add(n);for(;m-->0;)for(i=m;i++<n;)r.Add(i);return r;}

Thanks to VisualMelon for doing the hard work! I thought I'd try to squeeze it down as much as possible.
(114 bytes * 0.5 = 57, if you insist on using .ToArray() to return int[])

K (oK), 4 bytes
Solution:
&!1+

Try it online!
Examples:
&!1+5
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
&!1+6
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6

Explanation:
&!1+ / the solution
  1+ / add one to the input, 1+5 => 6
 !   / til, !6 => 0 1 2 3 4 5
&    / where, &0 1 2 3 4 5 => 1 2 2 3 3 3...

Python, 53 bytes ÷ 2 = 26.5
lambda n:[n-i%-~n%(i//n-~n)for i in range(n*~n//2,0)]
Attempt This Online!
Python 2 version, 51 bytes ÷ 2 = 25.5
lambda n:[n-i%-~n%(i/n-~n)for i in range(n*~n/2,0)]
Attempt This Online!
This uses ranges like many other answers here but groups them in pairs (longest,shortest);(2nd longest,2nd shortest) etc. That way we can use a closed form expression inside a flat loop.

Factor + grouping.extras, 35 * 0.5 = 17.5 bytes
[ [1,b] tail-clump reverse concat ]

Try it online!
           ! 5
[1,b]      ! { 1 2 3 4 5 }
tail-clump ! { { 1 2 3 4 5 } { 2 3 4 5 } ... }
reverse    ! { { 5 } { 4 5 } { 3 4 5 } ... }
concat     ! { 5 4 5 3 4 5 2 3 4 5 1 2 3 4 5 }

JavaScript (V8), 44 bytes
y=x=>x-1?y(x-1).concat(Array(x).fill(x)):[1]

Try it online!
Could probably be golfed more and probably similar to some other answers but might as well post it.

Vyxal, 8 6 4 bytes
ƛẋ;f

Try it Online!
Explained
ƛẋ;f
ƛ    # mapping lambda
 ẋ   # Repeat
  ;  # end lambda
   f # flatten

I think you mean Try it Online!

Also, Try it Online! for 4 bytes

Raku, 25 bytes * 0.5 = 12.5
{$_,|flat (1..$_-1)X..$_}

Try it online!
This generates the list consisting of the input number n, and the flattened list of ranges 1 .. (n-1), 2 .. (n-1), ..., n-2 .. n-1, n-1 .. n-1.

K (ngn/k), 12 bytes
,/{x#x}'1+!:

Try it online!
Short and sweet.
Explanations:
,/{x#x}'1+!:  Main function. Takes implicit input x via Right (:)
          !   Create a range between 0 to x (exclusive)
        1+    + 1 to each of them
       '      For each of the numbers in the range
  {   }       Execute a function that
     x        Takes the number as implicit argument x
   x#         And duplicate by themselves' amount of times
,/            Join together

CoffeeScript, 57
f=(n)->i=0;a=[];(j=0;a.push i while(j++<i))while(i++<n);a

Perl 5: 30 bytes / 2 = 15
Added one byte for the -p flag.
#!perl -p
$_=join$",map-$_..$',-$_..-//

Takes parameter on the input:
$ perl int.pl <<<5
5 4 5 3 4 5 2 3 4 5 1 2 3 4 5

Java (adjacent equals ok): 276 bytes
public class a{public static int[]b(final int c){final int d=(c+1)*c/2;final int[]e=new int[d];int f=1;int g=0;for(int i=0;i<d;i++){if(g==f){f++;g=0;;}
e[i]=f;g++;}
return e;}
public static void main(String[]args){final int q=new java.util.Scanner(System.in).nextInt();b(q);}}

Java (adjacent equals not ok): 442 * 0.5 = 221 bytes
public class a{private static int h=1;public static int[]j(final int k){final int[]l=new int[k+1];for(int i=1;i<=k;i++){l[i]=i;}
final int m=(k+1)*k/2;final int[]n=new int[m];for(int i=1;i<n.length;i++){n[i]=o(l,k);}
n[0]=k;return n;}
private static int o(final int[]p,final int q){if(h>q){h=1;}
while(p[h]==0){h++;}
p[h]=p[h]-1;return h++;}
public static void main(String[]args){final int q=new java.util.Scanner(System.in).nextInt();j(q);}}

OK then I removed the aim statement, submission now aligns with the criteria.

minified to comply with rules.

Most of the modifiers on your variables aren't needed.

Perl, 57 * 0.5 = 28.5
This entry is a subroutine named "l" (for "list"?)
sub l{$d=$n=shift;while($d){for($d--..$n){@a=(@a,$_)}}@a}

You can test it like this:
$"=", ";
@a=l(3);
print "[@a]\n"; # prints "[3, 2, 3, 1, 2, 3]"
@a=();          # needed because the function does not re-initialize @a
@a=l(5);
print "[@a]\n"; # prints "[5, 4, 5, 3, 4, 5, 2, 3, 4, 5, 1, 2, 3, 4, 5]"

A prior solution is shorter (45 characters), but doesn't print the output prettily so it was disqualified
$d=$n=<>;while($d){for($d--..$n){print"$_ "}}

For an input of 3, this one prints (with a trailing space):
3 2 3 1 2 3

On second thought, only the [] are required. You can get rid of the ,

JAGL Alpha 1.1 - 15 bytes
1Ti[r{d()+S*}/E

Explanation:
1Ti               Push 1, take input, and convert to integer
   [r             Increment and make a range
     {d()+S*}     Push a block that makes an array with x occurrences of x
             /E   Map over list and flatten

I can see this is your own language, mere two hours older than the question. I guess this is just a test of the language? Note you won't be able to use v 1.2 for this challenge, and it wouldn't be a good test of your language anyways. Oh, and the documentation needs to be vastly improved before a public release ;-)

I'll work on that. I haven't had much time to make the full documentation yet, but that will be the next step.
The language itself is a few days old, but the most recent update was released just a couple hours before the question.

Perl 48 * 0.5 = 24
$i=<>;$"=", ";@a=map{-$_..$i}-$i..-1;print"[@a]"

Test run:
$ ./repeated.pl <<< 5
[5, 4, 5, 3, 4, 5, 2, 3, 4, 5, 1, 2, 3, 4, 5]

Are you sure about <!-- language=lang-perl -->? The result doesn't seem right.

I know. $" makes the syntax highlight crazy :)

Can you rename the variable? Switch to lang-none?

Erlang, 56 Bytes * 0.5 = 28
f(I)->L=lists,L:flatten([L:seq(X,I)||X<-L:seq(I,1,-1)]).

Using a list comprehension, reverses the list using lists:seq(UpperBound, 1, -1) and for each element, creates a sequence using lists:seq(CurrentValue, UpperBound). The eventual list is then flattened.
Expanded:
f(I) ->
    lists:flatten([lists:seq(X, I) || X <- lists:seq(I, 1, -1)]).

Input: module_name:f(9).
Output: [9,8,9,7,8,9,6,7,8,9,5,6,7,8,9,4,5,6,7,8,9,3,4,5,6,7,8,9,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9]

Matlab, 44 * 0.5 = 22
function r=f(n);r=[];for i=1:n;r=[i:n,r];end

f(4) == [4     3     4     2     3     4     1     2     3     4]

Javascript, 63 * 0.5 = 31.5
F=n=>{r=[m=n];while(--n){r=r.slice(0,m-n).concat(n,r)}return r}

F(4) == [ 4, 3, 2, 1, 4, 3, 2, 4, 3, 4 ]

Nothing fancy, just concatenating arrays.

Tcl, 36 bytes
time {time {puts $i} [incr i]} $argv

Try it online!

Stax, 4 bytes * 0.5 = 2
R|]r

Run and debug it online! Note: To verify that is does indeed work, you'll need to step through the execution, as the values are printed as characters rather than numbers.
Explanation:
R|]r
R       Range [1..n].     Example: [1, 2, 3, 4]
 |]     List of suffixes: Example: [[1, 2, 3, 4], [2, 3, 4], [3, 4], [4]]
   r    Reverse.          Example: [[4], [3, 4], [2, 3, 4], [1, 2, 3, 4]]
        Implicit flatten and print (treating numbers as characters and concatenating).

Without the bonus (3 bytes):
R|]

or
R|[     (This does what you expect)

Java 8, 109 bytes (score: 54.5 bytes)
import java.util.*;

n->{List l=new Stack();l.add(n);for(int i=0,j;i<n-1;i++)for(j=i;j++<n;)l.add(j);return l;}

That's a lambda from int to List<Object>. The members are, of course, Integers.
Try It Online

Pyth, 6 bytes * 0.5 = 3
s>RSQS

Try it here!

Golang, 80 bytes
func n(a int)(r[]int){for i:=0;i<=a;i++{for j:=0;j<i;j++{r=append(r,i)}};return}

Ungolfed and readable:
func n(a int) (r []int){
    for i := 0; i <= a; i++ {
        for j := 0; j < i; j++ {
            r = append(r, i)
        }
    }
    return
}

Try it online!
Pretty straightforward solution and probably pretty bad.

Pyth, 17 bytes x 0.5 = 8.5
FbQ=+Y-SQSb)+eYPY

Possibly golfable. Explanation:
FbQ=+Y-SQSb)+eYPY
FbQ                For b in range(int(input()))
     Y             A variable containing an empty list
   =+              +=
      -            The set difference of
       SQ          [1, 2, ..., input()]
         Sb        [1, 2, ..., b]
           )       End function
            +eY    Append to the last element of Y
               PY  All but the last element of Y

So for example, putting 3 through the loop would yield [1,2,3,2,3,3], then the last five characters will transpose that final 3 to the beginning so no two numbers touch each other.

GolfScript, 14 bytes
~),1>{.[()]*}%

Try it online!

Add++, 9 bytes
L,Rdz£XbF

Try it online!
In most other languages, it might be worth going for the bonus by using things like prefixes etc. Not in add++.
Explained
L,Rdz£XbF
L,        # create a lambda that:
  R       # pushes the range [1...n] to the stack
   dz     # ... zips that with itself
     £X   # ... reduces each item by item repetition
       bF # ... and flattens that

brainf***, 98 bytes
[[->+>+<<]>>[-<<+>>]<-[[->+>+<<]>>[-<<+>>]<-<[-]<[->+>>+<<<]>>>[-<<<+>>>]<]<[->+>+<<]>>[-<<+>>]<-]

Try it online!
Takes input as first cell on tape and outputs onto the tape. I'm not sure if this is allowed but input and output is really painful in brainf*** so I'm presuming it's allowed. The example on TIO has header and footer code to print the values out because I couldn't find a way to dump the memory into the output.
If you consider that each brainf*** character only contains 3 bits of information (as there are only 8 possible characters), then it's only 98 * (3/8) = 36.75 bytes of information.
I would put an explanation but I wrote the code yesterday and have forgotten how it works since then.

GeoGebra, 44 33 bytes * 0.5 bonus = 22 16.5
n=4
l=Flatten(Zip(1…a,a,n…1))

Try It On GeoGebra!
My first time code golfing with GeoGebra :D and I gotta say, GeoGebra has a ton more built-in functions than Desmos. I think I'll start trying out GeoGebra a little bit more, it definitely has a lot of features. It's also surprisingly golfy, especially when it comes to lists!
But, I couldn't figure out how to get functions working properly in GeoGebra for some reason, so the input has to be changed by editing the value of n, and then pressing Enter. The code currently has a default input of n=4.

MathGolf, score: 2 (4 bytes \$\times \frac{1}{2}\$ bonus)
╒╒x─

Try it online.
Explanation:
╒     # Push a list in the range [1, (implicit) input]
 ╒    # Map each value to an inner list in the range [1, value]
  x   # Reverse this list of lists
   ─  # Flatten
      # (after which the entire stack is output implicitly as result)

APOL, 14 bytes
⭳(Ƒ(⧣ Ƒ(∈ ⋒)))
Explanation:
         Implicit print
⭳(       Flatten list
  Ƒ(     One-indexed list-builder for loop
    ⧣    Integer input
    Ƒ(   One-indexed list-builder for loop
      ∈  Loop item (of parent loop in this case)
      ⋒  For iterator (what's being iterated through)
    )
  )
)

Japt, 5 bytes * 0.5 = 2.5
õõU c

Try it
õõU c #
õ     # For all numbers X in the range [1, input]:
 õU   #  Generate the range [input, X]
    c # Flatten

A cheatier 3 byte version produces the same visible output, but that's only because Japt's default string representation of 2D arrays isn't very clear. Using the -Q flag reveals the real output.

Ruby, 34 bytes * 0.5 = 17
->n{(1..n).flat_map{[*n-_1+1..n]}}

Attempt This Online!

Thunno 2, 3 bytes * 0.5 = 1.5
RȷI

Attempt This Online!
Explanation
RȷI  # Implicit input          ->  5
R    # Range [1..input]        ->  [1,2,3,4,5]
 ȷ   # Map over each:
  I  #  Range [input..n]       ->  [[5,4,3,2,1],[5,4,3,2],[5,4,3],[5,4],[5]]
     # Sum (flatten) the list  ->  [5,4,3,2,1,5,4,3,2,5,4,3,5,4,5]
     # Implicit output

jot 23 | awk NF=OFS=\$_

1
22
333
4444
55555
666666
7777777
88888888
999999999
10101010101010101010
1111111111111111111111
121212121212121212121212
13131313131313131313131313
1414141414141414141414141414
151515151515151515151515151515
16161616161616161616161616161616
1717171717171717171717171717171717
181818181818181818181818181818181818
19191919191919191919191919191919191919
2020202020202020202020202020202020202020
212121212121212121212121212121212121212121
22222222222222222222222222222222222222222222
2323232323232323232323232323232323232323232323