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

Fixed submission:
S=list(map(int,list(input())))
def manyformulas(s):
    if len(s)==1:
        return s[0]
    return s[0]*2**(len(s)-2)+manyformulas(s[1:])+manyformulas([s[0]*10+s[1]]+s[2:])
print(manyformulas(S))

Buggy submission (verdict: Runtime Error):
S=list(map(int,list(input())))
def manyformulas(s):
    if len(s)==1:
        return s[0]
    return s[0]*2**(len(s)-2)+manyformulas(s[1:])+manyformulas([s[0]*10+s[1], *s[2:]])
print(manyformulas(S))
Problem p04044 (python)

Fixed submission:
N, L = map(int, input().split())
Slist = list(input() for _ in range(N))
Slist.sort()
print(''.join(Slist))

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
Slist = list(input() for _ in range(N))
print(''.join(Slist.sort()))
Problem p02780 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
tmp = sum(P[:K])
high = tmp
e = 0
for i in range(1, N-K+1):
    tmp -= P[i-1]
    tmp += P[i+K-1]
    if tmp > high:
        high = tmp
        e = i
exp = 0
for p in P[e:e+K]:
    exp += sum(range(1,p+1)) / p

print(exp)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
tmp = 0
for p in P[0:K]:
    tmp += p
high = tmp
for i in range(1, N-K+1):
    tmp -= P[i-1]
    tmp += P[i+K-1]
    if tmp > high:
        high = tmp
        e = i
exp = 0
for p in P[e:e+K]:
    exp += sum(range(1,p+1)) / p

print(exp)
Problem p02813 (python)

Fixed submission:
import sys
import numpy as np
import itertools
input = sys.stdin.readline

N = int(input())
P = tuple(input().split())
Q = tuple(input().split())
p_all = sorted(list(itertools.permutations(P, N)))
q_all = sorted(list(itertools.permutations(Q, N)))
p_in = p_all.index(P)
q_in = q_all.index(Q)
ans = abs(q_in - p_in)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
from scipy import special
import numpy as np
import itertools
input = sys.stdin.readline

N = int(input())
# P = int(input().replace(' ', ''))
# Q = int(input().replace(' ', ''))
k = int(special.factorial(N))
# arr = np.arange(k)
# print(P)
# print(Q)
# print(k)
# print(arr)
# print(np.where(arr == 1))
P = tuple(input().split())
Q = tuple(input().split())
p_all = sorted(list(itertools.permutations(P, N)))
q_all = sorted(list(itertools.permutations(Q, N)))
p_in = p_all.index(P)
q_in = q_all.index(Q)
ans = abs(q_in - p_in)
print(ans)
Problem p02818 (python)

Fixed submission:
A, B, K = map(int, input().split())
a = max(0, A-K)
K = max(0, K-A)
b = max(0, B-K)
print(str(a) + ' ' + str(b))

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
a = max(0, A-K)
K = max(0, K-A)
if K > 0:
    b = max(0, B-K)
print(str(a) + ' ' + str(b))

Buggy submission (verdict: Runtime Error):
A, B, K = map(int, input().split())
a = max(0, A-K)
K = max(0, K-A)
print(max(0, K-A))
if K > 0:
    b = max(0, B-K)
print(str(a) + ' ' + str(b))
Problem p02945 (python)

Fixed submission:
A, B = [int(i) for i in input().split()]
print(max(A+B, A-B, A*B))

Buggy submission (verdict: Runtime Error):
N = int(input())
S={}
for _ in range(N):
  s = ''.join(sorted(input().rstrip()))
  if s in S:
    S[s] += 1
  else:
    S[s] = 1

ans=0
for s in S.values():
  ans += s*(s-1)//2
  
print(ans)
Problem p02994 (python)

Fixed submission:
N, L = map(int, input().split())
A = [L+i for i in range(N)]

A.remove(min(max(A), *[abs(a) for a in A]))

print(sum(A))

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

A.remove(min([abs(a) for a in A]))
print(sum(A))
Problem p03160 (python)

Fixed submission:
import sys
#from functools import lru_cache
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
INF = 10**5+1
cost = [INF]*N
cost[0] = 0
cost[1] = abs(H[0] - H[1])

#@lru_cache(maxsize=None)
def dp(i):
  if cost[i] != INF:
    return cost[i]
  else:
    cost[i] = min(
      dp(i-1) + abs(H[i-1] - H[i]),
      dp(i-2) + abs(H[i-2] - H[i]))
  return cost[i]

for i in range(N-1):
  dp(i)
print(dp(N-1))

Buggy submission (verdict: Runtime Error):
import sys
#from functools import lru_cache
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
INF = 10**5+1
cost = [INF]*N
cost[0] = 0
cost[1] = abs(H[0] - H[1])

#@lru_cache(maxsize=None)
def dp(i):
  if cost[i] != INF:
    return cost[i]
  else:
    cost[i] = min(
      dp(i-1) + abs(H[i-1] - H[i]),
      dp(i-2) + abs(H[i-2] - H[i]))
  return cost[i]

print(dp(N-1))

Buggy submission (verdict: Runtime Error):
import sys
#from functools import lru_cache
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
INF = 10**4+1
cost = [INF]*N
cost[0] = 0
cost[1] = abs(H[0] - H[1])

#@lru_cache(maxsize=None)
def dp(i):
  if cost[i] != INF:
    return cost[i]
  else:
    cost[i] = min(
      dp(i-1) + abs(H[i-1] - H[i]),
      dp(i-2) + abs(H[i-2] - H[i]))
  return cost[i]

print(dp(N-1))

Buggy submission (verdict: Runtime Error):
import sys
from functools import lru_cache
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
cost = [0]*N

@lru_cache(maxsize=None)
def dp(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(H[i-1] - H[i])
  else:
    return min(
      dp(i-1) + abs(H[i-1] - H[i]),
      dp(i-2) + abs(H[i-2] - H[i]))
  
print(dp(N-1))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
cost = [0]*N

def dp(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(H[i-1] - H[i])
  else:
    return min(
      dp(i-1) + abs(H[i-1] - H[i]), 
      dp(i-2) + abs(H[i-2] - H[i]))
  
print(dp(N-1))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

N = int(input())
H = [int(h) for h in input().split()]
cost = [0]*N

def dp(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(H[i-1] - H[i])
  else:
    return min(
      dp(i-1) + abs(H[i-1] - H[i]), 
      dp(i-2) + abs(H[i-2] - H[i]))
  
print(dp(N-1))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(h) for h in input().split()]
cost = [0]*N

def dp(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(H[i-1] - H[i])
  else:
    return min(
      dp(i-1) + abs(H[i-1] - H[i]), 
      dp(i-2) + abs(H[i-2] - H[i]))
  
print(dp(N-1))
Problem p02778 (python)

Fixed submission:
for i in range(0,len(input())):
 print("x",end="")
print()

Buggy submission (verdict: Runtime Error):
for i in range(0,len(input()))
 print("x",end="")
print()
Problem p03386 (python)

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


temp = []

for i in range(a,a+k):
    temp.append(i)
    if i== b:
        break

for i in range(b-k+1,b+1):
    if i < a:
        continue
    if i in temp:
        continue
    temp.append(i)

for i in temp:
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = list(map(int,input().split()))


import numpy as np

X = np.arange(a,b+1)
Y = (X<a+k)+(X>b-k)
count = 0

for i in a:
     if Y[count]:
         print(X[count])
     count+=1

Buggy submission (verdict: Runtime Error):
a,b,k = list(map(int,input().split()))

temp = []

count = a

while count < a+k:
    if count == b:
        break
    print(count)
    temp.append(count)
    count += 1

count = b-k+1

while count <= b:
    if count < temp[-1]:
        count = temp[-1]
    if count in temp:
        count += 1
        continue
    print(count)
    count += 1
Problem p03556 (python)

Fixed submission:
a=input()
print(int(int(a)**0.5)*int(int(a)**0.5))

Buggy submission (verdict: Runtime Error):
a=input()
print(int(a**0.5)*int(a**0.5))
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,raw_input().split())
print "B" if abs(a-x)>abs(b-x) else "A"

Buggy submission (verdict: Runtime Error):
x,a,b=raw_input().split()
print max(abs(a-x),abs(b-x))
Problem p03856 (python)

Fixed submission:
S = raw_input().split()[0]
t = ['dreameraser','dreamerase','dreamer','dream','eraser','erase']
while len(S) > 0:
    for i in t:
        if S[-len(i):]==i:
            S = S[:-len(i)]
            break
        elif i == t[-1]:
            print "NO"
            exit()
print "YES"

Buggy submission (verdict: Runtime Error):
S = raw_input()
t = ['dreamer','dream','eraser','erase']
while len(S) > 0:
    for i in t:
        if S[S.rfind(i):]==i:
            S = S[:S.rfind(t)]
            break
        elif i == t[-1]:
            print "NO"
            exit()
print "YES"

Buggy submission (verdict: Runtime Error):
S = raw_input()
t = ['dreamer','dream','eraser','erase']
while len(S) > 0:
    for i in t:
        if S[S.rfind(i):]==i:
            S = S[:S.rfind(t)]
            continue
        elif i == t[-1]:
            print "NO"
            exit()
print "YES"
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
x=x/a
c=b/2
if x<=a*c:
    d=2*x/b
    print(round(math.degrees(math.atan(b/d)),10))
elif x==a*b:
    print(0)
else:
    x=a*b-x
    d=2*x/a
    print(round(90-math.degrees(math.atan(a/d)),10))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
c=b/2
if x<=a*a*c:
    d=2*x/b/a
    print(round(math.degrees(math.atan(b/d)),10))
else:
    x=a*a*b-x
    d=2*x/a/a
    print(round(90-math.degrees(math.atan(a/d)),10))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
x=x/a
c=b/2
if x<=a*c:
    d=2*x/b
    print(round(math.degrees(math.atan(b/d)),10))
else:
    x=a*b-x
    d=2*x/a
    print(round(90-math.degrees(math.atan(a/d)),10))

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
x=x/a
c=b/2
if x<=a*c:
    d=2*x/b
    print(math.degrees(math.atan(b/d)))
else:
    x=a*b-x
    d=2*x/a
    print(90-math.degrees(math.atan(a/d)))
Problem p02885 (python)

Fixed submission:
A,B=map(int,input().split())
if A<=2*B:
    print(0)
else:
    print(A-2*B)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
c=0
L.sort()
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[k]>=L[i]+L[j]:
                c+=N-k
                break
N=int((N-2)*(N-1)*N/6-c)
print(N)
Problem p02887 (python)

Fixed submission:
N=int(input())
S=str(input())
T=0
for i in range(N-1):
    if S[i]==S[i+1]:
        T+=1
print(N-T)

Buggy submission (verdict: Runtime Error):
def T():
    N=int(input())
    S=input()
    c=''
    t=0
    for s in S:
        if s==c:
            t+=1
        c=s
    return(t)
print(N-T())
Problem p02882 (python)

Fixed submission:
# coding: utf-8
import math
a, b, x = map(int, input().split())
h = x / a ** 2
l = 2 * a * h / b
if l <= a:
    print(math.degrees(math.atan2(b, l)))
elif x == a ** 2 * b:
    print(0)
else:
    k = 2 * h - b
    m = a * b / (k - b)
    print(90 + math.degrees(math.atan2(m, b)))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
a, b, x = map(int, input().split())
h = x / a ** 2
l = 2 * a * h / b
if l <= a:
    print(math.degrees(math.atan2(b, l)))
else:
    k = 2 * h - b
    m = a * b / (k - b)
    print(90 + math.degrees(math.atan2(m, b)))
Problem p02885 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A - 2 * B, 0))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(max(A - 2 * B, 0)
Problem p02887 (python)

Fixed submission:
# coding: utf-8
N = int(input())
S = input()
ans = 1
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
20
xxzaffeeeeddfkkkkllq
Problem p02888 (python)

Fixed submission:
# coding: utf-8
import bisect

N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    for j in range(i + 1, N - 1):
        ans += max(bisect.bisect_right(L, L[i] + L[j] - 1) - j - 1, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

def triangles(L, s, c, n):
    if c == len(L):
        return(n)
    if L[c] < s:
        n += 1
        return(triangles(L, s, c + 1, n))
    else:
        return(n)

N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    for j in range(i + 1, N - 1):
        ans += triangles(L, L[i] + L[j], j + 1, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

def triangles(L, s, c, n):
    if c == len(L):
        return(n)
    if L[c] < s:
        n += 1
        return(triangles(L, s, c + 1, n))
    else:
        return(n)

N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
    for j in range(i + 1, N - 1):
		ans += triangles(L, L[i] + L[j], j + 1, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

def triangles(L, s, c, n):
    if c == len(L):
        return(n)
    if L[c] < s:
        n += 1
        return(triangles(L, s, c + 1, n))
    else:
        return(n)

N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
dp = []
for i in range(L[-2] + L[-1] + 1):
    dp.append(-1)
for i in range(N):
    for j in range(i + 1, N - 1):
        if dp[L[i] + L[j]] >= 0:
            ans += dp[L[i] + L[j]]
        else:
            dp[L[i] + L[j]] = triangles(L, L[i] + L[j], j + 1, 0)
            ans += dp[L[i] + L[j]]
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8

def triangles(L, s, c, n):
    if c == len(L):
        return(n)
    if L[c] < s:
        n += 1
        return(triangles(L, s, c + 1, n))
    else:
        return(n)

N = int(input())
L = sorted(list(map(int, input().split())))
ans = 0
dp = []
for i in range(2001):
    dp.append(-1)
for i in range(N):
    for j in range(i + 1, N - 1):
        if dp[L[i] + L[j]] >= 0:
            ans += dp[L[i] + L[j]]
        else:
            dp[L[i] + L[j]] = triangles(L, L[i] + L[j], j + 1, 0)
            ans += dp[L[i] + L[j]]
print(ans)
Problem p03340 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0
temp = 0
l = 0
r = 0
while r < N:
  if temp ^ a[r] == temp + a[r]:
    temp += a[r]
    ans += r - l + 1
    r += 1
  else:
    temp -= a[l]
    l += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
ans = 0
temp = 0
l = 0
r = 0
while r < N:
  if temp ^ a[r] == temp + a[r]:
    temp += A[r]
    ans += r - l + 1
    r += 1
  else:
    temp -= A[l]
    l += 1
print(ans)
Problem p03361 (python)

Fixed submission:
import math
H, W = map(int, input().split())
s = []
flag = 0
ans = "No"
for i in range(H):
  s.append(list(input()))
for i in range(H):
  for j in range(W):
    if flag == 0:
      if s[i][j] == "#":
        if s[max(0, i - 1)][j] == "#" or s[i][max(0, j - 1)] == "#" or s[min(H - 1, i + 1)][j] == "#" or s[i][min(W - 1, j + 1)] == "#":
          continue
        else:
          flag += 1
if flag == 0:
  ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
import math
H, W = map(int, input().split())
s = []
flag = 0
ans = "No"
for i in range(W):
  s.append(list(input()))
for i in range(H):
  for j in range(W):
    if flag == 0:
      if s[i][j] == "#":
        if s[max(0, i - 1)][j] == "#" or s[i][max(0, j - 1)] == "#" or s[min(H - 1, i + 1)][j] == "#" or s[i][min(W - 1, j + 1)] == "#":
          continue
        else:
          flag += 1
if flag == 0:
  ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
import math
H, W = map(int, input().split())
s = []
flag = 0
ans = "No"
for i in range(W):
  s.append(list(input()))
if flag == 0:
  for i in range(H):
    for j in range(W):
      if s[i][j] == "#":
        if s[max(0, i - 1)][j] == "#" or s[i][max(0, j - 1)] == "#" or s[min(H - 1, i + 1)][j] == "#" or s[i][min(W - 1, j + 1)] == "#":
          continue
        else:
          flag += 1
if flag == 0:
  ans = "Yes"
print(ans)
Problem p03565 (python)

Fixed submission:
Sprime = input() # S'の入力
T = input() # Tの入力
S = [] # Sの候補をlistで管理
if len(Sprime) < len(T): # S'の文字列長がTの文字列長よりも短い場合はそもそもSが存在しえない
    print("UNRESTORABLE")
    exit()
for i in range(len(Sprime) - len(T) + 1): # 左からTを入れられるか見ていく
    flag = 0 # 文字が一致しえないことのflagを初期化
    if Sprime[i] == T[0] or Sprime[i] == "?":
        for j in range(len(T)):
            if Sprime[i + j] != T[j] and Sprime[i + j] != "?": # 一致しえない場合
                flag += 1
                break
        if flag != 1:
            S.append(Sprime[0 : i].replace("?", "a") + T + Sprime[i + len(T) :].replace("?", "a")) # 辞書順最小を求めるので?は全てaにする
S.sort() # Sの候補をさらに辞書順に並べる
if S == []: # Sの候補が無い場合 "UNRESTORABLE" を出力
    print("UNRESTORABLE")
else: # Sの候補のうち辞書順最小のものを出力
    print(S[0])

Buggy submission (verdict: Runtime Error):
Sprime = input() # S'の入力
T = input() # Tの入力
S = [] # Sの候補をlistで管理
if len(Sprime) < len(T): # S'の文字列長がTの文字列長よりも短い場合はそもそもSが存在しえない
    print("UNRESTORABLE")
    exit()
for i in range(len(Sprime) - len(T) + 1): # 左からTを入れられるか見ていく
    flag = 0 # 文字が一致しえないことのflagを初期化
    if Sprime[i] == T[0] or Sprime[i] == "?":
        for j in range(len(T)):
            if Sprime[i + j] != T[j] and Sprime[i + j] != "?": # 一致しえない場合
                flag += 1
                break
        if flag != 1:
            S.append(Sprime[0 : i].replace("?", "a") + T + Sprime[i + len(T) :].replace("?", "a")) # 辞書順最小を求めるので?は全てaにする
S.sort() # Sの候補をさらに辞書順に並べる
if S == []: # Sの候補が無い場合 "UNRESTORABLE" を出力
    print("UNRESTORABLE")
else: # Sの候補のうち辞書順最小のものを出力
    print(S[0])
print(S[0]) # Sの候補のうち辞書順最小のものを出力

Buggy submission (verdict: Runtime Error):
# coding: utf-8
Sprime = input() # S'の入力
T = input() # Tの入力
S = [] # Sの候補をlistで管理
if len(Sprime) < len(T): # S'の文字列長がTの文字列長よりも短い場合はそもそもSが存在しえない
    print("UNRESTORABLE")
    exit()
for i in range(len(Sprime) - len(T) + 1): # 左からTを入れられるか見ていく
    flag = 0 # 文字が一致しえないことのflagを初期化
    if Sprime[i] == T[0] or Sprime[i] == "?":
        for j in range(len(T)):
            if Sprime[i + j] != T[j] and Sprime[i + j] != "?": # 一致しえない場合
                flag += 1
                break
        if flag != 1:
            S.append(Sprime[0 : i].replace("?", "a") + T + Sprime[i + len(T) :].replace("?", "a")) # 辞書順最小を求めるので?は全てaにする
S.sort() # Sの候補をさらに辞書順に並べる
print(S[0]) # Sの候補のうち辞書順最小のものを出力
Problem p02817 (python)

Fixed submission:
S, T = [str(s) for s in input().split()]

print(T+S)

Buggy submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]
if K <= A:
    a = A-K
    b = B
elif A < K and K <= A+B:
    a = 0
    b = B-(K-A)
else:
    a = 0
    b = 0
print(a, b)
Problem p02818 (python)

Fixed submission:
A, B, K = [int(i) for i in input().split()]
if K <= A:
    a = A-K
    b = B
elif A < K and K <= A+B:
    a = 0
    b = B-(K-A)
else:
    a = 0
    b = 0
print(a, b)

Buggy submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]
if K <= A:
    a = A-K
elif A < K and K <= A+B:
    a = 0
    b = B-(K-A)
else:
    a = 0
    b = 0
print(a, b)

Buggy submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]
if K <= A:
    a -= K
elif A < K and K <= A+B:
    a = 0
    b = B-(K-A)
else:
    a = 0
    b = 0
print(a, b)
Problem p02837 (python)

Fixed submission:
N = int(input())
lista = []
for n in range(N):
    listan = []
    an = int(input())
    for n in range(an):
        listxy = tuple(map(int, input().split()))
        listan.append(listxy)
    listset = tuple(listan)
    lista.append(listset)    
tuplea = tuple(lista)    
#print(lista)
ansfin = 0
for n in range(2**N):
    bin2 = list(bin(n))[2:]
    bin2.reverse()
    #print(bin2)
    l = len(bin2)
    rightwrong = set()
    #print(l)
    setright = set()
    for n in range(N):
        if n<l:
            #print(bin2[n])
            if bin2[n] == str(1):
                rightwrong.add((n+1, 1))
                lo = len(tuplea[n])
                for m in range(lo):
                    setright.add(tuplea[n][m])
            else:
                rightwrong.add((n+1, 0))
        else:
            rightwrong.add((n+1, 0))  
    #print('a')                     
    #print(setright)
    #print(rightwrong)
    if setright.issubset(rightwrong):
        ans = bin2.count(str(1))
        if ansfin>=ans:
            pass
        else:
            ansfin = ans
    #print(ans)    
print(ansfin)

Buggy submission (verdict: Runtime Error):
N = int(input())
lista = []
for n in range(N):
    listan = []
    an = int(input())
    for n in range(an):
        listxy = tuple(map(int, input().split()))
        listan.append(listxy)
        listset = tuple(listan)
    lista.append(listset)    
tuplea = tuple(lista)    
#print(lista)
ansfin = 0
for n in range(2**N):
    bin2 = list(bin(n))[2:]
    bin2.reverse()
    #print(bin2)
    l = len(bin2)
    rightwrong = set()
    #print(l)
    setright = set()
    for n in range(N):
        if n<l:
            #print(bin2[n])
            if bin2[n] == str(1):
                rightwrong.add((n+1, 1))
                lo = len(tuplea[n])
                for m in range(lo):
                    setright.add(tuplea[n][m])
            else:
                rightwrong.add((n+1, 0))
        else:
            rightwrong.add((n+1, 0))  
    #print('a')                     
    #print(setright)
    #print(rightwrong)
    if setright.issubset(rightwrong):
        ans = bin2.count(str(1))
        if ansfin>=ans:
            pass
        else:
            ansfin = ans
    #print(ans)    
print(ansfin)
Problem p02923 (python)

Fixed submission:
N = int(input())
listh = list(map(int, input().split()))
#print(listh)
lista = [0]
count = 0
for n in range(1,N):
    if listh[n] > listh[n-1]:
        count = 0
        lista.append(count)
    else:
        count = count + 1
        lista.append(count) 
#print(lista)        
print(max(lista))

Buggy submission (verdict: Runtime Error):
listh = list(map(int, input().split()))
#print(listh)
lista = [0]
count = 0
for n in range(1,N):
    if listh[n] > listh[n-1]:
        count = 0
        lista.append(count)
    else:
        count = count + 1
        lista.append(count) 
print(max(lista))
Problem p02814 (python)

Fixed submission:
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import fractions
F = sys.stdin

N, M = list(map(int,F.readline().rstrip().split()))
a_list = list(map(int,F.readline().rstrip().split()))

num = 1
while a_list[0] % 2**(num + 1) == 0:
    num += 1
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

lcm_before = 1
for a in a_list:
    if (a/(2**num)) % 2 != 1:
        print(0)
        sys.exit()

    lcm_before = lcm(lcm_before, a//2)



ans1 = M // lcm_before
ans = (ans1 + 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import functions
F = sys.stdin

N, M = list(map(int,F.readline().rstrip().split()))
a_list = list(map(int,F.readline().rstrip().split()))

num = 1
while a_list[0] % 2**(num + 1) == 0:
    num += 1
def lcm(a, b):
    return (a * b) // functions.gcd(a, b)

lcm_before = 1
for a in a_list:
    if (a/(2**num)) % 2 != 1:
        print(0)
        sys.exit()

    lcm_before = lcm(lcm_before, a//2)



ans1 = M // lcm_before
ans = (ans1 + 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import pdb
import sys
import math
F = sys.stdin

N, M = list(map(int,F.readline().rstrip().split()))
a_list = list(map(int,F.readline().rstrip().split()))

num = 1
while a_list[0] % 2**(num + 1) == 0:
    num += 1
def lcm(a, b):
    return (a * b) // math.gcd(a, b)

lcm_before = 1
for a in a_list:
    if (a/(2**num)) % 2 != 1:
        print(0)
        sys.exit()

    lcm_before = lcm(lcm_before, a//2)



ans1 = M // lcm_before
ans = (ans1 + 1) // 2
print(ans)