Preamble
----
The definition of "life" is quite ambiguous. In philosophical terms, it refers to some kind of consciousness. In biological terms, it refers to cellular metabolism. In game theory it might refer to a semi-conscious agent like a bacterium that acts in a manner seemingly consistent with its own survival, even if it doesn't know that's what it's doing. In many fantasy settings, it refers to an entity imbued with some kind of "soul" or other life force. Etc.

So you're almost automatically going to have arguments over which definition is the correct definition unless it's spelled out in the rules.

Summary
----
The ultimate answer here is "it's the GM's call". There's nothing I can find in the rules that make anything explicit one way or the other.

However, from reading through other examples of "living" versus "nonliving" things in the player's handbook and DM guide, I would suggest that the following hold:

- Consciousness is stored in the soul, but isn't the definition of "living". A flower, though not conscious, is still "living".
- A soul (or lack thereof) is therefore not an indicator of whether something is "nonliving" for spell purposes.
- "Living" (positive energy) and "undead" (negative energy) are opposed ideas, but both can be alive in the sense of consciousness or intelligence.
- Both "living" and "undead" creatures are "animated".
- Unless it's a spell about necrotic energy versus living energy, "inanimate" seems generally synonymous with "nonliving".
- Animal and vegetable matter (what we would typically call "organic" matter) can be "living" or "nonliving".
- A body that's held in stasis, but is capable of sustained life, is "living".
- A body that's incapable of sustained life becomes "nonliving" at some point.
- **There isn't an exact timeframe given in the rules for how long it takes a detached limb, plucked flower, or now-soulless body to go from "living matter" to "nonliving matter".**
- **However, the Raise Dead spell suggests the timeframe might be 10 days.**

**So it seems clear that a long-dead corpse would be nonliving, animal matter, and would fit in your box. A freshly-dead corpse (less than 10 days dead) might still be living, depending on GM preference.**

A body held in stasis with the Magic Jar spell or similar cannot fit in the box, as it's explicitly not dead. The container that holds the caster's soul during the Magic Jar spell would probably fit in the box, as the soul isn't "living matter", and souls can otherwise exist in the Ethereal Plane, though I'd call that GM preference.

A "corpse" could be defined as a body that's become "nonliving", but that's a purely semantic point your group would have to decide, if you think it's important.

The GM might come up with some rules for simplicity, like "bodies become corpses after 1 day in hot environments, 10 days in normal environments, and 3 weeks in cold environments". Or just "10 days and it's a corpse". Or "when you fail your last death saving throw the body is a corpse". But that's a house rule in any case.

As for undead, it's not "living", but I think it's more reasonably defined as not "nonliving" either. It's "undead" anima rather than "living" anima, but both are animated. But it's ultimately still a GM call.

Other Examples in D&D
----
A quick search through the 5e player's handbook finds a bunch of non-relevant references to "living", such as "Such a half-orc living among humans might 
display these scars proudly or hide them in shame." There are also plenty of examples of cases that are as ambiguous as the example in your question.

But there are some examples that might shed light on the general concepts as used in D&D.

> **Positive and Negative Planes** Like a dome above the
> other planes, the Positive Plane is the source of radiant energy and
> the raw life force that suffuses all living beings, from the puny to
> the sublime. Its dark reflection is the Negative Plane, the source of
> necrotic energy that destroys the living and animates the undead.

There's a discrepancy between things animated with "life energy" from the positive plane, and undead animated with "necrotic energy" from the negative plane.

Note that undead in D&D can be intelligent, like vampires. They're very much alive in any normal, philosophical sense, just powered by a different kind of energy.

However, this suggests undead creatures are not "living" from certain standpoints and might fit in your box despite no longer being corpses.

> Druidic Focus. A druidic focus might be ... a
> staff drawn whole out of a living tree.

This suggests that a tree might be non-living, implying that not all organic matter is "living".

> **Creation** You pull wisps of shadow material from the Shadowfell to
> create a nonliving object of vegetable matter within range: soft
> goods, rope, wood, or something similar.

As you already quoted, this also suggests there's non-living organic matter.

Spells like Clone and Magic Jar talk about souls and being able to hop between bodies, so clearly the consciousness is contained in the soul. However, Magic Jar has a very relevant distinction:

> Your body falls into a catatonic state as your soul leaves it and
> enters the container you used for the spell’s material component.  
> ...  
> If the container is destroyed or the spell ends, your soul
> immediately returns to your body. If your body is more than 100 feet
> away from you or if your body is dead when you attempt to return to
> it, you die.

This makes it explicitly clear there's a difference between a catatonic, soulless body, and a dead body. So a body with no soul isn't automatically "nonliving".

Of course, it still doesn't explicitly define the difference. I would suggest a "dead" body is one that can't sustain life in the standard, biological sense. That is, you return to your body, but then die as soon as your soul re-animates it, since it no longer functions properly.

And it still doesn't tell us the intent of storing "nonliving" matter in your box. Does the box reject anything animated with positive energy, or does it break down organic matter?

It also doesn't tell us when a "living" body becomes a "nonliving" body. The soul likely leaves when you lose too many hit points. But real bodies don't cease all cellular functions just because the person is gone. So it's completely plausible that a D&D corpse still contains positive energy for a while.

> **Raise Dead** You return a dead creature you touch to life, provided that it has been dead no longer than 10 days. If the creature’s soul
> is both willing and at liberty to rejoin the body, the creature
> returns to life with 1 hit point.  
> ...  
> This spell closes all mortal
> wounds, but it doesn’t restore missing body parts. If the creature
> is lacking body parts or organs integral for its survival — its head,
> for instance — the spell automatically fails.

This could be interpreted as saying the soul itself is no longer around to rejoin its body, but I would suggest this is a good starting point for a pseudo-RAW timeframe on when a body goes from "living matter" to "nonliving matter". A body older than 10 days is "nonliving", and a body incapable of sustaining life is "nonliving", for spell purposes.

Switching to the DM Guide, we see some other examples.

> **Bag of Devouring** Animal or vegetable matter placed wholly in the bag is devoured and lost forever. When part of a living creature is
> placed in the bag, as happens when someone reaches inside it, there
> is a 50 percent chance that the creature is pulled inside the bag.

Like above with vegetable matter, we see that there's a difference between "animal" matter and "part of a living creature". This definitely suggests that, at some point, a corpse goes from being "living" to "nonliving".

> **Cube of Force (Faces)**  
> 2 Nonliving matter can't pass through the barrier. Walls, floors, and ceilings can pass through at your discretion.  
> 3 Living matter can't pass through the barrier.

Here we have "living matter". This could just mean "living entities", but could also imply a recently-detached limb will bounce off the barrier. (Come here, elf, we need to do an experiment. I promise it won't hurt. <sub><sup>*Me.*</sup></sub>)

Conclusion
----
I would suggest the simple answer to your question is "a corpse can fit in the box 10 days after death". But that a GM could decide otherwise in various scenarios.