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

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

int main() {
  int N, min;
  cin >> N;
  min = 1000;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a;
    b = 0;
    for (a; a % 2 == 0 && a != 0; a / 2) {
      b++;
    }
    if (min > b) {
      min = b;
    }
  }
  cout << min << endl;
}


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

int main() {
  int N, min;
  cin >> N;
  min = 1000;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a;
    b = 0;
    for (a; a % 2 == 0; a /= 2) {
      b++;
    }
    if (min > b) {
      min = b;
    }
  }
  cout << min << endl;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int oddnum = 0;
  bool even = true;

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  while (true) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
        a[i] /= 2;
      else {
        even = false;
      }
    }
    if (even)
      oddnum++;
  }

  cout << oddnum << endl;
}


Fixed submission:
#include <iostream>
#include <math.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int oddnum = 0;
  bool even = true;

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  while (true) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
        a[i] /= 2;
      else {
        even = false;
      }
    }
    if (even)
      oddnum++;
    else {
      break;
    }
  }

  cout << oddnum << endl;
}
Problem p03494 (C++)

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

int main() {
  int N;
  cin >> N;
  int A[210];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int count = 0;
  bool even = true;
  while (1) {
    for (int i; i < N; i++) {
      if (A[i] % 2 == 1) {
        even = false;
      }
    }
    if (!even)
      break;
    for (int i = 0; i < N; i++) {
      A[i] /= 2;
    }
    count++;
  }
  cout << count << endl;
}

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

int main() {
  int N;
  cin >> N;
  int A[210];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int count = 0;
  bool even = true;
  while (1) {
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 1) {
        even = false;
      }
    }
    if (!even)
      break;
    for (int i = 0; i < N; i++) {
      A[i] /= 2;
    }
    count++;
  }
  cout << count << endl;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int N;
int a[210];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> a[i];

  int res = 0;
  while (true) {
    bool odd = false;
    for (int i = 0; i < N; i++) {
      if (a[i] % 2 == 1)
        odd = true;
    }
    if (odd)
      break;
    for (int i = 0; i < N; i++) {
      a[i] / 2;
    }
    ++res;
  }
  cout << res << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int N;
int a[210];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> a[i];

  int res = 0;
  while (true) {
    bool odd = false;
    for (int i = 0; i < N; i++) {
      if (a[i] % 2 == 1)
        odd = true;
    }
    if (odd)
      break;
    for (int i = 0; i < N; i++) {
      a[i] /= 2;
    }
    ++res;
  }
  cout << res << endl;
}
Problem p03494 (C++)

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

int main() {
  int N;
  int arr[100];
  int have2[100] = {
      0,
  };
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &arr[i]);
  }
  for (int i = 0; i < N; i++) {
    while (arr[i] % 2 == 0) {
      have2[i]++;
      arr[i] /= 2;
    }
  }
  int min = 987654321;
  for (int i = 0; i < N; i++) {
    if (min > have2[i])
      min = have2[i];
  }
  printf("%d\n", min);
}


Fixed submission:
#include <stdio.h>

int main() {
  int N;
  int arr[200];
  int have2[200] = {
      0,
  };
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &arr[i]);
  }
  for (int i = 0; i < N; i++) {
    while (arr[i] % 2 == 0) {
      have2[i]++;
      arr[i] /= 2;
    }
  }
  int min = 987654321;
  for (int i = 0; i < N; i++) {
    if (min > have2[i])
      min = have2[i];
  }
  printf("%d\n", min);
}
Problem p03494 (C++)

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

int main() {
  int N;
  int count = 0;
  bool flag = true;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  while (true) {
    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 != 0) {
        flag = false;
        break;
      } else {
        A.at(i) /= 2;
      }
    }
    if (flag == false) {
      break;
    }
    count++;
  }
  cout << count << endl;
}


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

int main() {
  int N;
  int count = 0;
  bool flag = true;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  while (true) {
    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 != 0) {
        flag = false;
        break;
      } else {
        A.at(i) /= 2;
      }
    }
    if (flag == false) {
      break;
    }
    count++;
  }
  cout << count << endl;
}
Problem p03494 (C++)

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

int main() {
  int n;
  std::cin >> n;
  int a[n];

  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  int i = 0;
  int flag = 0;
  int count = 0;
  while (1) {
    for (int ii = 0; ii < n; ii++) {
      if (a[ii] % 2 == 1) {
        flag = 1;
        break;
      }
    }
    if (flag == 0)
      count++;
    else
      break;
  }
  std::cout << count;
}

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

int main() {
  int n;
  std::cin >> n;
  int a[n];

  for (int i = 0; i < n; i++) {
    std::cin >> a[i];
  }

  int i = 0;
  int flag = 0;
  int count = 0;
  while (1) {
    for (int ii = 0; ii < n; ii++) {
      if (a[ii] % 2 == 1) {
        flag = 1;
        break;
      } else
        a[ii] /= 2;
    }
    if (flag == 0)
      count++;
    else
      break;
  }
  std::cout << count;
}
Problem p03494 (C++)

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

int main() {
  int N, x, k, j;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x;
    for (j = 0; x % 2 == 0; j++) {
      x /= 2;
    }
    if (i = 0 || k > j) {
      k = j;
    }
  }
  cout << k << endl;
}

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

int main() {
  int N, x, k, j;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x;
    for (j = 0; x % 2 == 0; j++) {
      x /= 2;
    }
    if (i == 0 || k > j) {
      k = j;
    }
  }
  cout << k << endl;
}
Problem p03494 (C++)

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

int N;
int A[210];

int main() {
  cin >> N;
  for (int i = 0; i < N; ++i)
    cin >> A[i];

  int counter = 0;

  while (true) {
    bool exist_odd = false; // A[i] がすべて偶数かどうかを判定するフラグ
    for (int i = 0; i < N; ++i) {
      if (A[N] % 2 != 0) {
        exist_odd = true;
        break;
      }
    }
    if (exist_odd)
      break;

    for (int i = 0; i < N; ++i)
      A[i] /= 2;

    counter += 1;
  }

  cout << counter << endl;
}

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

int N;
int A[210];

int main() {
  cin >> N;
  for (int i = 0; i < N; ++i)
    cin >> A[i];

  int counter = 0;

  while (true) {
    bool exist_odd = false; // A[i] がすべて偶数かどうかを判定するフラグ
    for (int i = 0; i < N; ++i) {
      if (A[i] % 2 != 0)
        exist_odd = true; // 奇数があったらフラグを立てる
    }
    if (exist_odd)
      break;

    for (int i = 0; i < N; ++i)
      A[i] /= 2;

    counter += 1;
  }

  cout << counter << endl;
}
Problem p03494 (C++)

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

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

  string a;
  cin >> a;

  for (int i = 0; i < n; i++)
    cin >> a[i];

  int count = 0;

  while (true) {
    bool exist_odd = false;
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 != 0)
        exist_odd = true;
    }

    if (exist_odd)
      break;

    for (int i = 0; i < n; i++) {
      a[i] /= 2;
    }

    count++;
  }

  cout << count << endl;
}


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

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

  int a[220];

  for (int i = 0; i < n; i++)
    cin >> a[i];

  int count = 0;

  while (true) {
    bool exist_odd = false;
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 != 0)
        exist_odd = true;
    }

    if (exist_odd)
      break;

    for (int i = 0; i < n; i++) {
      a[i] /= 2;
    }

    count++;
  }

  cout << count << endl;
}
Problem p03494 (C++)

Buggy submission (status: Runtime Error):
#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[1100000000];
  for (int i = 0; i < N; ++i)
    cin >> a[i];

  int res = 0;
  while (true) {
    bool f = true;
    for (int i = 0; i < N; ++i) {
      if (a[i] % 2 != 0)
        f = false;
    }
    if (!f)
      break;
    for (int i = 0; i < N; ++i)
      a[i] /= 2;
    ++res;
  }

  cout << res << endl;
}

Fixed submission:
#include <iostream>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[200];
  for (int i = 0; i < N; ++i)
    cin >> a[i];

  int res = 0;
  while (true) {
    bool f = true;
    for (int i = 0; i < N; ++i) {
      if (a[i] % 2 != 0)
        f = false;
    }
    if (!f)
      break;
    for (int i = 0; i < N; ++i)
      a[i] /= 2;
    ++res;
  }

  cout << res << endl;
}
Problem p03494 (C++)

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

using namespace std;

int main(void) {
  int n;
  int maxi = 10000000;
  int now;
  int a[201];

  cin >> n;

  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  for (int i = 1; i < n; i++) {
    now = 0;
    while (a[i] % 2 == 0) {
      now++;
    }
    if (now < maxi) {
      maxi = now;
    }
  }

  cout << maxi << endl;

  return 0;
}

Fixed submission:
#include <iostream>

using namespace std;

int main(void) {
  int n;
  int maxi = 10000000;
  int now;
  int a[201];

  cin >> n;

  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }

  for (int i = 1; i < n; i++) {
    now = 0;
    while (a[i] % 2 == 0) {
      now++;
      a[i] /= 2;
    }
    if (now < maxi) {
      maxi = now;
    }
  }

  cout << maxi << endl;

  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++)
    cin >> A[i];

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 != 0)
      break;
    if (i == N - 1) {
      i = -1;
      count++;
    }
  }
  cout << count << endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++)
    cin >> A[i];

  int count = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] % 2 != 0)
      break;
    A[i] /= 2;
    if (i == N - 1) {
      i = -1;
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
Problem p03494 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, a, n = 50, p;
  cin >> N;

  for (int i = 1; i <= N; i++) {
    cin >> A;
    a = 0, p = 0;
    for (int j = 1; p == 0; j++) {
      p = A % (2 ^ j);
      if (p == 0)
        a = j;
    }
    if (n > a)
      n = a;
  }
  cout << n << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, a, n = 50, p;
  cin >> N;

  for (int i = 1; i <= N; i++) {
    cin >> A;
    a = 0, p = 0;
    for (int j = 1; p == 0; j++) {
      p = A % 2;
      A /= 2;
      if (p == 0)
        a = j;
    }
    if (n > a)
      n = a;
  }
  cout << n << endl;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[200];
  int dim = 100;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    int b = 0;
    while (a[i] % 2 == 0) {
      b++;
    }
    dim = min(dim, b);
  }
  cout << dim << endl;
}

Fixed submission:
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a[200];
  int dim = 100;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    int b = 0;
    while (a[i] % 2 == 0) {
      a[i] = a[i] / 2;
      b++;
    }
    dim = min(dim, b);
  }
  cout << dim << endl;
}
Problem p03494 (C++)

Buggy submission (status: Runtime Error):
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1e9;
const ll LINF = 1e18;

struct edge {
  int to, cost;
};

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

  int n;
  cin >> n;

  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  bool flag = false;
  int cnt = 0;
  while (true) {
    for (int i = 0;; i++) {
      if (a[i] % 2 == 0)
        a[i] /= 2;
      else
        flag = true;
    }
    if (flag)
      break;
    cnt++;
  }
  cout << cnt << "\n";
  return 0;
}

Fixed submission:
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int INF = 1e9;
const ll LINF = 1e18;

struct edge {
  int to, cost;
};

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

  int n;
  cin >> n;

  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  bool flag = false;
  int cnt = 0;
  while (true) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0)
        a[i] /= 2;
      else
        flag = true;
    }
    if (flag)
      break;
    cnt++;
  }
  cout << cnt << "\n";
  return 0;
}
Problem p03494 (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 p = pair<int, int>;

int main() {
  int n;
  vector<long int> a(n);
  int t = 0;
  rep(i, n) { cin >> a.at(i); }

  while (true) {
    bool exist = false;
    rep(i, n) {
      if (a.at(i) % 2 != 0) {
        exist = true;
      }
    }
    if (exist == true)
      break;

    rep(i, n) { a.at(i) /= 2; }
    t++;
  }

  cout << t << endl;
}


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

int main() {
  int n;
  cin >> n;
  vector<long int> a(n);
  int t = 0;
  rep(i, n) { cin >> a.at(i); }

  while (true) {
    bool exist = false;
    rep(i, n) {
      if (a.at(i) % 2 != 0) {
        exist = true;
      }
    }
    if (exist == true)
      break;

    rep(i, n) { a.at(i) /= 2; }
    t++;
  }

  cout << t << endl;
}
Problem p03494 (C++)

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

int main() {
  int N = 0;
  int count = 0;
  std::cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  while (1) {
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 1)
        goto end;
      A[i] = A[i] / 2;
    }
    count++;
  }
end:
  std::cout << count;
  return 1;
}


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

int main() {
  int N = 0;
  int count = 0;
  std::cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    std::cin >> A[i];
  }
  while (1) {
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 1)
        goto end;
      A[i] = A[i] / 2;
    }
    count++;
  }
end:
  std::cout << count;
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N, count = -1;
  cin >> N;
  vector<int> A(N);

  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  bool flag = true;

  while (flag) {
    count++;

    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 == 1) {
        flag = false;
        break;
      }
    }
  }

  cout << count << endl;
}

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

int main() {
  int N, count = -1;
  cin >> N;
  vector<int> A(N);

  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }

  bool flag = true;

  while (flag) {
    count++;

    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 == 1) {
        flag = false;
        break;
      } else {
        A.at(i) /= 2;
      }
    }
  }

  cout << count << endl;
}
Problem p03494 (C++)

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

int div(int n) {
  if (n % 2 == 1) {
    return 0;
  } else {
    return div(int(n / 2)) + 1;
  }
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(N);
  }
  int min = div(a.at(0));
  for (int i = 1; i < N; i++) {
    int d = div(a.at(i));
    if (d < min) {
      min = d;
    }
  }
  cout << min << endl;
}


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

int div(int n) {
  if (n % 2 == 1) {
    return 0;
  } else {
    return div(int(n / 2)) + 1;
  }
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  int min = div(a.at(0));
  for (int i = 1; i < N; i++) {
    int d = div(a.at(i));
    if (d < min) {
      min = d;
    }
  }
  cout << min << endl;
}
Problem p03494 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for (int i = x; i < (int)(n); i++)
#define VSORT(v) sort(v.begin(), v.end());
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
int main() {
  int N;
  vector<int> A(N);
  cin >> N;
  REP(i, N) { cin >> A[i]; }

  int c = 0;
  bool odd = false;

  while (true) {
    REP(i, N) {
      if (A[i] % 2 != 0) {
        odd = true;
        break;
      }
    }

    if (odd == true) {
      break;
    }
    REP(i, N) { A[i] /= 2; }
    c++;
  }
  cout << c << endl;
}

Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, x, n) for (int i = x; i < (int)(n); i++)
#define VSORT(v) sort(v.begin(), v.end());
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
int main() {
  int N;
  vector<int> A(200);
  cin >> N;
  REP(i, N) { cin >> A[i]; }

  int c = 0;
  bool odd = false;

  while (true) {
    REP(i, N) {
      if (A[i] % 2 != 0) {
        odd = true;
        break;
      }
    }

    if (odd == true) {
      break;
    }
    REP(i, N) { A[i] /= 2; }
    c++;
  }
  cout << c << endl;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#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[n];

  int ans = 0;
  while (1) {
    bool odd = false;
    for (int i = 0; i < n; ++i) {
      if (a[i] % 2 == 1) {
        odd = true;
      }
    }
    if (odd)
      break;
    ans++;
    for (int i = 0; i < n; ++i) {
      a[i] /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#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[i];

  int ans = 0;
  while (1) {
    bool odd = false;
    for (int i = 0; i < n; ++i) {
      if (a[i] % 2 == 1) {
        odd = true;
      }
    }
    if (odd)
      break;
    ans++;
    for (int i = 0; i < n; ++i) {
      a[i] /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N, A;
  cin >> N;
  int MAX = 31;
  for (int i = 0; i < N; i++) {
    int wattakaisu = 0;
    cin >> A;
    while (A % 2 == 0) {
      wattakaisu++;
    }
    if (MAX > wattakaisu) {
      MAX = wattakaisu;
    }
  }
  cout << MAX << endl;
}


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

int main() {
  int N, A;
  cin >> N;
  int MAX = 31;
  for (int i = 0; i < N; i++) {
    int wattakaisu = 0;
    cin >> A;
    while (A % 2 == 0) {
      wattakaisu++;
      A /= 2;
    }
    if (MAX > wattakaisu) {
      MAX = wattakaisu;
    }
  }
  cout << MAX << endl;
}
Problem p03494 (C++)

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

int main() {
  int a[200], n;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int c = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 1)
        return c;
      a[i] = a[i] / 2;
    }
    c++;
  }
  cout << c;

  return 0;
}

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

int main() {
  int a[200], n;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int c = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 1) {
        cout << c;
        return 0;
      }
      a[i] = a[i] / 2;
    }
    c++;
  }
  cout << c;

  return 0;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <vector>

#define ok printf("ok\n");
#define MAX 1000000
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define REPR(i, s, n) for (int i = (s); i >= (g); (i)--)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

int main() {
  int a, b, c = 0;
  string s, t;
  vi v;
  cin >> a;
  rep(i, a) {
    cin >> b;
    v.push_back(b);
  }
  rep(i, a) {
    rep(j, a) if (v[j] % 2 == 1) {
      cout << c;
      return 0;
    }
    c++;
    i = 0;
  }
  return 0;
}

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

#define ok printf("ok\n");
#define MAX 1000000
#define rep(i, n) for (int i = 0; i < n; i++)
#define REP(i, s, n) for (int i = (s); i < (n); i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)
#define REPR(i, s, n) for (int i = (s); i >= (g); (i)--)
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

int main() {
  int a, b, c = 0;
  string s, t;
  vi v;
  cin >> a;
  rep(i, a) {
    cin >> b;
    v.push_back(b);
  }
  rep(i, a) {
    rep(j, a) if (v[j] % 2 == 1) {
      cout << c;
      return 0;
    }
    else {
      v[j] = v[j] / 2;
    }
    c++;
    i = 0;
  }
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N, A, p = 1000000000, pi;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A;
    while (A % 2 == 0) {
      pi++;
    }
    if (pi < p) {
      p = pi;
    }
    pi = 0;
  }
  cout << p;
}


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

int main() {
  int N, A, p = 1000000000, pi;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A;
    while (A % 2 == 0) {
      pi++;
      A /= 2;
    }
    if (pi < p) {
      p = pi;
    }
    pi = 0;
  }
  cout << p;
}
Problem p03494 (C++)

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

int main(void) {

  int num;

  cin >> num;

  int array[num];

  for (int i = 0; i < num; i++) {
    cin >> array[i];
  }

  bool flg = true;

  for (int i = 0; i < num; i++) {
    if (array[i] % 2 != 0) {
      flg = false;
    }
  }

  int count = 0;

  while (true) {
    for (int i = 0; i < num; i++) {
      array[i] /= 2;
      if (array[i] % 2 != 0) {
        flg = false;
      }
    }
    count++;
  }

  cout << count << endl;

  return 0;
}

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

int main(void) {

  int num;

  cin >> num;

  int array[num];

  for (int i = 0; i < num; i++) {
    cin >> array[i];
  }

  bool flg = true;

  for (int i = 0; i < num; i++) {
    if (array[i] % 2 != 0) {
      flg = false;
    }
  }

  int count = 0;

  while (flg) {
    for (int i = 0; i < num; i++) {
      array[i] /= 2;
      if (array[i] % 2 != 0) {
        flg = false;
      }
    }
    count++;
  }

  cout << count << endl;

  return 0;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <stdio.h>
int main(void) {
  int n;
  int i;
  int count;
  int number[100] = {0};
  int old_number[100] = {0};
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &number[i]);
    old_number[i] = number[i];
  }
  for (count = 0;; count++) {
    for (i = 0; i < n; i++) {
      number[i] /= 2;
      if (2 * number[i] != old_number[i]) {
        goto label;
      }
      old_number[i] = number[i];
    }
  }
label:
  printf("%d", count);
}

Fixed submission:
#include <stdio.h>
int main(void) {
  int n;
  int i;
  int count;
  int number[200] = {0};
  int old_number[200] = {0};
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &number[i]);
    old_number[i] = number[i];
  }
  for (count = 0;; count++) {
    for (i = 0; i < n; i++) {
      number[i] /= 2;
      if (2 * number[i] != old_number[i]) {
        goto label;
      }
      old_number[i] = number[i];
    }
  }
label:
  printf("%d", count);
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <iostream>
using namespace std;
int N;
int A[200];
int ans;
bool check() {
  for (int n = 0; n < N; ++n) {
    if (A[n] % 2 == 1)
      return false;
    A[n] >> 1;
  }
  return true;
}
int main(void) {
  cin >> N;
  for (int n = 0; n < N; ++n)
    cin >> A[n];
  while (check())
    ++ans;
  cout << ans << endl;
  return 0;
}

Fixed submission:
#include <iostream>
using namespace std;
int N;
int A[200];
int ans;
bool check() {
  for (int n = 0; n < N; ++n) {
    if (A[n] % 2 == 1)
      return false;
    A[n] >>= 1;
  }
  return true;
}
int main(void) {
  cin >> N;
  for (int n = 0; n < N; ++n)
    cin >> A[n];
  while (check())
    ++ans;
  cout << ans << endl;
  return 0;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main() {
  int N;
  int max_ = 30;

  cin >> N;

  for (int i = 0; i < N; i++) {
    int x;
    int count = 0;
    cin >> x;
    while (!(x & 1)) {
      count++;
      x >> 1;
    }
    max_ = MIN(max_, count);
  }

  cout << max_ << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main() {
  int N;
  int max_ = 30;

  cin >> N;

  for (int i = 0; i < N; i++) {
    int x;
    int count = 0;
    cin >> x;
    while (!(x & 1)) {
      count++;
      x >>= 1;
    }
    max_ = MIN(max_, count);
  }

  cout << max_ << endl;
}
Problem p03494 (C++)

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

int main() {
  int N;
  int A[200];
  int c = 0;
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> A[i];
  while (true) {
    bool extra_odd = false;
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 1)
        extra_odd = true;
    }
    if (extra_odd)
      break;
    c++;
  }
  cout << c << endl;
  return 0;
}

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

int main() {
  int N;
  int A[200];
  int c = 0;
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> A[i];
  while (true) {
    bool extra_odd = false;
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 1)
        extra_odd = true;
    }
    if (extra_odd)
      break;
    for (int i = 0; i < N; ++i) {
      A[i] /= 2;
    }
    c++;
  }
  cout << c << endl;
  return 0;
}
Problem p03494 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define A_MAX 10 ^ 9

int main(void) {
  int N;
  ll A[A_MAX];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int count = 0; // 2割回数
  while (true) {
    bool exist_odd = false; // A[i]に一つでも奇数があればtrue
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 0) {
        A[i] /= 2;
      } else {
        exist_odd = true;
        break;
      }
    }
    if (exist_odd == 1)
      break;
    count++;
  }
  cout << count << endl;
  return 0;
}

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

int main(void) {
  int N;
  ll A[A_MAX];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int count = 0; // 2割回数
  while (true) {
    bool exist_odd = false; // A[i]に一つでも奇数があればtrue
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 == 0) {
        A[i] /= 2;
      } else {
        exist_odd = true;
        break;
      }
    }
    if (exist_odd == 1)
      break;
    count++;
  }
  cout << count << endl;
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N, B = 30;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int A, C = 0;
    cin >> A;
    for (; A % 2 == 0; A / 2)
      C++;
    if (C < B)
      B = C;
  }
  cout << B << endl;
}

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

int main() {
  int N, B = 30;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int A, C = 0;
    cin >> A;
    for (; A % 2 == 0; A /= 2)
      C++;
    if (C < B)
      B = C;
  }
  cout << B << endl;
}
Problem p03494 (C++)

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

int main() {
  int x;
  std::cin >> x;
  signed long long y[3];
  for (int i = 0; i < x; i++) {
    cin >> y[i];
  }

  bool flag = false;
  unsigned long int j = 0;
  while (flag == false) {
    for (int i = 0; i < x; i++) {
      if (y[i] % 2 == 1) {
        flag = true;
        break;
      } else {
        y[i] = y[i] / 2;
      }
    }
    if (flag == false) {
      j++;
    }
  }
  std::cout << j << std::endl;
}

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

int main() {
  int x;
  std::cin >> x;
  unsigned long long y[x];
  for (int i = 0; i < x; i++) {
    cin >> y[i];
  }

  bool flag = false;
  unsigned long int j = 0;
  while (flag == false) {
    for (int i = 0; i < x; i++) {
      if (y[i] % 2 == 1) {
        flag = true;
        break;
      } else {
        y[i] = y[i] / 2;
      }
    }
    if (flag == false) {
      j++;
    }
  }
  std::cout << j << std::endl;
}
Problem p03494 (C++)

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

using namespace std;

int main() {
  vector<int> a(100);
  int N, counter = 0;
  bool f = true;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] % 2 != 0) {
      f = false;
    }
  }
  while (f == true) {
    for (int i = 0; i < N; i++) {
      a[i] = a[i] / 2;
      if (a[i] % 2 == 1) {
        f = false;
      }
    }
    counter++;
  }
  cout << counter << endl;
}

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

using namespace std;

int main() {
  vector<int> a(200);
  int N, counter = 0;
  bool f = true;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    if (a[i] % 2 != 0) {
      f = false;
    }
  }
  while (f == true) {
    for (int i = 0; i < N; i++) {
      a[i] = a[i] / 2;
      if (a[i] % 2 == 1) {
        f = false;
      }
    }
    counter++;
  }
  cout << counter << endl;
}
Problem p03494 (C++)

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

int main() {
  int n, a[n];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int flg = 0;
  int count = 0;
  while (flg == 0) {
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 1) {
        flg++;
        break;
      }
    }
    if (flg == 0) {
      count++;
    }
  }
  cout << count << endl;
}


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

int main() {
  int n, a[n];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int flg = 0;
  int count = 0;
  while (flg == 0) {
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 1) {
        flg++;
        break;
      }
    }
    if (flg == 0) {
      count++;
      for (int i = 0; i < n; i++) {
        a[i] /= 2;
      }
    }
  }
  cout << count << endl;
}
Problem p03494 (C++)

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

using namespace std;

int N;
int nums[200];

int main() {
  for (int i = 0; i < N; i++)
    cin >> nums[i];

  int breakFlag = 0;
  int count = 0;
  while (true) {
    for (int i = 0; i < N; ++i) {
      if (nums[i] % 2 == 0) {
        nums[i] /= 2;

      } else {
        breakFlag++;
        break;
      }
    }

    if (breakFlag > 0) {
      break;
    }
    count++;
  }
  cout << count;
}

Fixed submission:
#include <iostream>

using namespace std;

int N;
int nums[200];

int main() {
  cin >> N;
  for (int i = 0; i < N; i++)
    cin >> nums[i];

  int breakFlag = 0;
  int count = 0;
  while (true) {
    for (int i = 0; i < N; ++i) {
      if (nums[i] % 2 == 0) {
        nums[i] /= 2;

      } else {
        breakFlag++;
        break;
      }
    }

    if (breakFlag > 0) {
      break;
    }
    count++;
  }
  cout << count;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  int cnt = 0;
  while (1) {
    int flag = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 != 0)
        flag = 1;
      else
        A[i] /= 2;
    }
    if (flag == 1)
      break;
    cnt++;
  }
  cout << cnt << endl;
}

Fixed submission:
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++)
    cin >> A[i];
  int cnt = 0;
  while (1) {
    int flag = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 != 0)
        flag = 1;
      else
        A[i] /= 2;
    }
    if (flag == 1)
      break;
    cnt++;
  }
  cout << cnt << endl;
}
Problem p03494 (C++)

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

int main() {
  int N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int c = 0;
  while (true) {
    bool flag = false;
    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 != 0) {
        flag = true;
      }
    }
    if (flag)
      break;
    for (int i = 0; i < N; i++) {
      A.at(i) /= 2;
    }
    c++;
  }
  cout << c << endl;
  return 0;
}

Fixed submission:
#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);
  }
  int c = 0;
  while (true) {
    bool flag = false;
    for (int i = 0; i < N; i++) {
      if (A.at(i) % 2 != 0) {
        flag = true;
      }
    }
    if (flag)
      break;
    for (int i = 0; i < N; i++) {
      A.at(i) /= 2;
    }
    c++;
  }
  cout << c << endl;
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N, k = 0, c = 0;
  cin >> N;
  int A[N];
  for (int n = 0; n <= N - 1; n++) {
    cin >> A[n];
  }
  for (int i = 0;; i++) {
    k = A[i % N] % 2;
    if (k != 0) {
      break;
    }
    if (i % N == 0) {
      c++;
    }
  }
  cout << c << endl;
}

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

int main() {
  int N, k = 0, c = 0;
  cin >> N;
  int A[N];
  for (int n = 0; n <= N - 1; n++) {
    cin >> A[n];
  }
  for (int i = 0;; i++) {
    k = A[i % N] % 2;
    if (k != 0) {
      break;
    }
    if (i % N == 0) {
      for (int n = 0; n <= N - 1; n++) {
        A[n] /= 2;
      }
      c++;
    }
  }
  cout << c << endl;
}
Problem p03494 (C++)

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i; i < N; i++) {
    cin >> A[i];
  }
  int s = 0;
  bool a = false;
  while (true) {
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 != 0) {
        a = true;
        break;
      }
      A[i] /= 2;
    }
    s++;
  }
  cout << s << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i; i < N; i++) {
    cin >> A[i];
  }
  int s = 0;
  bool a = false;
  while (true) {
    for (int i = 0; i < N; i++) {
      if (A[i] % 2 != 0) {
        a = true;
        break;
      }
      A[i] /= 2;
    }
    if (a)
      break;
    s++;
  }
  cout << s << endl;
}
Problem p03494 (C++)

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

int main() {
  int n, count = 0, result = 0;
  cin >> n;
  int a[100];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (1) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0) {
        count++;
        a[i] /= 2;
      }
    }
    if (count == n) {
      result++;
      count = 0;
    } else {
      break;
    }
  }
  cout << result;
  return 0;
}

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

int main() {
  int n, count = 0, result = 0;
  cin >> n;
  long long a[200];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  while (1) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 == 0) {
        count++;
        a[i] /= 2;
      }
    }
    if (count == n) {
      result++;
      count = 0;
    } else {
      break;
    }
  }
  cout << result;
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int n, a[200], cnt = 0;
  cin >> n;

  rep(i, 0, n) cin >> a[i];

  while (1) {
    rep(i, 0, n) {
      if (a[i] % 2 != 0) {
        cout << cnt << endl;
        return 0;
      }
    }
    cnt++;
  }
  return 0;
}

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

int main() {
  int n, a[200], cnt = 0;
  cin >> n;

  rep(i, 0, n) cin >> a[i];

  while (1) {
    rep(i, 0, n) {
      if (a[i] % 2 != 0) {
        cout << cnt << endl;
        return 0;
      }
    }

    rep(i, 0, n) { a[i] = a[i] / 2; }

    cnt++;
  }
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int a;
  int b[100];
  int ans = 0;
  cin >> a;
  while (1) {
    for (int i = 0; i < a; ++i) {
      cin >> b[i];
      if (b[i] % 2 != 0 || b[i] < 2) {
        cout << ans << endl;
        return 0;
      } else
        b[i] /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}

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

int main() {
  int a;
  int b[200];
  int ans = 0;
  cin >> a;
  while (1) {
    for (int i = 0; i < a; ++i) {
      cin >> b[i];
      if (b[i] % 2 != 0 || b[i] < 2) {
        cout << ans << endl;
        return 0;
      } else
        b[i] /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}
Problem p03494 (C++)

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

using namespace std;

int main() {
  int n = 0;

  cin >> n;
  int *pAry = NULL;
  pAry = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> pAry[i];
  }

  int count = 0;
  int breaking = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (pAry[i] % 2 == 0) {
        pAry[i] = pAry[i] / 2;
      } else {
        breaking = 1;
        break;
      }
    }
    if (breaking == 1) {
      break;
    }
    count++;
  }

  return count;
}

Fixed submission:
#include <iostream>

using namespace std;

int main() {
  int n = 0;

  cin >> n;
  int *pAry = NULL;
  pAry = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> pAry[i];
  }

  int count = 0;
  int breaking = 0;
  while (1) {
    for (int i = 0; i < n; i++) {
      if (pAry[i] % 2 == 0) {
        pAry[i] = pAry[i] / 2;
      } else {
        breaking = 1;
        break;
      }
    }
    if (breaking == 1) {
      break;
    }
    count++;
  }

  cout << count << endl;
}
Problem p03494 (C++)

Buggy submission (status: Time Limit Exceeded):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, n, k;
  cin >> N;
  for (int i = 0; i < N; i++) {
    n = 0;
    cin >> A;
    for (int j = 0; true; j++) {
      if (A % 2 == 0) {
        n++;
        A / 2;
      } else {
        break;
      }
    }
    if (i == 0) {
      k = n;
    } else {
      if (k > n) {
        k = n;
      }
    }
  }
  cout << k << endl;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, A, n, k;
  cin >> N;
  for (int i = 0; i < N; i++) {
    n = 0;
    cin >> A;
    for (int j = 0; true; j++) {
      if (A % 2 == 0) {
        n++;
        A /= 2;
      } else {
        break;
      }
    }
    if (i == 0) {
      k = n;
    } else {
      if (k > n) {
        k = n;
      }
    }
  }
  cout << k << endl;
}
Problem p03494 (C++)

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
  for (auto v : (V))                                                           \
    cout << v << ' ';
#define PRINT_ENTER() cout << endl;

int main() {
  /* code */
  int n;
  cin >> n;
  int a;
  int bit{};
  REP(i, 0) {
    cin >> a;
    bit = (a | bit);
  }
  int counter{};
  while ((bit & 1) == 0) {
    bit = bit >> 1;
    counter++;
  }
  PRINT(counter);
  return 0;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V)                                                           \
  for (auto v : (V))                                                           \
    cout << v << ' ';
#define PRINT_ENTER() cout << endl;

int main() {
  /* code */
  int n;
  cin >> n;
  int a;
  int bit{};
  REP(i, n) {
    cin >> a;
    bit = (a | bit);
  }
  int counter{};
  while ((bit & 1) == 0) {
    bit = bit >> 1;
    counter++;
  }
  PRINT(counter);
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N, X, Y, A;
  cin >> N;
  X = 64;
  for (int i = 0; i < N; i++) {
    cin >> A;
    for (int j = 0; A != 0; j++) {
      if (A / 2 == (A + 1) / 2) {
        Y++;
        A /= 2;
      }
      if (X >= Y) {
        X = Y;
      }
    }
  }
  cout << X << endl;
}

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

int main() {
  int N, X, Y, A;
  cin >> N;
  X = 64;
  for (int i = 0; i < N; i++) {
    cin >> A;
    Y = 0;
    while (A / 2 == (A + 1) / 2) {
      Y++;
      A /= 2;
    }
    if (X >= Y) {
      X = Y;
    }
  }
  cout << X << endl;
}
Problem p03494 (C++)

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

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

  int a, min = INT_MAX;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < min; j++) {
      if (a % 2 == 0) {
        a /= 2;
      } else {
        min = j;
        break;
      }
    }
  }

  cout << min << endl;
}

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

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

  int a, min = INT_MAX;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 0; j < min; j++) {
      if (a % 2 == 0) {
        a /= 2;
      } else {
        min = j;
        break;
      }
    }
  }

  cout << min << endl;
}
Problem p03494 (C++)

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

int main() {
  int n;
  int min = 9999;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp, count;
    count = 0;
    cin >> temp;
    while (temp % 2 == 0) {
      temp / 2;
      count++;
    }
    if (count < min)
      min = count;
  }

  cout << min;
}

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

int main() {
  int n;
  int min = 9999;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp, count;
    count = 0;
    cin >> temp;
    while (temp % 2 == 0) {
      temp /= 2;
      count++;
    }
    if (count < min)
      min = count;
  }

  cout << min;
}
Problem p03494 (C++)

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

int main() {
  int n, a[200], ans = 1001001001;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int count = 0;
    while (ans % 2 == 0) {
      count++;
      a[i] /= 2;
    }
    ans = min(count, ans);
  }
  cout << ans << endl;
}

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

int main() {
  int n, a[200], ans = 1001001001;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    int count = 0;
    while (a[i] % 2 == 0) {
      count++;
      a[i] /= 2;
    }
    ans = min(count, ans);
  }
  cout << ans << endl;
}
Problem p03494 (C++)

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

int main() {
  int n, a, c = 0, m = INT_MAX;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    while (a % 2 == 0) {
      a >> 1;
      c++;
    }
    m = min(m, c);
    c = 0;
  }
  cout << m << endl;
  return 0;
}

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

int main() {
  int n, a, c = 0, m = INT_MAX;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    while (a % 2 == 0) {
      a >>= 1;
      c++;
    }
    m = min(m, c);
    c = 0;
  }
  cout << m << endl;
  return 0;
}
Problem p03494 (C++)

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int ans = 0;
  while (true) {
    bool odd = false;
    for (int i = 0; i < N; i++) {
      if (vec.at(i) % 2 != 0) {
        odd = true;
      }
    }
    if (odd) {
      break;
    }
    for (int i = 0; i < N; i++) {
      vec.at(i) / 2;
    }
    ans++;
  }
  cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  int ans = 0;
  while (true) {
    bool odd = false;
    for (int i = 0; i < N; i++) {
      if (vec.at(i) % 2 != 0) {
        odd = true;
      }
    }
    if (odd) {
      break;
    }
    for (int i = 0; i < N; i++) {
      vec.at(i) /= 2;
    }
    ans++;
  }
  cout << ans << endl;
}
Problem p03494 (C++)

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

int t = 1000000000;

int recur(int n, int c) {
  if (c > t) {
    return c;
  }
  if (n % 2 == 0) {
    return recur(n % 2, c + 1);
  } else {
    return c;
  }
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    int c;
    c = recur(a, 0);
    if (c < t) {
      t = c;
    }
  }
  cout << t << endl;
  return 0;
}


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

int t = 1000000000;

int recur(int n, int c) {
  if (c > t) {
    return c;
  }
  if (n % 2 == 0) {
    return recur(n / 2, c + 1);
  } else {
    return c;
  }
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    int c;
    c = recur(a, 0);
    if (c < t) {
      t = c;
    }
  }
  cout << t << endl;
  return 0;
}