text:
Find the number of integers in the range from 1 to N that ends with 2
Task
As input you have:

a positive integer N

And you should output:

The number of integers in \$[1,N]\$ (an inclusive range) which end with the digit \$2\$ in base ten.

Test cases
1 -> 0
2 -> 1
5 -> 1
10 -> 1
12 -> 2
20 -> 2
30 -> 3
54 -> 6
97 -> 10
100 -> 10

Rules
It is a code-golf so the lowest score in bytes wins!

This looks neat as a series of graphs.

Chameleon? (filler)

Python 2, 17 bytes
lambda n:(n+8)/10

Try it online! Uses Python 2's integer division. In Python 3 would be a byte longer with lambda n:(n+8)//10.

How'd you come up with this?

@S.S.Anne I noticed the result increases by one every 10 integers, so integer division by 10 was necessary. Then it was just a matter of finding the correct offset so that f(1)=0, f(2)=1

My first crack at it was lambda n:n/10+(n%10>1)

@Cruncher still a really nice try :D

Well done. My usual code golf experience is to formulate my answer and then look what the geniuses of code-golf-mastery have come up with and then stare aghast at my overall ineptitude. But today I got the same answer. It's the small wins in life.

@BellyBuster I thank you for your compliment. I wouldn't call myself a genius of code-golf-mastery... But even the both of us can come up with some really nice golfs every now and then :)

Jelly, 4 bytes
Ḋm⁵L

A monadic Link accepting a positive integer, N, which yields a non-negative integer.
Try it online!
How?
Every tenth number starting with \$2\$ ends with the digit \$2\$...
Ḋm⁵L - Link: integer, N                           e.g. 15
Ḋ    - dequeue (implicit range [1..N]) -> [2..N]       [2,3,4,5,6,7,8,9,10,11,12,13,14,15]
  ⁵  - literal ten                                     10
 m   - modulo slice                                    [2,12]
   L - length                                          2

Alternative 4 byter:
+8:⁵

Add eight, integer divide by ten (as first used in RGS's Python answer I believe).

Interesting method. Looks like the "add 8 then int-divide by 10" that everyone is doing is the same length: +8:⁵(TIO)

"as first used in RGS's Python answer I believe" :') also, I should really learn my Jelly atoms... 4 bytes is a really nice length :D

Perl 5 -pl, 13 10  bytes
@Grimmy got it back down to 10 bytes, with correct output.
$_+=1<chop

Try it online!

doesn't return 0 for 1

Isn't an empty string a form of 0? :)   I've fixed it.

10 bytes: $_+=1<chop. Properly outputs 0 for input 1 (relevant meta).

@Grimmy nice fix, i had 11 bytes but using -Minteger

This requires that the input has no trailing newline? Like the one you'd get if you run perl -pe '$_+=1<chop' and input a number..?

@ilkkachu That is correct.  Or, you can add a -l flag to the command line, as I have now done.

@Xcali, oo, I didn't remember -l chomps the newline on input too, thanks!

APL (Dyalog Unicode), 8 7 bytes
-1 byte thanks to Bubbler
Full program
⌊.1×8+⎕

Try it online!

-1 byte using .1×.

Jelly, 7 6 5 bytes
R%⁵ċ2

Try it online! Thanks to Nick Kennedy for saving me one byte.
How it works:
R      Range from 1 to n,
 %⁵    modulo 10.
   ċ2  Then count how many of those are 2.

R%⁵ċ2 saves 1

Retina 0.8.2, 15 13 bytes
.+
$*
.{2,10}

Try it online! Edit: Saved 2 bytes thanks to @Grimmy. Explanation:
.+
$*

Convert to unary.
.{2,10}

Count the number of multiples of 10, each of which contains an integer that ends in 2 in base 10, plus count an additional match for a final 2-9, as that's enough for one last integer that ends in 2 in base 10.

Haskell, 14 Bytes
f x=div(x+8)10

you can replace floor and / with div.

The point-free version (\div`10).(+8)` scores the same.

05AB1E, 4 bytes
8+T÷

Same approach as everyone else.
Try it online or verify all test cases.
Some (slightly) more interesting 5-bytes alternatives:
LT%2¢
L€θ2¢
L2Å¿O
FNθΘO

Try each online.
Explanation:
8+     # Add 8 to the (implicit) input-integer
  T÷   # Integer-divide it by 10
       # (after which the result is output implicitly)

L      # Push a list in the range [1, (implicit) input-integer]
 T%    # Take modulo-10 on each
       # or
 €θ    # Leave the last digit of each
   2¢  # Count the amount of 2s
       # (after which the result is output implicitly)

L      # Push a list in the range [1, (implicit) input-integer]
 2Å¿   # Check for each whether it ends with a 2 (I'm actually surprised it vectorizes..)
    O  # Sum to get the amount of truthy values

F      # Loop `N` in the range [0, (implicit) input-integer):
 N     #  Push `N`
  θ    #  Pop and leave only its last digit
   Θ   #  05AB1E trutify: check if it's exactly 1
    O  #  Sum all values on the stack together
       # (after the loop, the result is output implicitly)

I like the fact that you are "trutifying" in your last explanation. Almost like "making look like a trout"!

another four byte solution: <T/î

Python 3, 55 40 bytes
Any help with golfing it would be appreciated
lambda N:sum(x%10==2for x in range(N+1))

Lots of thanks to the commentors for helping me out( I have problems with memory, see names below)

can you help me then?

See the upper answer.

My best advice, for this challenge and in general, is to think about the problem and try to figure out a way to compute the result directly instead of iterating through all the numbers, etc. Iteration is slow, and sometimes it's the only solution - but very often there's A Better Way that you can find if you put some thought into it.

Welcome! Please see https://codegolf.stackexchange.com/questions/54/tips-for-golfing-in-python for golfing in Python, and observe patterns in other questions that might help you get an idea on the practices in code golfing. Note the objective is not just to solve the problem at hand (in fact, generally we borrow solutions already posted and port into other languages) but also to implement the solution as efficiently as possible.

If you wish to solve it this way, with iteration, you may be best off using list-comprehension and check the len, it's definitely not the best way to approach it. Also, it's often best to express it as a lambda function to save chars. Try it online!

Can you please format your answer correctly? There appears to be an extra four spaces of indentation as well as a newline

It doesn't work

lambda N:sum(x%10==2for x in range(N+1))

Desmos
I know I'm 7 months late but this is my first code golf answer. I'm looking for some easier coding challenges to take down. I have two answers(one where I tried it without looking at any answers, then one after I looked through some answers.).
First Answer, 62 bytes:
f(N)=\sum_{n=1}^N\left\{\operatorname{mod}(n,10)=2:1,0\right\}

Try it on Desmos!
Explanation:
f(N)=                                               a function taking in an argument of N
     \sum_{n=1}^N                                   summation from 1 to N
                 \left\{                            starting piecewise
                        \operatorname{mod}(n,10)=2: if the remainder of n/10 is 2...
1                                                   sum 1
 ,                                                  otherwise...
  0                                                 sum 0
   \right\}                                         end piecewise

Not too sure why I can't take out the \left and \right for the brackets({ and }). Theoretically it should work(I've taken out the \left's and \right's of all the other "left-right pairs"), but I guess Desmos doesn't allow it.
Second Answer, 20 18 bytes:
Saved two bytes thanks to @golf69
f(N)=floor(.1N+.8)

Try it on Desmos!
Explanation:
My answer is equivalent to f(N)=floor((N+8)/10), which is explained in RGS's comment under his answer.

18 bytes: f(N)=floor(.1N+.8)

@golf69 Thanks! I can't believe I didn't think to distribute the fraction...

W, 4 bytes
8+T/

Just another boring formula: Add eight, divide by 10. (W performs integer division if both operands are integers.)
W d, 5 bytes
[ⁿNy|

Uncompressed:
Tm2=Wk

Explanation
    W % For every number in the range [1 .. N]:
      % Keep all that satisfies:
Tm    % After modulo by 10,
  2=  % The result is equal to 2
     k% Find the length of that

2= is a really frequent operation, I need to make a built-in for that. :D Wk = K too...

Powershell, 50 20 bytes
1.."$args"-match"2$"

$args are arguments to pass as number.

I think that means you can omit the 1..50 and then your score would be 10 or 11.

@S.SAnne how to omit that? Please help I am new to code golfing.

$args is an array of arguments Try it online!. See docs

Thanks I knew it but didn't thought I can use it here.

Your objective is to make your byte count lower. Remove 1.."$args"- and then put something in the header to make it work.

You need to actually output the count. Simple Fix for +8 bytes

Julia 1.0, 12 bytes
x->(x+8)÷10

Try it online!

Kotlin, 25 bytes
{(1..it).count{it%10==2}}

Try it online!

Pyt [sic!], 3 bytes
Finally found the right language. I had a now-deleted answer in Vim, but it returned the empty string for an input of 1 :(
8+₀

Explanation:
8    In fact, I have no idea whether is this language stack-based, I guess it pushes 8
 +   add that 8 to the seemingly-implicit input
  ₀  divide by 10. There are also instructions to divide by numbers from 2 to 11 :)

Try it online!

Pyt? Maybe Pyth...

Japt -x, 6 bytes
The straightforward solution of adding 8 and floor dividing by 10 would be a byte shorter: +8 zA. But where's the fun in that?!
õ_ìÌ¶2

Try it
õ_ìÌ¶2     :Implicit input of integer U
õ          :Range [1,U]
 _         :Map
  ì        :  To digit array
   Ì       :  Last element
    ¶2     :  Is equal to 2?
           :Implicit output of sum of resulting array

Jelly, 10 7 bytes
ṾṪ=”2)S

Try it online!
But there's already 2 shorter answers I hear you say... Well, this doesn't use mathematics but rather uses strings

Scala, 11 bytes
n=>(n+8)/10

Try it online!

9 bytes: _.+(8)/10

Husk, 7 bytes
#ȯ=2→dḣ

Try it online!

Nice - but there's an even golfier way...

5 bytes. EDIT: Ah @DominicvanEssen already mentioned there is a shorter way, most likely referring to this.

@DominicvanEssen It was too boring to implement.

Haha I kind-of agree...  but did it anyway!

Husk, 5 4 bytes
Edit: -1 byte thanks to Jo King
hs+8

Try it online! or check all test cases
How?
            # implicit input
    +8      # plus 8
   s        # convert to string
  h         # remove last character
            # (so hs effectively divides by 10)

C (gcc), 17 bytes
f(n){n=(n+8)/10;}

Try it online!

PHP, 18 17 bytes
<?=$argn/10+.8|0;

Try it online!
-1 bytes thanks to @oxgeba

C (gcc), 17 bytes
f(n){n+=8;n/=10;}

Try it online!
Alternative 17-byter:
C (gcc), 17 bytes
f(n){n=n/10.+.8;}

Try it online!
Alternative 17-byter
C (gcc), 17 bytes
f(n){n=(n+8)/10;}

Try it online!

Clojure, 28 bytes
(defn e[n](int(/(+ n 8)10)))

Ungolfed:
(defn ends-in-two [n]
  (int (/ (+ n 8) 10)))

Test harness:
(println (e 1))
(println (e 2))
(println (e 5))
(println (e 10))
(println (e 12))
(println (e 20))
(println (e 30))
(println (e 54))
(println (e 97))
(println (e 100))

Try it online!

R, 18 15 bytes
Thanks @Giuseppe! Guess I didn't really know what the %/% operator did.
(scan()+8)%/%10

Try it online!

15 bytes?

%/% is integer division -- see here for details, under "Value" :-)

Python 3, 22 18 bytes
lambda n:(n+8)//10

Thanks to @JoKing for suggesting to use integer division.

This approach can be generalized for any digits 0..9. To note 8 = 10-2 then we can rewrite the function in this way lambda n,d: (n+10-d)//10.

Where  d is the digit to find in sequence.

GolfScript, 6 bytes
GolfScript has no decimal support, that's why the / works.
~8+10/

Try it online!

Pyth, 5 bytes
/+8QT

Try it online!
Explanation
/+8QT
   Q   : Variable containing evaluated input
 +8    : Add 8 to it
/   T  : Divide result of add by 10

Javascript (node) - 25 Bytes
f=n=>n?(n%10==2)+f(n-1):0

Try it online!

-1 byte: f=n=>n&&(n%10==2)+f(n-1)

13 bytes

JavaScript (V8), 15 bytes
f=n=>(n+8)/10|0

Try it online!

Stax, 4 bytes
8+A/

Run and debug it
Just a standard add 8, integer divide by 10

Burlesque, 7 bytes
8|+10|/

Try it online!
Using RGS's method
8|+  # Add 8 (Parse string implcit)
10|/ # Divide by 10

Burlesque, 10 bytes
riq[~GO2CN

Try it online!
ri   # Read int
q[~  # Boxed tail (last digit)
GO   # Generate from 1, N
2CN  # Count number of 2's

Rail, 87 bytes
$'main'
 -0(!a!)-/-(a)ia(!a!)\
#od[01]a*8(a)-\ /e-----@
@-(!a!)/      >-
  \m(a)[01]--/

Try it online!
Explanations:
0(!a!)         Put 0 into variable "a"
(a)ia(!a!)     Add "a" with input (one number at a time), put into variable "a"
e              check if it's EOF, then go left or right at the next junction

               if false:
[10](a)m(!a!)  multiply "a" by 10, put into variable "a"

               if true:
(a)8a[10]do#   add a with 8, then divide by 10, print the output. Fin.

The rest of symbols are tracks

Erlang (escript), 18 bytes
f(N)->(N+8)div 10.

Try it online!
Explanation
f(N)->  % Function taking N as input
(N+8)   % Add input by 8
div 10. % Floor division by 10

Excel, 43 bytes
=SUM(1*(RIGHT(ROW(OFFSET(A1,0,0,A1)))="2"))

OFFSET(A1,0,0,A1) generates a range starting at A1 that is A1's value rows tall.
ROW(OFFSET(~)) returns an array of row numbers for that range (\$[1,N]\$).
RIGHT(ROW(~)) returns an array of the right-most character of those row numbers as a string.
RIGHT(~)="2" returns an array of TRUE or FALSE.
1*(~) transforms TRUE to 1 and FALSE to 0.
SUM(~) sums.

Vyxal, 4 bytes
8+ĳ∖

the easy solution.
Vyxal Ms, 6 bytes
ƛSt\2=

-2 bytes from Lyxal.
Explanation
ƛSt\2=
ƛ      map range 1..n to the following:
 S     convert to string
  t    get last character
   \2= is it equal to '2'?
       sum the results(s flag)

ƛSt\2=with s flag as well. i.e. Vyxal, Ms, 6 bytes

Vyxal, 8+Τ⳹

Vyxal, ƛSt\2=

Brachylog, 3 bytes
+₈k

Try it online!
Since Brachylog likes to treat integers as lists of decimal digits when appropriate, the "remove last element" builtin k can be used to floor-divide by 10.

Io, 24 bytes
method(i,((i-1)/10)ceil)

Try it online!
1 byte saved, thanks to xigoi

-1 byte by using ((i-1)/10)ceil instead of ((i+8)/10)floor

Nim, 29 28 bytes
func f[I](n:I):I=(n+8)div 10

Try it online!

Oh, I heard about Nim ;)

Factor, 13 bytes
[ 8 + 10 /i ]

Try it online!
It's a quotation (anonymous function) that adds 8 to its input and then (integer) divides it by 10.

Mathematica, 14 bytes
⌊.1*#+.8⌋&

RGS did most of the work by coming up with the clever function to determine the answer.  Putting it into Wolfram Langage was then trivial.
Try it online!
NB:
⌊ = \[LeftFloor] = U+230A (3 bytes)
⌋ = \[RightFloor] = U+230B (3 bytes)

APL+WIN, 9 bytes
Prompts for integer n:
+/2=10|⍳⎕
Try it online! Courtesy of Dyalog Classic

This only works if ⎕IO is 1. Does that need to be a part of the program?

@mappo The default ⎕IO setting of my APL+WIN is 1. Similarly it seems that Dyalog Classic in TIO  defaults to ⎕IO = 1. Generally ⎕IO is a session setting and not part of any function. It can be localised within a function if desired to over-ride the session setting.

dc, 5 4 bytes
8+I/

Try it online!
This is a dc "function": it pops the input from the stack, and then pushes the output onto the stack.  (dc is a stack-based language.)
To call it, enter the desired input first (to push it on the stack), follow with the code above, and then enter p to print the output.

Bash + Unix utilities, 13 bytes
dc<<<$1d8+I/p

Try it online!
The input is passed as an argument, and the output is printed.
(This just uses my dc answer internally.)

Java (JDK), 11 bytes
n->(n+8)/10

Try it online!

Groovy, 18 bytes
{(it+8).intdiv 10}

Try it online!

Kotlin, 13 bytes
{a->(a+8)/10}

Try it online!

C, 29 21 20 17 bytes
f(n){n=(n+8)/10;}

Try It Online
Which works only if optimizations are turned off (more info).
If you love optimizations, then I got this 18 bytes solution for you:
#define N (n+8)/10

Try It Online

It's not golfed ;)

You mean that (n+8)/10; is not a valid answer? The answer should read the input and print the output?

In code-golf you should implement either a function or a program. In this case program would take n as input and print the result to output and function would take n as argument and return the result.

All right thank you very much for the explanation! If I choose a function, do I need to count even the declaration int countTwos( int n ) { or can I limit the count to the body of the function?

You need to write a full function or a full program in a minimal amout of bytes/characters. So I'd use int f(int n){. ;)

all right thank you! :)

YW ;) can you please edit your answer? ;)

Sure, I am working on it. I need to include in the count even white spaces, isn't it?

Yeah, white spaces count too.

Thank you so much! I did it!

Yea, that's a well-golfed answer. Thank you ;)

Thank You! It's nice to golf :)

-1 byte: int f(int n){return(n+8)/10;}

Oh thank you so much! I didn't know I could do it

AWK, 17 bytes
$1=int($1/10+.8)e

Try it online!
This substitutes the input $1 for the formula int($1/10+.8), and also appends the e variable, which is null (not defined variables return null). This causes $1 to become a string, preventing the expression from evaluating 0 when input is 0 or 1. A false pattern wouldn't allow the line to be printed (0 is false).

Coconut, 12 bytes
n->(n+8)//10

Try it online!

TI-BASIC, 8 bytes
int(.1(N+8

There are a handful of equivalent solutions here because of the number of ways you can do implicit multiplication by .1 - there's also a solution available using the default value of Xmax from the graphscreen variables.
int(.1N+.8

int(N/Xmax+.8

Ruby, 44 bytes
->x{(1..x).to_a.map{|e|(e%10)==2?1:0}.sum}

Try it online!
I don't use Ruby very often, I'm sure it can be golfed further.

Risky, 3.5 bytes
?++//+/

Try it online!

tinylisp, 35 bytes
(load library
(d y(q((n)(/(+ 8 n)10

Try it online!
Luckily, library had a builtin for division.

Knight, 17 bytes
OUTPUT/+8PROMPT10

My first submission for the language of the month; Knight, which I just found out was a thing. Implements the same function as my previous Haskell (and basically everyone else's) answer.
Try it online! (online interpreter implemented in TIO in C)

You can just do O/+8P10.

Thunno 2, 4 bytes
8+T÷

Attempt This Online! Port of RGS's Python answer.
Thunno 2 L, 4 bytes
æ2ø>

Attempt This Online! Literal solution.
Explanation
8+T÷  # Implicit input
8+    # Add 8 to the input
  T÷  # Floor divide by 10
      # Implicit output

æ2ø>  # Implicit input
æ     # Filter [1..input] by:
 2ø>  #  Ends with 2
      # Push the length
      # Implicit output

authors: Bob Jarvis - Слава Україні

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


text:
How many petals around the rose
How many petals around the rose
How many petals around the rose is a dice game you can play with your friends. Similar to "can I join the music box", there is a person that knows how the game works and the others have to discover the rule.
In this game, someone rolls some dice (usually two or more) and then people have to call "how many petals are around the rose".
Algorithm
If you want to play it by yourself, you can play it over at TIO. Just hide the header (which is where the rule is implemented) and try passing different arguments (from 1 to 6) in the function.
spoiler, what follows is the rule you are invited to find by yourself!

 The "roses" here are the dice, and the "petals" are the black dots that are around a central dot. Because only the odd numbers have a central black dot, only numbers 1, 3, 5 matter for the petals. Those numbers have, respectively, 0, 2, 4 dots around the central dot, the "petals".

Input
Your input will be a non-empty list (or equivalent) of integers in the range [1, 6].
Output
The number of petals around the rose.
Test cases
Reference implementation in Python, that also generated the test cases.
1, 1 -> 0
1, 2 -> 0
1, 3 -> 2
1, 4 -> 0
1, 5 -> 4
1, 6 -> 0
2, 1 -> 0
2, 2 -> 0
2, 3 -> 2
2, 4 -> 0
2, 5 -> 4
2, 6 -> 0
3, 1 -> 2
3, 2 -> 2
3, 3 -> 4
3, 4 -> 2
3, 5 -> 6
3, 6 -> 2
4, 1 -> 0
4, 2 -> 0
4, 3 -> 2
4, 4 -> 0
4, 5 -> 4
4, 6 -> 0
5, 1 -> 4
5, 2 -> 4
5, 3 -> 6
5, 4 -> 4
5, 5 -> 8
5, 6 -> 4
6, 1 -> 0
6, 2 -> 0
6, 3 -> 2
6, 4 -> 0
6, 5 -> 4
6, 6 -> 0
3, 1, 5 -> 6
4, 5, 2 -> 4
4, 3, 5 -> 6
1, 4, 4 -> 0
5, 5, 2 -> 8
4, 1, 1 -> 0
3, 4, 1 -> 2
4, 3, 5 -> 6
4, 4, 5 -> 4
4, 2, 1 -> 0
3, 5, 5, 2 -> 10
6, 1, 4, 6, 3 -> 2
3, 2, 2, 1, 2, 3 -> 4
3, 6, 1, 2, 5, 2, 5 -> 10

This is code-golf so shortest submission in bytes, wins! If you liked this challenge, consider upvoting it... And happy golfing!

Suggestion: Since you offer to let people play it themselves with the TIO link, consider giving a small warning of some sort before explaining what the solution/rule is. I was a bit confused after reading both paragraphs and then poking in different numbers thinking there would be some additional rule to figure out, only to find that the results were precisely as described.

@Klaycon I don't understand what you mean! Can you please try to elaborate?

The intro presents the game as having some rule that must be discovered. The reader is then invited to try and find the rule themselves by visiting the TIO link, collapsing the header, and trying inputs themselves - but immediately following this invitation is an explanation of what the rule is, without any indication as such. For me at least I didn't realize that explanation was the "rule" and proceeded to try figuring it out, leading to some confusion and lost time when there seemed to be nothing more to it.

@Klaycon that actually makes a lot of sense, I edited it into the challenge. I hope it makes it more clear now.

Could you put actual spoiler tags to hide the rule?

@JiK now I have, thanks for the suggestion.

@Veskah input is in the range 1-6 so you don't need to worry about 0

D'oh, meant output. E.g., for (1,2,4), can we return nothing instead of 0?

@Veskah you have to return 0, sorry.

Python 3, 30 bytes
lambda l:sum(n**3&6for n in l)

Try it online!
(test cases shamelessly borrowed from xnor's answer)
How?
Given \$1\le n\le6\$, the number of petals can be computed with:
$$p=n^{2k+1} \operatorname{and}6,\:k\in\mathbb{N}^*$$
where \$\operatorname{and}\$ is a bitwise operator.
This can also be written as:
$$p=2\times\left\lfloor\frac{n^{2k+1}\bmod 8}{2}\right\rfloor$$
And is based on the fact that, for any \$k\ge1\$:
$$n^{2k+1}\bmod 8=\cases{
n&\text{if $n$ is odd ($1$, $3$ or $5$)}\\
0&\text{if $n$ is even ($2$, $4$ or $6$)}
}$$
More specifically, choosing \$k=1\$:
$$p=n^3 \operatorname{and}6$$
As Python code, the resulting expression is just as long as the nice n%-2%n found by xnor. But because it ends with a digit, we can get rid of the space just before the for, saving a byte.
 n | n**3 | as binary  | AND 6
---+------+------------+-------
 1 |    1 | 00000 00 1 |   0
 2 |    8 | 00001 00 0 |   0
 3 |   27 | 00011 01 1 |   2
 4 |   64 | 01000 00 0 |   0
 5 |  125 | 01111 10 1 |   4
 6 |  216 | 11011 00 0 |   0

May I ask how you got to this formula? Were you playing around with the bits?

@RGS Playing around with the bits sounds like an accurate description. Given that I wanted to find something either shorter than n%-2%n or just as long but ending with a digit, there were actually not so many (reasonable) things to try.

Nice method! I posted a bounty. Amusingly, I had tried to brute-force for shorter expressions than mine, but missed yours because the intermediate step of 6**3=216 was above my cutoff. Searching now without cutoff, I don't find any other solutions except your other odd exponents as you note.

Retina 0.8.2, 11 bytes
5
33
3
33
3

Try it online! Link includes test cases. Input can be in almost any format really as only the 5s and 3s count. Explanation:
5
33

A 5 has as many petals as two 3s.
3
33

Speaking of 3s, they have two petals, so make them count twice.
3

Count the petals.

Python, 31 bytes
lambda l:sum(n%-2%n for n in l)

Try it online!
The core expression n%-2%n evaluates to zero for even n and to n-1 for odd n.
       | n%-2   n%-2%n
-------+--------------
n even |    0        0
n odd  |   -1      n-1

R, 26 23 bytes
function(l)l%%2%*%(l-1)

Try it online!
-3 thanks to Robin Ryder!
Returns a 1x1 matrix with the result.

Old answer, since there are a handful of explicit ports:
function(l)sum((l-1)*l%%2)

Try it online!

23 bytes with matrix multiplication.

@RobinRyder thanks! I should have tried that, don't know why I didn't.

Jelly,  7  4 bytes
-3 using Giuseppe's method!
Ḃ×’S

Try it online!
How?
We know that 3's and 5's "score", that they score one less than their pips, and that \$1-1=0\$ so:
        throw   1  2  3  4  5  6
  x=throw - 1   0  1  2  3  4  5
  y=throw % 2   1  0  1  0  1  0
score = x * y   0  0  2  0  4  0

So:
Ḃ×’S - Link: throws, list of integers in [1,6]   e.g. [1,2,3,4,5,6]
Ḃ    - (throws) % 2                                   [1,0,1,0,1,0]
  ’  - (throws) - 1                                   [0,1,2,3,4,5]
 ×   - multiply                                       [0,0,2,0,4,0]
   S - sum                                            6

Have been meaning to ask you this: where/how did you get to know the implicit things you know that some jelly atoms do? as an example, quite often you use dequeue on integers, which first implicitly converts to the range [1, .., n].

Being told by Dennis / Lynn / Miles or looking at the code

...Dequeue is lambda z: iterable(z, make_range = True)[1:] for example.

Perl 6, 17 16 bytes
{sum $_>>³X+&6}

Try it online!
Uses Arnauld's formula of \$n^3\&6\$. If HyperWhatevers worked, then something like (**³+&6).sum should be possible for 13 bytes.
My old regex based solution:
{sum m:g/3|5/X-1}

Try it online!
Match 3s and 5s from the input, subtract one from each and sum them together.

Python, 32 bytes
lambda d:sum(r%2*~-r for r in d)

Port of Giuseppe's R answer.
Try it online!

Fine - roses in dice.

J, 9 bytes
1#.2&|*<:

Try it online!

1#. Sum of applying the following to each element...
2&| Remainder when divided by 2
* Times...
<: Number decremented by 1

Japt -mx, 3 bytes
³&6

Try it
Saved 2 bytes using Arnauld's formula so be sure to +1 him if you're +1ing this.
Original, 5 bytes
fu xÉ

Try it

AWK, 29 28 26 bytes
/3|5/{x+=$0-1}END{print+x}

Try it online!
-1 byte thanks to Jo King
-2 bytes thanks to user41805
+x is needed so that inputs with no odd numbers still return 0.

Taking input as lines is allowed +1

It appears /3|5/ works, and you should be able to remove the space after print

PHP, 55 53 51 bytes
fn($a)=>array_sum(array_map(fn($v)=>$v%2*~-$v,$a));

Try it online!
-2 bytes thanks to @RGS

You might be able to golf this considerably if you check, for example, Giuseppe's answer

Thanks. Unfortunately my options are limited to either looping through the array or using array functions. I've plumped for the latter. The only way to apply a function to each element is to use array_map or maybe array_filter. My petal choosing lookup could be shorter, but not by much.

Yeah, I only managed to get 53 bytes by using Giuseppe's formula.

Python 3, 40 33 32 bytes
Saved 7 bytes thanks to RGS!!!
lambda d:sum(i%2*~-i for i in d)

Try it online!
This turns out to be a total rip off of Jonathan Allan's Python answer so update him instead.

33 bytes :)

@RGS Nice one - thanks!

thanks, but now Jonathan Allan golfed one byte more by using clever bitwise operations... I always forget about the ~ trick.

@RGS Was just converting the (i-1) to ~-i ...

yeah I know, I just never remember that trick by myself.

@RGS It's very useful (and -~i for (i+1)) when brackets are needed.

Haskell, 23 bytes
f x=sum[n-1|n<-x,odd n]

Try it online!

C (gcc), 50 48 bytes
Saved 2 bytes thanks to xibu!!!
s;f(l,p)int*p;{for(s=0;l--;)s+=*p%2*~-*p++;l=s;}

Try it online!
Inputs an integer array pointer preceded by its length.

I'm assuming it's standard to allow C submissions to take the length of the array as input? +1

@RGS In C, only char* arrays (strings) have a sentinel value at the end. So the only way to know the size of other arrays is to be passed the length.

I thought you could do something with sizeof or something like that..?

That's not going to work with a pointer and that's done at compile time so how's a function going to work taking different sizes of arrays?

I'm not against you taking the length as input! I just don't know much C and that is why I'm asking

I normally work with C++ so never use raw pointers in the wild. But a big thing right now is spans, which is basically a pointer and length. Turns out that's very speed efficient too! :-)

And the very first span was std::string_view which replaces the '\0' terminated C string with a pointer and a length! Not only faster and more memory efficient but way more useful for things like substrings too! :D

Let us continue this discussion in chat.

You can save 2 Bytes by using K&R style for the declaration of p. TIO

@xibu Good 'ol K&R! Nice one - thanks! :-)

As the only defined values in this challenge are [1..6], you can use 0 as your sentinel value and save 5 bytes: Try it online!

05AB1E, 5 4 bytes
ÉÏ<O

Try it online!
-7 byes thanks to Expired Data
-1 byte thanks to Grimmy
As promised, someone who knows 05AB1E better than I came and golfed it somehow.
11 bytes
ε2%}Iε1-}*O

Try it online!
I'm sure someone who knows 05AB1E better than I do will come along and golf this somehow. Really simple:
ε2%}   # Map the code 2% (mod 2) to each element of the implicit input
Iε1-}  # Map the code 1- (sub 1) to each element of the explicit input
*O     # Multiply the two lists and sum

Try it online!

Everything in 05AB1E vectorizes, and É is a built-in for %2, < is a built-in for -1.

4 bytes: ÉÏ<O.

Wolfram Language (Mathematica), 25 bytes
Tr[(Mod[#,2]#//.0->1)-1]&

Try it online!

Mod[#,2].(#-1)&.

C# (Visual C# Interactive Compiler), 20 bytes
a=>a.Sum(x=>x--%2*x)

Try it online!

TI-BASIC, 13 12 bytes
I found some 12 byte solutions
Ans-1:sum(Ansnot(fPart(Ans/2

The previous is the same byte count as below due to the line separator costing a byte
sum((Ans-1)2fPart(Ans/2

The above solutions use NfPart(Ans/N as a modulus operation to judge even/odd, giving us a list of dice that can have petals.  Multiplying that by the original list -1 restores the petal counts to the list which can then be summed
2sum(Ans=3)+4sum(Ans=5

The original 13 byte solution simply compared the list once against 3 and separately against 5 before summing those results independently to get the petal count
All the above solutions take input as a list in Ans

Julia 1.0, 23 16 bytes
l->sum(l.^3 .&6)

Try it online!
-7 Bytes thanks to Maria Miller

16 bytes: l->sum(l.^3 .&6)

Brain-Flak, 66 60 44 42 bytes
Two bytes saved by Jo King
({(({}[()])<>)<>{<({}[()])><>([{}])<>}{}})

Try it online!
This challenge seems to ellude a straight forward solution in Brain-flak.  It was quite fun to golf.

Java (JDK), 47 45 bytes
r->{int s=0;for(int i:r)s+=i%2*~-i;return s;}

First time code golfing, hope I posted this right.
-2 Bytes by removing unneeded curly brackets
Try it online!

Welcome to the site, and good job here!

W, 5 bytes
►S≡5u

Uncompressed:
(S2m*J

(      % Decrement input
 S     % Swap a copy of the input up
  2m   % Modulo the value by 2
    *  % Multiply them
     J % Find their sum
```

Thanks for your W submission. What is the d next to the language name?

@RGS It's a flag to decompress the source; it's currently an obscure flag but is kept for backwards compatibility. (I forgot to remove the flag, whoops!)

Powershell, 32 18bytes
1.."$args"|?{$_%2}

Example input 6 will output
1
3
5

Saved 14 bytes thanks to @mazzy

Hey, thanks for your submission! You may want to consider including a tio link, or at least a screenshot of the results of your program for a couple of test cases! :D Ping me when you do that!

@RGS done it. Please verify! I have run it in tio and It works.

I don't understand your example output for input 6. I wanted you to include a link for your code. Try checking the other answers: the vast majority has a link in the end that you can click, to try their code.

I don't know how to add a tio link with code.

It is easy. In the tio.run site, you choose the programming language you were using and put the code there. Then, on top of the page, there will be a couple of buttons. A triangle pointing to the right can be used to run the code. The button to the right shows a link. If you click that, you can copy a link to the code on tio! Then you just have to include it in your answer by substituting the link in this text: [Try it online](your link here)

you can save some bytes in your solution Try it online!

@mazzy thanks so much!

While nice and short, this isn't up to spec. Goal is to take a list of numbers and for each odd, add $_-1 to a running total. See my answer

Perl 5 -pl, 15 bytes
$\+=$_%2*$_&6}{

Try it online!
Takes the input list as one entry per line.

Roj, 134 92 88 86 65 bytes
Considerably easier than the previous challenge. Takes numbers in separate lines and end input with the input 0. Outputs via return value. (Dramatically saved 42 bytes by using dynamic input)
O=0;i=1;while i do readint i;if i==3 or i==5 do O=O+i-1 end end;O

Bash + Core utilities, 37 35 34 30 29 bytes
sed s/5/33/\;p|tr -cd 3|wc -c

Try it online!

Shortened by 1 byte: Thanks to @user41805 for pointing out that OP is allowing the program to require one number per line, which lets me eliminate the g flag from the sed command.

Shortened by 4 bytes thanks to @Neil! The change is to use sed to print the output twice, before counting characters, eliminating the need to double the character count.

I was going to use the formula n%2*(n-1), but then I saw that everybody else had the same idea, so I decided to do something different.
Input is a list of integers between 1 and 6, inclusive, on stdin, with one number per line.
Output is on stdout.
The 30-byte version:
Uses @Neil's idea of using sed to print the line twice, eliminating the need to double the number.
The 34-byte version:
One byte shorter: instead of multiplying by 2, I now add the number to itself.
How the 35-byte version worked:

Replace every instance of 5 by 33.  (The number of 3s is now half the desired answer.)
Delete all characters except 3.  (This even eliminates the \n at the end of the line.)
Use wc (without the -c option this time) to print the number of lines, the number of words, and the number of characters, separated by spaces.
Use dc to double the number of characters, ignoring the number of lines and the number of words.

How the original 37-byte version worked:

Replace every instance of 5 by 33.
Replace every instance of 3 by 33.  (In particular, every 5 in the original string has now become 3333.)
Delete all characters except 3.  (This even eliminates the \n at the end of the line.)
Count and print the number of characters in what remains.  (Every 3 in the original string has been replaced by 33, every 5 has been replaced by 3333, and everything else has been removed.)

In looking through the various submissions, it turns out that @Neil's Retina answer had used the same method as my original 37-byte version (but he was earlier).  I wasn't sure at first, since I've never used Retina, but @Neil confirmed it.
The newer versions work somewhat differently, though.

Yes, my Retina answer does use the same approach; the first two pairs of lines correspond to your sed substitutions while the final line is roughly equivalent to grep -o 3|wc -l (although obviously for a single character your tr approach is golfier).

Thanks -- that's what I thought when I read your answer. Retina looks like an interesting language; I'll check it out.

Seeing your latest answer makes me wonder - can you make sed print each line twice, thus doubling the number of 3s?

Interesting idea, @Neil -- thanks, I'll check it out.

Thanks, @Neil!  That saved 4 bytes!

"Taking input as lines is allowed", so you should be able to save 4 bytes at least

@user41805 Thank you for pointing that out. But I must be missing something obvious -- I see that this lets you eliminate the g flag from the sed command, but where are the other 3 bytes coming from?

You can double the count by having wc -c also count newlines to save more than 3 bytes

APL (Dyalog Unicode), 8 bytesSBCS
+/⊢|¯2|⊢

Try it online!
A port of xnor's double modulo trick.
How it works
+/⊢|¯2|⊢
    ¯2|⊢  ⍝ Input modulo -2; 0 if even, -1 if odd
  ⊢|      ⍝ That modulo input; 0 if even, n-1 if odd
+/        ⍝ Sum

APL (Dyalog Unicode), 9 bytesSBCS
2∘|+.×-∘1

Try it online!
How it works
2∘|+.×-∘1
      -∘1  ⍝ Decrement input
   +.×     ⍝ Dot product with
2∘|        ⍝ Input modulo 2

Good job using three vector dot product

Ruby, 23 21 bytes
->a{a.sum{|x|x**9&6}}

Try it online!
Actually using the same idea as Arnauld, only with bigger numbers. Read his explanation and upvote him.

Might as well take a single array as input instead of splatting the 2 arguments, since some other answers are doing the same.

Icon, 50 bytes
procedure f(a)
n:=0&n+:=!a-1=(2|4)&\z
return n
end

Try it online!
Explanation:
procedure f(a)         # the argument a is the list
    n:=0 &             # sets the sum to 0 and
    n+:=!a-1=(2|4) &   # add to n (n+:=) each element of a decreased by one (!a-1),
                       # if it now equals 2 or 4 (=(2|4)) and
    \z                 # loop (in fact checks if a variable z exists - since it
                       # doesn't, backtracks to get the next element of a, if any)
    return n           # returns the sum
end

K (oK), 13 bytes
{+/(2!x)*x-1}

Try it online!
Essentially same as Jonah's J solution

Actually, 8 bytes
A port using Arnauld's formula.
⌠3ⁿ6&⌡MΣ

Try it online!

Excel, 34 bytes
=SUMIF(A:A,3)/3*2+SUMIF(A:A,5)/5*4

SUMIF does much of the work for us.
Feel like there should be a solution using SUMPRODUCT, but have not found it yet.

Burlesque, 12 bytes
psf{2.%}?d++

Try it online!
ps     # Parse input to array
f{2.%} # Filter for mod2 == 1
?d     # Decrement each
++     # Sum

MathGolf, 4 bytes
(Ç¥Σ

Try it online.
Explanation:
(     # Decrease each value in the (implicit) input-list by 1
 Ç    # Inverted filter this list by (so keep those which are falsey):
  ¥   #  Modulo-2
   Σ  # And sum each remaining item
      # (after which the entire stack joined together is output implicitly as result)

Red, 48 bytes
func[b][s: 0 foreach a b[s: a - 1 *(a % 2)+ s]s]

Try it online!

Charcoal, 7 bytes
ＩΣ＆⁶ＸＡ³

Try it online! Link is to verbose version of code. Port of @Arnauld's Python answer, as Charcoal supports vectorising those operations. Explanation:
     Ａ  Input array
    Ｘ ³ Cubed (vectorises)
   ⁶    Literal `6`
  ＆     Bitwise And (vectorises)
 Σ      Sum
Ｉ       Cast to string for implicit print

Since ＆ is commutative, the ⁶ is placed first in order to keep it separate from the ³.

GolfScript, 10 bytes
Port of Arnauld's Python answer.
0\{3?6&+}/

Try it online!

Aaaah, beat me to posting the 10-byter - took me a good while to notice I had to toss the 0 up front to get it to work. I spent a while getting the block to fit five bytes, and figured the cube answer just a tad too late. Well done!

This appears to use hard-coded input. Is it meant to be a function, a full program or just a snippet? If it  is a function then shouldn't it be reusable?

@JoKing this takes input via one of the methods allowed by default.

So it's a function then? Can you reuse it? I have doubts as to whether it counts as a function when not surrounded by {}

I don’t think it really matters whether it’s a function, since the input / output methods allowed are the same. Worst case, I can change it to inputting an array of bytes from STDIN, but that’s not gonna look pretty on TIO since byte values 1‑6 are unprintables.

That rule specifies functions can take the same input as full programs, not the other way around

C (gcc), 38 bytes
b;f(int*a){b=(b=*a++)?b%2*~-b+f(a):0;}

Input as 0-terminated array a.
Recursive function.
-10 bytes thanks to Arnauld!
Try it online!

Using a 0-terminated list would save 3 bytes.

Going recursive saves 7 more bytes.

Batch, 101 90 Bytes
@Set _=0
@For %%A in (%*) Do @For %%B in (3,5) DO @IF %%A EQU %%B Set /A _+=%%B-1
@Set _

11 bytes saved using Neil's suggestions

I'm not sure that the output of SET _ counts as acceptable. But you can save some bytes by removing @ECHO OFF and putting the @ at the start of each line and after )DO @. You can also loop over 3 and 5 using a simple For loop without /L, although doing arithmetic on the value would probably be shorter still.

Correct in the savings using @ and dropping /L. old habbits die hard. As for using
set to output the result, I can't say I understand why you think it wouldn't count.

I have this vague memory of seeing some answer (on a different question and in a different language) where this was an issue, so I thought it was best to seek clarification.

@Neil thanks for the worries, I would say I don't really mind :) the point is clearly computing the answer

golfed another 19 bytes off: lingering environment changes (SET) causing inaccurate results are not part of the answer's concern. https://pastebin.com/MikFWfG9

PowerShell, 29 bytes
$args|?{$_%2}|%{$i+=$_-1}
+$i

Try it online!
Takes input via splatting

How can I test your submission with 3 or more inputs? :)

@RGS Like this

Husk, 6 bytes
Σm←f%2

Try it online!
Direct port of my Haskell answer.
   f%2 Take the odd numbers
 m←    Decrement them
Σ      Sum

JavaScript (V8), 34 bytes
r=>r.map(i=>d+=i&1&&i>>1<<1,d=0)|d

Try it online!

i>>1<<1 -> i&~1, but since it only applies to odd numbers you can just i^1.

Vyxal, 4 bytes
~∷‹∑

Try it Online!
~    # Filter by
 ∷   # Odd?
  ‹  # Decrement
   ∑ # Sum

Jelly, 3 bytes
’ḋḂ

Try it online!
’      Decrement each number,
  Ḃ    and take each number mod 2.
 ḋ     Return the dot product of both vectors of results.

APL+WIN, 16 bytes
Prompts for vector of integers
+/2 4[(3 5⍳⎕)~3]

Try it online! Courtesy of Dyalog Classic

Keg, -rR , 13 bytes
÷0&(¦32⑼|54⑼™

Try it online!
On days like these, kids like you, should be grateful that SBCS's exist. Because otherwise, this'd be 21 bytes.
Input is taken as a number with no commas. So a roll of 5, 5, 3 would be inputted as 553.
Explanation
÷           # Item split the implicit input.
0&          # Store 0 in the register.
(           # For each item in the stack:
    ¦       #   Switch statement:
    32⑼     #   If the item is 3, add 2 to the register.
    |54⑼    #   If the item is 5, add 4 to the register.
    ™       #   End switch statement.

# -rR prints the value in the register rawly. In other words, as a number.

What are the rR flags for?

@RGS -rR prints the value in the register rawly. In other words, as a number.

@RGS more accurately: at the end of the program, whatever is stored in the register will be printed as if ⑻. had been appended to the program after autocompletion of brackets.

Rabbit~, 31
_[.0{.51}{+.2}{.53}{+.4}>]_+++:

Explanation:
_                               - Move to input
 [.0                    >]      - Loop over die rolls
    {.51}{+.2}                  - If die roll is 3 add 2
              {.53}{+.4}        - If die roll is 5 add 4
                          _+++: - Move out of the way, flush and print addition result

51 and 53 is ascii for 3 and 5

Pure data, 401 bytes
#N canvas;#X obj 0 0 inlet;#X obj 0 0 list split 1;#X obj 0 0 i;#X obj 0 0 outlet;#X msg 0 0 0;#X obj 0 0 t l;#X obj 0 0 del;#X obj 0 0 expr $i2+$i1%2*($i1>>1);#X obj 0 0 i;#X connect 0 0 4 0;#X connect 0 0 5 0;#X connect 1 0 7 0;#X connect 1 1 5 0;#X connect 1 2 6 0;#X connect 2 0 3 0;#X connect 4 0 8 0;#X connect 5 0 1 0;#X connect 6 0 2 0;#X connect 7 0 8 0;#X connect 8 0 7 1;#X connect 8 0 2 1;

Pure Data is a graphical programming language for audio processing.
Here is what my the source looks like:

It is pretty unreadable since I saved bytes by placing all elements at coordinate 0 0.  Here it is reorganized so you can read the elements.

It is important to note that execution in pure data sometimes depends on the order in which objects were created, which is not visible in images like this.  For this answer to work The inlet object must be connected to the 0 message before the t 1 object.  This shows up in the source code as that connection being earlier on.
Most of the program is just list processing.  The logic is actually handled in the expr block
#X obj 0 0 expr $i2+$i1%2*($i1>>1);

Here $i1 is the current element and $i2 is the result of the last expr.  So this bitshifts the element down by one, which is intended result for odd numbers.  To make even numbers we then multiply it by its 2 modulus, which is zero for even numbers and 1 for odd numbers.

Thanks to 0 ' for working on this with me.

Thunno, \$ 7\log_{256}(96)\approx \$ 5.76 bytes
g2%k1-S

Attempt This Online!
Port of Kevin Cruijssen's MathGolf answer.
Thunno, \$ 9\log_{256}(96)\approx \$ 7.41 bytes
D2%s1-z*S

Attempt This Online!
Port of Jonathan Allan's Jelly answer.
Explanations
g2%k1-S  # Implicit input
g  k     # Filter for those which are:
 2%      #  Odd
    1-   # Subtract one from each
      S  # Sum

D2%s1-z*S  # Implicit input
D2%        # Duplicate and mod by 2
   s1-     # Swap and subtract one
      z*   # Multiply
        S  # Sum

Thunno 2 S, 4 bytes
ɗ$⁻×

Try it online!
Explanation
ɗ$⁻×  # Implicit input
ɗ     # Mod each item by 2
 $    # Push the input again
  ⁻   # Decrement each item
   ×  # Multiply elementwise
      # Implicit output

JavaScript (V8), 29 bytes
r=>r.map(i=>d+=i%2*--i,d=0)|d

Try it online!

source: Stack Exchange

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

sort: votes


text:
(RGS 3/5) Help me write Portuguese!
Context
(Feel free to skip, doesn't really matter for the algorithmic explanation of the task)
European Portuguese is a fairly complicated language to learn, mostly because of its grammar. One particular annoying thing is conjugating the verbs correctly:
We have this mechanism that, when we have a verb followed by a noun, we may replace the noun by a pronoun and create a contraction with the verb, by means of a hyphen (-).
This introduces a problem because many verb tenses sound like verb-pronoun contractions and many verb-pronoun contractions sound like verb tenses... And then, (Portuguese!) people want to write Portuguese and they know how it should sound, but they don't know if they should insert a hyphen or not... (Strictly speaking, the two variants have subtle differences in intonation.)
So we are taught a decent method to help us discern if we should use a hyphen or not, that revolves around putting the sentence in the negative form.
When the hyphen belongs there, the negative form makes the contracted pronoun go before the verb. When the hyphen doesn't belong there (and it is really just a verb tense) the verb doesn't change. So you negate the sentence and try placing the suspect pronoun in both places. What sounds right is probably the right choice.
Task
Given a Portuguese sentence, perform the basic test to help discern if a sentence should use a hyphen in a contraction or not.
Basic algorithm for the challenge
We are going to simplify things a bit here. Your code should do the following (check below for two worked examples)

Look for the only hyphen in the input sentence (the hyphen that we are unsure about), between two words, like so: verb-pronoun
Output the two following modified sentences:

in the place of the verb-pronoun, use "nao" verbpronoun, i.e. prepend "nao" and drop the hyphen;
in the place of the verb-pronoun, use "nao" pronoun verbs where verbs is the verb (with an extra "s" if the verb ended in a vowel "aeiou").

Worked examples
Let "sei que apanhas-te um susto" [~I know you were scared] be the input. We find the hyphen and extract verb = "apanhas" and pronoun = "te". The verb does not end in a vowel, so there will be no need to add an "s" for the second sentence. The two sentences will be of the form "sei que _ um susto". Indeed, they are:

"sei que nao apanhaste um susto" [~I know you were not scared]
"sei que nao te apanhas um susto" [~I know were you not scared]

So clearly we should go with number 1.
Now let us take "da-me um upvote" [~give me an upvote]. The hyphen is in "da-me" so we take verb = "da" and pronoun = "me". The verb ends in a vowel so we will need to use verbs = "das" in the second sentence:

"nao dame um upvote" [~give me an upvote not]
"nao me das um upvote" [~you don't give me an upvote]

So clearly the right Portuguese sentence would be number 2.
Input
A string composed of spaces, characters in the range [a-z] and a single hyphen surrounded by two words.
The input string can be in any sensible format, like a string, a list of words or a list of characters.
Output
The two modified sentences, as described above. These can be printed separately, returned in a list, or whatever is sensible in your programming language.

The two sentences can be interchanged, i.e. order doesn't matter.
The two sentences can be in a single string, as long as they are separated by a character that is not in [a-z \-].

Test cases
"sei que apanhas-te um susto" -> "sei que nao apanhaste um susto", "sei que nao te apanhas um susto"
"da-me um upvote" -> "nao dame um upvote", "nao me das um upvote"
"conta-me no que estas a pensar" -> "nao contame no que estas a pensar", "nao me contas no que estas a pensar"
"pensei em bater-te" -> "pensei em nao baterte", "pensei em nao te bater"
"isto custa-me a crer" -> "isto nao custame a crer", "isto nao me custas a crer"
"passeia-te pela rua" -> "nao passeiate pela rua", "nao te passeias pela rua"

This is code-golf so shortest submission in bytes, wins! If you liked this challenge, consider upvoting it... And happy golfing!

This is the third challenge of the RGS Golfing Showdown. If you want to participate in the competition, you have 96 hours to submit your eligible answers. Remember there is still 350 reputation in prizes! (See 6 of the rules)
Also, as per section 4 of the rules in the linked meta post, the "restricted languages" for this third challenge are only Pyth, MATL, Husk and CJam so submissions in these languages are not eligible for the final prize. But they can still be posted!!
Otherwise, this is still a regular code-golf challenge, so enjoy!

Thank you for sticking to ASCII :-)

We don't need to capitalize the first word of the output?

@MitchellSpector not really, why? But you can do it, for extra imaginary internet style points.

No real reason, except that the sentences look strange not starting with a lower-case letter.  (But the input sentences are all lower-case anyway, so I won't worry about it.)   It might have been interesting for both the input and the output sentences to have to start with a capital letter (sometimes "Nao" is the first word of the output sentence, and sometimes it's not).

Does output order matter?

@MitchellSpector thanks for your feedback. That would've made for a nice subtlety, but maybe also steer the focus a bit from the core challenge, which was to use the "rule"... That is why I tried to make things as simple as possible in terms of input characters and etc :)

Can we take the input string as input twice?

@S.S.Anne Not really, sorry; I don't think it makes much sense.

May we take input as a list of words?

@RobinRyder yes

Since you allow a list of words, do you allow words being seperated not by spaces, but by newlines?

@EmbodimentofIgnorance may I ask why? I don't think that makes much sense... In view of the challenge and from my pov.

@RGS It would save a few bytes in my submission. However, it is fine if you decline it. I have a new question though: If the input can be a list of words, can the output be too?

@EmbodimentofIgnorance yes, as long as the two sentences are clearly separated. Either by being in two different lists, or by having something between the two sentences , like a newline or a character like |

Python 3, 112 bytes
(*a,v),(p,*b)=map(str.split,input().split('-'))
a+='nao',
print(*a,v+p,*b)
print(*a,p,v+'s'*(v[-1]in'aeiou'),*b)

Try it online!

This is some voodoo python right here

V (vim),  38  37 bytes
My first ever V answer I believe ...props to the inventor, James A.K.A. DJMcMayhem!
ÄÎf-binao
ó¨[aeiou]©-/±s-
f-dbeá pí-

Try it online!
How?
ÄÎf-binao <CR>ó¨[aeiou]©-/±s-<CR>f-dbeá pí- | implicit read from STDIN
Ä                                           | copy line, paste below
 Î        <CR>                              | for all lines:
  f-                                        |   find "-"
    b                                       |   back one word
     i                                      |   enter insert mode
      naoS                                  |   "nao "
                                            |   (<CR>: implicit exit from insert mode)
              ó          /   <CR>           | single substitution on line:
                                            |    pattern.../:
               ¨       ©                    |      group (1):
                [     ]                     |        any of:
                 aeiou                      |          "aeiou"
                        -                   |      + "-"
                                            |    /...replacement:
                          ±                 |      group (1)
                           s-               |      + "s-"
                                 f-         | find "-"
                                   db       | cut back a word
                                     e      | move to end of word
                                      áS    | insert a space character
                                        p   | paste
                                         í  | single substitution on every line:
                                            |   pattern.../:
                                          - |     "-"
                                            |   /...replacement: (implicit)
                                            |     ""
                                            | implicit print to STDOUT

05AB1E, 57 55 53 51 41 40 39 38 bytes
-3 bytes thanks to @KevinCruijssen
-1 byte thanks to @Grimmy
#ʒa_}н©¡D®'-¡Âðý¤žMså's×«sJ‚vy"nao ÿ"ý

Try it online!

Explanation
#                                           - split input on spaces
 ʒ'-¢}н©                                    - get the hyphenated word
        ¡D                                  - split the input on this word (removing it)
          ®'-¡                              - split the hyphenated word into its two parts
              Âðý                           - Swap and join with space
                                            - (e.g. custa-me -> me custa)
                 ¤žMså's×«                  - if the last char is a vowel add an 's'
                            sJ              - swap and join the other hyphenated word
                                            - (e.g. custa-me -> custame)
                              ‚             - put these in an array so ["custame","me custa"]
                               vy"nao ÿ"    - for each of these add nao in front
                                        ý   - then join the split input with them

Regex would be a fine thing, a fine thing indeed

Python 3.8,  167 \$\cdots\$ 143 142 bytes
Saved a byte thanks to Kevin Cruijssen!!!
lambda p:((n:=(g:=re.match(r'(.*)\b(\w+)-(\w+)(.*)',p).group)(1)+'nao ')+(v:=g(2))+g(3)+g(4),n+g(3)+' '+v+'s'*(v[-1]in'aeiou')+g(4))
import re

Try it online!
Inputs a string and returns a tuple of two strings.

Gosto do teste em português!

@MitchellSpector Muito obrigado! :-)

Hmm, TIL that Python doesn't have a \0 group for the entire match and save on parenthesis. Although it does have something similar with \g<0> (which unfortunately is longer than (...) + \1, so pretty useless in code-golfing).

@KevinCruijssen Python does have group()  for the string matched by the regex, not sure if that's what you're after.

@Noodle9 I mean that in Java and some other languages the '([aeiuo])$',r'\1s' could have been '[aeiuo]$',r'\0s', but unfortunately this isn't possible in Python unless you do '[aeiuo]$',r'\g<0>s' (which is longer). Although I guess group() as alternative could work as well, but that's even longer than \g<0>. :) Just an off-topic TIL moment, not really useful for your answer, sorry.

@KevinCruijssen Figured out a way to golf that: use the entire string + 's' times a test for the last letter in 'aeiou' instead of the regex sub. Thanks for drawing my attention to it! :-)

@Noodle9 Ah, nice. Glad I could help. :) In that case 1 more byte can be saved with (t:=g(2)) and replacing the other two g(2) with t. Cool to see Python finally has inline variable assignments with (variable:=...) in v3.8!

@KevinCruijssen Nice one! Yes, it's great for the language too to be able to make assignments in if statements &c rather than having to store a variable out of scope. Thanks! :-)

@MitchellSpector does this mean any of you is/speaks Portuguese? Or are you just using Google Translate :)

@RGS Hands up! I've been using Google Translate out of respect for the language.  English just looked so awkward in my test cases.

@Noodle9 sure, thanks for the effort! When I read your comments in PT I was so confused, I had to stop and look at them to understand what was going on :p

@RGS (facepalm) kinda had a dreadful feeling this would be the outcome...

@RGS I know a tiny bit of Portuguese (your grammar exercise is way beyond my level). My mother was Brazilian, and we lived in Rio for short time when I was a child, but we always spoke English at home.

@MitchellSpector really interesting! I am not sure, but I think the problem I described here in European Portuguese doesn't really exist in Brazilian Portuguese, so maybe that is why this is not familiar to you :)

@RGS  Thanks, that clarifies things a bit.  I was thinking that looked like European Portuguese, rather than the Brazilian Portuguese that I'm accustomed to, but I know little enough that I wasn't at all sure.

Bash + Core utilities, 85 84 82 75 72 71 bytes
p=";s/(\w*)-(\w*)/nao "
sed -E "h$p\1\2/p;g;s/([aeiou])-/\1s-/$p\2 \1/"

Try it online!

1 byte shorter, thanks to @user41805: Using the p flag in the first substitution permits one ; to be omitted.

Down to 72 bytes now: Added the -E option to sed for extended regexes, eliminating the need to escape the various parentheses.

Thanks to @Neil for shaving off 7 bytes, leaving 75 bytes!
Improvements: (1) Eliminating the \< and \>, which are unnecessary because of sed's greedy regex matching.  (2) Appending the s (if needed) before reversing the order of the verb and the pronoun, which eliminates the need for adding the identifying % character and later deleting it.

Input is on stdin, and output is on stdout.
How it works:

The value of p is essentially the beginning of a sed substitute
command that finds the verb-pronoun combination and replaces it with
a string starting with nao (the command is incomplete -- it will
need to filled in with the rest of the desired substitute and then a
final /).  At the very beginning of p, preceding the command, is
a ;, which will separate it from the previous sed command.  (p will be used twice -- once for each output string.)
The sed command starts by reading one line of input (one Portuguese sentence) into sed's pattern space. (This is automatic with sed.)
The first sed command, h, copies the pattern space into the hold space, so we've saved a copy of the input string for use later to compute the 2nd output.
Next comes $p\1\2/, which expands to ;s/(\w*)-(\w*)/nao \1\2.  The command after the sed command separator (;) inserts the nao in the right place and removes the -.
The sed command p prints the pattern space.  That's the first output string.
The sed command g copies the hold space to the pattern space.  Now the pattern space contains the original input string again.
The next sed command, s/([aeiou])-/\1s-/ appends an s to the verb if the verb ends with a vowel.
Next comes $p\2 \1, which expands to a sed command that inserts nao, reverses the order of the verb and the pronoun, and replaces the hyphen with a space.
Finally, the pattern space is printed (no command needed -- by default, sed does this automatically at the end).  That's the second output string.

Note that the sed command is run on each input line separately, so you can process as many sentences as you want in a single run of the program.

This seems to work for 75 bytes somehow?

@Neil -- That's clever; it looks like you're taking care of appending the s (if needed) before rearranging.  Thank you!

Since the input is guaranteed to have a -, you can pass p as a flag to the first s command to print after substitution, thus saving a byte.

@user41805 Thank you!

Java 8, 107 121 119 107 bytes
s->s.replaceAll("(.*?)(\\w+)-(\\w+)(.*)","$1nao $2$3$4;$1nao $3 $2"+(s.matches(".*[aeiou]-.*")?"s$4":"$4"))

+14 bytes for a bugfix (thanks to @ovs for mentioning it)
-12 bytes thanks to @Arnauld. Now we're back to the initial -bugged- byte-count again. xD
Outputs with ; delimiter between the two sentences.
Try it online.
Explanation:
s->               // Method with String as both parameter and return-type
  s.replaceAll(   //  Replace in the input-String:
   "(.*?)(\\w+)-(\\w+)(.*)",
                  //   This regex match
   "$1nao $2$3$4;$1nao $3 $2"
                  //   With this replacement,
     +(           //   which is appended with:
       s.matches(".*[aeiou]-.*")?
                  //    If the input-String matches this regex fully:
         "s$4"    //     Append "s$4" to the replacement
        :         //    Else:
         "$4"))   //     Append "$4" to the replacement instead

Regex explanation:
(.*?)(\\w+)-(\\w+)(.*)        # MATCH:
(   )                         #  Capture group 1:
 .*                           #   Any amount of (optional) leading characters
   ?                          #   Which are optional (to lower their priority in comparison
                              #                       to the next groups)
     (   )                    #  Followed by capture group 2:
      \w+                     #   Any amount of alphanumeric characters
          -                   #  Followed by a literal "-"
            (   )             #  Followed by capture group 3:
             \w+              #   Any amount of alphanumeric characters
                 (  )         #  Followed by capture group 4:
                  .*          #   Any amount of (optional) leading characters
$1nao $2$3$4;$1nao $3 $2s$4   # REPLACEMENT:
$1                            #  Content of capture group 1
  nao                         #  Followed by a literal "nao "
      $2$3$4                  #  Followed by the contents of capture groups 2, 3, and 4
            ;                 #  Followed by a literal ";" as separator
             $1               #  Followed by the content of capture group 1
               nao            #  and a literal "nao " again
                   $3         #  Followed by the content of capture group 3
                              #  Followed by a literal " "
                      $2      #  Followed by the content of capture groups 2
                        s     #  Followed by a literal "s", iff the match below is truthy
                         $4   #  Followed by the content of capture group 4

 .*[aeiou]-.*                 # Check if the string matches this string:
^            $                #  It tries to match the ENTIRE string (which is done
                              #  implicitly by the `String#matches` method)
 .*                           #  Any amount of leading characters
   [aeiou]                    #  Followed by a single vowel character
          -                   #  Followed by a literal "-"
           .*                 #  Followed by any amount of trailing characters

Retina, 47 bytes
(\w*?([aeiou])?)-(\w+)
nao $1$3$"nao $3 $1$#2*s

Try it online!
The verb consists of some characters \w*? and an optional vowel ([aeiou])?. The pronoun is just some characters \w+ after the hyphen.
VERB-PRONOUN gets replaced by nao VERBPRONOUN (nao $1$3), POST_MATCH NEWLINE PRE_MATCH ($"), nao  PRONOUN VERB (nao $3 $1) and, if ([aeiou])? had a match, a trailing s ($#2*s).

SNOBOL4 (CSNOBOL4), 145 bytes
	W =SPAN(&LCASE)
	INPUT ARB . L W . V '-' W . P REM . R
	L =L 'nao '
	OUTPUT =L V P R
	V ANY('aeiou') . E RPOS(0) =E 's'
	OUTPUT =L P ' ' V R
END

Try it online!
Explanation:
	W =SPAN(&LCASE)				;* Alias for SPAN(&LCASE), which matches at least one character from &LCASE,
						;* the lowercase letters, so I guess it's [a-z]+
	INPUT ARB . L W . V '-' W . P REM . R	;* match the input against the following pattern:
		;* ARBitrary match, save as L, the Left part of the sentence
		;* SPAN(&LCASE) save as V, the verb
		;* hyphen
		;* SPAN(&LCASE) save as P, the pronoun
		;* REMainder of the match, save as R, the Right part of the sentence
	L =L 'nao '				;* concatenate 'nao ' to the end of L
	OUTPUT =L V P R				;* print L V P R
	V ANY('aeiou') . E RPOS(0) =E 's'	;* if V ends (RPOS(0)) in aeiou, add S to the end
	OUTPUT =L P ' ' V R			;* and output the new sentence.
END

Japt, 41 bytes
2ÆË=q-)ÊÉ?X?DÔ¸r"%v$""$&s":Dq)i"nao ":D}S

Try it
Alternative, with output being list of words:
Japt -R, 40 bytes
2ÆË=q-)ÊÉ?X?DÔ¸r"%v$"_+'s:Dq)i"nao " ¸:D

Try it

Nicely golfed but I do question the output format.

This output format isn't acceptable for this challenge, sorry.

I see in your answer history that the 41 byte solution still had an acceptable format. You are welcome to rollback to that one, if you please.

@RGS I have rolled back to my old answer. However, I have attached another answer which actually outputs a list of words

@RGS May I ask why this answer was marked as non-compteting in the scoreboard?

@EmbodimentofIgnorance I haven't updated it yet, I know, sorry. Your answer is eligible since you did the rollback.

@RGS Is the 40 byte answer valid? It outputs a list, when joined together with a spaces, form a string that is a sentence

Jelly, 37 bytes
e€ØẹṪ”sxṭ
ṚKÇ,ṭ€“nao ”
ṣÇ¥Wċ?€”-ŒpK€Y

Try it online!
A full program that takes a list of words and prints a the output separated by newlines.

JavaScript (ES6),  81 80  79 bytes
Returns a single string with the two sentences separated by a /.
s=>s.replace(/(\w+)-(\w+)/,"nao $1$2$'/$`nao $2 $"+(/[aeiou]-/.test(s)?'1s':1))

Try it online!
Commented
s =>                       // s = input string
  s.replace(               // replace in s
    /(\w+)-(\w+)/,         //   (verb)-(pronoun) with
    "nao $1$2$'" +         //   1st sentence:
                           //     implicit left context
                           //     + "nao verbPronoun"
                           //     + explicit right context ($')
    "/" +                  //   append our separator
    "$`nao $2 $" + (       //   2nd sentence:
                           //     explicit left context ($`)
                           //     + "nao pronoun verb",
                           //     where 'verb' is built as follows:
      /[aeiou]-/.test(s) ? //       if there's a vowel before the '-' in s,
                           //       i.e. if the verb ends with a vowel:
        '1s'               //         append '1s' (which gives "$1s")
      :                    //       else:
        1                  //         just append '1' (which gives "$1")
    )                      //     + implicit right context
  )                        // end of replace()

Excel, 311 Bytes
B2 <- Input
B3 =LEN(B2)
B4 nao <- Required trailing space
B5 aeiou
B6  <- Cell contains a single space
C3 -
C4 '<- Single results in empty (text formatted) cell
C5 :
D2 =TEXTJOIN(B6,,IF(ISERR(SEARCH(C3,D3#:C3)),D3#:C3,D4#:D5#:C5))<- Output
D3 =TRIM(MID(SUBSTITUTE(B2,B6,REPT(B6,B3)),(SEQUENCE(,B3-LEN(SUBSTITUTE(B2,B6,))+1)-1)*B3+1,B3))
D4 =B4&SUBSTITUTE(D3#,C3,)
D5 =D6#&IF(ISERR(SEARCH(RIGHT(D6#,1),B5)),"","s")
D6 =B4&RIGHT(D3#,LEN(D3#)-D7#)&B6&LEFT(D3#,D7#-1)

This answer would be so much shorter if SUBSTITUTE was renamed to SUBS (Microsoft pls fix)
Sample Image

I like the "Microsoft pls fix" as if it were a bug or something !

Yeah, it's not like people are using Excel for SUBStractions, so there can't be any confusion.

Japt, 42 bytes
2Ær7î"%w+-" _X?Zq- Ô¸r"%v$"_+'s:Zr-)i"nao

Try it

Thanks for your submission. What is the -R in the end of the input?

@RGS It's actually a flag; I don't know why he put it in the input box, but you can move it to the flag box and it works fine.

@Neil, Japt can takes flags in its input field by default but I added a dedicated field to my interpreter. When they're not relevant to my solution, though, I generally place them in the input field. In this instance, the -R flag is just formatting the output for easier reading.

Had @RGS required that output be a newline separated string, on the other hand ...

Python 3, 111 bytes
(*a,v),(p,*b)=map(str.split,input().split('-'))
for c in[v+p,p+' '+v+'s'*(v[-1]in'aeiou')]:print(*a,"nao",c,*b)

Try it online!
Method of taking input thanks to @ovs. I felt that this is a big enough change to warrant its own answer, however.

R, 111 bytes
cat(sub(r<-"(\\w+)-(\\w+)","nao \\1\\2",s<-scan(,"")),1,sub(r,paste0("nao \\2 \\1","s"[grep("[aeiou]-",s)]),s))

Try it online!
I am pretty bad at regexing, so there is probably inspiration for something better to be found in other answers.
Note that scan(,"") splits words on spaces, making it easier to manipulate the strings. In the output, the two sentences are separated by a 1.
More readable :
r <- "(\\w+)-(\\w+)"                       # regex to match the word with a dash
s <- scan(, "")                            # stdin
cat(sub(r, "nao \\1\\2", s),
    1,
    sub(r, paste0("nao \\2 \\1",
                 "s"[grep("[aeiou]-", s)]) # add an s or NULL, depending on whether the letter before the dash is a vowel or not
        , s))

Ruby, 94 87 83 81 bytes
->s{['\1\2','\2 \1'+"#{s=~/[aeiou]-/&&?s}"].map{|r|s.sub /(\w+)-(\w+)/,'nao '+r}}

Try it online!

Julia 1.0, 121 118 116 bytes
s->((x=(r=match(r"(.*)\b(\w+)-(\w+)(.*)",s))[1]*"nao ")*(y=r[2])*r[3]*r[4],x*r[3]*" "*y*"s"^(y[end]∈"aeiou")*r[4])

Try it online!

Your TIO link produces no output at all. Is this supposed to happen?

@RGS if all the tests pass it produces no output, if any of them fail it throws an error

Perl 5 -p, 67 58 bytes
s%(\w*)-(\w+)%"nao $1$2$'
$`nao $2 $1"=~s/[aeiou]\K$/s/r%e

Try it online!

sed 4.2.2 -E, 72 bytes
h;s/(\w*)-(\w*)/nao \1\2/p;g;s/([aeiou])-/\1s-/;s/(\w*)-(\w*)/nao \2 \1/

Port of Mitchell Spector's Bash answer.
Try it online!

It looks like it worked :) why did you only have 15 minutes?

@RGS The 96-hour limit.

You still have almost one full day..! 96 hours is 4 days :)

@RGS I don't think I'll try the C++ solution I was thinking of... This challenge is really hard without regex.

Pure Bash, 118 117 bytes
a=${1%-*}
b=${1#*-}
v=${a##* }
u=${v#${v%[aeiou]}}
h=${a%$v}nao
p=${b%% *}
t=${b#$p}
echo $h $v$p$t,$h $p $v${u:+s}$t

Try it online!
I decided to see what I could do with pure bash (no Unix utilities), and this is what I came up with.  It can probably be golfed some more.
Input is passed as an argument.
The output is a comma-separated string containing the two desired results.

Batch, 265 bytes
@echo off
set m=
set n=
for %%w in (%*) do set w=%%w&call:w
echo%m%
echo%n%
exit/b
:w
if %w:-=%==%w% set m=%m% %w%&set n=%n% %w%&exit/b
set m=%m% nao %w:-=%
set v=%w:-=^&rem %
set n=%n% nao %w:*-=% %v%
for %%v in (a e i o u)do if %n:~-1%==%%v set n=%n%s

Takes input as command-line parameters. Explanation: The main work is done by the :w subroutine, which receives each word in turn passed in a variable so that substitutions can be performed on it. The first substitution is simply deleting the -; if this doesn't change the word then we're not interested in the word and we just concatenate it to the outputs. Otherwise, for the first output, we just add nao and the substituted word. For the second output things get a little more complicated. Although we can substitute all characters up to and including the - with the empty string to give us the pronoun, the verb is a bit tricker. Fortunately due to a quirk of Batch processing we effectively get to exec the result of the substitution, turning the pronoun into a comment. (This behaviour also eats the leading space in the output when we echo it.) It then remains to see whether the verb ended in a vowel and if so suffix an s. Example:
set m= nao dame             `m` becomes ` nao dame`
set v=da^&rem me            `v` becomes `da&rem me`
set n= nao me da&rem me     `n` becomes ` nao me da`,
                            as the `rem me` is now a comment.

GolfScript, 62 bytes
"-"/~2/(:f;:e;" ":s/.)" nao ":w\f\s\e++++\s*\+p~w\f e++++s\++p

Boy do I hate string parsing.
This is nowhere near optimised and can very easily be brought down below 50 bytes, I just don't have the bother right now.
Ugh.
TLDR of the process
Split along the hyphen. Remove the next two letters on the right side. Split the left half by spaces and duplicate it. Shove the "nao" and the two letters where they belong and print.
Try it online!

vi, 48 bytes
yyPf-xbinao ␛bj.:s/\([aeiou]\)-/\1s-/e␍f-r ldbwP

␍ means the Enter key and ␛ means the Escape key. Explanation:
yyP

Duplicate the input line.
f-x

Delete the - on the first line.
binao ␛bj.

Insert the nao on both lines.
:s/\([aeiou]\)-/\1s-/e␍

Append an s to the vowel if necessary.
f-r l

Change the - to a space.
dbwP

Swap the verb and pronoun.

T-SQL, 304 bytes
I added some linebreaks to make it readable
SELECT
stuff(replace(@,d+w,iif('eioua'like'%'+right(w,1)+'%',w,p)),z,0,f),
stuff(replace(@,d+w,iif(substring(@,q-2,1)=p,'',p)),z,0,f+w+y)FROM(
SELECT substring(@,q,charindex(y,@+y,q-1)-q)w,len(@)
-charindex(y,s,charindex(d,s)+1)+2z,*
FROM(SELECT-~charindex('-', @)q,'nao 'f,' 'y,'-'d,'s'p,reverse(' '+@)S)Q)L

Try it online(ungolfed)

PHP, 159 bytes
for($t=2;$t--;)echo preg_replace_callback('#(\w+?)([aeiou]?)-(\w+)#',fn($m)=>'nao '.$m[$t*2+1].($t?' ':'').$m[2-$t].$m[3-$t].($t&&$m[3-$t]?'s':''),$argn),"\n";

Try it online!
The array numbering is messy, there's more juice to be squeezed there.

Jelly,  41 38 37  36 bytes
ṚKµe€ØẹṪ”sxṭÑ
“nao ”;
ṣ”-⁹Ŀ¹Ḋ?¥þ2K€Y

A full program accepting a single argument, a list of words, which prints to STDOUT.
Try it online!
How?
ṚKµe€ØẹṪ”sxṭÑ - Link 1: list of lists of characters, Parts
Ṛ             - reverse
 K            - join with space characters, call this R
  µ           - start a new monadic chain
     Øẹ       - lower-case vowels
    €         - for each character, C, in R:
   e          -   (C) exists in (vowels)?
       Ṫ      - tail (i.e. is the last character a vowel?)
        ”s    - 's' character
          x   - times (i.e. X = ['s'] or [])
           ṭ  - tack (X) to (R)
            Ñ - call the next link (Link 2) as a monad

“nao ”; - Link 2: list, V
“nao ”  - list of characters "nao "
      ; - concatenate ("nao " with V)

ṣ”-⁹Ŀ¹Ḋ?¥þ2K€Y - Main Link: list of lists of characters, words
          2    - literal two
         þ     - outer-product (W in words)*(N in implicit range of 2 = [1,2]) with:
        ¥      -   last two links as a dyad  - i.e. f(W, N):
ṣ              -     split (W) at any:
 ”-            -       hyphen character
       ?       -     if...
      Ḋ        -     ...condition: dequeue (empty is falsey)
    Ŀ          -     ...then: call Link at line number:
   ⁹           -           chain's right argument (N)
     ¹         -     ...else: identity - do nothing
           K€  - join each with space characters
             Y - join with newline characters
               - implicit print

Charcoal, 50 bytes
≔⊟Φ⪪θ №ι-η≔⪪η-ζＥ⟦⪫ζω⁺⪫⮌ζ ×s№aeiou§§ζ⁰±¹⟧⪫⪪θη⁺nao ι

Try it online! Link is to verbose version of code. Explanation:
≔⊟Φ⪪θ №ι-η

Split the input on spaces and extract the word that contains a -.
≔⪪η-ζ

Split that word on its -.
  ⪫ζω

Join the parts together.
⁺⪫⮌ζ ×s№aeiou§§ζ⁰±¹

Reverse the parts and join them with a space, then append as many ss as there are vowels in the last letter of the first word.
Ｅ⟦...⟧⪫⪪θη⁺nao ι

Prefix nao to each of the two above values and substitute them for the original word.

Thanks for your submission and explanation. I just explicitly allowed the input string to be a list of words, so you can save a couple of bytes by not doing the splitting by yourself.

@RGS Actually it doesn't help because it's easier to replace the hyphenated word this way.


text:
String-wise calculus (i)
This will turn into a series involving other aspects of calculus, including using the "derivative" of a string to find "stationary points" etc, as well as "integration" of sentences
Introduction
If y'all have ever studied calculus, you'll most likely know that differentiation is limited to differentiable functions.
Not that there's anything wrong with that, but have you ever wondered what it'd be like to take the first (or second) derivative of a word? Or how about a sentence? You probably haven't, so let me explain my theory of string based differentiation.
The Basics
If you already know how differentiation works, feel free to skip this part
When being introduced to the concept of differential calculus, most beginners are taught about the concept of differentiation from first principles. This is based on the concept of finding the gradient of a tangent to a curve via the gradient formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
On the tangent, we say that we have two points: \$(x, f(x))\$ and \$(x + h, f(x + h))\$, where \$h\$ is an infinitesimal number. Plugging this into the gradient formula gives:
$$
m = \frac{f(x+h)-f(x)}{x+h-x} = \frac{f(x+h) - f(x)}{h}
$$
In order to eliminate any inaccuracies from the tangent's gradient, we take the limit of the above equation as \$h\$ approaches 0, giving us:
$$
\frac{d}{dx}(f(x)) = \lim_{h\to 0}\left(\frac{f(x+h)-f(x)}{h}\right)
$$
Now, you may be asking "how on earth does that apply to string calculus? First-principles uses functions and numbers, not characters!"
Well, for this challenge, I've devised a slightly modified version of the first principles concept. The "formula" we'll be using is:
$$
\frac{d}{dx}(y) = \sum_{h=-1}^{1}\left(h\left[y\left[x+h\right]-y\left[x\right]\right]\right) = y\left[x+1\right]-y\left[x-1\right]
$$
The Formula Explained
One of the major differences here is that there is no longer a limit being taken of the equation. That's because it doesn't quite make sense having something approaching 0 for the whole string. Rather, we use a \$\sum\$ to inspect the characters to the left and right of the character in question.
Also, inside the sum, the first \$y\$ is now being multiplied by the \$h\$. This is to ensure that the result is balanced, as without it, the results weren't very reflective of the string.
To evaluate this formula for a certain index \$x\$, you:

Evaluate \$-y[x-1] + y[x]\$
Evaluate \$0\$
Evaluate \$y[x+1] - y[x]\$
Summate the above three items.

Essentially, you are calculating the following:
$$
y[x+1]-y[x-1]
$$
Note that when subtracting things, the ordinal values are used. E.g. c  - a = 99 - 97 = 2
If any position becomes negative, it starts indexing from the back of the string (like python does). If any position becomes greater than the length of the string, the character is ignored.
Applying Differentiation to the Whole String
By now, you may have noticed that the first principles formula only works on individual characters, rather than the whole string. So, in this section, we will develop a more generalised approach to using the formula.
To apply the formula to the whole string, we get the derivative of each character in the string, convert those numbers to characters based on code point conversion (like python's chr() function) and concatenate the results into a single string. Now, the problem here is that results may sometimes be negative. To solve this problem, we will introduce a second string to store information: the sign string.
This string will consist of a combination of any two letters of your choice, representing whether or not a character is positive.
Worked Example
Let's take a look at what would happen with the word Code:

We start at position 0 (C). The three parts for this character are -(e + C), 0 and o - c. These evaluate to -34, 0 and 44. The sum of these is 10 and the sign is +. So a newline is added to the main string, and a + is added to the sign string.
We then move to position 1 (o). The three parts are: -(o + C), 0 and d - o. These evaluate to 44, 0 and -11. The sum of these is 33, so a ! is added to the main string and a + is added to the sign string.
We then move to position 2 (d). The three parts are: -(o + d), 0 and e - d. These evaluate to -11, 0 and 1. The sum of these is -10, so a new line is added to the main string and a - is added to the sign string.
We finally move to position 3 (e). The position 3 + 1 is longer than the length of the string, so therefore, the process ends.

Therefore, the final result is ["\n!\n", "++-"]
Test Cases
Format is input, newline, output. These test cases were generated using Python, and uses UTF-8.
Code
('\n!\n', 'ppn')
Code Golf
('\t!\nD\x1eO%\t', 'ppnnnppn')
Cgcc
('\x04 \x04', 'ppn')
Lyxal
('\r,\x18\x0c', 'ppnn')
3 - 3 = 0
('\x10\x06\x00\x06\x00\n\x00\r', 'nnpppppn')
Lim x -> 0
('9!I\x0b\x00K\x1e\r\x0e', 'ppnppnpnn')
lim x -> 0
('9\x01I\x0b\x00K\x1e\r\x0e', 'ppnppnpnn')

('', '')
afanfl;aknsf
('\x00\x00\x08\x05\x02+\x0b0\r\x08\x08', 'ppppnnnpppn')
nlejkgnserg
('\x05\t\x02\x06\x03\x03\x0c\t\x01\x02', 'pnnpnppnnp')
38492
('\x06\x01\x01\x02', 'pppn')
abcdefghijklmnopqrstuvwxy
('\x17\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02\x02', 'nppppppppppppppppppppppp')
KLJBFD
('\x08\x01\n\x04\x02', 'pnnnp')
::::::::::::
('\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'ppppppppppp')
aaa
('\x00\x00', 'pp')
aaaaa
('\x00\x00\x00\x00', 'pppp')

Rules

Input will be restricted to printable ASCII
You can use any codepage you like for the output, just so long as it is consistently used. This means that UTF-8, CP437, etc. are fair game.
Input can be taken in any convenient and reasonable format
Output can be given in any convenient and reasonable format. Suggested formats include: a list of both strings, each string on a newline, both strings joined together. It's up to you really how you want to output the result.
Unicode sequences (like \x00 or \x05) can be used in the output if wanted. In other words, both real representations and Unicode control sequences are valid output given they are applied consistently.
You can use any two characters for the string sign. That's right! It doesn't have to be + and -... it could be p and n or 3 and '. It really doesn't matter as long as you use two distinct characters.
For this challenge, 0 is considered positive.

Both full programs and functions are allowed.

Scoring
Of course, this is code-golf, so the shortest answer wins!
Reference Program
Try it online!
Special Thanks
I'd just like to say a huge thanks to @xnor and @FryAmTheEggman for showing me that my original model of string differentiation was not the best way of doing things. I'm much happier with this new method that you see here!

How is -(e + C) = -34 do you mean -e + C

Can we  use  truthy/falsy to represent positive/negative? And can we output nothing for an empty string input?

@Noodle9 you may indeed do that

In college I thought it was just coincidence that calculus and Cthulhu both start with 'C'. Now I'm not so sure...

05AB1E, 12 11 bytes
Ç¤š¥ü+Dd‚Äç

-1 byte thanks to @ExpiredData.
Uses I/O with UTF-8 encoding like the challenge description, and uses characters \0 for negative and \1 for 0 or positive. Outputs as a list of list of characters.
Try it online or verify all test cases (the Join is added to pretty-print the character-lists to strings, but feel free to remove it to see the actual output).
Explanation:
Ç            # Convert the characters in the (implicit) input-string to their unicode values
             #  i.e. "Code!!!" → [67,111,100,101,33,33,33]
 ¤š          # Prepend its own trailing item (without popping it)
             #  → [33,67,111,100,101,33,33,33]
   ¥         # Pop and push the deltas (forward differences) of this list
             #  → [34,44,-11,1,-68,0,0]
    ü        # For each overlapping pair of differences:
             #   → [[34,44],[44,-11],[-11,1],[1,-68],[-68,0],[0,0]]
     +       #  Sum them together
             #   → [78,33,-10,-67,-68,0]
      D      # Duplicate this list
       d     # Check for each whether it's >=0 (0 if negative; 1 if 0 or positive)
        ‚    # Pair those two lists together
             #  → [[78,33,-10,-67,-68,0],[1,1,0,0,0,1]]
         Ä   # Take the absolute value of each
             #  → [[78,33,10,67,68,0],[1,1,0,0,0,1]]
          ç  # And convert all integers to ASCII characters
             #  → [["N","!","\n","C","D","\0"],["\1","\1","\0","\0","\0","\1"]]
             # (after which this pair of character-lists is output implicitly as result)

11 bytes if you make your distinct values ascii 1 and ascii 0

Wow! I would not have thought that this could be solved in just 11 bytes. Well done! +1

Burlesque, 39 bytes
)**iRrtm{{0 2}sip^.-}~]Jm{0>=}j{abL[}\m

Try it online!
)**       # Map ord() on string
iR        # Generate all rotations
rt        # Rotate once to put deriv[0] to first pos
m{        # Map
 {0 2}si  # Take the 0th and 2nd chars (either side)
 p^       # Push (un-array)
 .-       # Difference
}
~]        # Discard last (i.e. deriv[-1])
J         # Duplicate
m{0>=}    # Create pos/neg list as 0,1
j         # Swap
{
 ab       # Abs
 L[       # Chr()
}\m       # Map and concat to str

If there's one thing I enjoy about your answers on CGCC, it's your complete dedication to Burlesque. I like how you've picked up a language and stuck with it. +1

@Lyxal Well, my day to day languages are Fortran and Python (besides small programs). I quite like the challenge of solving things and thinking in a different way. I am not going to be competitive when it comes to some of the insane Python tricks people pull and Fortran really doesn't come close to anything resembling golf usually.

Jelly, 13 bytes
LŻịOI+Ɲµ>-,AỌ

Try it online!
Uses \0 and \1 for the sign string, the Footer converts the output into code points to be clearer
How it works
Just a refresher on Jelly's indexing rules: 1-indexed, wrapping modularly. That means that 0 ị “1234” returns 4.
LŻịOI+Ɲµ>-,AỌ - Main link. Takes a string s on the left
L             - Length of s
 Ż            - [0, 1, 2, ..., len(s)]
   O          - Yield the code points of s
  ị           - Index into the code points with the range
                This is equivalent to prepending the last character of s
    I         - Forward differences
     +Ɲ       - Sums of overlapping pairs
       µ      - Call these sums S and use as the left and right arguments
        >-    - Is each sum greater than -1?
           A  - Yield the absolute values of each sum
          ,   - Pair
            Ọ - Convert to characters

Python 3, 119 \$\cdots\$ 92 91 bytes
Saved 6 bytes thanks to Kevin Cruijssen!!!
Added 6 bytes to handle empty string input.
lambda s:zip(*[(chr(abs(S)),S<0)for S in(ord(s[i+1])-ord(s[i-1])for i in range(len(s)-1))])

Try it online!
Outputs a sequence of: a tuple of characters and a tuple of True/False for negative/positive values.

113 bytes by combining the a,b into a sum S.

@KevinCruijssen Ah, very nice - thanks! :-)

Interesting use of and to handle the empty string! I wouldn't have thought of using Python's short-circuiting in that way. +1

@Lyxal Turns out it's one less byte to use range instead of the and short-circuit with zip to handle the empty string input.

Charcoal, 28 bytes
≔Ｅ⊖Ｌθ⁻℅§θ⊕ι℅§θ⊖ιθ⟦⭆θ‹ι⁰⭆θ℅↔ι

Try it online! Link is to verbose version of code. Outputs the signs first (0=+,1=-) as otherwise the default print format will mangle the newlines. Explanation:
≔Ｅ⊖Ｌθ⁻℅§θ⊕ι℅§θ⊖ιθ

Compute the pairs of ordinal differences, excluding the last pair (which in Charcoal would normally wrap around to 0).
⟦⭆θ‹ι⁰⭆θ℅↔ι

Print the signs of the differences and the characters of the absolute values of the differences.

Where is the map function documented within the charcoal docs? I seem to be able to find it. Still, nice answer. +1

@Lyxal Since it returns a result, it's on the Operators page, but it's listed under "Other" at the end of that page.

Ruby, 87 85 82 bytes
->s{d=n='';i=0;loop{k=s[i+=1].ord-s[i-2].ord;n+="++-"[k<=>0];d<<k.abs}rescue[d,n]}

Try it online!

What does the rescue at the end do? I've never learnt Ruby, but this answer looks impressive (+1)

rescue is Ruby's equivalent to catch; it performs exception handling. I'll write a full explanation later, but basically I let my counter i go past the end of the string and catch the error to save bytes over actually stopping at i<s.size-1, which is just a little more expensive.

authors: Bob Jarvis - Слава Україні