prithivMLmods/Coder-Stat huggingface dataset:
Problem p03234 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>

typedef long long LL;
using namespace std;
const int maxn = 310, mod = 1e9 + 7;

int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-')
      f = 0;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return f ? x : -x;
}

int g[maxn], cnt[maxn][maxn], dp[maxn][maxn], a[maxn];

int main() {

  int n = read() * 2, K = read();
  for (int i = 1; i <= K; ++i) {
    int x = read(), y = read();
    a[x] = y;
    a[y] = x;
  }

  g[0] = 1;
  for (int i = 2; i <= n; i += 2)
    g[i] = (LL)g[i - 2] * (i - 1) % mod;
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j)
      cnt[i][j] = cnt[i][j - 1] + (a[j] ? 0 : 1);

  int ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      if ((j - i + 1) & 1)
        continue;
      for (int k = i; k <= j; ++k)
        if (a[k] && (a[k] < i || a[k] > j))
          goto nxt;
      dp[i][j] = g[cnt[i][j]];
      for (int k = i; k < j; ++k)
        (dp[i][j] -= (LL)dp[i][k] * g[cnt[k + 1][j]] % mod) %= mod;
      (ans += (LL)dp[i][j] * g[cnt[1][i - 1] + cnt[j + 1][n]] % mod) %= mod;
    nxt:;
    }
  cout << ans << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <iostream>

typedef long long LL;
using namespace std;
const int maxn = 610, mod = 1e9 + 7;

int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-')
      f = 0;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return f ? x : -x;
}

int g[maxn], cnt[maxn][maxn], dp[maxn][maxn], a[maxn];

int main() {

  int n = read() * 2, K = read();
  for (int i = 1; i <= K; ++i) {
    int x = read(), y = read();
    a[x] = y;
    a[y] = x;
  }

  g[0] = 1;
  for (int i = 2; i <= n; i += 2)
    g[i] = (LL)g[i - 2] * (i - 1) % mod;
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j)
      cnt[i][j] = cnt[i][j - 1] + (a[j] ? 0 : 1);

  int ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = i; j <= n; ++j) {
      if ((j - i + 1) & 1)
        continue;
      for (int k = i; k <= j; ++k)
        if (a[k] && (a[k] < i || a[k] > j))
          goto nxt;
      dp[i][j] = g[cnt[i][j]];
      for (int k = i; k < j; ++k)
        (dp[i][j] -= (LL)dp[i][k] * g[cnt[k + 1][j]] % mod) %= mod;
      (ans += (LL)dp[i][j] * g[cnt[1][i - 1] + cnt[j + 1][n]] % mod) %= mod;
    nxt:;
    }
  cout << ans << endl;

  return 0;
}
Problem p03234 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = (x); i <= (y); i++)
#define ll long long
using namespace std;
const int N = 305, mod = 1e9 + 7;
int n, m, a, b, f[N][N], cnt[N][N], p[N], g[N], ans;
void upd(int &x, int y) {
  x += y;
  x -= x >= mod ? mod : 0;
}
int main() {
  scanf("%d%d", &n, &m);
  n *= 2;
  rep(i, 1, m) scanf("%d%d", &a, &b), p[a] = b, p[b] = a;
  rep(i, 1, n) rep(j, i, n) cnt[i][j] =
      cnt[i][j - 1] + (!p[j]); // i~j中未连过的点数
  g[0] = 1;
  rep(i, 1, n) if (!(i & 1)) g[i] =
      (ll)g[i - 2] * (i - 1) %
      mod; // 两个点可以自成一个匹配或拆散i-2个点中的一个匹配，i-2+1
  rep(i, 1, n) rep(j, i, n) {
    bool flag = 1;
    rep(k, i, j) if (p[k] && (p[k] > j || p[k] < i)) flag = 0; // 不能连到外面
    if (!flag)
      continue;
    f[i][j] = g[cnt[i][j]]; // 容斥
    rep(k, i + 1, j - 1)
        upd(f[i][j], mod - (ll)f[i][k] * g[cnt[k + 1][j]] % mod);
  }
  rep(i, 1, n) rep(j, 1, n)
      upd(ans, (ll)f[i][j] * g[n - 2 * m - cnt[i][j]] % mod);
  printf("%d\n", ans);
  return 0;
}
// 果然很神啊……我好菜

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, x, y) for (int i = (x); i <= (y); i++)
#define ll long long
using namespace std;
const int N = 605, mod = 1e9 + 7;
int n, m, a, b, f[N][N], cnt[N][N], p[N], g[N], ans;
void upd(int &x, int y) {
  x += y;
  x -= x >= mod ? mod : 0;
}
int main() {
  scanf("%d%d", &n, &m);
  n *= 2;
  rep(i, 1, m) scanf("%d%d", &a, &b), p[a] = b, p[b] = a;
  rep(i, 1, n) rep(j, i, n) cnt[i][j] =
      cnt[i][j - 1] + (!p[j]); // i~j中未连过的点数
  g[0] = 1;
  rep(i, 1, n) if (!(i & 1)) g[i] =
      (ll)g[i - 2] * (i - 1) %
      mod; // 两个点可以自成一个匹配或拆散i-2个点中的一个匹配，i-2+1
  rep(i, 1, n) rep(j, i, n) {
    bool flag = 1;
    rep(k, i, j) if (p[k] && (p[k] > j || p[k] < i)) flag = 0; // 不能连到外面
    if (!flag)
      continue;
    f[i][j] = g[cnt[i][j]]; // 容斥
    rep(k, i + 1, j - 1)
        upd(f[i][j], mod - (ll)f[i][k] * g[cnt[k + 1][j]] % mod);
  }
  rep(i, 1, n) rep(j, 1, n)
      upd(ans, (ll)f[i][j] * g[n - 2 * m - cnt[i][j]] % mod);
  printf("%d\n", ans);
  return 0;
}
// 果然很神啊……我好菜
Problem p03238 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  // 歳入力
  int N;
  cin >> N;

  // 条件分岐
  if (N == 2) {
    // 2歳
    int A = 0, B = 0;
    cin >> A;
    cin >> B;
    cout << A + B << endl;
  } else if (N == 1) {
    // 1歳
    cout << "Hello World" << endl;
    return 0;
  } else {
    // 一応その他
    return 0;
  }

  return -1;
}

Fixed submission:
#include <algorithm>
#include <array>
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
  // 歳入力
  int N;
  cin >> N;

  // 条件分岐
  if (N == 2) {
    // 2歳
    int A = 0, B = 0;
    cin >> A;
    cin >> B;
    cout << A + B << endl;
    return 0;
  } else if (N == 1) {
    // 1歳
    cout << "Hello World" << endl;
    return 0;
  } else {
    // 一応その他
    return 0;
  }

  return -1;
}
Problem p03238 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define ifaxb(a, x, b) if (a < x && x < b) // 比較は昇順
#define toInt(x) (x - '0')
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int>
#define spair pair<string, string>
#define lpair pair<LL, LL>
#define MP make_pair
#define MM multimap
#define PB push_back
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
  int n, a, b;
  cin >> n;
  if (n % 0) {
    cout << "Hello World" << endl;
  } else {
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define ifaxb(a, x, b) if (a < x && x < b) // 比較は昇順
#define toInt(x) (x - '0')
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int>
#define spair pair<string, string>
#define lpair pair<LL, LL>
#define MP make_pair
#define MM multimap
#define PB push_back
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
  int n, a, b;
  cin >> n;
  if (n % 2) {
    cout << "Hello World" << endl;
  } else {
    cin >> a >> b;
    cout << a + b << endl;
  }

  return 0;
}
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
def solve(string):
    flag, *ab = map(int, string.split())
    return str(sum(ab)) if flag - 1 else "Hello World"


if __name__ == "__main__":
    flag = int(input())
    if flag - 1:
        flag = "{}\n".format(flag) + "\n".join([input(), input()])
    print(solve(flag))


Fixed submission:
def solve(string):
    flag, *ab = map(int, string.split())
    return str(sum(ab)) if flag - 1 else "Hello World"


if __name__ == "__main__":
    flag = int(input())
    if flag - 1:
        flag = "{}\n".format(flag) + "\n".join([input(), input()])
    print(solve(str(flag)))
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
def solve():
    age = int(input())
    if age == 1:
        return "Hello World"
    a, b = map(int, input().split())
    return a + b


if __name__ == "__main__":
    print(solve())


Fixed submission:
def solve():
    age = int(input())
    if age == 1:
        return "Hello World"
    a, b = list(int(input()) for _ in range(2))
    return a + b


if __name__ == "__main__":
    print(solve())
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
def programming_education(N: int) -> str:
    if N == 1:
        return "Hello World"

    A, B = map(int, input().split())
    return str(A + B)


if __name__ == "__main__":
    N = int(input())
    ans = programming_education(N)
    print(ans)


Fixed submission:
def programming_education(N: int) -> str:
    if N == 1:
        return "Hello World"

    A = int(input())
    B = int(input())
    return str(A + B)


if __name__ == "__main__":
    N = int(input())
    ans = programming_education(N)
    print(ans)
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
dat0 = input()
if dat0 == 1:
    print("Hello World")
else:
    dat1 = input()
    dat2 = input()
    ans = int(dat1) + int(dat2)
    print(ans)


Fixed submission:
dat0 = input()
if dat0 == "1":
    print("Hello World")
else:
    dat1 = input()
    dat2 = input()
    ans = int(dat1) + int(dat2)
    print(ans)
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
if N == 1:
    print("Hello World")
else:
    a, b = map(int, input().split())
    print(a + b)


Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
import sys

N = int(sys.stdin.readline())

if N == 1:
    print("Hello World")
    sys.exit()

if N == 2:
    ans = 0
    for value in sys.stdin.readlines():
        ans += value

    print(ans)


Fixed submission:
import sys

N = int(sys.stdin.readline())

if N == 1:
    print("Hello World")
    sys.exit()

if N == 2:
    ans = 0
    for value in sys.stdin.readlines():
        ans += int(value)

    print(ans)
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
N = int(input())

if N == 1:
    print("Hello World")
elif N == 2:
    A, B = map(int, input().split())

    print(A + B)


Fixed submission:
N = int(input())

if N == 1:
    print("Hello World")
elif N == 2:
    A = int(input())
    B = int(input())
    print(A + B)
Problem p03238 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

#define fastIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int

int32_t main() {
  fastIO;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  int n, i;
  cin >> n;
  if (n == 1)
    cout << "Hello World";
  else {
    int a, b, c;
    cin >> a >> b;
    c = a + b;
    cout << c;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;

#define fastIO                                                                 \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int

int32_t main() {
  fastIO;

  int n, i;
  cin >> n;
  if (n == 1)
    cout << "Hello World";
  else {
    int a, b, c;
    cin >> a >> b;
    c = a + b;
    cout << c;
  }
  return 0;
}
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
if N == 1:
    print("Hello World")
else:
    A, B = map(int, input().split())
    print(A + B)


Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)
Problem p03238 (Python)

Buggy submission (status: Runtime Error):
N = int(input())

if N == 1:
    print("Hello World")
else:
    A, B = map(int, input().split())
    print(A + B)


Fixed submission:
N = int(input())

if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A + B)
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;
#define all(a) a.begin(), a.end()
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using P = pair<ll, ll>;
using ld = long double;

int main() {
  ll N, T;
  cin >> N >> T;
  vector<P> p;
  for (int i = 0; i < N; ++i) {
    ll t, c;
    cin >> c >> t;
    if (t <= T)
      p.push_back({c, t});
  }
  if (p.empty())
    puts("TLE");
  sort(all(p));
  cout << p[0].first << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;
#define all(a) a.begin(), a.end()
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using P = pair<ll, ll>;
using ld = long double;

int main() {
  ll N, T;
  cin >> N >> T;
  vector<P> p;
  for (int i = 0; i < N; ++i) {
    ll t, c;
    cin >> c >> t;
    if (t <= T)
      p.push_back({c, t});
  }
  if (p.empty())
    puts("TLE");
  else {
    sort(all(p));
    cout << p[0].first << endl;
  }
  return 0;
}
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
import sys

N, T = map(int, sys.stdin.readline().strip().split())  # N個の帰宅経路, T時間以内に

cost = 1001
for line in sys.stdin.readlines():
    c, t = line.strip().split()
    if T >= t:
        cost = min(cost, c)

if cost == 1001:
    print("TLE")
else:
    print(cost)


Fixed submission:
import sys

N, T = map(int, sys.stdin.readline().strip().split())  # N個の帰宅経路, T時間以内に

cost = 1001
for line in sys.stdin.readlines():
    c, t = map(int, line.strip().split())
    if T >= t:
        cost = min(cost, c)

if cost == 1001:
    print("TLE")
else:
    print(cost)
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
N, T = map(int, input().split())

c = set()
for i in range(0, N):
    ci, ti = map(int, input().split())
    if ti > T:
        continue
    c.add(ci)

print(min(c))


Fixed submission:
N, T = map(int, input().split())

c = set()
for i in range(0, N):
    ci, ti = map(int, input().split())
    if ti > T:
        continue
    c.add(ci)

if c:
    print(min(c))
else:
    print("TLE")
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
import sys

input = sys.stdin.readline


def main():
    n, t = map(int, input().split())
    routes = filter(
        lambda x: x[1] <= t, [list(map(int, input().split())) for _ in range(n)]
    )
    if routes:
        print(min(routes)[0])
    else:
        print("TLE")


if __name__ == "__main__":
    main()


Fixed submission:
import sys

input = sys.stdin.readline


def main():
    n, t = map(int, input().split())
    routes = list(
        filter(lambda x: x[1] <= t, [list(map(int, input().split())) for _ in range(n)])
    )
    if routes:
        print(min(routes)[0])
    else:
        print("TLE")


if __name__ == "__main__":
    main()
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
N, T = map(int, input().split())
a = 9999
for _ in N:
    c, t = map(int, input().split())
    if t <= T:
        a = min(a, c)
if a == 9999:
    print("TLE")
else:
    print(a)


Fixed submission:
N, T = map(int, input().split())
a = 9999
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        a = min(a, c)
if a == 9999:
    print("TLE")
else:
    print(a)
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, t;
  cin >> n >> t;

  vector<pair<int, int>> vp;

  for (int i = 0; i < n; ++i) {
    int ci, ti;
    cin >> ci >> ti;

    if (ti > t)
      continue;
    vp.push_back(make_pair(ci, ti));
  }
  sort(vp.begin(), vp.end());
  cout << vp[0].first << endl;
}

Fixed submission:
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, t;
  cin >> n >> t;

  vector<pair<int, int>> vp;

  for (int i = 0; i < n; ++i) {
    int ci, ti;
    cin >> ci >> ti;

    if (ti > t)
      continue;
    vp.push_back(make_pair(ci, ti));
  }
  sort(vp.begin(), vp.end());
  if (vp.empty())
    cout << "TLE" << endl;
  else
    cout << vp[0].first << endl;
}
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
N, T = map(int, input().split())
r = [tuple(map(int, input().split())) for _ in range(N)]
f = [(c, t) for c, t in r if t <= T]
print(min(f, key=lambda x: x[0])[0])


Fixed submission:
N, T = map(int, input().split())
r = [tuple(map(int, input().split())) for _ in range(N)]
f = [(c, t) for c, t in r if t <= T]
if len(f) == 0:
    print("TLE")
else:
    print(min(f, key=lambda x: x[0])[0])
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
def solve(string):
    n, t, *ct = map(int, string.split())
    c = [_c for _c, _t in zip(ct[::2], ct[1::2]) if _t <= t]
    return str(min(c)) if len(c) else "TLE"


if __name__ == "__main__":
    n, t = map(int, input().split())
    print(solve("{} {}\n".format(n, t) + "\n".join([input() for _ in n])))


Fixed submission:
def solve(string):
    n, t, *ct = map(int, string.split())
    c = [_c for _c, _t in zip(ct[::2], ct[1::2]) if _t <= t]
    return str(min(c)) if len(c) else "TLE"


if __name__ == "__main__":
    n, t = map(int, input().split())
    print(solve("{} {}\n".format(n, t) + "\n".join([input() for _ in range(n)])))
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

bool compare_pair(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    return a.first > b.first;
  } else {
    return a.second < b.second;
  }
}

int main() {
  int n, t;
  cin >> n >> t;
  vector<pair<int, int>> c(n);
  rep(i, n) cin >> c[i].first >> c[i].second;

  sort(ALL(c), compare_pair);

  int ans = 10000;
  int no = 0;
  while (c[no].second <= t)
    ans = min(ans, c[no++].first);
  if (ans == 10000)
    cout << "TLE";
  else
    cout << ans;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()

bool compare_pair(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) {
    return a.first > b.first;
  } else {
    return a.second < b.second;
  }
}

int main() {
  int n, t;
  cin >> n >> t;
  vector<pair<int, int>> c(n);
  rep(i, n) cin >> c[i].first >> c[i].second;

  sort(ALL(c), compare_pair);

  int ans = 10000;
  int no = 0;
  while (c[no].second <= t && no < n)
    ans = min(ans, c[no++].first);
  if (ans == 10000)
    cout << "TLE";
  else
    cout << ans;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

const ll MOD = 1000000007;
const int INF = 1 << 30;
// const ll INF = (ll)1e18 + 1;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> cost;
  rep(i, N) {
    int c, t;
    cin >> c >> t;
    if (t <= T)
      cost.push_back(c);
  }
  sort(cost.begin(), cost.end());
  cout << cost[0] << endl;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

const ll MOD = 1000000007;
const int INF = 1 << 30;
// const ll INF = (ll)1e18 + 1;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> cost;
  rep(i, N) {
    int c, t;
    cin >> c >> t;
    if (t <= T)
      cost.push_back(c);
  }
  if (cost.empty()) {
    cout << "TLE" << endl;
    return 0;
  }
  sort(cost.begin(), cost.end());
  cout << cost[0] << endl;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int c[T], t[N];
  for (int i = 0; i < N; ++i) {
    cin >> c[i] >> t[i];
  }

  int min = 1001;
  for (int i = 0; i < N; ++i) {
    if (t[i] <= T) {
      if (c[i] <= min) {
        min = c[i];
      }
    }
  }
  if (min == 1001) {
    cout << "TLE" << endl;
    return 0;
  }
  cout << min << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int c[N], t[N];
  for (int i = 0; i < N; ++i) {
    cin >> c[i] >> t[i];
  }

  int min = 1001;
  for (int i = 0; i < N; ++i) {
    if (t[i] <= T) {
      if (c[i] <= min) {
        min = c[i];
      }
    }
  }
  if (min == 1001) {
    cout << "TLE" << endl;
    return 0;
  }
  cout << min << endl;
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;

  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[N] >> B[N];
  }
  int b = 1001;
  for (int i = 0; i < N; i++) {
    if (T >= B[i]) {
      b = min(b, A[i]);
    }
  }
  if (b == 1001) {
    cout << "TLE" << endl;
  } else {
    cout << b << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;

  vector<int> A(N);
  vector<int> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
  }
  int b = 1001;
  for (int i = 0; i < N; i++) {
    if (T >= B[i]) {
      b = min(b, A[i]);
    }
  }
  if (b == 1001) {
    cout << "TLE" << endl;
  } else {
    cout << b << endl;
  }
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

int threemax(int a, int b, int c) {
  if (a >= b && a >= c) {
    return a;
  } else if (b >= a && b >= c) {
    return b;
  } else {
    return c;
  }
}

int threemin(int a, int b, int c) {
  if (a <= b && a <= c) {
    return a;
  } else if (b <= a && b <= c) {
    return b;
  } else {
    return c;
  }
}

void chmaxl(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
  return;
}

void chminl(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
  return;
}

void chmaxi(int &a, int b) {
  if (a < b) {
    a = b;
  }
  return;
}

void chmini(int &a, int b) {
  if (a > b) {
    a = b;
  }
  return;
}

int main() {
  int N, T;
  cin >> N >> T;
  int ans = 10000;
  vector<int> cvec;
  vector<int> tvec;
  for (int i = 0; i < N; i++) {
    cin >> cvec.at(i) >> tvec.at(i);
    if (tvec.at(i) <= T && cvec.at(i) < ans) {
      ans = cvec.at(i);
    }
  }
  if (ans == 10000) {
    cout << "TLE";
  } else {
    cout << ans;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define MAXR 100000
#define _GLIBCXX_DEBUG

int threemax(int a, int b, int c) {
  if (a >= b && a >= c) {
    return a;
  } else if (b >= a && b >= c) {
    return b;
  } else {
    return c;
  }
}

int threemin(int a, int b, int c) {
  if (a <= b && a <= c) {
    return a;
  } else if (b <= a && b <= c) {
    return b;
  } else {
    return c;
  }
}

void chmaxl(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
  return;
}

void chminl(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
  return;
}

void chmaxi(int &a, int b) {
  if (a < b) {
    a = b;
  }
  return;
}

void chmini(int &a, int b) {
  if (a > b) {
    a = b;
  }
  return;
}

int main() {
  int N, T;
  cin >> N >> T;
  int ans = 10000;
  vector<int> cvec(N);
  vector<int> tvec(N);
  for (int i = 0; i < N; i++) {
    cin >> cvec.at(i) >> tvec.at(i);
    if (tvec.at(i) <= T && cvec.at(i) < ans) {
      ans = cvec.at(i);
    }
  }
  if (ans == 10000) {
    cout << "TLE";
  } else {
    cout << ans;
  }
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
// Compiler version g++ 6.3.0

int main() {
  int N, t;
  vector<int> a;
  cin >> N >> t;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    if (y <= t) {
      a.push_back(x);
    }
  }
  sort(a.begin(), a.end());
  cout << a.at(0) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
// Compiler version g++ 6.3.0

int main() {
  int N, t;
  vector<int> a;
  cin >> N >> t;
  for (int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    if (y <= t) {
      a.push_back(x);
    }
  }
  sort(a.begin(), a.end());
  if (!a.empty()) {
    cout << a.at(0) << endl;
  } else {
    cout << "TLE" << endl;
  }
}
Problem p03239 (Python)

Buggy submission (status: Runtime Error):
N, T = map(int, input().split())
c_t = [list(map(int, input().split())) for _ in range(N)]
cost = 2_000_000
TLE_flg = True
for i in range(N):
    if c_t[i][1] <= T:
        cost = min(cost, c_t[i][0])
        TLE_flg = False
print("TLE" if TLE_flg else cost)


Fixed submission:
N, T = map(int, input().split())
c_t = [list(map(int, input().split())) for _ in range(N)]
cost = 2000000
TLE_flg = True
for i in range(N):
    if c_t[i][1] <= T:
        cost = min(cost, c_t[i][0])
        TLE_flg = False
print("TLE" if TLE_flg else cost)
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c;
  for (int i = 0; i < N; i++) {
    int t, x;
    cin >> x >> t;
    if (t <= T) {
      c.push_back(x);
    }
  }
  sort(c.begin(), c.end());
  cout << c.at(0) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c;
  for (int i = 0; i < N; i++) {
    int t, x;
    cin >> x >> t;
    if (t <= T) {
      c.push_back(x);
    }
  }
  if (c.size() == 0) {
    cout << "TLE" << endl;
  } else {
    sort(c.begin(), c.end());
    cout << c.at(0) << endl;
  }
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> cost;
  int c, t;
  for (int i = 0; i < N; i++) {
    cin >> c >> t;
    if (t <= T) {
      cost.push_back(c);
    }
  }
  sort(cost.begin(), cost.end());
  cout << *cost.begin();
  return 0;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> cost;
  int c, t;
  for (int i = 0; i < N; i++) {
    cin >> c >> t;
    if (t <= T) {
      cost.push_back(c);
    }
  }
  if (cost.size() != 0) {
    sort(cost.begin(), cost.end());
    cout << *cost.begin();
  } else {
    cout << "TLE";
  }
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, t;
  cin >> n >> t;
  vector<int> cost(0);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (y <= t)
      cost.push_back(x);
  }
  sort(cost.begin(), cost.end());
  cout << cost.at(0) << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, t;
  cin >> n >> t;
  vector<int> cost(0);
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (y <= t)
      cost.push_back(x);
  }
  sort(cost.begin(), cost.end());
  if (cost.size() > 0)
    cout << cost.at(0) << endl;
  else
    cout << "TLE" << endl;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define pb push_back
#define mp make_pair
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define INF (1 << 30)
#define LLINF (1 << 60)
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, T;
  vector<int> route;
  cin >> n >> T;
  for (int i = 0; i < n; i++) {
    int t, tt;
    cin >> t >> tt;
    if (tt <= T)
      route.pb(t);
  }
  sort(route.begin(), route.end());
  cout << route[0] << endl;
  return 0;
}


Fixed submission:
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define pb push_back
#define mp make_pair
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define INF (1 << 30)
#define LLINF (1 << 60)
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
using ll = long long;
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int n, T;
  vector<int> route;
  cin >> n >> T;
  for (int i = 0; i < n; i++) {
    int t, tt;
    cin >> t >> tt;
    if (tt <= T)
      route.pb(t);
  }
  sort(route.begin(), route.end());
  if (route.size() == 0)
    cout << "TLE" << endl;
  else
    cout << route[0] << endl;
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define PB push_back
#define all(a) (a).begin(), (a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a) (a).begin(), (a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{(ll)1e9 + 7};
const long double EPS = 1e-10;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N), ans;
  rep(i, N) {
    cin >> c[i] >> t[i];
    if (t[i] <= T) {
      ans.push_back(c[i]);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

#define PB push_back
#define all(a) (a).begin(), (a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a) (a).begin(), (a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{(ll)1e9 + 7};
const long double EPS = 1e-10;

int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N), ans;
  rep(i, N) {
    cin >> c[i] >> t[i];
    if (t[i] <= T) {
      ans.push_back(c[i]);
    }
  }
  if (ans.size() > 0) {
    sort(ans.begin(), ans.end());
    cout << ans[0] << endl;
  } else {
    cout << "TLE" << endl;
  }
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  vector<int> answer;
  for (int i = 0; i < N; ++i) {
    cin >> c[i] >> t[i];
    if (t[i] <= T) {
      answer.push_back(c[i]);
    }
  }
  sort(answer.begin(), answer.end());
  cout << answer[0] << endl;

  cin >> N;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N, T;
  cin >> N >> T;
  vector<int> c(N), t(N);
  vector<int> answer;
  for (int i = 0; i < N; ++i) {
    cin >> c[i] >> t[i];
    if (t[i] <= T) {
      answer.push_back(c[i]);
    }
  }
  if (answer.size() == 0) {
    cout << "TLE" << endl;
    return 0;
  }
  sort(answer.begin(), answer.end());
  cout << answer[0] << endl;

  cin >> N;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  freopen("input.txt", "r", stdin);

  int n, t;
  cin >> n >> t;

  vector<int> cost(n), time(n);
  for (int i = 0; i < n; ++i) {
    cin >> cost[i] >> time[i];
  }

  int ans = 1001;
  for (int i = 0; i < n; ++i) {
    if (time[i] <= t) {
      if (cost[i] < ans) {
        ans = cost[i];
      }
    }
  }

  if (ans == 1001) {
    cout << "TLE"
         << "\n";
  } else {
    cout << ans << "\n";
  }
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n, t;
  cin >> n >> t;

  vector<int> cost(n), time(n);
  for (int i = 0; i < n; ++i) {
    cin >> cost[i] >> time[i];
  }

  int ans = 1001;
  for (int i = 0; i < n; ++i) {
    if (time[i] <= t) {
      if (cost[i] < ans) {
        ans = cost[i];
      }
    }
  }

  if (ans == 1001) {
    cout << "TLE"
         << "\n";
  } else {
    cout << ans << "\n";
  }
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
using namespace std;

struct input {
  int c, t;
} inputs[1000];

bool compare(input a, input b) {
  if (a.t == b.t) {
    return a.c < b.c;
  }
  return a.t < b.t;
}

int main() {
  int N, T;
  cin >> N >> T;
  int c, t;
  for (int i = 0; i < N; i++) {
    cin >> c >> t;
    inputs[i] = input{c, t};
  }

  sort(inputs, inputs + N, compare);

  if (inputs[0].t > T) {
    cout << "TLE" << endl;
  } else {
    int mincost = 1001;
    int i = 0;
    while (inputs[i].t <= T) {
      mincost = min(mincost, inputs[i].c);
      i++;
    }
    cout << mincost << endl;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
using namespace std;

struct input {
  int c, t;
} inputs[1000];

bool compare(input a, input b) {
  if (a.t == b.t) {
    return a.c < b.c;
  }
  return a.t < b.t;
}

int main() {
  int N, T;
  cin >> N >> T;
  int c, t;
  for (int i = 0; i < N; i++) {
    cin >> c >> t;
    inputs[i] = input{c, t};
  }

  sort(inputs, inputs + N, compare);

  if (inputs[0].t > T) {
    cout << "TLE" << endl;
  } else {
    int mincost = 1001;
    int i = 0;
    while (inputs[i].t <= T && i < N) {
      mincost = min(mincost, inputs[i].c);
      i++;
    }
    cout << mincost << endl;
  }

  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, t, i;
  cin >> n >> t;
  vector<int> c, q;
  for (i = 0; i < n; i++)
    cin >> c[i] >> q[i];
  vector<int> p;
  for (i = 0; i < n; i++) {
    if (q[i] <= t)
      p.push_back(c[i]);
  }
  if (p.size() == 0)
    cout << "TLE" << endl;
  else
    cout << *min_element(p.begin(), p.end()) << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
  int n, t, i;
  cin >> n >> t;
  int c[n], q[n];
  for (i = 0; i < n; i++)
    cin >> c[i] >> q[i];
  vector<int> p;
  for (i = 0; i < n; i++) {
    if (q[i] <= t)
      p.push_back(c[i]);
  }
  if (p.size() == 0)
    cout << "TLE" << endl;
  else
    cout << *min_element(p.begin(), p.end()) << endl;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N, T;
  cin >> N >> T;

  vector<int> C;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      C.push_back(c);
    }
  }

  sort(C.begin(), C.end());

  cout << C[0] << endl;
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int N, T;
  cin >> N >> T;

  vector<int> C;
  for (int i = 0; i < N; i++) {
    int c, t;
    cin >> c >> t;
    if (t <= T) {
      C.push_back(c);
    }
  }

  if (C.size() == 0) {
    cout << "TLE" << endl;
    return 0;
  }

  sort(C.begin(), C.end());

  cout << C[0] << endl;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using ll = long long;
#define int ll
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define erep(e, v) for (auto &&e : v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9 : (int)1e18)
#define EPS 0.0000000001
using namespace std;
template <class T, class S> void cmin(T &a, const S &b) {
  if (a > b)
    a = b;
}
template <class T, class S> void cmax(T &a, const S &b) {
  if (a < b)
    a = b;
}
template <typename Head, typename Value>
auto vectors(const Head &head, const Value &v) {
  return vector<Value>(head, v);
}
template <typename Head, typename... Tail> auto vectors(Head x, Tail... tail) {
  auto inner = vectors(tail...);
  return vector<decltype(inner)>(x, inner);
}
template <class T> void join(T a) {
  for (auto itr : a) {
    if (itr != *a.begin())
      cout << " ";
    cout << itr;
  }
}
using ld = long double;
using pii = pair<int, int>;
using piii = pair<int, pii>;
int W, H;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
bool valid(int x, int y) { return (0 <= x && x < W) && (0 <= y && y < H); }
signed main() {
  int n, t;
  cin >> n >> t;
  vector<int> v;
  rep(_, n) {
    int a, b;
    cin >> a >> b;
    if (b <= t)
      v.push_back(a);
  }
  cout << *min_element(all(v)) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using ll = long long;
#define int ll
#define rep(i, n) for (int i = 0; i < n; i++)
#define loop(i, s, n) for (int i = s; i < n; i++)
#define erep(e, v) for (auto &&e : v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9 : (int)1e18)
#define EPS 0.0000000001
using namespace std;
template <class T, class S> void cmin(T &a, const S &b) {
  if (a > b)
    a = b;
}
template <class T, class S> void cmax(T &a, const S &b) {
  if (a < b)
    a = b;
}
template <typename Head, typename Value>
auto vectors(const Head &head, const Value &v) {
  return vector<Value>(head, v);
}
template <typename Head, typename... Tail> auto vectors(Head x, Tail... tail) {
  auto inner = vectors(tail...);
  return vector<decltype(inner)>(x, inner);
}
template <class T> void join(T a) {
  for (auto itr : a) {
    if (itr != *a.begin())
      cout << " ";
    cout << itr;
  }
}
using ld = long double;
using pii = pair<int, int>;
using piii = pair<int, pii>;
int W, H;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
bool valid(int x, int y) { return (0 <= x && x < W) && (0 <= y && y < H); }
signed main() {
  int n, t;
  cin >> n >> t;
  vector<int> v;
  rep(_, n) {
    int a, b;
    cin >> a >> b;
    if (b <= t)
      v.push_back(a);
  }
  cout << (v.size() ? to_string(*min_element(all(v))) : "TLE") << endl;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
#define speed                                                                  \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);
int const N = 1e5 + 1;
vector<int> v;
int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
#endif
  speed int x, time;
  cin >> x >> time;
  f(i, 0, x) {
    int c, t;
    cin >> c >> t;
    if (t <= time) {
      v.push_back(c);
    }
  }
  sort(v.begin(), v.end());
  if (v.size() == 0)
    cout << "TLE" << endl;
  else
    cout << v[0] << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
#define speed                                                                  \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);
int const N = 1e5 + 1;
vector<int> v;
int main() {
  speed int x, time;
  cin >> x >> time;
  f(i, 0, x) {
    int c, t;
    cin >> c >> t;
    if (t <= time) {
      v.push_back(c);
    }
  }
  sort(v.begin(), v.end());
  if (v.size() == 0)
    cout << "TLE" << endl;
  else
    cout << v[0] << endl;

  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <vector>
int main(void) {
  int N, T;
  std::cin >> N >> T;

  std::vector<int> costs;

  int time = 0;
  int cost = 0;
  for (int i = 0; i < N; i++) {
    std::cin >> cost >> time;
    if (time <= T) {
      costs.push_back(cost);
    }
  }
  std::sort(costs.begin(), costs.end());
  std::cout << costs[0];
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <vector>
int main(void) {
  int N, T;
  std::cin >> N >> T;

  std::vector<int> costs;

  int time = 0;
  int cost = 0;
  for (int i = 0; i < N; i++) {
    std::cin >> cost >> time;
    if (time <= T) {
      costs.push_back(cost);
    }
  }
  if (costs.size() == 0) {
    std::cout << "TLE";
  } else {
    std::sort(costs.begin(), costs.end());
    std::cout << costs[0];
  }
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int c[1000];
  int t[1000];
  int cost = 1001;
  for (int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
    if ((t[i] <= T) && (c[i] <= cost))
      cost = c[i];
  }
  if (cost == 1001)
    cout << "TLE";
  else
    cout << cost;
  while (1)
    ;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;

int main() {
  int N, T;
  cin >> N >> T;
  int c[1000];
  int t[1000];
  int cost = 1001;
  for (int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
    if ((t[i] <= T) && (c[i] <= cost))
      cost = c[i];
  }
  if (cost == 1001)
    cout << "TLE";
  else
    cout << cost;
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, t, ci, ti;
  vector<int> cost;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> ci >> ti;
    if (ti > t)
      continue;
    cost.push_back(ci);
  }
  cout << *min_element(cost.begin(), cost.end());
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, t, ci, ti;
  vector<int> cost;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> ci >> ti;
    if (ti > t)
      continue;
    cost.push_back(ci);
  }
  if (cost.size() == 0)
    cout << "TLE";
  else
    cout << *min_element(cost.begin(), cost.end());
  return 0;
}
Problem p03239 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, T, ans = 1001;
  cin >> N >> T;
  vector<int> c(N), t(N);
  for (int i = 1; i <= N; i++) {
    cin >> c[i] >> t[i];
  }

  for (int i = 1; i <= N; i++) {
    if (t[i] <= T)
      ans = min(ans, c[i]);
  }
  if (ans == 1001)
    cout << "TLE" << endl;
  else
    cout << ans << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, T, ans = 1001;
  cin >> N >> T;
  vector<int> c(110), t(110);
  for (int i = 1; i <= N; i++) {
    cin >> c[i] >> t[i];
  }

  for (int i = 1; i <= N; i++) {
    if (t[i] <= T)
      ans = min(ans, c[i]);
  }
  if (ans == 1001)
    cout << "TLE" << endl;
  else
    cout << ans << endl;
}
Problem p03240 (Python)

Buggy submission (status: Time Limit Exceeded):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *XYH = map(int, read().split())

    for cx in range(101):
        for cy in range(101):
            ok = 10**12
            ng = 0
            while ok - ng > 1:
                mid = (ok + ng) // 2
                valid = True
                for x, y, h in zip(*[iter(XYH)] * 3):
                    if max(mid - abs(x - cx) - abs(y - cy), 0) < h:
                        valid = False
                        break
                if valid:
                    ok = mid
                else:
                    ng = mid
            H = ok
            valid = True
            for x, y, h in zip(*[iter(XYH)] * 3):
                if max(H - abs(x - cx) - abs(y - cy), 0) != h:
                    valid = False
                    break
            if valid:
                print(cx, cy, H)
                return

    return


if __name__ == "__main__":
    main()


Fixed submission:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *XYH = map(int, read().split())

    for cx in range(101):
        for cy in range(101):
            ok = 10**9 + 100
            ng = 0
            while ok - ng > 1:
                mid = (ok + ng) // 2
                valid = True
                for x, y, h in zip(*[iter(XYH)] * 3):
                    if max(mid - abs(x - cx) - abs(y - cy), 0) < h:
                        valid = False
                        break
                if valid:
                    ok = mid
                else:
                    ng = mid
            H = ok
            valid = True
            for x, y, h in zip(*[iter(XYH)] * 3):
                if max(H - abs(x - cx) - abs(y - cy), 0) != h:
                    valid = False
                    break
            if valid:
                print(cx, cy, H)
                return

    return


if __name__ == "__main__":
    main()