# import libraries import streamlit as st from colivara_py import Colivara import base64 from PIL import Image from io import BytesIO import os API_KEY = os.getenv("COLIVARA_API_KEY") if "search_results" not in st.session_state: st.session_state["search_results"] = [] client = Colivara(api_key=API_KEY) # Add badges at the top of the page st.markdown( """
""", unsafe_allow_html=True, ) # Ask for API key from user st.title("Colivara Demo") st.markdown( """ ### Welcome to the Colivara Search Demo This demo allows you to search through the Competitive Programmer's Handbook by Antti Laaksonen. We included 12 chapters from the handbook in this demo to help you understand how Colivara works. **Chapters Covered:** `Introduction` `Time Complexity` `Sorting` `Data Structures` `Complete Search` `Greedy Algorithms` `Dynamic Programming` `Amortized Analysis` `Range Queries` `Bit Manipulation` `Basics of Graphs` `Graph Traversal` - Enter a search query in the input box below. - Retrieve the most relevant pages from the document. **Example Queries:** ``` 1. What is set theory? 2. How to analyze complexity using Big O notation? 3. Explain Binary Search Algorithm and provide implementation of lower bound. 4. How to use Stack, Queue and Deque? 5. Explain generating permutations and subsets in Complete Search. 6. What makes an algorithm greedy? 7. How to solve the coin change problem using Dynamic Programming? 8. What is amortized analysis? 9. How to implement prefix sum array? 10. Explain basic bitwise operations. 11. Show graph representation using matrix and adjacency list. 12. How to implement DFS and BFS traversal? ``` Try it out and see how the AI retrieves the information you need efficiently. """ ) # Display placeholder for document details with a badge for the PDF st.markdown( """ #### Document Overview: **Title:** Competitive Programmer's Handbook **Author:** Antti Laaksonen **Type:** PDF **Included Pages:** 100+ **Included Chapters Count:** 12 **Full Book Chapters Count:** 30