akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
vector<int>v(1000010);
vector<bool>vis(1000010);
int main(){
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];
       // cout<<v[33]<<endl;
    for(int i=0;i<1000010;i++)  vis[i]=0;
    for(int i=0;i<n;i++){
        int val=arr[i];
        if(vis[arr[i]]){
            v[arr[i]]++;
            continue;
        }
        vis[arr[i]]=1;
        for(int j=2*arr[i];j<=1000010;j+=arr[i]){
            v[j]++;
        }
    }
    //cout<<v[33]<<endl;
    int res=0;
    for(auto i:arr){
        if(v[i] == 0){
        res++;
        }
    }
    cout<<res;
    }


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

int main(){
    int N;
    cin >> N;
    vector<int> A(N),B(N);
    vector<int> L(100010),R(100010),imos(100010);
    for(int i=0;i<N;i++){
        cin >> A[i] >> B[i];
        L[B[i]-1]++;
        R[A[i]]++;
        imos[A[i]]++; imos[B[i]]--;
    }
    int ans1 = 0,ans2 = 0;
    for(int i=1;i<=100000;i++){
        L[i] += L[i-1];
        imos[i] += imos[i-1];
        ans2 = max(ans2,imos[i]);
    }
    for(int i=100000;i>=1;i--){
        R[i] += R[i+1];
    }
//    for(int i=1;i<=6;i++) cerr << L[i] << " " << R[i] << endl;
    for(int i=0;i<N;i++){
        ans1 = max(ans1,N-L[A[i]-1]-R[B[i]]);
    }
    cout << ans1 << " " << ans2 << endl;
}


Measured memory_bytes: 5396
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#define re register
#define il inline
#define ll long long
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define fp(i,a,b) for(re int i=a;i<=b;i++)
#define fq(i,a,b) for(re int i=a;i>=b;i--)
using namespace std;
const int mod=1e9+7,N=1e6+100;
ll n,x,jc[N],p,ans,Need,f[N],inv[N];
il ll gi()
{
  re ll x=0,t=1;
  re char ch=getchar();
  while(ch!='-'&&(ch<'0'||ch>'9')) ch=getchar();
  if(ch=='-') t=-1,ch=getchar();
  while(ch>='0'&&ch<='9') x=x*10+ch-48,ch=getchar();
  return x*t;
}
il ll ksm(re ll S,re ll n)
{
  re ll T=S;S=1;
  while(n)
    {
      if(n&1) S=S*T%mod;
      T=T*T%mod;
      n>>=1;
    }
  return S;
}
il ll C(re ll x,re ll y)
{
  return jc[y]*inv[y-x]%mod*inv[x]%mod;
}
int main()
{
  n=gi();Need=(n+1)/2;
  jc[0]=inv[0]=inv[1]=1;
  fp(i,2,n) inv[i]=(mod-mod/i*inv[mod%i]%mod)%mod;//printf("%lld ",inv[i]);
  fp(i,1,n) jc[i]=jc[i-1]*i%mod;
  fp(i,2,n) inv[i]=inv[i]*inv[i-1]%mod;
  fp(i,Need,n-1) f[i]=C(n-i-1,i-1)*jc[i]%mod*jc[n-i-1]%mod;
  fq(i,n-1,Need) f[i]=(f[i]-f[i-1]+mod)%mod;
  fp(i,Need,n-1) (ans+=(f[i]*i%mod))%=mod;
  printf("%lld\n",ans);
  return 0;
}


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

int main() {
  int A, B;
  cin >> A >> B;
  if((A + B) % 2 == 1) {
    cout << "IMPOSSIBLE" << endl;
  }
  else {
    cout << (A + B) / 2 << endl;
  }
}

Measured memory_bytes: 256
//第8回シンデレラガール総選挙は是非本田未央ちゃんに投票をお願いします！
//ファンのことも他のアイドルの子たちのことも本当に大事にしてて、今まで周りに色んなものを与えてくれました。
//今度は私たちが未央ちゃんにお返しをする番です。みんなでガラスの靴を履かせてあげましょう！
// #本田未央を一番星に #本田未央を令和のシンデレラガールに #第8回シンデレラガール総選挙
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
vector<pint> gr[25];
int a[200],b[200];
int n,m;
lint dc[(1<<20)+10],ds[(1<<20)+10];
int num[(1<<20)+10];
lint p[210][210];
void dfs(int v,int u,int g,int ma){
	//cout<<v<<u<<g<<ma<<endl;
	if(v==g){
		//cout<<v<<' '<<g<<' '<<ma<<endl;
		num[ma]++;return;
	}
	rep(i,gr[v].size()){
		pint w=gr[v][i];
		if(w.fi==u) continue;
		dfs(w.fi,v,g,ma+(1<<w.se));
	}
}
int main()
{
	cin>>n>>m;
	rep(i,m){
		cin>>a[i]>>b[i];
		if(i<n-1){
			gr[a[i]].pb(mp(b[i],i));
			gr[b[i]].pb(mp(a[i],i));
		}
	}
	REP(i,n-1,m){
		dfs(a[i],0,b[i],0);
	}
	n--;
	//num[0]++;
	//rep(i,(1<<n)) cout<<i<<' '<<num[i]<<endl;
	rep (i, n) rep (b, 1 << n) if (0 < (b & (1 << i))) num[b] += num[b - (1 << i)];
	//rep(i,(1<<n)) cout<<i<<' '<<num[i]<<endl;
	lint mo=1000000007;
	rep(i,205) rep(j,205) p[i][j]=1;
	rep(i,205) REP(j,i,205){
		REP(k,i,j+1) p[i][j]=(p[i][j]*k)%mo;
	}
	memset(dc,0,sizeof(dc));
	memset(ds,0,sizeof(ds));dc[(1<<n)-1]=1;
	for(int i=(1<<n)-1;i>=0;i--){
		int b=n-__builtin_popcount(i);
		int N=m-(num[i]+__builtin_popcount(i));
		//cout<<i<<' '<<dc[i]<<' '<<ds[i]<<' '<<b<<' '<<N<<endl;
		rep(j,n){
			if(!(i&(1<<j))) continue;
			int d=num[i]-num[i-(1<<j)];
			lint c=(dc[i]*p[N+1][N+d])%mo;
			lint s=(ds[i]*p[N+2][N+d+1])%mo;
			dc[i-(1<<j)]+=c;dc[i-(1<<j)]%=mo;
			ds[i-(1<<j)]+=s+c*(b+1);ds[i-(1<<j)]%=mo;
		}
	}
	cout<<ds[0]%mo<<endl;
}


Measured memory_bytes: 21120
#include <bits/stdc++.h>
using namespace std;
char x[21000];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		puts(x);
		puts(x);
	}
	return 0;
}

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

// types
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;

// macros
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};

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

  //whether centor or not, height
  pair<bool, ll> c[101][101];
  REP(i, 101){
    REP(j, 101)
      c[i][j] = make_pair(true, LLINF);
  }

  ll n;
  cin >> n;
  vll X(n), Y(n), H(n);
  vll initialize(3);
  REP(i, n){
    cin >> X[i] >> Y[i] >> H[i];
    if(H[i] != 0){
      initialize[0] = X[i];
      initialize[1] = Y[i];
      initialize[2] = H[i];
    }
  }

  REP(x, 101){
    REP(y, 101){
      c[x][y].SE = initialize[2] + abs(x-initialize[0]) + abs(y-initialize[1]);
      REP(i, n){
        if(!c[x][y].FI)
          continue;
        if(c[x][y].SE == LLINF && H[i] != 0)
          c[x][y].SE = H[i] + abs(x-X[i]) + abs(y-Y[i]);
        else{
          ll v = c[x][y].SE - (abs(x-X[i]) + abs(y-Y[i]));
          v = max(v, 0LL);
          if(v != H[i])
            c[x][y].FI = false;
        }
      }
    }
  }

  REP(x, 101){
    REP(y, 101){
      if(c[x][y].FI)
        cout << x << ' ' << y << ' ' << c[x][y].SE << endl;
    }
  }


}


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

#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define endl "\n" 
#define all(c) c.begin(),c.end()
#define present(c,element) (c.find(element)!=c.end())
#define cpresent(c,element) (find(c,element)!=c.end())
typedef vector<int> vi;
typedef vector<ll> vll;
ll mod=1e9+7;


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

int test=1;
//cin>>test;
while(test--)
{

	int s,w;
	cin>>s>>w;
	if(w>=s)cout<<"unsafe";
	else cout<<"safe";


	
}
return 0;
}









Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
long long mod4(long long n)
{
  int rem=n%4;
  if(rem==0)
    return n;
  else if(rem==1)
    return 1;
  else if(rem==2)
    return n+1;
  else
    return 0;
  
}
int main() 
{
  //input
  long long a,b;
  cin  >> a>>b;
  cout<<(mod4(a-1)^mod4(b));
  
}

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

int count( string s )
{
    int counter = 0;

    for( int i=1 ; i<s.size() ; i++ )
    {
        if( s[i-1] == s[i] ) 
        {
            counter++;
            if( s[i] == '0' ) s[i] = '1';
            else              s[i] = '0';
        }
    }

    return counter;
}

int main() 
{
    string s;  cin >> s;

    int temp1 = count( s );
    reverse( s.begin(), s.end() );
    int temp2 = count( s );

    if( temp1 < temp2 ) cout << temp1;
    else                cout << temp2;
}

Measured memory_bytes: 512
import sys
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    S = {
        'a': list(input()),
        'b': list(input()),
        'c': list(input())
    }
    turn = 'a'
    while S[turn]:
        turn = S[turn].pop(0)
    print(turn.upper())

if __name__ == '__main__':
    main()


Measured memory_bytes: 61424
#include <bits/stdc++.h>
#define M 1000000007
#define endl '\n'
#define ll long long
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	string str;
	cin>>str;
	ll len=str.length();

	char last=str[len-1];

	if(last=='s')
		str=str+"es";
	else
		str=str+"s";

	cout<<str<<endl;

	return 0;
}

Measured memory_bytes: 3652
#include <cmath>
#include <iostream>
#include <stdio.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <set>
#include <limits.h>
#include <map>
#include <numeric>

namespace test {
	std::string to_string (char val) {
		return std::string (1, val);
		// return std::string{val};
	}
	//if( str.find ("r") != string::npos)
}

using namespace std;
typedef long long int llint;

int main (void) {
	int n ; cin >> n;
	int *buttons = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> buttons[i];
	}
	int index = 0;
	for (int i = 1; i <= n; i++) {
		index = buttons[index] - 1;
		if (index == 1) {
			cout << i << endl;
			break;
		}
	}
	if(index != 1 ) cout << -1 << endl;
	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(){
  int a,b,i;
  char op;
  for(i=0;;i++){
    scanf("%d %c %d",&a,&op,&b);
    if(op=='+'){
      printf("%d\n",a+b);
    }else if(op=='-'){
      printf("%d\n",a-b);
    }else if(op=='*'){
      printf("%d\n",a*b);
    }else if(op=='/'){
      printf("%d\n",a/b);
    }else{
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 2076
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
using namespace std;

int main(){
	string s, t;
	cin >> s >> t;
	sort(s.begin(), s.end());
	sort(t.begin(), t.end(), greater<char>());
	if (s < t)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int height,i,j,k,tmp,tmp2;
	int ans[3];

	for(i = 0;i < 3;i++){
		ans[i] = 0;
	}

	for(i = 0;i < 10;i++){
		scanf("%d",&height);
		for(j = 0;j < 3;j++){
			if(ans[j] < height){
				tmp = ans[j];
				ans[j] = height;
				for(k = j+1;k < 3;k++){
					if(tmp > ans[k]){
						tmp2 = tmp;
						tmp = ans[k];
						ans[k] = tmp2;
					}
				}
				break;
			}
		}
	}

	for(i = 0;i < 3;i++){
		printf("%d\n",ans[i]);
	}

	return 0;
}

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

int main() {
	int a,b;
    cin>>a>>b;
  	vector<int> v;
  	v.push_back(a+b);
  	v.push_back(2*a-1);
  	v.push_back(2*b-1);
  	sort(v.begin(),v.end(),greater<int>());
  	cout<<v[0];
  
	return 0;
}

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

#define GO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int

const int maxr = 1e5 + 5;


int32_t main()
{
	GO;
	int a, b;
	cin >> a >> b;
	cout << a*b << endl;
	return 0;
}

//!

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

int d;
long long g;
vector<long long> p, c;

int main(){
  cin >> d >> g;
  p.resize(d); c.resize(d);
  for(int i = 0; i < d; ++i) cin >> p[i] >> c[i];

  long long res = 1 << 29;
  for(int bit = 0; bit < (1 << d); ++bit){
    long long sum = 0;
    long long num = 0;
    for(int i = 0; i < d; ++i){
      if(bit & (1 << i)) sum += c[i] + p[i] * 100 * (i + 1), num += p[i];
    }
    if(sum >= g) res = min(res, num);
    else{
      for(int i = d - 1; i >= 0; --i){
        if(bit & (1 << i)) continue;
        for(int j = 0; j < p[i]; ++j){
          if(sum >= g) break;
          sum += 100 * (i + 1);
          ++num;
        }
      }
      res = min(res, num);
    }
  }
  cout << res << endl;
}


Measured memory_bytes: 256
n,q = map(int, input().split())
s = input()
ac = [0]*n
c = 0
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        c += 1
    ac[i] = c

for j in range(q):
    l,r = map(int, input().split())
    print(ac[r-1]-ac[l-1])

Measured memory_bytes: 6084
n=int(input())
a=list(map(int, input().split()))
b=list(map(int, input().split()))

count=0

for i in range(n):
  if a[i] < b[i]:
    count+=a[i]
    b[i]=b[i]-a[i]
    if a[i+1] <= b[i]:
      count +=a[i+1]
      a[i+1]=0
    else:
      count+=b[i]
      a[i+1]-=b[i]
  else:
    count+=b[i]

print(count)
    
    


Measured memory_bytes: 18624
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := newIo()
	defer io.flush()

	n := io.nextInt()
	var fmHf, ltHf []int

	for i := range make([]struct{}, n) {
		a := io.nextInt()
		if n%2 != i%2 {
			fmHf = append(fmHf, a)
		} else {
			ltHf = append(ltHf, a)
		}
	}

	for i := len(fmHf) - 1; i >= 0; i-- {
		io.print(fmHf[i], " ")
	}
	for i, v := range ltHf {
		if i != 0 {
			io.print(" ")
		}
		io.print(v)
	}
	io.println()
}

type io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func newIo() *io {
	return &io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *io) flush() {
	_ = io.writer.Flush()
}

func (io *io) nextLine() string {
	var buffer []byte
	for {
		line, isPrefix, _ := io.reader.ReadLine()
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *io) nextString() string {
	for io.nextToken >= len(io.tokens) {
		line := io.nextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *io) nextInt() int {
	i, _ := strconv.Atoi(io.nextString())
	return i
}

func (io *io) print(a ...interface{}) {
	fmt.Fprint(io.writer, a...)
}

func (io *io) println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *io) printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}


Measured memory_bytes: 15872
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    a,b,c=MI()
    if a==b+c or b==a+c or c==a+b:print("Yes")
    else:print("No")

main()

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

long long dp[100][2];

int main(){
    long long N, K;
    cin >> N >> K;
    vector<long long> A(N);
    for(int i=0; i<N; i++)
        cin >> A[i];

    for(int i=0; i<100; i++)
        for(int j=0; j<2; j++)
            dp[i][j] = -(1LL<<60);
    dp[45][0] = 0;

    for(int i=44; i>=0; i--){
        long long zero = 0;
        long long one = 0;
        for(long long a : A){
            if(a & (1LL<<i)) one++;
            else zero++;
        }
        if(K & (1LL<<i)){
            dp[i][0] = dp[i+1][0] + zero * (1LL<<i);
            dp[i][1] = dp[i+1][0] + one * (1LL<<i);
            if(dp[i+1][1] >= 0)
                dp[i][1] = max(dp[i][1], dp[i+1][1] + max(one, zero)*(1LL<<i));
        }else{
            dp[i][0] = dp[i+1][0] + one * (1LL<<i);
            if(dp[i+1][1] >= 0)
                dp[i][1] = dp[i+1][1] + max(one, zero) * (1LL<<i);
        }
    }
    cout << max(dp[0][0], dp[0][1]) << endl;
    return 0;
}

Measured memory_bytes: 1024
//#pragma GCC optimize "trapv"
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int M = 1000000007;
#define pb push_back
#define fs first
#define sc second
#define forn(i,k,n) for(int i = k; i < n; ++i)
#define nfor(i,n,k) for(int i = n; i >= k; --i)
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vvpii vector<vector<pait<int,int>>>
#define all(arr) arr.begin(), arr.end()
#define endl '\n'
#define dbgarr(V,n) forn(i,0,n) cout << V[i] << " "; cout << endl;
#define dbgarrrev(V,n) nfor(i,n,0) cout << V[i] << " "; cout << endl;
#define dbgmaze(V) for(auto x: V) {for(auto y : x) cout << y <<  " ";cout << endl;}
#define dbg2d(V,n,m) forn(i,0,n) {forn(j,0,m) cout << V[i][j] <<  " ";cout << endl;}
#define N 100005
vi G[N];
bool vis[N] = {false};
int dp[N] = {0}; int ans = -1;
void dfs(int src){
	vis[src] = true;
	for(auto x: G[src]){
		if(!vis[x]) dfs(x);
		dp[src] = max(dp[src], 1 + dp[x]);
	}
	ans = max(ans, dp[src]);
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, m; cin >> n >> m;
	forn(i,0,m){
		int u, v; cin >> u >> v;
		G[u].pb(v); 
	}
	forn(i,1,n + 1) if(!vis[i]) dfs(i);
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 12224
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    int[] Number;
    string s;
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        s = Console.ReadLine();
        Number = new int[s.Length+1];
        {
            int d = 0;
            for(int i=0;i<s.Length;i++){
                d += 9*(s[s.Length-1-i]-'0');
                Number[i] = d % 10;
                d /= 10;
            }
            Number[s.Length] = d;
        }
        int count = 0;
        for(int i=s.Length;i>0;i--){
            int d = Number[i];
            count += d;
            Number[i] = 0;
            Plus(d);
            if(Number[i] == 1){
                if(Number[0] == 8){
                    count -= d-1;
                    break;
                }
                else{
                    Plus(1);
                    count++;
                    Number[i] = 0;
                }
            }
        }
        if(Number[0] == 9){
            count++;
        }
        sb.Append((count+8)/9+"\n");
    }
    void Plus(int N){
        int d = N;
        for(int i=0;i<s.Length+1;i++){
            d += Number[i];
            Number[i] = d % 10;
            d /= 10;
            if(d == 0){
                break;
            }
        }
    }
}

Measured memory_bytes: 14816
N = int(input())
a = [int(i) for i in input().split()]

snuke = a[0]
total = sum(a)
arai = total - snuke

minimum = abs(snuke- arai)

for i in range(1,N-1):
    snuke = snuke + a[i]
    arai = arai - a[i]
    sub = abs(snuke-arai)
    if sub < minimum:
        minimum = sub

print(minimum)

Measured memory_bytes: 24832
function Main(input) {
	var inputArr = input.split("\n");
	var inArr1 = inputArr[0].split(" ");
	var inArr2 = inputArr[1].split(" ");
	var n = parseInt(inArr1[0], 10);
    var max = 0;
    var count = 0;
	for(var i = 0; i < n; i++) {
      var hi = parseInt(inArr2[i], 10);
      if (max <= hi) {
        max = hi
        count++;
      }
	}
    console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
#include<stdio.h>
#include<string.h>
#include<math.h>
#define range 1000000
int total_added = 4;
struct primes{
	 int  key;
	 int  counts;
};
primes p[range];
bool is_prime(int key)
{
	int i;
	for (i = 2; i <= sqrt(key); i++)
	{
		if (key%i == 0)return false;
	}
	return true;
}
void init()
{
	p[0].key = 2;
	p[0].counts = 1;
	p[1].key = 3;
	p[1].counts = 2;
	p[2].key = 5;
	p[2].counts = 3;
	p[3].key = 7;
	p[3].counts = 4;
	int i;
	for (i = 8; i <= range; i++)
	{
		if (i % 2 != 0&&i%3!=0&&i%5!=0)
		{
			if (is_prime(i))
			{
				p[total_added].key = i;
				p[total_added].counts = p[total_added - 1].counts + 1;
				total_added++;
			}
		}
	}
}
int counting_result(int key)
{
	for (int i =total_added-1; i>=0; i--)
	{
		if (key >= p[i].key)
			return p[i].counts;
	}
	return 0;
}

int main()
{
	init();
	int i=0, n;
	while (scanf("%d", &n)==1&&30)
	{
		
		printf("%d\n",counting_result(n));
		i++;
	}

}

Measured memory_bytes: 1640
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  ll x;
  cin >> x;

  for (ll i = -200; i <= 200; i++) {
    for (ll j = -200; j <= 200; j++) {
      if ((i*i*i*i*i) - (j*j*j*j*j) == x) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }

  return 0;
}


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

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define read() 	        freopen("in.txt","r",stdin)
#define write()         freopen("out.txt","w",stdout)
#define sf(n) 	        scanf("%d",&n)
#define sfd(n)          scanf("%lf",&n)
#define sl(x)           scanf("%I64d",&x)
#define sfl(n) 	        scanf("%lld", &n)
#define sfc(n)          scanf(" %c",&n)
#define sful(n)         scanf("%ull",&n)
#define ull             unsigned long long int
#define endll           pf("\n")
#define pf              printf
#define pi              acos(-1.0)
#define eps 	        1e-10
#define mem(a,b)        memset(a,b,sizeof(a))
#define pb              push_back
#define xx              first
#define yy              second
#define pii             pair<int, int>
#define pll             pair<ll, ll>
#define MP make_pair
#define ll              long long
#define uniq(a)      a.erase(unique(a.begin(), a.end()), a.end())
#define cnd tree[idx]
#define lnd tree[idx<<1]
#define rnd tree[(idx<<1)+1]
#define lndp (idx<<1),(b),((b+e)>>1)
#define rndp ((idx<<1)+1),(((b+e)>>1)+1),(e)
#define inf 1999999999
#define MX 100005
#define mod 1000000007
#define var    int i,j,k,n,m,z=0,c=0,t,x,y,l,r,mid
//int dx[8]={0,0,1,1,-1,-1,1,-1};  //8 direction
//int dy[8]={1,-1,1,-1,1,-1,0,0};
//int dx[4]={1,-1,0,0};  //4 direction
//int dy[4]={0,0,1,-1};
ll a[200005],b[200005];
int main()
{
    ll var;
    sfl(n);
    for(i=0;i<n;i++)sfl(a[i]);
    for(i=0;i<n;i++)
    {
        b[a[i]]=b[a[i]-1]+1;
    }
    c=0;
    for(i=0;i<200005;i++)
    {
        c=max(c,b[i]);
    }
    cout<<n-c<<endl;
}


Measured memory_bytes: 3328
def c_repsept():
    K = int(input())

    L = 9 * K // 7 if K % 7 == 0 else 9 * K
    if L % 2 == 0 or L % 5 == 0:
        return -1

    remainder = 1
    for n in range(1, L + 1):
        remainder = (10 * remainder) % L
        if remainder == 1:
            return n
    return -1

print(c_repsept())

Measured memory_bytes: 9192
#include<iostream>
#include<algorithm>
using namespace std;
 
int s[4]={10,50,100,500};
int n,t[4],u[4],maxm,ans[4];
 
int calc(int x){
  int res=0;
  for(int i=3;i>=0;i--){
    res+=x/s[i];
    x%=s[i];
  }
  return res;
}
 
void solve(int pos,int cnt,int sum){
  if(pos==4){
    if(sum<n)return;
    cnt-=calc(sum-n);
    if(cnt<=maxm)return;
    for(int i=0;i<4;i++)ans[i]=u[i];
    maxm=cnt;
    return;
  }
  for(int i=0;i<=t[pos];i++){
    u[pos]=i;
    solve(pos+1,cnt+i,sum+i*s[pos]);
  }
}
 
int main(){
  cin>>n;
  while(1){
    for(int i=0;i<4;i++)cin>>t[i];
    maxm=-(1e9);
    solve(0,0,0);
    for(int i=0;i<4;i++){
      if(ans[i]==0)continue;
      cout<<s[i]<<" "<<ans[i]<<endl;
    }
    cin>>n;
    if(n==0)break;
    cout<<endl;
  }
}


Measured memory_bytes: 3096
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        double hourLen = sc.nextDouble();
        double minLen = sc.nextDouble();
        double hour = sc.nextDouble();
        double min = sc.nextDouble();

        double hRad = 2 * Math.PI * (hour / 12.0 + min / 60.0 / 12.0);
        double mRad = 2 * Math.PI * min / 60.0;

        double theta = hRad - mRad;

        double ans = Math.pow(hourLen, 2) + Math.pow(minLen, 2) - 2.0 * hourLen * minLen * Math.cos(theta);

        System.out.println(Math.sqrt(ans));

    }
}


Measured memory_bytes: 37320
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const ll mod = 1e9+7;
const int MAX = 2e6+1;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i-1] * (ll)i % mod;
    inv[i] = mod - inv[mod%i] * (mod/(ll)i) % mod;
    finv[i] = finv[i-1] * inv[i] % mod;
  }
}

ll COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}

ll Pow(ll x, ll n){
  if(n == 0) return 1;
  if(n % 2 == 0) return Pow(x*x % mod, n/2);
  else return x * Pow(x,n-1) % mod;
}

int main(){
  int k;
  cin >> k;
  string s;
  cin >> s;
  int l = s.length();
  COMinit();
  ll ans = 0;
  for(int n = l; n <= l+k; n++) {
    ll c = COM(n-1,l-1);
    (c *= Pow(25,n-l)) %= mod;
    (c *= Pow(26,l+k-n)) %= mod; 
    (ans += c) %= mod;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 51220
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#define INF 100000000
#define REP(i, a, n) for(int i = (a); i < (n); i++)
using namespace std;

struct state { int y, x, f, d; };
class Compare {
public:
  bool operator()(struct state a, struct state b) {
    return a.d > b.d;
  }
};

int H, W;
char S[60][30];
int dp[60][30][3];

int isin(int y, int x) {
  return 0 <= y && y < H && 0 <= x && x < W;
}

int main(void) {
  while(cin >> W >> H, H && W) {
    priority_queue<struct state, vector<struct state>, Compare> q;

    REP(i, 0, H) REP(j, 0, W) REP(k, 0, 3) dp[i][j][k] = INF;

    REP(i, 0, H) {
      REP(j, 0, W) {
        cin >> S[i][j];
        if(S[i][j] == 'S') {
          struct state l = { i, j, -1, 0 };
          struct state r = { i, j, 1, 0 };
          q.push(l);
          q.push(r);
        }
      }
    }

    long ans = -1;
    while(!q.empty()) {
      struct state c = q.top();
      q.pop();

      // cout << c.y << ", " << c.x << ", " << c.f << ", " << c.d << endl;

      if(dp[c.y][c.x][c.f + 1] <= c.d) continue;
      dp[c.y][c.x][c.f + 1] = c.d;
      if(S[c.y][c.x] == 'T') {
        ans = dp[c.y][c.x][c.f + 1];
        break;
      }

      REP(i, -2, 3) REP(j, 1, 4) {
        int ny = c.y + i, nx = c.x - j * c.f;
        if(abs(c.y - ny) + abs(c.x - nx) > 3) continue;
        if(S[ny][nx] == 'X') continue;
        if(!isin(ny, nx)) continue;
        int nd = c.d + ('0' <= S[ny][nx] && S[ny][nx] <= '9' ? S[ny][nx] - '0' : 0);
        int nf = -c.f;
        if(dp[ny][nx][nf + 1] <= nd) continue;
        struct state n = { ny, nx, nf, nd };
        q.push(n);
        // cout << "  " << n.y << ", " << n.x << ", " << n.f << ", " << n.d << endl;
      }
    }

    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 3168
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <utility>

#define reps(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reps(i,0,n)

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;

signed main()
{
    int n;
    cin >> n;
    
    int hist[13] = {};
    rep(i, n){
        int d;
        cin >> d;
        hist[d]++;
    }
    hist[0]++;
    
    vi t(24);
    vector<int> v;
    
    rep(i, 12){
        if(hist[i] >= 3){
            cout << 0 << endl;
            return 0;
        }
        if(hist[i] == 2){
            t[i] = 1;
            t[24-i] = 1;
        }
        if(hist[i] == 1){
            v.push_back(i);
        }
    }
    
    if(hist[0] >= 2){
        cout << 0 << endl;
        return 0;
    }
    if(hist[0] == 1){
        t[0] = 1;
    }
    
    if(hist[12] >= 2){
        cout << 0 << endl;
        return 0;
    }
    if(hist[12] == 1){
        t[12] = 1;
    }
    
    int s = 0;
    
    rep(m, (1 << v.size())){
        vi tt = t;
        rep(i, v.size()){
            if((m >> i) & 1) tt[v[i]] = 1;
            else tt[24-v[i]] = 1;
        }
        
        int tmp = 10000;
        rep(i, 24) rep(j, i){
            if(tt[i] && tt[j]){
                tmp = min(tmp, min(i-j, 24-(i-j)));
            }
        }
        
        s = max(s, tmp);
    }
    
    cout << s << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>

using namespace std;

int main(void) {
  int N;
  cin >> N;
  string s;
  map<string, int> S;

  for(int i = 0; i < N; i++){
    cin >> s;
    S[s]++;
  }
  printf("AC x %d\n", S["AC"]);
  printf("WA x %d\n", S["WA"]);
  printf("TLE x %d\n", S["TLE"]);
  printf("RE x %d\n", S["RE"]);
  return 0;
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }



int main() {
  ll N,M;
  scanf("%lld%lld", &N,&M);
  ll a[N];
  priority_queue<ll> que;
  for (int i = 0; i < N; ++i) {
    scanf("%lld", &a[i]);
    que.push(a[i]);
  }

  FOR(i,0,M-1){
    que.push(que.top()/2);
    que.pop();
  }

  ll ans = 0;

  FOR(i,0,N-1){
    ans += que.top();
    que.pop();
  }

  cout << ans << endl;


}



Measured memory_bytes: 1912
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;

int a[100011];
ll ans[100011];
ll fact[101111];
ll ifact[101111];

const int MOD = 1e9 + 7;

ll add(ll a, ll b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
	return a;
}

ll mult(ll a, ll b)
{
	return (a*b)%MOD;
}

ll c(ll a, ll b)
{
	if(b<0) return 0;
	if(a<b) return 0;
	if(b==0) return 1;
	ll ans = fact[a];
	ans=mult(ans,mult(ifact[a-b],ifact[b]));
	if(ans<0) ans+=MOD;
	return ans;
}

ll modpow(ll a, ll b)
{
	ll r=1;
	while(b)
	{
		if(b&1) r=mult(r,a);
		a=mult(a,a);
		b>>=1;
	}
	return r;
}

int used[100011];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	memset(used,-1,sizeof(used));
	int d=-1;
	for(int i=0;i<n+1;i++) 
	{
		cin>>a[i];
		if(used[a[i]]>=0)
		{
			d=i-used[a[i]]-1;
		}
		used[a[i]]=i;
	}
	fact[0]=1;
	ifact[0]=1;
	for(int i=1;i<=n+2;i++)
	{
		fact[i]=mult(fact[i-1],i);
		ifact[i]=modpow(fact[i],MOD-2);
	}
	for(int k=1;k<=n+1;k++)
	{
		ans[k] = add(c(n-1,k),c(n-1,k-2));
		ans[k] = add(ans[k],add(c(n-1-d,k-1),mult(2,add(c(n-1,k-1),MOD-c(n-1-d,k-1)))));
	}
	for(int i=1;i<=n+1;i++)
	{
		cout<<ans[i]<<'\n';
	}
}


Measured memory_bytes: 4352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String[] str = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);
		int l = Integer.parseInt(str[2]);

		int[][] A = new int[n][m];
		int[][] B = new int[m][l];

		for(int i = 0; i < n; i++){
			str = br.readLine().split(" ");
			for(int j = 0; j < m; j++){
				A[i][j]= Integer.parseInt(str[j]);
			}
		}
		for(int i = 0; i < m; i++){
			str = br.readLine().split(" ");
			for(int j = 0; j < l; j++){
				B[i][j]= Integer.parseInt(str[j]);
			}
		}
		long c = 0;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < l; j++){
				c = 0;
				for(int k = 0; k < m; k++){
					c += A[i][k] * B[k][j];
				}
				if(j == (l - 1)){
					System.out.print(c);
				}else{
					System.out.print(c + " ");
				}
			}
			System.out.println();
		}
	}
}

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

using namespace std;


int main() {
    string tmp;
    int cnt = 0;
    int res_cnt = 0;

    cin >> tmp;

    for (int i = 0; i < tmp.length(); i++) {
        if (tmp[i] == 'A' || tmp[i] == 'C' || tmp[i] == 'G' || tmp[i] == 'T') {
            cnt++;
        } else {
            if (res_cnt < cnt) {
                res_cnt = cnt;
                cnt = 0;
            }
        }
    }

    if (res_cnt < cnt) {
        res_cnt = cnt;
    }

    cout << res_cnt;

    return 0;
}

Measured memory_bytes: 256
n, m = gets.chomp.split.map(&:to_i)
ks = []

m.times do
  ks << gets.chomp.split.map(&:to_i)
end

p = gets.chomp.split.map(&:to_i)

ans = 0

[0, 1].repeated_permutation(n) do |bits|
  flag = 1
  m.times do |i|

    tmp_sum = 0

    ks[i][0].times do |j|
      tmp_sum += bits[ks[i][j+1]-1]
    end
    
    flag = 0 unless tmp_sum % 2 == p[i]
  end

  ans += 1 if flag == 1
end

puts ans



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

typedef long long ll;
const int INF = 2e9;
//const ll INF = 9e18;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int mn = 0;
    int last = 0;
    int x = 0;
    for (int i=0;i<n;i++){
        if (s[i] == '(') x++; else x--;
        mn = min(mn,x);
        if (i==n-1) last = x;
    }
    if (0 == mn) {
        for (int i=last;i>0;i--) s += ")";
    } else if (mn == last){
        for (int i=0;i>last;i--) s = "(" + s;
    } else {
        for (int i=0;i>mn;i--) s = "(" + s;
        for (int i=last;i>mn;i--) s += ")";
    }
    cout << s << "\n";
}

Measured memory_bytes: 256
$mod = 998244353

def power(x, n)
    n == 0 ? 1 : ((n.odd? ? x : 1) * power(x ** 2 % $mod, n / 2) % $mod)
end

n = gets.to_i
h = Array.new(n+1, 0)
d = gets.split.map(&:to_i)
d.each {|e| h[e.to_i] += 1}

if d[0] != 0 || h[0] != 1
    puts 0
else
    ans = 1
    n -= 1
    i = 1

    while n != 0
        ans = ans * power(h[i-1], h[i]) % $mod
        n -= h[i]
        i += 1
    end

    puts ans
end



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

const int N = 1 << 18;
using P = pair<int, int>;
P a[N];

P calc(P a, P b) {
  vector<int> v{a.first, a.second, b.first, b.second};
  sort(begin(v), end(v));
  return P(v[3], v[2]);
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n; cin >> n;
  int m = 1 << n;
  int mask = m - 1;
  for(int i = 0; i < m; i++) {
    int x; cin >> x;
    a[i^mask] = P(x, -1e9);
  }
  for(int i = 0; i < n; i++) for(int b = 0; b < (1 << n); b++)
    if(!(b & (1 << i))) a[b] = calc(a[b], a[b | (1 << i)]);
  int ma = 0;
  for(int i = 1; i < m; i++) cout << (ma = max(a[i^mask].first + a[i^mask].second, ma)) << endl;
  return 0;
}


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


int main(){
    int n, b1 = 0, b2 = 0, b4 = 0;
    cin >> n;
    rep(i,n){
        ll a;
        cin >> a;
        if(a%4 == 0) b4++;
        else if(a%2 == 0) b2++;
        else b1++;
    }
    if(b2) b1++;
    cout << (b1 <= b4+1 ? "Yes\n" : "No\n");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    double ans = 0;
    int n,m;
    cin>>n>>m;
    int x = 1900 *  m + 100 * (n-m);
    cout<<x*(1<<m)<<endl;
    return 0;
}

Measured memory_bytes: 256
production = True

import sys, math, collections

def input(input_format = 0, multi = 0):

    if multi > 0: return [input(input_format) for i in range(multi)]
    else:
        next_line = sys.stdin.readline()[:-1]

        if input_format >= 10:
            use_list = False
            input_format = int(str(input_format)[-1])
        else: use_list = True

        if input_format == 0: formatted_input = [next_line]
        elif input_format == 1: formatted_input = list(map(int, next_line.split()))
        elif input_format == 2: formatted_input = list(map(float, next_line.split()))
        elif input_format == 3: formatted_input = list(next_line)
        elif input_format == 4: formatted_input = (lambda x: [x[0], list(map(int, x[1:]))])(next_line.split())
        elif input_format == 5: formatted_input = (lambda x: [x[0], list(map(float, x[1:]))])(next_line.split())
        elif input_format == 6: formatted_input = next_line.split()
        else: formatted_input = [next_line]

        return formatted_input if use_list else formatted_input[0]


def out(output_line, output_format = 0, newline = True):

    formatted_output = ""

    if output_format == 0: formatted_output = str(output_line)
    elif output_format == 1: formatted_output = " ".join(map(str, output_line))
    elif output_format == 2: formatted_output = "\n".join(map(str, output_line))

    print(formatted_output, end = "\n" if newline else "")


def log(*args):
    if not production:
        print("$$$", end = "")
        print(*args)

enum = enumerate

#
#   >>>>>>>>>>>>>>> START OF SOLUTION <<<<<<<<<<<<<<
#

p = []

def seive(n):
    global p

    p = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            p[j] += 1

def solve():

    n = input(11)

    seive(n)
    t = sum(map(lambda a: a[0] * a[1], enum(p)))

    out(t)
    
    return


#for i in range(input(11)): solve()
solve()

#
#   >>>>>>>>>>>>>>>> END OF SOLUTION <<<<<<<<<<<<<<<
#


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

inline int gcd(int a,int b){
    while(b){
        a=a%b;
        swap(a,b);
    }
    return a;
}

typedef long long ll;
const int mod=1000000007;

ll qpow(ll a,ll n){
    ll res=1;
    while(n){
        if(n&1)res=res*a%mod;
        a=a*a%mod;
        n>>=1;
    }
    return res;
}

int n,k,ans;
int cnt[100005];

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>k;
    for(int i=1;i<=k;i++){
        for(int j=1;j*j<=i;j++){
            if(i%j==0){
                if(j*j!=i)cnt[i/j]++;
                cnt[j]++;
            }
        }
    }
    for(int i=k;i>=1;i--){
        cnt[i]=qpow(cnt[i],n);
        for(int j=i+i;j<=k;j+=i){
            cnt[i]=(cnt[i]-cnt[j]+mod)%mod;
        }
        ans=(ans+(ll)cnt[i]*i%mod)%mod;
    }
    cout<<ans<<endl;

    return 0;
}

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

typedef long long ll;

int main() {
    int X, Y, T, K;
    cin >> X >> Y;
    T = (4 * X - Y) / 2;
    K = X - T;
    if (T * 2 + K * 4 == Y && T >= 0 && K >= 0) cout << "Yes\n";
    else cout << "No\n";
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    for(int i=1;i<10;i++){
    	for(int j=1;j<10;j++){
    		if(i*j==N){
    			cout << "Yes" << endl;
    			return 0;
    		}
    	}
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int n, t;
int cost[100], times[100];
int main()
{
  cin >> n >> t;
  int cnt = 1000000;
  for (int i = 0;i<n;i++)
  {
    cin >> cost[i] >> times[i];
    if(cost[i]<cnt && times[i]<=t)
      cnt = cost[i];
  }
  if(cnt==1000000)
    cout << "TLE" << endl;
  else
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int nCr(int n)
{
	return (n*(n-1))/2;
}
int main()
{
	int n,m;
	cin>>n>>m;
	long long N,M;
	if(n<2)
	N=0;
	else
	N=nCr(n);
	if(m<2)
	M=0;
	else
	M=nCr(m);
	cout<<(N+M)<<"\n";
	
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
//#include<cstdio>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cassert>
using namespace std;
typedef long long ll;
const int Nmax = 100;
int N;
ll X, A[Nmax];

int main(){
	cin >> N >> X;
	for(int i=0; i<N; i++) cin >> A[i];

	ll sum = 0;
	for(int i=0; i<N; i++) sum += A[i];
	if(sum == X){
		cout << N << endl;
		return 0;
	}
	if(sum <= X){
		cout << N-1 << endl;
		return 0;
	}

	sort(A, A+N);

	sum = 0;
	for(int i=0; i<N; i++){
		sum += A[i];
		if(sum > X){
			cout << i << endl;
			return 0;
		}
	}

	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [int(a) for a in input().split(" ")]
B = [int(b) for b in input().split(" ")]
C = [int(c) for c in input().split(" ")]

A.sort()
B.sort()
C.sort()

combiBC = [0] * len(B)
# combiBC[i] : number of combination of B, C when B[i] is selected

ic = 0
lc = len(C)
for ib in range(len(B)):
	b = B[ib]
	while ic < lc:
		c = C[ic]
		if b >= c:
			ic += 1
		else:
			combiBC[ib] = lc - ic
			break

sumCombiBC = []
for i in range(len(combiBC)):
	if i == 0:
		sumCombiBC.append(combiBC[-1])
	else:
		sumCombiBC.insert(0, combiBC[-i-1] + sumCombiBC[0])

cnt = 0
ib = 0
for ia in range(len(A)):
	a = A[ia]
	while ib < len(B):
		b = B[ib]
		if a >= b:
			ib += 1
		else:
			cnt += sumCombiBC[ib]
			break

print(cnt)

Measured memory_bytes: 30324
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();

    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut oks = vec![true; 100010]; 
    let sosuu: u64 = 1000000007;

    for _i in 0..m {
        let a: usize = read();
        oks[a] = false;
    }

    let mut dp: [u64; 100010] = [0; 100010];
    dp[0] = 1;

    for now in 0..n { //配るDP
        for next in now + 1 .. std::cmp::min(n, now+2) + 1 { //+1,+2へ配る
            if oks[next] == true {
                dp[next] += dp[now];
                dp[next] %= sosuu;
            }
        }
    }
    
    /*
    for i in 0..n+1{
        println!("{} : {}", i, dp[i]);
    }
    */

    println!("{}", dp[n]);
}


Measured memory_bytes: 5116
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<vector>
#include <algorithm>
#include<deque>
#include<queue>
#include<set>
#include <functional>
#include <cmath>


//マクロ
/*動かない・・・
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define REP(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _roverload3(_1,_2,_3,name,...) name
#define _rrep(i,n) repi(i,0,n)
#define rrepi(i,a,b) for(int i=int(a);i<int(b);++i)
#define RREP(...) _roverload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
//*/
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
#define REPS(i,n) for(int i=1; i<=(int)(n); ++i)
#define RREP(i,n) for(int i=(int)(n)-1; i>=0; --i)
#define RREPS(i,n) for(int i=(int)(n); i>0; --i)
#define FOR(i,s,e) for(int i=(int)(s); i<(int)(e); ++i)
#define RFOR(i,s,e) for(int i=(int)(e)-1; i>=(int)(s); --i)
//*/
#define All(a) (a).begin(),(a).end()
#define dump(x)  cerr << #x << " = " << (x) << endl;

//定数
#define INF 1e9
#define MOD (int)(1e9+7)

typedef long long ll;
typedef unsigned long long ull;
/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
//*/
using namespace std;

//とりあえず書いておく変数
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

//今回の変数
int n;
int p, q;
int idx;
int num[50000];
bool f[8];
int ans;

//使用する関数
template<class T>bool chmax(T &a, const T &b) {
	if (a < b) { a = b; return 1; }
	return 0;
}
template<class T>bool chmin(T &a, const T &b) {
	if (a > b) { a = b; return 1; }
	return 0;
}
int kaijo(int k) {
	if (k == 1)return k;
	return k*kaijo(k - 1);
}
void dfs(int d,int a, int b) {
	//printf("d%d a%d b%d\n", d, a, b);
	a *= 10;
	a += b;
	if (d == n) {
		//printf("num[%d]=%d\n", idx, a);
		num[idx++] = a;
		return;
	}
	REPS(i, n) {
		if (!f[i-1]) {
			f[i-1] = true;
			dfs(d + 1, a, i);
			f[i-1] = false;
		}
	}
	return;
}

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

	cin >> n;
	int len = kaijo(n);
	REP(i, n) {
		f[i] = false;
	}
	dfs(0,0,0);
	REP(i, n) {
		p *= 10;
		int t;
		cin >> t;
		p += t;
	}
	REP(i, n) {
		q *= 10;
		int t;
		cin >> t;
		q += t;
	}
	REP(i, len) {
		//printf("%d\n", num[i]);
		if (p == num[i]) {
			ans = i;
			break;
		}
	}
	REP(i, len) {
		if (q == num[i]) {
			ans -= i;
			break;
		}
	}
	cout << abs(ans) << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <math.h>
using namespace std;

int main(){
	
	while(1){
		
		int n,s[100],m=1000,M=0,sum=0;
		cin>>n;
		if(n==0)break;
		
		for(int i=0;i<n;i++)cin>>s[i];
		
		for(int i=0;i<n;i++){
			sum+=s[i];
			if(s[i]<m)m=s[i];
			if(s[i]>M)M=s[i];
		}
		
		cout<<(sum-m-M)/(n-2)<<endl;
	}
	return 0;
}

Measured memory_bytes: 0