We need to read T test cases. For each test case: N days, list of nose lengths Li. We need number of days when Pinocchio lied at least once. Assumption: on first day he told truth (so the length on first day is the baseline truth length). Also note that each time he lies, his nose extends by 1 cm. But also he may tell truth sometimes (no extension). And the nose does not shrink. It can stay the same if he tells truth all day? Actually if he doesn't lie, nose length remains same. If he lies at least once, nose extends by 1 cm per lie. But we only have the length at the end of each day. We need to infer which days had at least one lie.
Given the daily lengths, we need to count days where the length increased from previous day. Because if he lies at least once on a day, his nose will be longer than the previous day (since each lie adds 1 cm). However, there is nuance: could he lie multiple times in a day? The problem says "Each time he lies, his nose is extended by 1 cm." And "he wants to find out the number of days when Pinocchio lied at least once." So if he lies multiple times on a day, the nose length would increase by more than 1 relative to previous day? But is that allowed? The example: lengths: 1,2,2,3,4,5,5. If each lie adds 1 cm, and on day 2 length is 2, so increase by 1 from day1 to day2 => at least one lie on day2. Day3 same as day2 => no lies day3. Day4: 3 -> increase by1 from day3 => at least one lie day4. Day5: 4 -> increase by1 from day4 => at least one lie day5. Day6:5 -> increase by1 from day5 => at least one lie day6. Day7:5 -> no increase => no lies. So total lies days=4. That matches output.
But could there be a case where the nose length increases by more than 1 in a day? That would indicate more than one lie on that day. But the problem statement says "Each time he lies, his nose is extended by 1 cm." And "Lampwick asks Pinocchio some questions each day and notes down the length of his nose in centimeters at the end of the day." So if Pinocchio lies multiple times in a day, the length should increase accordingly. However, the problem asks "number of days when Pinocchio lied atleast once." So whether there are multiple lies on a day, it still counts as one day (if at least one lie). So we need to count days where length increased compared to previous day (since nose never shrinks). That is straightforward: count number of indices i from 2 to N where Li > Li-1.
But there's a catch: what if the nose length increases by more than 1? That would be Li - Li-1 > 1. That still indicates that there was at least one lie on day i (maybe multiple lies). So we count it as one day. So simple approach: for each test case, iterate from second day to N, if Li > Li-1 then increment count.
But wait: could there be a scenario where the nose length stays the same even if he lied? That would be impossible because if he lies, nose extends. So if he lies, nose must be longer. So equality means no lies. Also could there be a scenario where nose length decreases? That would be impossible because nose never shrinks. But given the constraints, input might contain decreasing lengths? Possibly not, but we should assume the input is consistent with the process? The problem likely expects that the input is valid according to the process, but we might need to handle if not? However, problem says "Lampwick recorded the length each day." So it's plausible that the recorded lengths are as per Pinocchio's behavior, thus non-decreasing. So we can just count strict increases.
Thus answer is count of i such that Li > Li-1.
But is there any nuance about the first day? The problem says "Being a trusting friend, Lampwick assumes Pinocchio was telling the truth on the first day." So we don't count day1 as a lie day, because we only consider days he lied at least once. So day1 always not counted (since even if length >0, but we assume truth). So our count from i=2..N works.
But what if length on day1 is not 1? Actually the example starts with 1. Could be any positive integer. The truth assumption just says he didn't lie on day1. So day1 length is initial length. That's fine.
Thus the solution is straightforward.
But constraints: N up to 10^5 per test case, T up to 100, sum of N across test cases could be up to 10^7? Actually T * N could be 100 * 1e5 = 1e7, which is okay for O(total N). So we just read input and compute.
Now confirm with example: 1 2 2 3 4 5 5 => increases: day2>day1: yes; day3>day2: no; day4>day3: yes; day5>day4: yes; day6>day5: yes; day7>day6: no => count=4. Good.
Edge cases: N=1 => answer 0.
So implement.
But wait, is there any scenario where the nose length might stay same but Pinocchio lies? Suppose he lies but also something else? No, each lie extends nose by 1 cm. So no, can't stay same.
Thus answer is count of increments.
But the problem might be trickier? Could it be that Pinocchio's nose length can also increase due to other reasons? The problem only mentions lying, so it's safe.
Therefore code: read T. For each test case: read N (maybe next line), then read list of N ints. Compute count = sum(1 for i in range(1,N) if L[i] > L[i-1]). Print count.
Be careful with input reading: lines might be separated by spaces and newlines. Use sys.stdin.read to parse all ints.
Time complexity: O(total N). Memory: store list of N ints per test case, but could also read and process streaming. However, constraints allow storing per test case.
But there is a nuance: Li up to 5*10^6, but that's fine.
Thus final solution is trivial.
However, the problem statement might be from a contest where they want to consider that Pinocchio might have told a lie on the first day? But they explicitly said "Being a trusting friend, Lampwick assumes Pinocchio was telling the truth on the first day." So we must not count day1 even if Li > something? No, day1 has no previous day, so we can't compare. So we only count days from 2 to N.
Double-check: Could there be a scenario where day1 length > 0? But that's initial length, not due to lies. So okay.
Thus final answer.
Let me check if there is any hidden trick: The problem might be: "Each time he lies, his nose is extended by 1 cm." But note that he could lie multiple times in a day and we only have the length at the end of the day. So the increase from previous day's end to today's end is the number of lies he told that day. If it increased by 2, that means he told at least one lie (actually at least 2 lies). So day counted. So counting strict increases works.
Thus answer.
But wait, could there be a scenario where he told truth on a day but his nose length increased because of lies from previous days? No, it's cumulative. So if he didn't lie on a day, it stays the same.
Thus solved.
Implementation details:
Pseudo:
def solve():
import sys
data = list(map(int, sys.stdin.read().split()))
it = iter(data)
t = next(it)
out = []
for _ in range(t):
n = next(it)
arr = [next(it) for _ in range(n)]
cnt = 0
for i in range(1, n):
if arr[i] > arr[i-1]:
cnt += 1
out.append(str(cnt))
sys.stdout.write("\n".join(out))
Edge case: ensure reading stops correctly.
Alternatively, we can read line by line.
Given T up to 100 and N up to 1e5, reading all at once is fine.
Thus final answer.
But wait, the problem statement says: "After N days of carefully analysing Pinocchio's lying habit, Lampwick wants to confront Pinocchio. But for that he needs to find out the number of days when Pinocchio lied atleast once." So output number of days.
Thus simple.
I'll produce final answer with explanation.
But before final, check with more test cases:
Input:
2
5
1 1 1 1 1
Output: 0
Input:
2
5
1 2 3 4 5
Output: 4
Input:
1
3
10 11 12
Output: 2
Input:
1
3
10 10 10
Output: 0
Works.
Thus final. ```python
import sys
def solve() -> None:
data = list(map(int, sys.stdin.read().split()))
it = iter(data)
t = next(it)
out_lines = []
for _ in range(t):
n = next(it)
# read the n lengths
arr = [next(it) for _ in range(n)]
cnt = 0
for i in range(1, n):
if arr[i] > arr[i-1]:
cnt += 1
out_lines.append(str(cnt))
sys.stdout.write("\n".join(out_lines))
if name == "main":
solve()