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

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

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

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

  int ans = 0;
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j < n - 1; j++) {
      if (l[i] == l[j]) {
        continue;
      }
      for (int k = j + 1; k < n; k++) {
        if (l[j] == l[k]) {
          continue;
        }
        if (l[i] + l[j] > l[k]) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}


Error: TLE

Fixed submission:

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

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

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

  long long ans = 0;
  for (int i = 0; i < l.size() - 2; i++) {
    for (int j = i + 1; j < l.size() - 1; j++) {
      if (l[i] == l[j]) {
        continue;
      }
      for (int k = j + 1; k < l.size(); k++) {
        if (l[j] == l[k]) {
          continue;
        }
        if (l[i] + l[j] > l[k]) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}
Problem p02583 (C++) — buggy submission, verdict: Runtime Error

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

int check(int a, int b, int c) {

  if (a == b || b == c || c == a)
    return 0;

  if (a + b <= c || b + c <= a || c + a <= b)
    return 0;

  return 1;
}

int main() {

  int N, i, j, k;
  cin >> N;

  vector<int> L(N);
  for (i = 0; i < N; i++) {
    cin >> L[i];
  }

  int ans = 0;
  int flag;
  int a, b, c;
  for (i = 0; i < N - 2; i++) {
    a = L[i];
    for (j = i + 1; j < N - 1; j++) {
      b = L[j];
      for (k = j + 1; k < N; k++) {
        c = L[k];

        flag = check(a, b, c);
        if (flag == 1)
          ans += 1;
      }
    }
  }

  cout << ans << endl;
}


Error: WA

Fixed submission:

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

int check(int a, int b, int c) {

  if (a == b || b == c || c == a)
    return 0;

  if (a + b <= c || b + c <= a || c + a <= b)
    return 0;

  return 1;
}

int main() {

  int N, i, j, k;
  vector<int> L(N);

  cin >> N;
  for (i = 0; i < N; i++) {
    cin >> L[i];
  }

  int ans;
  int flag;
  int a, b, c;
  for (i = 0; i < N - 2; i++) {
    a = L[i];
    for (j = i + 1; j < N - 1; j++) {
      b = L[j];
      for (k = j + 1; k < N; k++) {
        c = L[k];

        flag = check(a, b, c);
        if (flag == 1)
          ans += 1;
      }
    }
  }

  cout << ans << endl;
}
Problem p02583 (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;

int main() {
  int N;
  int count = 0;
  cin >> N;
  vector<int> L(N, 0);
  rep(i, N) { cin >> L[i]; }
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      for (int k = j; k < N; ++k) {
        if ((L[k] < L[i] + L[j]) && (L[i] < L[k] + L[j]) &&
            (L[j] < L[i] + L[k])) {
          if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) {
          } else {
            count++;
          }
        }
      }
    }
  }
  cout << count << endl;
  return 0;
}

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


Fixed submission:

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

int main() {
  int N;
  string LLL;
  int count = 0;
  cin >> N;
  cin >> LLL;
  vector<int> L(N, 0);
  rep(i, N) { L[i] = LLL.at(i) - '0'; }
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      for (int k = j; k < N; ++k) {
        if ((L[k] < L[i] + L[j]) && (L[i] < L[k] + L[j]) &&
            (L[j] < L[i] + L[k])) {
          if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) {
          } else {
            count++;
          }
        }
      }
    }
  }
  cout << count;
  return 0;
}
Problem p02583 (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() {
  int n, cnt = 0;
  ll tmp;
  vector<ll> l(n);
  cin >> n;
  rep(i, n) {
    cin >> tmp;
    l.push_back(tmp);
  }
  for (int i = 0; i < n - 2; i++) {
    for (int j = i + 1; j - 1 < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if ((l[i] < l[j] + l[k]) && (l[j] < l[i] + l[k]) &&
            (l[k] < l[j] + l[i]) && (l[i] != l[j]) && (l[i] != l[k]) &&
            (l[j] != l[k])) {
          cnt++;
          // cout << l[i] << l[j] << l[k] << endl;
        }
      }
    }
  }

  cout << cnt << endl;

  return 0;
}

Error: WA

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() {
  int n, cnt = 0;
  int tmp;
  vector<int> l(n);
  cin >> n;
  rep(i, n) {
    cin >> tmp;
    l.push_back(tmp);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if ((l[i] < l[j] + l[k]) && (l[j] < l[i] + l[k]) &&
            (l[k] < l[j] + l[i]) && (l[i] != l[j]) && (l[i] != l[k]) &&
            (l[j] != l[k])) {
          cnt++;
          // cout << l[i] << l[j] << l[k] << endl;
        }
      }
    }
  }

  cout << cnt << endl;

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

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; ++i)
    cin >> vec[i];
  sort(vec.begin(), vec.end());

  int ans = 0;

  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < i; ++j) {
      for (int k = 0; k < j; ++k) {
        if (vec[k] != vec[j] and vec[i] != vec[j] and
            vec[k] + vec[j] > vec[i]) {
          ans++;
        }
      }
    }
  }

  cout << ans << endl;

  return 0;
}

Error: WA

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() {
  int n, cnt = 0;
  int tmp;
  vector<int> l(n);
  cin >> n;
  rep(i, n) {
    cin >> tmp;
    l.push_back(tmp);
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (l[i] != l[j] && l[i] != l[k] && l[j] != l[k]) {
          int a[] = {l[i], l[j], l[k]};
          sort(a, a + 3);
          if (a[0] + a[1] > a[2])
            cnt++;
          // cout << l[i] << l[j] << l[k] << endl;
        }
      }
    }
  }

  cout << cnt << endl;

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

#include <bits/stdc++.h>

#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define mi map<int, int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl '\\n'
#define rep(i, a, b) for (i = a; i < b; i++)
#define inf INT_MAX

template <typename T, typename U> static inline void amin(T &x, U y) {
  if (y < x)
    x = y;
}
template <typename T, typename U> static inline void amax(T &x, U y) {
  if (x < y)
    x = y;
}

using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n], i, j, k, ans = 0;
  rep(i, 0, n) cin >> a[i];
  sort(a, a + n);
  rep(i, 0, n) {
    rep(j, i + 1, n) {
      rep(k, j + 1, n) {
        if (a[i] != a[j] && a[j] != a[k]) {
          vi v(3);
          v[0] = a[i];
          v[1] = a[j];
          v[2] = a[k];
          sort(all(v));
          if (v[0] + v[1] > v[2])
            ans++;
        }
      }
    }
  }
  cout << ans;
  // for(auto i:v)cout<<i.F<<" "<<i.S.F<<" "<<i.S.S<<endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  int t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>

#define ll long long int
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vii vector<pair<int, int>>
#define mi map<int, int>
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define sz(x) (int)x.size()
#define endl '\\n'
#define rep(i, a, b) for (i = a; i < b; i++)
#define inf INT_MAX

template <typename T, typename U> static inline void amin(T &x, U y) {
  if (y < x)
    x = y;
}
template <typename T, typename U> static inline void amax(T &x, U y) {
  if (x < y)
    x = y;
}

using namespace std;
void solve() {
  int n;
  cin >> n;
  int a[n], i, j, k;
  rep(i, 0, n) cin >> a[i];
  vector<pair<int, pii>> v;
  rep(i, 0, n) {
    rep(j, i + 1, n) {
      rep(k, j + 1, n) {
        if (a[i] + a[j] > a[k] && a[j] + a[k] > a[i] && a[i] + a[k] > a[j] &&
            a[i] != a[j] && a[j] != a[k] && a[k] != a[i]) {
          pair<int, pii> p(mp(i + 1, mp(j + 1, k + 1)));
          if (find(all(v), p) == v.end())
            v.pb(mp(i + 1, mp(j + 1, k + 1)));
        }
      }
    }
  }
  cout << sz(v);
  // for(auto i:v)cout<<i.F<<" "<<i.S.F<<" "<<i.S.S<<endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  int t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
  return 0;
}
Problem p02583 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <stdio.h>

int main() {
  int N;
  scanf("%d", &N);
  int L[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &L[i]);
  }
  int counter = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = j + 1; k < N; k++) {
        if (L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) {
          if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
            counter++;
          }
        }
      }
    }
  }
  printf("%d", counter);

  return 0;
}

Error: TLE

Fixed submission:

#include <stdio.h>
#include <string.h>
#define ll long long int

int main() {
  int n, cek = 0;
  scanf("%d", &n);
  ll num[n];
  for (int i = 0; i < n; i) {
    scanf("%d", &num[i]);
  }
  if (n < 3) {
    printf("0\\n");
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if ((num[i] != num[j]) && (num[j] != num[k]) && (num[k] != num[i])) {
          if ((num[i] + num[j] > num[k]) && (num[j] + num[k] > num[i]) &&
              (num[k] + num[i] > num[j])) {
            cek++;
          }
        }
      }
    }
  }
  printf("%d\\n", cek);

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

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

int main() {

  int N;
  cin >> N;
  vector<ull> L(N);
  for (int i = 0; i < N; i++)
    cin >> L.at(i);

  ull a = 0, b = 0, c = 0, cnt = 0;
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      for (int k = j + 1; k < N; k++) {
        a = L.at(i);
        b = L.at(j);
        c = L.at(k);

        if ((a + b > c) && (b + c > a) && (c + a > b) && (L.at(i) != L.at(j)) &&
            (L.at(j) != L.at(k)) && (L.at(k) != L.at(i))) {
          //                    cerr << i+1 << " " << j+1 << " " << k+1 << endl;
          //                    cerr << L.at(i) << " " << L.at(j) << " " <<
          //                    L.at(k) << endl; cerr << a << " " << b << " " <<
          //                    c << endl;
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {

  int N;
  cin >> N;
  vector<ull> L(N);
  for (int i = 0; i < N; i++)
    cin >> L.at(i);

  ull a = 0, b = 0, c = 0, cnt = 0;
  for (int i = 0; i < N - 2; i++) {
    for (int j = i + 1; j < N - 1; j++) {
      for (int k = j + 1; k < N; k++) {
        a = L.at(i);
        b = L.at(j);
        c = L.at(k);

        if ((a + b > c) && (b + c > a) && (c + a > b) && (L.at(i) != L.at(j)) &&
            (L.at(j) != L.at(k)) && (L.at(k) != L.at(i))) {
          cerr << i + 1 << " " << j + 1 << " " << k + 1 << endl;
          cerr << L.at(i) << " " << L.at(j) << " " << L.at(k) << endl;
          cerr << a << " " << b << " " << c << endl;
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
Problem p02583 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  int n;
  cin >> n;
  vector<int> l(n, 0);
  rep(i, n) cin >> l[i];

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (i == j || j == k || k == i)
          continue;
        if (l[i] < l[j] + l[k] && l[j] < l[k] + l[i] && l[k] < l[j] + l[i]) {
          if (l[i] == l[j] || l[j] == l[k] || l[k] == l[i])
            continue;
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}

Error: 0

Fixed submission:

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

int main() {
  int n;
  vector<int> l(n, 0);
  cin >> n;
  rep(i, n) cin >> l[i];

  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        if (i == j || j == k || k == i)
          continue;
        if (l[i] < l[j] + l[k] && l[j] < l[k] + l[i] && l[k] < l[j] + l[i]) {
          if (l[i] == l[j] || l[j] == l[k] || l[k] == l[i])
            continue;
          ans++;
        }
      }
    }
  }
  cout << ans << endl;

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

#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\\n'
const int inf = 1e9 + 7;
const int N = 1e6 + 9;

int main() {
  ios_base::sync_with_stdio(0);
  int a, b, n;
  cin >> n;
  // set<int> st;
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    // st.insert(a);
    v.pb(a);
  }
  // for(int p: st) {
  // v.pb(p);
  // }
  sort(v.begin(), v.end());
  int cnt = 0;
  for (int i = 0; i < v.size(); ++i) {
    // cout<<v[i]<<endl;
    for (int j = i + 1; j < v.size(); ++j)
      if (v[j] != v[i]) {
        for (int k = j + 1; k < v.size(); ++k)
          if (v[k] != v[i] && v[k] != v[j]) {
            if (v[i] + v[j] > v[k]) {
              // cerr<<v[i]<<" "<<v[j]<<" "<<v[k]<<endl;
              // cerr<<" "<<i+1<<" "<<j+1<<" "<<k+1<<endl;
              ++cnt;
            }
          }
      }
  }
  cout << cnt << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
#define db(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\\n'
const int inf = 1e9 + 7;
const int N = 1e6 + 9;

int main() {
  ios_base::sync_with_stdio(0);
  int a, b, n;
  cin >> n;
  // set<int> st;
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    // st.insert(a);
    v.pb(a);
  }
  // for(int p: st) {
  // v.pb(p);
  // }
  sort(v.begin(), v.end());
  int cnt = 0;
  for (int i = 0; i < v.size(); ++i) {
    // cout<<v[i]<<endl;
    for (int j = i + 1; j < v.size(); ++j)
      if (v[j] != v[i]) {
        for (int k = j + 1; k < v.size(); ++k)
          if (v[k] != v[i] && v[k] != v[j]) {
            if (v[i] + v[j] > v[k]) {
              cerr << v[i] << " " << v[j] << " " << v[k] << endl;
              cerr << " " << i + 1 << " " << j + 1 << " " << k + 1 << endl;
              ++cnt;
            }
          }
      }
  }
  cout << cnt << endl;
  return 0;
}
Problem p02583 (C++) — buggy submission, verdict: Runtime Error

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

// helpful functions
#define fl(i, n) for (int i = 0; i < n; i++)
#define fls(i, a, b) for (int i = a; i < b; i++)
#define afl(i, a, n)                                                           \\
  int a[n];                                                                    \\
  for (int i = 0; i < n; i++)                                                  \\
  scanf("%d", &ar[i])

// printers
#define iprint(x) printf("%d\\n", x)
#define lprint(x) printf("%lld\\n", x)
#define fprint(x, n) printf("%.nf\\n", x)
#define dprint(x, n) printf("%.nlf\\n", x)
#define sprint(x) printf("%s\\n", x)

// scanners
#define iscan(x) scanf("%d", &x)
#define lcan(x) scanf("%lld", &x)
#define fscan(x) scanf("%f", &x)
#define dscan(x) scanf("%lf", &x)
#define scan(x) scanf("%s", x)
#define qs(x)                                                                  \\
  int x;                                                                       \\
  scanf("%d", &x)

int main() {
  int n;
  scanf("%d", &n);
  int num[n], count[n] = {0}, u = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    int x, yes = 1;
    scanf("%d", &x);
    for (int j = 0; j < u; j++) {
      if (x == num[j]) {
        yes = 0;
        count[j]++;
        break;
      }
    }
    if (yes) {
      count[u]++;
      num[u++] = x;
    }
  }
  fls(i, 0, u) fls(j, i + 1, u) fls(k, j + 1, u) {
    if (num[i] + num[j] > num[k] && num[i] + num[k] > num[j] &&
        num[k] + num[j] > num[i])
      ans += count[i] * count[j] * count[k];
  }
  printf("%d\\n", ans);
  return 0;
}

Error: 0

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int N, L[100], ans = 0;
int main() {
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> L[i];
  }
  for (int i = 1; i <= N; i++) {
    for (int j = i + 1; j <= N; j++) {
      for (int k = j + 1; k <= N; k++) {
        if (L[i] != L[j] && L[i] != L[k] && L[j] != L[k]) {
          if (L[i] + L[j] > L[k] && L[i] + L[k] > L[j] && L[j] + L[k] > L[i]) {
            ans++;
          }
        }
      }
    }
  }
  cout << ans << endl;
}
Problem p02583 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define fastio                                                                 \\
  ios_base::sync_with_stdio(false);                                            \\
  cin.tie(NULL)
using namespace std;

int main() {
  fastio;
  long long n, i, j, k, sum = 0, high, low, mid, p;
  static long long ara[103];
  cin >> n;
  for (i = 0; i < n; i++)
    cin >> ara[i];
  sort(ara, ara + n);
  for (i = 0; i < n - 2; i++) {
    for (j = i + 1; j < n - 1; j++) {
      if (ara[i] == ara[j])
        continue;
      else {
        for (k = j + 1; k < n; k++) {
          if (ara[j] == ara[k])
            continue;
          else {
            low = k;
            high = n - 1;
            p = 0;
            while (low <= high) {
              mid = (low + high) / 2;
              if (ara[mid] >= ara[i] + ara[j] &&
                  ara[mid - 1] < ara[i] + ara[j]) {
                sum = sum + mid - k;
                p = 1;
                break;
              } else if (ara[mid] < ara[i] + ara[j])
                low = mid + 1;
              else if (ara[mid] >= ara[i] + ara[j])
                high = mid - 1;
            }
            if (p == 0)
              sum = sum + n - k;
            break;
          }
        }
      }
    }
  }
  cout << sum << endl;
  return 0;
}


Error: TLE

Fixed submission:

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

int main() {
  unsigned long long n, i, j, k, sum = 0;
  static unsigned long long ara[103];
  cin >> n;
  for (i = 0; i < n; i++)
    cin >> ara[i];
  for (i = 0; i < n - 2; i++) {
    for (j = i + 1; j < n - 1; j++) {
      if (ara[i] == ara[j])
        continue;

      for (k = j + 1; k < n; k++) {
        if (ara[i] == ara[k] || ara[j] == ara[k])
          continue;

        if (ara[i] + ara[j] > ara[k] && ara[i] + ara[k] > ara[j] &&
            ara[j] + ara[k] > ara[i])
          sum++;
      }
    }
  }
  cout << sum << endl;
  return 0;
}
Problem p02583 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  int ans = 0, frag = 0;
  vector<vector<int>> data(0, vector<int>(3));
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      for (int k = j; k < N; k++) {
        if (v.at(i) == v.at(j) || v.at(j) == v.at(k) || v.at(k) == v.at(i)) {
          continue;
        }
        if (v.at(i) + v.at(j) > v.at(k) && v.at(j) + v.at(k) > v.at(i) &&
            v.at(k) + v.at(i) > v.at(j)) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Error: TLE

Fixed submission:

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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  int ans = 0, frag = 0;
  vector<vector<int>> data(0, vector<int>(3));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < N; k++) {
        // cout << i << " " << j << " " << k << " " << endl;
        if (i == j || j == k || k == i) {
          continue;
        }
        for (int l = 0; l < data.size(); l++) {
          if (i == data.at(l).at(0)) {
            if (j == data.at(l).at(1)) {
              if (k == data.at(l).at(2)) {
                frag = 1;
                break;
              }
            }
          }
          if (i == data.at(l).at(0)) {
            if (j == data.at(l).at(2)) {
              if (k == data.at(l).at(1)) {
                frag = 1;
                break;
              }
            }
          }
          if (i == data.at(l).at(1)) {
            if (j == data.at(l).at(0)) {
              if (k == data.at(l).at(2)) {
                frag = 1;
                break;
              }
            }
          }
          if (i == data.at(l).at(1)) {
            if (j == data.at(l).at(2)) {
              if (k == data.at(l).at(0)) {
                frag = 1;
                break;
              }
            }
          }
          if (i == data.at(l).at(2)) {
            if (j == data.at(l).at(0)) {
              if (k == data.at(l).at(1)) {
                frag = 1;
                break;
              }
            }
          }
          if (i == data.at(l).at(2)) {
            if (j == data.at(l).at(1)) {
              if (k == data.at(l).at(0)) {
                frag = 1;
                break;
              }
            }
          }
        }
        if (frag == 1) {
          // cout << i << " " << j << " " << k << " " << endl;
          frag = 0;
          continue;
        }
        if (v.at(i) == v.at(j) || v.at(j) == v.at(k) || v.at(k) == v.at(i)) {
          continue;
        }
        if (v.at(i) + v.at(j) > v.at(k) && v.at(j) + v.at(k) > v.at(i) &&
            v.at(k) + v.at(i) > v.at(j)) {
          // cout << i << " " << j << " " << k << " " << endl;
          data.push_back({i, j, k});
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}