<jupyter_start><jupyter_text>Getting Started[Contest Rules](http://www.usaco.org/index.php?page=instructions)[Training](https://train.usaco.org)[]() Input and Outputhttps://darrenyao.com/usacobook/cpp.pdfpage=33 Sample SubmissionIn USACO, input is read from a file called problemname.in, and printing outputto a file called problemname.out.<jupyter_code>"""
ID: weng.cl1
LANG: PYTHON3
TASK: sample
"""
fin = open ('sample.in', 'r')
fout = open ('sample.out', 'w')

## Do something here

fout.write ('OK')
fout.close()<jupyter_output><empty_output><jupyter_text>Read one line and remove the newline **fin.readline()**<jupyter_code>fin = open ('sample.in', 'r')
l = fin.readline().strip()
## loop through each character
for c in l.strip():
    print(c)<jupyter_output>1
,
2<jupyter_text>Read all lines into a list of strings **fin.readlines()**<jupyter_code>fin = open ('sample.in', 'r')
lines = fin.readlines()
for l in lines:
    ## split strings 
    for i in l.strip().split(","):
        print(i)<jupyter_output>1
2
13
14
15
26
26
28
29<jupyter_text>Big O Notation and Complexity Calculations<jupyter_code>n = 100
total=0

def simple(n):
     return 34 * n + 153

## Time order O(1)
print(simple(100))

## Time order O(n)
for i in range(n):
    simple(n)<jupyter_output>3553<jupyter_text>The following code is O(n^2 + nm), because it consists of two blocks of complexity O(n^2) and O(nm), and neither of them is a lower order function with respect to the other.<jupyter_code>n = 1000
m = 500
s = 0
for i in range(n):
    for j in range(n):
        s += i*j
for i in range(n):
    for j in range(m):
        s += i*j<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14381067961165048, 'fraction_numerical': 0.029733009708737865, 'mean_word_length': 4.608843537414966, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '165606', 'license': 'Apache-2.0', 'n_tokens_mistral': 648, 'n_tokens_neox': 613, 'n_words': 178, 'path': 'usaco/0_Geting_Started.ipynb', 'repo_name': 'cliffweng/coding-dojo', 'size': '1648'}