akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <map>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <chrono>
#include <thread>
#include <string.h>
 
#define rep(i,n)    for(ll i=0;i<n;i++)
#define repu(i,k,n) for(ll i=k;i<=n;i++)
#define repd(i,k,n) for(ll i=k;i>=n;i--)
#define se second
#define fi first
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define endl "\n"
#define INF (ll)ll_MAX
 
typedef long long ll;
typedef long double ld;
typedef std::pair<ll, ll> pii;
typedef std::vector< ll > vi;
typedef std::vector< pii > vii;
typedef std::vector< ll > vll;
typedef std::vector< std::pair < pii, ll > > vpp;
 
const ll N = 3*1e5 +5 ;
const long long MOD = 1000000007;
const long long MOD2 = 998244353;
const long long inf = 1e18;
 
using namespace std;

// ll g[200000], ig[200000];



bool ok;

void dfs1(ll u, bool vis[], ll tot[], ll p[],ll h[], vll v[]){
    if(vis[u]==1) return;
    vis[u] = 1;

    ll sum = 0;

    sum += p[u];

    ll sorr = 0;

    for(ll i=1;i<v[u].size();i++){
        // cout<<'a';
        dfs1(v[u][i],vis,tot,p,h,v);
        sum+= tot[v[u][i]];
        sorr = sorr +  tot[v[u][i]] - h[v[u][i]];
    }

    // cout<<sum;

    tot[u] = sum;

    // if(tot[u]-h[u]>sorr){
    //     cout<<tot[u]-h[u]<<' '<<sorr<<'\n';
    //     ok = false;
    //     // cout<<"NOOOOO";
    // }

    return;

}

void dfs2(ll u, bool vis[], ll tot[], ll p[],ll h[], vll v[]){
    if(vis[u]==1) return;
    vis[u] = 1;

    // ll sum = 0;

    // sum += p[u];

    ll sorr = 0;

    for(ll i=1;i<v[u].size();i++){
        // cout<<'a';
        dfs2(v[u][i],vis,tot,p,h,v);
        // sum+= tot[v[u][i]];
        sorr = sorr +  tot[v[u][i]] - h[v[u][i]];
    }

    // cout<<sum;

    // tot[u] = sum;

    // cout<<sorr<<endl;

    if(tot[u]-h[u]>sorr + 2*p[u]){
        // cout<<u<<' '<<tot[u]-h[u]<<' '<<sorr<<'\n';
        ok = false;
        // cout<<"NOOOOO";
    }

    if((tot[u]-h[u])%2==1){
        ok = false;
    }

    if(h[u]>(tot[u]) or h[u]<(-tot[u])){
        ok = false;
    }

    return;

}





void solve()
{	
    
    ll x,k,d;
    cin>>x>>k>>d;

    if(abs(x)/d>=k){
        cout<<abs(x)-k*d;
        return;
    }


    x = abs(x);

    ll temp = x/d;
    x = x-temp*d;
    k = k-temp;

    if(k%2==0){
        cout<<x;
    }
    else{
        cout<<abs(x-d);
    }

    // ll l1,l2,l3;
    // l1 = l2 = 1e15;
    // l3 = l1*l2;

    // cout<<endl<<l3;



}

int main() {


    // #ifndef ONLINE_JUDGE
    //     // for getting input from input.txt
    //     freopen("input.txt", "r", stdin);
    //     // for writing output to output.txt
    //     freopen("output.txt", "w", stdout);
    // #endif


    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    ll t = 1;
    // cin>>t;
    ll ctr=0;
    while(t--)
    {   
        ctr++;
        // cout<<"Case #"<<ctr<<": ";
        solve();    
    } 
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
 
}

Measured memory_bytes: 3804
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (int i = 0; i < n; i++)
#include <math.h> /* M_PI */
#define INF 2147483647
int main()
{
    ll a;
    ll b;
    cin >> a >> b;
    cout << a * b;
}

Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] p = new Integer[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }
        sc.close();

        int count = 0;
        for (int i = 1; i < n - 1; i++) {
            if (p[i - 1] == p[i + 1]) {
                if (p[i] < p[i + 1]) {
                    count++;
                }
            } else if (p[i - 1] < p[i + 1]) {
                if (p[i - 1] <= p[i] && p[i] < p[i + 1]) {
                    count++;
                }
            } else if (p[i - 1] > p[i + 1]) {
                if (p[i - 1] > p[i] && p[i] >= p[i + 1]) {
                    count++;
                }
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 21972
class Combination:                                      # 計算量は O(n_max + log(mod))
    def __init__(self, n_max, mod=10**9+7):
        self.mod = mod
        f = 1
        self.fac = fac = [f]
        for i in range(1, n_max+1):                     # 階乗(= n_max !)の逆元を生成
            f = f * i % mod                             # 動的計画法による階乗の高速計算
            fac.append(f)                               # fac は階乗のリスト
        f = pow(f, mod-2, mod)                          # 階乗から階乗の逆元を計算。フェルマーの小定理より、　a^-1 = a^(p-2) (mod p) if p = prime number and p and a are coprime
                                                        # python の pow 関数は自動的に mod の下での高速累乗を行ってくれる
        self.facinv = facinv = [f]
        for i in range(n_max, 0, -1):                   # 上記の階乗の逆元から階乗の逆元のリストを生成（＝ facinv ）
            f = f * i % mod
            facinv.append(f)
        facinv.reverse()

    def __call__(self, n, r):  # self.C と同じ
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def C(self, n, r):
        if not 0 <= r <= n: return 0                    # 範囲外という事はすなわち、そのような場合の数は無いはずなので、0を出力すればよい。（これが無いとREになる）
        return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod

    def P(self, n, r):
        if not 0 <= r <= n: return 0
        return self.fac[n] * self.facinv[n-r] % self.mod

    def H(self, n, r):                                  # (箱区別:〇　ボール区別:×　空箱:〇)　重複組み合わせ nHm
        if (n == 0 and r > 0) or r < 0: return 0
        return self.fac[n+r-1] * self.facinv[r] % self.mod * self.facinv[n-1] % self.mod

from math import ceil
MOD = 10**9 + 7
S = int(input())
C = Combination(S*10)
print(sum(C.H(n,S-3*n) for n in range(1,ceil(S/3)+3))%MOD)

Measured memory_bytes: 67692
#include <set>
#include <queue>
#include <cmath>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define debug(x) cerr<<#x<<'='<<x<<endl
#define set0(x) memset(x,0,sizeof(x))
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();ll f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}

ll M,cs = 0,u,v,cs2 = 0;
int main() {
	cin>>M;
	for(int i=0;i<M;i++){
		cin>>u>>v;
		cs2+=v;
		cs+=u*v;
	}
	cout<<cs2-1+(cs-1)/9<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>  
#include <cstring>  
#include <algorithm> 
using namespace std; 
int main()
{
    int a,b,c,d;
    while(cin>>a>>b>>c>>d)
    {
	    if(min(b,d)-max(a,c)<=0)cout<<0<<endl;
    	else cout<<min(b,d)-max(a,c)<<endl;
    	
    }
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>

using namespace std;

int main(){
    int a; cin>>a;
    int b[110]; for(int i=0;i<a;++i)cin>>b[i];
    int c; cin>>c;
    int d[110],e[110]; for(int i=0;i<c;++i)cin>>d[i]>>e[i];

    int sum=0;
    for(int i=0;i<a;++i)sum += b[i];

    int ans[110];
    for(int i=0;i<c;++i){
        ans[i] = sum + (e[i]- b[d[i]-1]);
        cout<<ans[i]<<endl;
    }
}

Measured memory_bytes: 256
N = int(input())
h = list(map(int, input().split()))

current_h = [0] * N
c = 0

l = 0
while True:
    escape_loop = False
    while current_h[l] == h[l]:
        if l + 1 < N:
            l += 1
        else:
            escape_loop = True
            break
    if escape_loop:
        break

    r = l
    while True:
        if r + 1 < N and current_h[r + 1] < h[r + 1]:
            r += 1
        else:
            break

    for i in range(l, r + 1):
        current_h[i] += 1
    c += 1

print(c)


Measured memory_bytes: 3064
package main

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

var s = bufio.NewScanner(os.Stdin)
var w = bufio.NewWriter(os.Stdout)

func main() {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())

	T := make(map[string]int)
	for i := 0; s.Scan() && i < n; i++ {
		cmd := strings.Fields(s.Text())
		switch cmd[0] {
		case "find":
			if _, ok := T[cmd[1]]; ok {
				fmt.Fprintln(w, "yes")
			} else {
				fmt.Fprintln(w, "no")
			}
		case "insert":
			T[cmd[1]] = 0
		}
	}

	w.Flush()
}



Measured memory_bytes: 43744
#include <iostream>
#include <vector>
#include <string.h>

using namespace std;

const long modulo = 1e9+7;

int main(){
    long long N,Ci,last,i,j;
    while(cin >> N){
        last = 0;
        vector<long> stones;
        for(i = 0; i < N; i++){
            cin >> Ci;
            if(Ci != last) stones.push_back(Ci);
            last = Ci;
        }
        long long ans[stones.size() + 1],store[200007];
        memset(ans,0,sizeof(ans));
        memset(store,0,sizeof(store));
        ans[0] = 1;
        for(i = 1; i <= stones.size(); i++){
            ans[i] = (ans[i - 1] + store[stones[i - 1]]) % modulo;
            store[stones[i - 1]] = ans[i];
        }
        cout << ans[stones.size()] << endl;
    }
    return 0;
}

Measured memory_bytes: 7996
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    X, N = map(int, input().split())
    if N == 0:
        print(X)
        exit()
    else:
        P = set(map(int, input().split()))
    for i in range(100):
        x2 = X - i
        if x2 not in P:
            print(x2)
            exit()
        x1 = X + i
        if x1 not in P:
            print(x1)
            exit()

if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
int main()

{

  int n,m;
  cin>>n>>m;
  int i;
  int a[m];
  for(i=0;i<m;i++)
    cin>>a[i];
  if(n-accumulate(a,a+m,0) <0)
    cout<<"-1";
  else
    cout<<n-accumulate(a,a+m,0);
}


Measured memory_bytes: 3676
def check c, n, k, list
	i = 0
	0.upto k-1 do
		s = 0
		while s + list[i] <= c
			s += list[i]
			i += 1
			return n if i == n
		end
	end
	return i
end

def solve n, k, list
	left = 0
	right = 100000 * 100000
	while right - left > 1
		mid = (left + right)/2
		v = check mid, n, k, list
	if v >= n 
		right = mid	
	else
		left = mid
	end
end
return right
end


n, k = gets.split.map(&:to_i)
list = []
n.times do
	list << gets.to_i
end
ans = solve n, k, list
puts ans

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

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

  int n;
  cin >> n;

  string s, t;
  cin >> s >> t;

  for (int i = 0; i < n; ++i) cout << s[i] << t[i];
  cout << '\n';

  return (0);
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n, m;
  cin >> n >> m;
  map<ll, ll, greater<ll>> mp;
  rep(i, n) {
    ll a;
    cin >> a;
    mp[a]++;
  }
  rep(i, m) {
    ll b, c;
    cin >> b >> c;
    mp[c] += b;
  }
  ll ans = 0, cnt = n;
  for(auto v : mp) {
    ll k = v.first;
    ll num = v.second;
    if(cnt > num) {
      ans += k * num;
      cnt -= num;
      continue;
    }
    ans += k * cnt;
    break;
  }
  cout << ans << endl;
}

Measured memory_bytes: 16116
<?php

class Scanner
{
    private $arr = [];
    private $count = 0;
    private $pointer = 0;

    public function next()
    {
        if ($this->pointer >= $this->count) {
            $str = trim(fgets(STDIN));
            $this->arr = explode(" ", $str);
            $this->count = count($this->arr);
            $this->pointer = 0;
        }
        $result = $this->arr[$this->pointer];
        $this->pointer++;
        return $result;
    }

    public function hasNext()
    {
        return $this->pointer < $this->count;
    }

    public function nextInt()
    {
        return (int)$this->next();
    }

    public function nextDouble()
    {
        return (double)$this->next();
    }
}

class out
{
    public static function printIn($str = "")
    {
        echo $str . PHP_EOL;
    }
}

$sc = new Scanner;

$s = $sc->next();
$s_arr = str_split($s);

//for ($i = 0; $i < count($s_arr); $i++) {
//  if ($i === 0 || $i % 2 === 0){
//      echo $s_arr[$i];
//  }
//}

$a = strpos($s, 'A');
$z = strrpos($s, 'Z');

echo $z - $a + 1;

Measured memory_bytes: 18936
#include<iostream>
using namespace std;
int main()
{
    int n, w[1000];
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> w[i];
    }
    for (int i = n; i > 1; i--)
    {
        cout << w[i]<<' ';
    }
    cout << w[1] << endl;
    return 0;
}

Measured memory_bytes: 3096
# -*- coding: utf-8 -*-

n = int(input())

mod2 = lambda x: x%2
div2 = lambda x: x//2

l_a = list(map(int, input().split()))
odd_flgs = list(map(mod2, l_a))

cnt = 0

while sum(odd_flgs) == 0:
    cnt += 1
    l_a = list(map(div2, l_a))
    odd_flgs = list(map(mod2, l_a))

print(cnt)


Measured memory_bytes: 9168
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxtt[i])
#define clr(x,y) memset(x,y,sizeof(x))
#define in(a) a=read()
#define out(a) printf("%d\n",a)
inline ll read(){
    char c=getchar();ll f=1,x=0;
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=x*10+(c-'0'),c=getchar();
    return x*f;
}
#define mod 1000000007
void MOD(int &x){if(x>=mod)x-=mod;}
#define maxn 10000010
#define inf (1<<30)
int pre[maxn],a[maxn],nxt[maxn];
int nxtt[maxn],head[maxn],to[maxn],l;
void add(int x,int y){l++;nxtt[l]=head[x];head[x]=l;to[l]=y;}
int main(){
    int n;
    in(n);
    FOR(i,1,n){
    	in(a[i]);
        add(a[i],i);
        pre[i]=i-1;nxt[i]=i+1;
    }
    nxt[n+1]=n+1;
    ll ans=0;
    FOR(i,1,n){
        FORL(j,i){
        	int x=to[j];
			ans+=1ll*(pre[x]-pre[pre[x]])*(nxt[x]-x)*a[x];
            ans+=1ll*(x-pre[x])*(nxt[nxt[x]]-nxt[x])*a[x];
            pre[nxt[x]]=pre[x];
            nxt[pre[x]]=nxt[x];
        }
    }
    printf("%lld\n",ans);
}

Measured memory_bytes: 10880
n=int(input())
G=[[0]*20 for i in range(45)]
A=[0,0,0,0]
for i in range(n):
  S=list(input())
  s=""
  f=0
  a=0
  for j in S:
    if j==".":
      f=1
    else:
      s=s+j
      if f==1:
        a=a+1
  A[0]=int(s)
  A[1]=a
  m=int(s)
  c=0
  while m%10==0:
    c=c+1
    m=m//10
  A[0]=m
  A[1]-=c
  m=A[0]
  c=0
  while m%2==0:
    c=c+1
    m=m//2
  A[2]=c
  c=0
  m=A[0]
  while m%5==0:
    c=c+1
    m=m//5
  A[3]=c
  G[A[2]-A[1]+9][A[3]-A[1]+9]+=1
B=[[0]*21 for i in range(46)]
for i in range(44,-1,-1):
  for j in range(19,-1,-1):
    B[i][j]=B[i+1][j]+B[i][j+1]-B[i+1][j+1]+G[i][j]
ans=0
for i in range(45):
  for j in range(20):
    ans=ans+G[i][j]*B[max(0,18-i)][max(0,18-j)]
    if i>=max(0,18-i) and j>=max(0,18-j):
      ans=ans-G[i][j]
print(ans//2)

Measured memory_bytes: 72604
#include <stdio.h>
main(){
  int i,j,n1,n2,S[100000],T[50000],count=0,l=0,r,m;
  scanf("%d",&n1);
  for(i = 0; i < n1; i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&n2);
  for(i = 0; i < n2; i++){
    scanf("%d",&T[i]);
  }
  for(i = 0; i < n2; i++){
    l = 0;
    r = n1;
    while(l < r){
      m = (l+r)/2;
      if(T[i] == S[m]){
	count++;
        break;
      }
      if(T[i] > S[m]){
	l = m + 1;
      }
      else if(T[i] < S[m]){
	r = m;
      }
    }
  }  
  printf("%d\n",count);
  
  return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string ss;cin>>ss;
    if(ss=="ABC")cout<<"ARC"<<endl;
    else cout<<"ABC"<<endl;
    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int n;
int a[100000];

long long int min(long long int a, long long int b) {
    return a < b ? a : b;
}

long long int count(int sf) {
    int i;
    long long int sum = 0, count = 0;
    
    for (i = 0; i < n; i++) {
        sum += a[i];
        if (!sf) {
            if (sum >= 0) {
                count += sum + 1;
                sum = -1;
            }
        }
        else {
            if (sum <= 0) {
                count += -sum + 1;
                sum = 1;
            }
        }
        sf = !sf;
    }
    return count;
}

int main(void) {
    int i;
    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    
    printf("%lld\n", min(count(0), count(1)));
    return 0;
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:11:34 2020

@author: NEC-PCuser
"""

N = int(input())

s = input()

l = 0
r = len(s) - 1
count = 0
while True:
	flg = False
	for i in range(l, r):
		if (s[i] == 'W'):
			l = i + 1
			flg = True
			break
	for j in range(r, l - 1, -1):
		if (s[j] == 'R'):
			r = j - 1
			if flg:
				count += 1
			break
	else:
		break
	if flg == False:
		break
print(count)


Measured memory_bytes: 9492
n = int(input())
for i in range(1,n+1):
    if i % 3 == 0:
        print(" {0}".format(i), end="")
    else:
        x = i
        while x != 0:
            if x % 10 == 3:
                print(" {0}".format(i), end="")
                break;
            x //= 10;
print("")


Measured memory_bytes: 5872
#include<bits/stdc++.h>
using namespace std;
 
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define pfis(a) printf("%d ",a);
#define pfls(a) printf("%lld ",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,a,b) for(int i=a;i<b;i++)
#define pb(a) push_back(a);
#define mp(a,b) make_pair(a,b)
#define ll long long   

const ll mod=1e9+7;
int main()
{
    ll n,h,res=0;
   sfl(n);
   sfl(h);
//   cout<<h<<endl;
   ll p,j,max1=0,i;
   ll a[n],b[n];
   for(j=0;j<n;j++)
   {
    sfl(a[j]);
    sfl(b[j]);
   }
   sort(a,a+n);
   sort(b,b+n);
  max1=a[n-1];
  //cout<<max1;
  for(i=n-1;i>=0;i--)
  {
      if(b[i]>=max1 && h>0)
      {
          h=h-b[i];
          res++;
          
        //  cout<<h<<endl;
      }
  }
  p=h/max1;
 // cout<<p<<endl;
  if(p>0)
  {
      if(p*max1<h)
      {
          res++;
      }
      res=res+p;
  }
  
    cout<<res<<endl;  
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=100010;
const ll mod=1e9+7;

typedef vector<vector<pair<double,int>>> wgraph;
typedef pair<double,int> pli;

vector<double> bfs(wgraph v,int x){
  priority_queue<pli,vector<pli>,greater<pli>> q;
  vector<double> dist(v.size(),1e18);
  dist[x]=0;
  q.push({0LL,x});

  while(q.size()){
    pli p=q.top(); q.pop();
    double d=p.F;int now=p.S;
    if(dist[now]<d){ continue; }
    for(auto to:v[now]){
      if(dist[to.S]>d+to.F){
        dist[to.S] = d+to.F;
        q.push({dist[to.S], to.S});
      }
    }
  }
  return dist;
}


int main(){
  vector<int> x(1010,0),y(1010,0),r(1010,0);
  rep(i,2){
    cin >> x[i] >> y[i];
  }
  int n;
  cin >> n;
  n+=2;
  REP(i,2,n){
    cin >> x[i] >> y[i] >> r[i];
  }
  wgraph v(n);
  rep(i,n)rep(j,n)if(i!=j){
    double X = (x[i]-x[j]);
    double Y = (y[i]-y[j]);
    double z = sqrtl(X*X+Y*Y)-r[i]-r[j];
//    double z = hypot(x[i]-x[j],y[i]-y[j])-r[i]-r[j];
    z = max(z,0.0);
    v[i].emplace_back(z,j);
  }
  vector<double> dist=bfs(v,0);
  double ans = dist[1];
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 37360
package main

import (
	"fmt"
)

func main() {
	for {
		var x string
		var sum int
		fmt.Scan(&x)
		if x == "0" {
			break
		}
		for _, num := range x {
			sum += int(num - '0')
		}
		fmt.Println(sum)
	}
}



Measured memory_bytes: 1136
void main() {
    readln.split.to!(int[]).sort!"a < b".uniq.array.length.writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag,
		tree_order_statistics_node_update> ordered_set;

#define el				'\n'
#define sz(v)			((int)((v).size()))
#define all(v)          ((v).begin()),((v).end())
#define clr(v, d)		memset(v, d, sizeof(v))

double const EPS = 1e-8, PI = acos(-1);
const int N = 100 + 9, M = 1e5 + 9, OO = (int) 1e9 + 1;
const long long MOD = 1e9 + 7, INF = 1e13 + 9;

typedef long long ll;

void OUTPUT() {
	cout << fixed << setprecision(0);
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}

void INPUT() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
}

int main() {
//	INPUT();
	OUTPUT();
  	ll n;
  	cin>>n;
    if(n%1000 == 0)
        cout<<0;
    else{
        int x = n / 1000 + 1;
        cout<<  x * 1000 - n;
    }


	return 0;

}


Measured memory_bytes: 3688
// D - Derangement
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; cin>>N;
	int ans = 0;
	for(int i=1; i<=N; ++i){
		int L; cin>>L;
		if(L == i){ ans++; cin>>L; i++; }
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int[] b = new int[n + 1];

			for (int i = 1; i < n; i++) {
				b[i] = scanner.nextInt();
			}
			b[0] = b[n] = 1000000;

			int ans = 0;
			for (int i = 0; i < n; i++) {
				ans += Math.min(b[i], b[i+1]);
			}

			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=1000000007,MAX=1<<16,INF=1<<30;
int dp[MAX];

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        if(N==0) break;
        
        vector<vector<int>> A(N,vector<int>(N+1));
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N+1;j++){
                cin>>A[i][j];
            }
        }
        
        for(int i=0;i<(1<<N);i++) dp[i]=INF;
        
        dp[0]=0;
        
        for(int bit=0;bit<(1<<N);bit++){
            for(int to=0;to<N;to++){
                if(bit&(1<<to)) continue;
                int cost=A[to][0];
                
                for(int i=0;i<N;i++){
                    if(bit&(1<<i)) cost=min(cost,A[to][i+1]);
                }
                
                dp[bit|(1<<to)]=min(dp[bit|(1<<to)],dp[bit]+cost);
            }
        }
        
        cout<<dp[(1<<N)-1]<<endl;
        
    }
}




Measured memory_bytes: 3356
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;

using namespace std;

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*/
int main() {
	ll N, T;cin >> N >> T;
	VLL t(N);
	ll ans = T;
	cin >> t[0];
	for (int i = 1;i < N;i++) {
		cin >> t[i];
		if (t[i] - t[i - 1] > T)ans += T;
		else ans += t[i] - t[i - 1];
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
package main

import (
	"fmt"
)

func main() {
	var a, b, c, ans int
	fmt.Scan(&a, &b, &c)

	if a == b && b == c {
		ans = 1
	} else if a == b || b == c || c == a {
		ans = 2
	} else {
		ans = 3
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <cstdio>
#include <algorithm>
#include <vector>
#define file(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)

inline int read()
{
	int data = 0, w = 1; char ch = getchar();
	while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9') data = data * 10 + (ch ^ 48), ch = getchar();
	return data * w;
}

const int N(1e5 + 10), LogN(17);
int n, L, Q, A[N], f[LogN][N], stk[N], H, T;

int main()
{
	n = read(), H = 1, T = 0;
	for (int i = 1; i <= n; i++) A[i] = read();
	L = read(), Q = read(), f[0][n] = n;
	for (int i = n; i; i--)
	{
		while (H <= T && A[stk[H]] - A[i] > L) ++H;
		if (H <= T) f[0][i] = stk[H];
		stk[++T] = i;
	}
	for (int i = 1; i < LogN; i++)
		for (int j = 1; j <= n; j++) f[i][j] = f[i - 1][f[i - 1][j]];
	for (int a, b, ans; Q--; )
	{
		a = read(), b = read(), ans = 0; if (a > b) std::swap(a, b);
		for (int i = LogN - 1; ~i; i--) if (f[i][a] && f[i][a] < b)
			ans += (1 << i), a = f[i][a];
		printf("%d\n", ans + 1);
	}
	return 0;
}


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

using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset

typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;

#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'

char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll fexp (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = fexp (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return fexp (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/gcd(num1,num2))*num2;}


// end of Template
ll sum[300000],ans;
int n;
ll sumr(int l, int r){
    return sum[r] - sum[l-1];
}
int main(){

//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n;
    for(int i=1;i<=n;i++){
        ll a; cin>>a; sum[i] = sum[i-1] + a;
    }
    ans = LONG_LONG_MAX;
    for(int i=2;i<=n;i++){
        ll a,b;
        a = sumr(1,i-1);
        b = sumr(i,n);
        ll temp = abs(a-b);
        ans = min(ans,temp);
    }
    cout<<ans<<newl;

}


Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <numeric>

const int mod = 1000000007;
class carr {
	int** c;
	int level;
public:
	carr(int n, int t = 0) {
		for (int i = 0; i < 30; i++) {
			if (1 << i >= n) {
				level = i + 1;
				break;
			}
		}
		c = new int*[level];
		for (int i = 0; i < level; i++) {
			c[i] = new int[1 << (level - 1 - i)];
			for (int j = 0; j < 1 << (level - 1 - i); j++) {
				if (i == 0) {
					c[0][j] = j < n ? t : 0;
				}
				else {
					c[i][j] = c[i - 1][j << 1] + c[i - 1][(j << 1) + 1];
				}
			}
		}
	}
	carr(int n, int *t) {
		for (int i = 0; i < 30; i++) {
			if (1 << i >= n) {
				level = i + 1;
				break;
			}
		}
		c = new int*[level];
		for (int i = 0; i < level; i++) {
			c[i] = new int[1 << (level - 1 - i)];
			for (int j = 0; j < 1 << (level - 1 - i); j++) {
				if (i == 0) {
					c[0][j] = j < n ? t[j] : 0;
				}
				else {
					c[i][j] = c[i - 1][j << 1] + c[i - 1][(j << 1) + 1];
				}
			}
		}
	}
	void cadd(int n, int a = 1) {
		for (int i = 0; i < level; i++) {
			c[i][n >> i] += a;
		}
	}
	void csub(int n, int a = 1) {
		for (int i = 0; i < level; i++) {
			c[i][n >> i] -= a;
		}
	}
	int prev(int n) {
		if (c[0][n])return n;
		for (int i = 0; i < level; i++) {
			if (n&(1 << i) && c[i][(n >> i) - 1]) {
				int r = (n >> i) - 1;
				for (int j = i - 1; j >= 0; j--) {
					r <<= 1;
					if (c[j][r | 1])r |= 1;
				}
				return r;
			}
		}
		return -1;
	}
};
int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	std::pair<int, int> *d = new std::pair<int, int>[N];
	for (int i = 0; i < N; i++) {
		int A, B;
		scanf("%d %d", &A, &B);
		d[i].first = -B;
		d[i].second = A;
	}
	std::sort(d, d + N);
	carr c(M, 1);
	int res = 0;
	for (int i = 0; i < N; i++) {
		if (d[i].second > M)continue;
		int r = c.prev(M - d[i].second);
		if (r != -1) {
			res -= d[i].first;
			c.csub(r);
		}
	}
	printf("%d", res);
}

Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static int[] DR = { 1, 1, 1, 0, 0, -1, -1, -1 };
	static int[] DC = { -1, 0, 1, -1, 1, -1, 0, 1 };

	public static void main(String[] args) throws Exception {
		char[][] b = new char[8][8];
		for (int i = 0; i < 8; ++i) {
			b[i] = sc.next().toCharArray();
		}
		char[] hand = { 'o', 'x' };
		for (int t = 0; t < 64; ++t) {
			int pr = -1;
			int pc = -1;
			int best = -1;
			for (int i = 0; i < 8; ++i) {
				for (int j = 0; j < 8; ++j) {
					int c = count(b, i, j, hand[t % 2]);
					if (c > 0 && (c > best || (t % 2 != 0 && c == best))) {
						best = c;
						pr = i;
						pc = j;
					}
				}
			}
			//			System.out.println(pr + " " + pc + " " + best);
			if (best != -1) put(b, pr, pc, hand[t % 2]);
		}
		for (int i = 0; i < 8; ++i) {
			System.out.println(String.valueOf(b[i]));
		}
	}

	static int count(char[][] board, int r, int c, char hand) {
		if (board[r][c] != '.') return 0;
		int count = 0;
		for (int i = 0; i < 8; ++i) {
			int pr = r + DR[i];
			int pc = c + DC[i];
			int revert = 0;
			while (0 <= pr && pr < 8 && 0 <= pc && pc < 8) {
				if (board[pr][pc] == hand) {
					count += revert;
					break;
				}
				if (board[pr][pc] == '.') {
					break;
				}
				pr += DR[i];
				pc += DC[i];
				++revert;
			}
		}
		return count;
	}

	static void put(char[][] board, int r, int c, char hand) {
		board[r][c] = hand;
		for (int i = 0; i < 8; ++i) {
			int pr = r + DR[i];
			int pc = c + DC[i];
			while (0 <= pr && pr < 8 && 0 <= pc && pc < 8) {
				if (board[pr][pc] == hand) {
					pr -= DR[i];
					pc -= DC[i];
					while (pr != r || pc != c) {
						board[pr][pc] = hand;
						pr -= DR[i];
						pc -= DC[i];
					}
					break;
				}
				if (board[pr][pc] == '.') {
					break;
				}
				pr += DR[i];
				pc += DC[i];
			}
		}
	}
}

Measured memory_bytes: 19040
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int MAX_N=101;
struct edge{
    int src,dst,cost;
    edge(int src,int dst,int cost):
    src(src),dst(dst),cost(cost){}
    };
bool operator < (const edge &m,const edge &f){
    return m.cost!=f.cost?m.cost<f.cost:
    m.src!=f.src?m.src<f.src:m.dst<f.dst;
}
struct UnionFind{
    int par[MAX_N],rank[MAX_N]; 
    void init(int n){
        for (int i=0;i<n;i++){par[i]=i;rank[i]=0;}
    } 
    int find(int x){
        if (x==par[x]) return (x);
        return (par[x]=find(par[x]));
    }
    void unite(int x, int y){
        x=find(x);y=find(y);       
        if(x==y) return;
        if(rank[x]<rank[y]){par[x]=y;}
        else{par[y]=x;if(rank[x]==rank[y]) rank[x]++;}
    } 
    bool same(int x, int y){return (find(x) == find(y));} 
};
vector<edge> ve;
int n;
int kruskal(){
    sort(ve.begin(),ve.end());
    UnionFind uf;
    uf.init(n);
    int res=0;
    rep(i,ve.size()){
        edge m=ve[i];
        if(!uf.same(m.src,m.dst)){
            uf.unite(m.src,m.dst);
            res +=m.cost;
        }
    }
    return res;
}
int main(){
    cin>>n;
    int a;
    rep(i,n){
        rep(j,n){
            cin>>a;
            if(a!=-1) ve.pb(edge(i,j,a));
        }
    }
    cout<<kruskal()<<endl;
    return 0;
}


Measured memory_bytes: 3152
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
VL AA[8];
int main(){
    int N,M;
    R(N,M);
    REP(i,N){
        LL d[3];
        REP(j,3)R(d[j]);
        REP(j,8){
            LL now=0;
            REP(k,3){
                if((j>>k)&1)now+=d[k];
                else now-=d[k];
            }
            AA[j].PB(now);
        }
    }
    LL an=0;
    REP(i,8){
        sort(ALL(AA[i]),greater<LL>());
        LL now=0;
        REP(j,M)now+=AA[i][j];
        an=max(an,now);
    }
    W(an);
    return 0;
}


Measured memory_bytes: 3912
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

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

	cin >> N >> K;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	while (K--) {
		cin >> M >> L >> R;
		long long int ed = L;
		auto w = v;
		long long int sum = 0;
		for (auto &i : w) {
			i %= R;
			sum += i;
		}
		long long int index = 0;
		for (; index%N != (M - 1) % N; index++) {
			ed += w[index];
		}
		ed += (M - 1 - index) / N*sum;
		long long int ans = M - 1;
		ans -= ed / R - L / R;
		for (int i = 0; i < N; i++) {
			if (!w[i]) {
				ans -= (M - 1) / N;
				if ((M - 1) % N > i)ans--;
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 384
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

// Created by White Knife on 15/04/20.
// doot diddly donger cuckerino Hahahahahah

#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#pragma GCC target("popcnt")


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

// @formatter:off
#define F               first
#define S               second
#define all(x)          (x).begin(), (x).end()
#define sz(x)           (long long) (x).size()
#define sim             template<typename T
#define ris             return *this
#define dor             > debug & operator <<
#define eni(x)          sim > typename enable_if<sizeof dud<T>(0) x 1, debug&>::type operator<<(T i)
sim> struct rge { T b, e; };
sim> rge<T> rang(T i, T j) { return rge<T>{i, j}; }
sim> auto dud(T *x) -> decltype(cerr << *x, 0);
sim> char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) { cerr << boolalpha << i; ris; }
  eni(==) { ris << rang(all(i)); }
  sim, typename U dor(pair<U, T> d) { ris << "(" << d.first << ", " << d.second << ")"; }
  sim dor(rge<T> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
  sim dor(const T&) { ris; }
#endif
};
#define pr(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ull = unsigned long long;
using ld = long double;
//using li = __int128;
//using uli = unsigned __int128;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vb = vector<bool>;

using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

const ld PI = acos(-1);

template<typename T> inline T mini(T& x, T y) { return x = min(x, y); }
template<typename T> inline T maxi(T& x, T y) { return x = max(x, y); }
template <typename T> T rand(T x, T y) { return rand() % (y - x + 1) + x; }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
// @formatter:on


class BTripleDots {
public:
  
  void solveOne(istream& cin, ostream& cout) {
    string s;
    int k;
    cin >> k >> s;
    for (int i = 0; i < s.length(); ++i) {
      if (i < k) {
        cout << s[i];
      } else {
        cout << "...";
        return;
      }
    }
  }
  
  void solve(std::istream& cin, std::ostream& cout) {
    int t = 1;
    // cin >> t;
    for (int tc = 1; tc <= t; ++tc) {
      //	cout << "Case #" << tc << ": ";
      solveOne(cin, cout);
    }
  }
};

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
	BTripleDots solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(void){
    int a,b,c,m;
    cin>>a>>b>>c;
    m=max(max(a,b),c);
    if((3*m-(a+b+c))%2==1) m++;
    cout<<(3*m-(a+b+c))/2;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

void Swap(long x[ ], int i, int j)
{
    long temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

void QSort(long x[ ], int left, int right)
{
    int i, j;
    long pivot;

    i = left;                      /* ソートする配列の一番小さい要素の添字 */
    j = right;                     /* ソートする配列の一番大きい要素の添字 */

    pivot = x[(left + right) / 2]; /* 基準値を配列の中央付近にとる */

    while (1) {                    /* 無限ループ */

        while (x[i] < pivot)       /* pivot より大きい値が */
            i++;                   /* 出るまで i を増加させる */

        while (pivot < x[j])       /* pivot より小さい値が */
            j--;                   /*  出るまで j を減少させる */
        if (i >= j)                /* i >= j なら */
            break;                 /* 無限ループから抜ける */

        Swap(x, i, j);             /* x[i] と x[j]を交換 */
        i++;                       /* 次のデータ */
        j--;
    }
    if (left < i - 1)              /* 基準値の左に 2 以上要素があれば */
        QSort(x, left, i - 1);     /* 左の配列を Q ソートする */
    if (j + 1 <  right)            /* 基準値の右に 2 以上要素があれば */
        QSort(x, j + 1, right);    /* 右の配列を Q ソートする */
}

int main(){
  int n,i,j,aaa;;
  long h,a[100000],b[100000],max=0,temp,cnta=0,cntb=0,cnt;
  scanf("%d %ld",&n,&h);
  for(i=0;i<n;i++){ 
    scanf("%ld %ld",&a[i],&b[i]);
    if(max<a[i]) max=a[i];
  }
  QSort(b, 0, n - 1);
  for(i=n-1;i>=0;i--){
    if(max<b[i]){
      h-=b[i];
      cntb++;
    }
    else break;
    if(h<=0) break;
  }
  if(h<=0)  cnta=0;
  else if(h%max!=0)  cnta=(h/max)+1;
  else cnta=h/max;
  cnt=cnta+cntb;
  printf("%ld\n",cnt);
}


Measured memory_bytes: 1792
/*
 * author :Sadik Hassan(_sad_)
 *
*/
#include "bits/stdc++.h"
using namespace std;
using   ll       =    long long;
using   ld       =    long double;
#define nl            "\n"
#define pb            push_back
#define fi            first
#define se            second
#define MP            make_pair
#define PI            (acos(-1.0))
#define rep1(i,n)     for(int i=1;i<=n;i++)
#define rep(i,n)      for(int i=0;i<n;i++)
#define SZ(s)         (int)s.size()
#define all(x)        (x).begin(), (x).end()
#define rall(x)       (x).rbegin(), (x).rend()
#define w(t)          int t;cin>>t;while(t--)
#define TSU(s)        transform(s.begin(),s.end(),s.begin(),::toupper);
#define TSL(s)        transform(s.begin(),s.end(),s.begin(),::tolower);
#define _SAD()     	  ios::sync_with_stdio(0),cin.tie(0),cout.tie(0),cout<<fixed<<setprecision(15);

typedef vector<int> vi;
typedef vector<ll> vii;
typedef set<int> si;
typedef set<ll> sii;
/*---------------------------------------------------------------------*/

const int N = (int)1e6+1;
const int MOD =(ll)1e9+1147483647;
const ll INF = (ll)1e18+5;

int main()
{
    _SAD()
    int a,b,c;
    cin>>a>>b>>c;
    int cnt=0;
    for(int i=a;i<=b;i++)
    {
        if(i%c==0)cnt++;
    }
    cout<<cnt<<nl;
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
	a = max(a,b);
}

void solve(){	
	string str;
	cin >> str;
	if(str[2] == str[3] && str[4] == str[5])
		cout << "Yes\n";
	else
		cout << "No\n";
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    //int t; cin >> t;
    //while(t--) solve();
    //
    solve();
    return 0;
}


Measured memory_bytes: 256
using System;

namespace ITP1_4_B
{
    class Program
    {
        static void Main(string[] args)
        {
            const double pi = 3.141592653589;
            string str = Console.ReadLine();
            double r = double.Parse(str);
            Console.WriteLine("{0:f8} {1:f8}", pi * r * r, pi * r * 2);
        }
    }
}

Measured memory_bytes: 20120