Codeforces Round #422 (Div. 2), problem: (D) My pretty girl Noora Solution In C/C++

#include<bits/stdc++.h>
using namespace std;
long long f[5000010],pwr[5000010],mod=1e9+7,t,r,l,ans;
main()
{
int i,j,k;
cin>>t>>l>>r;
pwr[0]=1;
//for(i=1;i<=r-l+1;i++)pwr[i]=(1ll*pwr[i-1]*t)%mod;
for(i=0;i<=r;i++)
f[i]=1e18;
f[1]=0;
for(i=1;i<=r;i++)
{
for(j=2*i,k=2;j<=r;j+=i,k++)
{
f[j]=min(f[j],(1ll*i*(k-1)*k)/2+f[i]);
}
}
ans=0;long long pr=1;
for(i=l;i<=r;i++)
ans=(ans+((f[i])%mod*pr)%mod)%mod,pr=(pr*t)%mod;
cout<<ans<<endl;
}

Is the Owala FreeSip...

Is the Owala FreeSip Worth It? Our 6-Month Real-World...

Owala FreeSip Lock Loop:...

Owala FreeSip Lock Loop: Complete Guide to the Carry...

Best Color Combinations for...

Owala FreeSip Colors: Most Popular Picks and Limited Editions...

Is the Owala FreeSip...

Owala FreeSip Safety: BPA-Free, Lead-Free, and Material Certifications Food safety...

Owala FreeSip vs Hydro...

Owala FreeSip vs Hydro Flask Wide Mouth: Durability &...

Is Owala FreeSip Cupholder...

Owala FreeSip Cupholder Compatibility: Size-by-Size Test Cupholder compatibility is one...

Is the Owala FreeSip Water Bottle Worth the Price? Real 6-Month Review

Is the Owala FreeSip Worth It? Our 6-Month Real-World Verdict After 6 months of daily use as a primary hydration bottle — in a car,...

Owala FreeSip Lock Loop: How the Push-Button Carry Handle Works

Owala FreeSip Lock Loop: Complete Guide to the Carry Handle and Lid Mechanism The FreeSip's lock loop is simultaneously its most practical feature and the...

Best Color Combinations for Owala FreeSip: Most Popular Limited Editions

Owala FreeSip Colors: Most Popular Picks and Limited Editions (2026) One of Owala's biggest competitive advantages is its color strategy — frequent limited-edition drops that...

Is the Owala FreeSip Stainless Steel BPA-Free and Lead-Free?

Owala FreeSip Safety: BPA-Free, Lead-Free, and Material Certifications Food safety is a legitimate concern for any product you drink from daily. Here's the complete material...

Owala FreeSip vs Hydro Flask Wide Mouth: Which Is More Durable?

Owala FreeSip vs Hydro Flask Wide Mouth: Durability & Performance Comparison Hydro Flask has been the gold standard of insulated water bottles for years. The...

Is Owala FreeSip Cupholder Friendly? Car Cupholder Fit Guide

Owala FreeSip Cupholder Compatibility: Size-by-Size Test Cupholder compatibility is one of the most practical buying factors for a daily water bottle — and it varies...

How to Mold-Proof Your Owala FreeSip Lid and Straw Assembly

How to Prevent Mold in Your Owala FreeSip: Complete Cleaning Guide Mold in water bottle straws and lids is a common complaint across all straw-equipped...

Owala FreeSip Boot and Accessories: Must-Have Upgrades for Protection

Best Owala FreeSip Accessories and Upgrades (2026) The Owala FreeSip performs exceptionally well out of the box — but a handful of accessories can extend...

Is the Owala FreeSip Dishwasher Safe? Cleaning and Care Guide

Owala FreeSip Dishwasher Safety: What You Need to Know Dishwasher convenience is one of the most-asked questions about any reusable water bottle. Here's the complete,...