akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

struct Edge {
    int to, cost;
    Edge() {}
    Edge(int to, int cost) : to{to}, cost{cost} {}
};

constexpr int MAX = 10000;
constexpr int MAX_T = 200;
constexpr int INF = (1 << 29);

vector<Edge> G[MAX];

struct State {
    int w, v, t, n;
    State() {}
    State(int w, int v, int t, int n) : w{w}, v{v}, t{t}, n{n} {}

    bool operator < (const State& s) const {
        return w > s.w;
    }
};

int d[MAX][MAX_T + 1][3];

int dijkstra(int N, int X, const vector<int>& T)
{
    priority_queue<State> pq;
    pq.push(State(0, 0, 0, 0));

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= X; j++) {
            for (int k = 0; k < 3; k++) {
                d[i][j][k] = INF;
            }
        }
    }

    d[0][0][0] = 0;

    while (!pq.empty()) {
        State st = pq.top(); pq.pop();
        int v = st.v, t = st.t, n = st.n;

        if (d[v][t][n] < st.w) continue;
        
        if (v == N - 1) {
            return d[v][t][n];
        }
        
        for (const auto& e : G[v]) {
            int nt = min(X, t + e.cost);
            int ncost = d[v][t][n] + e.cost;
            if (T[e.to] == n) {
                if (ncost < d[e.to][0][n]) {
                    d[e.to][0][n] = ncost;
                    pq.push(State(d[e.to][0][n], e.to, 0, n));
                }
            } else {
                if (T[e.to] == 1) {
                    if (ncost < d[e.to][nt][n]) {
                        d[e.to][nt][n] = ncost;
                        pq.push(State(d[e.to][nt][n], e.to, nt, n));
                    }
                } else {
                    if (nt != X) continue;
                    if (ncost < d[e.to][0][T[e.to]]) {
                        d[e.to][0][T[e.to]] = ncost;
                        pq.push(State(d[e.to][0][T[e.to]], e.to, 0, T[e.to]));
                    }
                }
            }
        }
    }
    return -1;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N, M, X;
    cin >> N >> M >> X;

    vector<int> T(N);
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }
    
    for (int i = 0; i < M; i++) {
        int A, B, D;
        cin >> A >> B >> D;
        A--; B--;
        G[A].emplace_back(B, D);
        G[B].emplace_back(A, D);
    }
    cout << dijkstra(N, X, T) << endl;
    return 0;
}

Measured memory_bytes: 27684
object Main extends App {

  import scala.io.StdIn._
  import scala.math._

  val ballCount = readLine.trim.toInt
  val series = readLine.trim.split(' ').map{_.toLong}.sorted
  var stack: List[Ball] = List(new Ball(series.head, 1))
  for (i ← 1 until series.length){
    if (stack.head.number == series(i)){
      stack.head.count += 1
    }else {
      stack ::= new Ball(series(i), 1)
    }
  }
  val balls = stack.toArray.reverse
  val exp = Array.tabulate(33){_ ⇒ 1L}
  for (i ← 1 until exp.length){
    exp(i) = exp(i - 1) * 2
  }
  var sum: Int = 0
  for (i ← balls.indices.reverse){
    for (e ← exp){
      if (e < balls(i).number * 2 && e > balls(i).number) lowerBound(balls, e - balls(i).number) match {
        case r if balls(r).number + balls(i).number == e && balls(r).count >= 1 ⇒
          val min = math.min(balls(r).count, balls(i).count)
          sum += min
          balls(r).count -= min
        case _ ⇒
      }else if (e == balls(i).number * 2 && balls(i).count >= 2) {
        sum += balls(i).count / 2
      }
    }
  }

  println(sum)
  def lowerBound(balls: Array[Ball], target: Long): Int = {
    var left = 0
    var right = balls.length - 1
    while (left < right){
      val mid = (left + right) / 2
      if (balls(mid).number < target){
        left = mid + 1
      }else {// target <= balls(mid).number
        right = mid
      }
    }
    right
  }
  def upperBound(balls: Array[Ball], target: Long): Int = {
    var left = 0
    var right = balls.length - 1
    while (left < right){
      val mid = (left + right) / 2
      if (balls(mid).number <= target){
        left = mid + 1
      }else {// target < balls(mid).number
        right = mid
      }
    }
    right
  }

  class Ball(val number: Long, var count: Int) {
    override def toString: String = s"Ball($number, $count)"
  }
  implicit class Extenion[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}
/*

同じ文字数であれば

 */

Measured memory_bytes: 96540
#include <bits/stdc++.h>
#define fir first
#define sec second
#define mp std::make_pair
#define Pair std::pair<int, std::string>

typedef long long ll;

const int N = 1e5 + 5;
const int MOD = 1e9 + 7;

std::map< Pair, int > map;
std::vector<int> v;

int n;
ll a[N], b[N];

int main() {
    std::cin >> n;
    for (int i = 1; i <= n; i++) std::cin >> a[i];
    for (int i = 1; i <= n; i++) {
        int f = (i & 1) ? 1 : -1;
        b[1] += f * a[i];
    }
    for (int i = 2; i <= n; i++) {
        b[i] = 2 * a[i - 1] - b[i - 1];
    }
    for (int i = 1; i <= n; i++) {
        printf("%lld ", b[i]);
    }
    return 0;
}

Measured memory_bytes: 2816