Implement a single, self-contained, dependency-free TypeScript utility module.

## File
Output exactly one file:

```file:utils.ts
// your implementation
```

## Function to implement

```ts
export function parseQueryString(qs: string): Record<string, string | string[]>
```

Parse a URL query string into an object of decoded key/value pairs.

## Behavior
- Accept input with or without a leading `?` (e.g. both `"?a=1&b=2"` and
  `"a=1&b=2"`). An empty string, `""` or `"?"`, returns `{}`.
- Split pairs on `&`. Ignore empty segments (e.g. a trailing or doubled `&`).
- Split each pair on the FIRST `=` only (so a value may itself contain `=`).
- A key with no `=` (e.g. `"flag"`) maps to an empty string `""`.
- Percent-decode both keys and values, and convert `+` to a space, per standard
  form encoding (e.g. `"a%20b"` and `"a+b"` both decode to `"a b"`). If a value
  is malformed and cannot be decoded, keep the raw (undecoded) substring rather
  than throwing.
- Repeated keys collapse into an array in first-seen order: the first occurrence
  stores a string; the second occurrence turns that entry into a
  `[first, second]` array; further occurrences push onto the array. A key that
  appears once stays a plain string, never a one-element array.

## Acceptance criteria
- `parseQueryString("?a=1&b=2")` → `{ a: "1", b: "2" }`
- `parseQueryString("a=1&a=2&a=3")` → `{ a: ["1", "2", "3"] }`
- `parseQueryString("a+b=c%20d")` → `{ "a b": "c d" }`
- `parseQueryString("flag&x=1")` → `{ flag: "", x: "1" }`
- `parseQueryString("")` and `parseQueryString("?")` → `{}`
- `parseQueryString("token=a=b=c")` → `{ token: "a=b=c" }`

## Constraints
- Strict TypeScript: no `any`, no non-null assertions used to dodge the checker.
- No imports, no external packages, no Node-only globals — pure standard
  JavaScript/TypeScript (you may use the global `decodeURIComponent`).
- Output ONLY the `utils.ts` file block, no prose or tests.
