<jupyter_start><jupyter_text>Get API result<jupyter_code>import requests
url = 'https://leetcode.com/api/problems/algorithms/'
res = requests.get(url)
res.status_code
data = res.json()
data
problems = data['stat_status_pairs']<jupyter_output><empty_output><jupyter_text>Count open problems<jupyter_code>from collections import defaultdict
stat = defaultdict(int)
for each in problems:
    if each['paid_only']:
        stat['paid'] += 1
    else:
        stat['open'] += 1
stat<jupyter_output><empty_output><jupyter_text>Serialize data<jupyter_code>import pickle
with open('problems.plk', 'w') as f:
    pickle.dump(problems, f)
ls
problem_template = '''# 问题描述

{problem}

## 题目链接

[{problem_url}]({problem_url})

---'''<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14533333333333334, 'fraction_numerical': 0.0026666666666666666, 'mean_word_length': 6.084905660377358, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '100194', 'license': 'Apache-2.0', 'n_tokens_mistral': 293, 'n_tokens_neox': 289, 'n_words': 49, 'path': 'utils/Get_all_problems.ipynb', 'repo_name': 'guazidou/LeetCode-Solution-From-GuaZiDou', 'size': '750'}