Buggy python submission (verdict: Time Limit Exceeded):
while True:
  try:
    s1 = input()
    s2 = input()
    lst = [[1 if s1[i] == s2[j] else 0 for i in range(len(s1))] for j in range(len(s2))]
    ans = 0
    def search(x,y,count):
      while  x < len(s2) and y < len(s1) and lst[x][y]:
        count += 1
        lst[x][y] = 0
        x += 1
        y += 1
      return count
    for i in range(len(s2)):
      for j in range(len(s1)):
        if lst[i][j]:
          ans = max(ans,search(i,j,0))
    print(ans)
  except EOFError:
    break


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  while True:
    try:
      s1 = input()
      s2 = input()
      lst = [[1 if s1[i] == s2[j] else 0 for i in range(len(s1))] for j in range(len(s2))]
      ans = 0
      def search(x,y,count):
        while  x < len(s2) and y < len(s1) and lst[x][y]:
          count += 1
          lst[x][y] = 0
          x += 1
          y += 1
        return count
      for i in range(len(s2)):
        for j in range(len(s1)):
          if lst[i][j]:
            ans = max(ans,search(i,j,0))
      print(ans)
    except EOFError:
      break
solve()


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  while True:
    try:
      s1 = input()
      s2 = input()
      ans = 0
      def search(x,y,count):
        while  x < len(s1) and y < len(s2) and s1[x] == s2[y]:
          count += 1
          x += 1
          y += 1
        return count

      for i in range(len(s1)):
        for j in range(len(s2)):
          if s1[i] == s2[j]:
            ans = max(ans,search(i,j,0))
      print(ans)
    except EOFError:
      break
solve()


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)

Buggy python submission (verdict: Time Limit Exceeded):
def search(x,y,s1,s2,end1,end2):
  count = 0
  while  x < end1 and y < end2 and s1[x] == s2[y]:
    count += 1
    x += 1
    y += 1
  return count

def solve():
  while True:
    try:
      s1 = input()
      s2 = input()
      end1 = len(s1)
      end2 = len(s2)
      ans = 0
      for i in range(end1):
        for j in range(end2):
          if s1[i] == s2[j]:
            a = search(i,j,s1,s2,end1,end2)
            if a > ans:
              ans = a
      print(ans)
    except EOFError:
      break
solve()


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)

Buggy python submission (verdict: Time Limit Exceeded):
def search(x,y,s1,s2,end1,end2):
  count = 0
  while  x < end1 and y < end2 and s1[x] == s2[y]:
    count += 1
    x += 1
    y += 1
  return count

def solve():
  while True:
    try:
      s1 = input()
      s2 = input()
      end1 = len(s1)
      end2 = len(s2)
      dic = dict()
      for i in range(end2):
        alp = s2[i]
        if not alp in dic:
          dic[alp] = [i]
        else:
          dic[alp].append(i)
      ans = 0
      for i in range(end1):
        alp = s1[i]
        if alp in dic:
          for ind in dic[alp]:
            a = search(i, ind, s1, s2, end1, end2)
            if ans < a:
              ans = a
      print(ans)
    except EOFError:
      break
solve()


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  while True:
    try:
      s1 = input()
      s2 = input()
      end1 = len(s1)
      end2 = len(s2)
      checked = [[False for i in range(end2)] for j in range (end1)]
      dic = {}

      def check(i, j):
        count = 0
        while  i < end1 and j < end2 and (not checked[i][j]) and s1[i] == s2[j]:
          checked[i][j] = True
          i += 1
          j += 1
          count += 1
        return count

      
      for i in range(end2):
        alp = s2[i]
        if alp in dic:
          dic[alp].append(i)
        else:
          dic[alp] = [i]

      ans = 0

      for i in range(end1):
        alp = s1[i]
        if alp in dic:
          lst = dic[alp]
          for j in lst:
            if not checked[i][j]:
              a = check(i, j)
              if a > ans:
                ans = a

      print(ans)
    except EOFError:
      break
solve()


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
  while True:
    try:
      s1 = input()
      s2 = input()
      end1 = len(s1)
      end2 = len(s2)
      checked = [[0 for i in range(len(s2) + 1)] for j in range(len(s1) + 1)]
      dic = {}

      def check(i, j):
        count = 0
        while not checked[i][j] and i < end1 and j < end2 and s1[i] == s2[j]:
          checked[i][j] = 1
          i += 1
          j += 1
          count += 1
        return count

      
      for i in range(end2):
        alp = s2[i]
        if alp in dic:
          dic[alp].append(i)
        else:
          dic[alp] = [i]

      ans = 0

      for i in range(end1):
        alp = s1[i]
        if alp in dic:
          lst = dic[alp]
          for j in lst:
            if not ((i, j) in checked):
              a = check(i, j)
              if a > ans:
                ans = a

      print(ans)
    except EOFError:
      break
solve()


Fixed submission:
while True:
    try:
        s1 = input()
    except EOFError:
        break
    s2 = input()
    BASE = 27
    MOD = 1000000007


    def rolling_hash(s):
        h_lst = [0]
        for c in s:
            h_lst.append((h_lst[-1] * BASE + ord(c)) % MOD)
        return h_lst


    h_lst1 = rolling_hash(s1)
    h_lst2 = rolling_hash(s2)
    length1 = len(s1)
    length2 = len(s2)

    pow_mem = [pow(BASE, i, MOD) for i in range(min(length1, length2) + 1)]


    def check(center):
        hash_set = {(h_lst1[i + center] - h_lst1[i] * pow_mem[center]) % MOD for i in range(length1 - center + 1)}
        for i in range(length2 - center + 1):
            h2 = (h_lst2[i + center] - h_lst2[i] * pow_mem[center]) % MOD
            if h2 in hash_set:return True
        return False


    left = 0
    right = min(length1, length2)
    while right > left + 1:
        center = (left + right) // 2
        if check(center):
            left = center
        else:
            right = center
    print(right if check(right) else left)