akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int h = 1;
		int w = 1;
		while (h != 0 || w != 0) {
			h = scanner.nextInt();
			w = scanner.nextInt();
			for (int i = 0; i < h; ++i) {
				for (int c = 0; c < w; ++c) {
					System.out.print("#");

				}
				System.out.println("");
			}
			if (h != 0 || w != 0) {
				System.out.println("");
			}
		}

	}
}



Measured memory_bytes: 32844
//abc065_d2.cpp
//Thu Jun 11 22:39:48 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

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

//Union-Find木
int par[100100]; //親
int treerank[100100]; //木の深さ

//n要素で初期化
void init(int n){
	for (int i=0;i<n;i++){
		par[i] = i;
		treerank[i] = 0;
	}
}

//木の根（親）を見つける
int find (int x){
	if (par[x] == x){
		return x;
	} else {
		return par[x] = find(par[x]);
	}
}

//xとyの属する集合の併合
void unite(int x, int y){
	x = find(x);
	y = find(y);
	if (x == y) {
		return;
	} 

	if (treerank[x] < treerank[y]){
		par[x] = y;
	} else {
		par[y] = x;
		if (treerank[x] == treerank[y]){
			treerank[x]++;
		}
	}
}

//xとyが同じグループに属するか判定
bool same(int x, int y){
	return find(x) == find(y);
}

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

	vector<P> a;
	map<P,int> mp;
	int nool = 0;
	vector<pair<ll,int>> x,y;
	for (int i=0;i<n;i++){
		ll tmp1,tmp2;
		cin >> tmp1 >> tmp2;
		x.push_back(pair<ll,int>(tmp1,i));
		y.push_back(pair<ll,int>(tmp2,i));
	}

	sort(x.begin(),x.end());
	sort(y.begin(),y.end());

	pair<ll,int> cost[2*(n-1)];
	P nodecombi[2*(n-1)];
	for (int i=1;i<n;i++){
		cost[i-1] = P(x[i].first-x[i-1].first,i-1);
		nodecombi[i-1] = P(x[i].second,x[i-1].second);
	}
	for (int i=1;i<n;i++){
		cost[i-1+n-1] = P(y[i].first-y[i-1].first,i-1+n-1);
		nodecombi[i-1+n-1] = P(y[i].second,y[i-1].second);
	}

	sort(cost,cost+2*(n-1));

	init(n);

	ll ans = 0;
	for (int i=0;i<2*(n-1);i++){
		int id = cost[i].second;
		int tmp1 = nodecombi[id].first;
		int tmp2 = nodecombi[id].second;
		if (same(tmp1,tmp2)){
			continue;
		}else {
			ans+=cost[i].first;
			unite(tmp1,tmp2);
		}
	}


	cout << ans << endl;
//	printf("%.4f\n",ans);
}

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

int main(){
  long N, K;
  cin >> N >> K;
  
  vector<long> h(N);
  for(long i=0; i<N; i++){
    cin >> h.at(i);
  }
  
  sort(h.begin(), h.end());
  
  long m=10000000000;
  
  for(int i=0; i<N-K+1; i++){
    m = min(m, h.at(i+K-1)-h.at(i));
  }
  
  cout << m << endl;
  
}

Measured memory_bytes: 1024
#!/usr/bin/perl

use strict;
use warnings;

my ($n, $a, $b);
{
    my $in = <STDIN>;
    ($n, $a, $b) = split(" ", $in);
}
my $MOD = 10 ** 9 + 7;
sub power
{
    my ($a, $b) = @_;
    if ($b == 0)
    {
        1;
    }
    elsif ($b % 2 == 0)
    {
        power($a ** 2 % $MOD, $b / 2);
    }
    else{
        $a * power($a, $b - 1) % $MOD;
    }
}
sub inv
{
    my $n = shift;
    power($n, $MOD - 2) % $MOD;
}
sub combination
{
    my ($n, $k) = @_;
    my $a = 1;
    my $b = 1;
    for (my $i=0; $i<$k; $i++)
    {
        $a *= $n - $i;
        $a %= $MOD;
        $b *= $i + 1;
        $b %= $MOD;
    }
    $a * inv($b) % $MOD;
}
my $ans = power(2, $n) - 1;
$ans += $MOD - combination($n, $a);
$ans += $MOD - combination($n, $b);
print ($ans % $MOD), "\n";

Measured memory_bytes: 768
#include<iostream>
#include<vector>
#include<string>
#include<stdlib.h>
#include<algorithm>
#include<math.h>
#include<queue>
#include <forward_list>
#include <numeric>

#define mod 1000000007

using namespace std;


int main() {

	int n;

	cin >> n;

	vector<int> d(n);

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

	sort(d.begin(),d.end());

	cout << d[((n - 1) / 2)+1] - d[(n - 1) / 2];
	

	return 0;
}




Measured memory_bytes: 640
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#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 range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

void shufful(vi &cur,int q){
	vi next;
	int n=cur.size();
	next.resize(n);
	if(q){
		rep(i,n-q) next[i]=cur[i+q];
		rep(i,q) next[n-q+i]=cur[i];
	}else{
		rep(i,n/2) next[2*i]=cur[i];
		rep(i,n/2) next[2*i+1]=cur[n/2+i];
	}
	rep(i,n) cur[i]=next[i];
	return ;
}

int main(void){
	int n;
	cin >> n;
	vi cur;
	rep(i,2*n) cur.pb(i+1);
	int m; 
	cin >> m;
	rep(i,m){
		int q;
		cin >> q;
		shufful(cur,q);
	}

	rep(i,2*n) cout << cur[i] << endl;
	return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
int main(){
  int w,h,n,a,x,y,i,j,k=0,ax=0,ay=0,bx,by;
  cin>>w>>h>>n;
  bx=w;by=h;
  for(i=0;i<n;i++){
    cin>>x>>y>>a;
    if(a==1) ax=max(ax,x);
    if(a==2) bx=min(bx,x);
    if(a==3) ay=max(ay,y);
    if(a==4) by=min(by,y);
  }
  if(ax<bx&&ay<by) k=(bx-ax)*(by-ay);
  cout << k << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n, m; cin >> n >> m;
    auto g = vec<bool>(n, n);
    FOR(i, 0, m) {
        int a, b; cin >> a >> b;
        --a, --b;
        g[a][b] = g[b][a] = true;
    }

    VI p(n);
    FOR(i, 0, n)p[i] = i;
    int ans = 0;
    do {
        bool ok = p[0] == 0;
        FOR(i, 1, n)ok &= g[p[i - 1]][p[i]];
        if (ok)++ans;
    } while (next_permutation(all(p)));

    cout << ans << "\n";
}


Measured memory_bytes: 256
/**
*   @author: Kshitiz Srivastava (Pirate_ksh) @ MNNIT Allahabad
*/
#include<bits/stdc++.h>
using namespace std;
 
// General
#define ll long long
#define ld long double
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007 // 998244353
#define PI 3.1415926535897932384
#define endl "\n"
#define debug(x) cout<<x<<endl
#define REP(i,n) for(i=0;i<n;++i)
#define FOR(i,x,n) for(i=x;i<n;++i)
#define RREP(i,n) for(i=n-1;i>=0;--i)
#define RFOR(i,x,n) for(i=n-1;i>=x;--i)
#define TR(i,c) for(auto i=c.begin();i!=c.end();++i)
#define RTR(i,c) for(auto i=c.rbegin();i!=c.rend();++i)
#define sz(a) a.size()
 
// Bounds
#define lb(a,x) a.lower_bound(x)
#define ub(a,x) a.upper_bound(x)
#define all(a) a.begin(),a.end()
 
// Vector
#define vi vector <int>
#define pb(v,x) v.push_back(x)
#define vll vector <ll>
 
// Map
#define mii map <int, int>
#define umii unordered_map <int, int>
 
// Set
#define si set <int>
#define msi multiset<int>
 
// Pair
#define vpii vector<pair < int, int > >
#define vpll vector<pair < ll, ll > >
#define pii pair < int, int >
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define vppi vector<pair<pair<int,int>,int>>
#define ppi pair<pair<int,int>,int>

void solve();

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

void solve() {
    ll i, j, n;
    cin >> n;
    vi a(n);
    REP(i,n) cin >> a[i];
    ll ans = 0, sum = a[0] % mod;
    // cout << "sum=" << sum << endl;
    FOR(i,1,n) {
        ll temp = ((sum%mod) * (a[i]%mod)) % mod;
        ans = ((ans%mod) + ((temp)%mod)) % mod;
        sum = ((sum % mod) + (a[i]%mod)) % mod;
        // cout << "sum=" << sum << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3988
package main

import "fmt"

func main() {
	var n int
	var t, a int
	fmt.Scan(&n, &t, &a)
	h := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}

	x := a - t
	diff := 1000000000
	var ans int
	for i, v := range h {
		if y := abs(x*500 + v*3); y < diff {
			diff = y
			ans = i
		}
	}
	fmt.Println(ans + 1)
}

func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}


Measured memory_bytes: 512
package main
import(
  "fmt"
)
func main(){
  var(
    b string
    od1,ev1,od0,ev0 int
  )
  fmt.Scan(&b)
  for i,j:=range b{
    if i%2==0{
      if j==48{
        od0+=1
      }
    }else{
      if j==48{
        ev0+=1
      }
    }
  }
  od1=len(b)-len(b)/2-od0
  ev1=len(b)/2-ev0
  if od1+ev0>ev1+od0{
    fmt.Println(ev1+od0)
  }else{
    fmt.Println(od1+ev0)
  }
}

Measured memory_bytes: 1280
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> IP;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)

int main() {
	lint N;
	cin >> N;
	vector<lint>A(N);
	rep(i, N) {
		cin >> A[i];
	}
	lint INF = 1000000000000;
	rep(i, N - 1) {
		if (A[i] == A[i + 1]) {
			A[i] = INF;
		}
	}
	vector<lint>B;
	rep(i, N) {
		if (A[i] != INF) {
			B.push_back(A[i]);
		}
	}
	rep(i, B.size()) {
		cout << B[i];
		if (i != B.size() - 1) {
			cout << ' ';
		}
		else {
			cout << endl;
		}
	}
}




Measured memory_bytes: 4688
import std.stdio;
import std.string;
import std.format;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.concurrency;
import std.traits;
import std.uni;
import core.bitop : popcnt;
alias Generator = std.concurrency.Generator;

enum long INF = long.max/5;
enum long MOD = 10L^^9+7;

void main() {
  long X, Y;
  scanln(X, Y);
  long ans = 0;
  if (X == 1) ans += 300000;
  if (X == 2) ans += 200000;
  if (X == 3) ans += 100000;
  if (Y == 1) ans += 300000;
  if (Y == 2) ans += 200000;
  if (Y == 3) ans += 100000;
  if (X == 1 && Y == 1) ans += 400000;
  ans.writeln;
}

// ----------------------------------------------


void times(alias fun)(long n) {
  // n.iota.each!(i => fun());
  foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(long n) {
  // return n.iota.map!(i => fun()).array;
  T[] res = new T[n];
  foreach(ref e; res) e = fun();
  return res;
}

T ceil(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  // `(x+y-1)/y` will only work for positive numbers ...
  T t = x / y;
  if (t * y < x) t++;
  return t;
}

T floor(T)(T x, T y) if (isIntegral!T || is(T == BigInt)) {
  T t = x / y;
  if (t * y > x) t--;
  return t;
}

ref T ch(alias fun, T, S...)(ref T lhs, S rhs) {
  return lhs = fun(lhs, rhs);
}
unittest {
  long x = 1000;
  x.ch!min(2000);
  assert(x == 1000);
  x.ch!min(3, 2, 1);
  assert(x == 1);
  x.ch!max(100).ch!min(1000); // clamp
  assert(x == 100);
  x.ch!max(0).ch!min(10); // clamp
  assert(x == 10);
}

mixin template Constructor() {
  import std.traits : FieldNameTuple;
  this(Args...)(Args args) {
    // static foreach(i, v; args) {
    foreach(i, v; args) {
      mixin("this." ~ FieldNameTuple!(typeof(this))[i]) = v;
    }
  }
}

void scanln(Args...)(auto ref Args args) {
  enum sep = " ";
  enum n = Args.length;
  enum fmt = n.rep!(()=>"%s").join(sep) ~ "\n";
  static if (__VERSION__ >= 2071) {
    readf!fmt(args);
  } else {
    enum argsTemp = n.iota.map!(
      i => "&args[%d]".format(i)
    ).join(", ");
    mixin(
      "readf(fmt, " ~ argsTemp ~ ");"
    );
  }
}

// fold was added in D 2.071.0
static if (__VERSION__ < 2071) {
  template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
      static if (S.length < 2) {
        return reduce!fun(seed, r);
      } else {
        return reduce!fun(tuple(seed), r);
      }
    }
  }
}

// popcnt with ulongs was added in D 2.071.0
static if (__VERSION__ < 2071) {
  ulong popcnt(ulong x) {
    x = (x & 0x5555555555555555L) + (x>> 1 & 0x5555555555555555L);
    x = (x & 0x3333333333333333L) + (x>> 2 & 0x3333333333333333L);
    x = (x & 0x0f0f0f0f0f0f0f0fL) + (x>> 4 & 0x0f0f0f0f0f0f0f0fL);
    x = (x & 0x00ff00ff00ff00ffL) + (x>> 8 & 0x00ff00ff00ff00ffL);
    x = (x & 0x0000ffff0000ffffL) + (x>>16 & 0x0000ffff0000ffffL);
    x = (x & 0x00000000ffffffffL) + (x>>32 & 0x00000000ffffffffL);
    return x;
  }
}


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

using namespace std;

typedef long long ll;

int main() {
    
    string s;
    cin >>s;
    int n = s.size();
    int cnt=0;
    for (int i=0; i<n; i++){
        int a = s[i] - '0';
        cnt += a;
        
    }
    if (cnt % 9 == 0){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;



    return 0;
}

Measured memory_bytes: 3756
H, W = map(int, input().split())
Sn = [input() for _ in range(H)]

for h in range(0, H):
    h_strs = []
    for w in range(0, W):
        if Sn[h][w] == '#':
            h_strs.append('#')
            continue
        n = 0
        for sh in range(h-1, h+2):
            for sw in range(w-1, w+2):
                if 0 <= sh and sh < H and 0 <= sw and sw < W:
                    if Sn[sh][sw] == '#':
                        n += 1
        h_strs.append(str(n))
    Sn[h] = "".join(h_strs)

for S in Sn:
    print(S)


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

typedef  long long ll;
const double PI = acos(-1.0);


int main(){

    double a,b,h,m;
    cin>>a>>b>>h>>m;
    double x1 = h*30+m*0.5;
    double x2 = 6*m;
    double g = (x1-x2)*1.0/180.0*PI;
    double  ans = sqrt(a*a+b*b-2*a*b*cos(g));
    printf("%.15f\n",ans);
    return 0;
}


Measured memory_bytes: 4176
#include <iostream>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;
ll a[301][301], dst[301][301];

bool compare(vector<ll> a, vector<ll> b){return a[0] < b[0];}

int main() {
	cin >> n;
	for(ll i = 1; i <= n; i++){for(ll j = 1; j <= n; j++){cin >> a[i][j]; dst[i][j] = -1;}}
	for(ll i = 1; i <= n; i++){dst[i][i] = 0;}
	
	vector<vector<ll>> t(n*(n-1)/2+1, vector<ll>(3));
	ll ct = 0;
	for(ll i = 1; i <= n; i++){
		for(ll j = 1; j <= n; j++){
			if(i < j){t[++ct][0] = a[i][j]; t[ct][1] = i; t[ct][2] = j;}		
		}
	}
	sort(t.begin()+1, t.end(), compare);
	
	ll sum = 0;
	for(ll e = 1; e <= ct; e++){
		ll d = t[e][0]; ll x = t[e][1]; ll y = t[e][2];
		//cout << x << y <<endl;
		if(dst[x][y] != -1 && d > dst[x][y]){sum = -1; break;}
		if(dst[x][y] == -1 || d < dst[x][y]){
			dst[x][y] = d; dst[y][x] = d;
			sum += d;
			for(ll i = 1; i <= n; i++){
				for(ll j = 1; j <= n; j++){
					if(dst[i][x] != -1 && dst[y][j] != -1){
						if(dst[i][j] == -1 || dst[i][x]+d+dst[y][j] < dst[i][j]){
							dst[i][j] = dst[i][x]+d+dst[y][j];
						}
					}
					if(dst[i][y] != -1 && dst[x][j] != -1){
						if(dst[i][j] == -1 || dst[i][y]+d+dst[x][j] < dst[i][j]){
							dst[i][j] = dst[i][y]+d+dst[x][j];
						}
					}
				}	
			}
		}
	}
	//for(ll i = 1; i <= n; i++){for(ll j = 1; j <= n; j++){cout << dst[i][j];}cout << endl;}
	//for(ll i = 1; i <= 3; i ++){cout << i << t[i][0] << t[i][1] << t[i][2] << endl;}
	cout << sum;
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <cmath>
#include <math.h>
#include <vector>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

double Minkowski(vector<long double>& A, vector<long double>& B, long double p) {
	int const n = A.size();
	long double ans = 0;
	for (int i = 0; i < n; i++) {
		ans += pow(abs(A.at(i) - B.at(i)), p);
	}
	long double const D = pow(ans, (1.000000000 / p));
	return D;
}

int main() {
	int N; cin >> N;
	vector<long double>X(N), Y(N);
	for (int i = 0; i < N; i++) {
		cin >> X.at(i);
	}
	for (int i = 0; i < N; i++) {
		cin >> Y.at(i);
	}
	double const a = Minkowski(X, Y, 1.000000000);
	double const b = Minkowski(X, Y, 2.000000000);
	double const c = Minkowski(X, Y, 3.000000000);
	double max = 0;
	for (int i = 0; i < N; i++) {
		if (max < abs(X.at(i) - Y.at(i))) max = abs(X.at(i) - Y.at(i));
	}
	printf("%.8lf\n%.8lf\n%.8lf\n%.8lf\n", a, b, c, max);
}


Measured memory_bytes: 3480
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define forE(i,x) for(int i=head[x];i!=-1;i=ne[i])
using namespace std;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef pair<int,int> pin;
#define mk(a,b) make_pair(a,b)
#define lowbit(x) ((x)&(-(x)))
#define sqr(a) ((a)*(a))
#define clr(a) (memset((a),0,sizeof(a)))
#define ls ((x)<<1)
#define rs (((x)<<1)|1)
#define mid (((l)+(r))>>1)
#define pb push_back
#define w1 first
#define w2 second
inline void read(int &x){
	x=0;int f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	x*=f;
}
inline void judge(){
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
}
/*******************************head*******************************/
const int maxn=2005;
char s[maxn][maxn];
int res,last[maxn],n,m,a[maxn][maxn];
pin p[maxn];
int vis[maxn];
typedef set<int>::iterator It;
int main(){
	read(n);read(m);
	res=max(n,m);
	rep(i,1,n)scanf("%s",s[i]+1);
	rep(i,1,n)rep(j,1,m)a[i][j]=(s[i][j]=='.');
	rep(i,1,n-1)rep(j,1,m)a[i][j]^=a[i+1][j];
	rep(j,1,m-1)last[j]=n;
	per(i,n-1,1){
		rep(j,1,m-1)if(a[i][j]!=a[i][j+1])last[j]=i;
		rep(j,1,m-1)p[j]=mk(last[j],j);
		sort(p+1,p+m);
		set<int> zb;zb.insert(0);zb.insert(m);
		memset(vis,0,sizeof(vis));vis[m]=1;
		int ans=m;
		rep(j,1,m-1){
			if(p[j].w1!=p[j-1].w1)res=max(res,ans*(p[j].w1-i+1));
			int k=p[j].w2;
			if(p[j].w1==n)break;
			zb.insert(k);
			It it=zb.find(k);
			It it1=it;It it2=it;
			it1--;it2++;
			int l=*it1,r=*it2;
			vis[r-l]--;
			vis[k-l]++;
			vis[r-k]++;
			while(!vis[ans])ans--;
		}
	}
	cout<<res<<endl;
	return 0;
}


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

using namespace std;

int main() {
  int N, K;
  vector<int> l;
  
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    int _in;
    
    cin >> _in;
    
    l.push_back(_in);
  }
  
  sort(l.begin(), l.end());
  
  long long ans = 0;
  
  for (int i = 0; i < K; i++) {
    ans += l[i];
  }
  
  cout << ans << endl;
  
  return 0;
}

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

typedef long long int in;

in dp[10005][105],cp[10005][105];

in sum(in val)
{
    in ans=0;
    
    while(val)
    {
        ans+=(val%10);
        val=val/10;
    }
    
    return ans;
}

int main() 
{
    string s;
    cin>>s;
    
    in sub=0,d,i,j,k,n=s.size(),l=1000000007,ans=0;
    cin>>d;

    for(i=0;i<10;++i)
    ++cp[1][(sum(i)%d)];
    
    for(i=0;i<100;++i)
    ++cp[2][(sum(i)%d)];
    
    for(i=3;i<=10001;++i)
    {
        for(k=0;k<d;++k)
        {
            for(j=0;j<10;++j)
            {
                cp[i][k]=(cp[i][k]+cp[i-1][((((k-j)%d)+d)%d)])%l;
            }
        }
    
    }
    
    // for(i=0;i<100;++i)
    // cout<<cp[1][(i%d)]<<" ";
    // cout<<"\n";
    
    // for(i=0;i<100;++i)
    // cout<<cp[2][(i%d)]<<" ";
    // cout<<"\n";
    
    // for(i=0;i<100;++i)
    // cout<<cp[3][(i%d)]<<" ";
    // cout<<"\n";
    
    for(i=0;i<n-1;++i)
    {
        for(k=0;k<d;++k)
        {
            for(j=0;j<(s[i]-'0');++j)
            {
                dp[i][k]=(dp[i][k]+cp[n-i-1][(((k-j-sub)%d+d)%d)])%l;
            }
        }
        
        sub=sub+(s[i]-'0');
    }

    for(j=0;j<=(s[n-1]-'0');++j)
    dp[n-1][((((d-j-sub)%d)+d)%d)]=(dp[n-1][((((d-j-sub)%d)+d)%d)]+1)%l;
    
    for(i=0;i<n;++i)
    {
        ans=(ans+dp[i][0])%l;
    }
    
    ans=(ans-1+l)%l;
    
    cout<<ans;
	
	return 0;
}


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

void solve() {
    int N, K;
    cin >> N >> K;
    vector<ll> Hi(N);
    for (int i = 0; i < N; ++i) {
        cin >> Hi[i];
    }
    sort(Hi.begin(), Hi.end(), greater<ll>());
    ll x = 0;
    for (int i = K; i < N; ++i) {
        x += Hi[i];
    }
    cout << x << endl;
}

int main() {
    solve();
    return 0;
}


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

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

    int V = 0;
    if (a[0] == '1') V++;
    if (a[1] == '1') V++;
    if (a[2] == '1') V++;

    cout << V << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>

using namespace std;

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

    if(a % 2 == 0){
        cout << ((double)a/(2*a)) << endl;
    }else{
        cout << setprecision(12) <<  ((double)(a+1)/(2*a)) << endl;
    }

    return 0;
}

Measured memory_bytes: 384
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define fe(vec,lambda) std::for_each(vec.begin(), vec.end(), lambda );
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#define printv(val) std::for_each(val.begin(),val.end(),[](auto x){cout<<x<<"\n";});
#define lim 1000000007ll
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template <class T> T gcd(T a, T b){if (a < b) {a ^= b;b ^= a;a ^= b;} return b ? gcd(b, a % b) : a;}
template <class T> T lcm(T a, T b){return a * b / gcd(a, b);}
inline bool operator<(const pii &lhs,const pii &rhs){return(lhs.second<rhs.second);}
template<class T> vector<pair<T,T>> duplicator(const vector<T>& input){vector<pair<T,T>> out(input.size()-1);rep(i,input.size()-1){out[i].first =input[i  ];out[i].second=input[i+1];}return(out);}
vector<char> String_to_vector_char(const string& input){vector<char> out(input.size());rep(i,input.size()){out[i]=input[i];}return out;}


ll a,b,c,d,n;
vector<ll>v;
map<ll,ll>m;
string s,s2;
void input(){
    cin>>n;
}
void src(){
    cout<<800*n-200*(n/15);
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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

int main(int argc, char const *argv[]) {
  int n, k;
  cin >> n >> k;
  int ball[k];
  n = n-k;
  ball[0] = 1;
  ball[k-1] = 1+n;
  cout << ball[k-1]-ball[0] << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main {
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int val[] = new int[3];
		
		for(int i=0; i<3; i++) { 
			val[i] = sc.nextInt();
		}
		
		int tmp = 0;
		for(int i=0; i<2; i++) {
			if (val[i] > val[i+1]) {
				tmp = val[i];
				val[i] = val[i+1];
				val[i+1] = tmp;
			}
		}
		
		if(val[0] > val[1]) {
			tmp = val[0];
			val[0] = val[1];
			val[1] = tmp;
		}
		
		System.out.println(val[0] + " " + val[1] + " " + val[2]);
	}
}


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

int main(){
	long long n;
	cin>>n;
	long long ret = 0;
	for(int i=1; i<=n; i++){
		int div = n/i;
		if(n%i==0) div--;
		ret+=div;
	}
	cout<<ret;
}

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

signed main(){
    ll K;
    cin >> K;
    vector<ll>A(K);
    for(auto & e : A) cin >> e;
    reverse(A.begin(),A.end());
    ll lb = 2, ub = 2;
    for(ll i = 0; i < A.size(); ++i){
        ll crt = A[i];
        ub = (ub / crt) * crt + crt - 1;
        lb = (lb + crt - 1) / crt * crt;
        if(lb >  ub) return puts("-1") * 0;
    }
    cout << lb << " " << ub << endl;
}



Measured memory_bytes: 1024
N, T = map(int, input().split())
D = [tuple(map(int, input().split())) for _ in range(N)]
D.sort()
dp = [[0] * T for _ in range(N + 1)]

for i in range(N):
    A, B = D[i]
    for j in range(T):
        here = dp[i][j]
        if j < A:
            dp[i + 1][j] = here
        else:
            dp[i + 1][j] = max(here, dp[i][j - A] + B)

maxB = [0] * (N + 1)
t = 0
for i in range(N - 1, -1, -1):
    t = max(t, D[i][1])
    maxB[i] = t

ans = 0
for i in range(N):
    ans = max(ans, dp[i + 1][T - 1] + maxB[i + 1])

print(ans)


Measured memory_bytes: 118104
K, N = map(int, input().split())
lst = [int(x) for x in input().split()]
a = lst[0]
m = 0
for i in range(N - 1):
    m = max(m, (lst[i + 1] - a) - (lst[i] - a))

print(K - max(m, K - (lst[-1] - a)))


Measured memory_bytes: 26444
N = gets.to_i
$array=Array.new(2*N)
list=gets.chomp.split(" ").map(&:to_i);
n=0
while(n<N)
 $array[n]=list[n]
 $array[n+N]=list[n]
 n=n+1
end
#0->A1,1->A2,...,N->A1,...


##まず2(x1+x2+...+xn)を求める
$sum = 0
list.each { |i| $sum += i }
##2*x1を求めるには、2*x(2),2*x(3),...をsumから引く
##2*A(2),2*A(4),...を引けばよい
for i in 1..(N-1)/2 do
 $sum=$sum-2*$array[2*i-1]
end
$result=Array.new(N)
$result[0]=$sum
for i in 1..N-1 do
$result[i]=2*$array[i-1]-$result[i-1]
end
print $result.join(" ")

Measured memory_bytes: 16780
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const int MOD = 1000000007;
ll gcd(ll x, ll y){
  if(y==0)return x;
  else return gcd(y,x%y);
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans=1;
  rep(i,n-1){
    if(s[i]!=s[i+1])ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 512
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

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

func nextInt2() (int, int) {
	return nextInt(), nextInt()
}

func nextInt3() (int, int, int) {
	return nextInt(), nextInt(), nextInt()
}

func nextInt4() (int, int, int, int) {
	return nextInt(), nextInt(), nextInt(), nextInt()
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func sum(a []int) int {
	ret := 0
	for _, v := range a {
		ret += v
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, k := nextInt(), nextInt()
	p := nextInts(n)
	sort.Sort(sort.IntSlice(p))

	puts(sum(p[:k]))
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main() {
    int n,m;
    cin >> n >> m;
    int p[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i];
        p[i]--;
    }
    int x[m], y[m];
    for (int i = 0; i < m; i++) {
        cin >> x[i] >> y[i];
        x[i]--;
        y[i]--;
    }
    UnionFind tree(n);
    for (int i = 0; i < m; i++) {
        tree.unite(x[i],y[i]);
    }
    int ret = 0;
    for (int i = 0; i < n; i++) {
        if (tree.same(tree.par[i], tree.par[p[i]])) {
            ret++;
        }
    }
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 4712
from collections import defaultdict
 
n = int(input())
raw_numbers = list(map(int, input().split()))
q = int(input())
 
total = sum(raw_numbers)
 
numbers = defaultdict(int)
 
for item in raw_numbers:
    numbers[item] += 1

for i in range(q):
    a, b = map(int, input().split())
    taken = numbers[a]
    total -= numbers[a]*a
    numbers[b] += numbers[a]
    numbers[a] = 0
    total += taken*b
    print(total)

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

#define Mset(s, n)      memset(s, n, sizeof(s))
#define Rp0(i, m)       for(int i = 0; i < m; ++i)
#define Rpd(i, m, l)    for(int i = m; i >= l; --i)
#define Rp1(i ,m)       for(int i = 1; i <= m; i++)
#define All(a)          (a).begin(), (a).end()
#define Lwb             lower_bound
#define Upb             upper_bound
#define Sz(a)           int((a).size())
#define Count_bit(x)    __builtin_pop(x)
#define u_map           unordered_map
#define fi              first
#define se              second
#define pb              push_back
#define pf              push_front
#define is              insert
#define ooi             2000000000
#define ool             LLONG_MAX
#define ll              long long
#define ull             unsigned ll
#define ld              long double
#define pii             pair<int, int>
#define vi              vector<int>
#define vpii            vector<pii>

const ll MOD = (ll) 1e9 + 7;
const ld PI = acos((ld) -1);
inline int Get_bit(int x, int k){return (x >> (k - 1)) & 1;}
inline ll Gcd(ll a, ll b) {ll r; while(b){ r = a % b; a = b; b = r;} return a;}
inline ll Lcm(ll a, ll b) {return a / Gcd(a, b) * b;}
inline ll Pow(ll n, ll k) {ll r = 1; for(; k; k >>= 1, n = n * n % MOD){if(k & 1) r = r * n % MOD;} return r;}
const int base = 311;


const int N = 3e5;

ll n, m, k, q, ans, a[N];

struct cmp{
    bool operator()(ll x, ll y){
        return x < y;
    }
};

priority_queue<ll, vector<ll>, cmp> re;

inline void Solve(){
    cin >> n >> m;
    for(int i = 1; i <= n; i++){
        ll x;
        cin >> x;
        re.push(x);
    }
    while(m--){
        ll x = re.top();
        re.pop();
        x/=2;
        re.push(x);
    }
    while(!re.empty()){
        ans += re.top();
        re.pop();
    }
    cout << ans;
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    Solve();
    return 0;
}


Measured memory_bytes: 1400
h, w, n = map(int, input().split())
sr, sc = map(int, input().split())
s = input(); t = input()
is_drop = False

# 区間 [L, R] は安全なゾーン
# 初期値は全区間
L, R = 1, w

for i in range(n)[::-1]:
    if t[i] == 'R':
        # 後手が右に行く権利を得たので
        # 安全なゾーンが左に広がる(1より左には行けない)
        L = max(L-1, 1)
    if t[i] == 'L':
        # 後手が左に行く権利を得たので
        # 安全なゾーンが右に広がる(wより右には行けない)
        R = min(R+1, w)
    if s[i] == 'R':
        # 先手が右に行く権利を得たので
        # 安全なゾーンが左に狭まる
        R -= 1
    if s[i] == 'L':
        # 先手が左に行く権利を得たので
        # 安全なゾーンが右に狭まる
        L += 1
    if R < L: is_drop = True

if not L <= sc <= R: is_drop = True

# 区間 [L, R] は安全なゾーン
# 初期値は全区間
L, R = 1, h

for i in range(n-1, -1, -1):
    if t[i] == 'U':
        # 後手が上に行く権利を得たので
        # 安全なゾーンが下に広がる(hより下には行けない)
        R = min(R+1, h)
    if t[i] == 'D':
        # 後手が下に行く権利を得たので
        # 安全なゾーンが上に広がる(0より上には行けない)
        L = max(L-1, 1)
    if s[i] == 'U':
        # 先手が上に行く権利を得たので
        # 安全なゾーンが下に狭まる
        L += 1
    if s[i] == 'D':
        R -= 1

    if R < L: is_drop = True

if not L <= sr <= R: is_drop = True

print("NO" if is_drop else "YES")

Measured memory_bytes: 3788
#include<stdio.h>
int main(void){
int que,ans,i,j,hit,blow;
char q[5],a[5];

while(scanf("%d %d",&ans,&que),que+ans){

hit=0;
blow=0;

sprintf(q,"%d",que);
sprintf(a,"%d",ans);

if(ans/1000==0){
for(i=3;i>0;i--){
a[i]=a[i-1];
}
a[i]=0;
}

if(que/1000==0){
for(i=3;i>0;i--){
q[i]=q[i-1];
}
q[i]=0;
}

for(i=0;i<4;i++){
if(q[i]==a[i]) hit++;
}

for(i=0;i<4;i++){
for(j=0;j<4;j++){
if(i==j) continue;
if(q[i]==a[j]) blow++;
}
}

printf("%d %d\n",hit,blow);
}
return 0;}

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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

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

    ll sum=0,num;

    rep(i,1<<s.size()-1){
        num=s[0]-'0';
        rep(j,s.size()-1){
            if(i&(1<<j)){
                sum+=num;
                num=0;
            }
            num=num*10+(s[j+1]-'0');
        }
        sum+=num;
    }

    cout<<sum<<endl;
}



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

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		if(a < b && b < c)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}

Measured memory_bytes: 26180
S=input()
ans='AC'
ans='AC'
if S[0]!='A':
    ans='WA'
cnt=0
for i in range(1,len(S)):
    if S[i].isupper():
        if i==1 or i ==( len(S)-1) or S[i]!='C':
            ans='WA'
        cnt+=1
if cnt!=1:
    ans='WA'
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define vi vector<int>
#define vvi vector<vector<int> >
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
using ll = long long;
using ld =long double;
#define int ll
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<int,pii> piii;
#define mp make_pair
signed main(){
    int n; cin>>n;
    vi v(n);
    rep(i,n)cin>>v[i];
    int m;
    cin>>m;
    int ans=0;
    rep(i,m){
        int t;
        cin>>t;
        int imax=n-1;
        int imin=0;
        int mid;
        while(imax>=imin){
            mid=(imax+imin)/2;
            if(v[mid]>t)imax=mid-1;
            else if(v[mid]<t)imin=mid+1;
            else {
                ans++;
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3576
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>

using namespace std;

//typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)));
#define Mx(a , b) ((a) > (b) ? (a) : (b))
#define Mn(a , b) ((a) < (b) ? (a) : (b))

const double EPS = 1e-10;
const int INF = 2147483647;

const int UF_MAX = 1000000;

class UF{
	int x[UF_MAX];
	
public:
	
	void dft(){
		for(int i = 0 ; i < UF_MAX ; ++i) x[i] = -1;
	}
	
	int Boss(int a){
		int s = a;
		while(x[s] > -1) s = x[s];
		if(s != a) x[a] = s;
		return s;
	}
	
	void Union(int a , int b){
		int s = Boss(a);
		int t = Boss(b);
		if(s != t){
			if(x[s] < x[t]){
				x[s] += x[t];
				x[t] = s;
			} else {
				x[t] += x[s];
				x[s] = t;
			}
		}
	}
	
	bool Find(int a , int b){
		return Boss(a) == Boss(b);
	}
	
	int Count(int a){
		int b = 0;
		for(int i = 0 ; i < a ; ++i) if(x[i] < 0) ++b;
		return b;
	}
};

int H , W;
int d[5] = {1 , 0 , -1 , 0 , 1};
bool p[500][500];
bool r[500][500];
char c;
vector<int> V;
int a;
UF T;

int main(){
	T.dft();
	scanf("%d%d" , &H , &W);
	for(int i = 0 ; i < H ; ++i){
		for(int j = 0 ; j < W ; ++j){
			scanf(" %c" , &c);
			p[i][j] = c == '#';
			if(p[i][j]){
				++a;
				V.push_back(i * 500 + j);
				if(i > 0 && p[i - 1][j]) T.Union(i * 500 + j , (i - 1) * 500 + j);
				if(j > 0 && p[i][j - 1]) T.Union(i * 500 + j , i * 500 + j - 1);
			}
		}
	}
	if(!p[1][1]) r[1][1] = 1;
	for(int i = 0 ; i < a ; ++i){
		while(!T.Find(501 , V[i])){
			if(1 != V[i] % 500){
				int x = V[i] - 1;
				if(!p[x / 500][x % 500]) r[x / 500][x % 500] = 1;
				T.Union(V[i] , x);
				V[i] = x;
			} else {
				int x = V[i] - 500;
				if(!p[x / 500][x % 500]) r[x / 500][x % 500] = 1;
				T.Union(V[i] , x);
				V[i] = x;
			}
			for(int j = 0 ; j < 4 ; ++j){
				if(p[V[i] / 500 + d[j]][V[i] % 500 + d[j + 1]] || r[V[i] / 500 + d[j]][V[i] % 500 + d[j + 1]]) T.Union(V[i] , V[i] + 500 * d[j] + d[j + 1]);
			}
		}
	}
	for(int i = 0 ; i < H ; ++i){
		for(int j = 0 ; j < W ; ++j){
			printf("%c" , p[i][j] || r[i][j] ? '#' : '.');
		}
		printf("\n");
	}
	printf("\n");
	for(int i = 0 ; i < H ; ++i){
		for(int j = 0 ; j < W ; ++j){
			printf("%c" , r[i][j] ? '.' : '#');
		}
		printf("\n");
	}
	return 0;
}


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

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


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

int main(){
  int S;
  cin>>S;
  int h,m,s;
  h=S/3600;
  m=(S-3600*h)/60;
  s=S-h*3600-m*60;
  cout<<h<<':'<<m<<':'<<s<<endl;
}


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

ll A[200000];
ll B[200000];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
#ifdef LOCAL
	std::ifstream in("in");
	std::cin.rdbuf(in.rdbuf());
#endif

	int N;
	cin >> N;

	ll sum = 0;
	bool diff = false;
	ll minB = 1e9;
	for(int i = 0; i < N; i++){
		cin >> A[i] >> B[i];
		sum += B[i];
		if(A[i] > B[i]){
			minB = min(minB, B[i]);
		}
		if(A[i] != B[i]) diff = 1;
	}

	if(!diff) cout << 0 << endl;
	else cout << sum - minB << endl;
}


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

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

const ll mod =  1000000007;  //ansを出力する時は (ans % mod + mod) % mod とする(負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INFの値は1152921504606846976


int main()
{
    string s;
    cin >> s;
    int o = 0,z = 0;
    rep(i,s.size()){
        if(s[i] == '0') z++;
        else o++;
    }
    cout << min(o,z) * 2;
}


Measured memory_bytes: 512
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;

NodePointer listSearch(int key){
  /* your code */
  NodePointer n;
  n=nil->next;
  while((n!=nil)&&(n->key!=key)){
    n=n->next;
  }
  return n;
}

void init(){
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if ( cur == nil ) break;
    if ( isf == 0)  printf(" ");
    printf("%d", cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t){
  /* your code */
  if(t==nil)return;
  t->prev->next=t->next;
  t->next->prev=t->prev;
  free(t);
}


void deleteFirst(){
  NodePointer t = nil->next;
  if ( t == nil ) return;
  deleteNode(t);
}

void deleteLast(){
  /* your code */
  NodePointer t;
  t = nil->prev;
  if ( t == nil ) return;
  deleteNode(t);
}

void delete(int key){
  /* your code */
  NodePointer t;
  t=listSearch(key);
  deleteNode(t);
}


void insert(int key){
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;
  /* your code */
  x->next=nil->next;
  nil->next->prev=x;
  nil->next=x;
  x->prev=nil;
  
}

int main(){
  int key, n, i;
  int size = 0;
  char com[20];
  int np = 0, nd = 0;
  scanf("%d", &n);
  init();
  for ( i = 0; i < n; i++ ){
    scanf("%s%d", com, &key);
    if ( com[0] == 'i' ) {insert(key); np++; size++;}
    else if ( com[0] == 'd' ) {
      if (strlen(com) > 6){
	if ( com[6] == 'F' ) deleteFirst();
	else if ( com[6] == 'L' ) deleteLast();
      } else {
	delete(key); nd++; 
      }
      size--;
    }
  }

  printList();
  return 0;
}



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

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define FOR(i ,a, b) for (int i = a ; i <= b ; i++)
#define sz(a) int(a.size())
#define cuti(a) cout << a << endl;
#define cutii(a,b) cout << a << " " << b << endl;
#define vec(a) vector<int > a;

template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }

typedef pair<int ,int > pii;
typedef long long LL;
const long long oo = 1e9 + 7;

long long w,h;

int main() {
   // freopen("test.txt","r",stdin);
    cin >> h >> w;
    if ( w % 3 == 0 || h % 3 == 0 ) {
        cout << 0 ;
        return 0 ;
    }
    long long ans = oo;

    chmin(ans,min(w,h));


    for (int i = 0 ; i < w; i++ ){
        if(i==0) continue;
        if(w-i==0) continue;
        LL t1 = i * h;
        LL t2 = (w-i) * (h/2);
        LL t3 = h*w - t1 - t2;
        //cout << t1 <<  " " << t2 << " " << t3 << endl;
        chmin(ans , max(abs(t1-t2),max(abs(t1-t3),abs(t2-t3))));
    }

    for (int i = 0 ; i < h ; i++){
        if(i==0) continue;
        if(h-i==0) continue;
        LL t1 = i * w;
        LL t2 = (h-i) * (w/2);
        LL t3 = h*w - t1 - t2;
        chmin(ans , max(abs(t1-t2),max(abs(t1-t3),abs(t2-t3))));
    }

    cout << ans << endl;
}


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

int A,B,H,M;

signed main() {
  cin >> A >> B >> H >> M;
  double t = M_PI * (60*H - 11*M) /30 /12;
  if(t > M_PI) t = 2*M_PI - t;
  double cc = (double)(A*A + B*B) - 2.0*A*B * cos(t);
  printf("%.10f\n", sqrt(cc));
}


Measured memory_bytes: 4136
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
const int INF = 2e9;
using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
typedef long long ll;

int main(){
    int n; cin >> n;
    int ans = 0;
    
    rep(i,n) ans += i+1;

    cout << ans << endl;
}
    

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	for (;;) {
		int n, r; cin >> n >> r;
		if (n == 0) break;
		string s(n, ' ');
		for (int i = 0; i < n; i++) s[i] = n - i;
		while (r--) {
			int p, c; cin >> p >> c;
			string _s = s.substr(p - 1, c) + s.substr(0, p - 1) + s.substr(p + c - 1);
			s = _s;
		}
		cout << (int)s[0] << endl;
	}
}

Measured memory_bytes: 1220
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks.Dataflow;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		const int mod = 1000000007;  // 10^9+7
		static int Mod(long x, int m) { return (int)((x % m + m) % m); }
		static long Mod(long x, long m) { return (x % m + m) % m; }

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int n = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			//int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();

			int n = int.Parse(Console.ReadLine());

			long[] dp = new long[10000001];
			for (int i = 1; i <= n; i++) {
				int j = 1;
				while (i * j < dp.Length) {
					dp[i * j]++;
					j++;
				}
			}
			//System.Diagnostics.Debug.WriteLine(string.Join(" ", dp.Take(20)));

			long ans = 0;
			for (int i = 1; i <= n; i++) {
				ans += i * dp[i];
			}
			Console.WriteLine(ans);

		}
	}
}


Measured memory_bytes: 105728