alexjercan/bugnet huggingface dataset:
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  int ans = 0;
  rep(i, n) cin >> s[i];

  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  cout << s.size() << endl;

  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  int n;
  cin >> n;
  vector<string> s;
  int ans = 0;
  rep(i, n) {
    string tmp;
    cin >> tmp;
    auto result = find(s.begin(), s.end(), tmp);
    if (result == s.end()) {
      // not found
      ans += 1;
      s.push_back(tmp);
    }
  }

  cout << ans << endl;

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

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

int main() {
  int N;
  cin >> N;
  string S[N];
  for (int i = 0; i < N; i++) {
    cin >> S[i];
  }
  sort(S, S + N);
  int ans = 1;
  for (int i = 1; i < N; i++) {
    if (S[i - 1] != S[i])
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  string S[210000];
  cin >> N;
  int ans = N;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    for (int j = 0; j < i; j++) {
      if (S[i] == S[j]) {
        ans--;
      }
    }
  }
  if (ans <= 0)
    ans = 1;
  cout << ans << endl;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  for (size_t i = 0; i < n; i++) {
    cin >> s.at(i);
  }
  sort(s.begin(), s.end());
  int ans = 1;
  for (size_t i = 0; i < n - 1; i++) {
    if (s.at(i) != s.at(i + 1)) {
      ans++;
    }
  }

  cout << ans << endl;
}

Error: TLE

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> s(1);
  cin >> s.at(0);
  string ss;
  for (size_t i = 0; i < n - 1; i++) {
    cin >> ss;

    if (binary_search(s.begin(), s.end(), ss) == 0) {
      s.push_back(ss);
      sort(s.begin(), s.end());
    }
  }
  cout << s.size() << endl;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n, count = 0;
  cin >> n;
  vector<string> s;
  s.clear();
  string str;
  for (int i = 0; i < n; i++) {
    cin >> str;
    s.push_back(str);
  }
  sort(s.begin(), s.end());
  s.erase(unique(s.begin(), s.end()), s.end());

  cout << s.size() << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>

using namespace std;

int main() {
  int n, count = 0;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (s[i] != "err") {
        if (s[i] == s[j])
          s[j] = "err";
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i] != "err")
      count++;
  }
  cout << count << endl;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#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>;

const ll INF = 1e18;
const int MX = 2005;

int main() {
  int n;
  cin >> n;
  set<string> st;
  rep(i, n) {
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
  return 0;
}

Error: TLE

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>;

const ll INF = 1e18;
const int MX = 2005;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  vector<string> ans(1, " ");
  int sum = 0;
  rep(i, n) cin >> s[i];
  rep(i, n) {
    rep(j, ans.size()) {
      if (ans[j] == s[i]) {
        break;
      } else if (j == ans.size() - 1) {
        ans.push_back(s[i]);
        sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  int count = 1;
  int flag = 0;
  int index = 0;
  string f;
  cin >> n;
  vector<string> memo(n, "");

  for (int i = 0; i < n; i++) {
    cin >> memo[i];
  }

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

  for (int i = 1; i < n; i++) {
    if (memo[i] != memo[i - 1]) {
      count += 1;
    }
  }

  cout << count;
}


Error: TLE

Fixed submission:

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

int main() {
  int n;
  int count = 0;
  int flag = 0;
  int index = 0;
  string f;
  cin >> n;
  vector<string> memo(n, "");

  for (int i = 0; i < n; i++) {
    flag = 0;
    cin >> f;
    for (int j = 0; j < i; j++) {
      // cout<<j<<endl;
      if (f == memo[j]) {
        flag = 1;
        break;
      }
      if (memo[j] == "") {
        break;
      }
    }
    if (flag == 0) {
      count = count + 1;
      memo[index] = f;
      index = index + 1;
    }
  }
  for (int i = 0; i < n; i++) {
    // cout<<memo[i]<<endl;
  }
  cout << count;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < (n); ++i)
#define ALL(n) begin(n), end(n)
using ll = long long;
const ll INF = 1e18;
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;
}

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  REP(i, 0, N) cin >> S[i];

  // vector<string> data(N);
  // int data_num = 0;
  // int same_cnt = 0;
  // REP(i, 0, N){
  //     if (data_num == 0){
  //         data[0] = S[i];
  //         ++data_num;
  //     } else{
  //         REP(j, 0, data_num){
  //             if (S[i] == data[j]){
  //                 ++same_cnt;
  //                 break;
  //             }
  //         }
  //         if (same_cnt == 0){
  //             data[data_num] = S[i];
  //             ++data_num;
  //         }
  //         same_cnt = 0;
  //     }
  // }
  // cout << data_num << endl;

  set<string> st;
  REP(i, 0, N) { st.insert(S[i]); }
  cout << st.size() << endl;

  return 0;
}


Error: TLE

Fixed submission:

#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, s, n) for (int i = s; i < (n); ++i)
#define ALL(n) begin(n), end(n)
using ll = long long;
const ll INF = 1e18;
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;
}

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  REP(i, 0, N) cin >> S[i];

  vector<string> data(N);
  int data_num = 0;
  int same_cnt = 0;
  REP(i, 0, N) {
    if (data_num == 0) {
      data[0] = S[i];
      ++data_num;
    } else {
      REP(j, 0, data_num) {
        if (S[i] == data[j]) {
          ++same_cnt;
          break;
        }
      }
      if (same_cnt == 0) {
        data[data_num] = S[i];
        ++data_num;
      }
      same_cnt = 0;
    }
  }
  cout << data_num << endl;

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

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

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

  vector<string> s(n);
  for (int i = 0; i < n; i++)
    cin >> s[i];

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

  int ans = 0;
  int tmpCnt;
  for (int i = 0; i < n; i += tmpCnt) {

    int endIndex = -1;
    tmpCnt = 1;
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) {
        tmpCnt++;
      } else {
        endIndex = j;
        break;
      }
    }

    if (i == 0 && tmpCnt == 1 && endIndex == -1) {
      ans = n;
      break;
    } else if (i != n - 1 && tmpCnt == 1 && endIndex == -1) {
      break;
    } else {
      ans++;
    }
  }

  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

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

  vector<string> s(n);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

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

  int ans = 0;
  int tmpCnt;
  for (int i = 0; i < n; i += tmpCnt) {

    tmpCnt = 1;
    for (int j = i + 1; j < n; j++) {
      if (s[i] == s[j]) {
        tmpCnt++;
      } else {
      }
    }

    ans++;
  }

  cout << ans << endl;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int n;
  cin >> n;
  vector<string> data(n);
  for (int i = 0; i < n; i++) {
    cin >> data.at(i);
  }
  sort(data.begin(), data.end());

  vector<string> vec;
  vec.push_back(data.at(0));
  for (int i = 0; i < n - 1; i++) {
    if (data.at(i) != data.at(i + 1)) {
      vec.push_back(data.at(i + 1));
    }
  }
  cout << vec.size() << endl;
}


Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<string> s(N);
  vector<string> t;
  int counter = 1;

  cin >> s.at(0);
  t.push_back(s.at(0));
  for (int i = 1; i < N; i++) {
    cin >> s.at(i);
    for (int j = 0; j < t.size(); j++) {
      if (s.at(i) == t.at(j))
        break;
      else if (j == t.size() - 1) {

        counter++;
        t.push_back(s.at(i));
      }
    }
  }
  cout << counter << endl;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  vector<string> prise(N);
  for (int i = 0; i < N; i++) {
    cin >> prise.at(i);
  }
  int minus = 0;
  sort(prise.begin(), prise.end());
  for (int i = 1; i < N; i++) {
    if (prise.at(i - 1) == prise.at(i)) {
      minus++;
    }
  }
  cout << N - minus << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<string> prise(N);
  for (int i = 0; i < N; i++) {
    cin >> prise.at(i);
  }
  int minus = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      if (prise.at(i) == prise.at(j)) {
        prise.at(j) = j;
        minus++;
      }
    }
  }
  cout << N - minus << endl;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  ll n;
  cin >> n;
  vector<string> s(n);
  vector<string> list(n);
  unordered_set<string> list1;
  map<string, ll> mp;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    mp[s[i]] += 1;
  }

  cout << mp.size() << endl;
  return 0;
}


Error: TLE

Fixed submission:

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

bool kensaku(unordered_set<string> l, string t) {
  for (auto tmp : l) {
    if (tmp == t)
      return false;
  }
  return true;
}
int main() {
  ll n;
  cin >> n;
  vector<string> s(n);
  vector<string> list(n);
  unordered_set<string> list1;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

  ll count = 0;
  for (int i = 0; i < n; i++) {
    if (kensaku(list1, s[i])) {
      count++;
      list1.insert(s[i]);
    }
  }
  cout << count << endl;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<string> vec(N);

  string s;
  for (int i = 0; i < N; i++) {
    cin >> s;

    vec.at(i) = s;
  }

  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());

  cout << vec.size() << endl;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<string> res = {};

  string s;
  for (int i = 0; i < N; i++) {
    cin >> s;
    int t = 0;
    for (int j = 0; j < res.size(); j++) {
      if (s == res.at(j)) {
        t = 1;
      }
    }

    if (t == 0) {
      res.push_back(s);
    }
  }

  cout << res.size() << endl;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  S.erase(unique(S.begin(), S.end()), S.end());
  int sz;
  sz = S.size();
  cout << sz << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for (int i = 0; i < N; i++) {
    cin >> S.at(i);
  }
  int conf = 0;
  int freebie = N;

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

  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if (S.at(i) == S.at(j)) {
        conf++;
      }
    }
    if (conf > 1) {
      freebie--;
    }
    conf = 0;
  }

  cout << freebie << endl;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main(int argc, char *argv[]) {
  // TLE
  //   int n; cin >> n;
  //   vector<string> v(n);
  //   int cnt=0;
  //
  //   for(int i=0; i<n; ++i)
  //   {
  //     string tmp; cin >> tmp;
  //     bool ch=true;
  //     for(string x: v)
  //     {
  //       if(x==tmp)
  //       {
  //         ch = false;
  //         break;
  //       }
  //     }
  //     if(ch)
  //     {
  //       cnt++;
  //       v.push_back(tmp);
  //     }
  //   }
  //
  //   cout << cnt << endl;

  int n;
  cin >> n;
  set<string> s;
  for (int i = 0; i < n; ++i) {
    string tmp;
    cin >> tmp;
    s.insert(tmp);
  }
  cout << s.size() << endl;

  return 0;
}


Error: TLE

Fixed submission:

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

int main(int argc, char *argv[]) {
  int n;
  cin >> n;
  vector<string> v(n);
  int cnt = 0;

  for (int i = 0; i < n; ++i) {
    string tmp;
    cin >> tmp;
    bool ch = true;
    for (string x : v) {
      if (x == tmp) {
        ch = false;
        break;
      }
    }
    if (ch) {
      cnt++;
      v.push_back(tmp);
    }
  }

  cout << cnt << endl;

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

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

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

  vector<string> s(n);

  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }

  sort(s.begin(), s.end(), greater<string>());

  int num = 1;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] != s[i + 1]) {
      num++;
    }
  }

  cout << num << endl;

  return 0;
}


Error: TLE

Fixed submission:

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

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

  vector<string> s;

  int num = 1;

  string tmp;
  cin >> tmp;
  s.push_back(tmp);

  bool f = 0;
  for (int i = 1; i < n; i++) {
    cin >> tmp;
    f = 1;
    for (int j = 0; j < s.size(); j++) {
      if (tmp == s[j]) {
        f = 0;
        break;
      }
    }

    if (f) {
      s.push_back(tmp);
      num++;
    }
  }

  cout << num << endl;

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

#include <bits/stdc++.h>
#define rep(x, to) for (int(x) = 0; (x) < (to); (x)++)
#define rep2(x, fr, to) for (int(x) = (fr); (x) < (to); (x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll N;
  cin >> N;
  map<string, int> list;
  ll ans = 0;
  rep(i, N) {
    string temp;
    cin >> temp;
    list[temp] = 1;
  }
  cout << sz(list) << '\\n';
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define rep(x, to) for (int(x) = 0; (x) < (to); (x)++)
#define rep2(x, fr, to) for (int(x) = (fr); (x) < (to); (x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  ll N;
  cin >> N;
  vector<string> vec(N);
  ll ans = 0;
  rep(i, N) {
    ans++;
    cin >> vec[i];
    rep(j, i) {
      if (vec[j] == vec[i]) {
        ans--;
        break;
      }
    }
  }
  cout << ans << '\\n';
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>

using namespace std;

int main() {
  int n;
  vector<string> v;
  string s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  cout << v.size() << endl;
  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n;
  vector<string> v;
  string s;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (find(begin(v), end(v), s) != end(v)) {
      continue;
    }
    v.push_back(s);
  }
  cout << v.size() << endl;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  long n;
  cin >> n;
  string s;
  vector<string> vec;
  for (long i = 0; i < n; i++) {
    cin >> s;
    vec.push_back(s);
  }
  std::sort(vec.begin(), vec.end());
  vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
  cout << vec.size() << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  long n, leng = 0;
  cin >> n;
  string s[n], list[n];
  bool itti = false;
  for (long i = 0; i < n; i++) {
    cin >> s[i];
    for (long j = 0; j < leng; j++) {
      if (s[i] == list[j]) {
        itti = true;
        break;
      }
    }
    if (itti == false) {
      list[leng++] = s[i];
    }
    itti = false;
  }
  cout << leng << endl;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

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

/* */

int main() {

  // 入力スタンダード（複数指定）
  int n;
  cin >> n;
  vector<string> a;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    a.push_back(s);
  }
  sort(a.begin(), a.end());

  int keihin = 1;
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      keihin++;
    }
  }

  cout << keihin << endl;

  return 0;
}

Error: TLE

Fixed submission:

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

/* */

int main() {

  // 入力スタンダード（複数指定）
  int n;
  cin >> n;
  string a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  vector<string> b;

  int keihin = 1;
  b.push_back(a[0]);
  bool flag;
  for (int i = 1; i < n; i++) {
    flag = true;
    for (int j = 0; j < b.size(); j++) {
      if (b[j] == a[i]) {
        flag = false;
        break;
      }
    }
    if (flag) {
      b.push_back(a[i]);
    }
  }

  cout << b.size() << endl;

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

#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  set<string> t;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    t.insert(s[i]);
  }
  cout << t.size();
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  vector<string> t(n);
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    bool f = true;
    for (int j = 0; j < cnt; j++) {
      if (s[i] == t[j]) {
        f = false;
        break;
      }
    }
    if (f == true) {
      t[cnt] = s[i];
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
Problem p02701 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void func_A() {

  int s, w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe";
  else
    cout << "safe";
}

void func_B() {

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  while (a > 0) {
    c -= b;
    if (c <= 0)
      break;
    a -= d;
  }

  if (c <= 0)
    cout << "Yes";
  else
    cout << "No";
}

void func_C() {

  // 2重ループで実行時間超過

  int n;
  cin >> n;

  unsigned long long count = 0;
  string temp;
  cin >> temp;
  vector<string> str;
  str.push_back(temp);
  ++count;
  for (int i = 0; i < n - 1; ++i) {
    string temp;
    cin >> temp;

    for (int j = 0; j < str.size(); ++j) {
      if (str[j] == temp)
        break;
      if (j == str.size() - 1) {
        str.push_back(temp);
        ++count;
      }
    }
  }

  cout << count;
}

void func_Cfix() {

  int n;
  cin >> n;

  vector<string> str(n);

  int count = 0;
  string check = "";
  for (int i = 0; i < n; ++i) {
    cin >> str[i];
    string temp = " " + str[i] + " ";
    if (check.find(temp) != string::npos)
      continue;
    check += temp;
    ++count;
  }

  cout << count;
}

void func_Cfix2() {

  int n;
  cin >> n;

  vector<string> str(n);
  for (int i = 0; i < n; ++i)
    cin >> str[i];

  sort(str.begin(), str.end());
  int count = 1;
  for (int i = 1; i < n; ++i) {
    if (str[i - 1] != str[i])
      ++count;
  }

  cout << count;
}

void func_D() {}

int main() {

  // func_A();
  // func_B();
  // func_C();
  // func_Cfix();
  func_Cfix2();
  // func_D();

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <string>
#include <vector>

using namespace std;

void func_A() {

  int s, w;
  cin >> s >> w;
  if (w >= s)
    cout << "unsafe";
  else
    cout << "safe";
}

void func_B() {

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  while (a > 0) {
    c -= b;
    if (c <= 0)
      break;
    a -= d;
  }

  if (c <= 0)
    cout << "Yes";
  else
    cout << "No";
}

void func_C() {

  // 2重ループで実行時間超過

  int n;
  cin >> n;

  unsigned long long count = 0;
  string temp;
  cin >> temp;
  vector<string> str;
  str.push_back(temp);
  ++count;
  for (int i = 0; i < n - 1; ++i) {
    string temp;
    cin >> temp;

    for (int j = 0; j < str.size(); ++j) {
      if (str[j] == temp)
        break;
      if (j == str.size() - 1) {
        str.push_back(temp);
        ++count;
      }
    }
  }

  cout << count;
}

void func_Cfix() {

  int n;
  cin >> n;

  vector<string> str(n);

  int count = 0;
  string check = "";
  for (int i = 0; i < n; ++i) {
    cin >> str[i];
    string temp = " " + str[i] + " ";
    if (check.find(temp) != string::npos)
      continue;
    check += temp;
    ++count;
  }

  cout << count;
}

void func_Cfix2() {

  int n;
  cin >> n;

  string str;
}

void func_D() {}

int main() {

  // func_A();
  // func_B();
  // func_C();
  func_Cfix();
  // func_Cfix2();
  // func_D();

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

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

int main() {
  ll n;
  cin >> n;
  vector<string> v(n);
  for (ll i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  ll ans = 1;
  for (ll i = 1; i < n; i++) {
    if (v[i] != v[i - 1])
      ans++;
  }
  cout << ans << endl;

  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  ll n;
  cin >> n;
  vector<string> v(n);
  for (ll i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    if (v[i] != v[i - 1])
      ans++;
  }
  cout << ans << endl;

  return 0;
}