| Bytes | Lang | Time | Link |
|---|---|---|---|
| 018 | Haskell | 250606T191910Z | Ibozz91 |
| 006 | APL+WIN | 250606T085956Z | Graham |
| 006 | Charcoal | 250606T070831Z | Neil |
| 026 | Desmos | 250606T000636Z | Lucenapo |
| 017 | Google Sheets / Excel | 250605T144226Z | z.. |
| 025 | PowerShell | 250605T142415Z | user3141 |
| 019 | Ruby | 250605T141548Z | Jordan |
| 003 | 05AB1E | 250605T135419Z | Kevin Cr |
| 003 | Vyxal 3 | 250605T121448Z | Themooni |
| 026 | Python 2 | 250605T111525Z | squarero |
| 027 | JavaScript Node.js | 250605T112818Z | l4m2 |
| 063 | Python 3 | 250605T093241Z | Natelolz |
APL+WIN, 6 bytes
Prompts for a vector of measurements and uses ¯1 to indicate tamper.
¯1⌈+/⎕
Charcoal, 6 bytes
I⌈⟦±¹Σ
Try it online! No verbose version because it can't do implicit input. Uses -1 as the tamper value. Explanation: Same as everyone else.
Implicit input
Σ Take the sum
¹ Literal integer `1`
± Negated
⌈⟦ Take the maximum
I Cast to string
Implicitly print
Google Sheets / Excel, 17 bytes
Expects input in A:A
=MAX(SUM(A:A),-1)
PowerShell, 25 bytes
%{$s+=$_};($s,-1)[$s-lt0]
Sums the values in ForEach-Object (%) loop, then uses an array indexed with a truthy/falsy value to avoid if/else.
Input comes from the pipeline.
05AB1E, 3 bytes
O®M
Uses -1 as tamper value.
Try it online or verify all test cases.
Explanation:
O # Take the sum of the (implicit) input-list
® # Push -1
M # Push a copy of the maximum value on the stack
# (after which the top value is output implicitly as result)
Vyxal 3, 3 bytes
∑⑧Ġ
∑⑧Ġ
Ġ # max( )
⑧ # -1,
∑ # sum(implicit input)
💎
Created with the help of Luminespire.
<script type="vyxal3">
∑⑧Ġ
</script>
<script>
args=[["[10,10,10,-10]"],["[-5,-7,24,0]"],["[-10,100,-10,-10]"],["[10, -1, -5, -4]"],["[6, -7, 8, -8]"],["[6, -9, 8, -8]"]]
</script>
<script src="https://themoonisacheese.github.io/snippeterpreter/snippet.js" type="module"/>
Python 2, 29 26 bytes
-3 bytes by l4m2.
Uses -1 as the tamper value.
print max(sum(input()),-1)
You can do 27 23 bytes if functions are allowed.
Python 3, 63 Bytes
a=sum(map(int,input().split()));print("T")if a<0 else print(a)
Breakdown:
a=sum(map(int,input().split())) - Get input, convert to integer, sum
print("T")if a<0 else print(a) - Check for tamper, otherwise print
Can definitely shorten, but a decent solution nonetheless