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

#include <bits/stdc++.h>

using namespace std;

int main() {
  string n;
  int x;
  x = 0;
  cin >> n;
  for (int i = 0; i < n.length(); i++) {
    x = x + n[i] - 48;
  }
  if (x % 9 == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}

Error: -11

Fixed submission:

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

int main() {
  string n;
  int x;
  cin >> n;
  for (int i = 0; i < 200000; i++) {
    x = n[i] + x;
  }
  if (x % 9 == 0) {
    cout << "Yes" << endl;
  } else
    cout << "No" << endl;
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error


#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define IOS                                                                    \\
  ios::sync_with_stdio();                                                      \\
  cin.tie(0);
#define tc()                                                                   \\
  int tc;                                                                      \\
  scanf("%d", &tc);                                                            \\
  while (tc--)
#define endl "\\n"
#define FLOAT_COM(a, b) if (abs(a - b) == 1e-9)
#define LOOP(a, b) for (i = a; i < b; i++)
#define VI vector<int>
#define VLL vector<long long>
#define PB push_back
#define MP make_pair

using namespace std;

// int i,j,k,l,temp;

void shomoy() {
#ifndef ONLINE_JUDGE
  cerr << "\\nTime  :" << 1.0 * clock() / CLOCKS_PER_SEC << "  s\\n";
#endif
}

bool isprime(int n) {
  int f;
  for (f = 2; f * f <= n; f++) {
    if (n % f == 0)
      return false;
  }
  return true;
}

/*Driver Code Startes Here*/
int main() {
  IOS int i, n, count = 0;
  char line[10000000];
  cin >> line;
  n = strlen(line);
  for (i = 0; i < n; i++) {
    count += (line[i] - '0');
  }
  if (count % 9) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

  // shomoy();
  return 0;
}

Error: 0

Fixed submission:


#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define IOS                                                                    \\
  ios::sync_with_stdio();                                                      \\
  cin.tie(0);
#define tc()                                                                   \\
  int tc;                                                                      \\
  scanf("%d", &tc);                                                            \\
  while (tc--)
#define endl "\\n"
#define FLOAT_COM(a, b) if (abs(a - b) == 1e-9)
#define LOOP(a, b) for (i = a; i < b; i++)
#define VI vector<int>
#define VLL vector<long long>
#define PB push_back
#define MP make_pair

using namespace std;

// int i,j,k,l,temp;

void shomoy() {
#ifndef ONLINE_JUDGE
  cerr << "\\nTime  :" << 1.0 * clock() / CLOCKS_PER_SEC << "  s\\n";
#endif
}

bool isprime(int n) {
  int f;
  for (f = 2; f * f <= n; f++) {
    if (n % f == 0)
      return false;
  }
  return true;
}

/*Driver Code Startes Here*/
int main() {
  IOS int n, i, j, count = 0;
  char line[100000];
  cin >> line;
  n = strlen(line);
  for (i = 0; i < n; i++) {
    count += (line[i] - '0');
  }
  if (count % 9) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }

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

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

int main() {

  string a;
  cin >> a;
  int sum = 0;
  int len = a.size();
  for (int i = 0; i < len; i++) {
    sum += a[i] - 48;
  }
  if (sum % 9 == 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Error: WA

Fixed submission:

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

int main() {

  char a[20010];
  cin >> a;
  int sum = 0;
  int len = strlen(a);
  for (int i = 0; i < len; i++) {
    sum += a[i] - 48;
  }
  if (sum % 9 == 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

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

char n[200005];
int ans;

int main() {
  scanf(" %s", n);
  int sze = (int)strlen(n);
  for (int i = 0; i < sze; i++) {
    ans += n[i] - '0';
  }
  if (ans % 9 == 0)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}


Error: TLE

Fixed submission:

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

char n[2000005];
int ans;

int main() {
  scanf(" %s", n);
  for (int i = 0; i < strlen(n); i++) {
    int cur = n[i] - '0';
    ans += cur;
  }
  if (ans % 9 == 0)
    printf("Yes\\n");
  else
    printf("No\\n");
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int count = 0;
  for (int i = 0; i < n; i++) {
    count += s[i] - '0';
  }
  if (count % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Error: TLE

Fixed submission:

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

int main() {
  int a, b, c, d;
  cin >> a;
  d = 0;
  while (true) {

    c = a % 10;
    d += c;
    a /= 10;

    if (a < 0) {

      break;
    }
  }
  if (d % 9 == 0) {

    cout << "Yes" << endl;

  } else {

    cout << "No" << endl;
  }
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <utility>

using boost::multiprecision::cpp_int;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define MOD 1000000007
#define pb push_back
#define loop(i, a, b) for (int i = (int)a; i < (int)b; i++)
#define loope(i, b) for (int i = 1; i <= (int)b; i++)
#define loopl(i, a, b) for (ll i = ll(a); i < (ll)b; i++)

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

Error: TLE

Fixed submission:

#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <utility>

using boost::multiprecision::cpp_int;
using namespace std;
bool isMulOf9(cpp_int n) {
  // Base cases
  if (n == 0 || n == 9)
    return true;
  if (n < 9)
    return false;

  // if the number is greater than 9, then do this
  return isMulOf9((cpp_int)(n >> 3) - (cpp_int)(n & 7));
}
int main() {
  cpp_int a, sum;
  cin >> a;
  sum = 0;
  while (a > 0) {
    sum += a % 10;
    a /= 10;
  }
  if (isMulOf9(sum))
    cout << "Yes\\n";
  else
    cout << "No\\n";
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <map>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>

#define Vsort(a) sort(a.begin(), a.end())
#define Vreverse(a) reverse(a.bigin(), a.end())
#define Srep(n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Lrep(i, a, n) for (int i = (a); i < (n); i++)
#define vi vector<int>
#define vi64 vector<int64_t>
#define vvi vector<vi>
#define vvi64 vector<vi64>

using namespace std;

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int64_t sum = 0;
  vector<int> a(n);
  Srep(n) {
    a[i] = (s[i] - '0');
    sum += a[i];
  }
  sum % 9 == 0 ? cout << "Yes" << endl : cout << "No" << endl;
}

Error: TLE

Fixed submission:

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

int digit(long long int N) {
  while (N >= 10) {
    long long int tmp;
    while (N > 0) {
      tmp += (N % 10);
      N /= 10;
    }
    N = tmp;
  }
  return N;
}

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

  if (digit(N) % 9 == 0) {
    cout << "Yes";
  } else {
    cout << "No";
  }
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string s;
  cin >> s;
  int sum = 0;
  for (ll i = 0; i < s.length(); i++) {
    sum += (s.at(i)) - '0';
  }
  if (sum % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
/*
int wa(ll num){
    if(num < 10) return num;
    return wa(num/10) + num%10;
}*/

int main() {
  ll n;
  cin >> n;
  while (n >= 10) {
    int temp = n;
    int sum = 0;
    while (temp > 0) {
      sum += temp % 10;
      temp /= 10;
      n = sum;
    }
    // cout << "n"<< n <<endl;
  }
  if (n % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

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

int main() {
  string N;
  cin >> N;
  int sum = 0;
  for (int i = 0; i < N.length(); i++) {
    sum += N[i] - '0';
  }

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

Error: TLE

Fixed submission:

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

int calculate(int x1) {
  int answer = 0;
  while (x1 >= 0) {
    answer += x1 % 10;
    x1 /= 10;
  }
  return answer;
}

int main() {
  int N;
  cin >> N;
  int ans = calculate(N);
  if (ans % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

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

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

int main() {
  string s;
  cin >> s;
  ll sum = 0;

  for (ll i = 0; i < s.length(); i++) {
    sum += (s[i] - 48);
  }

  if (sum % 9 == 0)
    cout << "Yes\\n";
  else
    cout << "No\\n";
}

Error: TLE

Fixed submission:

#include <boost/multiprecision/cpp_int.hpp>
#include <iostream>
#include <utility>

using boost::multiprecision::cpp_int;
using namespace std;
int main() {
  cpp_int a, sum;
  cin >> a;
  sum = 0;
  while (a > 0) {
    sum += a % 10;
    a /= 10;
  }
  sum % 9 == 0 ? cout << "Yes"
                      << "\\n"
               : cout << "No"
                      << "\\n";
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int sum = 0;

  cin >> s;
  int i = 0;

  for (int i = 0; i < s.size(); i++) {
    int d = s[i] - '0';
    sum += d;
  }
  if (sum % 9 == 0) {
    cout << "Yes" << endl;

  } else
    cout << "No" << endl;
}


Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int sum = 0;

  cin >> s;
  int i = 0;
  int len = s.length();
  while (s[i] != len) {

    sum = sum + s[i] - '0';
    i++;
  }
  if (sum % 9 == 0) {
    cout << "Yes" << endl;

  } else
    cout << "No" << endl;
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long int ll;
int main() {
  char s[200000];
  scanf("%s", s);
  ll sum = 0;
  rep(i, strlen(s)) sum += s[i] - '0';
  if (sum % 9 == 0)
    printf("Yes");
  else
    printf("No");
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
#include <iostream>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long int ll;
int main() {
  char s[100000];
  scanf("%s", s);
  ll sum = 0;
  rep(i, strlen(s)) sum += s[i] - '0';
  if (sum % 9 == 0)
    printf("Yes");
  else
    printf("No");
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;

char num[200005];
int sum;

int main() {
  cin >> num;

  for (int i = 0; num[i]; i++) {
    sum += num[i] - '0';
  }
  if (sum % 9 == 0)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;

char num[2005];
int sum;

int main() {
  cin >> num;

  for (int i = 0; num[i]; i++) {
    sum += num[i];
  }
  if (sum % 9 == 0)
    cout << "Yes";
  else
    cout << "No";

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

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using namespace std;

int main() {

  cpp_int n;
  cin >> n;

  cpp_int r = n % 9;

  if (r % 9 == 0)
    cout << "Yes\\n";
  else
    cout << "No\\n";

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using namespace std;

int main() {

  cpp_int n;
  cin >> n;

  cpp_int ans = 0;

  cpp_int val = n;

  while (val > 0) {
    cpp_int r = val % 10;
    ans += r;
    val = val / 10;
  }

  if (ans % 9 == 0)
    cout << "Yes\\n";
  else
    cout << "No\\n";

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

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

string n;
int sum;

int main() {
  cin >> n;
  for (auto x : n) {
    sum += (x - '0');
    sum %= 9;
  }
  if (sum == 0)
    cout << "Yes";
  else
    cout << "No";
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main(void) {

  long long int n;

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

    cin >> n;

    n += n;
  }

  if (n %= 9 == 0) {

    cout << "Yes";

  } else {

    cout << "No";
  }

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

#include <bits/stdc++.h>
using namespace std;
char N[200010];

// WA
// 数値で扱おうとするとメモリが足りないので文字列として扱う
// わざわざ関数を用意しなくても各位の和を求めれば行ける
//  int findSumOfDigits(ll n)
//  {
//      ll sum = 0;
//      while (n > 0)
//      {
//          sum += n % 10;
//          n /= 10;
//      }
//      return sum;
//  }

int main() {
  cin >> N;
  int len = strlen(N);
  int sum = 0;
  for (int i = 0; i < len; i++) {
    sum += N[i] - '0';
  }

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

Error: TLE

Fixed submission:

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

// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
// 任意長整数型
// using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
// using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
cpp_int N;

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

int main() {
  cin >> N;
  cpp_int res = findSumOfDigits(N);
  if (res % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

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

char S[200100];
int main() {
  cin >> S;
  int len = strlen(S);
  long long sum = 0;
  for (int i = 0; i < len; i++) {
    sum += S[i] - '0';
  }
  if (sum % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  ;
}

Error: 0

Fixed submission:

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

char S[20010];
int main() {
  cin >> S;
  int len = strlen(S);
  long long sum = 0;
  for (int i = 0; i < len; i++) {
    sum += S[i] - '0';
  }
  if (sum % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  ;
}
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

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

void solve() {

  string str;
  cin >> str;
  int s = 0;
  for (int i = 0; i < str.length(); ++i) {
    int cnt = int(str[i] - '0');
    s += cnt;
  }

  if (s % 9 != 0)
    cout << "No\\n";
  else
    cout << "Yes\\n";
}

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

  solve();
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n;
  int cnt = 0, s = 0;
  for (int i = 0; i < 1e9; i++) {
    n = n % 10;
    s += n;
  }

  if (s % 9 == 0)
    cout << "Yes\\n";
  else
    cout << "No\\n";
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);

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

  char s[10000000];
  long long sum = 0;
  cin >> s;
  long long len = strlen(s);
  for (int i = 0; i < len; i++) {
    long long x = s[i] - 48;
    sum = sum + x;
  }
  if (sum % 9 == 0)
    cout << "Yes\\n";
  else
    cout << "No\\n";
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main() {
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);

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

  char s[1000];
  int sum = 0;
  cin >> s;
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    int x = s[i] - 48;
    sum = sum + x;
  }
  if (sum % 9 == 0)
    cout << "Yes\\n";
  else
    cout << "No\\n";
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main() {
  long long i, j, a, b, c = 0, l = 0, t, x, y, n;
  string s;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    c += int(int(s[i]) - 48);
  }
  if (c % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Error: -11

Fixed submission:

#include <iostream>
using namespace std;
int main() {
  long long i, j, a, b, c = 0, l = 0, t, x, y, n;
  cin >> n;
  long long A[n];
  for (i = 0; i < n; i++)
    cin >> A[i];
  for (i = 0; i < n - 1; i++) {
    if (A[i] > A[i + 1]) {
      c += (A[i] - A[i + 1]);
      A[i + 1] = A[i];
    }
  }
  cout << c << endl;
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
char s[100000005];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  int m, a;
  m = 0;
  for (int i = 0; i < len; i++) {
    a = s[i] - '0';
    m += a;
  }
  if (m % 9 == 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
char s[100005];
int main() {
  scanf("%s", s);
  int len = strlen(s);
  int m, a;
  m = 0;
  for (int i = 0; i < len; i++) {
    a = s[i] - '0';
    m += a;
  }
  if (m % 9 == 0)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <stdio.h>

int main() {
  char S[200100];
  scanf("%s", S);
  int s = 0;
  for (int i = 0; S[i]; i++)
    s += S[i] - '0';
  puts(s % 9 == 0 ? "Yes" : "No");
  return 0;
}

Error: 0

Fixed submission:

#include <stdio.h>

int main() {
  char S[100100];
  scanf("%s", S);
  int s = 0;
  for (int i = 0; S[i]; i++)
    s += S[i] - '0';
  puts(s % 9 == 0 ? "Yes" : "No");
  return 0;
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define debug(n) cout << "DEBUG1 " << n << "\\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\\n";
#define debug4(n, m, x, y)                                                     \\
  cout << "DEBUG3 " << n << ' ' << m << ' ' << x << ' ' << y << "\\n";
#define ss_def                                                                 \\
  stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) rrn < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
using namespace std;
void yes() {
  cout << "Yes\\n";
  return;
}
void no() {
  cout << "No\\n";
  return;
}
void solve(int case_no) {
  // implementation
  string str;
  cin >> str;
  int strl = str.length();
  int cnt = 0;
  for (int i = 0; i < strl; i++) {
    cnt += str[i] - 48;
  }
  if (cnt % 9 == 0)
    return yes();
  else
    return no();
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(NULL));
  int t = 1;
  //    cin >> t;
  for (int i = 1; i <= t; i++)
    solve(i);
}
/*

*/

Error: -11

Fixed submission:

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define debug(n) cout << "DEBUG1 " << n << "\\n";
#define debug2(n, m) cout << "DEBUG2 " << n << ' ' << m << "\\n";
#define debug3(n, m, x) cout << "DEBUG3 " << n << ' ' << m << ' ' << x << "\\n";
#define debug4(n, m, x, y)                                                     \\
  cout << "DEBUG3 " << n << ' ' << m << ' ' << x << ' ' << y << "\\n";
#define ss_def                                                                 \\
  stringstream ss // stringstream, do ss_def(str), then ss >> n (n is int)
#define upzero(n) rrn < 0) n = 0
#define alive(n) cout << "Alive here: checkpoint " << n << endl
#pragma GCC optimize("Ofast")
using namespace std;
void yes() {
  cout << "Ywa\\n";
  return;
}
void no() {
  cout << "No\\n";
  return;
}
void solve(int case_no) {
  // implementation
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++)
    cin >> a[i];
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] >= a[i - 1])
      cnt++;
  }
  cout << cnt << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  srand(time(NULL));
  int t = 1;
  //    cin >> t;
  for (int i = 1; i <= t; i++)
    solve(i);
}
/*

*/
Problem p02577 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
  int x, t = 0;
  string n;
  cin >> n;
  long long int i = 0;
  while (i < n.length()) {
    t += int(n[i]) - 48;
    i++;
  }
  if (t % 9 == 0)
    cout << "Yes";
  else {
    cout << "No";
  }
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, t = 0;
  string n;
  cin >> n;
  int i = n.length() - 1;
  while (int(n[i]) > 0) {
    t += int(n[i]) - 48;
  }
  if (t % 9 == 0)
    cout << "Yes";
  else {
    cout << "No";
  }
}
Problem p02577 (C++) — buggy submission, verdict: Runtime Error

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

int main() {
  char s;
  double sum = 0, m;

  while (scanf("%c", &s)) {
    if (s == '\\n')
      break;
    sum = sum + s - 48.0;
  }
  m = fmod(sum, 9);
  if (m == 0)
    printf("Yes\\n");
  else
    printf("No\\n");

  return 0;
}


Error: 0

Fixed submission:

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

int main() {
  char s[10000];
  int len;
  double sum = 0, m;
  scanf(" %s", s);
  len = strlen(s);
  for (int i = 0; i < len; i++) {
    sum = sum + s[i] - 48.0;
  }
  m = fmod(sum, 9);
  if (m == 0)
    printf("Yes\\n");
  else
    printf("No\\n");

  return 0;
}