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

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

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

  int f = 0;
  int a = N;
  while (a > 0) {
    f += a % 10;
    a /= 10;
  }

  if (N % a == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

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

  int f = 0;
  int a = N;
  while (a > 0) {
    f += a % 10;
    a /= 10;
  }

  if (N % f == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

ll inf = 9223372036854775806;

int main() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll n, s = 0, t;
  cin >> n;
  t = n;
  while (t > 0) {
    s += t % 10;
    t /= 10;
  }
  if (n % s == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}

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

ll inf = 9223372036854775806;

int main() {
  // freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ll n, s = 0, t;
  cin >> n;
  t = n;
  while (t > 0) {
    s += t % 10;
    t /= 10;
  }
  if (n % s == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
Problem p03502 (C++)

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

int main() {
  long long N;
  cin >> N;
  long long x = 0, p;
  for (long long i = N; i >= 10; i /= 10) {
    p = i % 10;
    x += p;
  }
  if (N % x == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


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

int main() {
  long long N;
  cin >> N;
  long long x = 0, p;
  for (long long i = N; i > 0; i /= 10) {
    p = i % 10;
    x += p;
  }
  if (N % x == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p03502 (C++)

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

int hs(int n) {
  int tmp;
  while (n < 0) {
    tmp += n % 2;
    n /= 10;
  }
  return tmp;
}

int main() {
  int n;
  cin >> n;
  int a = hs(n);
  if (n % a == 0)
    cout << "Yes"
         << "\n";
  else
    cout << "No"
         << "\n";
  return 0;
}


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

int hs(int n) {
  int tmp = 0;
  while (n > 0) {
    tmp += n % 10;
    n /= 10;
  }
  return tmp;
}

int main() {
  int n;
  cin >> n;
  int a = hs(n);
  if (n % a == 0)
    cout << "Yes"
         << "\n";
  else
    cout << "No"
         << "\n";
  return 0;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int num = N;
  int sum = 0;
  while (num / 10 != 0) {
    if (num / 10 != 0) {
      sum += num % 10;
      num /= 10;
    }
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int num = N;
  int sum = 0;
  while (num % 10 != 0) {
    sum += num % 10;
    num /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

int main() {
  int N, n, t;
  cin >> N;
  n = N;
  t = 0;
  int ri;
  for (int i = 8; i >= 0; i--) {
    ri = n / (10 ^ i);
    n -= ri * (10 ^ i);
    t += ri;
  }
  if (N % t == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int main() {
  int N, n, t;
  cin >> N;
  n = N;
  t = 0;
  for (int i = 0; i < 9; i++) {
    if (n >= 10) {
      t += n % 10;
      n = n / 10;
    } else {
      t += n;
      break;
    }
  }
  if (N % t == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int sumofeach(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
}

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

  ans = sumofeach(n);

  if (n % ans == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}


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

int sumofeach(int n) {
  int sum = 0;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

  ans = sumofeach(n);

  if (n % ans == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {
  int N, f, sum = 0;
  cin >> N;
  f = N;
  while (N > 0) {
    sum += f % 10;
    f /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N, f, sum = 0;
  cin >> N;
  f = N;
  while (f > 0) {
    sum += f % 10;
    f /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
// 080B
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
int main(void) {
  int n, r = 0, copy = 0;
  cin >> n;
  copy = n;
  while (true) {
    // cout << n%10 << endl;
    r += n / 10;
    n = n / 10;
    if (n == 0)
      break;
  }
  if (copy % r == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}

Fixed submission:
// 080B
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;
int main(void) {
  int n, r = 0, copy = 0;
  cin >> n;
  copy = n;
  while (true) {
    // cout << n%10 << endl;
    r += n % 10;
    n = n / 10;
    if (n == 0)
      break;
  }
  if (copy % r == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

using namespace std;

int findsum(int m) {
  int sum = 0;
  while (m > 0) {
    sum += m % 10;
    m /= 10;
  }
}
int main() {
  int n;
  cin >> n;

  if (n % findsum(n) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

using namespace std;

int findsum(int m) {
  int sum = 0;
  while (m > 0) {
    sum += m % 10;
    m /= 10;
  }
  return sum;
}
int main() {
  int n;
  cin >> n;

  if (n % findsum(n) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (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() {
  int N;
  cin >> N;
  int n = N;
  int sum = 0;
  rep(i, 9) {
    if (n < 10)
      break;
    n %= 10;
    sum += n;
  }
  if (N % sum == 0) {
    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() {
  int N;
  cin >> N;
  int n = N;
  int sum = 0;
  rep(i, 8) {
    sum += n % 10;
    n /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
Problem p03502 (C++)

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

int main() {

  int n;
  int a, b; // bが桁の合計値
  cin >> n;
  a = n;
  while (n > 0) {
    b += n % 10;
    a /= 10;
  }

  if (n % b == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

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

int main() {

  int n;
  int a, b; // bが桁の合計値
  cin >> n;
  a = n;
  while (a) {
    b += a % 10;
    a /= 10;
  }

  if (n % b == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}
Problem p03502 (C++)

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

int findSumOfDigits(int x) {
  int sum = 0;
  while (x >= 10) {
    sum += x % 10;
    x -= x % 10;
    x /= 10;
  }
  return sum;
}

int main() {
  string ans = "No";
  int N;
  cin >> N;
  int sum = findSumOfDigits(N);
  if (N % sum == 0) {
    ans = "Yes";
  }
  cout << ans << endl;
}


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

int findSumOfDigits(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x -= x % 10;
    x /= 10;
  }
  return sum;
}

int main() {
  string ans = "No";
  int N;
  cin >> N;
  int sum = findSumOfDigits(N);
  if (N % sum == 0) {
    ans = "Yes";
  }
  cout << ans << endl;
}
Problem p03502 (C++)

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

using namespace std;

// https://atcoder.jp/contests/abc080/tasks/abc080_b

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

  int sum = 0;
  int tmp = N;
  while (tmp > 1) {
    sum += tmp % 10;
    tmp /= 10.0;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Fixed submission:
#include <iostream>

using namespace std;

// https://atcoder.jp/contests/abc080/tasks/abc080_b

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

  int sum = 0;
  int tmp = N;
  while (tmp) {
    sum += tmp % 10;
    tmp /= 10.0;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int x = 100000000;
  int sum = 0;
  int K = N;
  for (int i = 0; i < 8; i++) {
    int S, A;
    S = N / x;
    N = N % x;
    sum += S;
    x /= 10;
  }
  if (K % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  // ここにプログラムを追記
}


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

int main() {
  int N;
  cin >> N;
  int x = 100000000;
  int sum = 0;
  int K = N;
  for (int i = 0; i < 9; i++) {
    int S, A;
    S = N / x;
    N = N % x;
    sum += S;
    x /= 10;
  }
  if (K % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  // ここにプログラムを追記
}
Problem p03502 (C++)

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

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, n, m) for (ll i = n; i > (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define VEC2(x, a, b)                                                          \
  vector<vector<ll>> x = vector<vector<ll>>(a, vector<ll>(b, 0))
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)                                                             \
  sort(v.begin(), v.end());                                                    \
  reverse(v.begin(), v.end())
#define cinv(v, n, m) FOR(i, n, m) cin >> v.at(i)
#define coutv(v, n, m)                                                         \
  FOR(i, n, m) cout << v.at(i) << " ";                                         \
  cout << end
#define cout(n) cout << fixed << setprecision(n)
ll disitSum(ll x) {
  ll res = 0;
  while (x > 0) {
    res += x % 10;
    x /= 10;
  }
  return res;
}

int main() {
  ll N;
  if (N % disitSum(N) != 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}


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

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
#define FOR(i, n, m) for (ll i = n; i < (ll)m; i++)
#define FORr(i, n, m) for (ll i = n; i > (ll)m; i--)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define VEC2(x, a, b)                                                          \
  vector<vector<ll>> x = vector<vector<ll>>(a, vector<ll>(b, 0))
#define sortAl(v) sort(v.begin(), v.end())
#define sortAlr(v)                                                             \
  sort(v.begin(), v.end());                                                    \
  reverse(v.begin(), v.end())
#define cinv(v, n, m) FOR(i, n, m) cin >> v.at(i)
#define coutv(v, n, m)                                                         \
  FOR(i, n, m) cout << v.at(i) << " ";                                         \
  cout << end
#define cout(n) cout << fixed << setprecision(n)
ll disitSum(ll x) {
  ll res = 0;
  while (x > 0) {
    res += x % 10;
    x /= 10;
  }
  return res;
}

int main() {
  ll N;
  cin >> N;
  if (N % disitSum(N) != 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int X = 0;
  int Y = 0;
  int M;
  M == N;

  for (int i = 0; i < 9; i++) {
    X = M % 10;
    Y += X;
    M = (M - X) / 10;
  }

  if (N % Y == 0)
    cout << "Yes" << endl;
  else if (N % Y != 0)
    cout << "No" << endl;
}


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

int main() {
  int N;
  cin >> N;
  int X = 0;
  int Y = 0;
  int M;
  M = N;

  for (int i = 0; i < 9; i++) {
    X = M % 10;
    Y += X;
    M = (M - X) / 10;
  }

  if (N % Y == 0)
    cout << "Yes" << endl;
  else if (N % Y != 0)
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int sumdigit(int a) {
  int ret = 0;
  while (a) {
    ret += a % 10;
    a /= 10;
  }
  return ret;
}
int main(void) {
  int N;

  if ((N % sumdigit(N)) == 0)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}


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

int sumdigit(int a) {
  int ret = 0;
  while (a) {
    ret += a % 10;
    a /= 10;
  }
  return ret;
}
int main(void) {
  int N;
  cin >> N;
  if ((N % sumdigit(N)) == 0)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
Problem p03502 (C++)

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

using namespace std;

int main() {
  long n, m;
  cin >> n;
  m = n;
  long a = 0;
  for (int i = 1; m / 10; ++i, m /= 10, a += n % (i * 10))
    ;
  cout << ((n % a == 0) ? "Yes" : "No");
  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  long n, m;
  cin >> n;
  m = n;
  long a = 0;
  while (m > 0) {
    a += m % 10;
    m /= 10;
  }
  cout << ((n % a == 0) ? "Yes" : "No");
  return 0;
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, l, r) for (long long i = (l); i < (r); ++i)
#define REP(i, n) FOR(i, 0, n)
#define int long long

int exsum(int x) {
  int ret = 0;
  while (x >= 10) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}

signed main() {
  int N;
  cin >> N;
  N % exsum(N) == 0 ? cout << "Yes" << endl : cout << "No" << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, l, r) for (long long i = (l); i < (r); ++i)
#define REP(i, n) FOR(i, 0, n)
#define int long long

int exsum(int x) {
  int ret = 0;
  while (x > 0) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}

signed main() {
  int N;
  cin >> N;
  N % exsum(N) == 0 ? cout << "Yes" << endl : cout << "No" << endl;
}
Problem p03502 (C++)

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

int main(void) {
  int N, sum = 0;
  cin >> N;
  int n = N;

  while (N >= 10) {
    sum += N % 10;
    N /= 10;
  }
  cout << (n % sum == 0 ? "Yes" : "No") << endl;

  return 0;
}


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

int main(void) {
  int N, sum = 0;
  cin >> N;
  int n = N;

  for (int i = 0; i < 8; i++) {
    sum += N % 10;
    N /= 10;
  }
  cout << (n % sum == 0 ? "Yes" : "No") << endl;

  return 0;
}
Problem p03502 (C++)

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

typedef long long ll;

using namespace std;

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

  int y = x;
  int z = 0;
  while (y != 0) {
    y = y / 10;
    z += y % 10;
  }

  if (x % z == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

typedef long long ll;

using namespace std;

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

  int y = x;
  int z = y % 10;
  while (y != 0) {
    y = y / 10;
    z += y % 10;
  }

  if (x % z == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int i = 0;
  int M = N;

  while (M != 0) {
    i += M % 10;
    M = N / 10;
  }
  if (N % i == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
  int N;
  cin >> N;
  int i = 0;
  int M = N;

  while (M != 0) {
    i += M % 10;
    M = M / 10;
  }
  if (N % i == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int C = N;
  int sum = 0;
  while (C > 0) {
    sum += N % 10;
    C = N / 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int C = N;
  int sum = 0;
  while (C > 0) {
    sum += C % 10;
    C /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

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

  for (int i = 1; i < N; i *= 10)
    f += (N / i) % 10;

  if (N % f == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

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

  for (int i = 1; i <= N; i *= 10)
    f += (N / i) % 10;

  if (N % f == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int64_t digit(int64_t num) {
  int64_t ans = 0;
  while (num > 0) {
    ans += num % 10;
    ans /= 10;
  }
  return ans;
}

int main() {
  int64_t num;
  cin >> num;
  cout << (num % digit(num) == 0 ? "Yes" : "No") << endl;
}


Fixed submission:
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int64_t digit(int64_t num) {
  int64_t ans = 0;
  while (num > 0) {
    ans += num % 10;
    num /= 10;
  }
  return ans;
}

int main() {
  int64_t num;
  cin >> num;
  cout << (num % digit(num) == 0 ? "Yes" : "No") << endl;
}
Problem p03502 (C++)

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

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

  int sum = 0;
  int k = 10;
  while (k / 10 < N) {
    sum += (N % k) / (k / 10);
    k *= 10;
  }

  if (N % sum) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}

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

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

  int sum = 0;
  int k = 10;
  while (k / 10 <= N) {
    sum += (N % k) / (k / 10);
    k *= 10;
  }

  if (N % sum) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
}
Problem p03502 (C++)

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

int main() {
  long long N, x, sum;
  cin >> N;
  x = N;
  sum = 0;
  while (x > 1) {
    sum = sum + x % 10;
    x = x / 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

int main() {
  long long N, x, sum;
  cin >> N;
  x = N;
  sum = 0;
  while (x >= 1) {
    sum = sum + x % 10;
    x = x / 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = n; i > 1; i--)
#define rep3(i, s, n) for (int i = (s); i < (int)(n); i++)

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

  int f = 0;
  rep2(i, 9) { f += int((n % int(pow(10, i))) / int(pow(10, (i - 1)))); }

  if ((n % f) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Fixed submission:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = n; i > 1; i--)
#define rep3(i, s, n) for (int i = (s); i < (int)(n); i++)

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

  int f = 0;
  int large_num = 1;
  int small_num = 1;
  rep3(i, 1, 9) {
    large_num = int(pow(10, i));
    small_num = int(pow(10, i - 1));
    if (n < small_num) {
      break;
    } else {
      f += int((n % large_num) / small_num);
    }
  }

  if ((n % f) == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

#define INF 1000000001
#define LINF 1000000000000000001

using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;

Int gcd(Int x, Int y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

Int lcm(Int x, Int y) { return x * y / gcd(x, y); }

int n;

int main() {
  cin >> n;
  int a = n, b = 0, c = 100000000;
  while (c > 1) {
    b += a / c;
    a %= c;
    c /= 10;
  }
  if (n % b == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

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

#define INF 1000000001
#define LINF 1000000000000000001

using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;

Int gcd(Int x, Int y) {
  if (y == 0)
    return x;
  return gcd(y, x % y);
}

Int lcm(Int x, Int y) { return x * y / gcd(x, y); }

int n;

int main() {
  cin >> n;
  int a = n, b = 0, c = 100000000;
  while (c >= 1) {
    b += a / c;
    a %= c;
    c /= 10;
  }
  if (n % b == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p03502 (C++)

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

int main() {
  int N, t, s, u, i, n;
  cin >> N;
  t = 0;
  s = 10;
  u = 0;
  i = 0;
  n = N;

  while (i < N) {
    if (N / s == 0) {
      break;
    } else {
      s *= 10;
      u += 1;
    }
    i++;
  }
  for (int l = 0; l < u; l++) {
    t += n % 10;
    n = n / 10;
  }
  if (N % t == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N, t, s, u, i, n;
  cin >> N;
  t = 0;
  s = 10;
  u = 0;
  i = 0;
  n = N;

  while (i < N) {
    if (N / s == 0) {
      u += 1;
      break;
    } else {
      s *= 10;
      u += 1;
    }
    i++;
  }
  for (int l = 0; l < u; l++) {
    t += n % 10;
    n = n / 10;
  }
  if (N % t == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int f(int x) {
  int ret = 0;
  while (x > 1) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}
int main(void) {
  int n;
  cin >> n;
  if (n % f(n) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int f(int x) {
  int ret = 0;
  while (x >= 1) {
    ret += x % 10;
    x /= 10;
  }
  return ret;
}
int main(void) {
  int n;
  cin >> n;
  if (n % f(n) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p03502 (C++)

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

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define ll long long

const int N = 1e5 + 5;
int a[N];

void fileIO() {
#ifndef ONLINE_JUDGE
  freopen("int.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
}
int main() {
  IOS;
  fileIO();
  int n;
  cin >> n;
  int k = n, sum(0);
  while (k) {
    sum += k % 10;
    k /= 10;
  }
  n % sum == 0 ? cout << "Yes" : cout << "No";
  return 0;
}


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

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define ll long long

const int N = 1e5 + 5;
int a[N];

void fileIO() {
#ifndef ONLINE_JUDGE
  freopen("int.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
#endif
}
int main() {
  IOS;
  //    fileIO();
  int n;
  cin >> n;
  int k = n, sum(0);
  while (k) {
    sum += k % 10;
    k /= 10;
  }
  n % sum == 0 ? cout << "Yes" : cout << "No";
  return 0;
}
Problem p03502 (C++)

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

int main() {
  int X; // 数字
  int Xsub;
  int Xsum = 0;
  int Harshad = 0;
  cin >> X;

  Xsub = X;

  while (Xsub > 0) {
    Xsum += Xsub / 10;
    Xsub /= 10;
  }

  Harshad = X % Xsum;
  if (Harshad == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
  int X; // 数字
  int Xsub;
  int Xsum = 0;
  int Harshad = 0;
  cin >> X;

  Xsub = X;

  while (Xsub > 0) {
    Xsum += Xsub % 10;
    Xsub /= 10;
  }

  Harshad = X % Xsum;
  if (Harshad == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>

int N;

int main() {
  int sum, n;
  scanf("%d", &N);

  sum = 0;
  n = N;
  while (n / 10 != 0) {
    sum += n % 10;
    n /= 10;
  }
  printf("%s", N % sum == 0 ? "Yes" : "No");
  return 0;
}

Fixed submission:
#include <stdio.h>

int N;

int main() {
  int sum, n;
  scanf("%d", &N);

  sum = 0;
  n = N;
  while (n > 0) {
    sum += n % 10;
    n /= 10;
  }
  printf("%s", N % sum == 0 ? "Yes" : "No");
  return 0;
}
Problem p03502 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pd pair<double, double>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int a, b, n;

int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  a = n;
  while (n) {
    b += n % 10;
    n / 10;
  }
  if (a % b)
    cout << "No";
  else
    cout << "Yes";
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pd pair<double, double>
#define lg length()
#define sz size()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

int a, b, n;

int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n;
  a = n;
  while (n) {
    b += n % 10;
    n /= 10;
  }
  if (a % b)
    cout << "No";
  else
    cout << "Yes";
}
Problem p03502 (C++)

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

int main() {
  int N, M;
  int sum = 0;

  cin >> N;
  M = N;
  for (int i = 0; i < 9; i++) {
    sum += M % 10;
    // cout << M/100 << endl;
    M /= 10;
  }
  if (N % M == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int main() {
  int N, M;
  int sum = 0;

  cin >> N;
  M = N;
  for (int i = 0; i < 9; i++) {
    sum += M % 10;
    // cout << M/100 << endl;
    M /= 10;
  }
  if (N % sum == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {
  int N, M, O,
      H; // Nは入力する値、Mは桁数を調べるために仮にNを代入する値、HはNがSUMで割り切れるかどうかを計算するために仮にNを代入する値
  int Keta = 1;
  int SUM = 0;
  cin >> N;
  M = N;
  H = N;
  string Q;
  for (int i = 0; i < 10; i++) {
    M = M / 10;
    if (M < 1) {
      break;
    } else {
      Keta += 1;
    }
  }
  for (int i = Keta; i > 1; i--) {
    O = N % 10;
    SUM += O;
    N = N / 10;
  }
  if (H % SUM == 0) {
    Q = "Yes";
  } else {
    Q = "No";
  }
  cout << Q << endl;
}

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

int main() {
  int N, M, O,
      H; // Nは入力する値、Mは桁数を調べるために仮にNを代入する値、HはNがSUMで割り切れるかどうかを計算するために仮にNを代入する値
  int Keta = 1;
  int SUM = 0;
  cin >> N;
  M = N;
  H = N;
  string Q;
  for (int i = 0; i < 10; i++) {
    M = M / 10;
    if (M < 1) {
      break;
    } else {
      Keta += 1;
    }
  }
  for (int i = Keta; i >= 1; i--) {
    O = N % 10;
    SUM += O;
    N = N / 10;
  }
  if (H % SUM == 0) {
    Q = "Yes";
  } else {
    Q = "No";
  }
  cout << Q << endl;
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {

  int n;
  cin >> n;
  string s = to_string(n);

  int tmp = 0;
  for (int i = 0; i < n; i++) {
    tmp += s[i] - '0';
  }

  if (n % tmp == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int main() {

  int n;
  cin >> n;
  string s = to_string(n);

  int tmp = 0;
  for (int i = 0; i < s.size(); i++) {
    tmp += s[i] - '0';
  }

  if (n % tmp == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int M = N;
  int sum = 0;
  while (M) {
    sum += M % 10;
    sum /= 10;
  }
  cout << (N % sum == 0 ? "Yes" : "No") << endl;
}

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

int main() {
  int N;
  cin >> N;
  int M = N;
  int sum = 0;
  while (M) {
    sum += M % 10;
    M /= 10;
  }
  cout << (N % sum == 0 ? "Yes" : "No") << endl;
}
Problem p03502 (C++)

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

int main() {
  int N;
  int j = 10;
  int hash = 0;
  cin >> N;
  int M = N;

  while (M != 0) {

    int a = M % j;
    M -= a;
    hash += a;
  }

  if (N % hash == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N;
  int j = 10;
  int hash = 0;
  cin >> N;
  int M = N;

  while (M != 0) {

    int a = M % j;
    M -= a;
    hash += a * 10 / j;
    j *= 10;
  }

  if (N % hash == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

int main() {

  int N, fx, N1, cp, a = 100000000;
  cin >> N;
  N1 = N;
  for (int i = 0; i < 8; i++) {
    cp = N;
    cp /= a;
    fx += cp;
    N -= cp * a;
    a /= 10;
  }
  if (N1 % fx == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {

  int N, fx, N1, cp, a = 100000000;
  cin >> N;
  N1 = N;
  for (int i = 0; i < 9; i++) {
    cp = N;
    cp /= a;
    fx += cp;
    N -= cp * a;
    a /= 10;
  }
  if (N1 % fx == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <stdio.h>
int digitSum(long a) {
  int reval = 0;
  int i = 0;
  while (a > 1) {
    reval += a % 10;
    a /= 10;
  }
  return reval;
}
int Harshad(long N) {
  int reval;
  if ((N % digitSum(N)) == 0)
    reval = 1;
  else
    reval = 0;
  return reval;
}
int main() {
  long N;
  scanf("%ld", &N);
  if (Harshad(N))
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}

Fixed submission:
#include <stdio.h>
int digitSum(long a) {
  int reval = 0;
  int i = 0;
  while (a >= 1) {
    reval += a % 10;
    a /= 10;
  }
  return reval;
}
int Harshad(long N) {
  int reval;
  if ((N % digitSum(N)) == 0)
    reval = 1;
  else
    reval = 0;
  return reval;
}
int main() {
  long N;
  scanf("%ld", &N);
  if (Harshad(N))
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int sum;
int main() {
  int x;
  cin >> x;
  for (int i = 1; i < x; i *= 10) {
    int xi = x / i - x / (i * 10) * 10;
    sum += xi;
    // cout<<sum<<endl;
  }
  if (x % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int sum;
int main() {
  int x;
  cin >> x;
  for (int i = 1; i < x + 1; i *= 10) {
    int xi = x / i - x / (i * 10) * 10;
    sum += xi;
    // cout<<sum<<endl;
  }
  if (x % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int N;
  cin >> N;

  int wa1 = 0;
  int wa2 = 0;
  for (int i = 0; i < N; i++) {
    wa1 = N / pow(10, i);
    wa2 = wa2 + (wa1 % 10);
  }
  if (N % wa2 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
int main() {
  int N;
  cin >> N;

  int wa1 = 0;
  int wa2 = 0;
  for (int i = 0; i < 9; i++) {
    wa1 = N / pow(10, i);
    wa2 = wa2 + (wa1 % 10);
  }
  if (N % wa2 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}
Problem p03502 (C++)

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

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

  int t = n, h = 0;
  while (t > 0) {
    if (t / 10 > 0) {
      h += t % 10;
      t /= 10;
    }
  }

  if (n % h == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

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

  int t = n, h = 0;
  while (t > 0) {
    h += t % 10;
    t /= 10;
  }

  if (n % h == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int f(int a) {
  int ans = 0;
  while (0 < a) {
    ans += a % 10;
    a /= 10;
  }
  return a;
}

int main() {
  int n;
  cin >> n;
  int num = f(n);
  if (n % num == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int f(int n) {
  int a = 0;
  while (0 < n) {
    a += n % 10;
    n /= 10;
  }
  return a;
}

int main() {
  int n;
  cin >> n;
  int num = f(n);
  if (n % num == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {
  int n, c, m;
  cin >> n;
  m = n;
  c = 0;
  while (n / 10 > 0) {
    c += n % 10;
    n /= 10;
  }
  if (m / c == m / (c + 0.0))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int main() {
  int n, c, m;
  cin >> n;
  m = n;
  c = 0;
  while (n / 10.0 > 0) {
    c += n % 10;
    n /= 10;
  }
  if (m / c == m / (c + 0.0))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {

  int N, A, B, C, sum;
  cin >> N;
  C = 100000000;
  sum = 0;

  for (int i = 0; i < 8; i++) {

    if (i == 0) {
      A = N / C;
      B = N % C;
      sum += A;
    } else if (i >= 1) {
      A = B / C;
      B = B % C;
      sum += A;
    }

    if (C == 1) {
      break;
    } else {
      C /= 10;
    }
  }

  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {

  int N, A, B, C, sum;
  cin >> N;
  C = 100000000;
  sum = 0;

  for (int i = 0; i < 9; i++) {

    if (i == 0) {
      A = N / C;
      B = N % C;
      sum += A;
    } else if (i >= 1) {
      A = B / C;
      B = B % C;
      sum += A;
    }

    if (C == 1) {
      break;
    } else {
      C /= 10;
    }
  }

  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define ll long long
const int N = 100005;
using namespace std;
int n, x, a;
int main() {
  cin >> n;
  a = n;
  while (a > 0)
    x += a % 10, x /= 10;
  if (n % x == 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#define ll long long
const int N = 100005;
using namespace std;
int n, x, a;
int main() {
  cin >> n;
  a = n;
  while (a > 0)
    x += a % 10, a /= 10;
  if (n % x == 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p03502 (C++)

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

int N;
int h;

int main() {
  std::cin >> N;
  int copy = N;
  for (int i = 8; i > 0; i--) {
    int mod = 1;
    for (int j = 0; j < i; j++) {
      mod *= 10;
    }
    h += (copy / mod);
    copy %= mod;
  }
  std::cout << (N % h == 0 ? "Yes" : "No") << std::endl;
  return 0;
}

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

int N;
int h;

int main() {
  std::cin >> N;
  int copy = N;
  for (int i = 8; i >= 0; i--) {
    int mod = 1;
    for (int j = 0; j < i; j++) {
      mod *= 10;
    }
    h += (copy / mod);
    copy %= mod;
  }
  std::cout << (N % h == 0 ? "Yes" : "No") << std::endl;
  return 0;
}
Problem p03502 (C++)

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

int main() {
  int N, x, y;
  cin >> N;
  y = N;
  x = 0;
  // ここにプログラムを追記
  for (int i = 100000000; i > 2; i /= 10) {
    x += N / i;
    N %= i;
  }
  if (y % x == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N, x, y;
  cin >> N;
  y = N;
  x = 0;
  // ここにプログラムを追記
  for (int i = 100000000; i >= 1; i /= 10) {
    x += N / i;
    N %= i;
  }
  if (y % x == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, nn, s = 0;
  cin >> n;
  n = nn;
  while (nn != 0) {
    s += nn % 10;
    nn = nn / 10;
  }
  if (n % s == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, nn, s = 0;
  cin >> n;
  nn = n;
  while (nn != 0) {
    s += nn % 10;
    nn = nn / 10;
  }
  if (n % s == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p03502 (C++)

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

int main() {
  int N;
  std::cin >> N;
  int N_original;
  int quotient = 0;
  int remainder = 0;
  int sum_number = 0;

  N_original = N;

  while (N > 9) {
    quotient = N / 10;
    remainder = N % 10;
    sum_number += remainder;
    N = quotient;
  }

  sum_number += quotient;

  if (N_original % sum_number == 0) {
    std::cout << "Yes" << '\n';
  } else {
    std::cout << "No" << '\n';
  }

  return 0;
}


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

int main() {
  int N;
  std::cin >> N;
  int N_original;
  int quotient = 0;
  int remainder = 0;
  int sum_number = 0;

  N_original = N;

  while (N > 9) {
    quotient = N / 10;
    remainder = N % 10;
    sum_number += remainder;
    N = quotient;
  }

  sum_number += N;

  if (N_original % sum_number == 0) {
    std::cout << "Yes" << '\n';
  } else {
    std::cout << "No" << '\n';
  }

  return 0;
}
Problem p03502 (C++)

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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int INF = 1e9 + 7;

int main() {
  int a;
  cin >> a;
  int sum = 0;
  int n = a;
  while (n >= 10) {
    sum += n % 10;
    n / 10;
  }
  sum += n;
  if (a % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


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

#define stirng string
#define vvi vector<vector<int>>
#define vi vector<int>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const int INF = 1e9 + 7;

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

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a, b;
  a = N;
  b = 0;
  while (a > 0) {
    b += a % 10;
    a / 10;
  }
  if (N % b == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a, b;
  a = N;
  b = 0;
  while (a > 0) {
    b += a % 10;
    a /= 10;
  }
  if (N % b == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

int main() {
  int N, M, sum = 0, num;
  cin >> N;
  M = N;

  while (M > 1) {
    num = M % 10;
    sum += num;
    M = (M - num) / 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}

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

int main() {
  int N, M, sum = 0, num;
  cin >> N;
  M = N;

  while (M >= 1) {
    num = M % 10;
    sum += num;
    M = (M - num) / 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int po = 1, pon = 10, Nco = N, Har = 0;
  while (pon < N) {
    po++;
    pon *= 10;
  }
  for (int i = 0; i < po; i++) {
    Har += Nco / pon;
    Nco %= pon;
    pon /= 10;
  }
  if (N % Har == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int po = 1, pon = 1, Nco = N, Har = 0;
  while (pon < N) {
    po++;
    pon *= 10;
  }
  for (int i = 0; i < po; i++) {
    Har += Nco / pon;
    Nco %= pon;
    pon /= 10;
  }
  if (N % Har == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

Buggy submission (status: Runtime Error):
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
const int MAX = 1000001;

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

  int fx = 0;
  int i = 1;
  while (i < n) {
    int a = (n % (10 * i)) / i;
    fx += a;
    i *= 10;
  }

  if (n % fx == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Fixed submission:
#include <cmath>
#include <iostream>
#include <string>
using namespace std;
const int MAX = 1000001;

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

  int fx = 0;
  int i = 1;
  while (i <= n) {
    int a = (n % (10 * i)) / i;
    fx += a;
    i *= 10;
  }

  if (n % fx == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int a = 0;
  int n = N;

  for (int i = 0; i < 9; i++) {
    a = a + (n % 10);
    a /= 10;
  }

  if (N % a == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int a = 0;
  int n = N;

  for (int i = 0; i < 9; i++) {
    a = a + (n % 10);
    n /= 10;
  }

  if (N % a == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
Problem p03502 (C++)

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

using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)

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

  int num = N;
  int sum = 0;
  while (!(num / 10 == 0)) {
    sum += (num % 10);
    num /= 10;
  }

  if ((N % sum) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

using namespace std;
#define repr(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)

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

  int num = N;
  int sum = 0;
  while (num > 0) {
    sum += (num % 10);
    num /= 10;
  }

  if ((N % sum) == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p03502 (C++)

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

int main() {
  int N;
  cin >> N;
  int sum = 0;
  while (N > 0) {
    sum += N % 10;
    N /= N / 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

int main() {
  int N;
  cin >> N;
  int sum = 0;
  int a = N;
  while (a > 0) {
    sum += a % 10;
    a /= 10;
  }
  if (N % sum == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}