---
type: "Source File"
title: "\"\"\""
description: "\"\"\" UK CopeCheck Pipeline — news scanning, figure cope scoring, ONS data refresh. Modes: --news : Scan UK news sources, score articles through the Oracle --cope : Scan for tracked figure quotes, score cope levels."
resource: "https://uk.copecheck.com"
tags: ["copecheck", "uk", "source-file", "py"]
timestamp: "2026-08-12T15:52:50Z"
site: "uk"
source_path: "copecheck-uk/pipeline_uk.py"
---

# """

Source path: `copecheck-uk/pipeline_uk.py`  
Index snapshot generated: `2026-11-24T13:42:54Z`  
File modified: `2026-08-12T15:52:50Z`

```py
"""
UK CopeCheck Pipeline — news scanning, figure cope scoring, ONS data refresh.

Modes:
  --news    : Scan UK news sources, score articles through the Oracle
  --cope    : Scan for tracked figure quotes, score cope levels
  --stats   : Refresh ONS stats data and generate AI commentary
  (no args) : Run all three sequentially
"""
import hashlib
import json
import logging
import os
import re
import sys
import time
from functools import lru_cache
from datetime import datetime, timezone
from pathlib import Path
from urllib.parse import quote_plus, urlparse

import feedparser
import requests
import trafilatura
from googlenewsdecoder import gnewsdecoder

import db_uk as db
import oracle_uk as oracle
import scoring_pipeline

log = logging.getLogger("pipeline_uk")

MAX_NEW_PER_RUN = int(os.environ.get("COPECHECK_MAX_NEW", "25"))
MAX_COPE_SCAN_PER_FIGURE = int(os.environ.get("COPECHECK_MAX_COPE_SCAN", "3"))
COPE_FIGURES_PER_RUN = int(os.environ.get("COPECHECK_COPE_FIGURES_PER_RUN", "6"))
COPE_RUN_BUDGET_SECONDS = int(os.environ.get("COPECHECK_COPE_RUN_BUDGET_SECONDS", "4800"))
NEWS_RUN_BUDGET_SECONDS = int(os.environ.get("COPECHECK_NEWS_RUN_BUDGET_SECONDS", "4500"))
MIN_BODY_CHARS = 300
FETCH_TIMEOUT = 25
_news_run_deadline = None

RSS_FEEDS_PATH = Path(__file__).parent / "rss_feeds.json"
COPE_CURSOR_PATH = Path(__file__).parent / "data" / "cope_scan_cursor.json"

# ─── API Keys ─────────────────────────────────────────────
[redacted secret-like line]
GNEWS_URL = "https://gnews.io/api/v4/search"


# ─── UK News Sources ─────────────────────────────────────

def google_news_url(q):
    return (
        "https://news.google.com/rss/search?"
        f"q={quote_plus(q + ' when:7d')}&hl=en-GB&gl=GB&ceid=GB:en"
    )

# UK-specific Google News queries
UK_NEWS_QUERIES = [
    "UK economy jobs",
    "UK immigration economy",
    "UK NHS funding",
    "UK housing crisis",
    "UK wages cost of living",
    "UK economic inactivity",
    "UK Reform immigration",
    "UK Labour economy growth",
    "UK Conservative economy",
    "Keir Starmer economy",
    "Nigel Farage immigration",
    "Rachel Reeves budget economy",
]

# UK RSS feeds — political and economic coverage
UK_RSS_FEEDS = [
    ("BBC Politics", "https://feeds.bbci.co.uk/news/politics/rss.xml"),
    ("BBC Business", "https://feeds.bbci.co.uk/news/business/rss.xml"),
    ("Guardian Politics", "https://www.theguardian.com/politics/rss"),
    ("Guardian Economics", "https://www.theguardian.com/business/economics/rss"),
    ("Telegraph Politics", "https://www.telegraph.co.uk/politics/rss.xml"),
    ("FT UK Economy", "https://www.ft.com/rss/home/uk"),
    ("Sky News Politics", "https://feeds.skynews.com/feeds/rss/politics.xml"),
    ("Independent Politics", "https://www.independent.co.uk/news/uk/politics/rss"),
]

# GNews UK-specific queries
GNEWS_UK_QUERIES = [
    "UK economy employment",
    "UK immigration policy",
    "UK NHS waiting list",
    "UK housing market crisis",
    "UK wages inflation",
    "Reform UK policy",
    "Labour government economy",
]

# Topic keywords for filtering generic feeds
UK_TOPIC_KEYWORDS = [
    "economy", "economic", "employment", "unemploy", "job", "jobs",
    "wage", "wages", "immigration", "migrant", "migration",
    "nhs", "housing", "rent", "mortgage", "inflation",
    "cost of living", "poverty", "benefit", "benefits",
    "labour market", "worker", "workers", "workforce",
    "growth", "gdp", "recession", "stagnation",
    "scapegoat", "blame", "reform uk", "conservative", "labour",
    "budget", "tax", "austerity", "spending",
    "inactivity", "sick", "disability",
    "ai", "automation", "artificial intelligence",
    "brexit", "trade", "investment",
]


# ─── Helpers ──────────────────────────────────────────────

def _hash_title(title):
    norm = re.sub(r"\W+", " ", (title or "").lower()).strip()
    return hashlib.sha256(norm.encode("utf-8")).hexdigest()[:16]


def _matches_topic(text):
    t = (text or "").lower()
    return any(kw in t for kw in UK_TOPIC_KEYWORDS)


def _entry_snippet(entry):
    raw = entry.get("summary", "") or entry.get("description", "")
    text = re.sub(r"<[^>]+>", " ", raw)
    text = re.sub(r"\s+", " ", text).strip()
    return text[:500]


def _parse_date(entry):
    from dateutil import parser as dateparser
    for key in ("published", "updated", "created"):
        v = entry.get(key)
        if v:
            try:
                return dateparser.parse(v).astimezone(timezone.utc).isoformat()
            except Exception:
                continue
    return None


def _is_google_news_redirect(url):
    """Return True for opaque Google News RSS redirect URLs."""
    parsed = urlparse(url)
    return (
        (parsed.hostname or "").lower() == "news.google.com"
        and parsed.path.startswith("/rss/articles/")
    )


@lru_cache(maxsize=512)
def _resolve_news_url(url):
    """Resolve an opaque Google News RSS URL to the publisher URL."""
    if not _is_google_news_redirect(url):
        return url
    try:
        result = gnewsdecoder(url, interval=0)
        decoded = (result or {}).get("decoded_url", "")
        if decoded and not _is_google_news_redirect(decoded):
            return decoded
    except Exception as exc:
        log.warning("Google News URL decode failed for %s: %s", url, exc)
    return ""


def _news_budget_available(stage):
    """Keep routine news runs inside the wrapper's hard timeout."""
    if _news_run_deadline is not None and time.monotonic() >= _news_run_deadline:
        log.warning("news run budget exhausted before %s; finishing cleanly", stage)
        return False
    return True


def fetch_article(url):
    """Fetch and extract article text from URL using Firecrawl."""
    if _is_google_news_redirect(url):
        url = _resolve_news_url(url)
        if not url:
            return ""

    try:
        result = scoring_pipeline.fetch_article_firecrawl(url, timeout=FETCH_TIMEOUT)
        markdown = result.get("markdown", "")
        if markdown:
            return scoring_pipeline._strip_boilerplate(markdown)
        return ""
    except Exception as e:
        log.warning("Firecrawl fetch failed for %s: %s, falling back to trafilatura", url, e)
        try:
            downloaded = trafilatura.fetch_url(url, no_ssl=False)
            if not downloaded:
                return ""
            text = trafilatura.extract(
                downloaded, include_comments=False,
                include_tables=False, favor_recall=True,
            )
            return (text or "").strip()
        except Exception as e2:
            log.warning("trafilatura fallback also failed for %s: %s", url, e2)
            return ""


def _extract_figure_context(text, name, window=800):
    """Extract text around mentions of a figure."""
    lower = text.lower()
    name_lower = name.lower()
    last_name = name.split()[-1].lower()

    def _find_positions(haystack, needle):
        positions = []
        pattern = re.compile(r'\b' + re.escape(needle) + r'\b')
        for m in pattern.finditer(haystack):
            positions.append(m.start())
        return positions

    full_positions = _find_positions(lower, name_lower)
    last_positions = []
    if len(last_name) >= 4:
        last_positions = _find_positions(lower, last_name)

    if full_positions:
        positions = sorted(set(full_positions + last_positions))
    else:
        # Full name must be present - last-name-only matches are too error-prone
        return ""

    chunks = []
    for pos in positions[:3]:
        s = max(0, pos - window // 2)
        e = min(len(text), pos + window // 2)
        chunks.append(text[s:e])

    return "\n...\n".join(chunks)




def _queue_for_scoring(figure_id, figure_name, figure_role, quote_context,
                       source_url, source_title, source_name):
    """Score article-figure pair through tiered pipeline (Gemma -> Validator -> Sonnet)."""
    person = {
        "id": figure_id,
        "name": figure_name,
        "role": figure_role or "",
        "party": "",
    }
    # Look up party from DB
    fig = db.get_figure(figure_id)
    if fig:
        person["party"] = fig.get("party", "") or ""

    # Check if already scored via pipeline
    if db.pipeline_url_scored(source_url, figure_id):
        log.info("already pipeline-scored: %s for %s", source_url[:60], figure_name)
        return 0

    log.info("pipeline scoring: %s for %s", source_title[:60], figure_name)

    try:
        result = scoring_pipeline.score_article(
            url=source_url,
            person=person,
            source_name=source_name,
            pre_fetched_text=quote_context,
            pre_fetched_title=source_title,
        )

        # Save raw log for debugging
        scoring_pipeline.save_raw_log(result, figure_id)

        if result.get("published") and result.get("score"):
            saved = scoring_pipeline.save_pipeline_result(result, figure_id, db)
            log.info(
                "pipeline scored %s: score=%s band=%s stage=%s",
                figure_name,
                result["score"].get("cope_score"),
                result["score"].get("band"),
                result.get("stage"),
            )
            return 1 if saved == 1 else 0
        elif result.get("reject_reason"):
            log.info("pipeline rejected %s: %s", figure_name, result["reject_reason"])
        else:
            log.warning("pipeline returned no result for %s", figure_name)
    except Exception as e:
        log.exception("pipeline scoring failed for %s: %s", figure_name, e)
    return 0

# ─── GNews ────────────────────────────────────────────────

def gnews_search(query, max_results=10):
    """Search GNews API with country=gb filter."""
[redacted secret-like line]
        return []
    params = {
        "q": query,
        "lang": "en",
        "country": "gb",
        "max": min(max_results, 10),
[redacted secret-like line]
        "sortby": "publishedAt",
    }
    try:
        resp = requests.get(GNEWS_URL, params=params, timeout=15)
        resp.raise_for_status()
        data = resp.json()
        articles = []
        for a in data.get("articles", []):
            articles.append({
                "title": a.get("title", ""),
                "url": a.get("url", ""),
                "source": a.get("source", {}).get("name", ""),
                "published": a.get("publishedAt", ""),
                "snippet": a.get("description", ""),
                "body": a.get("content", ""),
            })
        return articles
    except Exception as e:
        log.warning("GNews search failed for %r: %s", query, e)
        return []


# ─── News Ingestion ───────────────────────────────────────

def get_figures():
    """Get all figures from the database."""
    return db.get_leaderboard(include_empty=True)


def ingest_rss_feeds():
    """Scan UK RSS feeds for relevant articles."""
    seen_hashes = set()
    inserted = 0

    all_feeds = [(q, google_news_url(q)) for q in UK_NEWS_QUERIES] + UK_RSS_FEEDS
    is_narrow = set(UK_NEWS_QUERIES)

    for source_name, feed_url in all_feeds:
        if not _news_budget_available(f"RSS feed {source_name}"):
            return inserted
        if inserted >= MAX_NEW_PER_RUN:
            break
        log.info("feed scan: %s", source_name)
        try:
            parsed = feedparser.parse(feed_url)
        except Exception as e:
            log.warning("feed parse failed %s: %s", source_name, e)
            continue

        narrow = source_name in is_narrow

        for entry in parsed.entries[:20]:
            if not _news_budget_available(f"RSS article from {source_name}"):
                return inserted
            if inserted >= MAX_NEW_PER_RUN:
                break
            url = entry.get("link", "")
            title = (entry.get("title") or "").strip()
            if not url or not title:
                continue

            th = _hash_title(title)
            if th in seen_hashes:
                continue
            seen_hashes.add(th)

            # Check for duplicate in DB
            if db.cope_entry_exists_by_url(url):
                continue

            snippet = _entry_snippet(entry)
            search_blob = f"{title}\n{snippet}"
            if not narrow and not _matches_topic(search_blob):
                continue

            body = fetch_article(url)
            if len(body) < MIN_BODY_CHARS:
                if len(snippet) > MIN_BODY_CHARS:
                    body = snippet
                else:
                    continue

            if not narrow and not _matches_topic(body[:4000]):
                continue

            # Cross-link to figures
            _crosslink_article_to_figures(title, body, url, source_name)
            inserted += 1
            log.info("processed [%s] %s", source_name, title[:90])

    log.info("RSS ingestion done: %d articles processed", inserted)
    return inserted


def ingest_gnews():
    """Pull articles from GNews API (UK-filtered)."""
[redacted secret-like line]
        log.info("GNews: no API key, skipping")
        return 0

    inserted = 0
    for query in GNEWS_UK_QUERIES:
        if not _news_budget_available(f"GNews query {query}"):
            return inserted
        if inserted >= MAX_NEW_PER_RUN:
            break
        log.info("gnews scan: %s", query)
        articles = gnews_search(query, max_results=10)
        for a in articles:
            if not _news_budget_available(f"GNews article for {query}"):
                return inserted
            if inserted >= MAX_NEW_PER_RUN:
                break
            url = a["url"]
            title = a["title"]
            if not url or not title:
                continue
            if db.cope_entry_exists_by_url(url):
                continue

            body = a["body"] or ""
            if len(body) < MIN_BODY_CHARS:
                body = fetch_article(url)
            if len(body) < MIN_BODY_CHARS:
                continue

            _crosslink_article_to_figures(title, body, url, a["source"] or "GNews")
            inserted += 1
            log.info("processed [GNews/%s] %s", a["source"], title[:90])
        time.sleep(1)

    log.info("GNews ingestion: %d articles processed", inserted)
    return inserted


def _crosslink_article_to_figures(title, body, url, source_name):
    """Score article against all tracked figures.
    REQUIRES figure's full name to appear in title or body text.
    watch_for keywords are only used as secondary relevance, never primary match.
    """
    figures = get_figures()
    combined = (title + " " + body).lower()

    for fig in figures:
        name_lower = fig["name"].lower()

        # PRIMARY GATE: full name MUST appear in the article
        full_pattern = re.compile(r'\b' + re.escape(name_lower) + r'\b')
        if not full_pattern.search(combined):
            continue

        quote_context = _extract_figure_context(body, fig["name"])
        if not quote_context or len(quote_context) < 80:
            continue

        # Check for duplicate
        if db.cope_entry_exists(fig["id"], quote_context[:200]):
            continue

        try:
            log.info("queuing for scoring: %s in '%s'", fig["name"], title[:60])
            _queue_for_scoring(
                figure_id=fig["id"],
                figure_name=fig["name"],
                figure_role=fig.get("role", ""),
                quote_context=quote_context,
                source_url=url,
                source_title=title,
                source_name=source_name,
            )
        except Exception as e:
            log.warning("queue for scoring failed for %s: %s", fig["name"], e)


# ─── Figure News Scan ─────────────────────────────────────

def _clean_google_alerts_url(url):
    """Extract actual URL from Google Alerts redirect."""
    if "google.com/url" in url:
        from urllib.parse import urlparse, parse_qs
        parsed = urlparse(url)
        params = parse_qs(parsed.query)
        if "url" in params:
            return params["url"][0]
    return url


def ingest_google_alerts():
    """Pull articles from Google Alerts RSS (Atom) feeds for UK AI cope topics."""
    if not RSS_FEEDS_PATH.exists():
        log.info("Google Alerts: no rss_feeds.json found, skipping")
        return 0

    with open(RSS_FEEDS_PATH) as f:
        config = json.load(f)

    feeds = config.get("feeds", [])
    if not feeds:
        log.info("Google Alerts: no feeds configured")
        return 0

    max_per_feed = config.get("max_articles_per_feed", 20)
    seen_hashes = set()
    inserted = 0

    for feed_cfg in feeds:
        if not _news_budget_available("Google Alerts feed"):
            return inserted
        if inserted >= MAX_NEW_PER_RUN:
            break
        feed_name = feed_cfg.get("name", "unnamed")
        feed_url = feed_cfg.get("url", "")
        if not feed_url:
            continue

        log.info("google alerts scan: %s", feed_name)
        try:
            parsed = feedparser.parse(feed_url)
        except Exception as e:
            log.warning("google alerts feed parse failed %s: %s", feed_name, e)
            continue
        if parsed.bozo and not parsed.entries:
            log.warning("google alerts feed bozo %s: %s", feed_name, getattr(parsed, "bozo_exception", ""))
            continue

        for entry in parsed.entries[:max_per_feed]:
            if not _news_budget_available(f"Google Alerts article from {feed_name}"):
                return inserted
            if inserted >= MAX_NEW_PER_RUN:
                break
            url = _clean_google_alerts_url(entry.get("link", ""))
            title = (entry.get("title") or "").strip()
            if not url or not title:
                continue

            th = _hash_title(title)
            if th in seen_hashes:
                continue
            seen_hashes.add(th)

            if db.cope_entry_exists_by_url(url):
                continue

            snippet = _entry_snippet(entry)
            search_blob = f"{title}\n{snippet}"
            if not _matches_topic(search_blob):
                continue

            body = fetch_article(url)
            if len(body) < MIN_BODY_CHARS:
                if len(snippet) > MIN_BODY_CHARS:
                    body = snippet
                else:
                    continue

            _crosslink_article_to_figures(title, body, url, f"GoogleAlerts/{feed_name}")
            inserted += 1
            log.info("processed [GoogleAlerts/%s] %s", feed_name, title[:90])

    log.info("Google Alerts ingestion: %d articles processed", inserted)
    return inserted


def scan_figure_news():
    """Dedicated scan for each figure using their search queries."""
    figures = get_figures()
    requested_ids = {
        value.strip()
        for value in os.environ.get("COPECHECK_FIGURE_IDS", "").split(",")
        if value.strip()
    }
    if requested_ids:
        figures = [fig for fig in figures if fig["id"] in requested_ids]
        log.info("figure scan restricted to: %s", ", ".join(sorted(requested_ids)))
    if not figures:
        return 0

    deadline = time.monotonic() + COPE_RUN_BUDGET_SECONDS
    if not requested_ids and len(figures) > COPE_FIGURES_PER_RUN:
        cursor = 0
        try:
            cursor = int(json.loads(COPE_CURSOR_PATH.read_text()).get("next_index", 0))
        except (OSError, ValueError, TypeError, json.JSONDecodeError):
            cursor = 0
        cursor %= len(figures)
        batch_size = min(COPE_FIGURES_PER_RUN, len(figures))
        selected = [figures[(cursor + offset) % len(figures)] for offset in range(batch_size)]
        next_index = (cursor + batch_size) % len(figures)
        COPE_CURSOR_PATH.parent.mkdir(parents=True, exist_ok=True)
        temp_cursor = COPE_CURSOR_PATH.with_suffix(".tmp")
        temp_cursor.write_text(json.dumps({"next_index": next_index, "updated_at": datetime.now(timezone.utc).isoformat()}))
        temp_cursor.replace(COPE_CURSOR_PATH)
        figures = selected
        log.info(
            "figure scan batch: start=%d size=%d next=%d figures=%s",
            cursor,
            batch_size,
            next_index,
            ", ".join(fig["name"] for fig in figures),
        )

    total_scored = 0
    for fig in figures:
        if time.monotonic() >= deadline:
            log.info("figure scan stopped cleanly at the %ds budget", COPE_RUN_BUDGET_SECONDS)
            break
        # Use search queries from seed data if available
        from seed_data import FIGURES as SEED_FIGURES
        seed_fig = next((f for f in SEED_FIGURES if f["id"] == fig["id"]), None)
        queries = seed_fig.get("search_queries", []) if seed_fig else []
        if not queries:
            queries = [fig["name"] + " UK economy"]

        scored_this_figure = 0
        # Two focused searches per figure are enough to find up to the configured
        # score cap without turning one refresh into hundreds of external calls.
        for query in queries[:2]:
            if scored_this_figure >= MAX_COPE_SCAN_PER_FIGURE or time.monotonic() >= deadline:
                break

            feed_url = google_news_url(query)
            try:
                parsed = feedparser.parse(feed_url)
            except Exception:
                continue

            for entry in parsed.entries[:8]:
                if scored_this_figure >= MAX_COPE_SCAN_PER_FIGURE or time.monotonic() >= deadline:
                    break
                url = entry.get("link", "")
                title = (entry.get("title") or "").strip()
                if not url or not title:
                    continue

                url = _resolve_news_url(url)
                if not url or db.pipeline_url_scored(url, fig["id"]):
                    continue

                body = fetch_article(url)
                if len(body) < 200:
                    continue

                # PRIMARY GATE: full name MUST appear in the article
                fig_name_lower = fig["name"].lower()
                article_text = (title + " " + body).lower()
                full_name_pat = re.compile(r'\b' + re.escape(fig_name_lower) + r'\b')
                if not full_name_pat.search(article_text):
                    continue

                quote_context = _extract_figure_context(body, fig["name"])
                if not quote_context or len(quote_context) < 80:
                    continue

                if db.cope_entry_exists(fig["id"], quote_context[:200]):
                    continue

                try:
                    log.info("figure scan queuing: %s -> %s", fig["name"], title[:60])
                    saved = _queue_for_scoring(
                        figure_id=fig["id"],
                        figure_name=fig["name"],
                        figure_role=fig.get("role", ""),
                        quote_context=quote_context,
                        source_url=url,
                        source_title=title,
                        source_name="figure_scan",
                    )
                    if saved:
                        scored_this_figure += 1
                        total_scored += 1
                except Exception as e:
                    log.warning("figure scan queue failed for %s: %s", fig["name"], e)

    log.info("figure scan done: %d new scores", total_scored)
    return total_scored


# ─── ONS Stats Refresh ────────────────────────────────────

def refresh_ons_stats():
    """Pull fresh ONS data and generate AI commentary."""
    import ons_data

    log.info("Fetching ONS data...")
    months = ons_data.fetch_all_latest(num_months=6)
    if not months:
        log.error("No ONS data returned")
        return 0

    saved = 0
    for month_data in months:
        month = month_data["month"]
        # Check if we already have this month with real data
        existing = db.get_stats_by_month(month)
        if existing and existing.get("ai_model") != "seed":
            log.info("Stats for %s already exists with real data, skipping", month)
            continue

        # Generate AI commentary for the most recent months only
        commentary = None
        model = "ons-api"
        if month_data == months[-1] or month_data == months[-2]:
            log.info("Generating AI commentary for %s...", month)
            commentary, model = oracle.generate_stats_commentary(month, month_data)
            if commentary:
                model = model or "ai"
            else:
                model = "ons-api"

        db.save_stats_month(
            month=month,
            data_json=month_data,
            ai_commentary=commentary,
            ai_model=model,
        )
        saved += 1
        log.info("Saved ONS stats for %s (model=%s)", month, model)

    log.info("ONS stats refresh: %d months saved", saved)
    return saved


# ─── Main ─────────────────────────────────────────────────

def main():
    global _news_run_deadline

    log_dir = Path(__file__).parent / "logs"
    log_dir.mkdir(exist_ok=True)

    logging.basicConfig(
        level=logging.INFO,
        format="%(asctime)s %(levelname)s %(name)s | %(message)s",
        handlers=[
            logging.StreamHandler(),
            logging.FileHandler(str(log_dir / "pipeline.log"), encoding="utf-8"),
        ],
    )

    mode = sys.argv[1] if len(sys.argv) > 1 else "all"
    log.info("=== UK CopeCheck pipeline start mode=%s ===", mode)

    if mode in ("all", "news"):
        _news_run_deadline = time.monotonic() + NEWS_RUN_BUDGET_SECONDS
        n_rss = ingest_rss_feeds()
        n_gnews = ingest_gnews()
        n_alerts = ingest_google_alerts()
        log.info("news pipeline: rss=%d gnews=%d alerts=%d", n_rss, n_gnews, n_alerts)

    if mode in ("all", "cope"):
        n_cope = scan_figure_news()
        log.info("cope pipeline: scored=%d", n_cope)

    if mode in ("all", "stats"):
        n_stats = refresh_ons_stats()
        log.info("stats pipeline: %d months refreshed", n_stats)

    counts = db.counts()
    log.info("counts: %s", counts)
    log.info("=== UK CopeCheck pipeline done ===")


if __name__ == "__main__":
    main()
```
