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

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int K;
  cin >> K;
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << a.at(K) << endl;
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int K;
  cin >> K;
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << a.at(K - 1) << endl;
  return 0;
}
Problem p02741 (C++)

Buggy submission (status: Runtime Error):
// P.C.2.0.
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define speed                                                                  \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
#define ll long long int
#define ul unsigned long int
#define mod 1000007
#define endl "\n"
////fast power
ll power(ll a, ll b) {
  if (b == 0)
    return 1;
  ll smallans = power(a, b / 2);
  smallans = smallans * smallans;
  if (b % 2 == 0)
    return smallans;
  else
    return a * smallans;
}
////
int main() {
  ////
  speed
      ////
      int arr[33];
  for (int i = 1; i < 33; i++) {
    cin >> arr[i];
  }
  int temp;
  cin >> temp;
  cout << arr[temp];
}

Fixed submission:
// P.C.2.0.
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define speed                                                                  \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);
#define ll long long int
#define ul unsigned long int
#define mod 1000007
#define endl "\n"
////fast power
ll power(ll a, ll b) {
  if (b == 0)
    return 1;
  ll smallans = power(a, b / 2);
  smallans = smallans * smallans;
  if (b % 2 == 0)
    return smallans;
  else
    return a * smallans;
}
////
int main() {
  ////
  speed
      ////
      int arr[33] = {0, 1, 1, 1, 2, 1, 2, 1,  5, 2, 2, 1, 5, 1, 2, 1, 14,
                     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  // for(int i=1;i<33;i++){
  //     cin>>arr[i];
  // }
  int temp;
  cin >> temp;
  cout << arr[temp];
}
Problem p02741 (C++)

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

using namespace std;

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

  int list[32] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                  1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  return list[K];
}


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

using namespace std;

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

  int arr[32] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << arr[K - 1] << endl;
}
Problem p02741 (C++)

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

int main() {
  int n;
  cin >> n;
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << a.at(n + 1) << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << a.at(n - 1) << endl;
}
Problem p02741 (C++)

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

int main() {
  vector<int> data = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                      1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int K;
  cin >> K;

  cout << data.at(K) << endl;
}

Fixed submission:
#include <iostream>
#include <vector>
using namespace std;
#define N 32

int main() {
  vector<int> data = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                      1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int K;
  cin >> K;

  cout << data.at(K - 1) << endl;
}
Problem p02741 (C++)

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

int main() {

  vector<int> vec; // int型の配列変数vecを宣言
  int K;
  cin >> K;

  vec = {
      1, 1, 1, 2, 1, 2, 1,  5, 2, 2, 1, 5, 1, 2, 1, 14, 1,
      5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; // 25, 100, 64
                                                      // という整数(int)の列を代入

  cout << vec.at(K) << endl; // 1つめである25を出力
}


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

int main() {

  vector<int> vec; // int型の配列変数vecを宣言
  int K;
  cin >> K;

  vec = {
      1, 1, 1, 2, 1, 2, 1,  5, 2, 2, 1, 5, 1, 2, 1, 14, 1,
      5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}; // 25, 100, 64
                                                      // という整数(int)の列を代入

  cout << vec.at(K - 1) << endl; // 1つめである25を出力
}
Problem p02741 (C++)

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

int main() {
  int k;
  cin >> k;
  vector<int> v = {1, 2, 1, 2, 1, 5, 2,  2, 1, 5, 1, 2, 1, 14, 1,
                   5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1,  51};

  cout << v.at(k - 1);
}


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

int main() {
  int k;
  cin >> k;
  vector<int> v = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << v.at(k - 1);
}
Problem p02741 (C++)

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

int main() {
  int n;
  cin >> n;
  string s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, "
             "2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51";
  string ans = "";
  int cnt = 0;
  int i = -1;
  while (cnt < n) {
    i++;
    switch (s[i]) {
    case ',':
      cnt++;
      if (cnt < n)
        ans = "";
    case ' ':
      break;
    default:
      ans += s[i];
      break;
    }
  }
  cout << ans << endl;
}

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

int main() {
  int n;
  cin >> n;
  string s = "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, "
             "2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51,";
  string ans = "";
  int cnt = 0;
  int i = -1;
  while (cnt < n) {
    i++;
    switch (s[i]) {
    case ',':
      cnt++;
      if (cnt < n)
        ans = "";
    case ' ':
      break;
    default:
      ans += s[i];
      break;
    }
  }
  cout << ans << endl;
}
Problem p02741 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int K;
  cin >> K;
  vector<int> vec{1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                  1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << vec.at(K);
}


Fixed submission:
#include <algorithm>
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <string>
#include <vector>
using namespace std;
int main() {
  int K;
  cin >> K;
  vector<int> vec{1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                  1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << vec.at(K - 1);
}
Problem p02741 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K;
  cin >> K;
  vector<int> vec;

  vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << vec.at(K) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int K;
  cin >> K;
  vector<int> vec;

  vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << vec.at(K - 1) << endl;
}
Problem p02741 (C++)

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

using namespace std;

int main() {
  vector<int> num{100, 1, 1, 1, 2, 1, 2, 1,  5, 2, 2, 1, 5, 1, 2, 1, 14,
                  1,   5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;

  cout << num.at(k + 1) << endl;
}


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

using namespace std;

int main() {
  vector<int> num{100, 1, 1, 1, 2, 1, 2, 1,  5, 2, 2, 1, 5, 1, 2, 1, 14,
                  1,   5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;

  cout << num.at(k) << endl;
}
Problem p02741 (C++)

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

int main() {
  vector<int> data = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                      1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << data.at(K + 1) << endl;
}

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

int main() {
  vector<int> data = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                      1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int K;
  cin >> K;
  cout << data.at(K - 1) << endl;
}
Problem p02741 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> S;
  S = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
       1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << S.at(N) << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> S;
  S = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
       1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << S.at(N - 1) << endl;
}
Problem p02741 (C++)

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

int main() {
  vector<int> vec;
  vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int K;
  cin >> K;
  cout << vec.at(K) << endl;
}

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

int main() {
  vector<int> vec;
  vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int K;
  cin >> K;
  cout << vec.at(K - 1) << endl;
}
Problem p02741 (C++)

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

int main() {
  int K = 0;
  cin >> K;

  vector<int> suretsu(32);
  suretsu = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << suretsu.at(K + 1) << endl;
}


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

int main() {
  int K = 0;
  cin >> K;

  vector<int> suretsu(32);
  suretsu = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
             1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << suretsu.at(K - 1) << endl;
}
Problem p02741 (C++)

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

int main() {
  int K;
  cin >> K;
  vector<int> S = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << S.at(K + 1) << endl;
}


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

int main() {
  int K;
  cin >> K;
  vector<int> S = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                   1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << S.at(K - 1) << endl;
}
Problem p02741 (C++)

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

int main() {
  int K;
  cin >> K;
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << vec.at(K) << endl;
  return 0;
}


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

int main() {
  int K;
  cin >> K;
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  cout << vec.at(K - 1) << endl;
  return 0;
}
Problem p02741 (C++)

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

int main() {
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int N;
  cin >> N;
  int K;
  K = N + 1;
  cout << vec.at(K) << endl;
}


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

int main() {
  vector<int> vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
                     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int N;
  cin >> N;
  int K;
  K = N - 1;
  cout << vec.at(K) << endl;
}
Problem p02741 (C++)

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

int main() {
  vector<int> yama;
  yama = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
          1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;

  cout << yama.at(k) << endl;
}

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

int main() {
  vector<int> yama;
  yama = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
          1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  int k;
  cin >> k;
  k = k - 1;

  cout << yama.at(k) << endl;
}
Problem p02741 (C++)

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

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

  // 配列
  vector<int> vec; // int型の配列変数vecを宣言

  vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << vec.at(K) << endl; //
}


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

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

  // 配列
  vector<int> vec; // int型の配列変数vecを宣言

  vec = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
         1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

  cout << vec.at(K - 1) << endl; //
}
Problem p02741 (C++)

Buggy submission (status: Runtime Error):
//*******Abhijit Burman***********//
// Jalpaiguri Government Engineering College//

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

#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000 + 7)
#define fio                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(NULL);                                                               \
  cout.tie(NULL)

int solve() {
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
               1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k - 1] << endl;
  return 0;
}
int main() {
  fio;

#ifndef ONLINE_JUDGE
  // for getting input from input.txt
  freopen("input.txt", "r", stdin);
  // for writing output to output.txt
  freopen("output.txt", "w", stdout);
#endif

  ll t = 1;
  // cin>>t;
  while (t--) {

    solve();
  }
  return 0;
}


Fixed submission:
//*******Abhijit Burman***********//
// Jalpaiguri Government Engineering College//

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

#define pb push_back
#define mk make_pair
#define MAXX (1000000000000000000 + 7)
#define fio                                                                    \
  ios_base::sync_with_stdio(0);                                                \
  cin.tie(NULL);                                                               \
  cout.tie(NULL)

int solve() {
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
               1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k - 1] << endl;
  return 0;
}
int main() {
  fio;

  // 	#ifndef ONLINE_JUDGE
  //     // for getting input from input.txt
  //     freopen("input.txt", "r", stdin);
  //     // for writing output to output.txt
  //     freopen("output.txt", "w", stdout);
  // 	#endif

  ll t = 1;
  // cin>>t;
  while (t--) {

    solve();
  }
  return 0;
}
Problem p02742 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
long long h, w;
int main() {
  scanf("%lld%lld", &h, &w);
  if (h == 1 || w == 1)
    return puts("1");
  printf("%lld\n", (h * w + 1) / 2);
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
long long h, w;
int main() {
  scanf("%lld%lld", &h, &w);
  if (h == 1 || w == 1)
    return puts("1") * 0;
  printf("%lld\n", (h * w + 1) / 2);
}
Problem p02742 (C++)

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

int main() {
  int h;
  cin >> h;
  int w;
  cin >> w;
  pair<int, int> p;
  vector<pair<int, int>> chess;

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      p = make_pair(i, j);
      chess.push_back(p);
    }
  }
  int count = 0;
  for (int i = 0; i < int(chess.size()); ++i) {
    pair<int, int> hoge;
    hoge = chess.at(i);
    if ((hoge.first + hoge.second) % 2 == 0)
      ++count;
  }
  cout << count << endl;
}


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

int main() {
  long long h, w;
  cin >> h >> w;
  if (h == 1 || w == 1)
    cout << 1 << endl;
  else
    cout << (h * w) / 2 + ((h * w) % 2) << endl;
}
Problem p02742 (C++)

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

using namespace std;

#define endl '\n'
#define ll long long

const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 5;
const double pi =
    3.1415926535897932384626433832795028841971693993751058209749445923078;
// iostream::sync_with_stdio(false);

int main() {
  int m[35] = {1, 1, 1, 2, 1, 2, 1, 5,  2, 2, 1, 5, 1, 2, 1, 14,
               1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int n;
  cin >> n;
  cout << m[n - 1] << endl;
  return 0;
}


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

using namespace std;

#define endl '\n'
#define ll long long

const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 5;
const double pi =
    3.1415926535897932384626433832795028841971693993751058209749445923078;
// iostream::sync_with_stdio(false);

int main() {
  ll n, m;
  cin >> n >> m;
  if (n == 1 || m == 1) {
    cout << 1 << endl;
  } else if (n % 2) {
    if (m % 2) {
      cout << (n + 1) / 2 * (m + 1) / 2 + (n / 2) * (m / 2);
    } else {
      cout << (n + 1) / 2 * (m / 2) + (n / 2) * (m / 2);
    }
  } else {
    cout << (n / 2) * m;
  }
  return 0;
}
Problem p02742 (Python)

Buggy submission (status: Runtime Error):
H, W = map(int, input().split())

if H == 1 or W == 1:
    print(1)
else:
    if (H * W) % 2 == 1:
        ans = H * W // 2 + 1
    else:
        ans = H * W // 2
print(ans)


Fixed submission:
H, W = map(int, input().split())

if H == 1 or W == 1:
    print(1)
else:
    if (H * W) % 2 == 1:
        ans = H * W // 2 + 1
    else:
        ans = H * W // 2
    print(ans)
Problem p02742 (C++)

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

int main() {

  unsigned long long int h, w;
  cin >> h >> w;
  unsigned long long int bh = 0;
  unsigned long long int sh = 0;
  if (h == 1 or w == 1) {
    return 1;
  }
  if (h & 1) {
    bh = (h / 2) + 1;
    sh = bh - 1;
  } else {
    bh = h / 2;
    sh = bh;
  }

  unsigned long long int total = 0;
  unsigned long long int half = w / 2;
  if (w & 1) {
    total = (half + 1) * bh + (half * sh);
  } else {
    total = half * bh + half * sh;
  }
  cout << total << endl;
  return 0;
}

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

int main() {

  unsigned long long int h, w;
  cin >> h >> w;
  unsigned long long int bh = 0;
  unsigned long long int sh = 0;
  if (h == 1 or w == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (h & 1) {
    bh = (h / 2) + 1;
    sh = bh - 1;
  } else {
    bh = h / 2;
    sh = bh;
  }

  unsigned long long int total = 0;
  unsigned long long int half = w / 2;
  if (w & 1) {
    total = (half + 1) * bh + (half * sh);
  } else {
    total = half * bh + half * sh;
  }
  cout << total << endl;
  return 0;
}
Problem p02742 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
// repマクロ定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロ定義
#define all(v) v.begin(), v.end()
using namespace std;

int main() {
  long long h, w, ans;
  cin >> h >> w;

  if (h == 1 || w == 1) {
    ans = 1;
  } else {
    ans = (h * w + 1) / 2;
  }

  cout << ans << endl;
  vector<vector<int>> cell(h, vector<int>(h));
}

Fixed submission:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
// repマクロ定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロ定義
#define all(v) v.begin(), v.end()
using namespace std;

int main() {
  long long h, w, ans;
  cin >> h >> w;

  if (h == 1 || w == 1) {
    ans = 1;
  } else {
    ans = (h * w + 1) / 2;
  }

  cout << ans << endl;
}
Problem p02742 (C++)

Buggy submission (status: Runtime Error):
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for (ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for (ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x) = ((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
  ll ret = 1;
  while (y-- > 0)
    ret *= x;
  return ret;
}

ll gcd(ll a, ll b) {
  assert(a >= 0);
  assert(b >= 0);
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll &x, ll &y) {
  x = 1;
  y = 0;
  assert(a >= 0);
  assert(b >= 0);
  if (b == 0)
    return a;
  ll X, Y;
  auto d = extgcd(b, a % b, X, Y);
  x = Y;
  y = X - (a / b) * Y;
  return d;
}

int run(istream &in, ostream &out) {
  ll H, W;
  in >> H >> W;
  if (H == 1 || W == 1)
    return 1;
  ll ans = 0;
  auto a = (W + 1) / 2;
  auto b = W / 2;
  ans = (H + 1) / 2 * a + H / 2 * b;
  out << ans << endl;
  return 0;
}

int main() { return run(cin, cout); }


Fixed submission:
// https://atcoder.jp/contests/abcXXX/tasks/abcXXX_x

#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll>;

static const ll INF = 1001001001;
static const ll LLINF = 1001001001001001001;

#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define RANGE(i, m, n) for (ll i = (m); i <= (n); ++i)
#define RRANGE(i, m, n) for (ll i = (m); i >= (n); --i)
#define POSITIVE(x) (x) = ((x) < 0) ? 0 : (x)

ll power(ll x, ll y) {
  ll ret = 1;
  while (y-- > 0)
    ret *= x;
  return ret;
}

ll gcd(ll a, ll b) {
  assert(a >= 0);
  assert(b >= 0);
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

ll extgcd(ll a, ll b, ll &x, ll &y) {
  x = 1;
  y = 0;
  assert(a >= 0);
  assert(b >= 0);
  if (b == 0)
    return a;
  ll X, Y;
  auto d = extgcd(b, a % b, X, Y);
  x = Y;
  y = X - (a / b) * Y;
  return d;
}

int run(istream &in, ostream &out) {
  ll H, W;
  in >> H >> W;
  if (H == 1 || W == 1) {
    out << 1 << endl;
    return 0;
  }
  ll ans = 0;
  auto a = (W + 1) / 2;
  auto b = W / 2;
  ans = (H + 1) / 2 * a + H / 2 * b;
  out << ans << endl;
  return 0;
}

int main() { return run(cin, cout); }
Problem p02742 (C++)

Buggy submission (status: Runtime Error):
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂

                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ

 */
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T, typename cmp=less<T>> using oset =tree<T, null_type,
// cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define mod 1000000007
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(), _x.end()
#define f first
#define s second
#define pb push_back
void mahakal() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif
}
int main() {
  mahakal(), fast;
  ll n, m;
  cin >> n >> m;
  ll ans = ceil(n * m / 2.0);
  cout << ans << endl;

  return 0;
}

Fixed submission:
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂

                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ

 */
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T, typename cmp=less<T>> using oset =tree<T, null_type,
// cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long
#define mod 1000000007
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(), _x.end()
#define f first
#define s second
#define pb push_back
void mahakal() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  freopen("error.txt", "w", stderr);
#endif
}
int main() {
  // mahakal(),fast;

  ll n, m, mm, nn;
  cin >> nn >> mm;
  if (nn == 1 || mm == 1) {
    cout << 1 << endl;
    return 0;
  }
  n = max(nn, mm);
  m = min(nn, mm);
  ll st = (n - 1) / 2 + 1;
  ll nd = (n - 2) / 2 + 1;
  ll ans = (ll)ceil(m / 2.0) * st + (m / 2) * nd;
  cout << ans << endl;

  return 0;
}
Problem p02742 (Python)

Buggy submission (status: Runtime Error):
import math

h, w = map(int, input().split())

if h == 1 or w == 1:
    print(1)
elif (h * w) % 2 == 0:
    ans = (h * w) // 2
else:
    ans = (h // 2) * w + math.ceil(w / 2)

print(ans)


Fixed submission:
import math

h, w = map(int, input().split())

if h == 1 or w == 1:
    ans = 1
elif (h * w) % 2 == 0:
    ans = (h * w) // 2
else:
    ans = (h // 2) * w + math.ceil(w / 2)

print(ans)
Problem p02742 (C++)

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

int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, s;
  cin >> n >> m;
  s = n * m;
  if (n == 1 or m == 1)
    return 1;
  cout << (s % 2 == 0 ? s / 2 : (s / 2) + 1);
  return 0;
}

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

int main() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  long long n, m, s;
  cin >> n >> m;
  s = n * m;
  if (n == 1 or m == 1)
    cout << 1;
  else
    cout << (s % 2 == 0 ? s / 2 : (s / 2) + 1);
  return 0;
}
Problem p02743 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using vi = vector<int>;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ld = long double;
const ld eps = 1.0e-9; // 許容される誤差

ld mysqrtl(ld x) {
  ld a = sqrt((double)x); // 近似値
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);
  return a;
}

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

  ld a, b, c;
  cin >> a >> b >> c;
  ld d = 2 * mysqrtl(a * b);
  if (a + b + d < c) {
    cout << "Yes"
         << "\n";
    return 0;
  } else {
    cout << "No"
         << "\n";
    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 vi = vector<int>;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
using ld = long double;
const ld eps = 1.0e-9; // 許容される誤差

ld mysqrtl(ld x) {
  ld a = sqrt((double)x); // 近似値
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);
  return a;
}

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

  ld a, b, c;
  cin >> a >> b >> c;
  ld eps = 1.0E-14;
  if (sqrt(a) + sqrt(b) + eps < sqrt(c)) {
    cout << "Yes"
         << "\n";
    return 0;
  } else {
    cout << "No"
         << "\n";
    return 0;
  }
}
Problem p02743 (Python)

Buggy submission (status: Runtime Error):
a, b, c = input().split()

if c - a - b > 0:
    if 4 * a * b < (c - a - b) ** 2:
        print("Yes")
    else:
        print("No")
else:
    print("No")


Fixed submission:
a, b, c = map(int, input().split())

if c - a - b > 0:
    if 4 * a * b < (c - a - b) ** 2:
        print("Yes")
    else:
        print("No")
else:
    print("No")
Problem p02743 (C++)

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

int main() {
  using namespace std;
  unsigned long a, b, c;
  cin >> a >> b >> c;
  unsigned long k{4 * a * b}, l{max(a + b, c) - min(a + b, c)};
  if (k == l * l)
    abort();
  puts(k < l * l ? "Yes" : "No");
  return 0;
}

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

int main() {
  using namespace std;
  unsigned long a, b, c;
  cin >> a >> b >> c;
  unsigned long k{4 * a * b}, l{c - a - b};
  puts(a + b < c && k < l * l ? "Yes" : "No");
  return 0;
}
Problem p02743 (C++)

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

int main() {
  ll a, b, c;
  cin >> a >> b >> c;

  auto f = [](long double d) {
    long double a = sqrt((double)d);
    do {
      a = (a + d / a) / 2.0L;
    } while (fabsl(d - a * a) > (long double)1.0e-9);
    return a;
  };

  long double x = f(a * b) * 2.0L;
  bool yes = x < (long double)(c - a - b);

  if (yes)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

int main() {
  ll a, b, c;
  cin >> a >> b >> c;

  long double x = sqrt((long double)(4 * a * b));
  bool yes = x < (long double)(c - a - b);

  if (yes)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
Problem p02743 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define fr(i, a, b) for (int i = a; i < b; i++)
#define bfr(i, a, b) for (int i = a; i >= b; i--)
#define fio                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL), cout.tie(NULL);
#define tc                                                                     \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define mod 1000000007
#define all(vec) vec.begin(), vec.end()
#define ld long double

int main() {

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  fio

      lli a,
      b, c;
  cin >> a >> b >> c;

  if (a >= c || b >= c)
    cout << "No";
  else if (2 * sqrtl(a * b) < c - b - a)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define fr(i, a, b) for (int i = a; i < b; i++)
#define bfr(i, a, b) for (int i = a; i >= b; i--)
#define fio                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL), cout.tie(NULL);
#define tc                                                                     \
  int t;                                                                       \
  cin >> t;                                                                    \
  while (t--)
#define mod 1000000007
#define all(vec) vec.begin(), vec.end()
#define ld long double

int main() {

  fio

      lli a,
      b, c;
  cin >> a >> b >> c;

  if (a >= c || b >= c)
    cout << "No";
  else if (2 * sqrtl(a * b) < c - b - a)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}
Problem p02743 (C++)

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

const long double eps = 1.0e-10;

long double mysqrt(long double x) {

  long double a = sqrt(x);
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);

  return a;
}

int main() {
  long double a, b, c;
  string ans;

  cin >> a >> b >> c;

  long double sqsum = mysqrt(a * b);

  if ((long double)(a + b) + 2 * sqsum < c) {
    ans = "Yes";
  }

  else
    ans = "No";

  cout << ans << endl;

  return 0;
}

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

const long double eps = 1.0e-10;

long double mysqrt(long double x) {

  long double a = sqrt(x);
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);

  return a;
}

int main() {
  long double a, b, c;
  string ans;

  cin >> a >> b >> c;

  long double sqsum = mysqrt(a) * mysqrt(b);

  if ((long double)(a + b) + 2 * sqsum < c) {
    ans = "Yes";
  }

  else
    ans = "No";

  cout << ans << endl;

  return 0;
}
Problem p02743 (C++)

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

int main() {
  int64_t a, b, c;
  cin >> a >> b >> c;
  if (a == b)
    cout << (2 * (a + b) < c ? "Yes" : "No") << '\n';
  assert(a == b);
  return 0;
}


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

int main() {
  int64_t a, b, c;
  cin >> a >> b >> c;
  if (a == b)
    cout << (2 * (a + b) < c ? "Yes" : "No") << '\n';
  else {
    if (2 * (a + b) <= c) {
      cout << "Yes" << '\n';
    } else {
      cout << (sqrt(a) + sqrt(b) < sqrt(c) ? "Yes" : "No") << '\n';
    }
  }
  return 0;
}
Problem p02743 (C++)

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

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define int long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;
typedef unordered_map<int, int> uoii;
typedef unordered_map<string, int> uosi;

const int MOD = 1e9 + 7;

const int INF = 1e10;

int32_t main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  IOS double x, y, z;
  cin >> x >> y >> z;
  double xx = 2 * sqrt(y * x);
  if (x + y + xx < z)
    cout << "Yes";
  else
    cout << "No";

  return 0;
}


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

#define IOS                                                                    \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define int long long int
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;
typedef unordered_map<int, int> uoii;
typedef unordered_map<string, int> uosi;

const int MOD = 1e9 + 7;

const int INF = 1e10;

int32_t main() {

  IOS int a, b, c;
  cin >> a >> b >> c;
  int d = c - a - b;
  if (d > 0 && 4 * a * b < (c - a - b) * (c - a - b)) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }

  return 0;
}
Problem p02743 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define N 100005
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
using namespace std;
ll a, b, c;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  freopen("C.inp", "r", stdin);
  freopen("C.out", "w", stdout);
  cin >> a >> b >> c;
  ll d = c - a - b;
  if (d > 0 && d * d > 4 * a * b)
    cout << "Yes";
  else
    cout << "No";
}


Fixed submission:
#include <bits/stdc++.h>
#define N 100005
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define ll long long
using namespace std;
ll a, b, c;

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

  cin >> a >> b >> c;
  ll d = c - a - b;
  if (d > 0 && d * d > 4 * a * b)
    cout << "Yes";
  else
    cout << "No";
}
Problem p02743 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
typedef long double ld;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define F first
#define S second

const int mx = 200010;
const ll mod = 1e9 + 7;

const ld eps = 1.0e-18; // 許容される誤差

ld mysqrtl(ld x) {
  ld a = sqrt((double)x); // 近似値
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);
  return a;
}

int main() {
  ld a, b, c;
  cin >> a >> b >> c;
  if (mysqrtl(a) + mysqrtl(b) < mysqrtl(c)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
typedef long double ld;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define F first
#define S second

const int mx = 200010;
const ll mod = 1e9 + 7;

const ld eps = 1.0e-18; // 許容される誤差

ld mysqrtl(ld x) {
  ld a = sqrt((double)x); // 近似値
  do {
    a = (a + x / a) / 2.0L;
  } while (fabsl(x - a * a) > eps);
  return a;
}

int main() {
  ld a, b, c;
  cin >> a >> b >> c;
  if (a + 2 * sqrt(a * b) + b < c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
Problem p02744 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x);
#define scs(x) scanf("%s", x);
#define scl(x) scanf("%lld", &x);
#define rep(i, s, e) for (int i = s; i <= e; ++i)
#define dep(i, s, e) for (int i = s; i >= e; --i)
typedef long long ll;
using namespace std;
int end, k;
char s[100];
void solve(int end) {
  char v = 'a';
  rep(i, 1, end - 1) if (v < s[i]) v = s[i];
  rep(i, 0, v - 'a' + 1) {
    s[end] = 'a' + i;
    if (end == k)
      pf("%s\n", s + 1);
    else
      solve(end + 1);
  }
}
int main() {
  sc(k);
  s[1] = 'a';
  solve(2);
}

Fixed submission:
#include <bits/stdc++.h>
#define pf printf
#define sc(x) scanf("%d", &x);
#define scs(x) scanf("%s", x);
#define scl(x) scanf("%lld", &x);
#define rep(i, s, e) for (int i = s; i <= e; ++i)
#define dep(i, s, e) for (int i = s; i >= e; --i)
typedef long long ll;
using namespace std;
int end, k;
char s[100];
void solve(int end) {
  char v = 'a';
  rep(i, 1, end - 1) if (v < s[i]) v = s[i];
  rep(i, 0, v - 'a' + 1) {
    s[end] = 'a' + i;
    if (end == k)
      pf("%s\n", s + 1);
    else
      solve(end + 1);
  }
}
int main() {
  sc(k);
  s[1] = 'a';
  if (k == 1) {
    pf("%s\n", s + 1);
    return 0;
  }
  solve(2);
}
Problem p02744 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int N;
void dfs(string s) {
  if (s.length() == N) {
    cout << s << endl;
    return;
  }
  char moji = 'a';
  for (char c : s) {
    moji = max(c, moji);
  }

  for (char str = 'a'; str <= moji + 1; str++) {
    s += str;
    dfs(s);
  }
}
int main() {
  cin >> N;
  string s = "a";
  dfs(s);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int N;
void dfs(string s) {
  if (s.length() == N) {
    cout << s << endl;
    return;
  }
  char moji = 'a';
  for (char c : s) {
    moji = max(c, moji);
  }

  for (char str = 'a'; str <= moji + 1; str++) {

    dfs(s + str);
  }
}
int main() {
  cin >> N;
  string s = "a";
  dfs(s);
  return 0;
}
Problem p02744 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;

ll mod(ll a, ll b) {
  ll ret = a % b;
  if (ret < 0)
    ret += b;
  return ret;
}

ll modpow(ll a, ll b, ll c) {
  ll res = 1;
  while (b > 0) {
    if (b & 1)
      res = mod(res * a, c);
    a = mod(a * a, c);
    b >>= 1;
  }
  return res;
}

void dfs(char c, int n, string s) {
  if (s.size() == n) {
    cout << s << endl;
  }
  for (char h = 'a'; h <= (c - 'a') + 1 + 'a'; h = h - 'a' + 1 + 'a') {
    if (h < (c - 'a') + 1 + 'a')
      dfs(c, n, s + h);
    else
      dfs(c + 1, n, s + h);
  }
}

int main() {
  int n;
  cin >> n;
  dfs('a', n, "a");
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;

ll mod(ll a, ll b) {
  ll ret = a % b;
  if (ret < 0)
    ret += b;
  return ret;
}

ll modpow(ll a, ll b, ll c) {
  ll res = 1;
  while (b > 0) {
    if (b & 1)
      res = mod(res * a, c);
    a = mod(a * a, c);
    b >>= 1;
  }
  return res;
}

void dfs(char c, int n, string s) {
  if (s.size() == n) {
    cout << s << endl;
  } else {
    for (char h = 'a'; h <= (c - 'a') + 1 + 'a'; h = (h - 'a') + 1 + 'a') {
      if (h < (c - 'a') + 1 + 'a')
        dfs(c, n, s + h);
      else
        dfs(c + 1, n, s + h);
    }
  }
}

int main() {
  int n;
  cin >> n;
  dfs('a', n, "a");
  return 0;
}
Problem p02744 (C++)

Buggy submission (status: Runtime Error):

#include <bits/stdc++.h>

#define endl '\n'

using namespace std;
string s = "";
int dfs(int n, int mask) {
  if (n == 0) {
    cout << s << endl;

  } else {
    int i;
    for (i = 0; i < 26; i++) {
      if (mask & (1 << i)) {
        s += string(1, i + 'a');
        dfs(n - 1, mask);
        s.pop_back();
      } else {
        break;
      }
    }

    s += string(1, i + 'a');
    dfs(n - 1, mask | (1 << i));
    s.pop_back();
  }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);

  freopen("INPUT.txt", "r", stdin);
  freopen("OUTPUT.txt", "w", stdout);
  freopen("OUTPUT_ERROR.txt", "w", stderr);
  int n;
  cin >> n;
  dfs(n, 0);
}


Fixed submission:

#include <bits/stdc++.h>

#define endl '\n'

using namespace std;
string s = "";
int dfs(int n, int mask) {
  if (n == 0) {
    cout << s << endl;

  } else {
    int i;
    for (i = 0; i < 26; i++) {
      if (mask & (1 << i)) {
        s += string(1, i + 'a');
        dfs(n - 1, mask);
        s.pop_back();
      } else {
        break;
      }
    }

    s += string(1, i + 'a');
    dfs(n - 1, mask | (1 << i));
    s.pop_back();
  }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  if (fopen("INPUT.txt", "r")) {
    freopen("INPUT.txt", "r", stdin);
    freopen("OUTPUT.txt", "w", stdout);
    freopen("OUTPUT_ERROR.txt", "w", stderr);
  }
  int n;
  cin >> n;
  dfs(n, 0);
}
Problem p02744 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const ll maxn = 1e6 + 5;

int n, a[100];

void dfs(int p, int lim) {
  if (p == n + 1) {
    for (int i = 1; i <= n; i++) {
      cout << char(a[i] + 'a' - 1);
    }
    cout << endl;
  }
  for (int i = 1; i <= lim; i++) {
    a[p] = i;
    dfs(p + 1, lim + (i == lim));
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  dfs(1, 1);
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const ll maxn = 1e6 + 5;

int n, a[100];

void dfs(int p, int lim) {
  if (p == n + 1) {
    for (int i = 1; i <= n; i++) {
      cout << char(a[i] + 'a' - 1);
    }
    cout << endl;
    return;
  }
  for (int i = 1; i <= lim; i++) {
    a[p] = i;
    dfs(p + 1, lim + (i == lim));
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  dfs(1, 1);
  return 0;
}
Problem p02744 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

long long int dfs(std::string &S, long long int N, char tmpmax,
                  long long int i) {

  // if last letter
  if (i == N - 1) {
    for (char ctmp = 'a'; (int)ctmp <= (int)tmpmax + 1; ctmp++) {
      S[i] = ctmp;
      std::cout << S << std::endl;
    }
    return 0;
  }

  // other cases
  for (char ctmp = 'a'; ctmp <= tmpmax; ctmp++) {
    S[i] = ctmp;
    dfs(S, N, tmpmax, i + 1);
  }
  S[i] = tmpmax + 1;
  dfs(S, N, (char)((int)tmpmax + 1), i + 1);

  return 0;
}

int main() {

  long long int N;
  std::cin >> N;

  std::string S(N, 'a');
  std::cerr << S << std::endl;
  dfs(S, N, 'a', 1);

  return 0;
}


Fixed submission:
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

long long int dfs(std::string &S, long long int N, char tmpmax,
                  long long int i) {

  // if last letter
  if (i == N - 1) {
    for (char ctmp = 'a'; (int)ctmp <= (int)tmpmax + 1; ctmp++) {
      S[i] = ctmp;
      std::cout << S << std::endl;
    }
    return 0;
  }

  // other cases
  for (char ctmp = 'a'; ctmp <= tmpmax; ctmp++) {
    S[i] = ctmp;
    dfs(S, N, tmpmax, i + 1);
  }
  S[i] = tmpmax + 1;
  dfs(S, N, (char)((int)tmpmax + 1), i + 1);

  return 0;
}

int main() {

  long long int N;
  std::cin >> N;

  std::string S(N, 'a');
  std::cerr << S << std::endl;
  if (N == 1) {
    std::cout << "a" << std::endl;
  } else {
    dfs(S, N, 'a', 1);
  }

  return 0;
}
Problem p02744 (C++)

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

void f(int n, int now, int nmax);

string ans = "a";

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

  f(n, 1, 0);
}

void f(int n, int now, int nmax) {
  if (now == n - 1) {
    int i = 0;
    while (i <= nmax + 1) {
      ans += 'a' + i;
      cout << ans << endl;
      ans = ans.substr(0, now);
      i++;
    }
  } else {
    int j = 0;
    int nmaxnow = nmax;
    while (j <= nmax + 1) {
      ans += 'a' + j;
      if (j == nmax + 1)
        f(n, now + 1, j);
      else
        f(n, now + 1, nmax);
      ans = ans.substr(0, now);
      j++;
    }
  }
  return;
}

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

void f(int n, int now, int nmax);

string ans = "a";

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

  if (n != 1)
    f(n, 1, 0);
  else
    cout << 'a' << endl;
}

void f(int n, int now, int nmax) {
  if (now == n - 1) {
    int i = 0;
    while (i <= nmax + 1) {
      ans += 'a' + i;
      cout << ans << endl;
      ans = ans.substr(0, now);
      i++;
    }
  } else {
    int j = 0;
    int nmaxnow = nmax;
    while (j <= nmax + 1) {
      ans += 'a' + j;
      if (j == nmax + 1)
        f(n, now + 1, j);
      else
        f(n, now + 1, nmax);
      ans = ans.substr(0, now);
      j++;
    }
  }
  return;
}