akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long LL;
int read()
{
	char c=getchar();int f=1,sum=0;
	while(c<'0' || c>'9'){if(c=='-')f=-1;c=getchar();}
	while(c>='0' && c<='9'){sum=sum*10+c-'0';c=getchar();}
	return sum*f;
}
int n;
int a[200005],b[200005];
LL dp[4005][4005],ans;
LL fac[8005],inv[8005];
LL ksm(LL a,LL b)
{
	LL ret=1;
	while(b)
	{
		if(b&1) ret=ret*a%mod;
		b>>=1;a=a*a%mod;
	}
	return ret;
}
void init()
{
	fac[0]=1;
	for(int i=1;i<=8002;i++)
	fac[i]=fac[i-1]*i%mod;
	inv[8002]=ksm(fac[8002],mod-2);
    for(int i=8001;i>=0;i--)
    inv[i]=inv[i+1]*(i+1)%mod;
}
LL C(LL n,LL m)
{
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
	n=read();
	init();
	for(int i=1;i<=n;i++)
	{
		a[i]=read(),b[i]=read();
		dp[-a[i]+2001][-b[i]+2001]++;
	}
	for(int i=1;i<4002;i++)
	for(int j=1;j<4002;j++)
	dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
	for(int i=1;i<=n;i++) ans=(ans+dp[a[i]+2001][b[i]+2001])%mod;
    for(int i=1;i<=n;i++) ans=(ans-C((LL)(a[i]+b[i])*2,(LL)b[i]*2)%mod+mod)%mod;
    printf("%lld\n",ans*500000004LL%mod);
	return 0;
}


Measured memory_bytes: 127232
#include <cstdio>
using namespace std;

int main()
{
  long long n, m, k;
  long long sum = 0;
  scanf("%lld", &n);
  for (k = 1; k*k <= n; k++) {
    if (n % k == 0)
      if (n/k >= k+2)
        sum += n/k-1;
  }
  printf("%lld\n", sum);
}


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

int main(){
  int N;
  cin>>N;
  vector<int64_t> vec(N);
  for(int i=0;i<N;i++){
    cin>>vec[i];
  }
  
  int zero=0;
  for(int i=0;i<N;i++){
    if(vec[i]==0)
      zero++;
    if(zero>0){
      cout<<0<<endl;
      return 0;
    }
  }
  
  int64_t s=1;
  for(int i=0;i<N;i++){
    if(vec[i]>1000000000000000000/s){
      s=-1;
      break;
    }
    s*=vec[i];
  }
  cout<<s<<endl;
}

Measured memory_bytes: 4048
#include <iostream>
#include <cstdio>
#include <list>
#include <algorithm>
using namespace std;
 
int main() {
  int n, x;
  char a[20];
 
  list<int> v;
  cin>>n;
  for (int i=0;i<n;i++){
    scanf("%s", a);
    if(a[0]=='i'){
      cin>>x;
      v.push_front(x);
    }else if(a[6]=='L'){
      v.pop_back();
    }else if(a[6]=='F'){
      v.pop_front();
    }else if(a[0]=='d'){
      cin>>x;
      for(list<int>::iterator it=v.begin();it!=v.end();it++) {
	if(*it==x){
	  v.erase(it);
	  break;
	}
      }
    }
  }
  int i=0;
  for(list<int>::iterator it=v.begin();it!=v.end();it++){
    if(i++) cout<<' ';
    cout<<*it;
  }
  cout<<'\n';
 
  return 0;
 
}



Measured memory_bytes: 34372
#include <iostream>
using namespace std;
int main(){
        int N;
        int heap[250];
        cin >> N;
        for(int i=1 ; i<=N ; i++ )
                cin >> heap[i];
        for(int i=1 ; i<=N ; i++ ){
                int left=i*2;
                int right=i*2+1;
                int parent=i/2;
                cout<<"node "<<i<<": key = "<<heap[i];
                if(i!=1)
                        cout<<", parent key = "<<heap[parent];
                if(left<=N)
                        cout<<", left key = "<<heap[left];
                if(right<=N)
                        cout<<", right key = "<<heap[right];
                cout<<", "<<endl;
        }
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;

const int mod=1e9+7;
vector<int> prime;
bool check[1000];
int cnt[200];
int main(){
	for(int i=2;i<1000;i++){
		if(check[i]==false){
			prime.push_back(i);
			for(int j=i*2;j<1000;j+=i)	check[j]=true;
		}
	}
	//1000以下のprimeの個数は168
	ll n;	cin>>n;
	ll ret=1;
	for(int i=0;i<prime.size();i++){
		ll div=prime[i];
		ll cnt=0;
		while(div<=n){
			cnt+=n/div;
			div*=prime[i];
		}
		ret*=cnt+1;
		ret%=mod;
	}
	cout<<ret<<endl;
	return 0;
}


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

int N, C, K; //passengers, bus capacity, time capacity;
int* T;
int main()
{
    cin >> N >> C >> K;
    T = new int[N+1];
    for(int i = 1; i <= N; i++) cin >> T[i];
    sort(T+1, T+N+1);

    int c = C, t = K, b = 0;

    for(int i = 1; i <= N; i++)
    {
        if(c < C && t + T[i] - T[i-1] <= K)
        {
            c++;
            t += T[i] - T[i-1];
            continue;
        }
        b++;
        c = 1;
        t = 0;
    }
    cout << b << '\n';
    return 0;
}

Measured memory_bytes: 640
while l = gets
  w, k = l.split.map(&:to_i)
  break if w == 0 && k == 0
  cats = Hash.new
  wall = Array.new
  wall << [0, w]
  k.times do
    l = gets.split
    s = l.shift
    if s == "s"
       id, wide = l.map(&:to_i)
      (0..wall.size-1).each do |i|
        left = wall[i][0]
        len = wall[i][1]
        if len >= wide
          cats[id] = [left,wide]
          if len > wide
            wall[i] = [left+wide,len-wide] 
          else
            wall.delete_at(i)
          end
          break
        end
      end
      if cats[id] == nil
        puts "impossible"
      else
        puts cats[id][0]
      end
    else
      id = l[0].to_i
      wall.push(cats[id])
      wall.sort!
      cnt = 0
      (wall.size-1).times do |i|
        left = wall[i-cnt][0]
        len = wall[i-cnt][1]
        n_left = wall[i+1-cnt][0]
        n_len = wall[i+1-cnt][1]
        if left+len == n_left
          wall[i-cnt,2] = [[left,len+n_len]]
          cnt += 1
        end
      end
    end
  end
  puts "END"
end

Measured memory_bytes: 8740
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
#include<cstdlib>
#include <queue>
#include <cmath>
#include <iomanip>
#include<list>
#include <utility>
#include <functional>
#include <tuple>
#define T long long


int main(){
	std::string s;
	std::getline(std::cin,s);
	if(s=="ABC"){
		std::cout << "ARC"<<std::endl;
	}else{
		std::cout << "ABC"<<std::endl;
	}
	
}


Measured memory_bytes: 3628
import numpy as np

NM = list(map(int, input().split()))
X = list(map(int, input().split()))
N = NM[0]
M = NM[1]
#print(X)

if N >= M :
    ans = 0
    print(ans)
    
else:
    Xs = sorted(X)

    #print(Xs)
    length = []
    for i in range(len(Xs)-1):
        length.append(abs(Xs[i+1]-Xs[i]))

    length_n = sorted(length)
    #print(length_n)
    del length_n[M-N:]
    #print(length_n)

    idousum = sum(length_n)

    ans = idousum
    print(ans)
    

Measured memory_bytes: 22992
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
using namespace std;
typedef long long ll;

int main(){
  ll n,h,w;
  cin >> n >> h >> w;
  ll ans = 0;
  REP(i,n){
    ll a,b;
    cin >> a >> b;
    if(a>=h&&b>=w) ans++;
  }
  cout << ans<< endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = b[a[0]-1]
for i in range(1,n):
  ans += b[a[i]-1]
  if a[i]==a[i-1]+1:
    ans += c[a[i-1]-1]
print(ans)

Measured memory_bytes: 9184
#犬同士　または　猿同士
#交互のみ
mod = 10**9+7
"""
def chs(k,i,mod):
    deno = 1
    for j in range(k,k-i,-1):
        deno*=j
        deno%=mod
    nume = 1
    for j in range(1,j+1):
        nume*=pow(j,mod-2,mod)
        nume%=mod
    return deno*nume%mod
"""

n,m = map(int, input().split( ))
if abs(n-m)>1:
    print(0)
    exit()
ans = 1
for i in range(1,n+1):
    ans%=mod
    ans*=i
for i in range(1,m+1):
    ans*=i
    ans%=mod
if n==m:
    ans*=2
    ans%=mod
print(ans)
    
        



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

#define ll long long
#define rep(i, n) for(int i=0; i<n; ++i)

inline ll count_c(int x) {
  return 1ll*x*(x-1)/2;
}

int main() {
  cin.tie(0), ios::sync_with_stdio(false);
  int n;
  ll total = 0;
  cin >> n;
  vector<int> ball(n);
  vector<ll> c(n+1, 0), ans(n+1, 0);
  rep(i, n) {
    cin >> ball[i];
    ++c[ball[i]];
  }
  rep(i, n+1) {
    ans[i] = count_c(c[i]);
    total += ans[i];
  }
  rep(i, n) cout << (total - ans[ball[i]] + count_c(c[ball[i]]-1)) << endl;
}

Measured memory_bytes: 6528
#include <iostream>


using namespace std;

int main()
{
    int A , B;
    cin>>A>>B;
    if(1<=A&&A<=13&&1<=B&&B<=13)
    {
        if(A==B)
      cout<<"Draw\n";
    else if(A>B)
    {
        if(B==1)
        {
            cout<<"Bob\n";
        }
        else
            cout<<"Alice\n";
    }
  else if(A<B)
    {
        if(A==1)
            cout<<"Alice";
        else
            cout<<"Bob\n";
    }
    }
    return 0;
}


Measured memory_bytes: 888
n, k = map(int, input().split())
s = 0
if k % 2 == 0:
    x = [i for i in range(1, n+1) if i % k == k//2]
    s += len(x)**3
y = [i for i in range(1, n+1) if i % k == 0]
s += len(y)**3
print(s)

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

int main() {
  int num[3];
  for (int i = 0; i < 3; i++) {
    cin >> num[i];
  }
  sort(num, num + 3);

  cout << num[2] * 10 + num[1] + num[0] << endl;
}

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

vector<string> dfs(int x, int y) {
    if (x==0 && y==0) {
        return {""};
    }
    
    vector<string> res;
    
    if (x==5 && y==5) {
        vector<string> vl = dfs(x-1, y);
        vector<string> vr = dfs(x, y-1);
        
        for (int i=0; i<vl.size(); i++) {
            res.push_back(vl[i]+"A");
        }
        
        for (int i=0; i<vr.size(); i++) {
            res.push_back(vr[i]+"B");
        }
    }
    else if (x==6 || x==5 || y==0) {
        vector<string> vl = dfs(x-1, y);

        for (int i=0; i<vl.size(); i++) {
            res.push_back(vl[i]+"A");
        }
    }
    else if (y==6 || y==5 || x==0) {
        vector<string> vr = dfs(x, y-1);
        
        for (int i=0; i<vr.size(); i++) {
            res.push_back(vr[i]+"B");
        }
    }
    else {
        vector<string> vl = dfs(x-1, y);
        vector<string> vr = dfs(x, y-1);
        
        for (int i=0; i<vl.size(); i++) {
            res.push_back(vl[i]+"A");
        }
        
        for (int i=0; i<vr.size(); i++) {
            res.push_back(vr[i]+"B");
        }
    }
    
    return res;
}

int main() {
    int j, y; cin >> j >> y;
    vector<string> res = dfs(j, y);
    sort(res.begin(), res.end());
    
    for (int i=0; i<res.size(); i++) {
        cout << res[i] << endl;
    }
}


Measured memory_bytes: 3232
using System;
using System.Collections.Generic;
//using System.Linq;
class Program
{
	static void Main(string[] args)
	{
		// 入力フェーズ
        string[] input = Console.ReadLine().Split(' ');
				int N = int.Parse(input[0]);
        int T = int.Parse(input[1]);
				int min = 1001;
        for(int i=0; i<N; i++)
        {
					 	input = Console.ReadLine().Split(' ');
	 					int cost = int.Parse(input[0]);
	         int time = int.Parse(input[1]);

					 if(time <= T)
					 {
						 if(cost < min)
						 	 min = cost;
					 }
        }
				if(min == 1001)
					Console.WriteLine("TLE");
        else
					Console.WriteLine(min);
    }
}


Measured memory_bytes: 11092
x1,y1,x2,y2 = map(int, input().split())
dx = x2 -x1
dy = y2 -y1
x3 = x2 -dy
y3 = y2 +dx
x4 = x1 -dy
y4 = y1 +dx
print(x3, y3, x4, y4)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
 
#define rep(i,n) for(int i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;

 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
 
    ll a,b,k;
    cin >> a >> b >> k;
    if(a > k){
        a -= k;
    }else if(a + b < k){
        a = 0;
        b = 0;
    }else{        
        k -= a;
        a = 0;
        b -= k;
    }
    cout << a << " " << b << endl;
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <functional>
#include<math.h>
using namespace std;
vector<long long> code(26, 0);

vector<long long> a(0, 0);
vector<long long> b(0, 0);
vector<long long> n(200001, 0);


int main() {

	int x,a, b;
	cin >>x>> a >> b;
	if (abs(x - a) > abs(x - b)) {
		cout << "B" << endl;
	}
	else {
		cout << "A" << endl;
	}


	return 0;
}


Measured memory_bytes: 1792
/**
 *   created: 28 April 2019  23:46:46
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
// #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
int main()
{
	optimizeIO();
	int tt=1;
	// cin>>tt;
	while(tt--){
		int n;
		cin>>n;
		if(n%100<=12 && n%100>0 && n/100<=12 && n/100>0)
			cout<<"AMBIGUOUS";
		else if(n%100<=12 && n%100>0)
			cout<<"YYMM";
		else if(n/100<=12 && n/100>0)
			cout<<"MMYY";
		else
			cout<<"NA";
	}
	return 0;
}





Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
// ===================== MANASH =================== //

int n,m;
int rec( int x ) {
	if ( x == 0 ) return 0;
	else if ( x == 1 ) return 1;
	else return 1 + 2*rec(x/2);
}
void test() {
	cin >> n;
	cout << rec(n);
}

signed main() {

	#ifdef LOCAL
	freopen("input.txt","r",stdin);
	#endif

	test();
	cout << '\n';
	return 0;

}

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

public class Program
{
    private int N, K;
    private string S;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        K = sc.NextInt();
        S = sc.Next();
        int cnt = 0;
        int sakaime = 0;
        for (int i = 0; i < N; i++)
        {
            if (S[i] == 'L')
            {
                if (i + 1 < N && S[i + 1] == 'L')
                {
                    cnt++;
                }
            }
            else if (S[i] == 'R')
            {
                if (i - 1 >= 0 && S[i - 1] == 'R')
                {
                    cnt++;
                }
            }

            if (i + 1 < N && S[i] != S[i + 1])
            {
                sakaime++;
            }
        }

        Console.WriteLine(Math.Min(N - 1, cnt + Math.Min(sakaime, K * 2)));
    }

    public static void Main(string[] args)
    {
        new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _pos = 0;
        _line = new string[0];
    }

    const char Separator = ' ';
    private int _pos;
    private string[] _line;

    #region スペース区切りで取得

    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = Console.ReadLine().Split(Separator);
            _pos = 0;
        }

        return _line[_pos++];
    }

    public int NextInt()
    {
        return int.Parse(Next());
    }

    public long NextLong()
    {
        return long.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }

    #endregion

    #region 型変換

    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }

    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }

    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }

    #endregion

    #region 配列取得

    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = Console.ReadLine().Split(Separator);

        _pos = _line.Length;
        return _line;
    }

    public int[] IntArray()
    {
        return ToIntArray(Array());
    }

    public long[] LongArray()
    {
        return ToLongArray(Array());
    }

    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }

    #endregion
}

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

template<class T> inline bool chmin(T& a, T b)
{
	if (a > b)
	{
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b)
{
	if (a < b)
	{
		a = b;
		return true;
	}
	return false;
}

static const int INF = 1145141919;
const long long INFL = 1LL<<60;

int main()
{
	int n, k;
	cin >> n >> k;
	long long int h[110000];
	for (int i = 0; i < n; ++i)
	{
		cin >> h[i];
	}
	long long int dp[110000];
	for (int i = 0; i < 110000; ++i)
	{
		dp[i] = INFL;
	}
	dp[0] = 0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 1; j <= k; ++j)
		{
			chmin(dp[i+j], dp[i]+abs(h[i]-h[i+j]));
		}
	}
	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1920
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Eric
 */
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);
        CMinimization solver = new CMinimization();
        solver.solve(1, in, out);
        out.close();
    }

    static class CMinimization {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();
            int[] arr = new int[N];
            int cur = 0;
            for (int i = 0; i < N; i++) {
                arr[i] = in.nextInt();
                if (arr[i] == 1)
                    cur = i;
            }
            int res = 0;
            if (cur - K + 1 < 0)
                cur += -(cur - K + 1);
            int tmp = cur;
            while (tmp > 0) {
                tmp -= K - 1;
                res++;
            }
            tmp = cur;
            while (tmp < N - 1) {
                tmp += K - 1;
                res++;
            }
            //out.println(res);
            out.println(solve(N, K));
        }

        int solve(int n, int k) {
            return ((n - 1) + (k - 2)) / (k - 1);
        }

    }
}



Measured memory_bytes: 50736
/*{{{*/
#include "bits/stdc++.h"
using namespace std;

#define MT make_tuple
#define all(x) begin(x), end(x)
#define putchar(x) cout << (x)
static int fastio = [](){ ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(17); return 0; }();
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template<typename ...T> string format(const string& fmt, T&&... args) {
    size_t sz = snprintf(nullptr, 0, fmt.c_str(), args...) + 1;
    unique_ptr<char[]> buf(new char[sz]);
    snprintf(buf.get(), sz, fmt.c_str(), args...);
    return string(buf.get(), buf.get() + sz - 1);
}

template<class T> struct rge { T b, e; auto begin() const { return b; } auto end() const { return e; } };
template<class T> rge<T> range(T i, T j) { return rge<T>{i, j}; }
template<class T> auto dud(T* x) -> decltype(cerr << *x, 0);
template<class T> char dud(...);

struct debug {
#ifdef LOCAL
    debug(int line) {
        if(line) cerr << "LINE(" << line << ") -> ";
    }
    template<class T> typename enable_if<sizeof dud<T>(0) != 1, debug&>::type operator<<(T i) {
        cerr << boolalpha << i; return * this;
    }
    template<class T> typename enable_if<sizeof dud<T>(0) == 1, debug&>::type operator<<(T i) {
        return *this << range(begin(i), end(i));
    }
    template<class T, class U> debug& operator<<(pair<T, U> d) {
        return *this << "(" << d.first << ", " << d.second << ")";
    }
    debug& operator<<(tuple<>&) { return *this << "()"; };
    template<class ...T> debug& operator<<(tuple<T...> d) {
        *this << "("; debug_tuple<sizeof...(T), 0>(d);
        return *this << ")";
    }
    template<size_t L, size_t I, class T> void debug_tuple(const T& t) {
        *this << (I == 0 ? "" : ", ") << get<I>(t);
        if(I + 1 < L) debug_tuple<L, (I + 1) % L>(t);
    }
    template<class T> debug & operator <<(rge<T> d) {
        *this << "[";
        for(auto it = d.b; it != d.e; ++it)
            *this << (it != d.b ?  ", " : "") << *it;
        return *this << "]";
    }
    debug& operator<<(ostream&(*pf)(std::ostream&)) {
        cerr << pf; return *this;
    }
#else
    debug(int) {}
    template<class T> debug& operator<<(T&&) { return *this; }
    debug& operator<<(ostream&(*)(std::ostream&)) { return *this; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ << ": " << (__VA_ARGS__) << "] "

#define debug0()  debug(__LINE__)
#define debug1(x) debug(0)
#define GET_MACRO(_0, _1, NAME, ...) NAME
#define debug(...) GET_MACRO(_0, ##__VA_ARGS__, debug1, debug0)(__VA_ARGS__)
/*}}}*/
using LL = long long;

const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const LL LLINF = 0x3f3f3f3f3f3f3f3f;
const int MAX_N = 200005;

void solve(int) {
    int N;
    cin >> N;
    vector<LL> dp(N + 1, 0);
    for(int i = 1; i <= N; ++i) {
        for(int j = i; j <= N; j += i) {
            dp[j] += 1;
        }
    }
    LL ans = 0;
    for(int i = 1; i <= N; ++i) {
        ans += i * dp[i];
    }
    cout << ans << endl;
}

int main() {
    int T = 1;
    //cin >> T;
    for(int i = 1; i <= T; ++i) {
        solve(i);
    }
    return 0;
}


Measured memory_bytes: 81380
#include <iostream>
#include <stdio.h>
#define FOR(i,a,b) for (int i=(a); i<=(b); ++i)
#define FORR(i,a,b) for (int i=(a); i>=(b); --i)
#define REP(i,b) for (int i=0; i<(b); ++i)
#define input stdin
#define output stdout
#define assign freopen
#define endl '\n'
#define sz(x) (int) x.size()
#define div /
#define mod %
#define fillchar(x,y,z) memset(x,z,y)
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define sqr(x) ((x)*(x))
typedef long long int64;
typedef unsigned long long qword;
typedef void procedure;
using namespace std;
int sum(int x)
{
    int res=0;
    while (x!=0) {
        res+=x mod 10;
        x/=10;
    }
    return res;
}
procedure Input()
{
    int n;
    cin>> n;
    int res=1e8;
    FOR(a,1,n-1)
        res=min(sum(a)+sum(n-a),res);
    cout << res;
}
procedure Solve()
{

}
int main()
{
    //assign("input.txt","r",input);
    //assign("output.txt","w",output);
    iostream::sync_with_stdio(false);
    cin.tie(0);
    Input();
    Solve();
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sync ios_base::sync_with_stdio(false), cin.tie(NULL)
#define tests(t) int t; cin >> t; while(t--)
#define ll long long
#define EPS 1e-9
#define mod 1000000007
#define MOD 1000000007
#define N 200005
using namespace std;

int main()
{
  char s[3000] ; 
char t[3000]; 
cin>>s>>t;
int m = strlen(s); 
int n = strlen(t); 
   
    int dp[m+1][n+1];
  
    for(int i=0;i<=m;i++)
    {
    	for(int j=0;j<=n;j++)
    	{
    		if(i==0 || j==0 )
    		dp[i][j]=0;
    		else if(s[i-1]==t[j-1])
    		dp[i][j]=1+dp[i-1][j-1];
    		else
    		dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	int index = dp[m][n]; 
  
   char lcs1[index+1]; 
   lcs1[index] = '\0'; 

   int i = m, j = n; 
   while (i > 0 && j > 0) 
   { 
    
      if (s[i-1] == t[j-1]) 
      { 
          lcs1[index-1] = s[i-1];  
          i--; j--; index--;  
      } 

      else if (dp[i-1][j] > dp[i][j-1]) 
         i--; 
      else
         j--; 
   } 
  
 	cout<<lcs1;
    return 0;
}



Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
#define mp make_pair
#define ll long long 
#define mod 1000000007
void setIO(string name) {
  ios_base::sync_with_stdio(0); cin.tie(0);
  freopen((name+".in").c_str(),"r",stdin);
  freopen((name+".out").c_str(),"w",stdout);
}
void fast(){
  ios_base::sync_with_stdio(false);cin.tie(NULL);
}


int main() {
   fast(); 
   int h,w,m;
   cin>>h>>w>>m;
   map<pair<int,int>,int> mt;
   int a[h]={0};
   int b[w]={0};
   for(int i=0;i<m;i++){
       int l,r;
       cin>>l>>r;
       a[l-1]++;
       b[r-1]++;
       pair p={l-1,r-1};
       mt[p]=1;
   } 
   int ans=0;
   vector<pair<int,int>> v;
   vector<pair<int,int>> c;
   for(int i=0;i<h;i++){
    v.pb({a[i],i});
   }
   for(int i=0;i<w;i++){
    c.pb({b[i],i});
   }
   sort(v.begin(),v.end());
   sort(c.begin(),c.end());
   int d=v.size()-1;
   int e=c.size()-1;
   int f=v[d].first;
   int g=c[e].first;

   vector<pair<int,int>> final;
   vector<pair<int,int>> semi;
   for(int i=d;i>=0;i--){
      if(v[i].first==f){
        final.pb(v[i]);
      }else{
        break;
      }
   }
   for(int i=e;i>=0;i--){
      if(c[i].first==g){
        semi.pb(c[i]);
      }else{
        break;
      }
   }
   for(int i=0;i<final.size();i++){
       for(int j=0;j<semi.size();j++){
           
          if(mt[{final[i].second,semi[j].second}]==1){
            ans=f+g-1;
          }else{
            ans=f+g;
            cout<<ans<<"\n";
            return 0;
          }
       }
   }
   cout<<ans<<"\n";
   return 0;

} 

Measured memory_bytes: 37292
#include <stdio.h>
// #include <string.h>


const int step[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

void remove_land(char c[][51], int x, int y, int w, int h) {
    int i, j;
    if (x < 0 || w <= x || y < 0 || h <= y) return;
    if (!c[y][x]) return;
    c[y][x] = 0;
    for (i = -1; i <= 1; i++) {
        for (j = -1; j <= 1; j++) {
            if (i == 0 && j == 0) continue;
            remove_land(c, x+j, y+i, w, h);
        }
    }
    return;
}

int main() {
    int w, h, i, j;
    char c[50][51];
    int count;

    while (scanf("%d%d\n", &w, &h) != EOF && w && h) {
        for (i = 0; i < h; i++) {
            for (j = 0; j < w; j++) {
                scanf("%d", &c[i][j]);
            }
        }

        for (count = 0, i = 0; i < h; i++) {
            for (j = 0; j < w; j++) {
                if (c[i][j]) {
                    remove_land(c, j, i, w, h);
                    count++;
                }
            }
        }
        printf("%d\n", count);
    }

    return 0;
}

Measured memory_bytes: 788
#include "bits/stdc++.h"
#include<assert.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
#define MRE assert(0);
const int inf = 1e17;
const int mod =998244353;
typedef pair<int, int> P;
int clr[605][605];
int dx[] = { 1,-1,1,-1 }, dy[] = { 1,1,-1,-1 };
vector<P>v1, v2; int n;

void dfs(int nx, int ny,vector<P>V) {
	rep(i, V.size()) {
		rep(j, 4) {
			int mx = nx + V[i].first*dx[j], my = ny + V[i].second*dy[j];
			if (0 <= mx&&mx < 2 * n && 0 <= my&&my < 2 * n&&clr[mx][my]==0) {
				clr[mx][my] = clr[nx][ny] * -1;
				dfs(mx, my,V);
			}
		}
	}
}

signed main() {
	int d1, d2; cin >> n >> d1 >> d2;
	rep(i, d1 + 1) {
		int x = d1 - i*i;
		int Q = sqrt(x);
		if (x == Q*Q)v1.push_back(P(i, Q));
	}
	rep(i, d2 + 1) {
		int x = d2 - i*i;
		int Q = sqrt(x);
		if (x == Q*Q)v2.push_back(P(i, Q));
	}
	int cb = 0;
	rep(i, 2 * n) {
		rep(j, 2 * n) {
			if (!clr[i][j]) {
				clr[i][j] = 1; dfs(i, j,v1);
			}
			if (clr[i][j] == 1)cb++;
		}
	}
	int r = 1;
	if (cb < n*n * 2) r = -1;//-1を残す
	rep(i, 2 * n) {
		rep(j, 2 * n) {
			if (clr[i][j] == r)clr[i][j] = 0;
		}
	}

	rep(i, 2 * n) {
		rep(j, 2 * n) {
			if (!clr[i][j]) {
				clr[i][j] = 2; dfs(i, j, v2);
			}
		}
	}
	vector<P>ans1, ans2;
	rep(i, 2 * n) {
		rep(j, 2 * n) {
			if (clr[i][j] == 2)ans1.push_back(P(i, j));
			if (clr[i][j] == -2)ans2.push_back(P(i, j));
		}
	}
	if (ans1.size() < ans2.size()) {
		rep(i, n*n) {
			cout << ans2[i].first << ' ' << ans2[i].second << endl;
		}
	}
	else {
		rep(i, n*n) {
			cout << ans1[i].first << ' ' << ans1[i].second << endl;
		}
	}
}

Measured memory_bytes: 84224
import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;
import std.outbuffer;
import std.numeric;

void main()
{
	int n, k;
	readln.chomp.split.tie(n, k);
	long cnt = 0;
	debug {
		int ans = 0;
		/+
		for (int a = 1; a <= n; ++a) {
			for (int b = 1; b <= n; ++b) {
				if (a % b >= k) {
					verbose(a, b);
					++ans;
				}
			}
		}
		+/
		for (int b = 1; b <= n; ++b) {
			for (int a = b + 1; a <= n; ++a) {
				if (a % b >= k) {
					verbose(a, b, "...", a % b);
					++ans;
				}
			}
		}
		for (int a = 1; a <= n; ++a) {
			for (int b = a + 1; b <= n; ++b) {
				if (a % b >= k) {
					verbose(a, b, "...", a % b);
					++ans;
				}
			}
		}
		verbose("ans", ans);
	}
	// 上 (a <= b)
	for (int a = max(k, 1); a <= n; ++a) {
		cnt += n - a;
	}
	debug verbose("ue", cnt);
	// 下 (a > b)
	for (int b = k + 1; b <= n; ++b) {
		if (k == 0) {
			cnt += n - b + 1;
		} else {
			debug verbose(b);
			for (int d = 0; d < b - k; ++d) {
				if (n < k + b + d) {
					break;
				}
				int v = (n - (k + b + d)) / b + 1;
				debug verbose("\t", d, v);
				int w = v - 1;
				w *= b;
				int x = n - w - k - b;
				debug verbose("\t\tx = ", x, n - (k + b + x));
				x = min(x, b - k - 1);
				debug verbose("\t\tx' = ", x);
				cnt += (x - d + 1) * v;
				d = x;
			}
		}
	}
	cnt.writeln;
}

void tie(R, Args...)(R arr, ref Args args)
		if (isRandomAccessRange!R || isArray!R)
in
{
	assert (arr.length == args.length);
}
body
{
	foreach (i, ref v; args) {
		alias T = typeof(v);
		v = arr[i].to!T;
	}
}

void verbose(Args...)(in Args args)
{
	stderr.write("[");
	foreach (i, ref v; args) {
		if (i) stderr.write(", ");
		stderr.write(v);
	}
	stderr.writeln("]");
}


Measured memory_bytes: 256
from sys import stdin
import operator
readline = stdin.readline


n, total_wait = map(int, readline().split())
value_wait = [list(map(int, readline().split())) for _ in range(n)]
value_wait.sort(key=operator.itemgetter(1), reverse=True)

dp = [[0] * (total_wait + 1) for _ in range(n + 1)]
for ni, (v, w) in enumerate(value_wait):
    for tw in range(w, total_wait + 1):
        dp[ni + 1][tw] = max(dp[ni][tw], dp[ni][tw - w] + v)
print(dp[-1][-1])

Measured memory_bytes: 25712
from sys import stdin

N, Y = [int(x) for x in stdin.readline().rstrip().split()]

flag = True

# 10000
for i in range(N + 1):
    # 5000
    for j in range(N + 1 - i):
        a = N - i - j
        if 10000 * i + 5000 * j + 1000 * a == Y:
            print(i, j, a)
            flag = False
            break

    if (not flag):
        break
else:
    print('-1 -1 -1')


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


int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++){
    cin >> a.at(i);
  }
  int j=1;
  for (int i=0; i<N; i++){
    if (a.at(i)==j){
      j++;
    }
  }
  if (j==1){
    cout << -1 << endl;
  }
  else{
    cout << N-(j-1) << endl;
  }
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
  int A,B,flag=0;
  string S;
  cin >> A >> B;
  cin >> S;
  for(int i=0;i<=A+B;i++){
    if((i==A && S.at(i)!='-') || (i!=A && S.at(i)=='-')){
      flag=1;
      break;
    }
  }
  if(flag==1)cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <limits>
#include <algorithm>

class coordinate {
public:
  std::int_fast64_t x;
  std::int_fast64_t y;

  constexpr coordinate(const std::int_fast64_t x, const std::int_fast64_t y) :
    x(x),
    y(y) {
  }

  constexpr coordinate() :
    coordinate(0, 0) {
  }

  friend std::istream& operator>>(std::istream& is, coordinate& self) {
    return is >> self.x >> self.y;
  }
};

std::int_fast64_t calc_distance(const coordinate& lhs, const coordinate& rhs) {
  return std::abs(lhs.x - rhs.x) + std::abs(lhs.y - rhs.y);
}

int main() {
  std::int_fast64_t n, m;
  std::cin >> n >> m;
  std::vector<coordinate> students(n);
  for (coordinate& student : students) {
    std::cin >> student;
  }
  std::vector<coordinate> checkpoints(m);
  for (coordinate& checkpoint : checkpoints) {
    std::cin >> checkpoint;
  }

  for (const coordinate& student : students) {
    std::int_fast64_t min_distance = std::numeric_limits<std::int_fast64_t>::max();
    std::int_fast64_t min_checkpoint_id = 0;
    for (std::int_fast64_t i = 0; i < m; ++i) {
      std::int_fast64_t distance = calc_distance(student, checkpoints[i]);
      if (distance < min_distance) {
        min_distance = distance;
        min_checkpoint_id = i + 1;
      }
    }
    std::cout << min_checkpoint_id << std::endl;
  }
  return 0;
}

Measured memory_bytes: 256
//
//  main.cpp
//  ProCon
//
//  Created by hashimotoryoma on 2017/08/20.
//  Copyright © 2017年 hashimotoryoma. All rights reserved.
//

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <queue>
#include <vector>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))

using namespace std;

typedef long long ll;

int group(int n){
    if(n==2)
        return 2;
    else if(n==4 || n==6 || n==9 || n==11)
        return 1;
    else
        return 0;

}

int main() {
    // insert code here...    return 0;
    //////
    // input from txt
    /*
     std::ifstream in("input.txt");
     std::cin.rdbuf(in.rdbuf());
     std::ofstream out("output.txt");
     std::cout.rdbuf(out.rdbuf());
     ////
     */
    int x,y;
    cin >> x >> y;
    cout << (group(x)==group(y)? "Yes":"No") << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pii         pair<int,int> 
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F         first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define mem(x)      memset(x,0,sizeof(x));
#define what_is(x)  cerr << #x << " is " << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
 
using namespace std;
 
void solve(){
    int n,k;
    cin>>n>>k;
    int h[n];
    rep(i,0,n)cin>>h[i];
    int dp[n];

    dp[0]=0;

    rep(i,1,n)dp[i]=INT_MAX;

    rep(i,1,n){

        for(int j=1;j<=k;j++){
            if(i-j<0)break;
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
        
    }

    cout<<dp[n-1]<<endl;
}
 
 
 
int main(){
    // #ifndef ONLINE_JUDGE
    // // for getting input from input.txt
    // freopen("input.txt", "r", stdin);
    // // for writing output to output.txt
    // freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
   
 
    int t=1,i=1;
   // cin>>t;
    
 
    while(t--){
       // cout<<"Case #"<<i++<<": ";
        solve();
    
    }
 
    return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>


using namespace std;

int main ()
{
    string s1, s2;
    cin >> s1;
    cin >> s2;

    int len1 = s1.length() + 1;
    int len2 = s2.length() + 1;

    vector< vector<int> > mat;
    mat.resize(len1);
    for (int i = 0; i < len1; ++i)
    {
        mat[i].resize(len2);
    }

    for (int i = 0; i < len1; ++i)
    {
        mat[i][0] = i;
    }
    for (int j = 0; j < len2; ++j)
    {
        mat[0][j] = j;
    }

    for (int i = 1; i < len1; ++i)
    {
        for (int j = 1; j < len2; ++j)
        {
            mat[i][j] = min(mat[i-1][j], mat[i][j-1]);
            if (s1[i-1] == s2[j-1])
            {
                mat[i][j] = min(mat[i-1][j-1], ++mat[i][j]);
            }
            else
            {
                mat[i][j] = min(mat[i][j], mat[i-1][j-1]);
                ++mat[i][j];
            }
        }
    }


    cout << mat.back().back() << endl;

}

Measured memory_bytes: 4964
def editarr(x,y,arr):
  l=len(arr)
  if abs(x)>=abs(y):
    for i in range(l):
      arr[i][0],arr[i][1]=arr[i][1],arr[i][0]
  if x<0:
    for i in range(l):
      arr[i][0]*=-1
  if y<0:
    for i in range(l):
      arr[i][1]*=-1

k=int(input())
x,y=map(int,input().split())
ans=[]
tx=abs(x)
ty=abs(y)
if tx>=ty:
  tx,ty=ty,tx
if k%2==0 and (tx+ty)%2!=0:
  print(-1)
else:
  if tx+ty<k:
    if (tx+ty)%2==0:
      m=(ty-tx)//2
      ans.append([k-m,m])
    else:
      td=k-(tx+ty)
      ans.append([tx,ty+td])
      ans.append([tx+(k-td//2),ty+td//2])
    ans.append([tx,ty])
  elif ty-(k-tx%k)<k and (ty-(k-tx%k))%2!=0:
    if (2*k-(tx+ty))%2==0:
      td=2*k-(tx+ty)
      ans.append([tx+td//2,k-(tx+td//2)])
      ans.append([tx,ty])
    else:
      ans.append([tx,k-tx])
      td=ty-(k-tx)
      ans.append([tx+(k-td//2),ans[-1][1]+td//2])
      ans.append([tx,ty])
  else:
    ans.append([0,0])
    for i in range(tx//k):
      ans.append([ans[-1][0]+k,0])
    if ans[-1][0]!=tx:
      ans.append([tx,k-abs(tx-ans[-1][0])])
    td=ty-ans[-1][1]
    if td%k==0:
      flag=True
    else:
      flag=False
    for i in range(td//k):
      if flag==False and (ty-ans[-1][1])%2==0 and (ty-ans[-1][1])<=2*k:
          break
      ans.append([tx,ans[-1][1]+k])
    if ans[-1][1]!=ty:
      td=ty-ans[-1][1]
      ans.append([tx+(k-td//2),ans[-1][1]+td//2])
      ans.append([tx,ty])
    ans.pop(0)
  editarr(x,y,ans)
  print(len(ans))
  for a,b in ans:
    print(a,b)

Measured memory_bytes: 32328
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 501, C = 1000 * 1000 * 1000;
int a[N][N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n, m, n1, m1;
    cin >> n >> m >> n1 >> m1;
    if (n % n1 == 0 && m % m1 == 0) {
        cout << "No\n";
        exit(0);
    }   
    int f = C / (n1 * m1);
    for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) a[i][j] = f;
    for (int i = n1 - 1; i < n; i += n1) for (int j = m1 - 1; j < m; j += m1) a[i][j] = -((n1 * m1 - 1) * f + 1);
    cout << "Yes\n";
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) cout << a[i][j] << ' '; cout << '\n';
    }   
}   

Measured memory_bytes: 4736
#include <bits/stdc++.h>
using namespace std;
int main() {
 int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  
int max1 = 0;
  for(int i = 0; i < N; i++) {
    if(max1 < vec.at(i)) {
      max1 = vec.at(i);
    }
  }
  
  int sum = 0;
  for(int i = 0; i < N; i++) {
    sum += vec.at(i);
  }
  
  if(max1 < sum - max1) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
      
      
}

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

#define endl "\n"
#define PB push_back
#define F first 
#define S second
#define int long long 
#define Runner_up ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()

signed main()
{	
	Runner_up 
	int t=1; //cin>>t;
	while(t--){
		map <string , string > m;
		m["ABC"] = "ARC" ;
		m["ARC"] = "ABC" ;
		string s; cin>>s;
		cout<<m[s];
	}
	return 0;	
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,x,y;
  int sum = 0;
  cin >> a >> b >> c >> x >> y;
  if(c * 2 < a + b){
    if(x > y){
      sum += 2 * c * y;
      if(c * 2 < a){
        sum += 2 * c * (x - y);
      }else{
        sum += a * (x - y);
      }
    }else if(x < y){
      sum += 2 * c * x;
      if(c * 2 < b){
        sum += 2 * c * (y - x);
      }else{
        sum += b * (y - x);
      }
    }else{
      sum += 2 * c * x;
    }
  }else{
    sum += a * x + b * y;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

n = int(input())
h = list(map(int, input().split()))
if n == 1:
    ans = "Yes"
else:
    min_h = h[n-1]
    for i in range(n-1, 0, -1):
        if min_h > h[i]:
            min_h = h[i]
        if min_h+1 < h[i]:
            print("No")
            sys.exit()
    ans = "Yes"
print(ans)

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

int main(){
  int x[5];
  for (int i = 0; i < 5; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < 5; i++) {
    if(x[i] == 0)
    {
      cout << i+1 << endl;
    }
  }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)     for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = m; i < (int)(n); i++)
#define MOD 1000000007
#define Graph vector<vector<int>>
#define lint int64_t

set<int> P;

void prime( const int N )
{
    for( int i = 2; i <= N; i++ )
    {
        bool flag = true;
        for( int j = 2; j * j <= i; j++ )
        {
            if( i % j == 0 )
            {
                flag = false;
                break;
            }
        }
        if( flag )
        {
            P.insert( i );
        }
    }
}


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

    prime(100000);
  	vector<int> Num2017;
  	for(int j = 3; j <= 100000; j += 2){
      if(P.count(j) && P.count((j+1) >> 1)) Num2017.push_back(j); 
    }  
  
    rep(i,Q){
      int l,r;
      cin >> l >> r;
      vector<int>::iterator pos1,pos2;
      
      pos1 = lower_bound(Num2017.begin(), Num2017.end(), l);
      pos2 = upper_bound(Num2017.begin(), Num2017.end(), r);
      auto idx_L = distance(Num2017.begin(),pos1);
      auto idx_R = distance(Num2017.begin(),pos2);
      
      cout << idx_R - idx_L << endl;
    }

    return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n;
    cin >> n;
    
    vector<double> v(n);
    for ( ll i = 0; i < n; i++ ) cin >> v[i];
    sort(v.begin(), v.end());
    
    double ans = v[0];
    for ( ll i = 1; i < n; i++ ) ans = (ans + v[i]) / 2.0;
    
    cout << setprecision(12) << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,x;
  cin >> n >> x;
  vector<int> list(n);
  for(int i=0; i<n; i++) {
    cin >> list.at(i);
    x -= list.at(i);
  }
  int ans = n;
  sort(list.begin(),list.end());
  ans += x/list.at(0);
  cout << ans << endl;
}

Measured memory_bytes: 256
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
n = gets.chomp.to_i
a = gets.chomp.split.map(&:to_i)
a.sort!
h = Hash.new(0)
a.each do |e|
  h[e] += 1
end

amax = a.max
ans = 0
used = Array.new(amax+1, false)
a.each do |num|
  next if used[num]

  1000000.times do |i|
    number = num * i
    break if number > amax
    used[number] = true
  end

  next if h[num] > 1
  ans += 1
end

puts ans


Measured memory_bytes: 44928
#include <bits/stdc++.h>
using  namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1e18

int cnt[101];
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	cnt[a]++;cnt[b]++;cnt[c]++;
	int ans=0;
	REP(i,101)if(cnt[i]>0)ans++;
	cout<<ans<<endl;
}
	
	

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionD
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var nk = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();
            var p = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            long maxSum = 0;
            long tempSum = 0;
            long startIndex = 0;

            for(int i = 0; i < nk[1]; i++) {
                tempSum += p[i];
                maxSum = tempSum;
            }

            for (int i = 1; i <= nk[0] - nk[1]; i++) {
                tempSum -= p[i - 1];
                tempSum += p[i + nk[1] - 1];

                if(tempSum > maxSum) {
                    maxSum = tempSum;
                    startIndex = i;
                }
            }

            double sumsum = 0.0;

            for(long i = startIndex; i < startIndex + nk[1]; i++) {
                var t = p[i] * (p[i] + 1) / 2;
                sumsum += t / (double)p[i];
            }

            Console.WriteLine(sumsum);

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 37468
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef long long ll;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i,h) cin >> s[i];
  int c[10][1005];
  int ans = 1e9;
  rep(div,1<<(h-1)) {
    int g = 0;
    vector<int> id(h);
    rep(i,h) {
      id[i] = g;
      if (div>>i&1) ++g;
    }
    ++g;
    rep(i,g)rep(j,w) c[i][j] = 0;
    rep(i,h)rep(j,w) c[id[i]][j] += (s[i][j]-'0');

    int num = g-1;
    vector<int> now(g);
    auto add = [&](int j) {
      rep(i,g) now[i] += c[i][j];
      rep(i,g) if (now[i] > k) return false;
      return true;
    };
    rep(j,w) {
      if (!add(j)) {
        num++;
        now = vector<int>(g);
        if (!add(j)) {
          num = 1e9;
          break;
        }
      }
    }
    ans = min(ans, num);
  }
  cout << ans << endl;
  return 0;
}

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

int main(void){
	int x, y, z, people = 0;
	cin >> x >> y >> z;
	for (int i = 1; i < 100000; ++i){
		if (i*y + (i+1)*z > x){
			break;
		}
		people++;
	}
	cout << people << endl;
	return 0;
}

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

int s;
int n,maxn,minn,sum;
int main(){
	while(1){
		cin >> n;
		if(n==0)break;
		minn=1001;
		maxn=0;
		sum=0;
		for(int i=0;i<n;i++){
			cin >>s;
			sum+=s;
			if(maxn<s)maxn=s;
			if(minn>s)minn=s;
		}
		sum=sum-minn-maxn;
		cout <<sum/(n-2)<<endl;

	}
	return 0;
}

Measured memory_bytes: 3092