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

#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define ll long long
#define PII pair<ll, pair<ll, ll>>
#define print(arr, s, n)                                                       \\
  for (int i = s; i < n; ++i)                                                  \\
    cout << arr[i] << " ";                                                     \\
  cout << endl;

using namespace std;
int gcd(int a, int b) {
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

int main() {

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

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  int ans = 1;
  long long s = n;
  while (s % 360 != 0) {
    // cout<<n<<endl;
    s += n;
    ans++;
  }
  cout << ans;
  return 0;
}

Error: WA

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define ll long long
#define PII pair<ll, pair<ll, ll>>
#define print(arr, s, n)                                                       \\
  for (int i = s; i < n; ++i)                                                  \\
    cout << arr[i] << " ";                                                     \\
  cout << endl;

using namespace std;

int main() {

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

  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cout << 360 / n;
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod = 1e9 + 7;
void solve() {
  ll N;
  cin >> N;
  ll i = 1;
  while (1) {
    if ((i * 360) % N == 0) {
      cout << (i * 360) / N << "\\n";
      return;
    }
    i++;
  }
  cout << "-1\\n";
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  exit(0);
} /*Solved By:- Ritik Agarwal*/

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod = 1e9 + 7;
void solve() {
  ll N;
  cin >> N;
  ll i = 1;
  while (i <= 360) {
    if ((i * 360) % N == 0) {
      cout << (i * 360) / N << "\\n";
      return;
    }
  }
  cout << "-1\\n";
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  exit(0);
} /*Solved By:- Ritik Agarwal*/
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

#define endl '\\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <typename T> static T randint(T lo, T hi) {
  return uniform_int_distribution<T>(lo, hi)(rng);
}

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

  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

  ll n;
  cin >> n;

  cout << (360 / __gcd(n, 360ll)) << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

#define endl '\\n'

typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <typename T> static T randint(T lo, T hi) {
  return uniform_int_distribution<T>(lo, hi)(rng);
}

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

  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);

  ll x;
  cin >> x;

  x = 180 - x;

  for (ll n = 3;; n++) {
    ll t = 180 * (n - 2) / n;

    // cerr << t << " angle" << endl;
    if (t == x) {
      cout << n << endl;
      return 0;
    }
  }

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

#include <iostream>
#include <vector>

using namespace std;

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

  int A = 360;
  int B = X;
  int x;

  while (1) {
    int q = A / B;
    int r = A % B;

    if (r == 0) {
      x = B;
      break;
    } else {
      A = B;
      B = r;
    }
  }

  cout << 360 / x << endl;

  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>
#include <vector>

using namespace std;

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

  vector<int> cos_x(180, 0); // cos_x[i] = cos(i/180*pi) weight
  vector<int> sin_x(180, 0); // sin_x[i] = sin(i/180*pi) weight

  // n = 0;
  int n = 0;
  while (1) {
    int t = (n * X) % 360;

    if (t < 180) {
      ++cos_x[t];
      ++sin_x[t];
    } else {
      t %= 180;
      --cos_x[t];
      --sin_x[t];
    }

    cos_x[90] = 0;
    sin_x[0] = 0;

    int flag = 1;
    for (int i = 0; i < 180; ++i) {
      if ((cos_x[i] != 0) || (sin_x[i] != 0)) {
        flag = 0;
        break;
      }
    }

    if (flag == 1) {
      cout << (n + 1) << endl;
      return 0;
    }
    ++n;
  }

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

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

int main() {
  int x;
  cin >> x;
  for (int i = 1; i < 180; i++) {
    if (360 * i % x == 0) {
      cout << 360 * i / x << endl;
      break;
    }
  }
}

Error: 0

Fixed submission:

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

int main() {
  int x;
  cin >> x;
  int i = 1;
  while (i < 180) {
    if (360 % x == 0)
      break;
    x *= i;
    i++;
  }
  cout << 360 / x << endl;
}
Problem p02633 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
int sum = 1, x, y, c[200], k[200], t[200];
signed main() {
  scanf("%lld", &x);
  y = x;
  c[2] = 3, c[3] = 2, c[5] = 1;
  for (int i = 2; i <= x; ++i) {
    if (!k[i]) {
      while (x % i == 0)
        x /= i, ++t[i];
    }
    for (int j = i + i; j <= x; j += i)
      k[j] = 1;
  }
  for (int i = 1; i < 200; ++i) {
    for (int j = 1; j <= max(c[i], t[i]); ++j)
      sum *= i;
  }
  return printf("%lld\\n", sum / y), 0;
}

Error: 2

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define int long long
int sum = 1, x, y, c[200], k[200], t[200];
signed main() {
  scanf("%lld", &x);
  y = x;
  c[2] = 3, c[3] = 2, c[5] = 1;
  for (int i = 2; i <= x; ++i) {
    if (!k[i]) {
      while (x % i == 0)
        x /= i, ++t[i];
    }
    for (int j = i + i; j <= x; j += i)
      k[j] = 1;
  }
  for (int i = 1; i <= 200; ++i) {
    for (int j = 1; j <= max(c[i], t[i]); ++j)
      sum *= i;
  }
  return printf("%lld\\n", sum / y);
}
Problem p02633 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <chrono>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define REP(i, a, b) for (ll i = a; i > b; i--)
#define CST(x) cout << fixed << setprecision(x) // 小数点以下の桁数指定
#define ct(a) cout << a << endl
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repl(i, l, r) for (int i = (1); i < (r); i++)
#define per(i, n) for (int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

ll mod_pow(ll x, ll n) {
  if (n == 0)
    return 1;
  ll res = mod_pow(x * x % mod, n / 2);
  if (n & 1)
    res = res * x % mod;
  return res;
}

int main() {

  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  ll X, ans = 0;
  cin >> X;

  FOR(i, 1, 10000) {
    if ((360 * i) % X == 0) {
      ans = 360 * i / X;
      break;
    }
  }
  cout << ans << endl;

  return 0;
}


Error: -11

Fixed submission:

#include <algorithm>
#include <chrono>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <string>
#include <time.h>
#include <tuple>
#include <vector>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define REP(i, a, b) for (ll i = a; i > b; i--)
#define CST(x) cout << fixed << setprecision(x) // 小数点以下の桁数指定
#define ct(a) cout << a << endl
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repl(i, l, r) for (int i = (1); i < (r); i++)
#define per(i, n) for (int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = 1e9 + 7;
const ll mod = 1e9 + 7;

ll mod_pow(ll x, ll n) {
  if (n == 0)
    return 1;
  ll res = mod_pow(x * x % mod, n / 2);
  if (n & 1)
    res = res * x % mod;
  return res;
}

ll dp[3000][3000];

int main() {

  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);

  ll A, B, C, D;
  cin >> A >> B >> C >> D;

  dp[A - 1][B - 1] = 1;
  FOR(i, A, C) { dp[i][B - 1] = (dp[i - 1][B - 1] * B) % MOD; }
  FOR(i, B, D) { dp[A - 1][i] = (dp[A - 1][i - 1] * A) % MOD; }

  FOR(i, A, C) FOR(j, B, D) {
    dp[i][j] =
        ((dp[i - 1][j] * (j + 1)) % MOD + (dp[i][j - 1] * (i + 1)) % MOD -
         (dp[i - 1][j - 1] * i * j) % MOD) %
        MOD;
  }
  cout << (dp[C - 1][D - 1] + MOD) % MOD << endl;

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

#pragma GCC optimize("Ofast", 3, "inline")
#include <bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int>> min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int mon[20] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
ll gcd(ll x, ll y) { return ((y == 0) ? x : gcd(y, x % y)); }
int x;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //	freopen(".in","r",stdin);
  //	freopen(".out","w",stdout);
  cin >> x;
  for (int i = 1; i <= 3333; i++)
    if ((i * x) % 360 == 0) {
      cout << i << '\\n';
      return 0;
    }
  return 0;
}


Error: TLE

Fixed submission:

#pragma GCC optimize("Ofast", 3, "inline")
#include <bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int>> min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int mon[20] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
ll gcd(ll x, ll y) { return ((y == 0) ? x : gcd(y, x % y)); }
int X, i, k, n = 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //	freopen(".in","r",stdin);
  //	freopen(".out","w",stdout);

  cin >> X;
  for (i = 1;; i++) {
    k = (360 * n) / X;
    if (k * X == 360)
      break;
    else
      n += 1;
  }
  cout << k;
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
inline int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  int n;
  cin >> n;
  cout << 360 / gcd(n, 360) << endl;
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
namespace IO {
template <typename T> inline void read(T &x) {
  int f = 1;
  x = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-')
      f = -1;
  for (; isdigit(c); c = getchar())
    x = (x << 3) + (x << 1) + (c ^ 48);
  x *= f;
}

template <typename T> inline void chkmax(T &x, T y) { x = x > y ? x : y; }
template <typename T> inline void chkmin(T &x, T y) { x = x < y ? x : y; }

template <typename T> inline void write(T x) {
  if (x < 0)
    putchar('-'), x = -x;
  if (x > 9)
    write(x / 10);
  putchar(x % 10 + '0');
}
template <typename T> inline void writesp(T x) {
  write(x);
  putchar(' ');
}
template <typename T> inline void writeln(T x) {
  write(x);
  putchar('\\n');
}
} // namespace IO
using namespace IO;
int main() {
  int n;
  cin >> n;
  if (360 % n == 0)
    cout << 360 / n << endl;
  else
    while (1)
      cout << 1 << endl;
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

int main() {
  int x;
  scanf("%d", &x);
  for (int i = 1; i <= 10000000; ++i)
    if (x * i % 360 == 0)
      return printf("%d\\n", i), 0;
  return 0;
}

Error: 2

Fixed submission:

#include <bits/stdc++.h>

int main() {
  int x;
  scanf("%d", &x);
  for (int i = 1; i <= 10000000; ++i)
    if (x * i % 360 == 0)
      return printf("%d\\n", i);
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

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

typedef long long ll;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const ll inff = 1e18;
const ll mod = 1e9 + 7;
#define pii pair<int, int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
// #define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\\n'
#define IOS                                                                    \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);
#endif // HNO2

int32_t main() {
  IOS int x;
  cin >> x;
  cout << 360 / __gcd(x, 360) << endl;
}


Error: TLE

Fixed submission:

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

typedef long long ll;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const ll inff = 1e18;
const ll mod = 1e9 + 7;
#define pii pair<int, int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
// #define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\\n'
#define IOS                                                                    \\
  ios::sync_with_stdio(0);                                                     \\
  cin.tie(0);
#endif // HNO2

int32_t main() {
  IOS int x;
  cin >> x;
  multiset<int> s;
  int now = 0;
  for (int i = 1;; i++) {
    int tmp = (now >= 180 ? now - 180 : now + 180);
    if (s.find(tmp) != s.end())
      s.erase(s.find(tmp));
    else
      s.insert(now);
    if (sz(s) == 0) {
      cout << i << endl;
      return 0;
    }
    now = (now + x) % 360;
  }
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(), x.end()
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <typename T> T ceil(T a, T b) { return a / b + !!(a % b); }

ll x;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> x;
  int k = 1;
  while (x * k % 360 != 0)
    k++;
  cout << k << endl;
  // cout<<solve()<<endl;
  return 0;
}

Error: TLE

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>;
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(x) x.begin(), x.end()
template <typename T>
using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <typename T> T ceil(T a, T b) { return a / b + !!(a % b); }

int x;
ll solve() {
  ll ans = 0;

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

  cin >> x;
  int ans = 0;
  int angle = 180;
  while (angle % x != 0)
    angle += 360;
  ans = angle * 2 / x;
  cout << ans << endl;
  // cout<<solve()<<endl;
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <iostream>

using namespace std;

int main() {
  // cout << "Hello World" << endl;
  int X, i, k, n = 1;
  cin >> X;
  for (i = 1; n <= X; i++) {
    k = (360 * n) / X;
    if (k * X == 360 * n)
      break;
    else
      n += 1;
  }
  cout << k;
  return 0;
}

Error: TLE

Fixed submission:

#include <iostream>

using namespace std;

int main() {
  // cout << "Hello World" << endl;
  int X, i, k, n = 1;
  cin >> X;
  for (i = 1;; i++) {
    k = (360 * n) / X;
    if (k * X == 360)
      break;
    else
      n += 1;
  }
  cout << k;
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

/*
        Name:
        Author: xiaruize
        Date:
*/
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i, j, n) for (int i = int(j); i <= int(n); i++)
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define pis pair<int, string>
#define sec second
#define sz(a) int((a).size())

inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = x * 10 + (ch ^ 48), ch = getchar();
  return x * f;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  // freopen(".in","r",stdin);
  // freopen(".out","w",stdout);
  int x;
  cin >> x;
  cout << 360 / __gcd(360, x) << endl;
  return 0;
}


Error: TLE

Fixed submission:

/*
        Name:
        Author: xiaruize
        Date:
*/
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i, j, n) for (int i = int(j); i <= int(n); i++)
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
#define pis pair<int, string>
#define sec second
#define sz(a) int((a).size())

inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-')
      f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = x * 10 + (ch ^ 48), ch = getchar();
  return x * f;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  // freopen(".in","r",stdin);
  // freopen(".out","w",stdout);
  int x;
  cin >> x;
  int i = 1;
  while (1) {
    if (i * 360 % x == 0) {
      cout << i * 360 / x << endl;
      return 0;
    }
  }
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int t;
  t = 1;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    for (int j = 1; j < 100000001; j++) {
      ll x = j * n;
      if (x % 360 == 0) {
        cout << j;
        break;
      }
    }
  }
  return 0;
}

Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  int t;
  t = 1;
  for (int i = 0; i < t; i++) {
    int n;
    cin >> n;
    //  cout<<n<<"\\n";
    int x = 0;
    int turns = 0;
    while (1) {
      int z = (360 + x) / n;
      int y = 360 - z * n;
      turns += z;
      if (y == 0) {
        cout << turns << "\\n";
        break;
      }
    }
  }
  return 0;
}
Problem p02633 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <bits/stdc++.h>
using namespace std;
int main() {
  int X, A;
  int counter = 1;
  cin >> X;
  int K = 360 / X;
  if (360 % X == 0)
    cout << K << endl;
  else {
    while (true) {
      counter++;
      if ((counter * 360) % X == 0) {
        cout << (counter * 360) / X << endl;
        break;
      }
    }
  }
}


Error: TLE

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
int main() {
  int X, A;
  int counter = 1;
  cin >> X;
  int K = 360 / X;
  if (360 % X == 0)
    cout << K << endl;
  else {
    while (true) {
      counter++;
      if ((counter * 360) % X == 0) {
        cout << counter * K << endl;
      }
    }
  }
}
Problem p02633 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = -1; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if (a < b)
    return euclidean_gcd(b, a);
  unsigned r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  return b;
}

ll lcm(ll a, ll b) {
  ll c = euclidean_gcd(a, b);
  return a / c * b;
}

int main() {

  ll x;

  cin >> x;

  ll ans = lcm(360, x);
  ans /= x;

  cout << ans << endl;

  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <stdio.h>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n) for (int i = -1; i < (n); i++)
#define PI 3.141592653589793

using namespace std;
using ll = unsigned long long;

ll gcd(ll a, ll b) {
  if (a < b)
    swap(a, b);
  if (a % b == 0) {
    return b;
  } else {
    gcd(b, a % b);
  }
}

ll lcm(ll a, ll b) {
  ll c = gcd(a, b);
  return a / c * b;
}

int main() {

  ll x;

  cin >> x;

  ll ans = lcm(360, x);
  ans /= x;

  cout << ans << endl;

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

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

int main() {
  int x;
  cin >> x;
  int y = 360;
  while (true) {
    if (y % x == 0) {
      cout << y / x << endl;
      return 0;
    }
    y += 360;
  }
}


Error: WA

Fixed submission:

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

int main() {
  int x;
  int y = 360;
  while (true) {
    if (y % x == 0) {
      cout << y / x << endl;
      return 0;
    }
    y += 360;
  }
}
Problem p02633 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int X;
  int K;
  cin >> X;
  // Xto360nosaishoukoubasisu
  int ans;
  for (int i = 1; i <= 180; i++) {
    ans = i * 360;
    if (ans % X == 0) {
      break;
    }
  }
  cout << ans / X << endl;
}


Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int main(void) {
  // Your code here!
  int X;
  int K;
  cin >> X;
  cout << 360 / K << endl;
}