akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

template<typename T> vector<T> divisor(T n){
    vector<T> ret;
    for (T i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) { ret.push_back(n / i); }
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

int main(){
    long long N, ans = 0;
    cin >> N;
    vector<long long> div = divisor(N);
    for (long long d : div) {
        if (d == 1) continue;
        long long p = N / (d-1), q = N % (d-1);
        if (p == q) ans += (d-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <set>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
typedef long long ll;
typedef long double ld;
int main(){
    string s;cin>>s;
    set<char> v;
    ll n=SIZE(s);
    REP(i,n){
        v.insert(s[i]);
    } 
    char c='a';
    REP(i,n){
       if(v.find(c)!=v.end()){
           c++;
       }else{
           break;
       }
    }
    string ans;
    if(c=='{'){
        ans="None";
    }else{
        ans=c;
    }
    cout<<ans<<endl;
    return 0;

}


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) v.begin(),v.end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll i=1;
    while(true){
        int x; cin>>x;
        if(x==0||i>10000) break;
        printf("Case %d: %d\n",i,x);
        i++;
    }
    return 0;
}


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

int main()
{
  	/**
   	　* A, B, C, K：入力
   	　* a, b, c：操作後のカードの値
   	　*/
  	int A, B, C, K;
  	int a, b, c;
  	bool is_success = false;
  
  	cin >> A >> B >> C >> K;
  
    a = A;
    b = B;
    c = C;
  
  	// debug
  	// cout << A << B << C << K;
  
  	// i：緑のカードを2倍する回数
  	for (int i = 0; i <= K; i++)
 	{    
    	// j：青のカードを2倍する回数
     	c = C;
    	for (int j = 0; j <= K-i; j++)
    	{
            if (a < b && b < c)
            {
              // debug
              // cout << i << j << endl;
              is_success = true;
              break;
            }
          
          	c *= 2;
    	}
      
      	if (is_success) 
        {
          	break;
        }
      
        b *= 2;
  }
  
  if (is_success)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3616
#include<stdio.h>
#define MAX 100
//#define in_range(a,b,c) (a<=b&&b<=c)?1:0
int in_range(int a,int b ,int c){
  return (a<=b&&b<=c)?1:0;
}


int h,w;
char matrix[MAX+2][MAX+2];
char visited[MAX+2][MAX+2];
char vector[4][2]={{1,0},{-1,0},{0,1},{0,-1}};


int dfs(int x,int y,int fruit){
  int i;
  visited[y][x] = fruit;
  for(i=0;i<4;i++){
    int nx = x + vector[i][0];
    int ny = y + vector[i][1];
    if(in_range(0,nx,w-1) && in_range(0,ny,h-1)
      && !visited[ny][nx] && matrix[ny][nx]==fruit){
      dfs(nx,ny,fruit);
    }
  }
  return 0;
}


void print(){
  int i,j;
  for(i=0;i<h;i++){
    printf("%s ",matrix[i]);
    for(j=0;j<w;j++){
      printf("%d",visited[i][j]?1:0);
    }
    puts("");
  }
}

int main(){
  int i,j;
  int ans;
  while(1){
    scanf("%d %d",&h,&w);
    if(h==0&&w==0){break;}
    ans=0;
    for(i=0;i<h;i++){
      scanf("%s",matrix[i]);
      for(j=0;j<w;j++){
        visited[i][j]=0;
      }
    }
    for(i=0;i<h;i++){
      for(j=0;j<w;j++){
        if(!visited[i][j]){
          dfs(j,i,matrix[i][j]);
          ans++;
        }
      }
    }
    printf("%d\n",ans);
  }
  return 0;
}

Measured memory_bytes: 1088
let _ = Scanf.sscanf (read_line ()) "%d %d %d %d %d" (fun w h x y r ->
    match x with
    | x when x - r >= 0 && x + r <= w ->
        (match y with
        | y when y - r >= 0 && y + r <= h -> print_endline "Yes"
        | _ -> print_endline "No")
    | _ -> print_endline "No"
)


Measured memory_bytes: 2296
#include <stdio.h>

int main()
{
int inori,kuma,ayaneru,oonishisaori;
 
scanf("%d%d",&inori,&kuma);
 ayaneru=inori%kuma;
while(ayaneru != 0){
  inori = kuma;
  kuma = ayaneru;
  ayaneru = inori%kuma;
 }
printf("%d\n",kuma);

 return 0;
   }



Measured memory_bytes: 2104
using System;
using System.Linq;

namespace _4_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int q = int.Parse(Console.ReadLine());
            int[] t = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int x = 0;
            for (int i = 0; i < q; i++)
            {
                bool now = false;
                for (int j = 0; j < n; j++)
                {
                    if (s[j] == t[i])
                    {
                        now = true;
                    }
                }
                if (now)
                {
                    x++;
                }
            }
            Console.WriteLine(x);
        }
    }
}

Measured memory_bytes: 9956
using System;

namespace ABC086C_Traveling
{
    class MainClass
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] t = new int[110000];
            int[] x = new int[110000];
            int[] y = new int[110000];
            t[0] = x[0] = y[0] = 0;
            
            for (int i = 1; i <= n; i++)
            {
                string[] inp = Console.ReadLine().Split(' ');
                t[i] = int.Parse(inp[0]);
                x[i] = int.Parse(inp[1]);
                y[i] = int.Parse(inp[2]);
            }

            bool result = true;
            for (int i = 0; i < n; i++)
            {
                int dt = t[i + 1] - t[i];
                int dist = Math.Abs(x[i + 1] - x[i]) + Math.Abs(y[i + 1] - y[i]);
                if (dt - dist < 0 || (dt - dist) % 2 != 0)
                {
                    result = false;
                    break;
                }
            }
            Console.WriteLine(result ? "Yes" : "No");
        }
    }
}


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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 62;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> cnt(26, 0);
    string S; cin >> S;
    rep(i, S.length()){
        cnt[S[i]-'a']++;
    }
    rep(i, 26) if(cnt[i] >= 2){cout << "no" << endl; return 0;}
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 3568
#include <iostream>

using namespace std;

main(){
  int n;
  while(cin >> n && n){
    int ans = 0;
    for(int i=2;i<=1000;i++){
      int tmp = (i*(i-1))/2;
      for(int j=1;j<=1000;j++){
        int tmp2 = j*i + tmp;
        if(tmp2 > n) break;
        if(tmp2 == n) ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 0
/*
  AOJ 0565 
  Title:Lunch
  @kankichi573
*/
#include <stdio.h>
#define min(x,y) (((x)<(y))?(x):(y))

int Price[5];

main()
{
        int i,ans;

        for(i=0;i<5;i++)
                scanf("%d",&Price[i]);
        ans=min(min(Price[0],Price[1]),Price[2]) \
                +min(Price[3],Price[4])-50;
        printf("%d\n",ans);        
        
  return(0);
}

Measured memory_bytes: 592
#include <cstdio>
#include <vector>
#include <cstring>
#include <functional>
#include <algorithm>
#include <math.h>
#include <bitset>
#include <set>
#include <queue>
#include <assert.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <complex>
#include <numeric>
#include <map>
#include <time.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<int,ull> piu;
typedef pair<ull,ull> puu;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;
typedef pair<pii,ll> ppl;
typedef pair<ll,pii> plp;
typedef pair<ll,pll> plP;
typedef pair<int,pii> pip;
typedef pair<pii,int> ppi;
typedef pair<pii,pii> ppp;
typedef pair<double,int> pdi;
typedef pair<int,double> pid;
typedef pair<double,pii> pdp;
typedef pair<double,double> pdd;
typedef pair<pdd,double> pd3;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i,n) for (int (i) = 0; (i) < (n); (i)++)
#define repn(i,a,n) for (int (i) = (a); (i) < (n); (i)++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define SORT(x) sort((x).begin(),(x).end())
#define SORTN(x,n) sort((x),(x)+(n))
#define ERASE(x) (x).erase(unique((x).begin(),(x).end()),(x).end())
#define COUNT(x,c) count((x).begin(),(x).end(),(c))
#define REMOVE(x,c) (x).erase(remove((x).begin(),(x).end(),(c)),(x).end())
#define REVERSE(x) reverse((x).begin(),(x).end())
#define FORIT(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))-(x).begin()
#define lb(x,a) lower_bound((x).begin(),(x).end(),(a))
#define LBN(x,a,n) lower_bound((x),(x)+(n),(a))-(x)
#define lbN(x,a,n) lower_bound((x),(x)+(n),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))-(x).begin()
#define ub(x,a) upper_bound((x).begin(),(x).end(),(a))
#define BS(x,a) binary_search((x).begin(),(x).end(),(a))
#define BS2(x,n,a) binary_search((x),(x)+(n),(a))
#define NB(x) (((x)&~((x)+((x)&-(x))))/((x)&-(x))>>1)|((x)+((x)&-(x)))
#define NP(x) next_permutation((x).begin(),(x).end())
#define MM(x,p) memset((x),(p),sizeof(x))
#define SQ(x) (x)*(x)
#define SC(c1,c2) strcmp(c1,c2)==0
#define mp make_pair
#define INF (1<<29)
#define INFL (1LL<<61)
#define fi first
#define se second
#define EPS 1e-9
#define MOD 1000000007
#define MIN(x,a) x=min(x,a)
#define MAX(x,a) x=max(x,a)
#define madd(x,a) x=(x+a)%MOD
#define msub(x,a) x=(x+MOD-a)%MOD
#define OUTPUT(x) rep(__,x.size())printf("%d%c",x[__],__+1==x.size()?'\n':' ')

int N;
int A[300][300];
int d[300][300];

int main()
{
	scanf("%d",&N);
	rep(i,N)rep(j,N)scanf("%d",&A[i][j]);
	rep(i,N)rep(j,N)d[i][j]=A[i][j];
	rep(k,N)rep(i,N)rep(j,N)MIN(d[i][j],d[i][k]+d[k][j]);
	rep(i,N)rep(j,N)if(d[i][j]!=A[i][j])
	{
		puts("-1");
		return 0;
	}
	rep(k,N)rep(i,N)rep(j,N)if(d[i][j]==A[i][k]+A[k][j]&&A[i][k]&&A[k][j])d[i][j]=0;
	ll res=0;
	rep(i,N)rep(j,i)res+=d[i][j];
	printf("%lld\n",res);
}

Measured memory_bytes: 896
import numpy as np
N = []
FLAGS = True
for i in range(3):
  N1 = list(map(int, input().split(' ')))
  N.append(N1)

N = np.array(N)

M = int(input())

for i in range(M):
  a = int(input())
  
  for j in range(3):
    for k in range(3):
      if N[j, k] == a:
        N[j, k] = 0
  if (np.all(N == 0, axis = 0).any(0)) or (np.all(N == 0, axis = 1).any(0)) or (np.all(np.diag(N) == 0).any(0)) or (np.all(np.diag(np.fliplr(N)) == 0).any(0)):
    print('Yes')
    FLAGS = True
    break
  else:
    FLAGS = False
    continue
      
if FLAGS == False:     
  print('No')


Measured memory_bytes: 12500
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.stream.Stream;
import java.util.Collection;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author teiwa
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long N = in.nextLong();
            List<Long> passengerNum = new ArrayList<>();
            for (int i = 0; i < 5; i++) {
                passengerNum.add(in.nextLong());
            }

            List<Long> sortedPassengerNum = passengerNum.stream().sorted().collect(Collectors.toList());

            Long min = sortedPassengerNum.get(0);

            out.println((N - 1) / min + 5);
        }

    }
}



Measured memory_bytes: 28884
function main(input) {
   input = input.trim();
   const a = input.split("");
   var ans =700;
   a.forEach(function(a) {
    if(a == "o"){
     ans+=100;
    }
   });
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 30568
a,b,c,d,e,f= map(int, input().split())
youeki=0
yousitu=0
noudo=0
n_a=int(f/(100*a))


for i in range(2+n_a):
 for j in range(2+int((f-100*i*a)/(100*b))):
  for k in range(2+int((f-100*i*a-100*j*b)/c)):
   for l in range(2+int((f-100*i*a-100*j*b-k*c)/d)):
    S=100.0*a*i+100.0*b*j+c*k+d*l
    T=c*k+d*l
    if S!=0:
     L=100.0*T/S
     if S<=f and L<=100*e/(100+e) and L>=noudo:
      noudo=L
      youeki=S
      yousitu=T
print(int(youeki),int(yousitu))


Measured memory_bytes: 3188
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    ll N;
    cin>>N;
    string S, T;
    cin>>S>>T;
    string res = "";
    REP(i, N) res = res + S[i] + T[i];
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(void){
    int num_que;
    int A,B;
    int *point;
    //int box1[100],box2[100],box3[100];

    scanf("%d",&num_que);
    scanf("%d %d",&A,&B);
    point=(int *)malloc(sizeof(int)*num_que);
    int i;
    int a=0,b=0,c=0;
    for(i=0;i<num_que;i++){
        scanf("%d",&point[i]);
        if(point[i]<=A){
            a++;
        }
        else if(point[i]>A&&point[i]<=B){
            b++;
        }
        else if(B<point[i]){
            c++;
        }
    }
    if(a<=b&&a<=c){
        printf("%d",a);
    }
    else if(b<=a&&c<=b){
        printf("%d",c);
    }
    else if(c<=a&&b<=c){
        printf("%d",b);
    }

    return 0;
}



Measured memory_bytes: 128
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>

#define For(i, j, k) for(int i = j; i <= k; i++)
#define Forr(i, j, k) for(int i = j; i >= k; i--)
#define pb push_back

using namespace std;

const int N = 100010;

vector<int> G[N];
int n, mask[N];

void DFS(int o, int f){
	int label = 0, s = 0;
	for(int v : G[o]){
		if(v == f) continue;
		DFS(v, o);
		label |= s & mask[v];
		s |= mask[v];
	}
	label = label << 1 | 1;
	Forr(i, 30, 0) if(label & (1 << i))
		For(j, i, 30) if(!(s & (1 << j))){
			mask[o] = (s ^ (s & ((1 << j) - 1))) | (1 << j);
			return;
		}
}

int main(){
	scanf("%d", &n);
	For(i, 2, n){
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].pb(v), G[v].pb(u);
	}
	DFS(1, 0);
	Forr(i, 30, 0) if(mask[1] & (1 << i)){
		printf("%d\n", i);
		return 0;
	}
}

Measured memory_bytes: 11776
from collections import defaultdict
s = input() + 'T'
x, y = map(int, input().split())

si = 0
while s[si] == 'F':
    x -= 1
    si += 1
si += 1

d = [[], []]
dir = 1
z = 0
for i in range(si, len(s)):
    if s[i] == 'T':
        if z > 0:
            d[dir].append(z)
        dir = (dir + 1) % 2
        z = 0
    else:
        z += 1

d[0].sort()
d[1].sort()

def check(a, b):
    c1 = defaultdict(int)
    c2 = defaultdict(int)
    c1[0] += 1
    for i in range(len(a)):
        for c in c1:
            c2[c+a[i]] += 1
            c2[c-a[i]] += 1
        c1 = c2.copy()
        c2 = defaultdict(int)

    # print(c1.keys())
    if b in c1:
        return True
    else:
        return False

if check(d[0], x) and check(d[1], y):
    print("Yes")
else:
    print("No")


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

using namespace std;

typedef long long ll;
const ll MOD = 1000000007;

ll modpow(ll a, ll n) {
  ll ret = 1;
  while(n) {
    ret =ret * ((n % 2) ? a : 1) % MOD;
    a = a * a % MOD;
    n>>=1;
  }
	return ret;
}

ll comb(ll N, ll R) {
  if (N < 0 || R < 0 || N < R) return 0;
  ll n = 1, r = 1;
  R = min(R, N - R);
  for (ll i = 1; i <= R; i++) {
    n = n * N % MOD;
    r = r * i % MOD;
    N--;
  }
  return n * modpow(r, MOD - 2) % MOD;
}

int main() {
  ll N,M,K;
  cin>>N>>M>>K;
  ll ans = 0;
  for (ll d = 1; d < N; d++) ans = (ans + d * (N - d) * M * M) % MOD;
  for (ll d = 1; d < M; d++) ans = (ans + d * (M - d) * N * N) % MOD;
  ans = (ans * comb(N * M - 2, K - 2)) % MOD;
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
from fractions import gcd
from functools import reduce

N=int(input())
a=list(map(int,input().split()))

def lcm_base(x,y):
  return x*y//gcd(x,y)

def lcm(ls):
  return reduce(lcm_base,ls)

def mod(ls,num):
    ans=0
    for i in range(N):
        ans+=num%ls[i]
    return ans
print(mod(a,lcm(a)-1))




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

#define N 200123
#define mod 1000000007

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    if(fopen("input.in", "r")){
        freopen("input.in", "r", stdin);
        freopen("output.out", "w", stdout);
    }
    int n, sum = 0, ans = 0, a[N];
    cin >> n;
    for(int i = 0 ; i < n ; i++){
    	cin >> a[i];
    	ans += (sum*a[i]);
    	sum += a[i];
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  for (;;) {
    auto rd = readln.split.map!(to!int).array.sort();
    if (rd[0] == 0 && rd[1] == 0) break;
    writeln(rd.map!(to!string).join(" "));
  }
}

Measured memory_bytes: 2680
n,m  = gets.chomp.split
n = n.to_i
m = m.to_i
arr = Array.new(n).map{Array.new()}
nama = Array.new
while line = $stdin.gets
nama << line.chomp.split(" ").map(&:to_i)
arr[nama[-1][0]-1].push(nama[-1][1]-1)
arr[nama[-1][1]-1].push(nama[-1][0]-1)
end

dist = Array.new(n)
dist.fill(-1)
dist[0] = 0

que = []
que.push(0)

until que.empty? do
    arr[que[0]].each{|item|
        if dist[item] == -1
            dist[item] = dist[que[0]] + 1
            que.push(item)
        end
    }
    que.delete_at(0)
end
ans = Array.new(n)

nama.each{|item|
    if dist[item[0]-1] == dist[item[1]-1]
        next
    elsif dist[item[0]-1] > dist[item[1]-1]
        ans[item[0]-1] = item[1]
    else
        ans[item[1]-1] = item[0]
    end
}

puts "Yes",ans[1..-1]

Measured memory_bytes: 43456
#include <iostream>
using namespace std;
typedef long long ll;
int main()
{
	ll N;
	cin>>N;
	
	ll h,n,w;
	ll temp1, temp2;
	
	for(h = 1;h<=3500;h++){
		for(n = 1;n<=3500;n++){
			temp1 = N*h*n;
			temp2 = (4*h*n-N*n-N*h);
			
			if(temp2 > 0&& temp1%temp2==0){
				w = temp1/temp2;
				goto JUMP;
			}		
		}
	}
	
JUMP: cout<<h<<" "<<n<<" "<<w<<endl;
	
    return 0;
}


Measured memory_bytes: 256
n,w=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
a.sort()
b=[]
for i in range(n):
    b.append([0]*(w+1))
for i in range(1,w+1):
    if i>=a[0][0]:
        b[0][i]=a[0][1]

for i in range(1,n):
    for j in range(1,w+1):
        if j>=a[i][0]:
            b[i][j]=max(b[i-1][j],b[i-1][j-a[i][0]]+a[i][1])
        else:
            b[i][j]=b[i-1][j]
print(b[n-1][w])

Measured memory_bytes: 119916
require 'prime'

nums = []
h = {}
until (i = $<.gets.to_i).zero?
  nums << i
  h[i] = 0
end
max_num = nums.max

sum = 0
Prime.each.with_index do |prime, i|
  break if i + 1 > max_num
  sum += prime
  h[i + 1] = sum if h[i + 1]
end
nums.each {|j| puts h[j]}


Measured memory_bytes: 7852
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;
typedef vector<LL> LV;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};


LL gcd(LL a, LL b){    return b != 0 ? gcd(b, a % b) : a;} 

LL lcm(LL number1,LL number2){	return number1 * number2 / gcd(number1,number2);}

int f(){
    int n;
    cin >> n;
    if(n==0) return 0;
    string S[n];
    for (int i=0;i<n;i++){
        cin >> S[i];
    }
    int ans=0;
    string be="";
    bool ok = false;
    for(int i=0;i<n;i++){
        if(S[i]=="lu"){
            if(be=="ru"){
                ok = true;
            }
            be="lu";
        }else if(S[i]=="ld"){
            if(be=="rd"){
                ok=true;
            }
            be="ld";
        }else if(S[i]=="ru"){
            if(be=="lu"){
                ok=true;
            }
            be="ru";
        }else if(S[i]=="rd"){
            if(be=="ld"){
                ok=true;
            }
            be="rd";
        }

        if(ok==true){
            ans++;
        }
        ok=false;
        
    }
    
    cout << ans << endl;

    return 1;

}

int main(){
    while(f());

    return 0;
}


Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long int a,b,k;
  cin>>a>>b>>k;
  long long int t=b-a+1;
  long long int x=min(t,k);
  set<long long int> s;
  for(long long int i=0;i<x;i++){
    s.insert(a);
    a++;
  }
  for(long long int i=0;i<x;i++){
    s.insert(b);
    b--;
  }
  auto itr = s.begin();
   while (itr != s.end()) {
       cout << (*itr) << endl;
       itr++;
   }

}


Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    if(x-r>=0 && y-r >=0 && x+r<=w && y+r<=h)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3108
#include <stdio.h>

int selectionSort(int A[100],int N);

void show(int A[100],int N);

int selectionSort(int A[100],int N){

  int i=0,j=0,k,c=0,temp;
    for (i = 0; i < N - 1; i++) {
                    /* i 番目の要素を暫定的に最小値とし */
        k = i;                        /* 添字を保存 */
        for (j = i + 1; j < N; j++) {
            if (A[j] < A[k]) {       /* より小さい値が現れたら */
                        /* 最小値の入れ替え */
                k = j;                /* 添字を保存 */
                
            }
        }  /* このループを抜けるとk に最小値の添字が入っている */
    if(i!=k){
        c++;
        temp = A[i];                /* i 番目の要素と最小値の交換 */
        A[i] = A[k];
        A[k] = temp;
    }
        
    }
    return c;
}

void show(int A[100],int N){

 int i;

 for(i=0;i<N;i++){
     printf("%d",A[i]);
     if(i+1!=N){
         printf(" ");
     }
 }
 printf("\n");

}

int main(){

    int n,i;
    int a[100];

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

   int x;
   x = selectionSort(a,n);

    show(a,n);

    printf("%d\n",x);
   
return 0;

}


Measured memory_bytes: 2128
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 51000000;
const int MOD = 1000000007;

//エラトステネスの篩
int prime[MAX]; //i番目の素数
bool is_prime[MAX]; //素数かどうか

int sieve(int n) {
    int p = 0;
    for (int i = 0; i <= n; i++) {
        is_prime[i] = true;
    }
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i]) {
            prime[p++] = i;
            for (int j = 2 * i; j <= n; j += i) {
                is_prime[j] = false;
            }
        }
    }
    return p;
}

int main(){
  ll n;
  while(cin>>n){
    cout<<sieve(n)<<endl;
  }
}



Measured memory_bytes: 4360
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
  vector<int>vec(106);
  for (int i=0;i<n;i++){
  cin>>vec.at(i);}
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
    int alice=0;
  int bob=0;
  for(int i=0;i<105;i+=2){
    alice+=vec.at(i);
    bob+=vec.at(i+1);
  }
  cout <<alice-bob <<endl;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    private static double solve(int N, int[] a) {
        int[] state = new int[4];
        for (int i = 0; i < N; i++)
            state[a[i]] += 1;

        return solve(N, state, new double[301][301][301]);
    }

    private static double solve(int N, int[] state, double[][][] memo){
        double e = memo[state[1]][state[2]][state[3]];
        if (e > 0) return e;

        for (int s = 1; s <= 3; s++){
            if (state[s] == 0) continue;

            double p = (double)state[s]/N;
            double q = (double)state[0]/N;

            state[s] -= 1;
            state[s-1] += 1;
            e += (p/(1.0-q))*(solve(N, state, memo) + 1.0 / (1.0 - q));
            state[s-1] -= 1;
            state[s] += 1;
        }

        memo[state[1]][state[2]][state[3]] = e;
        
        return e;
    }

    public static double run(Scanner scanner) {
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i=0; i < N; i++) a[i] = scanner.nextInt();

        return solve(N, a);
    }

    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in)) {
            System.out.println(run(scanner));
        }
        //Tests.run();
    }
}

Measured memory_bytes: 304980
#include<bits/stdc++.h>
using namespace std;
string s,st,stt;
bool check (string str){
    if (str.size()%2){
        string s1="";
        string s2="";
        int i=0, j=str.size()-1;
        while (i<=(s.size()-2)/2 && j>=str.size()/2+1){
            s1+=str[i]; s2+=str[j];
            i++; j--;
        }
        if (s1==s2) return true; else return false;
    }
    else {
        string s1="";
        string s2="";
        int i=0, j=str.size()-1;
        while (i<=(s.size()-1)/2 && j>=(str.size()-1)/2+1){
            s1+=str[i]; s2+=str[j];
            i++; j--;
        }
        if (s1==s2) return true; else return false;
    }
}
int main(){
   
    cin>>s;
    st=""; stt="";
    for (int i=0; i<s.size(); i++){
        if (i<(s.size()-1)/2) st+=s[i];
        if (i>=(s.size()+3)/2-1) stt+=s[i];
    }
    //cout<<st<<" "<<stt;

    if (check(s)==true&& check(st)==true&& check(stt)==true) cout<<"Yes"; else cout<<"No";
}



Measured memory_bytes: 256
Q = 998244353
#import sys
#input = sys.stdin.readline
def main():
    A, B, C, D = map( int, input().split())
    dp = [[0]*3002 for _ in range(3001)]
    dp[C][D] = 1
    for a in range(C-1,A-1,-1):
        dp[a][D] = dp[a+1][D]*D%Q
    for b in range(D-1,B-1,-1):
        dp[C][b] = dp[C][b+1]*C%Q
    for a in range(C-1,A-1,-1):
        z = dp[a+1][D]*a%Q
        for b in range(D-1,B-1,-1):
            dp[a][b] = (b*dp[a+1][b] + z)%Q
            z = (z + dp[a+1][b])*a%Q
    # for i in range(C+1):
    #     print(dp[i][:D+1])
    print(dp[A][B])
if __name__ == '__main__':
    main()


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

#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define all(x) x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
#define MOD 1000000007
#define INF LONG_LONG_MAX
#define NINF LONG_LONG_MIN
#define endl "\n"
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

ll func(ll n,vector<ll> &dp)
{
    if(n==3 || n==4 || n==5 || n==0)
        return 1;
    if(n<3)
        return 0;
    if(dp[n]!=-1)
        return dp[n];
    ll ans = 0;
    for(int i=3;i<=n;i++)
    {
        ll chk = func(n-i,dp);
        if(chk!=0)
        {
            ans += chk;
            ans %= MOD;
        }
    }
    return dp[n] = ans;
}

int main()
{
    IOS;
    ll t,k,n,d,m,u,v;
    t=1;
    //cin >> t;
    while(t--)
    {
        cin >> n;
        vector<ll> dp(2005,-1);
        ll ans = func(n,dp);
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3660
A,B = map(int,input().split())
H,W = 100,100

grid = [['#'] * W for _ in range(50)] + [['.'] * W for _ in range(50)]

A -= 1
for h in range(1,50,2):
	for w in range(1, W, 2):
		if A > 0:
			grid[h][w] = '.'
			A -= 1
		else:
			break
B -= 1
for h in range(51, 100, 2):
	for w in range(1, W, 2):
		if B > 0:
			grid[h][w] = '#'
			B -= 1
		else:
			break

print(H,W)
for h in range(H):
	print("".join(grid[h][:]))

Measured memory_bytes: 3188
import javax.swing.*;
import javax.swing.plaf.synth.SynthSpinnerUI;
import java.util.Scanner;
import java.util.function.DoubleToIntFunction;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);

        int W = scan.nextInt();
        int H = scan.nextInt();
        int x = scan.nextInt();
        int y = scan.nextInt();
        int r = scan.nextInt();

        if((x+r) <= W && (y+r) <= H && (x-r) >= 0 && (y-r) >= 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }

}


Measured memory_bytes: 26312
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>

using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	int c = a+b;
	if( c>=10 ) {
		cout << "error";
	}else {
		cout << c;
	}
//    int n;
//    int a, b;
//    vector<int> num;
//    int m;
//    cin >> n >> a >> b;;
//    for( int i=0; i<n; i++ ) {
//    	cin >> m;
//    	num.push_back(m);
//	}
//	int cnt = 0;
//	sort(num.begin(), num.end(), [](int a, int b){
//			return a>b;
//		});
//	do{
//		num[0] -= a;
//		int len = num.size();
//		for( int i=1; i<len; i++ ) {
//			num[i] -= b;
//		}
////		for( int i=0; i<n; i++ ) {
////			cout << num[i];
////		}
//		cnt++;
//		sort(num.begin(), num.end(), [](int a, int b){
//			return a>b;
//		});
//		cout << '1' << endl;
//	}while( num[0]>0 );
//	cout << endl << cnt;
    return 0;
}

Measured memory_bytes: 256
# B Coins

A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0
for a in range(A+1):
  for b in range(B+1):
    for c in range(C+1):
      if 500*a+100*b+50*c == X:
        ans += 1
        
print(ans)

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/22  Problem: ABC 054 B / Link: http://abc054.contest.atcoder.jp/tasks/abc054_b  ----- */


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

	LL H, W; cin >> H >> W;
	vector<string> a(H);
	for (int i = 0; i < H; ++i) {
		cin >> a[i];
	}
	vector<string> s(W);
	for (int i = 0; i < W; ++i) {
		cin >> s[i];
	}
	auto f = [&](int y,int x) {
		bool ok = 1;
		FOR(i, 0, W) {
			FOR(j, 0, W) {
				ok&=a[i + y][j + x] == s[i][j];
			}
		}
		return ok;
	};
	LL ans = 0LL;
	FOR(i, 0, H - W + 1) {
		FOR(j, 0, H - W + 1) {
			ans |= f(i, j);
		}
	}

	
	auto print_yesno = [](LL yes, int mode = 0) {
		if (mode == 0) {
			cout << (yes ? "yes" : "no") << endl;
		}
		else if (mode == 1) {
			cout << (yes ? "Yes" : "No") << endl;
		}
		else if (mode == 2) {
			cout << (yes ? "YES" : "NO") << endl;
		}
		else assert(0);
	};
	print_yesno(ans, 1);

	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

using namespace std;

int gcd(int a, int b) {
  return b ? gcd(b, a % b) : a;
}

int main() {
  int a, b;
  while (scanf("%d%d", &a, &b) == 2) {
    if (a < b) swap(a, b);
    printf("%d\n", gcd(a, b));
  }
  return 0;
}

Measured memory_bytes: 0
/*
 * @Author: goatzyq
 * @Date: 2020-09-19 20:09:22
 * @LastEditors: goatzyq
 * @LastEditTime: 2020-09-19 20:15:49
 * @Description: abc 179 C
 */
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using db = double;
using vi = vector<int>;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define debug(x) cout << #x <<"	"<< x <<endl
const int inf = 0x3f3f3f3f;
const db eps = 1e-8;
const int mod = 1e9+7;
ll qpow(ll a, ll b){
    ll ret = 1;
    while(b){
        if(b&1)ret = ret*a%mod;
        a = a*a%mod;
        b>>=1;
    }
    return ret;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    ll ans = 0;
    cin >> n;
    for(int i=1; i<=n; ++i){
        int d = (n-1)/i;
        ans += max(0, d);
    }
    cout << ans <<"\n";
    return 0;
}

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

int main(int argc, char *argv[]) {
	std::string input;
	std::cin >> input;

	bool is_ok(true);
	if (input[0] != 'A') {
		is_ok = false;
	}

	std::string substr(input.substr(2, input.size() - 3));
	int upper_c = 0;
	for (int i = 0; i < substr.size(); i++) {
		if (substr[i] == 'C') {
			upper_c++;
		}
		if (substr[i] != 'C' && std::isupper(substr[i])) {
			is_ok = false;
		}
	}
	if (upper_c != 1) {
		is_ok = false;
	}

	if (!std::islower(input[1])) {
		is_ok = false;
	}
	if (!std::islower(input[input.size() - 1])) {
		is_ok = false;
	}

	std::cout << ((is_ok) ? "AC" : "WA") << std::endl;
	return 0;
}


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

int main() {
    int m = 1e9 + 7;
    int n, k, c;
    cin>>n>>k;

    vector<int> dp(k+1, 1);
    while(n--) {
        cin>>c;
        for(int i=k; i>=0; i--)
            dp[i] = (dp[i] + m - (i-c > 0 ? dp[i-c-1] : 0)) % m;
        for(int i=1; i<=k; i++) dp[i] = (dp[i] + dp[i-1]) % m;
    }
    if(k == 0) cout << dp[k] << endl;
    else cout << (dp[k] + m - dp[k-1]) % m << endl;

    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

//繰り返し二乗法
ll EX(ll x,ll n){
    if(n == 0)return 1;
    else if(n%2 == 1)return EX(x,n-1)*x;
    else return EX(x*x,n/2);
};

ll solve(ll n,ll num){
    ll res = 0;
    ll now = 1;
    n /= 2;
    while(n/(EX(num,now)) > 0){
        res += n/(EX(num,now));
        now++;
    }
    return res;
}

int main(){
    ll n;
    cin >> n;
    if(n%2 == 1){
        cout << 0 << endl;
        return 0;
    }    
    //cout << solve(n,2) << " " << solve(n,5) << endl;
    cout << solve(n,5) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,kin=4280;
	scanf("%d",&a);
	while(a>=0){
	kin=kin-1150;
	a-=10;
	if(a>0&&a<=10){
		kin-=125*a;
		a-=10;
	}
	else if(a>10){
		kin-=1250;
		a-=10;
	}
	if(a>0&&a<=10){
		kin-=140*a;
		a-=10;
	}
	else if(a>10){
		kin-=1400;
		a-=10;
	}
	if(a>=0){
		kin-=160*a;
	}
	printf("%d\n",kin);
	kin=4280;
	scanf("%d",&a);
	}
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;

int a, b;

int main(void) {

	cin >> a >> b;
	cout << max(a + b, max(a - b, a * b));

	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder sb = new StringBuilder();
        while (true) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            int count = 0;
            for (int i = 0; i < n / 4; i++) {
                count += sc.nextInt();
            }
            sb.append(count).append("\n");
        }
        System.out.print(sb);
    }
}


Measured memory_bytes: 26268
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <map>
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;

map<long,int> m;

int main() {
    int n;
    cin >> n;
    vector<long> as;
    long a;
    REP(i,n) {
        cin >> a;
        if (m[a] == 1) {
            as.push_back(a);
        }
        m[a]++;
    }
    
    
    sort(as.begin(), as.end());
    if (as.size() < 1) {
        cout << 0 << endl;
        return 0;
    }
    if (as.size() == 1) {
        if (m[as[0]] >= 4) {
            cout << as[0] * as[0] << endl;
            return 0;
        }
    }
    if (m[as.back()] >= 4) {
        cout << as.back() * as.back() << endl;
        return 0;
    }
    cout << as.back() * as[as.size() - 2] << endl;
}


Measured memory_bytes: 6528
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
  string s;
  cin >> s;
  cout << "2018/01/";
  cout << s[8] << s[9] << endl;
}


Measured memory_bytes: 256
n = str(input())
d = 0
if len(n)%2 == 0:
    for i in range(int(len(n)/2)):
        d += 9*(10**(i*2))
else:
    l = len(n)
    for j in range(l//2):
        d += 9*(10**(j*2))
    d += int(n)-10**(len(n)-1)+1
print(d)


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

int main() {
  int N;
  string Y,x;
  cin >> N;
  bool a =false;
  
	for(int i=0;i<N;i++){
      cin>>x;
      if(x=="Y")
      a =true;
    }
  if(a){
    cout<<"Four";
  }
      else{
        cout<<"Three";
  }
  
  
  
  
}


Measured memory_bytes: 3624
#include<iostream>
#include<cmath>
using namespace std;
int main(void){
  __int64_t num,p;
  __int64_t ans = 0;
  cin >> num;
  for(int i = 1;i <= num;i ++){
    p = floor(num/i);
    p = i*p*(p+1)/2;
    ans = ans+p;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define N 100001
using namespace std;

int main(){
  int n,C,K;
  cin>>n>>C>>K;
  int T[N];
  for(int i=0;i<n;i++)cin>>T[i];
  sort(T,T+n);

  if(C==1){cout<<n<<endl;return 0;}

  int ans=0;
  int cnt=1;
  int l = 0;
  for(int i=1;i<n;i++){
    cnt++;
    if(T[l]+K<T[i])ans++,cnt=1,l=i;
    if(cnt == C) ans++,cnt=0,l=i+1;
  }
  if(cnt)ans++;
  cout<<ans<<endl;


  return 0;
}


Measured memory_bytes: 640
use proconio::{fastout, input};

#[fastout]
fn main() {
    input!(n: usize);

    println!(
        "{}",
        (1..10)
            .map(|x| x * 100 + x * 10 + x)
            .filter(|&x| x >= n)
            .min()
            .unwrap()
    );
}


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

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

  int D, N;
  cin >> D >> N;

  int result;

  switch (D) {
    case 0:
      result = N;
      if (N == 100) {
        result += 1;
      }
      break;

    case 1:
      result = 100 * N;
      if (N == 100) {
        result += 100;
      }
      break;

    case 2:
      result = 10000 * N;
      if (N == 100) {
        result += 10000;
      }
      break;
  }

  cout << result << "\n";

  return 0;
}

Measured memory_bytes: 256
a,b= map(int,input().split(" "))
ar = list(map(int,input().split(" ")))
if sum(ar) == b:
    print(a)
elif sum(ar) < b:
    print(a-1)
else:
    br = []
    for r in ar:
        if r <= b:
            br.append(r)
    if len(br) == 0:
        print(0)
    else:
        br = sorted(br,reverse=True)
        while True:
            if sum(br) > b:
                del br[0]
            else:
                print(len(br))
                break
            

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

typedef long double ll;
#define    mod      1000000007
#define    speed    ios_base::sync_with_stdio(false);
#define    up       cin.tie(NULL);
#define    pb       push_back
#define    mp       make_pair
#define    T        int t; cin >> t; while(t--)

ll dp[3005][3005] , arr[3005];
int  n, k;

int main(){
   for(int i = 0; i <= 3000; i++){
       for(int j = 0; j <= 3000; j++){
           dp[i][j] = 1.0;
       }
   }
   cin >> n;
   for(int i = 1; i <= n; i++){
       cin >> arr[i];
       dp[0][i] = dp[0][i-1]*arr[i];
   }
   k = n/2;
   if(n%2==0){
       k--;
   }
   for(int i = 1; i <= k; i++){
       for(int j = 1; j <= n; j++){
              dp[i][j] = arr[j]*dp[i][j-1] + (1.0-arr[j])*dp[i-1][j-1];
       }
   }
    cout << setprecision(12) << dp[k][n] << '\n';

}

Measured memory_bytes: 141184
parseInt(s)=parse(Int,s)
n,k=parseInt.(split(readline()))
MOD=10^9+7

fac=Array{Int}(2n)
ifac=Array{Int}(2n)
fac[1]=ifac[1]=1

function makefact(n,M=MOD)
    for i in 2:n
        fac[i]=(fac[i-1]*i)%M
        ifac[i]=invmod(fac[i],M)
    end
end

function CMOD(n,k,M=MOD)
    (k==0 || n==k ) && return 1
    return ((fac[n]*ifac[k])%M*ifac[n-k])%M
end
makefact(2n)

s=0
k=min(n-1,k)
for i in 0:k
    s += (CMOD(n,i)*CMOD(n-1,i))%MOD 
    s %= MOD
end
print(s)

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

int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    while (a > 0 || c > 0)
    {
        c -= b;
        if (c <= 0)
        {
            cout << "Yes";
            break;
        }
        
        a -= d;
        if (a <= 0)
        {
            cout << "No";
            break;
        }
    }
    
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
using namespace std;
#define crap ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long int ll;
typedef unsigned long long ull;
typedef std::vector<int> vi;
typedef std::vector<ll> vll;
typedef std::vector<vi > vvi;
typedef std::vector<vll > vvll;
typedef std::pair<int,int> ii;
typedef std::pair< ll, ll > lp;
typedef std::vector<ii> vii;
typedef std::vector<vii > vvii;

#define pb push_back 
#define PB pop_back
#define pf push_front
#define PF pop_front
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define in(a,n) F(i,0,n-1)cin>>a[i]
#define in1(a,n) F(i,1,n)cin>>a[i]
#define out(a,n) F(i,0,n-1)cout<<a[i]<<" ";cout<<"\n"
#define ff first
#define ss second
#define F(i,a,b) for (ll i=a;i<=b;i++)
#define RF(i,a,b) for(ll i=a;i>=b;i--)
#define rep(i,n) F(i,0,n-1)
#define clr(a) (a).clear()
#define rz resize
#define sqr(a) ((a) * (a))
#define sz(a) int((a).size())
#define all(a) (a).begin(), (a).end()

int  main(int argc, char const *argv[])
{
	crap;
	string s;
	cin>>s;
	if (s.length()==2)
		cout<<s;
	else
	{
		reverse(all(s));
		cout<<s;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.BitSet;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int W = in.nextInt();
		BitSet wbit = new BitSet(W);
		int h = in.nextInt();
		BitSet hbit = new BitSet(h);
		for (int i = 0; i < n; i++) {
			int x = in.nextInt();
			int y = in.nextInt();
			int w = in.nextInt();
			wbit.set(Math.max(0, x - w), Math.min(W, x + w));
			hbit.set(Math.max(0, y - w), Math.min(h, y + w));
			// System.out.println(wbit);
			// System.out.println(hbit);
			if (wbit.cardinality() == W || hbit.cardinality() == h) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}

}

Measured memory_bytes: 97792
# B - Guidebook

n = int(input())
r = []

for i in range(1, n+1):
    city, point = map(str, input().split())
    r.append(list((i, city, int(point))))

r.sort(key=lambda x:x[2], reverse=True)
r.sort(key=lambda x:x[1])

for i in range(n):
    print(r[i][0])


Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
#include<random>
#include<ctime>
#include<set>
using namespace std;


const long long int mod=1000000007;
const long long int INF=99999999999999999;


long long int A[20],B[20],two[25]={1},res=INF;
pair<long long int,long long int>XL[100005];
int main() {
	cout << fixed << setprecision(18);
	long long int N,K,S;
	for(int i=1;i<20;i++){
		two[i]=two[i-1]*2;
	}
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	for(int i=0;i<N;i++){
		cin>>B[i];
	}
	for(long long int i=0;i<two[N];i++){
		//偶数にするナンバー
		long long int Counter=0;
		for(int j=0;j<N;j++){
			if((i&two[j])==0){
				Counter++;
			}
		}
		//偶奇の個数が合わなければ終了
		if(Counter!=(N+1)/2){continue;}
		vector<pair<long long int,long long int> >Odd,Even,SortedEven,SortedOdd;
		long long int Check[20]={};
		for(int j=0;j<N;j++){
			if((i&two[j])==0){
				if(j%2==0){Even.push_back({A[j],j});}
				else{Even.push_back({B[j],j});}
			}else{
				if(j%2==1){Odd.push_back({A[j],j});}
				else{Odd.push_back({B[j],j});}
			}
		}
		SortedOdd=Odd;
		SortedEven=Even;
		sort(SortedOdd.begin(),SortedOdd.end());
		sort(SortedEven.begin(),SortedEven.end());
		long long int now=0;
		bool Breaker=false;
		for(int j=0;j<SortedEven.size();j++){
			if(now<=SortedEven[j].first){
				now=SortedEven[j].first;
				Check[SortedEven[j].second]=2*SortedEven[j].first+2*j;
			}
			else{Breaker=true;break;}
			if(N%2==1&&j==SortedEven.size()-1){break;}

			if(now<=SortedOdd[j].first){
				now=SortedOdd[j].first;
				Check[SortedOdd[j].second]=2*SortedOdd[j].first+2*j+1;
			}
			else{Breaker=true;break;}
		}
		if(Breaker){continue;}
		long long int rev=0;
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				if(Check[i]>Check[j]){rev++;}
			}
		}
		res=min(res,rev);
	}
	if(res==INF){res=-1;}
	cout<<res;
} 

Measured memory_bytes: 256