bro still has 3 more IOI and IMO attempts 💀💀💀
Note that here, I am doing it by max rating, instead of current rating.
In the chart above, I manually added one more LGM to Singapore. The error bars are what happens with $$$\pm 1$$$ LGM.
Manually inspecting the above graph, we see that we should probably remove Antigua and Barbuda, and Samoa.
Actually let's remove Cyprus (which I think Endagorion plausibly lives there) too from the plot so we can see everything else more clearly.
Now, we can clearly see that only Hong Kong, Switzerland (and Cyprus) has higher LGM per capita.
But, I think I can claim that Hong Kong should not have 3 LGMs since fivedemands probably isn't an actual user. So Hong Kong should only have 2 LGMs.
For Switzerland, it unfortunately has barely higher LGM per capita than Singapore.
LGM per capita in Switzerland is $$$\frac{3}{9.034 \cdot 10^6} = 3.321 \cdot 10^{-7}$$$.
LGM per capita in Singapore is $$$\frac{2}{6.037 \cdot 10^6} = 3.313 \cdot 10^{-7}$$$.
This is very unfortunate.
But I always under the impressiong the LGM per capita in China was very high. It turns out no. They just have 1.4 billion people. But maybe it would be more fair to only take the urban population in China, or even select only the tier 1 cities.
import os
import json
import requests
from countryinfo import CountryInfo
import matplotlib.pyplot as plt
CACHE_FILE = "cf_users.json"
def load_cf_users():
# If cache exists, load from it
if os.path.exists(CACHE_FILE):
with open(CACHE_FILE, "r", encoding="utf-8") as f:
data = json.load(f)
print("Loaded from cache")
else:
# Otherwise fetch from API
response = requests.get(
"https://mirror.codeforces.com/api/user.ratedList?activeOnly=false&includeRetired=true"
)
data = response.json()["result"]
# Save to cache
with open(CACHE_FILE, "w", encoding="utf-8") as f:
json.dump(data, f)
print("Fetched from API and cached")
print("number of scraped user:", len(data))
return data
data = load_cf_users()
LGMCount = {}
for user in data:
if (user["maxRating"] >= 3000):
if ("country" in user):
country = user["country"]
if (country not in LGMCount):
LGMCount[country] = 0
LGMCount[country]+=1
#print(LGMCount)
x = [] # populations
y = [] # ratio = value / population
yerr = [] # error bars
labels = []
LGMCount["Singapore"] += 1
for country, LGMs in LGMCount.items():
try:
info = CountryInfo(country).info()
pop = info["population"]
if (pop < 10**6):
continue
ratio = float(LGMs) / pop
x.append(pop)
y.append(ratio)
# error = (LGMs ± 1) / pop → so delta is 1/pop
yerr.append(1.0 / pop)
iso = info["ISO"]["alpha2"]
labels.append(f"{iso}: {LGMs}")
except Exception as e:
print(f"Error fetching {country}: {e}") #antartica
# Plot
plt.figure(figsize=(8,6))
plt.errorbar(x, y, yerr=yerr, fmt='o', capsize=5, markersize=6, color="blue", ecolor="red")
plt.xscale("log") # populations vary a lot, log scale makes it clearer
plt.xlabel("Population (log scale)")
plt.yscale("log")
plt.ylabel("Value / Population (log scale)")
plt.title("Normalized Value vs Population with Error Bars")
plt.grid(True, which="both", ls="--", alpha=0.6)
# Add labels next to each point
for xi, yi, label in zip(x, y, labels):
plt.text(xi, yi, label, fontsize=9, ha="right", va="bottom")
plt.savefig("plot.png", dpi=300, bbox_inches="tight")








Congratulations literalchild!
Thanks!
orz literalchild
the most talented math/cp-er i know
hope bro grinds back to lgm
orz literalchild
the most talented math/cp-er i know
hope bro grinds back to lgm
Congratulations, crazy achievement literalchild!
Also, respect to Singapore!
congrats @bribritt