[Question]
  [
I'm hungry. Let's microwave something. Given a numerical input of between 1 and 4 digits, output the number of seconds that the microwave should run.
## Details
The trick is figuring out if the user is inputting seconds or a combination of seconds and minutes. The ones and the tens places should be interpreted as seconds and the hundreds and thousands places should be minutes. For example, the value `1234` should be interpreted as 12 minutes, 34 seconds and `9876` should be 98 minutes, 76 seconds. Typing `130` and `90` should both result in a cook time of 90 seconds.
Here are a few other inputs and outputs:
* 1 = 1
* 11 = 11
* 111 = 71
* 1111 = 671
* 9 = 9
* 99 = 99
* 999 = 639
* 9999 = 6039
## Rules
This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest program in bytes wins. Standard loopholes are not allowed. The winning entry must return the right answer when given any integer input from 1 to 9999.
  
[Answer]
# [Python 2](https://docs.python.org/2/), 19 bytes
```
lambda t:t-t/100*40
```
[Try it online!](https://tio.run/##K6gsycjPM/qfZhvzPycxNyklUaHEqkS3RN/QwEDLxOB/Wn6RQolCZp6CoY6CIRhDCCBpCURgDCEsrbgUFAqKMvNKFNI0SjT/AwA "Python 2 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 6 bytes
```
ìL ì60
```
[Test it online!](https://ethproductions.github.io/japt/?v=1.4.5&code=7Ewg7DYw&input=OTk5OQ==) `ìL` converts to base-100, and `ì60` converts back to base 60, resulting in `floor(n/100)*60 + n%100`. Also works with hours (`10000 -> 3600`, the number of seconds in an hour).
[Answer]
# Pyth - ~~9~~ 8 bytes
Converts input to base 100, then interprets that as a base 60 number.
```
ijQ*TT60
```
[Test Suite](http://pyth.herokuapp.com/?code=ijQ%2aTT60&test_suite=1&test_suite_input=1%0A11%0A111%0A1111%0A9%0A99%0A999%0A9999&debug=0).
[Answer]
# TI-Basic (83 series), 8 bytes
```
Ans-40int(sub(Ans
```
Requires OS version 1.15 or higher.
[Answer]
## C, C++, Java, C#, D : 36 bytes
### D : 35 bytes
### C : 28 bytes
First time i have an answer that short !
```
int r(int i){return i/100*60+i%100;}
```
D can have a special optimization because of the golfy template system :
```
T r(T)(T i){return i/100*60+i%100;}
```
C has a special optimization with the implicit int :
```
r(i){return i/100*60+i%100;}
```
Code to test   
In **C** ( have to include `stdio.h` ) :
```
int main() {
    int testArr[] = {1,11,111,1111,9,99,999,9999};
    for(int i=0;i<8; ++i) {
        printf("%d = %d\n",testArr[i],r(testArr[i]));
    }
    return 0;
}
```
[TIO Link](https://tio.run/##RU7LDsIgELz3K0hNE7CocDE2tCZ@h/ZgoK2bKDWUnhq@HQFtnOxs9pGdWbkbpPQb0PI5q66erIJx/zh7g4EsprOz0QgOnLHtkZVQhEI4D9qi1x00JmjJUEAc2G6yF2OuLWrQwimPkchpRasYiZUT6aQfg0U4g4YJqE8ClSWschFvE7Y9zgsV9Ap10zldHaClBv8bQr6KLuXfz0xkzn8A)
In **C++** ( have to include `iostream` ) :
```
int main() {
    std::initializer_list<int> testList{
        1,11,111,1111,9,99,999,9999
    };
    for (auto x : testList) {
        std::cout << r(x) << '\n';
    }
}
```
[Try it online!](https://tio.run/##PU3RCoMwDHz3K8LGsG6O2ZeBtfgF@4TBkNqNgLZSI8jEb3etMsMll8DlTnXd9aPUsqAhcCxMTCanaXAG8Maz7HzPLnjySzEvRzSqGWoNEm1PTldtGYWXtkLDEpgi8NVTLQQaJKwa/Gr3arAn6WUlkO7p4a9NGIqnPGBtnuZpHrB2vmrmIlr5bR2waiALI4jd5x@5xyo7EEjpRX4cBBwCOzYmgeOniYvNNZqXHw "C++ (gcc) – Try It Online")
In **Java** :
```
public class MainApp {
    int r(int i){return i/100*60+i%100;}
    public static void main(String[]a) {
        MainApp m = new MainApp();
        int testArr[] = new int[]{
                1,11,111,1111,9,99,999,9999
        };
        for (int v : testArr) {
            System.out.println(v + " = " + m.r(v));
        }
    }
}
```
[Try it online!](https://tio.run/##TU9LDoIwEN1ziomJSVFE2JggceEBXLkkLCpWU4RC2qHGEM6ObUX0ZX5t38y8llTTTdMyUV4fY9tdKl5AUVGl4ES5gH7kAkESG7nfS4adFMC3cRStdtGaL02RDqMHBlO3Qoom6YZfoTYzyBklF/cspz70jmjhptdwAMGe7kD8dH6025ApPEqZ5RPH3GX5r/@LOIitOY@DJEisOU9m7pB6c31rJLjfaNh/d/zrsji/FLI6bDoMWyMdK0E0rGFhlCxMrkNJtP8nd/A@cRjf "Java (OpenJDK 8) – Try It Online")
In **C#**
```
class Program {
    int r(int i){return i/100*60+i%100;}
    static void Main(string[] args) {
        var p = new Program();
        int[] testArr = new int[8]
        {
            1,11,111,1111,9,99,999,9999
        };
        foreach(int a in testArr) {
            Console.WriteLine(a + " = " + p.r(a));
        }
    }
}
```
In **D** ( have to import `std.stdio` ) ( exactly, i have no idea how to use arrays in D ) :
```
void main() {
    int[] arr = [1,11,111,1111,9,9,999,9999];
    for(int i = 0; i < arr.length; i++)
        writeln(arr[i]," = ",r(arr[i]));
} 
```
[TIO Link](https://tio.run/##LYvBCoMwDIbP7VMEYdDO4trLQLq9hTfxIOi2gLYj67aD@OxdlJF8JD/5MmScn5ESvNJQMRh9boBUo1UDqBca05sC4MlZezzbEg@8@DV/Ig4w9xiUhkUKDKntoCeCK7TOuK13nKm3qnfqzktxi6RYB2TVeh6X7a@axnBPD85lqaUQX8I0TkHxqcXOFCwXhv5Ray9XyD8)
[Answer]
## [dc](https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html), 10 bytes
```
?9A~r60*+p
```
[Try it online!](https://tio.run/##S0n@/9/e0rGuyMxAS7vg/39DQ0MA)
**Explanation:** in dc when you push sth. on the stack it goes on top
```
?         # read and push the input number on the stack
9A        # push 100: 9 * 10^1 + A[10] * 10^0 :D
~         # divide 2nd nr. by the top nr., push quotient, then remainder
r60*      # swap top 2 nr., then multiply the top by 60
+p        # add top 2 nr., then print result
```
[Answer]
# [Bash](https://www.gnu.org/software/bash/) bc + sed, ~~30~~ 28 bytes
*-2 bytes thanks to [@seshoumara](https://codegolf.stackexchange.com/users/59010/seshoumara).*
```
bc<<<0`sed 's/..\?$/*60+&/'`
```
[Try it online!](https://tio.run/##S0oszvj/PynZxsbGIKE4NUVBvVhfTy/GXkVfy8xAW01fPeH/f0sgAAA)
Takes input from stdin. Went for a more creative approach: inserts `*60+` before the last 1 or 2 digits, and prepends a `0` to the beginning to account for inputs with only 1 or 2 digits. The result is then passed to `bc`.
[Answer]
# Perl 5, 15+1(-p) bytes
```
/..$/;$_-=40*$`
```
* -l switch not counted because for tests readability
[Try it online](https://tio.run/##K0gtyjH9/19fT09F31olXtfWxEBLJeH/f0MuQxACY0MuSy5LEAJjy3/5BSWZ@XnF/3ULcgA)
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 50 bytes
```
t;f(){scanf("%d",&t);printf("%d",t%100+t/100*60);}
```
[Try it online!](https://tio.run/##S9ZNT07@/7/EOk1Ds7o4OTEvTUNJNUVJR61E07qgKDOvBMovUTU0MNAu0QeSWmYGmta1/4FyCrmJmXlAfUC9QAEA "C (gcc) – Try It Online")
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 bytes
As a monadic link (thanks for the heads-up, caird!):
```
b³ḅ60
```
[Try it online!](https://tio.run/##y0rNyan8/z/p0OaHO1rNDP5bAsHh9v8A "Jelly – Try It Online")
... Or as a full program:
```
bȷ2ḅ60
```
This can be ported easily to 05AB1E, so:
# [05AB1E](https://github.com/Adriandmen/05AB1E), 5 bytes
```
тв60β
```
[Try it online!](https://tio.run/##MzBNTDJM/f//YtOFTWYG5zb9/28JBAA "05AB1E – Try It Online")
Simply converts the input integer to base **100** and then converts the result from base **60** to integer. Hence, it is equivalent to **Input % 100 + 60 \* ⌊Input / 100⌋**
[Answer]
# Java 8, 13 bytes
```
n->n-n/100*40
```
Port of [*@ovs*' amazing Python 2 formula](https://codegolf.stackexchange.com/a/147787/52210).
[Try it here.](https://tio.run/##jc9NCoMwEAXgvaeYZSxoI@2mSHuDunFZukhjWmJ1FDMKpXj2NP5sS4QkMPM@eKQUg4iaVmFZvK2shDFwFRq/AYBGUt1TSAXZNM4LkGx6MUzdZnTXHUOCtIQMEM5gMbpghPuE892R23Qhbf@oHFnl0OgCatfCcuo0vm53EOFSkX8MqTpueopbF1GFDGPJknAu/J/7wQbhIydf7gcbhJdw308OqxiD0f4A)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~38~~ 33 bytes
-5 bytes thanks to mazzy
```
$args|%{$_-40*($_-replace'..?$')}
```
[Try it online!](https://tio.run/##K8gvTy0qzkjNyfmvkmZb/V8lsSi9uEa1WiVe18RASwNIFaUW5CQmp6rr6dmrqGvW/q/l4jLUMQQhMDbUsdSxBCEwtgRqVVNJU1CJr/0PAA "PowerShell – Try It Online")
Uses the same formula popularizes by ovs. Truncating is still expensive in PowerShell. Now uses a better regex to instead rip the last one or two characters off to division.
[Answer]
# JavaScript, 21 bytes
```
a=>(a/100^0)*60+a%100
```
[Try it online!](https://tio.run/##HYxBCoMwEAC/0ksxqWuabUXNwX6kKC4aIYImJGn7/FSFGZjTLPSlMHrjYrHZSae5TdS@GN1Ryl7yWyVzuu6dnLejDkGEONlPFD9vomZvBDw4RVCgDk4V4ONZgmrqqhMrObZvZ0Z5lnEuFmu24TLw9Ac)
[Answer]
# [J](http://jsoftware.com/), 12 bytes
```
-40*&<.%&100
```
It's ovs' Python 2 solution expressed in J. It consist of a hook and a fork:
```
┌─┬───────────────────────┐
│-│┌──┬────────┬─────────┐│
│ ││40│┌─┬─┬──┐│┌─┬─┬───┐││
│ ││  ││*│&│<.│││%│&│100│││
│ ││  │└─┴─┴──┘│└─┴─┴───┘││
│ │└──┴────────┴─────────┘│
└─┴───────────────────────┘
       %&100  - divides the number by 100
   *&<.       - finds the floor of the left argument and multiplies it to the left arg.
 40           - 
-             - subtracts the result of the above fork from the input 
```
[Try it online!](https://tio.run/##y/qfVqxgq6dgoGClYPBf18RAS81GT1XN0MDgvyaXkp6CepqtlbqCjkKtlUJaMRdXanJGvkKagiGcYaiAYCKJItiWcAYSC5lp@f8/AA "J – Try It Online")
[Answer]
## Batch, 23 bytes
```
@cmd/cset/a%1-%1/100*40
```
[Answer]
# bash, 20 bytes
```
echo $[$1-$1/100*40]
```
[Try it online](https://tio.run/##S0oszvifll@kkKmQmadgqGAIQmBsqGCpYAlCYGxpnZKvUJxaoqCS@T81OSNfQSVaxVBXxVDf0MBAy8Qg9n9Kfl7qfwA)
[Answer]
# [Haskell](https://www.haskell.org/), 18 bytes
```
f t=t-t`div`100*40
```
[Try it online!](https://tio.run/##y0gszk7Nyfn/P02hxLZEtyQhJbMswdDAQMvE4H9uYmaegq1CbmKBr4JGQVFmXomCnkK6pkK0oY6CIRhDCCBpCURgDCEsY/8DAA "Haskell – Try It Online")
Anotha port.
## Pointfree solution, 21 bytes
```
(-)<*>(*40).(`div`40)
```
[Answer]
## [Retina](https://github.com/m-ender/retina), 11 bytes
```
.{100}
60$*
```
[Try it online!](https://tio.run/##K0otycxL/K@qkaCnzaWi9V@v2tDAoJbLzADE/m/IZQhCYGzIZcllCUJgbAkA "Retina – Try It Online")
Input and output [in unary](http://meta.codegolf.stackexchange.com/questions/5343/can-numeric-input-output-be-in-unary). The test suite converts from and to decimal for convenience.
Doing this kind of base conversion for only up to two digits is surprisingly simple to do in unary. We just match runs of 100 `1`s and replace them with 60 `1`s. Anything that's left over would correspond to the last two digits in the decimal representation and remains unchanged.
[Answer]
## [Alice](https://github.com/m-ender/alice), 19 bytes
```
/o
\i@/.'d%~'d:'<*+
```
[Try it online!](https://tio.run/##S8zJTE79/18/nysm00FfTz1FtU49xUrdRkv7/39DIAAA "Alice – Try It Online")
### Explanation
Too bad I removed *divmod* from the language, I guess...
```
/o
\i@/...
```
This is just the usual framework for linear programs with decimal I/O operating purely in Cardinal (arithmetic) mode.
```
.     Duplicate input.
'd%   Mod 100.
~     Swap with other copy.
'd:   Divide by 100.
'<*   Multiply by 60.
+     Add.
```
[Answer]
## [Labyrinth](https://github.com/m-ender/labyrinth), 19 bytes
```
?:_100%}#00/_60*{+!
```
[Try it online!](https://tio.run/##y0lMqizKzCvJ@P/f3ire0MBAtVbZwEA/3sxAq1pb8f9/Q0NDAA "Labyrinth – Try It Online")
### Explanation
```
?      Read input.
:      Duplicate.
_100%  Mod 100.
}      Move off to auxiliary stack.
#00/   Divide by 100, using the stack depth to get a 1, instead of _1.
_60*   Multiply by 60.
{+     Retrieve the earlier result and add it.
!      Print.
```
The IP then hits a dead end and starts moving backward. When it reaches the `/` it attempts a division by zero which terminates the program.
[Answer]
# Excel VBA, 29 Bytes
Anonymous VBE immediate window function that takes input from range `[A1]` and outputs to the VBE immediate window.
```
?[A1]Mod 1E2+60*[Int(A1/100)]
```
[Answer]
# [APL (Dyalog)](https://www.dyalog.com/), ~~11~~ 10 bytes
```
60⊥0 100⊤⊢
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R2wQzg0ddSw0UDA2A9JJHXYv@/3/Uu0pBA8jSSdM8tOJR72ZjAwMudVt1LqiYgiUQAAA)
**How?**
`0 100⊤` - encode in base 100, stopping at the second LSB, effectively producing `n ÷ 100, n % 100`.
`60⊥` - decode in base 60
[Answer]
# [PARI/GP](http://pari.math.u-bordeaux.fr/), 16 bytes
Straightforward:
```
n->n\100*60+n%100
```
Unfortunately this nice method is simply too long to use:
```
n->[60,1]*divrem(n,100)
```
[Answer]
# [R](https://www.r-project.org/), 21 bytes
```
x=scan();x-x%/%100*40
```
[Try it online!](https://tio.run/##K/r/v8K2ODkxT0PTukK3QlVf1dDAQMvE4L8hlyEIgbEhlyWXJQiBseV/AA "R – Try It Online")
[Answer]
# Common Lisp, 34 bytes
```
(lambda(n)(- n(*(floor n 100)40)))
```
[Try it online!](https://tio.run/##S87JLC74r1FQlJlXoqDxXyMnMTcpJVEjT1NDVyFPQ0sjLSc/v0ghT8HQwEDTxEBTU/O/oaEhkAQA)
Another port of [@ovs' formula](https://codegolf.stackexchange.com/a/147787/52210).
[Answer]
# [Pushy](https://github.com/FTcode/Pushy), ~~10~~ 9 bytes
Kevin outgolfed me in my own language... (using the approach from [ovs](https://codegolf.stackexchange.com/a/147787/60919)' answer)
```
2dH/40*-#
```
**[Try it online!](https://tio.run/##Kygtzqj8/98oxUPfxEBLV/n///@WQAAA "Pushy – Try It Online")**
# 10 bytes
```
sjvj60*^+#
```
**[Try it online!](https://tio.run/##Kygtzqj8/784qyzLzEArTlv5////lkAAAA "Pushy – Try It Online")**
```
s             \ Split input into digits
 jvj          \ Join the first two and the last two
    60*       \ Multiply the first by 60
       ^+     \ Add the values
         #    \ Print
```
# 11 bytes
For one byte more we can use the `Input % 100 + 60 * ⌊Input / 100⌋` approach:
```
H2d%}/60*+#
```
**[Try it online!](https://tio.run/##Kygtzqj8/9/DKEW1Vt/MQEs7/v///5ZAAAA "Pushy – Try It Online")**
[Answer]
# [Husk](https://github.com/barbuz/Husk), 7 bytes
```
B60B100
```
[Try it online!](https://tio.run/##yygtzv6fm18erPOoqfG/k5mBk6GBwf///6MNjYxNdCwtzM10DHUMQQiMDXUsdSxBCIwtYwE "Husk – Try It Online") Not very exciting, just converts to base 100 and back from base 60.
[Answer]
# [Symbolic Python](https://github.com/FTcode/Symbolic-Python), ~~66~~ ~~48~~ 46 bytes
Thanks to [Jo King](https://codegolf.stackexchange.com/users/76162/jo-king) for -16 bytes!
```
__=-~-~_-_
_-=_/(__<<__^__)**__*(__-~__<<-~__)
```
[Try it online!](https://tio.run/##K67MTcrPyUzWLagsycjP@/8/Pt5Wt063Ll43nite1zZeXyM@3sYmPj4uPl5TSys@XgvIB8oCxUCk5v///y0tLQE "Symbolic Python – Try It Online")
---
## Explanation
```
                      # input is initially in _
__=-~-~_-_            # set __ to (2+input-input) = 2
_-=                   # subtract from _:
   _/                 # _ divided by:
     (__<<__^__)**__  # (2<<2 ^ 2) ** 2 = (8^2)**2 = 100
    *                 # multiplied by
     (__-~__<<-~__)   # (2 - ~2 << -~2) = 5 << 3 = 40
                      # value in _ is the implicit output
```
[Answer]
# [GAP](https://www.gap-system.org/), 45 bytes
[Try it online!](https://tio.run/##JYwxDoMwEAR7XrGiwsiRbCkNWHkAHdRAEQUcubmLrPP7nROsdqac7/tXaxxfsdBHElMnBvmUkgnyWApPJJ1Y75zpny6cdIQaOUOQCKu38Be31IP@4taw4@AGujknLUXNW7QbtSY0rK0/)
```
f:=function(t) return t-QuoInt(t,100)*40;end;
```
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), 4 bytes (8 nibbles)
```
`@60`@@
```
```
    `@      # convert input in command-line arg to base
      @     # 100 (default value for @ when no input from STDIN)
`@          # and convert from base
  60        # 60
```
[![enter image description here](https://i.stack.imgur.com/3ZLqv.png)](https://i.stack.imgur.com/3ZLqv.png)
]