alexjercan/bugnet huggingface dataset:
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mod 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define repa(i, start, end) for (int i = start; i <= end; i++)
#define repd(i, start, end) for (int i = start; i >= end; i--)
#define all(x) x.begin(), x.end()
void solve() {
  float d, t, s;
  cin >> d >> t >> s;
  if ((d / s) <= t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mod 1000000007
#define rep(i, n) for (int i = 0; i < n; i++)
#define repa(i, start, end) for (int i = start; i <= end; i++)
#define repd(i, start, end) for (int i = start; i >= end; i--)
#define all(x) x.begin(), x.end()
void solve() {
  ll d, t, s;
  cin >> d >> t >> s;
  if ((d / s) <= t) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

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

typedef long long ll;
typedef long double ld;

void solve() {
  ll d, t, s;
  cin >> d >> t >> s;

  ll curD = t * s;

  cout << (curD >= d ? "Yes" : "No") << endl;
}

int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);

#ifdef _DEBUG
  freopen("a-input-1.txt", "r", stdin);
  // freopen("a-output-1.txt", "w", stdout);
#endif

  solve();
  // int t; cin >> t; while(t--) solve();

  return 0;
}


Error: -8

Fixed submission:

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

typedef long long ll;
typedef long double ld;

void solve() {
  ll d, t, s;
  ll curT = (d / s);
  cin >> d >> t >> s;

  cout << (curT > t ? "No" : "Yes") << endl;
}

int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);

#ifdef _DEBUG
  freopen("a-input-1.txt", "r", stdin);
  // freopen("a-output-1.txt", "w", stdout);
#endif

  solve();
  // int t; cin >> t; while(t--) solve();

  return 0;
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

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

#define print cout <<

int main() {
  int dist, time, speed;
  cin >> dist >> time >> speed;

  if ((double)dist / speed <= time) {
    print "Yes" << endl;
  } else {
    print "No" << endl;
  }
}


Error: WA

Fixed submission:

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

#define print cout <<

int main() {
  int dist, time, speed;
  cin >> dist, time, speed;
  if (dist / speed < time) {
    print "Yes" << endl;
  }
  print "No" << endl;
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int D, T, S;
  cin >> D >> T >> S;
  if (T * S >= D) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Error: 0

Fixed submission:

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

int main() {
  int D, T, S;
  cin >> D, T, S;
  if (D / S < T) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) (ll) x.size()
int N = 2e5 + 5;

void solve_test_case() {
  ll d, t, n;
  cin >> d >> t >> n;
  if ((double)d / n <= t) {
    cout << "Yes\\n";
    return;
  }
  cout << "No\\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  // cin>>t;
  for (int i = 1; i <= t; ++i) {
    solve_test_case();
  }
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) (ll) x.size()
int N = 2e5 + 5;

void solve_test_case() {
  ll d, t, n;
  cin >> d >> t >> n;
  if (d / n <= t) {
    cout << "Yes\\n";
    return;
  }
  cout << "No\\n";
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = 1; i <= t; ++i) {
    solve_test_case();
  }
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

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

#define ll long long
#define pb push_back
#define printV(v)                                                              \\
  for (int i = 0; i < (int)v.size(); i++) {                                    \\
    cout << v[i] << " ";                                                       \\
  }                                                                            \\
  cout << endl
#define printRev(v)                                                            \\
  for (int i = (int)v.size() - 1; i >= 0; i--) {                               \\
    cout << v[i] << " ";                                                       \\
  }                                                                            \\
  cout << endl
#define sortV(v) sort(v.begin(), v.end())
#define revV(v) reverse(v.begin(), v.end())

ll a, b, c, d, e, f, g, n, m, k, t, x, h, w, p, q, y;
string str = "";
ll mod = 1e9 + 7;
const int N = 3009;

void solve() {
  cin >> n >> m >> k;
  ll time = n / k;
  if (n % k)
    time++;
  if (time <= m)
    cout << "Yes\\n";
  else
    cout << "No\\n";
}

int main() {
  ios_base::sync_with_stdio(false);

  int cases = 1;
  // cin >> cases;

  while (cases--)
    solve();
  return 0;
}


Error: -8

Fixed submission:

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

#define ll long long
#define pb push_back
#define printV(v)                                                              \\
  for (int i = 0; i < (int)v.size(); i++) {                                    \\
    cout << v[i] << " ";                                                       \\
  }                                                                            \\
  cout << endl
#define printRev(v)                                                            \\
  for (int i = (int)v.size() - 1; i >= 0; i--) {                               \\
    cout << v[i] << " ";                                                       \\
  }                                                                            \\
  cout << endl
#define sortV(v) sort(v.begin(), v.end())
#define revV(v) reverse(v.begin(), v.end())

ll a, b, c, d, e, f, g, n, m, k, t, x, h, w, p, q, y;
string str = "";
ll mod = 1e9 + 7;
const int N = 3009;

void solve() {
  cin >> n >> m >> k;
  ll time = n / k;
  if (n % k)
    time++;
  if (time <= m)
    cout << "YES\\n";
  else
    cout << "NO\\n";
}

int main() {
  ios_base::sync_with_stdio(false);

  int cases = 1;
  cin >> cases;

  while (cases--)
    solve();
  return 0;
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {

  int d, t, s;

  cin >> d >> t >> s;

  double speed = d / (t * 1.0);

  cout << (s >= speed ? "Yes" : "No");

  return 0;
}


Error: -11

Fixed submission:

#include <iostream>
using namespace std;
int main() {

  int d, t, s;

  cin >> d >> t >> s;

  double speed = d / (t * 1.0);

  cout << (s >= speed ? "Yes" : "No");
  main();
  return 0;
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  double D, T, S;
  cin >> D >> T >> S;

  double min = D / S;

  if (min <= T && S != 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Error: 0

Fixed submission:

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

int main() {
  int D, T, S;
  cin >> D, T, S;

  int min = D / (S * 60);

  if (min <= T) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  double a, b, c;
  cin >> a >> b >> c;
  if (b >= a / c) {
    cout << "Yes";
  } else
    cout << "No";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s, t, u;
  int ans, c;
  cin >> s >> t;
  for (int i = 0; i < s.size() - t.size() + 1; i++) {
    u = s.substr(i, t.size());
    c = 0;
    for (int j = 0; j < t.size(); j++) {
      if (u[j] != t[j]) {
        c++;
      }
    }
    ans = min(1000, c);
  }
  cout << ans;
  return 0;
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

const char nl = '\\n';

int main() {
#ifndef ONLINE_JUDGE
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  double d, t, s;
  cin >> d >> t >> s;
  if (d / s <= t) {
    cout << "Yes" << nl;
  } else {
    cout << "No" << nl;
  }
  return 0;
}

Error: -11

Fixed submission:

/* bimillahir rahmanir rahim...
 * AUTHOR
 * mubin_akib */
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define REP(i, a, b) for (int i = a; i <= (b); ++i)
#define trav(a, x) for (auto &a : x)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template <class T> bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template <class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
const char nl = '\\n';

ll solve() {
  int d, t, s;
  cin >> d >> t >> s;
  if (d / s <= t) {
    cout << "YES" << nl;
  } else {
    cout << "NO" << nl;
  }
}

int main() {
#ifndef ONLINE_JUDGE
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
#endif
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
Problem p02570 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
int main() {
  int d, t, s;
  cin >> d >> t >> s;
  if (d <= (t * s)) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mk make_pair
#define mod 1000000007
int main() {
  string s, t;
  cin >> s >> t;
  int ans = INT_MAX;
  for (int i = 0; i < s.length() - t.length() + 1; i++) {
    string str = s.substr(i, i + t.length());
    int c = 0;
    for (int j = 0; j < t.length(); j++) {
      if (t[j] != str[j])
        c++;
    }
    ans = min(c, ans);
  }
  cout << ans << endl;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string S, T;
  cin >> S;
  cin >> T;

  int Sl = S.size();
  int Tl = T.size();

  vector<int> candi;

  int tmp = 0;

  for (int i = 0; i < Sl - Tl + 1; i++) {
    for (int j = 0; j < Tl; j++) {
      if (T[j] != S[i + j])
        tmp++;
    }
    candi.push_back(tmp);
    tmp = 0;
  }

  // rep(i,candi.size()) cout << candi[i] << endl;

  tmp = 10000;

  rep(i, candi.size()) {
    if (tmp > candi[i])
      tmp = candi[i];
  }

  int ans = *std::min_element(candi.begin(), candi.end());
  cout << tmp << endl;
  return 0;
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string S, T;
  cin >> S;
  cin >> T;

  int Sl = S.size();
  int Tl = T.size();

  vector<int> candi;

  int tmp = 0;

  for (int i = 0; i < Sl - Tl; i++) {
    for (int j = 0; j < Tl; j++) {
      if (T[j] != S[i + j])
        tmp++;
    }
    candi.push_back(tmp);
    tmp = 0;
  }

  int ans = *std::min_element(candi.begin(), candi.end());
  cout << ans << endl;
  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  int s_size = S.size();
  int t_size = T.size();
  int size = s_size - t_size;
  int n = T.size();
  int count;
  for (int i = 0; i <= size; i++) {
    count = 0;
    for (int j = 0; j < t_size; j++) {
      if (S[i + j] != T[j])
        count++;
    }
    n = min(n, count);
  }
  cout << n << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
using namespace std;

int main() {
  string S, T;
  cin >> S >> T;
  int n = 0;
  if (S.find(T) != std::string::npos) {

  } else {
    int l = T.size() - 1;
    int i = 0;
    while (S.find(T.substr(i, l)) == std::string::npos) {
      int time = T.size() - l;
      if (i == time)
        l--;
    }
    n = T.size() - l;
  }
  cout << n << endl;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
  string compare2;
  string given;

  cin >> compare2 >> given;

  int len1 = compare2.size();
  int len2 = given.size();

  int cost = 0;
  int mincost = INT_MAX;

  if (len1 == len2) {
    if (compare2.compare(given) == 0) {
      cout << 0 << endl;
    } else {
      for (int i = 0; i < len2; i++) {
        if (compare2.at(i) != given.at(i)) {
          cost++;
        }
      }
      cout << cost << endl;
    }

  } else {
    for (int i = 0; i < (len1 - len2); i++) {
      cost = 0;
      for (int j = i; j < (i + len2); j++) {
        if (given.at(j - i) != compare2.at(j)) {
          cost++;
        }
      }
      if (mincost >= cost) {
        mincost = cost;
      }
    }
    cout << mincost << endl;
  }
  return 0;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 3) >= this->size() (which is 3)


Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
  string compare2;
  string given;

  cin >> compare2;
  cin >> given;

  int len1 = compare2.size();
  int len2 = given.size();

  int cost = len2;
  int mincost = INT_MAX;

  for (int i = 1; i <= (len1 - len2); i++) {
    for (int j = i; j <= (i + len2); j++) {
      if (given.at(j - 1) == compare2.at(j - 1)) {
        --cost;
      }
    }
    if (cost <= mincost) {
      mincost = cost;
    }
  }
  cout << mincost << endl;
  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#define rep(i, N) for (int i = 0; i < (N); i++)
using namespace std;

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  int Ans = T.size();

  rep(i, S.size() - T.size() + 1) {
    int cnt = 0;
    rep(j, T.size()) {
      if (S[i + j] != T[j])
        cnt++;
    }
    Ans = min(Ans, cnt);
  }
  cout << Ans << endl;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#define rep(i, N) for (int i = 0; i < (N); i++)
using namespace std;

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  int tsize = T.size();
  vector<int> ans(T.size());
  rep(i, tsize) {
    if (i + T.size() - 1 > S.size())
      break;
    int cnt = 0;
    string temp;
    rep(j, tsize) temp[j] = S[i + j];
    rep(j, tsize) {
      if (temp[j] != T[j])
        cnt++;
    }
    ans[i] = cnt;
  }
  int Answer = tsize;
  rep(i, ans.size()) if (ans[i] != 0) Answer = min(Answer, ans[i]);
  cout << Answer << endl;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>
#include <string.h>

int main(void) {
  char str1[1000], str2[1000];
  int i, diff = 0, ans, cnt1 = 0, cnt2 = 0;

  scanf("%s", str1);
  scanf("%s", str2);

  // str1のサイズ
  // str1[strlen(str1) + 1] = '\\0';

  // str2のサイズ
  //  str2[strlen(str2)+ 1] = '\\0';

  ans = strlen(str2); // 答えは必ず 0　～　str2の長さ

  // 全探索
  for (i = 0; i <= strlen(str1) - strlen(str2); i++) {
    diff = 0;
    for (int j = 0; j < strlen(str2); j++) {
      if (str2[j] != str1[j + i])
        diff++;
    }

    if (ans > diff)
      ans = diff;
  }

  printf("%d\\n", ans);

  return 0;
}


Error: 0

Fixed submission:

#include <stdio.h>
#include <string.h>

int main(void) {
  char str1[1000], str2[1000];
  int i, diff = 0, ans, cnt1 = 0, cnt2 = 0;

  scanf("%s", str1);
  scanf("%s", str2);

  // str1のサイズ
  for (i = 0; str1[i] != '\\0'; i++)
    cnt1++;
  str1[cnt1 + 1] = '\\0';

  // str2のサイズ
  for (i = 0; str2[i] != '\\0'; i++)
    cnt2++;
  str2[cnt2 + 1] = '\\0';

  ans = cnt2; // 答えは必ず 0　～　str2の長さ

  // 全探索
  for (i = 0; i <= cnt1 - cnt2; i++) {
    diff = 0;
    for (int j = 0; j < cnt2; j++) {
      if (str2[j] != str1[j + i])
        diff++;
    }

    if (ans > diff)
      ans = diff;
  }

  printf("%d\\n", ans);

  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  string S, T;
  cin >> S >> T;
  int maxmatch = 0;
  for (int i = 0; i < S.size() - T.size() + 1; i++) {
    int match = 0;
    for (int j = 0; j < T.size(); j++) {
      if (S.at(i + j) == T.at(j))
        match++;
    }
    if (maxmatch < match)
      maxmatch = match;
  }
  cout << T.size() - maxmatch << endl;
  return 0;
}

Error: -6
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::at: __n (which is 3) >= this->size() (which is 3)


Fixed submission:

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

int main() {
  string S, T;
  cin >> S >> T;
  int maxmatch = 0;
  for (int i = 0; i < S.size() - T.size(); i++) {
    int match = 0;
    for (int j = 0; j < T.size() + 1; j++) {
      if (S.at(i + j) == T.at(j))
        match++;
    }
    if (maxmatch < match)
      maxmatch = match;
  }
  cout << T.size() - maxmatch << endl;
  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

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

void solve() {

  string s;
  cin >> s;
  string t;
  cin >> t;
  int mini = INT_MAX;

  int sl = s.length() - 1;
  int tl = t.length() - 1;
  for (int i = 0; i <= sl - tl; i++) {
    int ans = 0;
    for (int j = 0; j <= tl; j++) {
      if (s[i + j] != t[j])
        ans++;
    }
    mini = min(ans, mini);
  }
  cout << mini;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);

#endif

  int t;
  t = 1;
  while (t--)
    solve();

  return 0;
}


Error: TLE

Fixed submission:

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

void solve() {

  string s;
  cin >> s;
  string t;
  cin >> t;
  int mini = INT_MAX;
  for (int i = 0; i <= s.length() - 1 - t.length(); i++) {
    int ans = 0;
    for (int j = 0; j < t.length(); j++) {
      if (s[i + j] != t[j])
        ans++;
    }
    mini = min(ans, mini);
  }
  cout << mini;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE
  freopen("in.txt", "r", stdin);

#endif

  int t;
  t = 1;
  while (t--)
    solve();

  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define FAST_IO                                                                \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define int long long int
#define nl "\\n"
using namespace std;

void code() {
  string s, t;
  cin >> s >> t;
  int maxm = INT_MIN;
  for (int i = 0; i <= ((int)s.size() - (int)t.size()); i++) {
    int count = 0;
    for (int j = i; j < i + (int)t.size(); j++) {
      if (s[j] == t[j - i])
        count++;
    }
    maxm = max(maxm, count);
  }
  cout << (int)t.size() - maxm;
}
signed main()

{

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

  FAST_IO;
  int t = 1;

  // cin>>t;

  while (t--) {
    code();
  }

#ifndef ONLINE_JUDGE
  cout << "\\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\\n";
#endif

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define FAST_IO                                                                \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);                                                                  \\
  cout.tie(0)
#define int long long int
#define nl "\\n"
using namespace std;

void code() {
  string s, t;
  cin >> s >> t;
  int maxm = INT_MIN;
  for (int i = 0; i <= ((int)s.size() - (int)t.size()); i++) {
    int count = 0;
    for (int j = i; j < (int)t.size(); i++) {
      if (s[j] == t[j - i])
        count++;
    }
    maxm = max(maxm, count);
  }
  cout << (int)t.size() - maxm;
}
signed main()

{

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

  FAST_IO;
  int t = 1;

  // cin>>t;

  while (t--) {
    code();
  }

#ifndef ONLINE_JUDGE
  cout << "\\nTime Elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " sec\\n";
#endif

  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
int main() {
  string S, T;
  cin >> S >> T;
  ll nS = S.size();
  ll nT = T.size();
  ll sameTS = 0;

  for (ll i = 0; i <= nS - nT; i++) {
    ll sam = 0;
    for (ll j = 0; j < nT; j++) {
      if (S[i + j] == T[j])
        sam++;
    }
    if (sameTS < sam)
      sameTS = sam;
  }

  cout << nT - sameTS;

  cin >> S;

  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)
int main() {
  string S, T;
  cin >> S >> T;
  ll nS = S.size();
  ll nT = T.size();
  ll sameTS = 0;

  rep(i, i <= nS - nT) {
    ll j = 0;
    while (S[i + j] == T[j] && j < nT)
      j++;
    if (sameTS < j)
      sameTS = j;
  }

  cout << nT - sameTS;

  cin >> S;

  return 0;
}
Problem p02571 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <string>
using namespace std;

int main(void) {
  string s, t;
  cin >> s >> t;

  int cost = -1;
  for (int i = 0; i < s.length() - t.length() + 1; i++) {
    int cnt = 0;
    for (int j = 0; j < t.length(); j++) {
      if (s[i + j] != t[j])
        cnt++;
    }
    if (cost > cnt || cost == -1) {
      cost = cnt;
    }
  }

  cout << cost << '\\n';

  return 0;
}

Error: 0

Fixed submission:

#include <iostream>
#include <string>
using namespace std;

int main(void) {
  string s, t;
  cin >> s >> t;

  int cost = -1;
  for (int i = 0; i < s.length() - t.length() - 1; i++) {
    int cnt = 0;
    for (int j = 0; j < t.length(); j++) {
      if (s[i + j] != t[j])
        cnt++;
    }
    if (cost > cnt || cost == -1) {
      cost = cnt;
    }
  }

  cout << cost << '\\n';

  return 0;
}