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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int MAXN = 100005;

template <typename T> inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-')
      flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}

int n, m, col[MAXN], has[MAXN];
vector<int> e[MAXN];
int siz[MAXN], sum[MAXN];
LL ans[MAXN];

inline LL C2(int x) { return 1LL * x * (x + 1) / 2; }

void DFS(int u, int fa) {
  siz[u] = 1;
  for (auto v : e[u]) {
    if (v == fa)
      continue;
    int cur = sum[col[u]];
    DFS(v, u);
    int blk = siz[v] - (sum[col[u]] - cur);
    ans[col[u]] += C2(blk);
    sum[col[u]] += blk;
    siz[u] += siz[v];
  }
  sum[col[u]] += 1;
}

void init() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(col[i]);
    has[col[i]] = 1;
  }
  for (int i = 1, u, v; i < n; ++i) {
    read(u);
    read(v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
}

void solve() {
  DFS(1, 0);
  for (int i = 1; i <= n; ++i) {
    if (i == col[1] || !has[i])
      continue;
    ans[i] += C2(n - sum[i]);
  }
  for (int i = 1; i <= n; ++i) {
    printf("%lld\n", has[i] ? C2(n) - ans[i] : 0);
  }
}

int main() {
  init();
  solve();
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
using namespace std;
typedef long long LL;
const int MAXN = 200005;

template <typename T> inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-')
      flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}

int n, m, col[MAXN], has[MAXN];
vector<int> e[MAXN];
int siz[MAXN], sum[MAXN];
LL ans[MAXN];

inline LL C2(int x) { return 1LL * x * (x + 1) / 2; }

void DFS(int u, int fa) {
  siz[u] = 1;
  for (auto v : e[u]) {
    if (v == fa)
      continue;
    int cur = sum[col[u]];
    DFS(v, u);
    int blk = siz[v] - (sum[col[u]] - cur);
    ans[col[u]] += C2(blk);
    sum[col[u]] += blk;
    siz[u] += siz[v];
  }
  sum[col[u]] += 1;
}

void init() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(col[i]);
    has[col[i]] = 1;
  }
  for (int i = 1, u, v; i < n; ++i) {
    read(u);
    read(v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
}

void solve() {
  DFS(1, 0);
  for (int i = 1; i <= n; ++i) {
    if (i == col[1] || !has[i])
      continue;
    ans[i] += C2(n - sum[i]);
  }
  for (int i = 1; i <= n; ++i) {
    printf("%lld\n", has[i] ? C2(n) - ans[i] : 0);
  }
}

int main() {
  init();
  solve();
  return 0;
}
Problem p02710 (C++)

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

#define N 200005
#define int long long

int n, c[N], num[N], ans[N], C[N];
int tot, head[2 * N], than[2 * N], to[2 * N];

inline int read() {
  int s = 0, t = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-')
    c = getchar(), t = -1;
  if (c == '-')
    c = getchar(), t = -1;
  while (c >= '0' && c <= '9')
    s = (s << 1) + (s << 3) + (c ^ 48), c = getchar();
  return s * t;
}

void add(int x, int y) {
  tot++;
  to[tot] = y;
  than[tot] = head[x];
  head[x] = tot;
}

void dfs(int now, int p = -1) {
  int tmp = C[c[now]];
  for (int i = head[now]; i; i = than[i]) {
    int t = to[i];
    if (t == p)
      continue;
    C[c[i]] = 0;
    dfs(t, now);
    num[now] += num[t];
    ans[c[now]] -= (num[t] - C[c[now]]) * (num[t] - C[c[now]] + 1) / 2;
  }
  C[c[now]] = tmp + num[now];
}

signed main(void) {
  n = read();
  for (int i = 0; i < n; i++)
    c[i] = read(), c[i]--, num[i] = 1;
  for (int i = 1; i < n; i++) {
    int x, y;
    x = read() - 1;
    y = read() - 1;
    add(x, y);
    add(y, x);
  }
  dfs(0);
  for (int i = 0; i < n; i++) {
    int f = n * (n + 1) / 2;
    int f1 = (n - C[i]) * (n - C[i] + 1) / 2;
    printf("%lld\n", ans[i] + f - f1);
  }
  //	for(int i=0;i<n;i++)
  //	printf("%d ",ans[i]);
}

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

#define N 200005
#define int long long

int n, c[N], num[N], ans[N], C[N];
int tot, head[2 * N], than[2 * N], to[2 * N];

inline int read() {
  int s = 0, t = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-')
    c = getchar(), t = -1;
  if (c == '-')
    c = getchar(), t = -1;
  while (c >= '0' && c <= '9')
    s = (s << 1) + (s << 3) + (c ^ 48), c = getchar();
  return s * t;
}

void add(int x, int y) {
  tot++;
  to[tot] = y;
  than[tot] = head[x];
  head[x] = tot;
}

void dfs(int now, int p = -1) {
  int tmp = C[c[now]];
  for (int i = head[now]; i; i = than[i]) {
    int t = to[i];
    if (t == p)
      continue;
    C[c[now]] = 0;
    dfs(t, now);
    num[now] += num[t];
    ans[c[now]] -= (num[t] - C[c[now]]) * (num[t] - C[c[now]] + 1) / 2;
  }
  C[c[now]] = tmp + num[now];
}

signed main(void) {
  n = read();
  for (int i = 0; i < n; i++)
    c[i] = read(), c[i]--, num[i] = 1;
  for (int i = 1; i < n; i++) {
    int x, y;
    x = read() - 1;
    y = read() - 1;
    add(x, y);
    add(y, x);
  }
  dfs(0);
  for (int i = 0; i < n; i++) {
    int f = n * (n + 1) / 2;
    int f1 = (n - C[i]) * (n - C[i] + 1) / 2;
    printf("%lld\n", ans[i] + f - f1);
  }
  //	for(int i=0;i<n;i++)
  //	printf("%d ",ans[i]);
}
Problem p02710 (Python)

Buggy submission (status: Runtime Error):
import sys
from collections import defaultdict

sys.setrecursionlimit(10**5 + 5)


def dfs(v, p, ccc, links, ans):
    ret_colors = defaultdict(int)
    ret_count = 1
    cv = ccc[v]
    for u in links[v]:
        if u == p:
            continue
        sub_colors, sub_count = dfs(u, v, ccc, links, ans)
        cc = sub_count - sub_colors[cv]
        ans[cv] -= cc * (cc + 1) // 2
        ret_count += sub_count

        if len(ret_colors) < len(sub_colors):
            ret_colors, sub_colors = sub_colors, ret_colors

        for c, cnt in sub_colors.items():
            ret_colors[c] += cnt

    ret_colors[cv] = ret_count

    return ret_colors, ret_count


def solve(n, ccc, links):
    if n == 1:
        return [1]

    all_pair = n * (n + 1) // 2
    ans = [all_pair] * (n + 1)

    colors, count = dfs(0, -1, ccc, links, ans)
    assert count == n

    for c in range(1, n + 1):
        cc = n - colors[c]
        ans[c] -= cc * (cc + 1) // 2

    return ans[1:]


n, *cab = map(int, sys.stdin.buffer.read().split())
ccc = cab[:n]
links = [set() for _ in range(n)]

for a, b in zip(cab[n + 0 :: 2], cab[n + 1 :: 2]):
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)

print("\n".join(map(str, solve(n, ccc, links))))


Fixed submission:
import sys
from collections import defaultdict

sys.setrecursionlimit(10**6)


def dfs(v, p, ccc, links, ans):
    ret_colors = defaultdict(int)
    ret_count = 1
    cv = ccc[v]
    for u in links[v]:
        if u == p:
            continue
        sub_colors, sub_count = dfs(u, v, ccc, links, ans)
        cc = sub_count - sub_colors[cv]
        ans[cv] -= cc * (cc + 1) // 2
        ret_count += sub_count

        if len(ret_colors) < len(sub_colors):
            ret_colors, sub_colors = sub_colors, ret_colors

        for c, cnt in sub_colors.items():
            ret_colors[c] += cnt

    ret_colors[cv] = ret_count

    return ret_colors, ret_count


def solve(n, ccc, links):
    if n == 1:
        return [1]

    all_pair = n * (n + 1) // 2
    ans = [all_pair] * (n + 1)

    colors, count = dfs(0, -1, ccc, links, ans)
    assert count == n

    for c in range(1, n + 1):
        cc = n - colors[c]
        ans[c] -= cc * (cc + 1) // 2

    return ans[1:]


n, *cab = map(int, sys.stdin.buffer.read().split())
ccc = cab[:n]
links = [set() for _ in range(n)]

for a, b in zip(cab[n + 0 :: 2], cab[n + 1 :: 2]):
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)

print("\n".join(map(str, solve(n, ccc, links))))
Problem p02711 (C++)

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

int main() {
  int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}

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

int main() {
  int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes" << endl;
      return 0;
    }
    n /= 10;
  }
  cout << "No" << endl;
}
Problem p02711 (C++)

Buggy submission (status: 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() {
  char n[2];
  cin >> n;
  if (n[0] == '7' || n[1] == '7' || n[2] == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 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() {
  char n[3];
  cin >> n;
  if (n[0] == '7' || n[1] == '7' || n[2] == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
// #include<bits/stdc++.h>

using namespace std;

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

  while (t) {
    if (t % 10 == 7) {
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}

Fixed submission:
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <time.h>
#include <vector>
typedef long long int ll;
// #include<bits/stdc++.h>

using namespace std;

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

  while (t) {
    if (t % 10 == 7) {
      cout << "Yes" << endl;
      return 0;
    }
    t /= 10;
  }

  cout << "No" << endl;

  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define in freopen("in.txt","r",stdin)
// #define out freopen("out.txt","w",stdout)
#define N 1e9 + 10;
ll n, m, i, j, k, t, l, r;
ll a, b, c, d;
char A, C, X, Y, Z;
ll ans, MAX, MIN, sum;
ll ax[2000500];
char cx[500];
ll dx[12];
ll bx[500];

int main() {
  t = 1;
  // scanf("%lld",&t);
  while (t--) {
    cin >> n;
    int flag = 0;
    while (n / 10) {
      if (n % 10 == 7) {
        flag = 1;
        break;
      }
    }
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// #define in freopen("in.txt","r",stdin)
// #define out freopen("out.txt","w",stdout)
#define N 1e9 + 10;
ll n, m, i, j, k, t, l, r;
ll a, b, c, d;
char A, C, X, Y, Z;
ll ans, MAX, MIN, sum;
ll ax[2000500];
char cx[500];
ll dx[12];
ll bx[500];

int main() {
  t = 1;
  // scanf("%lld",&t);
  while (t--) {
    cin >> n;
    int flag = 0;
    if (n % 10 == 7)
      flag = 1;
    n = n / 10;
    if (n % 10 == 7)
      flag = 1;
    n = n / 10;
    if (n % 10 == 7)
      flag = 1;
    if (flag)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
Problem p02711 (C++)

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

int main() {
  string s;
  cin >> s;
  if (s.at(1) == '7' || s.at(2) == '7' || s.at(3) == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

int main() {
  string s;
  cin >> s;
  if (s.at(0) == '7' || s.at(1) == '7' || s.at(2) == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02711 (C++)

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

int main() {
  string N;
  for (int i = 0; i < 3; i++) {
    if (N.at(i) == 7) {
      cout << "Yes" << endl;
      break;
    } else {
      cout << "No" << endl;
    }
  }
}


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

int main() {
  string N;
  cin >> N;

  if (N[0] == '7' || N[1] == '7' || N[2] == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02711 (C++)

Buggy submission (status: Runtime Error):
/*

Coded and Decoded by : Yash Kapoor

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

#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll, ll>
#define vl vector<ll>
#define sl set<ll>
#define vll vector<pll>
#define ml map<ll, ll>
#define mll map<pll, ll>
#define all(a) a.begin(), a.end()
#define x first
#define y second
#define sz(x) (ll) x.size()
#define dl '\n'
// #define why         (ll)1000000007
#define why (ll)998244353
#define lp(i, a, b) for (ll i = a; i < b; ++i)
#define lpr(i, a, b) for (ll i = a; i >= b; i--)
#define lpd(i, x) for (auto i : x)
#define ios                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
ll inf = 1e18;
ld pi = 3.141592653589;
ll mod = why;
ll fast_power(ll base, ll power, ll mod) {
  ll result = 1;
  while (power) {
    if (power % 2)
      result = (result * base) % mod;
    base = (base * base) % mod;
    power /= 2;
  }
  return result;
}

ll inverse(ll base, ll mod) { return fast_power(base, mod - 2, mod); }

ll solve() {
  string a;
  cin >> a;
  lp(i, 0, sz(a)) if (a[i] == '7') {
    cout << "Yes";
    return 0;
  }
  cout << "No";
}

int main() {
  ios ll t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
}

Fixed submission:
/*

Coded and Decoded by : Yash Kapoor

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

#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define mp make_pair
#define pll pair<ll, ll>
#define vl vector<ll>
#define sl set<ll>
#define vll vector<pll>
#define ml map<ll, ll>
#define mll map<pll, ll>
#define all(a) a.begin(), a.end()
#define x first
#define y second
#define sz(x) (ll) x.size()
#define dl '\n'
// #define why         (ll)1000000007
#define why (ll)998244353
#define lp(i, a, b) for (ll i = a; i < b; ++i)
#define lpr(i, a, b) for (ll i = a; i >= b; i--)
#define lpd(i, x) for (auto i : x)
#define ios                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
ll inf = 1e18;
ld pi = 3.141592653589;
ll mod = why;
ll fast_power(ll base, ll power, ll mod) {
  ll result = 1;
  while (power) {
    if (power % 2)
      result = (result * base) % mod;
    base = (base * base) % mod;
    power /= 2;
  }
  return result;
}

ll inverse(ll base, ll mod) { return fast_power(base, mod - 2, mod); }

ll solve() {
  string a;
  cin >> a;
  lp(i, 0, sz(a)) if (a[i] == '7') {
    cout << "Yes";
    return 0;
  }
  cout << "No";
  return 0;
}

int main() {
  ios ll t = 1;
  // cin>>t;
  while (t--) {
    solve();
  }
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <math.h>

#define PI 3.14159265358979323846264338327950L
#define ll long long

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 7) {
      cout << "Yes"
           << "\n";
      return 0;
    }
  }
  cout << "No"
       << "\n";
}


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

#define PI 3.14159265358979323846264338327950L
#define ll long long

using namespace std;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 7) {
      cout << "Yes"
           << "\n";
      return 0;
    }
    n = n / 10;
  }
  cout << "No"
       << "\n";
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
// In the name of GOD

#include <bits/stdc++.h>
#define ll long long
#define pp pair<int, int>
using namespace std;
const int N = 1e5 + 10;
string s;
int n;

void solve() {
  cin >> n;
  while (n > 0) {
    if (n % 10 == 7) {
      cout << "Yes";
      return;
    }
  }
  cout << "No";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt = 1;
  // cin >> tt;
  for (int tc = 1; tc <= tt; ++tc) {
    solve();
  }
}

Fixed submission:
// In the name of GOD

#include <bits/stdc++.h>
#define ll long long
#define pp pair<int, int>
using namespace std;
const int N = 1e5 + 10;
string s;
int n;

void solve() {
  cin >> n;
  while (n > 0) {
    if (n % 10 == 7) {
      cout << "Yes";
      return;
    }
    n /= 10;
  }
  cout << "No";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tt = 1;
  // cin >> tt;
  for (int tc = 1; tc <= tt; ++tc) {
    solve();
  }
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int ll;

const ll INF = 1000000009;

void solve() {
  int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#endif
  // int t;cin >> t;while(t--) solve();
  solve();
}


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

const ll INF = 1000000009;

void solve() {
  int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes\n";
      return;
    }
    n /= 10;
  }
  cout << "No\n";
}

int main() {
#ifndef LOCAL
  ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#endif
  // int t;cin >> t;while(t--) solve();
  solve();
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c;
  cin >> n;
  for (int i = n; i >= 0; i = i / 10) {
    if (i % 10 == 7) {
      cout << "Yes" << endl;
      c = 1;
      break;
    } else
      c = 0;
  }
  if (c == 0)
    cout << "No" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, c;
  cin >> n;
  for (int i = n; i > 0; i = i / 10) {
    if (i % 10 == 7) {
      cout << "Yes" << endl;
      c = 1;
      break;
    } else
      c = 0;
  }
  if (c == 0)
    cout << "No" << endl;
}
Problem p02711 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define Hello                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define ll long long
#define endl '\n'
int main() {
  Hello int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7)
      return cout << "Yes", 01;
    n /= 10;
  }
  cout << "No";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define Hello                                                                  \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define ll long long
#define endl '\n'
int main() {
  Hello int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7)
      return cout << "Yes", 0;
    n /= 10;
  }
  cout << "No";
  return 0;
}
Problem p02711 (Python)

Buggy submission (status: Runtime Error):
N = int(input())
str(N)
listN = sorted(N)
if listN.count("7") >= 1:
    print("Yes")
else:
    print("No")


Fixed submission:
N = int(input())
listN = sorted(str(N))
if listN.count("7") >= 1:
    print("Yes")
else:
    print("No")
Problem p02711 (Python)

Buggy submission (status: Runtime Error):
N = input()
ans = "No"
for i in range(len(N)):
    if N[i] == 7:
        global ans
        ans = "Yes"
        break
    else:
        continue
print(ans)


Fixed submission:
N = int(input())
a1 = N % 10
a2 = ((N % 100) - a1) / 10
a3 = N // 100
if a1 == 7 or a2 == 7 or a3 == 7:
    print("Yes")
else:
    print("No")
Problem p02711 (C++)

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

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

  for (i = 0; i < 3; i++) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      exit(1);
    }
  }
  cout << "No" << endl;

  return 0;
}


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

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

  for (i = 0; i < 3; i++) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}
Problem p02711 (C++)

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

using namespace std;
using ll = long long;

int n;

int solve() {
  int d_1 = n % 10;
  int d_10 = (n - d_1) % 100 / 10;
  int d_100 = (n - d_1 - d_10) % 1000 / 100;
  if (d_1 == 7 || d_10 == 7 || d_100 == 7)
    cout << "Yes";
  else
    cout << "No";
}

int main() {
  cin >> n;

  solve();

  return EXIT_SUCCESS;
}

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

using namespace std;
using ll = long long;

int n;

void solve() {
  int d_1 = n % 10;
  int d_10 = (n - d_1) % 100 / 10;
  int d_100 = (n - d_1 - d_10) % 1000 / 100;
  if (d_1 == 7 || d_10 == 7 || d_100 == 7)
    cout << "Yes";
  else
    cout << "No";
}

int main() {
  cin >> n;

  solve();

  return EXIT_SUCCESS;
}
Problem p02711 (C++)

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

#define ll long long
#define MOD 1000000007

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

  int n;
  cin >> n;
  int r;
  while (n > 0) {
    r = n % 10;
    if (r == 7) {
      break;
    }
  }
  if (n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

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

#define ll long long
#define MOD 1000000007

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

  int n;
  cin >> n;
  int r;
  while (n > 0) {
    r = n % 10;
    if (r == 7) {
      break;
    }
    n /= 10;
  }
  if (n)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  long long K, count = 0;
  cin >> K;
  while (K != 0) {
    if (K % 10 == 7) {
      cout << "Yes\n";
      return 0;
    }
    K %= 10;
  }
  cout << "No\n";
}

Fixed submission:
#include <iostream>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main(void) {
  long long K, count = 0;
  cin >> K;
  while (K != 0) {
    if (K % 10 == 7) {
      cout << "Yes\n";
      return 0;
    }
    K /= 10;
  }
  cout << "No\n";
}
Problem p02711 (Python)

Buggy submission (status: Runtime Error):
N = input()
print("Yes" if 7 in N else "No")


Fixed submission:
N = input()
print("Yes" if "7" in N else "No")
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):

// Problem : A - Lucky 7
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

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

  while (n != 0) {
    if (n % 10 == 7) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Fixed submission:

// Problem : A - Lucky 7
// Contest : AtCoder Beginner Contest 162
// URL : https://atcoder.jp/contests/abc162/tasks/abc162_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

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

  while (n != 0) {
    if (n % 10 == 7) {
      cout << "Yes" << endl;
      return 0;
    }
    n = n / 10;
  }
  cout << "No" << endl;
  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i;
  bool p = true;
  while (p) {
    if (n % 10 == 7) {
      cout << "Yes";
      p = false;
    }
    n = n / 10;
  }
  if (p)
    cout << "No";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i;
  bool p = true;
  while (p) {
    if (n % 10 == 7) {
      cout << "Yes";
      p = false;
    }
    n = n / 10;
    if (n == 0)
      break;
  }
  if (p)
    cout << "No";
  return 0;
}
Problem p02711 (C++)

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

int main() {
  string N;
  cin >> N;

  if (N.at(1) == '7' || N.at(2) == '7' || N.at(3) == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  string N;
  cin >> N;
  if (N[0] == '7' || N[1] == '7' || N[2] == '7') {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
void isN(int n) {
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes\n";
      return;
    }
  }
  cout << "No\n";
  return;
}
int main() {
  int T;
  cin >> T;
  isN(T);
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#define ll long long
using namespace std;
void isN(int n) {
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes\n";
      return;
    }
    n /= 10;
  }
  cout << "No\n";
  return;
}
int main() {
  int T;
  cin >> T;
  isN(T);
  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {

  char n[3];
  for (int i = 1; i < 4; i++) {
    cin >> n[i];
    if (n[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {

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

  a = n / 100;
  b = n / 10 - a * 10;

  c = n % 10;

  if (a == 7 || b == 7 || c == 7) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;

  return 0;
}
Problem p02711 (C++)

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

// const int N = 1000000000, MAXI = N, D = 14;

// int main() {
//     freopen("output.txt", "r", stdin);
//     freopen("input.txt", "w", stdout);
//     srand(time(nullptr));
//     int tc = 5, flag = 1;
//     cout << tc << "\n";
//     while (tc--)
//     {
//         int a = rand()%N+1;
//         a *= flag;

//         flag *= -1;

//         int b = rand()%MAXI + 1, c;

//         int d = rand()%D + 1;

//         int flag2 = rand()%3, k;

//         if(flag2==0)
//         {
//         	k = rand()%d+1;
//         	c = a + k*b;
//         }
//         else if(flag2==1)
//         {
//         	k = rand()%d + 1;
//         	c = a - k*b;
//         }
//         else
//         	c = rand()%MAXI;

//         cout << a << " " << b << " " << c << " " << d;
//         cout << "\n";
//         cout << "~\n";
//     }

//     return 0;
// }

//---------------------------------------------//

/*
#define int long long
#define mod (int)(1e9+9)
#define endl '\n'
#define MAXI (int)(3e17+10)
#define N 200005
 */

//  /* while(!cin.eof()) */

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod (int)(1e9 + 9)
#define endl '\n'
#define MAXI (int)(3e17 + 10)
#define N 200005

// Driver code to test above functions
int32_t main() {

  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);

  int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes";
      return 0;
    }
  }

  cout << "No";

  return 0;
}

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

// const int N = 1000000000, MAXI = N, D = 14;

// int main() {
//     freopen("output.txt", "r", stdin);
//     freopen("input.txt", "w", stdout);
//     srand(time(nullptr));
//     int tc = 5, flag = 1;
//     cout << tc << "\n";
//     while (tc--)
//     {
//         int a = rand()%N+1;
//         a *= flag;

//         flag *= -1;

//         int b = rand()%MAXI + 1, c;

//         int d = rand()%D + 1;

//         int flag2 = rand()%3, k;

//         if(flag2==0)
//         {
//         	k = rand()%d+1;
//         	c = a + k*b;
//         }
//         else if(flag2==1)
//         {
//         	k = rand()%d + 1;
//         	c = a - k*b;
//         }
//         else
//         	c = rand()%MAXI;

//         cout << a << " " << b << " " << c << " " << d;
//         cout << "\n";
//         cout << "~\n";
//     }

//     return 0;
// }

//---------------------------------------------//

/*
#define int long long
#define mod (int)(1e9+9)
#define endl '\n'
#define MAXI (int)(3e17+10)
#define N 200005
 */

//  /* while(!cin.eof()) */

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod (int)(1e9 + 9)
#define endl '\n'
#define MAXI (int)(3e17 + 10)
#define N 200005

// Driver code to test above functions
int32_t main() {

  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);

  int n;
  cin >> n;
  while (n) {
    if (n % 10 == 7) {
      cout << "Yes";
      return 0;
    }
    n /= 10;
  }

  cout << "No";

  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string.h>
#include <string>
#include <sys/time.h>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, string> P;
typedef tuple<int, string, string> T;
typedef complex<double> comp;
typedef vector<vector<ld>> matrix;
struct pairhash {
public:
  template <typename T, typename U>
  size_t operator()(const pair<T, U> &x) const {
    size_t seed = hash<T>()(x.first);
    return hash<U>()(x.second) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
  }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;

bool solve() {
  while (n > 0) {
    if (n % 10 == 7)
      return true;
  }
  return false;
}

void input() { cin >> n; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);

  input();
  cout << (solve() ? "Yes" : "No") << endl;
}


Fixed submission:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string.h>
#include <string>
#include <sys/time.h>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, string> P;
typedef tuple<int, string, string> T;
typedef complex<double> comp;
typedef vector<vector<ld>> matrix;
struct pairhash {
public:
  template <typename T, typename U>
  size_t operator()(const pair<T, U> &x) const {
    size_t seed = hash<T>()(x.first);
    return hash<U>()(x.second) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
  }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;

bool solve() {
  while (n > 0) {
    if (n % 10 == 7)
      return true;
    n /= 10;
  }
  return false;
}

void input() { cin >> n; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(15);

  input();
  cout << (solve() ? "Yes" : "No") << endl;
}
Problem p02711 (C++)

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

int main() {
  int a, c = 0;
  cin >> a;
  while (a) {
    if (a % 10 == 7) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
}


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

int main() {
  int a, c = 0;
  cin >> a;
  while (a) {
    if (a % 10 == 7) {
      cout << "Yes\n";
      return 0;
    }
    a /= 10;
  }
  cout << "No\n";
}
Problem p02711 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>

using namespace std;
using ll = long long;

int main() {
  string N = 0;
  cin >> N;
  for (int i = 0; i < 3; i++) {
    if (N[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <string>

using namespace std;
using ll = long long;

int main() {
  string N;
  cin >> N;
  for (int i = 0; i < 3; i++) {
    if (N[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IO                                                                     \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007

int32_t main() {
  IO;
  int n;
  cin >> n;
  bool f = false;
  while (n > 0) {
    int x = n % 10;
    if (x == 7) {
      f = true;
      break;
    }
    x /= 10;
  }
  if (f)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IO                                                                     \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007

int32_t main() {
  IO;
  int n;
  cin >> n;
  bool f = false;
  while (n > 0) {
    int x = n % 10;
    if (x == 7) {
      f = true;
      break;
    }
    n /= 10;
  }
  if (f)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p02711 (C++)

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

int main() {
  int N, tmp;
  cin >> N;
  bool flg = true;

  while (N > 0) {
    tmp = N % 10;
    if (tmp == 7) {
      cout << "Yes" << endl;
      flg = false;
      break;
    }
  }
  if (flg == true) {
    cout << "No" << endl;
  }
}


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

int main() {
  int N, tmp;
  cin >> N;
  bool flg = true;

  while (N > 0) {
    tmp = N % 10;
    N /= 10;
    if (tmp == 7) {
      cout << "Yes" << endl;
      flg = false;
      break;
    }
  }
  if (flg == true) {
    cout << "No" << endl;
  }
}
Problem p02711 (C++)

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

int main() {
  string N;
  cin >> N;
  if (N.at(1) != '7' && N.at(2) != '7' && N.at(3) != '7')
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}


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

int main() {
  string N;
  cin >> N;
  if (N.at(0) != '7' && N.at(1) != '7' && N.at(2) != '7')
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
  int s;
  cin >> s;
  ll c = 0;
  while (s > 0) {
    if (s % 10 == 7) {
      c = 1;
      break;
    }
    c = c / 10;
  }
  if (c == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main() {
  int s;
  cin >> s;
  ll c = 0;
  while (s > 0) {
    if (s % 10 == 7) {
      c = 1;
      break;
    }
    s = s / 10;
  }
  if (c == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02711 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INFLL = 1LL << 62;
const int INF = 1 << 30;
const double PI = acos(-1);
int main() {
  string n;
  int ans = 0;
  scanf("%s", &n);
  // cin >>n;

  cout << solve(n[0] == '7' || n[1] == '7' || n[2] == '7') << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a) ? "Yes" : "No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long INFLL = 1LL << 62;
const int INF = 1 << 30;
const double PI = acos(-1);
int main() {
  string n;
  int ans = 0;

  cin >> n;

  cout << solve(n[0] == '7' || n[1] == '7' || n[2] == '7') << endl;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
/// Bismillahir Rahmanir Rahim

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define f0(n) for (int i = 0; i < n; i++)
#define ms(x) memset(x, 0, sizeof(x))
#define ins insert
#define ALL(v) v.begin(), v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(), v.end())
#define maxv(v) *max_element(v.begin(), v.end())
#define PI acos(-1)
#define IOS ios::sync_with_stdio(false);
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
template <typename T> inline T Bigmod(T base, T power, T MOD) {
  T ret = 1;
  while (power) {
    if (power & 1)
      ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}

bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
int main() {
  IOS int n;
  cin >> n;
  while (n > 1) {
    if (n % 10 == 7) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}
/// Alhamdulillah


Fixed submission:
/// Bismillahir Rahmanir Rahim

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define f0(n) for (int i = 0; i < n; i++)
#define ms(x) memset(x, 0, sizeof(x))
#define ins insert
#define ALL(v) v.begin(), v.end()
#define highest(x) numeric_limits<x>::max()
#define lowest(x) numeric_limits<x>::min()
#define Inf INFINITY
#define minv(v) *min_element(v.begin(), v.end())
#define maxv(v) *max_element(v.begin(), v.end())
#define PI acos(-1)
#define IOS ios::sync_with_stdio(false);
using namespace std;
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};
const long long MOD = 1000000007;
template <typename T> inline T Bigmod(T base, T power, T MOD) {
  T ret = 1;
  while (power) {
    if (power & 1)
      ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    power >>= 1;
  }
  return ret;
}

bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
int main() {
  IOS int n;
  cin >> n;
  while (n > 1) {
    if (n % 10 == 7) {
      cout << "Yes\n";
      return 0;
    }
    n /= 10;
  }
  cout << "No\n";
  return 0;
}
/// Alhamdulillah
Problem p02711 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  if (n.at(1) != '7' && n.at(2) != '7' && n.at(3) != '7') {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  string n;
  cin >> n;
  if (n.at(1) != '7' && n.at(2) != '7' && n.at(0) != '7') {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}
Problem p02711 (C++)

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

int main() {
  char str1[2];
  cin >> str1[2];
  if (str1[0] == '7' || str1[1] == '7' || str1[2] == '7')
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

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

int main() {
  string s;
  bool ans = false;
  cin >> s;
  for (int i = 0; i < 3; i++) {
    if (s[i] == '7') {
      ans = true;
    }
  }
  if (ans)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02711 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int num, check = 7, count, temp;
  while (cin >> num, num >= 100 && num < 1000) {
    count = 0;
    while (num > 0) {
      temp = num % 10;
      if (temp == check) {
        count++;
        if (count != 0) {
          cout << "Yes" << endl;
        }
        break;
      }
      num /= 10;
    }
    if (count == 0) {
      cout << "No" << endl;
      break;
    }
  }
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int num, check = 7, count, temp;
  while (cin >> num, num >= 100 && num < 1000) {
    count = 0;
    while (num > 0) {
      temp = num % 10;
      if (temp == check) {
        count++;
        if (count != 0) {
          cout << "Yes" << endl;
        }
        break;
      }
      num /= 10;
    }
    if (count == 0) {
      cout << "No" << endl;
      break;
    }
    break;
  }
}
Problem p02712 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>

int main() {
  // jika 3 dan 5 membagi == fixxbuzz
  // jika dibagi 3 doang ==fizz
  // jika dibagi 5 doang == buzz
  // jika ttidak a =i
  // pakai long long int katanya warning overflow?
  long long int n, sum = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    if (i % 3 == 0 || i % 5 == 0) {
      continue;
    } else {
      sum += i;
    }
  }
  printf("%lld", sum);
  return 0;
}

Fixed submission:
#include <stdio.h>

int main() {
  long long int max, sum = 0;
  scanf("%lld", &max);
  for (int i = 0; i <= max; i++) {
    if (i % 3 != 0 && i % 5 != 0) {
      sum = sum + i;
    }
  }
  printf("%lld", sum);
  return 0;
}
Problem p02712 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a, b) for (int a = 0; a < b; a++)
#define Sort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(), a.end()), a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int, vector<int>, greater<int>>
#define PriP                                                                   \
  priority_queue<P<int, int>, vector<P<int, int>>, greater<P<int, int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(), (a).end()
#define elif else if

signed main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0)
      i = 0;
    if (i % 5 == 0)
      i = 0;
    sum += i;
  }
  cout << sum << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define fo(a, b) for (int a = 0; a < b; a++)
#define Sort(a) sort(a.begin(), a.end())
#define rev(a) reverse(a.begin(), a.end())
#define fi first
#define se second
#define sz size()
#define bgn begin()
#define en end()
#define pb push_back
#define pp() pop_back()
#define V vector
#define P pair
#define yuko(a) setprecision(a)
#define uni(a) a.erase(unique(a.begin(), a.end()), a.end())
#define Q queue
#define pri priority_queue
#define Pri priority_queue<int, vector<int>, greater<int>>
#define PriP                                                                   \
  priority_queue<P<int, int>, vector<P<int, int>>, greater<P<int, int>>>
#define ff first.first
#define fs first.second
#define sf second.first
#define ss second.second
#define all(a) (a).begin(), (a).end()
#define elif else if

signed main() {
  int n;
  cin >> n;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    int b = i;
    if (b % 3 == 0)
      b = 0;
    else if (b % 5 == 0)
      b = 0;
    sum += b;
  }
  cout << sum << endl;
}
Problem p02712 (C++)

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

using namespace std;
typedef long long ll;

int main() {
  int n;
  ll sum = 0;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    if (i % 3 != 0 && i % 5 != 0)
      sum += i;
  }
  printf("%lld", sum);
}

Fixed submission:
#include <cstdio>

using namespace std;
typedef long long ll;

int main() {
  int n;
  ll sum = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    if (i % 3 != 0 && i % 5 != 0)
      sum += i;
  }
  printf("%lld", sum);
}