Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03608 (python)

Fixed submission:
from itertools import permutations
from heapq import *

N,M,R=map(int,input().split())
r=list(map(int,input().split()))
INF=float("inf")
G=[[INF]*N for i in range(N)]
for i in range(M):
    A,B,C=map(int,input().split())
    A,B=A-1,B-1
    G[A][B]=C
    G[B][A]=C
def distance(a,b):
    stack=[(G[a][i],i) for i in range(N) if G[a][i]!=INF]
    heapify(stack)
    reached=[0]*N
    reached[0]=1
    dis=[INF]*N
    dis[0]=0
    while(stack):
        c,i=heappop(stack)
        if reached[i]==1:
            continue
        if dis[i]<=c:
            continue
        dis[i]=c
        if i==b:
            return c
        reached[i]=1
        for j in range(N):
            if G[i][j]!=INF and reached[j]==0:
                heappush(stack,(G[i][j]+dis[i],j))
D=[[0]*N for i in range(N)]
for i in r:
    for j in r:
        if i>=j:
            continue
        D[i-1][j-1]=distance(i-1,j-1)
        D[j-1][i-1]=D[i-1][j-1]
ans=10**9
for r_ in permutations(r):
    res=0
    for i in range(R-1):
        res+=D[r_[i]-1][r_[i+1]-1]
    ans=min(ans,res)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,R=map(int,input().split())
INF=10**9
d=[[INF]*N for i in range(N)]
r=list(map(int,input().split()))
for i in range(M):
  A,B,C=map(int,input().split())
  d[A-1][B-1]=C
  d[B-1][A-1]=C
for k in range(N):
  for i in range(N):
    for j in range(N):
      d[i][j]=min(d[i][j],d[i][k]+d[k][j])
ans=10**9
for L in permutations(r):
  temp=0
  for j in range(R-1):
    temp+=d[L[j]-1][L[j+1]-1]
  ans=min(temp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations
N,M,R=map(int,input().split())
r=list(map(int,input().split()))
INF=float("inf")
G=[[INF]*N for i in range(N)]
for i in range(M):
    A,B,C=map(int,input().split())
    A,B=A-1,B-1
    G[A][B]=C
    G[B][A]=C
def distance(a,b):
    stack=[(G[a][i],i) for i in range(N) if G[a][i]!=INF]
    heapify(stack)
    reached=[0]*N
    reached[0]=1
    dis=[INF]*N
    dis[0]=0
    while(stack):
        c,i=heappop(stack)
        if reached[i]==1:
            continue
        if dis[i]<=c:
            continue
        dis[i]=c
        if i==b:
            return c
        reached[i]=1
        for j in range(N):
            if G[i][j]!=INF and reached[j]==0:
                heappush(stack,(G[i][j]+dis[i],j))
D=[[0]*N for i in range(N)]
for i in r:
    for j in r:
        if i>=j:
            continue
        D[i-1][j-1]=distance(i-1,j-1)
        D[j-1][i-1]=D[i-1][j-1]
ans=10**9
for r_ in permutations(r):
    res=0
    for i in range(R-1):
        res+=D[r_[i]-1][r_[i+1]-1]
    ans=min(ans,res)
print(ans)
Problem p03611 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
B=[0]*(4+10**5)
for a in A:
    B[a+1]+=1
    B[a]+=1
    B[a+2]+=1
print(max(B))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
B=[0]*(1+10**5)
for a in A:
    B[a+1]+=1
    B[a]+=1
    B[a+2]+=1
print(max(B))
Problem p03633 (python)

Fixed submission:
from fractions import gcd
N=int(input())
T=1
for i in range(N):
    T1=int(input())
    t=gcd(T,T1)
    T=(T1//t)*(T//t)*t
print(T)

Buggy submission (verdict: Runtime Error):
N=int(input())
T=1
for i in range(N):
    T1=int(input())
    t=gcd(T,T1)
    T=(T1//t)*(T//t)*t
print(T)
Problem p03638 (python)

Fixed submission:
H,W=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
if W==1:
    tmp=0
    for a in A:
        tmp+=1
        for j in range(a):
            print(tmp)
    quit()
G=[[0]*W for i in range(H)]
i=0
j=0
tmp=0
t=1
for a in A:
    tmp+=1
    for k in range(a):
        G[i][j]=tmp
        if j==W-1:
            if t==0:
                i+=1
                t=1
                dx=0
            elif t==1:
                dx=-1
                t=0
        elif j==0:
            if t==0:
                i+=1
                t=1
                dx=0
            elif t==1:
                dx=1
                t=0
        j+=dx
for k in G:
    print(*k,sep=" ")

Buggy submission (verdict: Runtime Error):
H,W=map(int,input().split())
N=int(input())
A=list(map(int,input().split()))
G=[[0]*W for i in range(H)]
i=0
j=0
tmp=0
t=1
for a in A:
    tmp+=1
    for k in range(a):
        G[i][j]=tmp
        if j==W-1:
            if t==0:
                i+=1
                t=1
                dx=0
            elif t==1:
                dx=-1
                t=0
        elif j==0:
            if t==0:
                i+=1
                t=1
                dx=0
            elif t==1:
                dx=1
                t=0
        j+=dx
for k in G:
    print(*k,sep=" ")
Problem p03645 (python)

Fixed submission:
from collections import defaultdict
N,M=map(int,input().split())
dict=defaultdict(int)
l1=[]
l2=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        l1.append(b)
    if b==N:
        dict[a]=1
for i in l1:
    if dict[i]:
        print("POSSIBLE")
        quit()
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
dict=defaultdict(int)
l1=[]
l2=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        l1.append(b)
    if b==N:
        dict[a]=1
for i in l1:
    if dict[i]:
        print("POSSIBLE")
        quit()
print("IMPOSSIBLE")
Problem p03657 (python)

Fixed submission:
A,B=map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%3==0:
    print("Possible")
else:
    print("Impossible")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A%3==0 or B%3==0 or (A+B)%3==0:
    print(Possible)
else:
    print(Impossible)
Problem p03660 (python)

Fixed submission:
from collections import deque
N=int(input())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
stack1=deque(G[0])
stack2=deque(G[N-1])
X=[-1]*N
X[0]=1
X[N-1]=0
while(stack1 or stack2):
    Stack1=deque()
    for i in stack1:
        if X[i]==-1:
            X[i]=1
            for j in G[i]:
                if X[j]==-1:
                    Stack1.append(j)
    stack1=Stack1
    Stack2=deque()
    for i in stack2:
        if X[i]==-1:
            X[i]=0
            for j in G[i]:
                if X[j]==-1:
                    Stack2.append(j)
    stack2=Stack2
f,s=0,0
for i in range(N):
    if X[i]==1:
        f+=1
    else:
        s+=1
if f>s:
    print("Fennec")
else:
    print("Snuke")

Buggy submission (verdict: Runtime Error):
N=int(input())
G=[[] for i in range(N)]
for i in range(N-1):
    a,b=map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
stack1=deque(G[0])
stack2=deque(G[N-1])
X=[-1]*N
X[0]=1
X[N-1]=0
while(stack1 or stack2):
    Stack1=deque()
    for i in stack1:
        if X[i]==-1:
            X[i]=1
            for j in G[i]:
                if X[j]==-1:
                    Stack1.append(j)
    stack1=Stack1
    Stack2=deque()
    for i in stack2:
        if X[i]==-1:
            X[i]=0
            for j in G[i]:
                if X[j]==-1:
                    Stack2.append(j)
    stack2=Stack2
f,s=0,0
for i in range(N):
    if X[i]==1:
        f+=1
    else:
        s+=1
if f>s:
    print("Fennec")
else:
    print("Sunuke")
Problem p03679 (python)

Fixed submission:
X,A,B=map(int,input().split())
if B-A>X:
    print("dangerous")
elif B-A>0:
    print("safe")
else:
    print("delicious")

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
        self.size = [1] * (n+1)

    # 検索
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    # 併合
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    # 同じ集合に属するか判定
    def same_check(self, x, y):
        return self.find(x) == self.find(y)

N=int(input())
X=[]
Y=[]
for i in range(N):
    x,y=map(int,input().split())
    X.append((x,i))
    Y.append((y,i))
X.sort()
Y.sort()
E=[]
ans=0
count=1
for i in range(N-1):
    a=X[i]
    b=X[i+1]
    c=Y[i]
    d=Y[i+1]
    E.extend([(b[0]-a[0],X[i][1],X[i+1][1]),(d[0]-c[0],Y[i][1],Y[i+1][1])])
E.sort()

U=UnionFind(N)
i=0
while(count<N):
    cost,v1,v2=E[i]
    if not U.same_check(v1,v2):
        U.union(v1,v2)
        ans+=cost
        count+=1
    i+=1
print(ans)
Problem p03695 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
c=[0]*9
for i in A:
    c[min(i//400,8)]+=1
for i in range(8):
    if c[i]>0:
        c[i]=1
if c[:8]==[0]*8:
    print(1,c[-1])
else:
    print(sum(c[:8]),sum(c[:8])+c[-1])

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
c=[0]*9
for i in A:
    c[i//400]+=1
for i in range(8):
    if c[i]>0:
        c[i]=1
if c[:8]==[0]*8:
    print(min(1,c[-1]),c[-1])
else:
    print(sum(c[:8]),sum(c[:8])+c[-1])
Problem p03716 (python)

Fixed submission:
from heapq import *

N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range(N):
    heappush(B,A[i])
sumB=[sum(B)]
for i in range(N,2*N):
    heappush(B,A[i])
    poped=heappop(B)
    sumB.append(sumB[-1]-poped+A[i])

A.reverse()
C=[]
for i in range(N):
    heappush(C,A[i]*(-1))
sumC=[(-1)*sum(C)]
for i in range(N,2*N):
    heappush(C,A[i]*(-1))
    poped=heappop(C)*(-1)
    sumC.append(sumC[-1]-poped+A[i])
sumC.reverse()
ans=-10**19
for i,j in zip(sumB,sumC):
    ans=max(ans,i-j)
print(ans)

Buggy submission (verdict: Runtime Error):
from heapq import *

N=int(input())
A=map(int,input().split())
A.reverse()
B=[]
heap=[]
for i in range(N):
    heappush(heap,A[i])
for i in range(N,2*N):
    if heap[0]<A[i]:
        B.append(heappop(heap))
        heappush(heap,A[i])
    else:
        B.append(A[i])
C=[]
for i in range(2*N,3*N):
    if 2*B[-1]-A[i]-heap[0]>0:
        C.append(B.pop(-1))
        B.append(heappop(heap))
    else:
        C.append(A[i])
print(sum(C)-sum(B))
Problem p03761 (python)

Fixed submission:
from collections import defaultdict

n=int(input())
l=[defaultdict(int) for i in range(n)]
for i in range(n):
    S=input()
    for s in S:
        l[i][s]+=1
t=""
for i in range(26):
    a=10**30
    for j in range(n):
        a=min(a,l[j][chr(i+ord("a"))])
    t+=chr(i+ord("a"))*a
print(t)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[defaultdict(int) for i in range(n)]
for i in range(n):
    S=input()
    for s in S:
        l[i][s]+=1
t=""
for i in range(26):
    a=10**30
    for j in range(n):
        a=min(a,l[j][chr(i+ord("a"))])
    t+=chr(i+ord("a"))*a
print(t)
Problem p03848 (python)

Fixed submission:
N=int(input())
A=list(map(int,input().split()))
A.sort()
INF=int(1e9+7)
if N%2==1:
    if A[0]!=0:
        print(0)
        quit()
    for i in range((N-1)//2):
        if A[2*i+1]!=2*(i+1) or A[2*i+2]!=2*(i+1):
            print(0)
            quit()
    print(2**((N-1)//2)%INF)
else:
    for i in range(N//2):
        if A[2*i]!=2*i+1 or A[2*i+1]!=2*i+1:
            print(0)
            quit()
    print(2**(N//2)%INF)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
INF=1e9+7
if N%2==1:
    if A[0]!=0:
        print(0)
        quit()
    for i in range((N-1)//2):
        if A[2*i+1]!=2*(i+1) or A[2*i+2]!=2*(i+1):
            print(0)
            quit()
    print(2**((N-1)//2)%INF)
else:
    for i in range(N//2):
        if A[2*i]!=2*i+1 or A[2*i+1]!=2*i+1:
            print(0)
            quit()
    print(2**(N//2)%INF)
Problem p04001 (python)

Fixed submission:
import copy
S=input()
lst=[]
def Sum(l,S):
    if S=="A":
        return sum(l)
    a=l.pop()
    x=copy.copy(l)
    x.append(a*10+int(S[0]))
    y=copy.copy(l)
    y.extend([a,int(S[0])])
    return Sum(x,S[1:])+Sum(y,S[1:])
S+="A"
lst.append(int(S[0]))
print(Sum(lst,S[1:]))

Buggy submission (verdict: Runtime Error):
S=input()
ans=0
for i in range(2**(len(S)-1)):
    k=bin(i)[2:].zfill(len(S)-1)
    l=int(S[0])
    for j in range(len(k)):
        t=int(k[j])
        if t==1:
            ans+=l
            l=int(S[j+1])
        else:
            l=l*10+int(S[j+1])
    ans+=l
print(ans)
Problem p02945 (python)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split())
print(max(a+b,a-b,a*b))

Buggy submission (verdict: Runtime Error):
a, b = int(input().split())
m = a + b
m = m < a - b if m = a - b else m
m = m < a * b if m = a * b else m
print(m)
Problem p02957 (python)

Fixed submission:
a, b = (int(x) for x in input().split())
ans = int(a/2+b/2+0.5)
if abs(a-ans) == abs(b-ans):
    print(ans)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
ba, bb = (int(x) for x in input().split())
m = a if a > b else b
for i in range(m+2):
    a = abs(a-i)
    b = abs(b-i)
    if a == b:
        print(i)
        break:
if i == m+1:
    print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
ba, bb = (int(x) for x in int(input().split()))
m = a if a > b else b
for i in range(m+2):
    a = abs(a-i)
    b = abs(b-i)
    if a == b:
        print(i)
if i == m+1:
    print('IMPOSSIBLE')
Problem p02945 (python)

Fixed submission:
x, y = list(map(int, input().split()))

num1 = x + y
num2 = x - y
num3 = x * y

if num1 > num2:
    if num1 > num3:
        ans = num1
    else:
        ans = num3
elif num2 > num3:
    ans = num2
else:
    ans = num3

print(ans)

Buggy submission (verdict: Runtime Error):
date = inp.readline().rstrip().split(' ')
x = int(date[0])
y = int(date[1])
num1 = x + y
num2 = x - y
num3 = x * y

if num1 > num2:
    if num1 > num3:
        ans = num1
    else:
        ans = num3
elif num2 > num3:
    ans = num2
else:
    ans = num3

print(ans)
Problem p02994 (python)

Fixed submission:
N, L = list(map(int, input().split()))

apple_pie = 0
for i in range(1, N+1):
    apple_pie += L + i - 1

ab = []
for k in range(1, N+1):
    ab.append(abs(L + k - 1))

print(apple_pie - (L + ab.index(min(ab))  ))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1, N+1):
    apple_pie = 0
    apple_pie += L + i - 1

for k in range(1, N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  ))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1,N+1):
    apple_pie = 0
    apple_pie += L + i - 1

for k in range(1,N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  - 1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1,N+1):
    apple_pie += L + i - 1

for k in range(1,N+1):
    ab = []
    ab += abs(L + k - 1)
    if min(ab):
        print(apple_pie - (L + k - 1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  - 1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k - 1)

if min(ab):
    print(apple_pie - (L + ab.index(min(ab))  - 1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k - 1)
    if min(ab):
        print(apple_pie - (L + k - 1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(1:N+1):
    apple_pie += L + i - 1

for k in range(1:N+1):
    ab = []
    ab += abs(L + k -1)
    if min(ab):
        print(apple_pie - (L + k -1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

for i in range(N):
    apple_pie += L + i - 1

for k in range(N):
    ab = []
    ab += abs(L + k -1)
    if min(ab):
        print(apple_pie - (L + k -1))

Buggy submission (verdict: Runtime Error):
N, L = list(map(int, input().split()))

taste = L + i -1
for i in range(N):
    apple_pie_o += taste
    
    for k in range(N):
        ab = []
        ab += abs(L + k -1)
        if min(ab):
            apple_pie_a=apple_pie_o - (L + k -1)
            print(apple_pie_a)

Buggy submission (verdict: Runtime Error):
N = input()
L = input()

taste = L + i -1
for i in range(N):
    apple_pie_o += taste
    
    for k in range(N):
        ab = []
        ab += abs(L + k -1)
        if min(ab):
            apple_pie_a=apple_pie_o - (L + k -1)
            print(apple_pie_a)
Problem p03308 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

A.sort()
ans = A[N-1] - A[0]
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

As = A.sort()
ans = As[len(N)-1] - As[0]
print(ans)
Problem p03331 (python)

Fixed submission:
N = int(input())

def sum_10(n):
  return sum([int(l) for l in str(n)])

li=[]
for i in range(1,N//2 +1):
    if N - N//2 <= N - i <= N:
      li.append(sum_10(i)+sum_10(N - i))
print(min(li))

Buggy submission (verdict: Runtime Error):
N = int(input())

def sum_10(n):
  return sum[int(l) for l in str(n)]

li=[]
for i in range(1,N//2 +1):
  for k in range(N-N//2,N+1):
    if i + k == N:
      li.append(sum_10(i)+sum_10(k))
print(min(li))
Problem p03369 (python)

Fixed submission:
S = input()
S_list = [S[i:i+1] for i in range(len(S))]
count = 0
for k in range(len(S)):
  if S_list[k] == 'o':
    count += 1
  else:
    pass
print(700 + 100 * count)

Buggy submission (verdict: Runtime Error):
S = input()
S_list = [S[i:i+1] for i in range(S)]
count = 0
for k in range(len(S)):
  if S_list[k]==o:
    count += 1
  else:
    pass
print(700 + 100*count)
Problem p03433 (python)

Fixed submission:
N = int(input())
A = int(input())

if N % 500 <= A:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = input()
A = input()

if N % 500 <= A:
  print('YES')
else:
  print('NO')
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500 *i + 100 *j + 50 *k == X:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count = 0

for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500 *i + 100 *j + 50 *k == X
          count += 1

print(count)
Problem p03493 (python)

Fixed submission:
s = input()
N = [int(s[i:i+1]) for i in range(len(s))]
count = 0
for i in range(len(N)):
  if N[i] == 1:
    count += 1
  else:
    pass 
print(count)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
A = [int(i) for i in input().split()]

l=[]
for i in range(N+1):
  l.append(A.count(i))

ls = sorted(l,reverse=True)

j= K
ans = 0
while ls[j] != 0:
  ans += ls[j]

print(ans)
Problem p03494 (python)

Fixed submission:
N = int(input())
A = [int(l) for l in input().split()]


count1 = 0
k = 0
while True:
  count2 = 0
  for i in range(N):
      if A[i]/2** k % 2 !=0:
        break
      else:
        count2 += 1
  if count2 == N:
    count1 += 1
  else:
    break
  k += 1

print(count1)

Buggy submission (verdict: Runtime Error):
N = int(raw_input())
A = map(int, raw_input().split())

def hmtd(n):
  ans = 0
  while n % 2 == 0:
    n /= 2
    ans += 1
    return ans

ans = min(map(hmtd, A))
print(ans)

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible(a)))
 
print ans

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible(), a))
 
print ans

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))
 
print ans

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible(a)))
 
print ans

Buggy submission (verdict: Runtime Error):
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible, a))
 
print ans
Problem p02958 (python)

Fixed submission:
N=int(input())
p=list(map(int,input().split()))
A=p.copy()
A.sort()
if p==A:
  print("YES")
else:
  flag=0
  for i in range(N):
    for j in range(i):
      p[i],p[j]=p[j],p[i]
      if p==A:
        flag=1
        break
      else:
        p[i],p[j]=p[j],p[i]
    if flag==1:
      break
  if flag==0:
    print("NO")
  else:
    print("YES")

Buggy submission (verdict: Runtime Error):
N=int(input())
p=list(map(int,input().split()))
A=p.copy()
A.sort()
if p==A:
  print("YES")
else:
  i=p.index(max(p))
  min1=p[N-1]
  for j in range(N-2,0,-1):
    if p[j]<min1:
      min1=p[j]
      min_index=j
  p[i],p[min_index]=p[min_index],p[i]
  if p==A:
    print("YES")
  else:
    print("NO")
Problem p02971 (python)

Fixed submission:
N=int(input())
A=[0 for i in range(N)]
for i in range(N):
  A[i]=int(input())
max1=max(A)
numbers_of_max1=0
for i in range(N):
  if A[i]==max1:
    numbers_of_max1+=1
    
if numbers_of_max1>1:
  for i in range(N):
    print(max1)
else:
  L=A.copy()
  L.pop(L.index(max1))
  max2 = max(L)
  for i in range(N):
    if A[i]==max1:
      print(max2)
    else:
      print(max1)

Buggy submission (verdict: Runtime Error):
N=int(input())
A=[0 for i in range(N)]
for i in range(N):
  A[i]=int(input())

for i in range(N):
  if i == A.index(max(A)):
    A.pop(i)
    A.sort
    print(A[N-2])
  else:
    print(max(A))
Problem p02983 (python)

Fixed submission:
A,B=map(int,input().split())
mod = 2018
flag =0
for i in range(A,B):
  x = i % 2019
  for j in range(i+1,B+1):
    j = j % 2019
    mod = min(mod, (x*j)%2019)
    if mod == 0:
      flag = 1
      break
  if flag:
    break

print(mod)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
mod = 2018
flag =0
for i in range(A,B):
  x = i % 2019
  for j in range(i+1,B+1):
    j = j % 2019
    mod = min(mod, (x*j)%2019)
    if mod = 0:
      flag = 1
      break
  if flag:
    break

print(mod)
Problem p03485 (python)

Fixed submission:
import math
a,b=map(int, input().split())
x=math.ceil((a+b)/2)
print(x)

Buggy submission (verdict: Runtime Error):
a,b=map(int, input(),split())
x=round(a/b)
print(x)
Problem p03238 (python)

Fixed submission:
if(input() == "1"):
  print("Hello World")
else:
  print(int(input()) + int(input()))

Buggy submission (verdict: Runtime Error):
n = input()
if(n == 1):
  print("Hello World")
else:
  print(input() + input())
Problem p03280 (python)

Fixed submission:
num = input().split(' ')
a = int(num[0]) - 1
b = int(num[1]) - 1
print(a*b)

Buggy submission (verdict: Runtime Error):
num = input().split(' ')
print((int(num[0]) - 1)＊(int(num[1]) - 1))

Buggy submission (verdict: Runtime Error):
num = input().split(' ')
print((int(num[0]) - 1)＊(int(num[1]) - 1)
Problem p03292 (python)

Fixed submission:
nums = list(map(int, input().split(' ')))
nums.sort()
buf = nums[0]
nums = list(map(lambda x: x - buf, nums))
print(nums[2])

Buggy submission (verdict: Runtime Error):
nums = map(int, input().split(' '))
nums.sort()
map(-nums[0], nums)
print(nums[2] - nums[1])