Goal: Place in top 50
Problem-solving strategy:
- Plan out implementation ahead of time
- Try to write all the code in one sitting; any details need to be scoped out ahead of time
| from modal import Image, Stub, Secret, gpu | |
| from pathlib import Path | |
| import os | |
| MODEL_PATH = "/model" | |
| def download_models(): | |
| from transformers import AutoTokenizer, AutoModelForCausalLM | |
| token = os.environ["HUGGINGFACE_TOKEN"] | |
| tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf", use_auth_token=token) |
| A: | |
| Insights | |
| - Every 7 rounds, you do 6 + 3 = 9 damage total (6 rounds of 1 damage each, 7th round you do 3 damage) | |
| - So total number of rounds = Total health divided by 9, must be an integer | |
| - If k = TotalHealth/9, all monsters (a, b, c) must have at least k health | |
| - Check that this is true: a >= k && b >= k && c >= k | |
| Just check these conditions, print YES if true, NO otherwise |
| [dp]: [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 3, 1, 2, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 4, 3, 3, 4, 2, 4, 1, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 5, 6, 5, 9, 5, 10, 5, 9, 4, 7, 3, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 6, 10, 9, 16, 13, 19, 17, 19, |
| #include <iostream> | |
| #include <map> | |
| #include <vector> | |
| #include <set> | |
| using namespace std; | |
| typedef pair<int, int> pii; | |
| const int MOD = 998244353; | |
| typedef long long ll; | |
| const int MAXN = 1001000; |
| #!/usr/bin/env python3 | |
| # encoding: utf-8 | |
| """Use instead of `python3 -m http.server` when you need CORS""" | |
| import sys | |
| from http.server import HTTPServer, SimpleHTTPRequestHandler | |
| class CORSRequestHandler(SimpleHTTPRequestHandler): | |
| def end_headers(self): |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| int m, a, b; | |
| typedef long long ll; | |
| int cnt = 0; | |
| ll ans = 0; | |
| int mx = 0; |
| // ==UserScript== | |
| // @name Slack Channel Grouping | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://scaleapi.slack.com/* | |
| // @grant none | |
| // ==/UserScript== |
| // ==UserScript== | |
| // @name Require Lodash | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Asynchronously inject lodash into all webpages | |
| // @author Steven Hao | |
| // @match *://*/* | |
| // @grant none | |
| // ==/UserScript== |