akhauriyash/Code-Regression huggingface dataset:
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int32_t main()
{
    FIO 
    int x; cin>>x;
    cout<<1-x<<"\n";
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

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

template<typename CommutativeMonoid>
class BIT{
public:
	using value_type = CommutativeMonoid;

private:
	std::vector<value_type> tree;
	size_t N;

public:
	BIT(){}
	BIT(const size_t& N):N(N+1), tree(N+1, value_type(0)){}
	BIT(const BIT& bit):tree(bit.tree), N(bit.N){}

	void update(size_t k, const value_type& diff){
		for(;k <= N;k += k & -k){
			tree[k] = tree[k]+diff;
		}
	}

	value_type query(size_t k) const { // sum of [0, k)
		value_type res = value_type();
		for(;k > 0;k -= k & -k){
			res = res + tree[k];
		}
		return res;
	}

	void updatez(size_t k, value_type v){ // 0-indexed
		update(k+1, v);
	}

	size_t search(std::function<bool(value_type)>& f) const { // Find k :[0, k) -> True, [0, k-1) -> False
		if(f(value_type()))
			return 0;
		if(!f(query(N)))
			return N+1;
		value_type x;
		size_t k = 1, idx = 0;
		while(k <= N) k <<= 1;
		k >>= 1;
		while(k >>= 1){
			if((idx|k) <= N && !f(tree[idx|k]+x))
				x = x + tree[idx|=k];
		}
		return idx+1;
	}

	size_t size() const {return N;}
};

/*
	Fenwick Tree(Binary Indexed Tree)
	- typename CommutativeMonoid
		可換モノイド

		- 単位元 : デフォルトコンストラクタ
		- 演算   : operator+
*/

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

	int_fast64_t n, q;
	scanf("%lld%lld", &n, &q);
	BIT<int_fast64_t> bit(n);
	for(int32_t i = 0;i < q;i++){
		int64_t com, x, y;
		scanf("%lld%lld%lld", &com, &x, &y);
		if(com == 0){
			bit.update(x, y);
		}else{
			printf("%lld\n", bit.query(y)-bit.query(x-1));
		}
	}
}



Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int ym = sc.nextInt();

		int i1 = ym/100;
		int i2 = ym%100;
		if(i1 >= 1 && i1 <= 12){
			if(i2 >= 1 && i2 <=12){
				System.out.println("AMBIGUOUS");
			}else{
				System.out.println("MMYY");
			}
		}else{
			if(i2 >= 1 && i2 <=12){
				System.out.println("YYMM");
			}else{
				System.out.println("NA");
			}
		}
	}
}

Measured memory_bytes: 23764
N,T=map(int,input().split())
paths=[]
for i in range(N):
  c,t=map(int,input().split())
  paths.append([c,t])

s_path=float('inf')

for i in paths:
  if i[1]<=T:
    s_path=min(s_path,i[0])

if s_path == float('inf'):
  print('TLE')
else:
  print(s_path)




Measured memory_bytes: 3060
fn main() {
    let n = readln();
    let a: Vec<usize> = readln();
    let mut b: Vec<(usize, usize)> = vec![];

    let mut i = 0;
    while i < n {
        if a[i] == 0 {
            let mut j = i;
            while j < n && a[j] == 0 {
                j += 1;
            }
            b.push((0, j - i));
            i = j - 1;
        } else {
            b.push((a[i], 1));
        }
        i += 1;
    }
    let mut answer = 0usize;
    for i in 0..b.len() {
        for k in 0..b[i].1 {
            let mut sum = 0;
            let mut f = 0;
            for j in i..b.len() {
                sum += b[j].0;
                f = f ^ b[j].0;
                if sum != f {
                    break;
                }
                if j == i {
                    answer += b[j].1 - k;
                } else {
                    answer += b[j].1;
                }
            }
        }
    }
    println!("{}", answer);
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(String, bool, f32, f64, isize, i8, i16, i32, i64, usize, u8, u16, u32, u64);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


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

int main() {
	int x;
  cin >> x;
  if (x >= 400 && x <= 599){
    cout << '8';
  }
  if (x >= 600 && x <= 799){
    cout << '7';
  }
  if (x >= 800 && x <= 999){
    cout << '6';
  }
  if (x >= 1000 && x <= 1199){
    cout << '5';
  }
  if (x >= 1200 && x <= 1399){
    cout << '4';
    
  }
  if (x >= 1400 && x <= 1599){
    cout << '3';
    
  }
  if (x >= 1600 && x <= 1799){
    cout << '2';
    
  }
  if (x >= 1800 && x <= 1999){
    cout << '1';
    
  }
	return 0;
}


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

    #define ll long long
    #define pb push_back
    #define mod 1000000007

    int main() {
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
      cout.tie(NULL);
      
      ll n; cin>>n;
      ll i,j,B[n+1],A[n];
      for(i=0;i<=n;i++){
        cin>>B[i]; 
      }
      for(i=0;i<n;i++)cin>>A[i];
      ll ans=0;
      for(i=n-1;i>=0;i--){
        // ll a=abs(A[i]-B[i+1]);
        if(A[i]>B[i+1]){
          A[i]-=B[i+1];
          ans+=B[i+1];
          if(A[i]>B[i]){
            ans+=B[i];
            B[i]=0;
          }else{
            ans+=A[i];
            B[i]-=A[i];
          }
        }else{
            B[i+1]-=A[i];
            ans+=A[i];          
        }
        // cout<<ans<<" "<<A[i]<<" ";
        // for(int j=0;j<=n;j++)cout<<B[j]<<"* ";
      }

      cout<<ans;

      return 0;
    } 


    

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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;}

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    REP(i,n){
        cin >> a[i];
    }
    ll ans=0;
    REP(i,n){
        ans+=a[i]/2;
        a[i]%=2;
        if(a[i]==1&&i!=n-1&&a[i+1]!=0){
            a[i]--;
            a[i+1]--;
            ans++;
        }
    }
    cout << ans << endl;
}

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

int judge(int i) {
  int r;
  if(i == 1) return 1;
  else return 0;
}

int main() {
  string a; cin >> a;
  string s1, s2, s3;
  s1 = a[0]; s2 = a[1]; s3 = a[2];

  int r;
  r += judge(stoi(s1));
  r += judge(stoi(s2));
  r += judge(stoi(s3));
  cout << r << endl;
}


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

int main() {
    int N, K, d, A;
    bool ok[103];

    cin >> N >> K;

    memset(ok, false, sizeof(ok));
    for (int i = 1; i <= K; i++) {
        cin >> d;
        for (int j = 1; j <= d; j++) {
            cin >> A;
            ok[A] = true;
        }
    }

    int answer = 0;
    for (int i = 1; i <= N; i++) {
        if (!ok[i])
            answer += 1;
    }

    cout << answer << endl;
}


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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair

ll dp[3002][3002][2];

int main() {
  int n, m;
  cin >> n >> m;
  
  rep (i, n + 1) {
    if (i == 0) dp[0][i][1] = 1;
    else dp[0][i][0] = 1;
  }

  rep (i, m) {
    rep (r, n + 1) {
      int b = n - r;
      if (r > 0) {
        if (r == 1) {
          (dp[i + 1][r][1] += dp[i][r][0]) %= MOD;
          (dp[i + 1][r - 1][1] += dp[i][r][0]) %= MOD;
        }
        else {
          (dp[i + 1][r][0] += dp[i][r][0]) %= MOD;
          (dp[i + 1][r - 1][0] += dp[i][r][0]) %= MOD;
        }
        (dp[i + 1][r][1] += dp[i][r][1]) %= MOD;
        (dp[i + 1][r - 1][1] += dp[i][r][1]) %= MOD;        
      }
      if (b > 0) {
        (dp[i + 1][r][0] += dp[i][r][0]) %= MOD;
        (dp[i + 1][r + 1][0] += dp[i][r][0]) %= MOD;
        (dp[i + 1][r][1] += dp[i][r][1]) %= MOD;
        (dp[i + 1][r + 1][1] += dp[i][r][1]) %= MOD;
      }
    }
  }
  ll ans = 0;
  rep (i, n + 1) {
    (ans += dp[m][i][1]) %= MOD;
  }
  cout << ans << endl;
}


Measured memory_bytes: 141056
/// Zhupengfei 2018
/// Hereby declare: this program is in public domain.

/// Solution for problem:

#include <bits/stdc++.h>

#ifdef LOCAL
#pragma GCC poison printf // To avoid fastio problems
#pragma GCC poison scanf
#endif

typedef std::pair<int, int> P;

namespace std{
template<>
struct hash<P> {
    size_t operator()(const P& pair) const {
        size_t hashv = pair.first;
        hashv=hashv*1000001 + pair.second;
        return hashv;
    }
};
}

using namespace std;



int dists[800005]={};
unordered_map<P, int> idx;
vector<P> vert;
int siz=0;
vector<int> clist;

struct rec{
    int u, v;
};

vector<rec> sons[800005]={};
vector<rec> tmpsons[100001]={};
unordered_map<P, vector<int> > sonswiththesamec={};
bool v[100001]={};

void dijkstra(int s) {
    priority_queue<P,vector<P>,greater<P> > que;
    dists[s] = 0;
    que.push(P(0,s));
    while(!que.empty())
    {
        P p = que.top(); que.pop();
        int v = p.second;
        if (dists[v] < p.first) continue;
        for(int i = 0; i < sons[v].size(); i++)
        {
            auto e = sons[v][i];
            if (dists[e.u] > dists[v] + e.v)
            {
                dists[e.u] = dists[v] + e.v;
                que.push(P(dists[e.u],e.u));
            }
        }
    }
}

inline void put(int q, int c) {
    //cout<<"trying to put "<<q<<","<<c<<" in"<<endl;
    auto x = make_pair(q, c);
    if(!idx.count(x)) {
        idx.emplace(x, ++siz);
        vert.push_back(x);
    }
} 

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
    int N, M;
    cin>>N>>M;
    put(1, 0);
    put(N, 0);
    int p, q, c;
    for(int i=1;i<=M;i++) {
        cin>>p>>q>>c;
        put(p, c+1);
        put(q, c+1);
        put(p, 0);
        put(q, 0); 
        tmpsons[p].push_back({q, c+1});
        tmpsons[q].push_back({p, c+1});
        sonswiththesamec[{p, c+1}].push_back(q);
        sonswiththesamec[{q, c+1}].push_back(p); 
    }
    
    for(const auto& it: vert) {
        sons[idx[it]].push_back({idx[{it.first, 0}], 0});
        for(const auto& itit: sonswiththesamec[it]) {
            
            sons[idx[it]].push_back({idx[{itit, it.second}], 0});
        }
        if(!v[it.first]) {
            for(const auto& itit : tmpsons[it.first]) sons[idx[{it.first, 0}]].push_back({idx[{itit.u, itit.v}], 1});
            v[it.first]=1;
        }
    }
    memset(dists, 0x7f, sizeof(dists));
    // do an inversed dijkstra
    dijkstra(idx[{1, 0}]);
    int ans=dists[idx[{N, 0}]];
    cout<<(ans==0x7f7f7f7f?-1:ans)<<endl;
	return 0;
}



Measured memory_bytes: 131288
/// Author: Sarfaraz Alam
# include <bits/stdc++.h>
# define pb push_back
# define ll long long

# define fi first
# define se second
# define all(vc) vc.begin(),vc.end()
# define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
# define DEBUG
typedef unsigned long long int ull;
using namespace std;
#include<string>
#include<cmath>
const int N = 1e5 + 7;
const int mod = 1e9 + 7;


int main()
{
    speed;
    #ifdef DEBUGfd
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif // DEBUG

    //Code begins
    deque<int> s;
    int n;
    cin>>n;
    int str[n];
    for(int i = 0; i<n; i++)
    cin>>str[i];

    s.push_back(str[0]);

    int turn  = 0;
    for(int i = 1; i<n; i++)
    {
      if(turn == 0)
      {s.push_front(str[i]);
        turn = 1;}

        else if(turn == 1)
        {
          s.push_back(str[i]);
          turn = 0;

        }
    }
    int reverse = 0;
    if(n%2 == 1)
    {
      reverse = 1;
    }

    if(reverse == 0){
    for(auto l: s)
    {
      cout<<l<<" ";
    }
    cout<<endl;}
    else
    {
      for(int i = n-1; i>=0; i--)
      {
        cout<<s[i]<<" ";
      }
      cout<<endl;
    }






    return 0;
}


Measured memory_bytes: 3840
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int n;
  int k;
  cin >> n >> k;
  int a[n];
  for(int i=0; i<n; i++){
    cin >> a[i];
  }
  int count = 0;
  n -= k;
  count++;
  while(n > 0){
    n -= k-1;
    count++;
  }
  
  cout << count << endl;
  
  return 0;
}


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

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

  int cnt = 0;
  for (int i = 0; i < n - 2; i++) {
    if (s[i] == 'A') {
      if (s[i + 1] == 'B' && s[i + 2] == 'C') {
        cnt++;
        i += 2;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define forN(n, N) for(int n=0; n<N; n++)
#define res_out(ans) cout << ans << "\n";
#define ll long long

int A[int(1e6)+1];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K;
    cin >> N >> K;
    forN(n,N)cin >> A[n];
    int ans;
    float di;
    di = (N - 1.0) / (K - 1.0);
    ans = di;
    if(ans != di)ans++;
    res_out(ans)
    return 0;
}

Measured memory_bytes: 1020
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <functional>
#include <climits>
#include <cmath>
#include <utility>
#include <iomanip>

using namespace std;


int main(int argc, char *argv[])
{
	int n, r;

	//input
	cin >> n >> r;


	//calc
	int ans;
	if (10 <= n){
		ans = r;
	}
	else{
		ans = r + 100 * (10 - n);
	}


	//ans
	cout << ans << endl;



	return 0;
}


Measured memory_bytes: 256
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define koto_memory(a) cout<<(sizeof(a)/1048576.0)<<" MB";
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using vi = std::vector<int>;
using vvi = std::vector<vi>;
using pii = std::pair<int,int>;
using vpii = std::vector<pii>;
using vvpii = std::vector<vpii>;
#define mp         make_pair
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define per(i,b,a) for (int i = b; i >= a; i--)
#define all(x)     x.begin(), x.end()
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/1e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int sp[(int)1e7+2LL];
bool v[(int)1e7+2LL];
void Sieve(){
  for (int i = 2; i < 1e7+1; i += 2)  sp[i] = 2;//even numbers have smallest prime factor 2
  for (int  i = 3; i < 1e7+1; i += 2){
    if (!v[i]){
      sp[i] = i;
      for (int j = i; (j*i) < 1e7+1; j += 2){
        if (!v[j*i])  v[j*i] = true, sp[j*i] = i;
      }
    }
  }
}
void solve(){
  int n;cin>>n;
  Sieve();
  int cnt=0;
  rep(i,1,n){
    int t=1,j=i;
    while(1){
      int spf=sp[j],c=0;
      if(sp[j]==0)break;
      while((j%spf)==0)j/=spf,c++;
      t*=c+1;
      if(j==1)break;
    }
    cnt+=t*i;
  }
  cout<<cnt;
}
int32_t main()
{
  ibs;cti;
  solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  // int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

Measured memory_bytes: 91488
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll N, W;
    cin >> N >> W;
    vector<ll>dp(101010, 1145141919);
    dp[0] = 0;
    ll ans = 0;
    for(ll i = 0; i < N; i++){
        ll w, v;
        cin >> w >> v;
        for(ll to = 101000; to >= 0; to--){
            ll from = to - v;
            if(from < 0)break;
            dp[to] = min(dp[to], dp[from] + w);
            if(dp[to] <= W)ans = max(ans, to);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb   push_back
#define pt(x)  cout<<x<<endl;
#define T int time;        scanf("%d", &time); while(time--)
    struct aray{
        ll a,b;
    };
//aray a[10000],b[100000];
int main(){
     //T{
     ll r ;
     cin >> r;
     r ^= 1;
     cout << r << endl;
        
} 

Measured memory_bytes: 3512
#pragma GCC optimize ("O3")

#include <cstdio>
using namespace std;

int main() {
    const int m_max = 200000;
    const int q_max = 100000;

    int N, M, Q;
    scanf("%d%d%d", &N, &M, &Q);

    short L[m_max], R[m_max];

    for (int i = 0; i < M; i++) {
        scanf("%hd%hd", &L[i], &R[i]);
    }

    int ans[q_max];
    short p[q_max], q[q_max];

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

    for (int i = 0; i < Q; i++) {
        scanf("%hd%hd", &p[i], &q[i]);
    }

    const int Q1 = Q / 6 * 6;
  
    for (int i = 0; i < Q1; i += 6) {
        for (int j = 0; j < M; j++) {
            ans[i] += (p[i] <= L[j] & R[j] <= q[i]);
            ans[i + 1] += (p[i + 1] <= L[j] & R[j] <= q[i + 1]);
            ans[i + 2] += (p[i + 2] <= L[j] & R[j] <= q[i + 2]);
            ans[i + 3] += (p[i + 3] <= L[j] & R[j] <= q[i + 3]);
            ans[i + 4] += (p[i + 4] <= L[j] & R[j] <= q[i + 4]);
            ans[i + 5] += (p[i + 5] <= L[j] & R[j] <= q[i + 5]);
        }
    }
  
    for (int i = Q1; i < Q; i++) {
        for (int j = 0; j < M; j++) {
            ans[i] += (p[i] <= L[j] & R[j] <= q[i]); 
        }
    }

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


Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int h,w,n,a[1010],b[1010];
int s=0;
int main()
{
	cin>>n>>h>>w;
	for(int i=0;i<n;i++)
	{
		cin>>a[i]>>b[i];
		if(a[i]>=h&&b[i]>=w)
		s++;
	}
	cout<<s;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
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;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


int X,Y,A,B,C;
vector<ll> p,q,r;
vector<ll> pq;

int main() {
  cin >>X >>Y >>A >>B >>C;
  p.assign(A, 0); q.assign(B, 0); r.assign(C, 0);
  rep(i, A) cin >>p[i]; rep(i, B) cin >>q[i]; rep(i, C) cin >>r[i];
  sort(all(p)); reverse(all(p)); sort(all(q)); reverse(all(q)); sort(all(r)); reverse(all(r));
  pq.assign(X+Y, 0);
  rep(i, X) pq[i] = p[i]; rep(i, Y) pq[X+i] = q[i];
  sort(all(pq));
  // pqにはp,qから各々X,Y個大きい順に取ってきたものが昇順に格納されている
  ll res = 0;
  rep(i, X+Y) res += pq[i];

  for (int i=0; i<min(X+Y, C); i++){
    if (pq[i] < r[i]){
      res -= pq[i]; res += r[i];
    }else{
      break;
    }
  }
  cout <<res <<endl;
}

/*
0 1 2 3 4 5 6 7 8

*/

Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int m = scan.nextInt();

		if (n == m) System.out.println("Yes");
		else System.out.println("No");

		scan.close();
	}
}


Measured memory_bytes: 23764
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
	int N;
	cin >> N;
	pair<pair<string, int>, int> rest[N];
	for(int i=0; i<N; ++i) {
		string S;
		int A, B;
		cin >> S >> A;
		rest[i] = make_pair(make_pair(S, -A), i);
	}
	sort(rest, rest+N);
	for(int i=0; i<N; ++i) cout << rest[i].second+1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<cstdlib>
#include<list>
#include<set>
#include<numeric>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
	int N; cin >> N;
	vector<int> A(N);

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

	vector<int> B;

	B.push_back(0);
	B.push_back(1);

	for (int i = 1; i < N; i++) {
		if (A[i] != A[i - 1])
			B[B.size() - 1]++;
		else
			B.push_back(1);
	}
	B.push_back(0);

	int ans = 0;
	for (int i = 2; i < B.size(); i++) {
		ans = max(ans,B[i-2]+B[i-1]+B[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3456
#n=int(input())
n,m,X=map(int,input().split())
C=[]
A=[]

for i in range(n):
    x=list(map(int,input().split()))
    C.append(x[0])
    A.append(x[1:])

ans = 10**9
for x in range(2**n):
    v=[0 for _ in range(m)]
    p=x
    c=0
    for i in range(n):
        if p%2==1:
            c+=C[i]
            for j in range(m):
                v[j] += A[i][j]
        p//=2
    f=True
    for j in range(m):
        if v[j]<X:
            f = False
            break
    if f:
        ans = min(ans, c)

if ans==10**9:
    print("-1")
else:
    print(ans)
            
    
    

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

using namespace std;

int d[111111];

int main() {
    int n, c, m=0, r=0;
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> c;
        if(c <= 100000) {
            m = max(m,c);
            d[c]++;
        }
        else r++;
    }
    for(int i=1;i<=m;i++) {
        if(d[i] > i) r += (d[i]-i);
        else if(d[i] < i) r += d[i];
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{
	public static void main (String[] args) throws java.lang.Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
	    while(line!=null){
	        String[] lines = line.split(" ");
    	    long a = Integer.parseInt(lines[0]);
    	    long b = Integer.parseInt(lines[1]);
    	    long tmp_a = a;
    	    long tmp_b = b;
    	    
    	    if(a<b){
    	        long tmp = a;
    	        a = b;
    	        b = tmp;
    	    }
    	    long r=a%b;
    	    while(r!=0){
    	        a=b;
    	        b=r;
    	        r=a%b;
    	    }
    	    long GCD = b;
    	    System.out.print(GCD);
    	    System.out.print(" ");
    	    System.out.println((tmp_a*tmp_b)/GCD);
	        line = br.readLine();
	    }
	}
}

Measured memory_bytes: 24176
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define int long long
typedef long long ll;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
using namespace std;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main() {
  string s,t[16] = {
    "KIHBR",
    "KIHBRA",
    "KIHBAR",
    "KIHBARA",
    "KIHABR",
    "KIHABRA",
    "KIHABAR",
    "KIHABARA",
    "AKIHBR",
    "AKIHBRA",
    "AKIHBAR",
    "AKIHBARA",
    "AKIHABR",
    "AKIHABRA",
    "AKIHABAR",
    "AKIHABARA",
  };cin>>s;
  rep(i,16){
    if(s == t[i]){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
}

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

int main() {
	long long N, K, H;
	cin >> N >> K;
	vector<int> vec(N);
	long long total = 0;
	for (int i = 0; i < N; i++) {
		cin >> H;
		vec.at(i) = H;
	}
	sort(vec.begin(),vec.end());
	if (vec.size() <= K) {
		cout << 0 << endl;
	}
	else {
		for (int j = 0; j < N - K; j++) {
			total += vec.at(j);
		}
		cout << total << endl;
	}
}

Measured memory_bytes: 4020
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    let _=read::<i32>();
    let _=read::<i32>();
    let _=read::<i32>();
    let e=read::<i32>();
    let f=read::<i32>();
    println!("{}",if e-a>f{":("}else{"Yay!"})
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

	private static Scanner sc;

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		Integer n = sc.nextInt();
		int[] array = new int[n];
		int sum = 0;
		int result2 = 0;

		for (int i = 0; i < n; i ++) {
			array[i] = sc.nextInt();
			sum += array[i];
		}

		for (int i : array) {
			result2 += i * (sum - i);
		}

		int result = result2 / 2;
		System.out.println(result);
	}



}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
#define debugg(x) cout<<#x <<":"<< x << endl;
typedef  long long ull;
using namespace std;
#define  INF 1e9
int main()
{
     int N , K;
     cin >> N >> K ;
     int T[N+5];

     for(int i=1 ; i<=N ; i++)
     {
         cin >> T[i];
     }
     int dp[N+5];
     int j;
     dp[1]=0;
     for(int i=2  ; i<=N ; i++)
     {
         int mini =INF;
         int comp =1;
         for(int j=i-1 ; j >0 && comp<=K ; j--)
         {

             int res1 = abs(T[i] -T[j]) + dp[j];
             if(mini > res1)
             {
                 mini = res1;
             }
             comp ++;
         }
          dp[i] = mini;

     }

     cout << dp[N] << endl;



    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i=0;i<N;i++) cin >> A[i];
  int all;
  for (int i=0;i<N;i++) all += A[i];
  int all_p;
  for (int i=0;i<N;i+=2) all_p += 2*A[i];
  int pre = all_p-all;
  int fol;
  cout <<all_p-all;
  for (int i=0;i<N-1;i++) {
    fol = A[i]*2-pre;
    cout <<" "<<fol;
    pre = fol;
  }
  cout << "\n";
}

Measured memory_bytes: 1664
from collections import Counter

n = int(input())
A = list(map(int,input().split()))

A = Counter(A)
V = Counter(A.values())

if list(A.keys())==[0]:
    print('Yes')

elif len(A)==2:
    p,q = A.keys()
    if min(p,q)==0 and A[0]*2==A[max(p,q)]:
        print('Yes')
    else:
        print('No')

elif len(A)==3 and len(V)==1:
    p,q,r = A.keys()
    if p^q^r == 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 60784
def main():
	S = input().split("/")
	if S[0] == "#":
		return
	for s in range(len(S)):
		for i in range(10):
			S[s]= S[s].replace(str(i),"."*i)
	a,b,c,d = map(int,input().split())
	S[a-1] = S[a-1][:b-1]+"."+S[a-1][b:]
	S[c-1] = S[c-1][:d-1]+"b"+S[c-1][d:]
	for s in range(len(S)):
		ref = ""
		temp = 0
		for i in S[s]:
			if i == ".":
				temp += 1
			else:
				ref += (str(temp) if temp is not 0 else "") + "b"
				temp = 0
		S[s] = ref + (str(temp) if temp is not 0 else "")
	print("/".join(S))
	main()
	return
main()


Measured memory_bytes: 5616
/* Dynamic Programming implementation of LCS problem */
#include<iostream>
#include<cstring>
#include<cstdlib>
using namespace std;

/* Returns length of LCS for X[0..m-1], Y[0..n-1] */
void lcs( string s , string t, int m, int n )
{
  int L[m + 1][n + 1];

  /* Following steps build L[m+1][n+1] in bottom up fashion. Note
    that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] */
  for (int i = 0; i <= m; i++)
  {
    for (int j = 0; j <= n; j++)
    {
      if (i == 0 || j == 0)
        L[i][j] = 0;
      else if (s[i - 1] == t[j - 1])
        L[i][j] = L[i - 1][j - 1] + 1;
      else
        L[i][j] = max(L[i - 1][j], L[i][j - 1]);
    }
  }

// Following code is used to print LCS
  int index = L[m][n];

// Create a character array to store the lcs string
  char lcs[index + 1];
  lcs[index] = '\0'; // Set the terminating character

// Start from the right-most-bottom-most corner and
// one by one store characters in lcs[]
  int i = m, j = n;
  while (i > 0 && j > 0)
  {
    // If current character in X[] and Y are same, then
    // current character is part of LCS
    if (s[i - 1] == t[j - 1])
    {
      lcs[index - 1] = s[i - 1]; // Put current character in result
      i--; j--; index--;   // reduce values of i, j and index
    }

    // If not same, then find the larger of two and
    // go in the direction of larger value
    else if (L[i - 1][j] > L[i][j - 1])
      i--;
    else
      j--;
  }

// Print the lcs
  cout <<  lcs << endl;
}

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif*/
}

int main()
{
  c_p_c();

  string s, t;

  cin >> s >> t;


  int m = s.length();
  int n = t.length();
  lcs(s, t, m, n);
  return 0;
}


Measured memory_bytes: 38804
//============================================================================
// Name        : beginner079.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : atcorder ABC077 in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

using namespace std;

inline int main003();

int main() {

		main003();

	return 0;
}


inline int main003() {

	string num;
	int temp;
	int array[4];

	cin >> num;

	temp = atoi(num.c_str());
	array[0] = temp / 1000;
	array[1] = (temp / 100)%10;
	array[2] = (temp / 10)%10;
	array[3] = temp % 10;


	if (array[0] + array[1] + array[2] + array[3] == 7) {
		cout << array[0] << '+' << array[1] << '+' << array[2] << '+'
				<< array[3] << "=7";
	} else if (array[0] - array[1] + array[2] + array[3] == 7) {
		cout << array[0] << '-' << array[1] << '+' << array[2] << '+'
				<< array[3] << "=7";
	} else if (array[0] + array[1] - array[2] + array[3] == 7) {
		cout << array[0] << '+' << array[1] << '-' << array[2] << '+'
				<< array[3] << "=7";
	} else if (array[0] - array[1] - array[2] + array[3] == 7) {
		cout << array[0] << '-' << array[1] << '-' << array[2] << '+'
				<< array[3] << "=7";
	} else if (array[0] + array[1] + array[2] - array[3] == 7) {
		cout << array[0] << '+' << array[1] << '+' << array[2] << '-'
				<< array[3] << "=7";
	} else if (array[0] - array[1] + array[2] - array[3] == 7) {
		cout << array[0] << '-' << array[1] << '+' << array[2] << '-'
				<< array[3] << "=7";
	} else if (array[0] + array[1] - array[2] - array[3] == 7) {
		cout << array[0] << '+' << array[1] << '-' << array[2] << '-'
				<< array[3] << "=7";
	} else if (array[0] - array[1] - array[2] - array[3] == 7) {
		cout << array[0] << '-' << array[1] << '-' << array[2] << '-'
				<< array[3] << "=7";
	}

	return 0;
}


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

const ll MOD = (ll)1e9 + 7;

template <typename T>
ostream& operator<< (ostream& os, const vector<T>& vec) {
    os << "[ ";
    for (int i = 0; i < vec.size(); i++) {
        os << vec.at(i) << " ";
    }
    os << "]" << "\n";
}

unordered_map<ll, int> prime_factorize(ll num) {
    unordered_map<ll, int> count;
    int i = 2;
    while (i * i <= num) {
        if (num % i == 0) {
            int cnt = 0;
            while (num % i == 0) {
                cnt += 1;
                num /= i;
            }
            count[i] = cnt;
        }
        i += 1;
    }
    if (num != 1) {
        count[num] = 1;
    }
    return count;
}

ll intpow(ll num, ll e) {
    ll result = 1, cur_num = num;
    while (e) {
        if (e & 1) {
            result *= cur_num;
            result %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return result;
}

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

    // execute prime factorization.
    unordered_map<ll, int> prime_counts = prime_factorize(M);

    // derive factorials and the inverses of them to calculate combinations.
    vector<ll> factorials(N + 100, 1);
    for (int i = 1; i < factorials.size(); i++) {
        ll prev = factorials.at(i - 1);
        factorials.at(i) = prev * i % MOD;
    }

    vector<ll> inv_factorials(N + 100, 1);
    for (int i = 1; i < inv_factorials.size(); i++) {
        ll fact = factorials.at(i);
        ll inv_fact = intpow(fact, MOD - 2);
        inv_factorials.at(i) = inv_fact;
    }

    // calculate combinations.
    ll total_num_combinations = 1;
    for (auto it = prime_counts.begin(); it != prime_counts.end(); it++) {
        ll prime = it->first, count = it->second;
        // cout << prime << " " << count << "\n";
        ll num_combinations = factorials.at(N + count - 1) * inv_factorials.at(N - 1) % MOD;
        num_combinations *= inv_factorials.at(count);
        num_combinations %= MOD;
        total_num_combinations *= num_combinations;
        total_num_combinations %= MOD;
    }
    cout << total_num_combinations << "\n";
}


Measured memory_bytes: 1792
N,M = map(int,input().split(" "))
dic = {}
for i in range(M):
    P,Y = map(int,input().split(" "))
    if not P in dic: 
        dic[P] = [(Y,i)]
    else:
        dic[P].append((Y,i))

ans = [0] * M
for key in dic.keys():
    dic[key].sort(key=lambda x:x[0])
    l = len(dic[key])
    for i in range(l):
        ans[dic[key][i][1]] = (key,i+1)

for i in range(len(ans)):
    print('{:0=6}'.format(ans[i][0]) + '{:0=6}'.format(ans[i][1]))



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

int main() {

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

  string s;
  cin >> s;

  int n = s.size();
  int dp[n+1][2];
  memset(dp, 0x3f, sizeof dp);
  dp[n][0] = 0;
  dp[n][1] = 10;

  for (int i = n-1; i >= 0; --i) {
    int d = s[i] - '0';
    dp[i][0] = min(d, 11 - d) + dp[i+1][0];
    dp[i][0] = min(dp[i][0],  min(d+1, 10-d) + dp[i+1][1]);
    dp[i][1] = 10 - d + dp[i+1][0];
    dp[i][1] = min(dp[i][1], 10 - d - 1 + dp[i+1][1]);
  }

  cout << dp[0][0] << '\n';
}


Measured memory_bytes: 9116
import java.util.Scanner;

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

        Scanner as = new Scanner(System.in);
        int S = as.nextInt();

        int m=S/60;
        int h=m/60;
        int s=S%60;
        m=m%60;
        
 
        System.out.println(h+":"+m+":"+s);
 
 
   }
 
 
}

Measured memory_bytes: 26168
n,m=map(int, input().split())
l=[]
zero=[]
one=[]
for i in range(m):
  l.append(list(map(int, input().split())))
for i in range(m):
  zero.append(l[i][0])
  one.append(l[i][1])
print(max(min(one)-max(zero)+1,0))




Measured memory_bytes: 29080
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
string print(string, int, int);
string reverse(string, int, int);
string replace(string, int, int, string);

string print(string str, int a,int b) {
  string ans="";
  for(int i = a; i < b+1; i++) {
    ans += str[i];
  }
  return ans ;
}
string reverse(string str, int a, int b) {
  string ans="";
  REP(i,a) {
    ans+=str[i];
  }
  for(int i=b;i>=a;i--) {
    ans+=str[i];
  }
  for(int i=b+1;i < str.length();i++) {
    ans+=str[i];
  }
  return ans;
}
string replace(string str, int a, int b, string p) {
  string ans="";
  REP(i,str.length()) {
    if(a<=i&&i<=b) {
      ans+=p[i-a];
    } else {
      ans+=str[i];
    }
  }
  return ans;
}

int main() {
  static const double pi = 3.141592653589793;
  double a,b,c,C;
  cin >> a >> b >> C;
  C = C*pi/180;
  c = sqrt(a*a+b*b-2*a*b*cos(C));
  double S = 0.0, L = 0.0, h = 0.0;
  S = a*b*sin(C)/2.0;
  L = a + b + c;
  h = b*sin(C);
  cout << setprecision(8) << S << endl;
  cout << setprecision(8) << L << endl;
  cout << setprecision(8) << h << endl;
  
  return 0;
}



Measured memory_bytes: 3448
sx,sy,tx,ty = [int(x) for x in input().split()]
m1 = 'U'*(ty-sy)+'R'*(tx-sx)
m2 = 'D'*(ty-sy)+'L'*(tx-sx)
m3 = 'D'+'R'*(tx-sx+1)+'U'*(ty-sy+1)+'L'
m4 = 'U'+'L'*(tx-sx+1)+'D'*(ty-sy+1)+'R'
print(m1+m2+m3+m4)


Measured memory_bytes: 3068
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		int gc = 0, pc = 0, score =0;
		for(int i=0;i<S.length();i++){
			if(pc < gc){
				if(S.charAt(i)=='g'){
					score++;
					pc++;
				}else{
					pc++;
				}
			}else{
				if(S.charAt(i)=='g'){
					gc++;
				}else{
					score--;
					gc++;
				}
			}
		}
		System.out.println(score);
	}

}


Measured memory_bytes: 13644
#include <stdio.h>
#include <math.h>

int main(void) {
	int student;
	double s[1001] = { 0 };
	double a;
	double ave;
	double sum;
	int i;

	while (1) {

		scanf("%d", &student);

		if (student == 0) {
			break;
		}

		ave = 0;
		sum = 0;
		for (i = 0; i < student; i++) {
			scanf("%lf", &s[i]);
			ave += s[i];
		}

		ave /= (double)student;
		for (i = 0; i < student; i++) {
			s[i] -= ave;
			s[i] *= s[i];
			sum += s[i];
		}

		sum /= (double)student;
		a = sqrt(sum);

		printf("%.8f\n", a);
	}

	return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it=x.begin();it!=x.end();it++) cout<<*it<<' '; cout<<endl;
#define printii(x)  for(auto it=x.begin();it!=x.end();it++) cout<<*it.F<<' '<<*it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){int y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define ii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<ii>
#define viii vector<pair<ii,int>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)
ll n;
vi we,v;
ll dp[100][1000001];
ll func(ll i, ll w){
	if(w<0){
		return -1*LLMAX;
	}
	if((i>=n) || (w==0)){
		return 0;
	}
	if(dp[i][w]!=-1){
		return dp[i][w];
	}

	return dp[i][w] = max(func(i+1,w-we[i])+v[i],func(i+1,w));
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll x,t,m,w;
    cin>>n>>w;
    MSET(dp,-1);
    for(int i=0;i<n;i++){
        cin>>x;
        we.pb(x);
        cin>>x;
        v.pb(x);
    }
    cout<<func(0,w);




    
    

    return 0;
}




Measured memory_bytes: 781568
#include <stdio.h>

int main()
{
  int A[100],N,chan=0,i,j,minj=0,count=0;

  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&A[i]);
  for (i = 0; i< N-1;i++)
    {
      minj = i;
      for (j = i+1; j<N;j++)
	{	  
	  if (A[j] < A[minj])  minj = j;
	    
	}
      chan=A[i];
      A[i]=A[minj];
      A[minj]=chan;
      if(minj!=i)count++;	    
    }


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

  return 0;
  
}



Measured memory_bytes: 2108
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	nums := make(map[int]struct{})
	for i := 0; i < n; i++ {
		var num int
		fmt.Scan(&num)
		nums[num] = struct{}{}
	}
	fmt.Println(len(nums))

}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int n,m,s=0;
	cin>>n>>m;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>=m){
			s++;
		}
	}
	cout<<s;
}


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

int main() {
	int a, b, c;
	int count = 0;

	cin >> a >> b >> c;
	
	for (int i = a; i <= b; i++) {
		if (c % i == 0) {
			count++;
		}
	}
	cout << count << endl;

	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;


int main(){
    ll n;
    string s;
    cin>>n;
    cin>>s;
    ll x=s.length();
    string a,b;
    rep(i,0,x/2)a+=s[i];
    rep(i,(x/2),x)b+=s[i];
    if(x==1)cout<<"No";
    else if(x%2!=0) cout<<"No";
    else if(a==b)cout<<"Yes";
    else cout<<"No";
    
}

Measured memory_bytes: 256