14

brainfuck, 811 775 709 701 bytes >>-[-[--->]<<-]>--...<++++++++++.>>>>>>>>>>+[->>>>>>+<<,[[-<+<+>>]<----------[[-]->]-[+>-]<<<+[-<[-]>]<[-<+>>+<]++++++[->-------<]>>++++++[-<<++++++>>]>+<<-[<->&...


14

Whython, 84 77 bytes f=lambda a,*b:a+f" {'and %s are'%b?'is'%b} typing..."?f(a,f"{len(b)} others") Attempt This Online! This is my first answer in Whython, a horrible modification of Python I made. Its only new feature so far is ?, which is a short-circuiting exception [mis-]handling operator. Here I use it to handle the ...


14

Python 3.8 (pre-release), 57 bytes f=lambda S,p=1:S>[]and f(S[1:])+sum((p:=p^s%2)for s in S) Try it online! Similar to brute-force method below but should have better complexity. Python 3, 57 bytes f=lambda S:S>[]and~sum(S)%2+f(S[1:])+f(S[:-1])-f(S[1:-1]) Try it online! This is a brute force method based on inclusion-exclusion. Also works on ...


14

Haskell, 31 bytes -6 bytes thanks to @xnor. a=s 0b b=s 1$b<*" " s=scanl(+) Try it online! A178855 is the cumsum of A033485, while A033485 is the cumsum of 1, a(1), a(1), a(2), a(2), a(3), a(3), ..., where a is A033485 itself.


10

Python 3, 89 bytes lambda a,*b:a+f" {b and'and %s are'%[b[0],'%d others'%len(b)][len(b)>1]or'is'} typing..." Try it online! -2 bytes thanks to dingledooper


9

Python 2, 57 bytes z=1 for x in input():z+=1j+1-x%2*2*z%1j print abs(z*z)//4 Try it online! Thanks to dingledooper for saving 2 bytes with z%1j in place of z.real! 58 bytes z=p=1 for x in input():p*=1|x%-2;z+=1j+p print abs(z*z)//4 Try it online! 59 bytes t=e=o=0 for x in input():e+=1;exec"e,o=o,e;"*x;t+=e print t Try it online! 59 bytes n=0;...


9

Embrace the type errors Type parameter constraints can often be replaced by a well-placed //@ts-ignore comment: // 34 bytes type Head<T extends any[]> = T[0]; // 33 bytes //@ts-ignore type Head<T> = T[0];


8

Ruby, 59 ... 37 bytes ->l{*q=r=0,-1;l.sum{|n|q[r^=n%2]+=1}} Try it online! Finally found the time to implement Bubbler's advice.


8

APL (Dyalog Unicode), 15 13 bytes +/~2|∊+\¨,⍨\⎕ Try it online! ,⍨\⎕: Reversed prefixes of the input. +\¨: For each reversed prefix, get the cumulative sums. ∊: Flatten into a vector of sums. ~2|: For each sum, is it even? +/: Take the sum. Slightly longer, but more interesting alternative: +/,∘.(≤⍱2|-)⍨+\2+0,⎕ Try it online! 0,⍵: Prepend a 0 to the input....


8

Haskell, 44 bytes f a=sum[gcd 2s-1|s<-scanl1(+)=<<scanr(:)[]a] Try it online!


7

Vyxal ṡ, 32 bytes ḣ:[‛λ¬$ḣ[_?L‹‛÷„]‛λ½|_‛is]`Ȯ»... Try it Online! ḣ # Push the first item (first user) and the rest to the stack # The first item will remain on the bottom of the stack :[ ] # If the rest exists (More than one user) ‛λ¬$ # ...


7

05AB1E, 4 bytes ŒOÈO Try it online or verify all test cases. Explanation: Œ # Get the sublists of the (implicit) input-list O # Sum each inner list È # Check for each whether it's even O # Take the sum to get the amount of truthy results # (after which this is output implicitly as result)


7

x86-64 machine code, 21 bytes 31 c9 f7 e1 ff c1 f6 07 01 74 02 87 d1 01 c8 af ff ce 75 f0 c3 Try it online! Following the standard calling convention for Unix-like systems (from the System V AMD64 ABI), this takes the address of an array of 32-bit integers in RDI and the length of the array in RSI. Assembly: .text .global essa .intel_syntax noprefix essa: ...


7

TypeScript Types, 1807 1771 bytes //@ts-ignore type B<X="\0\x01\x02\x03\x04\x05\x06\x07\b\t\n\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\...


6

dprintf for conditional printing As you may know, printing something by a condition can be done with ?:, && or ||: cond&&printf("%d\n",n); cond||printf("%d\n",n); cond?:printf("%d\n",n); Another interesting idea is to use dprintf, which is the same as printf except that it takes an extra argument, specifying the ...


6

Pip, 52 bytes [POgg?["and"#c?[#g"others"]b"are"]"is""typing..."]Js (Or 50 bytes in Pip -s, which would use a flag to accomplish the same thing as the Js at the end.) Takes the names as separate command-line arguments. Try it online! Explanation One big list, with the exact contents depending on the number of ...


6

Haskell, 94 bytes g(a:x)=a++f x++" typing..." f[]=" is" f[x]=" and "++x++" are" f l=f[show(length l)++" others"] Try it online!


6

J, 17 bytes 1#.1#.(0=2|+/)\\. Try it online! (0=2|+/) Is sum even... \\. For each suffix list of each prefix list (so all sublists)? Returns a 0-1 matrix, and now we want to sum all the elements... 1#. Sum the rows... 1#. And sum the resulting list of sums.


6

Husk, 8 7 bytes #ȯ¬%2ΣQ Try it online! Explanation Q # consecutive subsequences # # count elements by ȯ # composed function ¬ # not Σ # sum %2 # mod 2 -1 bytes thanks to ovs


6

JavaScript (ES6),  44  41 bytes This is inspired by Bubbler's comment, but updates the sum \$n_0(n_0-1)/2+n_1(n_1-1)/2\$ on the fly rather than computing it afterwards. The number of 0's and 1's are stored in a[0] and a[1] respectively, with a[] initialized to [1,0]. a=>a.map(c=>t+=a[p^=c&1]++,a=[1,p=t=0])|t Try it online!


5

x86-16 machine code, 23 21 bytes 00000000: ac3c 617c 0e50 b028 aae8 f4ff 58aa e8ef .<a|.P.(....X... 00000010: ffb0 29aa c3 ..).. Listing: P2I: AC LODSB ; AL = next char, SI++ 3C 61 CMP AL, 'a' ; is alpha? 7C 0E JL IS_ARG ; if not, it's an argument 50 PUSH ...


5

R, 113 102 bytes Or R>=4.1, 95 bytes by replacing the word function with \. function(s,l=length(s)-1,`?`=paste)s[1]?"if"(l,"and"?"if"(l-1,l?"others",s[2])?"are","is")?"typing..." Try it online! It appears that paste chains nicely, so we can rename that to ? and use like string ...


5

Jelly, 5 bytes Ẇ§2ḍS Try it online! Similar to my Vyxal answer, but Jelly's builtins are nicer. A monadic link. Ẇ # Sublists § # Sum (vectorised) 2ḍ # Is divisisible by 2? (vectorised) S # Sum (non-vectorising)


5

Japt, 5 bytes ãx èv Try it ãx - subarrays reduced èv - number of evens


5

Wolfram Language (Mathematica), 36 34 bytes Tr[1-Mod[Tr/@Subsequences@#,2]]-1& –2 bytes from @alephalpha Try it online! There is an EvenQ test in Mathematica, but alephalpha's use of Mod saves 2 bytes relative to it: Count[Tr/@Subsequences@#,_?EvenQ]-1& Alternative 34-byte function from @att: Count[{a__/;2∣+a}]@*Subsequences


5

Haskell, 50 47 44 bytes g l=sum[1|t<-scanr(:)[]l>>=scanl1(+),even t] Try it online! thanks to @ovs for reminding me there's already an even function in Haskell (3 Bytes saved). saved 3 more bytes inspired by @Lynn answer and tip for golfing in Haskell sum Total of [1|t<- * list comprehension counting: scanr(:)[]l -tails >...


5

JavaScript (ES6), 31 bytes Returns the \$n\$-th term, 0-indexed. f=n=>n&&f(n>>1)+f(--n>>1)-~f(n) Try it online!


5

Jelly, 18 bytes Very inefficient, \$n=4\$ is just on the edge of timing out on TIO. Œc_/€²§QƑ pµŒPÇƇṪL Try it online! Commented: Œc_/€²§QƑ -- helper function; verify a set of pawn coordinates is valid Œc -- unordered pairs of coordinates _/€ -- reduce each pair by subtraction ² -- square all values § -- sum to get the ...


4

Jelly, 47 bytes ḢɓL,“¥ṃkŒ»ƊḷḊ?“ and ”;;“@k»ʋ;“ is”$ḷ?ṭ⁹“Æʋ@1'ɼ» Try it online! Full program, as it uses Jelly's smash-printing and nilad dumping. How it works ḢɓL,“¥ṃkŒ»ƊḷḊ?“ and ”;;“@k»ʋ;“ is”$ḷ?ṭ⁹“Æʋ@1'ɼ» - Main link. Takes a list of usernames U on the left Ḣ - Chop off the first username, B, and set U' to be ...


4

JavaScript, 77 bytes a=>a[0]+` ${(l=a.length-1)?`and ${l>1?l+' others':a[1]} are`:'is'} typing...` Try it online!


Only top voted, non community-wiki answers of a minimum length are eligible