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

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007

struct edge {
  ll to, a;
};

int main() {

  int n, m, s, t;
  scanf("%d %d %d %d", &n, &m, &s, &t);
  s--, t--;
  vector<vector<edge>> v(n), w(n);
  rep(i, m) {
    ll u, u_, a, b;
    scanf("%lld %lld %lld %lld", &u, &u_, &a, &b);
    u--, u_--;
    v[u].push_back({u_, a});
    v[u_].push_back({u, a});
    w[u].push_back({u_, b});
    w[u_].push_back({u, b});
  }
  vector<ll> yen(n, 1e18);
  vector<ll> snuuk(n, 1e18);
  auto dijkstra = [](vector<vector<edge>> &v, vector<ll> &d, int s) {
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, less<pair<ll, ll>>> que;
    que.push(make_pair(0, s));
    d[s] = 0;
    while (!que.empty()) {
      pair<ll, ll> ov = que.top();
      que.pop();
      if (ov.first > d[ov.second])
        continue;
      for (auto nv : v[ov.second]) {
        if (d[nv.to] <= d[ov.second] + nv.a)
          continue;
        d[nv.to] = d[ov.second] + nv.a;
        que.push(make_pair(d[nv.to], nv.to));
      }
    }
  };
  dijkstra(v, yen, s);
  dijkstra(w, snuuk, t);
  multiset<ll> st;
  rep(i, n) st.insert(yen[i] + snuuk[i]);
  rep(i, n) {
    cout << (ll)1e15 - (*st.begin()) << endl;
    st.erase(st.find(yen[i] + snuuk[i]));
  }

  return 0;
}

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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007

struct edge {
  ll to, a;
};

int main() {

  int n, m, s, t;
  scanf("%d %d %d %d", &n, &m, &s, &t);
  s--, t--;
  vector<vector<edge>> v(n), w(n);
  rep(i, m) {
    ll u, u_, a, b;
    scanf("%lld %lld %lld %lld", &u, &u_, &a, &b);
    u--, u_--;
    v[u].push_back({u_, a});
    v[u_].push_back({u, a});
    w[u].push_back({u_, b});
    w[u_].push_back({u, b});
  }
  vector<ll> yen(n, 1e18);
  vector<ll> snuuk(n, 1e18);
  auto dijkstra = [](vector<vector<edge>> &v, vector<ll> &d, int s) {
    priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
        que;
    que.push(make_pair(0, s));
    d[s] = 0;
    while (!que.empty()) {
      pair<ll, ll> ov = que.top();
      que.pop();
      if (ov.first > d[ov.second])
        continue;
      for (auto nv : v[ov.second]) {
        if (d[nv.to] <= d[ov.second] + nv.a)
          continue;
        d[nv.to] = d[ov.second] + nv.a;
        que.push(make_pair(d[nv.to], nv.to));
      }
    }
  };
  dijkstra(v, yen, s);
  dijkstra(w, snuuk, t);
  multiset<ll> st;
  rep(i, n) st.insert(yen[i] + snuuk[i]);
  rep(i, n) {
    cout << (ll)1e15 - (*st.begin()) << endl;
    st.erase(st.find(yen[i] + snuuk[i]));
  }

  return 0;
}
Problem p03305 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <limits>
#include <queue>
#include <unordered_map>
#include <vector>

using Graph_t = std::vector<std::unordered_map<size_t, size_t>>;

constexpr size_t INF = std::numeric_limits<size_t>::max() / 2;

std::vector<size_t> calc_fare(Graph_t const &g, size_t start) {
  std::vector<size_t> ret(g.size(), INF);
  std::priority_queue<std::pair<size_t, size_t>> que;

  ret[start] = 0;
  que.emplace(0, start);

  while (!que.empty()) {
    size_t fare, u;
    std::tie(fare, u) = que.top();
    que.pop();

    if (fare > ret[u])
      continue;

    for (auto const &p : g[u]) {
      size_t v, f;
      std::tie(v, f) = p;
      auto new_f = fare + f;

      if (new_f < ret[v]) {
        ret[v] = new_f;
        que.emplace(new_f, v);
      }
    }
  }

  return ret;
}

int main() {
  size_t n, m, s, t;
  std::cin >> n >> m >> s >> t;
  s--;
  t--;

  Graph_t g_y(n);
  Graph_t g_s(n);

  for (size_t i = 0; i < m; i++) {
    size_t u, v, a, b;
    std::cin >> u >> v >> a >> b;
    u--;
    v--;
    g_y[u].emplace(v, a);
    g_s[u].emplace(v, b);
    g_y[v].emplace(u, a);
    g_s[v].emplace(u, b);
  }

  auto f_y = calc_fare(g_y, s);
  auto f_s = calc_fare(g_s, t);

  std::vector<size_t> anss(n);
  auto f_min = f_y[n - 1] + f_s[n - 1];
  for (ssize_t i = n - 1; i >= 0; i--) {
    f_min = std::min(f_min, f_y[i] + f_s[i]);
    anss[i] = 1'000'000'000'000'000 - f_min;
  }

  for (auto ans : anss) {
    std::cout << ans << '\n';
  }

  return 0;
}


Fixed submission:
#include <iostream>
#include <limits>
#include <queue>
#include <unordered_map>
#include <vector>

using Graph_t = std::vector<std::unordered_map<size_t, size_t>>;

constexpr size_t INF = std::numeric_limits<size_t>::max() / 2;

std::vector<size_t> calc_fare(Graph_t const &g, size_t start) {
  std::vector<size_t> ret(g.size(), INF);
  using P = std::pair<size_t, size_t>;
  std::priority_queue<P, std::vector<P>, std::greater<P>> que;

  ret[start] = 0;
  que.emplace(0, start);

  while (!que.empty()) {
    size_t fare, u;
    std::tie(fare, u) = que.top();
    que.pop();

    if (fare > ret[u])
      continue;

    for (auto const &p : g[u]) {
      size_t v, f;
      std::tie(v, f) = p;
      auto new_f = fare + f;

      if (new_f < ret[v]) {
        ret[v] = new_f;
        que.emplace(new_f, v);
      }
    }
  }

  return ret;
}

int main() {
  size_t n, m, s, t;
  std::cin >> n >> m >> s >> t;
  s--;
  t--;

  Graph_t g_y(n);
  Graph_t g_s(n);

  for (size_t i = 0; i < m; i++) {
    size_t u, v, a, b;
    std::cin >> u >> v >> a >> b;
    u--;
    v--;
    g_y[u].emplace(v, a);
    g_s[u].emplace(v, b);
    g_y[v].emplace(u, a);
    g_s[v].emplace(u, b);
  }

  auto f_y = calc_fare(g_y, s);
  auto f_s = calc_fare(g_s, t);

  std::vector<size_t> anss(n);
  auto f_min = f_y[n - 1] + f_s[n - 1];
  for (ssize_t i = n - 1; i >= 0; i--) {
    f_min = std::min(f_min, f_y[i] + f_s[i]);
    anss[i] = 1'000'000'000'000'000 - f_min;
  }

  for (auto ans : anss) {
    std::cout << ans << '\n';
  }

  return 0;
}
Problem p03305 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge {
  ll to, cost;
};
const ll INF = 100000000000000000;
ll n, m, s, t, u, v, a, b;

ll V;
vector<edge> G[2][100000];
ll d[2][100000];
ll mini[100000];

void dijkstra(int num, int start) {
  for (ll i = 0; i < n; i++)
    d[num][i] = INF;
  d[num][start] = 0;
  priority_queue<P> que;
  que.push(P(0, start));
  while (!que.empty()) {
    P p = que.top();
    que.pop();
    ll cost = p.first, from = p.second;
    if (d[num][from] < cost)
      continue;
    for (ll i = 0; i < G[num][from].size(); i++) {
      edge e = G[num][from][i];
      ll to = e.to, newcost = cost + e.cost;
      if (d[num][to] > newcost) {
        d[num][to] = newcost;
        que.push(P(newcost, to));
      }
    }
  }
}

int main() {
  scanf("%lld%lld%lld%lld", &n, &m, &s, &t);
  s--;
  t--;
  for (ll i = 0; i < m; i++) {
    scanf("%lld%lld%lld%lld", &u, &v, &a, &b);
    u--;
    v--;
    edge e1, e2, e3, e4;
    e1.to = v, e2.to = u;
    e1.cost = e2.cost = a;
    G[0][u].push_back(e1), G[0][v].push_back(e2);
    e3.to = v, e4.to = u;
    e3.cost = e4.cost = b;
    G[1][u].push_back(e3), G[1][v].push_back(e4);
  }
  dijkstra(0, s);
  dijkstra(1, t);
  for (ll i = 0; i < n; i++)
    mini[i] = d[0][i] + d[1][i];
  for (ll i = n - 2; i >= 0; i--)
    mini[i] = min(mini[i], mini[i + 1]);
  for (ll i = 0; i < n; i++)
    printf("%lld\n", 1000000000000000 - mini[i]);
}


Fixed submission:
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
struct edge {
  ll to, cost;
};
const ll INF = 100000000000000000;
ll n, m, s, t, u, v, a, b;

ll V;
vector<edge> G[2][100000];
ll d[2][100000];
ll mini[100000];

void dijkstra(int num, int start) {
  for (ll i = 0; i < n; i++)
    d[num][i] = INF;
  d[num][start] = 0;
  priority_queue<P, vector<P>, greater<P>> que;
  que.push(P(0, start));
  while (!que.empty()) {
    P p = que.top();
    que.pop();
    ll cost = p.first, from = p.second;
    if (d[num][from] < cost)
      continue;
    for (ll i = 0; i < G[num][from].size(); i++) {
      edge e = G[num][from][i];
      ll to = e.to, newcost = cost + e.cost;
      if (d[num][to] > newcost) {
        d[num][to] = newcost;
        que.push(P(newcost, to));
      }
    }
  }
}

int main() {
  scanf("%lld%lld%lld%lld", &n, &m, &s, &t);
  s--;
  t--;
  for (ll i = 0; i < m; i++) {
    scanf("%lld%lld%lld%lld", &u, &v, &a, &b);
    u--;
    v--;
    edge e1, e2, e3, e4;
    e1.to = v, e2.to = u;
    e1.cost = e2.cost = a;
    G[0][u].push_back(e1), G[0][v].push_back(e2);
    e3.to = v, e4.to = u;
    e3.cost = e4.cost = b;
    G[1][u].push_back(e3), G[1][v].push_back(e4);
  }
  dijkstra(0, s);
  dijkstra(1, t);
  for (ll i = 0; i < n; i++)
    mini[i] = d[0][i] + d[1][i];
  for (ll i = n - 2; i >= 0; i--)
    mini[i] = min(mini[i], mini[i + 1]);
  for (ll i = 0; i < n; i++)
    printf("%lld\n", 1000000000000000 - mini[i]);
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int p = n;
  while (true) {
    if (p % 2 == 0 && p % n == 0) {
      cout << p << endl;
      break;
    } else
      p++;
  }
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int p = n;
  if (p % 2 == 0 && p % n == 0) {
    cout << p << endl;
  } else
    cout << p * 2 << endl;
}
Problem p03307 (Python)

Buggy submission (status: Runtime Error):
import math

n = int(input())

print(2 * n // math.gcd(2, n))


Fixed submission:
import math

n = int(input())

if n % 2 == 0:
    n = n // 2

print(2 * n)
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = 2;; i += 2) {
    if (i % 2 == 0 && i % N == 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = N;; i++) {
    if (i % 2 == 0 && i % N == 0) {
      cout << i;
      return 0;
    }
  }
  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep_eq(i, x, n) for (int i = x; i <= (int)(n); i++)
using namespace std;

int main() {
  int N;
  cin >> N;
  int i = 1;
  while (true) {
    if (!(i % 2) and !(i % N)) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
}


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

int main() {
  int N;
  cin >> N;
  if (!(N % 2))
    cout << N << endl;
  else
    cout << N * 2 << endl;
  return 0;
}
Problem p03307 (C++)

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

int main() {
  int n;
  int temp = 0;

  cin >> n;

  for (int i = 2;; i++) {
    if (i % 2 == 0 && i % n == 0) {
      temp = i;
      break;
    }
  }
  cout << temp << endl;
  return 0;
}


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

int main() {
  int n;
  int temp = 0;

  cin >> n;

  for (int i = n;; i *= 2) {
    if (i % 2 == 0 && i % n == 0) {
      temp = i;
      break;
    }
  }
  cout << temp << endl;
  return 0;
}
Problem p03307 (C++)

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

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

  int ans = 0;

  if (N % 2 == 0) {
    ans = N;
  } else {
    ans = N + 1;
  }

  while (1) {
    if (ans % N == 0) {
      break;
    }

    ans += 2;
  }

  cout << ans << endl;
}

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

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

  int ans = 0;

  if (N % 2 == 0) {
    ans = N;
  } else {
    ans = N * 2;
  }

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

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

using namespace std;

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

  int count = 2;
  while (1) {
    if (count % 2 == 0 && count % n == 0)
      break;

    ++count;
  }
  cout << count << endl;
}

Fixed submission:
#include <iostream>

using namespace std;

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

  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << (n * 2) << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < 10000000000; i++) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      break;
    }
  }
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n << endl;
  } else {
    cout << n * 2 << endl;
  }
}
Problem p03307 (C++)

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

using namespace std;

int main() {

  int n, kakeru;
  cin >> n;
  if (n % 2 == 0) {
    kakeru = n;
  } else {
    kakeru = n * 2;
  }
  int i = 1;
  while (1) {
    if (i % kakeru == 0) {
      cout << i << endl;
      return 0;
    }
    i++;
  }

  return 0;
}

Fixed submission:
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {

  int n, kakeru;
  cin >> n;
  if (n % 2 == 0) {
    kakeru = n;
  } else {
    kakeru = n * 2;
  }
  cout << kakeru << endl;

  return 0;
}
Problem p03307 (C++)

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

int main() {
  int N;
  int result = 0;
  cin >> N;
  for (int i = N; i <= N * 2; i++) {
    if (i % N == 0) {
      if (i % 2 == 0) {
        result = i;
        break;
      }
    }
  }
  cout << result << endl;
}

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

int main() {
  int N;
  int result = 0;
  cin >> N;
  if (N % 2 == 0)
    result = N;
  else
    result = 2 * N;
  cout << result << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdexcept>
#include <string>
#include <vector>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<int, int> P;
int ceil(int a, int b) { // a以上bの倍数の最小値//
  return (a + b - 1) / b * b;
}
int stoii(string s) { // stoi関数の代用 文字列⇒int型//
  return atoi(s.c_str());
}

int R, C;
int sy, sx;
int gy, gx;
string c[51];
void solve() {
  queue<P> qp;
  qp.push({sy, sx});
}
int dp[1010][1010] = {0};
int main() {
  int n, k;
  cin >> n;
  int i = 1;
  while (1) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdexcept>
#include <string>
#include <vector>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<int, int> P;
int ceil(int a, int b) { // a以上bの倍数の最小値//
  return (a + b - 1) / b * b;
}
int stoii(string s) { // stoi関数の代用 文字列⇒int型//
  return atoi(s.c_str());
}

int R, C;
int sy, sx;
int gy, gx;
string c[51];
void solve() {
  queue<P> qp;
  qp.push({sy, sx});
}
int dp[1010][1010] = {0};
int main() {
  int n, k;
  cin >> n;
  int i = n;
  while (1) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
  return 0;
}
Problem p03307 (C++)

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

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

  for (int i = 1; i <= 2000000000; i++) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


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

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

  if (n % 2 == 0) {
    cout << n << endl;
  } else {
    cout << n * 2 << endl;
  }

  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < 1000000001; i++) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      break;
    }
  }
}

Fixed submission:
#include <bits/stdc++.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << n * 2 << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

#define for1(n) for (int i = 0; i < n; i++)
#define for2(n) for (int j = 0; j < n; j++)
#define for3(n) for (int k = 0; k < n; k++)
#define for4(n) for (int l = 0; l < n; l++)
#define forl(n) for (ll i = 0; i < n; i++)

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 2; i <= n * 2; i++)
    if (i % n == 0 && i % 2 == 0) {
      cout << i;
      return 0;
    }
}

Fixed submission:
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

#define for1(n) for (int i = 0; i < n; i++)
#define for2(n) for (int j = 0; j < n; j++)
#define for3(n) for (int k = 0; k < n; k++)
#define for4(n) for (int l = 0; l < n; l++)
#define forl(n) for (ll i = 0; i < n; i++)

int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n;
  else
    cout << n * 2;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int n;
  cin >> n;
  for (ll i = 2; i < 10000000000; i += 2) {
    /* code */
    if (i % 2 == 0 && i % n == 0) {
      /* code */
      cout << i << endl;
      break;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
  int n;
  cin >> n;
  for (ll i = n; i < 10000000000; i += n) {
    /* code */
    if (i % 2 == 0 && i % n == 0) {
      /* code */
      cout << i << endl;
      break;
    }
  }
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  int tmp = n;
  while (1) {
    if (tmp % 2 == 0 && tmp % n == 0) {
      printf("%d\n", tmp);
      break;
    }
    tmp++;
  }
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <vector>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    printf("%d\n", n);
  else
    printf("%d\n", 2 * n);
  return 0;
}
Problem p03307 (C++)

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

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

  for (int i = 1; i < 1000000000; i++) {
    if (i % 2 == 0 && i % N == 0) {
      cout << i << endl;
      break;
    }
  }
}

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

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

  if (N % 2 == 0) {
    cout << N << endl;
  } else {
    cout << 2 * N << endl;
  }
}
Problem p03307 (C++)

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

using namespace std;

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

  for (int i = n;; i++) {
    if (i % 2 == 0 & i % n == 0) {
      cout << i << endl;
      return 0;
    }
  }
}

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

using namespace std;

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << 2 * n << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <array>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[]) {
  ll N;
  cin >> N;

  for (ll i = 2;; i = i + 2) {
    if (i % N == 0) {
      cout << i << endl;
      break;
    }
  }
}

Fixed submission:
#include <algorithm>
#include <array>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[]) {
  ll N;
  cin >> N;

  if (N % 2 == 0) {
    cout << N << endl;
  } else {
    cout << N * 2 << endl;
  }
}
Problem p03307 (C++)

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

int main() {
  int n;
  cin >> n;
  for (int k = n; k <= 2 * n; k++) {
    if (k % n == 0 && k % 2 == 0) {
      cout << k << endl;
      break;
    } else
      continue;
  }
}

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

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n << endl;
  } else {

    for (int k = n / 2 + 1; k <= n; k++) {
      if (2 * k % n == 0) {
        cout << 2 * k << endl;
        break;
      } else
        continue;
    }
  }
}
Problem p03307 (C++)

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

int main() {
  int a;
  cin >> a;
  for (long long int i = 1; i < 1145141919810931; i++) {
    if (i % 2 == 0 && i % a == 0) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}


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

int main() {
  int a;
  cin >> a;
  if (a % 2 == 0) {
    cout << a << endl;
  } else {
    cout << a * 2 << endl;
  }
  return 0;
}
Problem p03307 (C++)

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

using namespace std;

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

  int num = 1;
  while (1) {
    if (num % 2 == 0 && num % N == 0) {
      cout << num << endl;
      break;
    }
    num++;
  }
}


Fixed submission:
#include <iostream>

using namespace std;

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

  int num = N;
  while (1) {
    if (num % 2 == 0 && num % N == 0) {
      cout << num << endl;
      break;
    }
    num++;
  }
}
Problem p03307 (C++)

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int i = 1;
  while (true) {
    if (i % 2 == 0 && i % N == 0) {
      cout << i << endl;
      break;
    }
    i++;
  }
}


Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << 2 * N << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#define rep(i, x) for (ll i = 0; i < x; i++)
#define all(a) (a).begin(), (a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
ll gcd(ll a, ll b) {
  if (a < b)
    swap(a, b);
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
bool isp(ll n) {
  bool res = true;
  if (n == 1)
    return false;
  else {
    for (ll i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        res = false;
        break;
      }
    }
    return res;
  }
}
// printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
    */
int main() {
  ll N;
  cin >> N;
  usleep(1999000);
  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << 2 * N << endl;
}

Fixed submission:
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#define rep(i, x) for (ll i = 0; i < x; i++)
#define all(a) (a).begin(), (a).end()
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll INF = 1LL << 60;
const ll mod = 1000000007;
typedef pair<ll, ll> P;
using graph = vector<vector<ll>>;
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
ll gcd(ll a, ll b) {
  if (a < b)
    swap(a, b);
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
bool isp(ll n) {
  bool res = true;
  if (n == 1)
    return false;
  else {
    for (ll i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        res = false;
        break;
      }
    }
    return res;
  }
}
// printf("%.10f\n", N);
/*
ll fibo(ll n){
    if(memo[n] != 0)return memo[n];
    if(n <= 1)return n;
    else return memo[n] = fibo(n - 1)+ fibo(n - 2);
}*/
/*  vector<ll> vec = {1,2,5,6,8,9,10};
    cout << binary_search(all(vec),5) << endl; -> true*/
/*
    vector<ll> vec = {1,2,5,6,8,9,10};
    auto n = upper_bound(all(vec),4);
    cout << *n << endl; -> 5*/
/*
    cout << fixed << setprecision(15);
    */
int main() {
  ll N;
  cin >> N;
  usleep(1998999);
  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << 2 * N << endl;
}
Problem p03307 (C++)

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

int main(void) {
  long int N;
  cin >> N;
  long int i = N;

  while (1) {
    if (i % 2 == 0 && i % N == 0) {
      cout << i << endl;
      break;
    } else
      i++;
  }

  return 0;
}

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

int main(void) {
  long int N;
  cin >> N;
  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << 2 * N << endl;
  return 0;
}
Problem p03307 (C++)

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

int main() {
  int n;
  cin >> n;
  int i = 2;
  while (1) {
    if (i % n == 0) {
      break;
    }
    i += 2;
  }
  cout << i;
}


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

int main() {
  int n;
  cin >> n;
  int i = n;
  if (n % 2 != 0) {
    i++;
  }
  while (1) {
    if (i % n == 0) {
      break;
    }
    i += 2;
  }
  cout << i;
}
Problem p03307 (C++)

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

using namespace std;

int main() {
  int n, r;
  cin >> n;
  if ((n & 1) == 0) {
    r = n;
  } else {
    r = n * 2;
  }
  return r;
}


Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int n, r;
  cin >> n;
  if ((n & 1) == 0) {
    r = n;
  } else {
    r = n * 2;
  }
  cout << r;
  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#define ll long long
// #include <bits/stdc++.h>
#define req(i, h) for (int i = 0; i < h; i++)

using namespace std;

int main(void) {
  ll n;
  cin >> n;
  ll i = 2;
  while (i < 1e11) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      return 0;
    }
    i = i + 2;
  }
}


Fixed submission:
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#define ll long long
// #include <bits/stdc++.h>
#define req(i, h) for (int i = 0; i < h; i++)

using namespace std;

int main(void) {
  ll n;
  cin >> n;
  if (n % 2 == 1) {
    cout << 2 * n;
  } else {
    cout << n << endl;
  }
}
Problem p03307 (C++)

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

int main() {
  int a;
  scanf("%d", a);
  if (a % 2 == 0)
    printf("%d", a);
  else
    printf("%d", a * 2);
  return 0;
}

Fixed submission:
#include <cstdio>

int main() {
  int a;
  scanf("%d", &a);
  if (a % 2 == 0)
    printf("%d", a);
  else
    printf("%d", a * 2);
  return 0;
}
Problem p03307 (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;

int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= 1e10; i += 2) {
    if (i % n == 0) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << n * 2 << endl;
}
Problem p03307 (C++)

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

int main() {
  int N;
  cin >> N;
  int n = (2 < n) ? n : 2;
  for (int i = n;; ++i)
    if (i % 2 == 0 && i % N == 0) {
      cout << i << endl;
      return 0;
    }
}


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

int main() {
  int N;
  cin >> N;
  int i = N;
  while (N % 2 == 0 && 2 * N > i)
    N /= 2;
  cout << N * 2 << endl;
  return 0;
}
Problem p03307 (C++)

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

using namespace std;

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

  for (int i = 1; true; ++i) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      break;
    }
  }

  return 0;
}

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

using namespace std;

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

  for (int i = n; true; ++i) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      break;
    }
  }

  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int x;
  cin >> x;
  int a[x];
  int b = 0;
  int c = 99999999999;
  for (int i = 1; i <= x; i++) {
    cin >> a[i];
    if (a[i] >= b) {
      b = a[i];
    }
    if (a[i] <= c) {
      c = a[i];
    }
  }
  cout << b - c;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n;
  } else
    cout << n * 2;
  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  return n % 2 == 0 ? n : 2 * n;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  cout << (n % 2 == 0 ? n : 2 * n) << endl;
  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main(void) {
  int n, i;
  scanf("%d", &n);
  for (i = 1;; i++) {
    if (i % 2 == 0 && i % n == 0) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}


Fixed submission:
#include <stdio.h>
int main(void) {
  int n, i;
  scanf("%d", &n);
  for (i = n;; i++) {
    if (i % 2 == 0 && i % n == 0) {
      printf("%d\n", i);
      break;
    }
  }
  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define repr(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
typedef long long lint;
using namespace std;

int main(void) {

  int n;
  cin >> n;
  int v = 2;
  if (n > 100000000) {
    v = 100000000;
  }

  while (1) {
    if (!(v % n)) {
      break;
    }
    v += 2;
  }

  cout << v << endl;

  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define repr(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
typedef long long lint;
using namespace std;

int main(void) {

  int n;
  cin >> n;
  int v = 2;
  if (n > 999999998) {
    v = 999999998;
  }

  while (1) {
    if (!(v % n)) {
      break;
    }
    v += 2;
  }

  cout << v << endl;

  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <string>
using namespace std;
int main(void) {
  long long i, count = 0, n;
  cin >> n;
  if (n % 2 == 0) {
    for (i = 0; i < 10000000000000; i += 2) {
      if (i >= 2 && i % n == 0 && i % 2 == 0) {
        break;
      }
      count += 2;
    }
  } else
    count = n * 2;
  cout << count << endl;
}

Fixed submission:
#include <iostream>
#include <string>
using namespace std;
int main(void) {
  long long i, count = 0, n;
  cin >> n;
  if (n % 2 == 0)
    count = n;
  else
    count = n * 2;
  cout << count << endl;
}
Problem p03307 (C++)

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

using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;

// container util
#define SORT(c) sort((c).begin(), (c).end())

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {

  int N;
  cin >> N;

  for (int i = 1;; ++i) {
    if (i % 2 == 0 and i % N == 0) {
      cout << i << endl;
      return 0;
    }
  }

  return 0;
}


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

using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;

// container util
#define SORT(c) sort((c).begin(), (c).end())

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

int main(void) {

  int N;
  cin >> N;

  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << 2 * N << endl;

  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int main() {
  int N, i;
  cin >> N;
  int find = 1;
  for (i = 2; find; i = i + 2)
    if (i % N == 0)
      find = 0;
  cout << i - 2;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int N, i;
  cin >> N;
  if (N % 2 == 0)
    cout << N;
  else
    cout << N * 2;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>

using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;

int main() {
  int n;
  cin >> n;
  int num = 1;
  while ((num % 2 != 0) || (num % n != 0)) {
    num++;
  }
  out(num);
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>

using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;

int main() {
  int n;
  cin >> n;
  int a;
  if (n % 2 == 0)
    out(n);
  else
    out(2 * n);
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define reps(i, x) for (int i = 1; i <= (int)(x); i++)
#define UNIQUE(v) v..erase(unique(v.begin(), v.end()), v.end());
#define Size(x) ((int)(x).size())
using namespace std;

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 1000000000; i++) {
    if (i % n == 0 and i % 2 == 0) {
      cout << i << endl;
      break;
    }
  }
}


Fixed submission:
#include <bits/stdc++.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define reps(i, x) for (int i = 1; i <= (int)(x); i++)
#define UNIQUE(v) v..erase(unique(v.begin(), v.end()), v.end());
#define Size(x) ((int)(x).size())
using namespace std;

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << n * 2 << endl;

  return 0;
}
Problem p03307 (C++)

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

int main() {
  int cnt = 2;
  int n;
  cin >> n;
  while (true) {
    if (cnt % 2 == 0 && cnt % n == 0) {
      cout << cnt << endl;
      return 0;
    }
    cnt += 2;
  }
}


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

int main() {
  long long cnt;
  cin >> cnt;
  if (cnt % 2)
    cout << cnt * 2 << endl;
  else
    cout << cnt << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
  int N;
  cin >> N;
  int ans = 1;
  for (;;) {
    if (ans % 2 == 0 && ans % N == 0) {
      break;
    } else {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
typedef long long ll;
int main() {
  int N;
  cin >> N;
  int ans;
  if (N % 2 == 0) {
    ans = N;
  } else {
    ans = N * 2;
  }
  cout << ans << endl;
  return 0;
}
Problem p03307 (C++)

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

using namespace std;
using std::cout;
using ll = long long;
bool is_int_lround(double x) { return std::lround(x) == x; }
int ketasuu(int x) {
  int n = 0;
  while (x > 0) {
    x /= 10;
    n++;
  }
  return n;
}
ll gcd11(ll x, ll y) {
  long long a = max(x, y), b = min(x, y), c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

int ab(int x, int y) {
  if (x >= y) {
    return x - y;
  } else if (y > x) {
    return y - x;
  }
}
int main() {
  ll n;
  cin >> n;
  for (ll i = 1; i <= n; i++) {
    if (2 * i % n == 0) {
      cout << 2 * i << endl;
      break;
    }
  }
}

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

using namespace std;
using std::cout;
using ll = long long;
bool is_int_lround(double x) { return std::lround(x) == x; }
int ketasuu(int x) {
  int n = 0;
  while (x > 0) {
    x /= 10;
    n++;
  }
  return n;
}
ll gcd11(ll x, ll y) {
  long long a = max(x, y), b = min(x, y), c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

int ab(int x, int y) {
  if (x >= y) {
    return x - y;
  } else if (y > x) {
    return y - x;
  }
}
int main() {
  ll n;
  cin >> n;
  cout << 2 * n / gcd11(2, n) << endl;
}
Problem p03307 (C++)

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

using namespace std;

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

  for (int i = 1;; i++) {
    if ((i % 2 == 0) && (i % n == 0)) {
      cout << i << endl;
      break;
    }
  }

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

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

  cout << ((n % 2 == 0) ? n : n * 2) << endl;
  return 0;
}
Problem p03307 (C++)

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

int main(void) {
  int N;
  cin >> N;
  for (int i = 2; i <= 2 * N; i = i + 2) {
    if (i % N == 0 && i % 2 == 0) {
      cout << i << endl;
      return 0;
    }
  }
}

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

int main(void) {
  int N;
  cin >> N;
  if (N % 2 == 0) {
    cout << N << endl;
  } else {
    cout << 2 * N << endl;
  }
}
Problem p03307 (C++)

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

int main() {
  int n;
  cin >> n;
  int k = n;
  if (n % 2 == 0)
    cout << n;
  else {
    while (k % n != 0 || k % 2 != 0) {
      k++;
    }
    cout << k;
  }

  return 0;
}

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

int main() {
  int n;
  cin >> n;
  int k = n;
  if (n % 2 == 0)
    cout << n;
  else {
    while (k % n != 0 || k % 2 != 0) {
      k += k;
    }
    cout << k;
  }

  return 0;
}
Problem p03307 (C++)

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  cout << A.at(N - 1) - A.at(0) << endl;
}

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

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

  if (N % 2 == 1)
    cout << 2 * N << endl;
  else
    cout << N << endl;
}
Problem p03307 (C++)

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

#include <cmath>
#include <cstdlib>

using namespace std;

int main(void) {
  //
  int n;
  cin >> n;
  for (int i = 2; i <= pow(10, n); i++) {
    if (i % 2 == 0 && i % n == 0) {
      cout << i << endl;
      return 0;
      break;
    }
  }
  return 0;
}

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

#include <cmath>
#include <cstdlib>

using namespace std;

int main(void) {
  //
  int n;
  cin >> n;
  if (n % 2 == 0) {
    cout << n << endl;
  } else {
    cout << 2 * n << endl;
  }
  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

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

  for (int i = 0;; i += 2) {
    if (i == 0) {
      continue;
    }
    if (i % 2 == 0 && i % N == 0) {
      cout << i << endl;
      return 0;
    }
  }
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>
using namespace std;

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

  if (N % 2 == 0) {
    cout << N << endl;
  } else {
    cout << 2 * N << endl;
  }
}
Problem p03307 (C++)

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

int main(int argc, const char *argv[]) {
  // insert code here...
  int N;
  cin >> N;

  int ans = 0;
  bool flag = true;
  while (flag) {
    ans += 2;
    if (ans % N == 0)
      flag = false;
  }

  cout << ans << endl;

  return 0;
}


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

int main(int argc, const char *argv[]) {
  // insert code here...
  int N;
  cin >> N;

  if (N % 2 == 0)
    cout << N << endl;
  else
    cout << N * 2 << endl;

  return 0;
}
Problem p03307 (C++)

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

int main() {
  int n;
  cin >> n;
  while (n & 1) {
    n << 1;
  }
  cout << n;
}

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

int main() {
  int n;
  cin >> n;
  while (n % 2 != 0) {
    n *= 2;
  }
  cout << n;
}
Problem p03307 (C++)

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

int main() {
  int x;
  int answer = 1;
  scanf("%d", &x);
  while (true) {
    if (answer % x == 0) {
      if (answer % 2 == 0) {
        goto exit;
      }
    }
    answer++;
  }
exit:
  printf("%d", answer);

  return 0;
}

Fixed submission:
#include <stdio.h>
#include <stdlib.h>

int main() {
  int x;
  int answer = 1;
  scanf("%d", &x);

  if (x % 2 == 0) {
    answer = x;
    goto exit;
  } else {
    answer = 2 * x;
  }
exit:
  printf("%d", answer);

  return 0;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i, j, n) for (int i = (j); i < (n); i++)
#define rep2(i, j, n) for (int i = (j); i <= (n); i++)
#define all(i) i.begin(), i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;
typedef vector<long long int> vll;

int main() {
  int n;
  cin >> n;
  int i = n;
  while (1) {
    if (i % n == 0 && i % 2 == 0) {
      cout << i << endl;
      return 0;
    }
    i++;
  }
}

Fixed submission:
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i, j, n) for (int i = (j); i < (n); i++)
#define rep2(i, j, n) for (int i = (j); i <= (n); i++)
#define all(i) i.begin(), i.end()
#define rall(i) i.rbegin(), i.rend()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;
typedef vector<long long int> vll;

int main() {
  int n;
  cin >> n;
  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << n * 2 << endl;
}
Problem p03307 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

int main() {

  ll n;
  cin >> n;
  for (ll i = 2; i <= 1000000000; i = i + 2) {
    if (i % n == 0) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

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

int main() {

  ll n;
  cin >> n;
  if (n % 2 == 0)
    cout << n << endl;
  else
    cout << 2 * n << endl;
  return 0;
}
Problem p03307 (C++)

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

int main() {
  int n, i = 0;
  cin >> n;
  while (true) {
    i++;
    if (i % 2 == 0 && i % n == 0)
      break;
  }
  cout << i << endl;
}

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

int main() {
  int n, i = 0;
  cin >> n;
  if (n % 2 == 0)
    i = n;
  else
    i = n * 2;
  cout << i << endl;
}