akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long
const int N=200005;
const int mod=1e9+7;
const double eps=1e-8;
const double PI = acos(-1.0);
#define lowbit(x) (x&(-x))
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll qpow(ll a,ll b){ll res=1;while(b){if(b&1) res=res*a%mod;a=a*a%mod;b>>=1;}return res;}
ll inv(ll a,ll p){return qpow(a,p-2);}
int main()
{
    std::ios::sync_with_stdio(false);
    int n,l;
    string s[105];
    cin>>n>>l;
    priority_queue<string,vector<string>,greater<string>> pq;
    for(int i=1;i<=n;i++)
    {
        cin>>s[i];
        pq.push(s[i]);
    }
    while(!pq.empty())
    {
        cout<<pq.top();
        pq.pop();
    }
    cout<<endl;
  //  sort(s[1],s[n+1]);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>

using namespace std;

int main() {
	int n, m; scanf("%d%d",&n,&m);
	int d[n+1];
	for (int i=1; i<=n; i++) d[i]=10;
	while (m--) {
		int a, b; scanf("%d%d",&a,&b);
		if (d[a]!=10 && d[a]!=b) {
			printf("-1\n");
			return 0;
		}
		if (a==1 && b==0 && n>1) {
			printf("-1\n");
			return 0;
		}
		d[a]=b;
	}
	if (d[1]==10 && n>1) d[1]=1;
	for (int i=1; i<=n; i++) {
		printf("%d",d[i]==10?0:d[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;

int main()
{
    int N,pot,sum=0;
    cin>>N;
    pot=N;

    while(pot>0)
    {
        sum=sum+pot%10;
        pot=pot/10;
    }

    if(N%sum==0)
        cout<<"Yes";
        else
        cout<<"No";
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
int main(){
    int E,Y;
    scanf("%d %d",&E,&Y);
    if(E<=0){
        if(Y<=1911){
            printf("M%d\n",Y-1868+1);
        }
        else if(Y<=1925){
            printf("T%d\n",Y-1912+1);
    }
        else if(Y<=1988){
            printf("S%d\n",Y-1926+1);
        }
        else if(Y<=2016){
            printf("H%d\n",Y-1989+1);
        }
    }
    else{
        if(E==1)
            printf("%d\n",1868-1+Y);
        if(E==2)
            printf("%d\n",1912-1+Y);
        if(E==3)
            printf("%d\n",1926-1+Y);
        if(E==4)
            printf("%d\n",1989-1+Y);
    }
    return 0;
}

Measured memory_bytes: 2744
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N, M;

int main() {
    cin >> N >> M;

    if (N == M)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
function Main(input) {
    var input = input.split(' ').map(n => parseInt(n, 10));
    var A = input[0];
    var B = input[1];
    var C = input[2];
    var D = input[3];
    if(Math.max(A, C) <= Math.min(B, D)) {
     console.log(Math.min(B, D) - Math.max(A, C)); 
    } else{
        console.log(0);
    }
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
var x = require('fs').readFileSync('/dev/stdin', 'utf8');

var array = x.split("\n");

var result = "";

for (i = 0; i <array.length; i++)
{
    var subarr = array[i].split(" ");
    var a = subarr[0]-0;
    var op = subarr[1];
    var b = subarr[2]-0;

    switch(op) 
    {
        case "+":
            result += a + b;
            break;
        case "-":
            result += a - b;
            break;
        case "*":
            result += a * b;
            break;
        case "/":
            if(b != 0) {
            result += Math.floor(a / b);
            }
            break;
        default:
            break;
    }

    result += "\n"; 

}

console.log(result.trim());




Measured memory_bytes: 15352
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;




int main() {
	int n;
	cin >> n;
	int a[n];
	rep (i, n) cin >> a[i];

	vector<int> arI(n), arJ(n);
	rep (i, n) {
		arI[i] = a[i] + i;
		arJ[i] = i - a[i];
	}

	//rep (i, n) cout << i << " " << arI[i] << " " << arJ[i] <<endl;

	map<int, int> mp1, mp2;
	rep (i, n) {
		mp1[arI[i]]++;
		mp2[arJ[i]]++;
	}

	ll ans = 0;
	for (auto x: mp1) {
		ans += (ll)x.se * mp2[x.fi];
	}

	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 31192
#include <bits/stdc++.h>
	using namespace std;
	int main() { 
	    
	    string str;
	    cin >> str;

	    	
	   while(str != "0"){
		   	long sum =0;
		   	for(int i=0;i<str.size();i++){
		   		sum += str[i] -'0';
		   	}
		   	cout << sum << endl;
		   	cin >>str;
	   }
	    return 0;
	}


Measured memory_bytes: 3156
#include <iostream>
#include <iomanip>
#include <random>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <sstream>
#include <bitset>
#include <cassert>
#include <fstream>
#include <queue>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
	#define DEBUG_OUTPUT_ENABLED 1
	#define DBG(X) dout << #X << "=" << (X) << '\n';
	#define SAY(X) dout << (X) << '\n';
#else
	#define DEBUG_OUTPUT_ENABLED 0
	#define DBG(X) 42;
	#define SAY(X) 42;
#endif

#define dout   ___debug::instance

using namespace std;
using ll = long long int;
using ull = unsigned long long int;
using ld  = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S>& v) { for(auto el: v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const multiset<T>& v) { for(auto el: v) cout << el << " "; return os; }
namespace ___debug {
	struct DebugStream {
		private:
			bool is_first;
		public:
			DebugStream(bool _is_first): is_first(_is_first) {}
			template<typename T> DebugStream operator<<(const T& value) const {
				assert(DEBUG_OUTPUT_ENABLED);
				if(is_first) cout << "[DBG] ";
				cout << value;
				return DebugStream(false);
			};

			template<typename T> DebugStream printArray(T* l, T* r) {
				assert(DEBUG_OUTPUT_ENABLED);
				if(is_first) cout << "[DBG] ";
				while(l != r) {
					cout << (*l);
					++l;
					if(l == r) {
						cout << '\n';
					} else {
						cout << ' ';
					}
				}
				return DebugStream(false);
			}
	};
	DebugStream instance(true);
};

const int INT_INF = (int)(2e9);
const ll  LL_INF  = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for(auto& elem: ret) cin >> elem; return ret; }

void solve() {
	ld v = fetch<ld>();
	cout << fixed << setprecision(12) << (v * 6.28318530717958623200) << '\n';
}

int main() {
	fast_io();
	solve();

	return 0;
}


Measured memory_bytes: 3816
N = int(input())
def travel():
    t, x, y = 0, 0, 0
    for _ in range(N):
        nt, nx, ny = map(int, input().split())
        dt = nt - t
        dist = abs(nx - x) + abs(ny - y)
        if dt < dist:
            return False
        if (dt % 2) == (dist % 2):
            t, x, y = nt, nx, ny
        else:
            return False
    return True

print("Yes" if travel() else "No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define pb emplace_back
#define mp make_pair
#define endl '\n'
#define f first
#define s second

#ifdef SEREZHKA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) { cerr << _s << " = " << _h << "\n"; }

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7ll;
const ll LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

int n;
ll ans = 0;
ll a[MAXN];
vector<int> lst[2];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n)
        cin >> a[i];

    return true;
}

void solve() {
    vector<ll> v(a, a + n);
    sort(v.begin(), v.end());

    forn (i, n)
        if ((lower_bound(v.begin(), v.end(), a[i]) - v.begin()) % 2 != i % 2)
            ++ans;

    cout << ans / 2 << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    
    while (read())
        solve();
    
    return 0;
}



Measured memory_bytes: 1792
// In the Name of Allah
// Ya Ali!
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(x) x.begin() , x.end()

const ll maxn = 2e5 + 10;
const ll mod = 1e9 + 7;
const ll INF = 1e18 ;

ll n , m , dp[ maxn ] , maxx[ 4*maxn ] , la[ 4*maxn ] , ans = 0 ;
vector < pair < ll , ll > > vl[ maxn ] , vr[ maxn ] ;

ll poww( ll a , ll b)
{
  if( b == 0 )return 1 ;
  ll x = poww( a , b/2 )%mod ;
  if( b & 1) return (((x*x)%mod)*a)%mod ;
  else return (x*x)%mod ;
}

void shift( int l , int r , int node)
{
  maxx[ node ] += la[ node ];

  if(l == r){
    la[ node ] = 0;
    return ;
  }

  la[ node+node ] += la[ node ];
  la[ node+node+1 ] += la[ node ];
  la[ node ] = 0;
}

void add( int x , int y , ll va , int l = 0 , int r = n , int node = 1)
{
 shift( l , r , node) ;

 if(l > y || r < x )return ;
 if(l >= x && r <= y){
   la[ node ] += va;
   shift( l , r , node) ;
   return ;
 }

 int mid = (r+l)/2 ;
 add( x , y , va , l , mid , node + node) ;
 add( x , y , va , mid+1 , r , node+node+1);

 maxx[ node ] = max( maxx[ node+node] , maxx[ node+node+1 ]) ;
}

ll getmax( int x , int y , int l = 0 , int r = n , int node = 1)
{
  if( l > y || r < x)
    return -INF;
  if(l >= x && r <= y)
    return maxx[ node ];

  int mid = (r+l)/2 ;
  return max( getmax(x , y , l , mid , node+node) , getmax( x , y , mid+1 , r , node+node+1 ));
}

signed main()
{
 ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 cin >> n >> m ;
 for(int i = 1 ; i <= m ; i ++){
   ll l , r , a ;
   cin >> l >> r >> a ;
   vr[ r ].pb({ l , a }) ;
   vl[ l ].pb({ l , a }) ;
 }

 for(int i = 1 ; i <= n ; i ++){
   // on
   for(auto pp : vl[ i ])
      add( 0 , pp.F-1 , pp.S) ;

   dp[ i ] = getmax(0 , i-1);

   add( i , i , dp[ i ]) ;

   //off
   for(auto pp : vr[ i ])
      add( 0 , pp.F-1 , -pp.S);

   ans = max( ans , dp[ i ]) ;
 }

 cout << ans ;

    return 0;
}


Measured memory_bytes: 36224
import copy 

def resolve(List):
    # L[0]!=0を起点とする
    L = copy.deepcopy(List)
    cnt = 0
    s = L[0]
    for i in range(1,len(L)):
        a = L[i]
        if(s>0 and s+a>=0):
            L[i] = -s-1
            cnt += (s+a+1)
            s = -1
        elif(s<0 and s+a<=0):
            L[i] = -s+1
            cnt += (-s-a+1)
            s = 1
        else:
            s += a
    return cnt      

def ans(List):
    L = copy.deepcopy(List)
    a = L[0]
    c0,c1=0,0

    if (a>0):
        c0 = resolve(L)
        c1 = (a+1) + resolve([-1]+L[1:])
    elif (a<0):
        c0 = resolve(L)
        c1 = (-a+1) + resolve([1]+L[1:])
    else:
        c0 = 1 + resolve([1]+L[1:])
        c1 = 1 + resolve([-1]+L[1:])
    
    return(min(c0,c1))

def main():
    N = int(input())
    List = [int(x) for x in input().split(' ')]
    print(ans(List))

main()


Measured memory_bytes: 20644
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)

using namespace std;
using ll = long long;
using P = pair<int,int>;
using ull= unsigned long long;
const ll K_MAX=1e5+5;
const int INF=1e9;

ll pow2(ll a,int b){
  if(b==1){
    return a;
  }else{
    return pow2(a,b-1)*a;
  }
};


int main(){
  ll n;
  cin>>n;
  vector<ll> a(12);
  ll temp=1;
  a[0]=1;
  rep1(i,11){
    temp *=26;
    a[i]=temp;
  }

  vector<string> abc(26);
  vector<ll> c(12);// 桁数iのものの最大数
  c[0]=0;
  temp=1;
  
  for(int i=1; i<=11;i++){
    temp *=ll(26);
    c[i]=c[i-1]+temp;
  }
  
  abc={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};

  int keta=0;
  
  for(int j=11; j>0; j--){
    if(n>c[j]){//桁数
      keta=j+1;
      break;
    }
  }
  vector<ll> st(keta);
  //cout<<"keta"<<keta;
  if(keta==0){
    cout<<abc[n-1];
    return 0;
  }
  
  ll now=n-c[keta-1]-1; // 000=aaa
  for(int i=keta-1;i>=0;i--){
    st[i]=now/a[i];
    cout<<abc[st[i]];
    now -=a[i]*st[i];
  }
   
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
using namespace std;
int main(){
  string S;
  cin >> S;
  int mae, ushiro;
  mae = stoi(S.substr(0,2));
  ushiro = stoi(S.substr(2,2));
  if(mae<=12 && mae>0){
    if(ushiro<=12 && ushiro>0){
      cout << "AMBIGUOUS" <<"\n";
    }else cout << "MMYY" <<"\n";
  }else{
    if(ushiro<=12 && ushiro>0){
      cout << "YYMM" <<"\n";
    }else cout << "NA" <<"\n";
  }
  return 0; 
}

Measured memory_bytes: 256
#include<stdio.h>
void noone(int[10]);

int main(void){
	int mt[10];
	int i=0;

	for(i=0; i<10; i++){

		scanf("%d",&mt[i]);//10個の配列に数値を入れる

	}

	noone(mt);//一番大きい値を決める




}

void noone(int hai[10]){
	int i=0;
	int max=0;
	int max2=0;
	int max3=0;

	max=hai[0];

	for(i=1;i<10;i++){
		if(max<hai[i]){
			max3=max2;
			max2=max;
			max=hai[i];
		}else if(max2<hai[i]){
				max3=max2;
				max2=hai[i];
		}else if(max3<hai[i]){
				max3=hai[i];
			}
	}

	printf("%d\n%d\n%d\n",max,max2,max3);
}


Measured memory_bytes: 2044
#include <iostream>
#include <sstream>
#include <string>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <limits>
#include <iomanip>
#include <functional>
#include <array>
#include <climits>

using namespace std;
using ll = long long;
const ll MOD = (ll)1e9 + 7;

int main()
{
    ll n, k;
    cin >> n >> k;

    vector<ll> h;
    for (ll i = 0; i < n; i++)
    {
        ll hh;
        cin >> hh;
        h.push_back(hh);
    }
    sort(h.begin(), h.end());

    ll result = INT_MAX;
    for (ll i = 0; i <= h.size() - k; i++)
    {
        ll diff = h[i + k - 1] - h[i];
        if (result > diff)
        {
            result = diff;
        }
    }
    cout << result << endl;
    return 0;
}



Measured memory_bytes: 1400
N,M = map(int, input().split())
#ab = [list(map(int, input().split())) for _ in range(M)]
ab = [list(map(int, input(). split())) for i in range(M)]
#print(ab)

cnt_list = [0]*N

for _list in ab:
	for j in _list:
		cnt_list[j-1]+=1
for i in cnt_list:
	print(i)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;

int count(const vector<string> &P){
  int N = P.size(), ret = 0;
  for(int r = 0; r < (N+1)/2; ++r){
    for(int c = 0; c < (N+1)/2; ++c){
      if((P[r][c] == P[N-1-r][c]) and (P[r][c] == P[r][N-1-c]) and (P[r][c] == P[N-1-r][N-1-c]))
        continue;
      ++ret;
    }
  }
  return ret;
}

int check(vector<string> &P, int r, int c){
  int N = P.size();
  bool prev = (P[r][c] == P[N-1-r][c]) and (P[r][c] == P[r][N-1-c]) and (P[r][c] == P[N-1-r][N-1-c]);
  P[r][c] = '0' + '1' - P[r][c];
  bool cur = (P[r][c] == P[N-1-r][c]) and (P[r][c] == P[r][N-1-c]) and (P[r][c] == P[N-1-r][N-1-c]);
  return prev - cur;
}

int main(){
  int C, N;
  cin >> C >> N;
  vector<string> P(N);
  for(int i = 0; i < N; ++i){
    cin >> P[i];
  }
  int d = count(P);
  int ans = 0;
  if(not d) ++ans;
  for(int i = 0; i < C-1; ++i){
    int D;
    cin >> D;
    for(int j = 0; j < D; ++j){
      int r, c;
      cin >> r >> c;
      --r,--c;
      //P[r][c] = '0' + '1' - P[r][c];
      d += check(P,r,c);
    }
    if(not d) ++ans;
  }
  cout << ans << endl;
}



Measured memory_bytes: 4012
#include <stdio.h>
#include <math.h>
#define MAX 999999

int main(void) {

  int flag[MAX+1];
  int n,count;

  int i,j;

  for(i=0;i<=MAX;i++) {
    flag[i]= (i<=1)? 0: 1;
  }

  for(i=2;i<=(int)sqrt(MAX)+1;i++) {
    if(flag[i]==1) {
      for(j=i*2;j<=MAX;j+=i) flag[j]=0;
    }
  }
  //for(i=0;i<=MAX;i++) printf("%d\n",flag[i]);
  while(scanf("%d",&n)!=EOF) {

    count=0;

    for(i=2;i<=n;i++) {

      if(flag[i]==1) count++;
    }

    printf("%d\n",count);

  }

  return 0;

}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i=0; i<N; i++){
    cin >> S[i];
  }
  sort(S.begin(), S.end());
  vector<string> T(N);
  vector<int> F(N);
  T[0]=S[0];
  F[0]++;
  int h=0;
  int fmax=F[0];
  for(int i=1; i<N; i++){
    if (S[i]==S[i-1]) F[h]++;
    else{
      h++;
      T[h]=S[i];
      F[h]++;
    }
    fmax=max(fmax, F[h]);
  }
  for(int i=0; i<=h; i++){
    if(F[i]==fmax){
      cout << T[i] <<endl;
    }
  }
}

Measured memory_bytes: 16640
#include <bits/stdc++.h>

using namespace std;

#define all(x) begin(x), end(x)

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    int n;
    ll k;
    cin >> n >> k;
    vector<ll> a(n);

    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    ll cur = 0LL;
    for (ll d = 60; d >= 0; --d) {
        ll b = (1LL << d);
        if ((cur ^ b) > k) continue;
        // count frequency of 0s and 1s 
        // if 0s > 1s, use the bit
        int zeros = 0;
        for (ll x : a) {
            if ((x & b) == 0) {
                ++zeros;
            }
        }

        int ones = n - zeros;
        if (zeros > ones) {
            cur ^= b;
        }
    }

    ll res = 0LL;
    for (ll x : a) {
        res += (x ^ cur);
    }

    cout << res << '\n';
    return 0;
}


Measured memory_bytes: 1024
//#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;

int main() {
	int n, a[200005];
	for (int i = 0; i < 200005; i++) a[i] = 0;
	cin >> n;
	for (int i = 0; i < n-1; i++) {
		int x; cin >> x;
		a[x]++;
	}

	for (int i = 1; i <= n; i++) cout << a[i] << endl;
}

Measured memory_bytes: 4416
import sys
input = sys.stdin.readline
from collections import deque


def read():
    X = input().strip()
    return X,


def solve(X):
    q = deque()
    for x in X:
        if x == "T":
            if len(q) > 0 and q[-1] == "S":
                # remove ST pair
                q.pop()
            else:
                q.append("T")
        elif x == "S":
            q.append("S")
    return len(q)
        


if __name__ == '__main__':
    inputs = read()
    print(solve(*inputs))


Measured memory_bytes: 10568
A,B = gets.split.map(&:to_i).map{|n| n-1}
S = gets.chomp

puts ((/[0-9]{#{A+1}}/ =~ S[0..A]) == 0 and
  S[A+1] == '-' and
  (/[0-9]{#{B+1}}/ =~ S[A+2..A+2+B]) == 0) ?
  "Yes" : "No"

Measured memory_bytes: 1788
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    S = input()
    K = int(readline())

    letter = S[K - 1]

    res = ""
    for x in S:
        if x == letter:
            res += letter
        else:
            res += "*"

    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 61896
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    int dx=x2-x1,dy=y2-y1;
    int x3=x2-dy,y3=y2+dx,x4=x1-dy,y4=y1+dx;
    cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;
    return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)

using namespace std;
using ll = long long;
using pos = pair<ll, ll>;

ll n;
vector<ll> a;

void solve();

int main() {

   solve();
   return 0;

}

void solve() {

	cin >> n;
	a.resize(n);
	REP(i,n){
		cin >> a[i];
	}
	sort(a.begin(),a.end());
	ll ans=1;	ll cnt=2;
	RFOR(i,1,n){
      	//cout << i;
		if(a[i]==a[i-1]){
			if(cnt){
              ans*=a[i];
              cnt--;
            }
			i--;
          	//cout << "hit";
		}
      	//cout << endl;
	}
	cout << (cnt?0:ans) << endl;	

}

Measured memory_bytes: 1024
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

if N == 1:
  print(sum(A1) + sum(A2))
  exit()
  
ans = 0

for i in range(N+1):
  ans = max(ans, sum(A1[0:i]) + sum(A2[i-1:N]))

print(ans)

Measured memory_bytes: 3064
#pragma GCC optimize(2)
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <set>
//#include <unordered_map>
#include <queue>
#define all(v) (v).begin(),(v).end()
#define rep(x,y) for(ull i = (x);i<=(y);i++)
#define pb(x) push_back((x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const int inf = 0x3f3f3f3f;
int dir8[8][2] = {-1,0,1,0,0,1,0,-1,-1,-1,-1,1,1,-1,1,1};
int dir4[4][2] = {0,1,1,0,0,-1,-1,0};
char dir4show[4] = {'r','d','l','u'};
const double eps = 1e-6;

string s;
int idx[maxn];
int res[maxn];
int idxr = -1,idxl = -1;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>s;
    for(int i = 0;i<s.size();i++){
        if(s[i] == 'L') idx[i] = idxr;
        else idxr = i;
    }
    for(int i = s.size()-1;i>=0;i--){
        if(s[i] == 'R') idx[i] = idxl;
        else idxl = i;
    }
    for(int i = 0;i<s.size();i++){
        if(s[i] == 'R'){
            if((idx[i]-i)%2 == 1) res[idx[i]-1]++;
            else res[idx[i]]++;
        }else{
            if((i-idx[i])%2 == 1) res[idx[i]+1]++;
            else res[idx[i]]++;
        }
    }
    for(int i = 0;i<s.size();i++) cout<<res[i]<<" ";



    return 0;
}

Measured memory_bytes: 5184
#include <iostream>
#include<vector>
#include <queue>
using namespace std;

int A[200005];
int main(){
	int N,K,j;
	cin>>N>>K;
	for(int i=0;i<N;i++){
		cin>>j;
		A[j]++;
	}
	priority_queue<int, vector<int>, greater<int> > q;
	int num=0;
	for(int i=0;i<=N;i++){
		if(A[i]!=0){
			q.push(A[i]);
			num++;
		}
	}
	int ans=0;
	for(int i=0;i<num-K;i++){
		ans+=q.top();
		q.pop();
	}
	cout<<ans<<endl;
	return 0;

}




Measured memory_bytes: 2168
N=int(input())
s=[int(input()) for i in range(N)]
p=s[0]
if p==2:
    print(1)
    exit()
for i in range(N):
    q=s[p-1]
    if q==2:
        print(i+2)
        exit()
    p=q
print(-1)    

Measured memory_bytes: 7084
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
#define pii pair<int, int>
#define mp(x, y) make_pair(x, y)
using namespace std;
typedef long long ll;
const int Maxn = 1e5 + 5;
typedef int arr[Maxn];
//ll Add(ll x, ll y) { return (x += y) >= Mod ? x - Mod : (x < 0 ? x + Mod : x); }
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
ll n;
deque<int> ans;
int main()
{
	rg ll cnt = 1;
	cin >> n;
	if (n == 1)
	{
		printf("2\n1 1\n");
		return 0;
	}
	while (cnt <= n)
		cnt <<= 1;
	cnt >>= 1;
	rg int i;
	ans.push_front(i = 1);
	n ^= cnt;
	cnt >>= 1;
	while (cnt)
	{
		if (n & cnt)
			ans.push_back(++i);
		if (cnt != 1)
			ans.push_front(++i);
		cnt >>= 1;
	}
	ans.push_back(++i);
	cout << 2 * i << '\n';
	for (int j = 1; j <= i; j++)
		cout << j << ' ';
	while (!ans.empty())
	{
		cout << i - ans.front() + 1 << ' ';
		ans.pop_front();
	}
	putchar('\n');
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,n) for(int (i)=0; (i) < (n); (i)++)

int main()
{
    ll N; cin >> N;
    string S; cin >> S;

    ll ans = 0;
    rep(i, N) {
            vector<ll> A(26, 0);
            vector<ll> B(26, 0);
            rep(j,N) {
                if (j < i+1) {
                    A[S[j] - 'a'] = 1;
                    //cout << "A = " << S[j] << endl;
                }
                else {
                    B[S[j] - 'a'] = 1;
                    //cout << "B = " << S[j] << endl;
                }
            }
            ll num = 0;
            rep(j, 26) {
                if (A[j] == 1 && B[j] == 1) num++;
            }
            if (ans < num) ans = num;
    }
    cout << ans << endl;

    




}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main() {
  int k;
  cin >> k;
  vector<ll> a;
  for (int i = 1; i <= 9; i++) a.push_back(i);
  while(true){
    if(k <= a.size()){
      cout << a[k - 1] << endl;
      return 0;
    }
    k -= a.size();
    vector<ll> old;
    swap(old, a);
    for(ll x : old){
      for (int i = -1; i <= 1; i++){
        int d = x % 10 + i;
        if(d < 0 || 9 < d) continue;
        ll nx = x * 10 + d;
        a.push_back(nx);
      }
    }
  }
  return 0;
}

Measured memory_bytes: 1712
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define mod 1000000007
 //----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll first_no;
	ll last_no;
	first_no=(a/c+1)*c;
	if(a%c==0)
		first_no=(a/c)*c;
	last_no=(b/c)*c;
	ll n1=((last_no-first_no)/c)+1;
	first_no=(a/d+1)*d;
	if(a%d==0)
		first_no=(a/d)*d;
	last_no=(b/d)*d;
	ll n2=((last_no-first_no)/d)+1;
	ll lcm=c*d/__gcd(c,d);
	first_no=(a/lcm+1)*lcm;
	if(a%lcm==0)
		first_no=(a/lcm)*lcm;
	last_no=(b/lcm)*lcm;
	ll n3=((last_no-first_no)/lcm)+1;
	cout<<b-a+1-(n1+n2-n3);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define LOL cout << '\n';
#define sz(x) ((int)x.size())
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define deb(x) cout << "[" << (#x) << "=" << x << "]" << '\n';
#define deb2(x,y) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "]" << '\n';
#define deb3(x,y,z) cout << "[" << (#x) << "=" << x << "] [" << (#y) << "=" << y << "] [" << (#z) << "=" << z << "]" << '\n';

void solve(){
  int n; cin >> n;
  int a[n];
  for(int i = 0 ; i < n ; i++) cin >> a[i];
  int cnt = 0, s = a[0];
  for(int i = 1 ; i < n ; i++){
    if(a[i] < s) cnt += s - a[i];
    a[i] = max(a[i], s);
    s = a[i];
  }
  cout << cnt;LOL
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int _ = 1; //cin >> _;
  for(int i = 1 ; i <= _ ; i++){
    //cout << "Case #" << i << ": ";
    solve();
  }
  return 0;
}


Measured memory_bytes: 5180
import sys

def input(): return sys.stdin.readline()[:-1]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def MATINT(h): return [list(map(int, input().split())) for _ in range(h)]
def MATSTR(h): return [input() for _ in range(h)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
inf = float('inf')
mod = 10 ** 9 + 7

H, W, A, B = MAP()
M = [[0] * W for _ in range(H)]
for hh in range(H):
    for ww in range(W):
        if ww < A and hh < B:
            M[hh][ww] = 1
        if ww >= A and hh >= B:
            M[hh][ww] = 1
for hh in range(H):
    print("".join([str(n) for n in M[hh]]))


Measured memory_bytes: 12788
import Data.List (nub)

kinds :: String -> Int
kinds = length . nub

normalStrings :: Int -> [String]
normalStrings 1 = ["a"]
normalStrings n
  | n <= 0 = error "normalStrings: non-positive integer"
  | otherwise =
      let prefixes = normalStrings (n-1)
      in
      flip concatMap prefixes $ \prefix ->
        map (\c -> prefix ++ [c]) $ take (kinds prefix + 1) ['a'..]

main :: IO ()
main = do
  n <- readLn
  mapM_ putStrLn $ normalStrings n


Measured memory_bytes: 2684
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 998244353LL;
const int maxn = 3000010;
ll qpow(ll a,ll x){
    ll ret=1;
    while (x){
        if (x&1)
            ret = ret*a%mod;
        a=a*a%mod;
        x>>=1;
    }
    return ret;
}
ll fac[maxn],inv[maxn];

ll init(){
    fac[0]=1;
    for (int i=1;i<maxn;i++)
        fac[i]=fac[i-1]*i%mod;
    inv[maxn-1]=qpow(fac[maxn-1],mod-2);
    for (int i=maxn-2;i>=0;i--)
        inv[i]=inv[i+1]*(i+1)%mod;
    return 0;
}

ll c(ll n,ll m){
    if (n<m) return 0;
    return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
    init();
    ll N,A,B,K;
    cin>>N>>A>>B>>K;
    ll ans=0;
    for(int i=0;i<=N;i++){
        if(K-A*i<0) continue;
        if((K-A*i)%B!=0) continue;
        ll y=(K-A*i)/B;
        if(y>N)continue;
        ans=(ans+c(N,i)*c(N,y)+mod)%mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 47104
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int ans = (n * (n - 1)) / 2 + (m * (m - 1)) / 2;
    System.out.println(ans);
  }
}


Measured memory_bytes: 23636
object Main extends App {
    override def main(args: Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        
        Iterator.continually(new Datum(sc.nextInt,sc.nextInt)).takeWhile(_.isContinue).foreach{ d => 
            println(d.solve)
        }
        
    }
    
    class Datum(val x:Int , val y:Int){
        val isContinue:Boolean = !(x == 0 && y == 0)
        
        def solve:String = Math.min(x,y) + " " + Math.max(x,y) 
        
    }
}

Measured memory_bytes: 54812
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
	int i,j,k;
	cin>>i>>j;
	double a,b=i,c=j;
	a=4*b-c;
	a=a/2;
	k=floor(a);
	if(a<0)
	cout<<"No";
	else if(a==k)
	{
		if(k>i)
		cout<<"No";
		else
		{
		if((2*k+(i-k)*4)==j)
		cout<<"Yes";
		else
		cout<<"No";
		}
	}
	else
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3620
n, m = map(int, input().split())

import math
if n == m:
    dog = math.factorial(n)
    mon = math.factorial(m)
    ans = dog * mon * 2
elif n == m + 1 or n == m - 1:
    dog = math.factorial(n)
    mon = math.factorial(m)
    ans = dog * mon
else:
    ans = 0

print(ans % (10 ** 9 + 7))


Measured memory_bytes: 11116
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a, a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x-a)*(x-a) + (y-b)*(y-b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cerr << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846
#define FF first
#define SS second

#define M 222222
ll sze, numComp;
ll sz[M], id[M];
void build(ll N) {
	sze = numComp = N;
	for ( ll k = 0; k < N; k++ ){
		sz[k] = 1;
		id[k] = k;
	}
}

ll find(ll p) {
	ll root = p;
	while (root != id[root]){ root = id[root]; }
	while (p != root){
		ll temp = id[p];
		id[p] = root;
		p = temp;
	}
	return root;
}

bool connected(ll p, ll q) { return find(p) == find(q); }
ll componentSize(ll p) { return sz[find(p)]; }

void unify(ll p, ll q) {
		ll root1 = find(p);
		ll root2 = find(q);
		if (root1 == root2) return;
		if (sz[root1] < sz[root2]) {
			sz[root2] += sz[root1];
			id[root1] = root2;
		} else {
			sz[root1] += sz[root2];
			id[root2] = root1;
		}
		numComp--;
}

int main(){
	FASTIO;
	ll n, m; cin >> n >> m;
	build(n + 1);
	for ( int k = 0; k < m; k++ ){
		ll x, y; cin >> x >> y;
		unify(x, y);
	}
	ll ans = 0;
	for ( int k = 0; k <= n; k++ ){
		ans = max(ans, componentSize(k));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 6820
# -*- coding: utf-8 -*-
from heapq import heappush,heappushpop,heapify

n = int(input())
a = [int(x) for x in input().split()]

q = []
s = 0
for i in range(n):
    heappush(q, a[i])
    s += a[i]
left = [s]
for k in range(n):
    x = heappushpop(q, a[n+k])
    s = s - x + a[n+k]
    left.append(s)

q = []
s = 0
for i in range(n):
    heappush(q, -1*a[3*n-1-i])
    s += a[3*n-1-i]
right = [0 for _ in range(n+1)]
right[n] = s
for k in range(n):
    x = heappushpop(q, -1*a[2*n-1-k])
    s = s - (-1*x) + a[2*n-1-k]
    right[n-1-k] = s

m = None
for k in range(n+1):
    if m is None:
        m = left[k] - right[k]
    else:
        m = max(m, left[k]-right[k])

print(m)


Measured memory_bytes: 37212
import java.lang.Math;
import java.util.Scanner;
import java.util.List;
import java.util.Collections;
import java.util.ArrayList;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int k = sc.nextInt();
        List<Integer> answers = new ArrayList<>(4);

        for (int i = a; i <= Math.min(b, a + k - 1); i++) {
            System.out.println(i);
        }
        for (int i = Math.max(a + k, b - k + 1); i <= b; i++) {
            System.out.println(i);
        }
    }
}


Measured memory_bytes: 21844
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
typedef long long LL;
const int inf = 1 << 30;
const LL INF = 1LL << 60;
const int MaxN = 100005;

int n;
int a[MaxN + 5];
int sum[MaxN + 5];

int solve(int x) {
	int L = sum[x - 1];
	int R = sum[n + 1] - sum[x + 1];
	return (L + R + abs(a[x - 1] - a[x + 1]));
}

int main()
{
	while(scanf("%d", &n) != EOF)
	{
		for(int i = 1; i <= n; i++) scanf("%d", &a[i]);
		a[0] = a[n + 1] = 0;
		sum[0] = 0;
		for(int i = 1; i <= n + 1; i++)
			sum[i] = sum[i - 1] + abs(a[i] - a[i - 1]);
		for(int i = 1; i <= n; i++)
			printf("%d\n", solve(i));
	}
	return 0;
}

Measured memory_bytes: 2048
n,a,b=map(int,input().split())
s=input()

ninzu=0
kaigai=0
ans=0
for s_i in s:
    if s_i=='a':
        if ninzu<(a+b):
            print('Yes')
            ninzu+=1
        else:
            print('No')
    if s_i=='b':
        if ninzu<(a+b) and kaigai<b:
            print('Yes')
            ninzu+=1
            kaigai+=1
        else:
            print('No')
    if s_i=='c':
        print('No')



Measured memory_bytes: 9188
#include <iostream>
#include<stdio.h>
using namespace std;

int main()
{
    int a,b;
    while(scanf("%d %d",&a,&b)!=EOF){
    int ad,s,jf,temp;
    ad=a+b;
    jf=a-b;
    s=a*b;
    if(ad>jf){
        temp=ad;
    }
    else{
        temp=jf;
    }
    if(temp>s){
        printf("%d",temp);
    }else{
        printf("%d",s);
    }
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

const ll mod = 998244353ll;
// const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5],rfact[fact_table + 5];

void c3_init(){
    fact[0] = rfact[0] = 1;
    for(ll i=1; i<=fact_table; i++){
        fact[i] = (fact[i-1]*i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod);
    for(ll i=fact_table; i>=1; i--){
       rfact[i-1] = rfact[i] * i;
       rfact[i-1] %= mod;
    }
    return;}
ll c3(ll n,ll r){
    return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;}
*/

bool multicase = false;

ll n, m, k, num, a, b, c, d, e, h, q, ans, sum;

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

ll x[500005], y[500005];
ll z[500005];

string s, t;

void solve() {
    cin >> n;
    for(ll i=1;i<=n;i++){
        ll maxi = n / i;
        ans += ((maxi + 1) * maxi / 2) * i;
    }
    p(ans);
    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}



Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0,buf1=0,buf2=0,buf3=0,buf4=0,sum=0;
  ll l,r;
  bool judge = true;
  ll n,a,b;cin>>n>>a>>b;
  vector<ll>x(n);
  for(i=0;i<n;i++)cin>>x[i];
  for(i=0;i<n-1;i++){
    res+=min((x[i+1]-x[i])*a,b);

  }
  cout<<res<<endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;

    if (N == 1)
    {
        cout << "Hello World" << endl;
    }
    else
    {
        int A, B;
        cin >> A >> B;
        cout << (A + B) << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  string s;cin>>s;
  int q;cin>>q;
  vector<int> k(q);
  rep(i,q)cin>>k[i];
  rep(x,q){
      lint res=0;
      lint d=0;
      lint m=0;
      lint dm=0;
      rep(i,k[x]){
          if(s[i]=='D')++d;
          else if(s[i]=='M'){
              ++m;dm+=d;
          }
          else if(s[i]=='C')res+=dm;
      }
      for(int i=k[x];i<n;++i){
          if(s[i-k[x]]=='D'){
              --d;dm-=m;
          }
          else if(s[i-k[x]]=='M'){
              --m;
          }
          if(s[i]=='D')++d;
          else if(s[i]=='M'){
              ++m;dm+=d;
          }
          else if(s[i]=='C')res+=dm;
      }
      cout<<res<<"\n";
  }
  return 0;
}

Measured memory_bytes: 5344
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

const string YES = "Yes";
const string NO = "No";

void solve(long long N, std::vector<long long> a)
{
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> a(N);
    long long one = 0;
    long long two = 0;
    long long four = 0;
    for (int i = 0; i < N; i++)
    {
        long long a;
        cin >> a;
        if (a % 4 == 0)
        {
            four++;
        }
        else if (a % 2 == 0)
        {
            two++;
        }
        else
        {
            one++;
        }
    }

    if (two > 0)
    {
        one++;
    }

    if (one <= four + 1)
    {
        cout << YES << endl;
    }
    else
    {
        cout << NO << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	static public void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[][] aArray = new int[2][n];
		for (int i = 0; i < 2; i++) {
			for (int j = 0; j < n; j++) {
				aArray[i][j] = scan.nextInt();
			}
		}
		scan.close();

		int max = 0;
		for (int i = 0; i < n; i++) {
			int tmpMax = aArray[0][0];
			for (int j = 0; j < i; j++) {
				tmpMax += aArray[0][j + 1];
			}
			for (int j = i; j < n; j++) {
				tmpMax += aArray[1][j];
			}
			if (max < tmpMax) {
				max = tmpMax;
			}
		}

		System.out.println(max);
	}
}


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;

int main(){
  long int n, m, l, b[100][100], a[100][100], c[100][100] = {};
  cin >> n >> m >> l;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      cin >> a[i][j];
    }
  }
  for(int i = 0; i < m; i++){
    for(int j = 0; j < l; j++){
      cin >> b[i][j];
    }
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < m; j++){
      for(int k = 0; k < l; k++){
        c[i][k] += a[i][j] * b[j][k];
      }
    }
  }
  for(int i=0;i<n;i++){
				for(int j=0;j<l;j++){
					if(j!=l-1)cout<<c[i][j]<<" ";
					else cout<<c[i][j]<<endl;
				}
			}
}



Measured memory_bytes: 3324
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,x,n;
	cin>>x>>n;
	ll ar[n+1],fll[1001]={0}; 
	for(i=1;i<=n;i++){
		cin>>ar[i];
		fll[ar[i]]=1;
	}
	queue<ll> qe;
	map<ll,ll> fl;
	qe.push(x); fl[x]=1;
	while(qe.size()>0){
		k=qe.front();
		qe.pop();
		if(fll[k]==0){
			cout<<k<<endl; return 0;
		}
		fl[k]=1;
		if(fl[k-1]==0){
			qe.push(k-1);
		}
		if(fl[k+1]==0){
			qe.push(k+1);
		}
	}
	return 0;	
}

Measured memory_bytes: 3680
#include<bits/stdc++.h>
using namespace std;

int main()
{
    long long N,X;
    cin >> N >> X;
    vector<long long> m(N);
    int count = 0;
    long long minm = 1001;

    for(int i = 0; i < N; i++)
    {
        cin >> m.at(i);
        minm = min(minm,m.at(i));
        X -= m.at(i);
        count++;
    }

    if(X < minm)
    {
        cout << count << endl;
        return 0;
    }

    while(X >= minm)
    {
        X -= minm;
        count++;
    }

    cout << count << endl;

    return 0;
}

Measured memory_bytes: 256
//300
fun a021(args: Array<String>) {
    val nStr = args[0]
    val nLong = nStr.toLong()
    var ans = 0L
    fun pow(x: Int, n: Int): Long = Math.pow(x.toDouble(), n.toDouble()).toLong()
    for (digit in 1..17) {
        ans += nLong % pow(10, digit) / pow(10, digit - 1)
    }
    println(Math.max(9L * (nStr.length - 1) + nStr[0].toString().toLong() - 1, ans))
}

fun main(args: Array<String>) {
    a021(readLineList())
}

fun readLineList(): Array<String> {
    val lineList = mutableListOf<String>()
    while (true) {
        val line = readLine()
        if (line.isNullOrBlank()) {
            break
        } else {
            lineList.add(line!!)
        }
    }
    return lineList.toTypedArray()
}

Measured memory_bytes: 31824
## coding: UTF-8
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
dp = [[0, 0, 0] for _ in range(N)]
#print(l)
#print(dp)

dp[0] = l[0]
#print(dp)

for i in range(1, N):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + l[i][0]
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + l[i][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + l[i][2]
    #print(dp)
print(max(dp[-1]))


Measured memory_bytes: 77312