akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<string.h>

int const N = 1300;
int main()
{
	char str1[N], str2[N];

	while(fgets(str1, 1300, stdin))
	{
		int s1 = strlen(str1)-1, go = 0;
		//vanceknowledgeto"advance"knowledgetoad
		for(int i = s1, j = 0; i < s1*2; i++, j++)
		{
			str1[i] = str1[j];
		}
		fgets(str2, 1300, stdin);
		for(int i = 0; i < strlen(str1); i++)
		{
			int k =0;
			for(int j = 0; j < strlen(str2)-1; j++)
			{
				if(str1[i+j] == str2[j])
				{
					k++;
				}
				else
				{
					break;
				}			
			}
			if(k == strlen(str2)-1)
			{
				go = 1;
				break;
			}
		}		
		if(go)
		{
			printf("Yes\n");		
		}	
		else
		{
			printf("No\n");
		}	
	}
		
	return 0;	
}


Measured memory_bytes: 2628
n,d=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

cnt=0
for i in range(n-1):
 for j in range(i+1,n):
  l1=l[i]
  l2=l[j]
  sum=0
  for y,z in zip(l1,l2):
   sum+=(y-z)**2
  dist=sum**0.5
  if dist==int(dist):
   cnt+=1
print(cnt)

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

int main(){
  uint64_t X; cin >> X;
  
  if(X > 1258431959){
    uint64_t ans = 1700, money = 1258431959;
    while(true){
      money = (uint64_t)(money * 1.01);
      ans++;
      if(money >= X){
        break;
      }
    }
    cout << ans << endl;
    return 0;
  }
  
  uint64_t ans = 0, money = 100;
  while(true){
    money = (uint64_t)(money * 1.01);
    ans++;
    if(money >= X){
      break;
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include<algorithm>
#include <string>
#include <set>
#include <limits.h>
#include <map>
#include <queue>
#include <stack>

using namespace std;

#define rip(i,n,s) for (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<long long, int> P;

bool operator<(const P &a, const P &b) {
	if (a.first == b.first) {
		return a.second > b.second;
	}
	else {
		return a.first > b.first;
	}
}
bool operator>(const P &a, const P &b) {
	return (b < a);
}
bool operator>=(const P &a, const P &b) {
	return !(a < b);
}
bool operator<=(const P &a, const P &b) {
	return !(b < a);
}

void dijk(vector<vector<P>> &da, int s, vector<ll> &ans) {
	priority_queue<P,vector<P>,greater<P>> q;
	int x = da[s].size();
	rip(i, x, 0) {
		q.push(da[s][i]);
	}
	ans[s] = 0;
	while (!q.empty()) {
		P no = q.top();
		q.pop();
		//printf("%lld %d\n", no.first, no.second);
		if (ans[no.second] < 0) {
			x = no.second;
			ans[x] = no.first;
			int size = da[x].size();
			rip(i, size, 0) {
				P PA = make_pair(da[x][i].first + no.first, da[x][i].second);
				q.push(PA);
			}
		}
	}
}

int main() {
	int n, m, s, t;
	cin >> n >> m >> s >> t;
	vector<vector<P>> toa(n, vector<P>(0)), otb(n, vector<P>(0));
	s--;t--;
	int u, v;
	ll a, b;
	rip(i, m, 0) {
		cin >> u >> v >> a >> b;
		u--;v--;
		toa[u].push_back(make_pair(a, v));
		otb[v].push_back(make_pair(b, u));
		otb[u].push_back(make_pair(b, v));
		toa[v].push_back(make_pair(a, u));
	}
	vector<ll> A(n, -1), B(n, -1);
	dijk(toa, s, A);
	dijk(otb, t, B);
	vector<ll> ans(n + 1);
	ans[n] = LLONG_MAX;
	rip(i, n, 0) {
		ans[n - i - 1] = min(ans[n - i], A[n - i - 1] + B[n - i - 1]);
	}
	rip(i, n, 0) {
		printf("%lld\n", 1000000000000000 - ans[i]);
	}
}

Measured memory_bytes: 18972
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

#define unordered_map __fast_unordered_map
template<class Key, class Value, class Hash = std::hash<Key>>
using unordered_map = __gnu_pbds::gp_hash_table<Key, Value, Hash>;

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  
  int N;
  cin >> N;
  vector<int> data(N);

  for (int &x : data) { cin >> x; }

  VI ans;
  int sz = N;

  while (!data.empty()) {
    int best = -1;
    for (int i = 0; i < sz; ++i) {
      if (data[i] == i + 1) { best = i; }
    }
    if (best == -1) {
      cout << "-1\n";
      return 0;
    }

    ans.PB(best + 1);
    data.erase(data.begin() + best);
    --sz;
  }

  reverse(ALL(ans));
  for (int v : ans) { cout << v << "\n"; }
}



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

int main(){
  int N,L,i,aji=0;
  cin >> N >> L;

  for(i=1;i<=N;i++)
  aji += L+i-1;

  if(L>=0)
  cout << aji - L << endl;
  else{
    if(N>L*-1)
    cout << aji << endl;
    else
    cout << aji - (L+N-1) << endl;
  }

}


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

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define dump_1(x1) cerr << #x1 << ": " << x1 << endl
#define dump_2(x1, x2) \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define dump_3(x1, x2, x3)                                                \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << endl
#define dump_4(x1, x2, x3, x4)                                            \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << endl
#define dump_5(x1, x2, x3, x4, x5)                                        \
  cerr << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " \
       << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#define dump(...) \
  CHOOSE((__VA_ARGS__, dump_5, dump_4, dump_3, dump_2, dump_1, ~))(__VA_ARGS__)
#define check(s) cerr << s << endl

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

using namespace std;

using ll = long long;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll N, ll K, std::vector<ll> a, std::vector<ll> b) {
  vector<pair<ll, ll>> p(N);
  rep(i, N) { p.at(i) = {a.at(i), b.at(i)}; }
  sort(all(p));

  ll c = 0;
  ll ans;
  rep(i, N) {
    if (c + p.at(i).second >= K) {
      ans = p.at(i).first;
      break;
    }
    c += p.at(i).second;
  }

  cout << ans << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll N;
  scanf("%lld", &N);
  ll K;
  scanf("%lld", &K);
  std::vector<ll> a(N);
  std::vector<ll> b(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
    scanf("%lld", &b[i]);
  }
  solve(N, K, std::move(a), std::move(b));
  return 0;
}


Measured memory_bytes: 6416
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int a[] = new int[n];
    for(int i=0;i<n;i++){
      a[i] = sc.nextInt();
    }
    int cnt[] = new int[n];
    for(int i=0;i<n;i++){
      while(a[i]%2==0){
        a[i]=a[i]/2;
        cnt[i]=cnt[i]+1;
      }
    }
    int answer =0;
    for(int i=0;i<n;i++){
      answer = answer + cnt[i];
    }
    System.out.println(answer);
    
  }
  

  
}

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

using namespace std;

struct Point{
    double x,y;

    Point(){}
    Point(double x,double y) : x(x),y(y) {}

    Point operator + (const Point &p)const{ return Point(x+p.x,y+p.y); }
    Point operator - (const Point &p)const{ return Point(x-p.x,y-p.y); }
    Point operator * (const double &k)const{ return Point(x*k,y*k); }
};

double dot(const Point &a,const Point &b){ return a.x*b.x+a.y*b.y; }
double norm(const Point &p){ return dot(p,p); }

struct Segment{
    Point s,t;
    Segment(){}
    Segment(Point s,Point t) : s(s),t(t) {}
};

typedef Point Vector;

Point projection(const Segment &s,const Point &p){
    Vector b = s.t-s.s;
    double t = dot(p-s.s,b)/norm(b);
    return s.s+b*t;
}

Point reflection(const Segment &s,const Point &p){
    return p+(projection(s,p)-p)*2.0;
}

int main(){
    int Q;
    Point p;
    Segment s;
    cin >> s.s.x >> s.s.y >> s.t.x >> s.t.y;
    cin >> Q;
    while(Q--){
        cin >> p.x >> p.y;
        Point q = reflection(s,p);
        printf("%.12f %.12f\n",q.x,q.y);
    }
    return 0;
}

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

int main() {
    int n, a;
    bool ans = false;
    
    cin >> n >> a;
    
    if ((n % 500) <= a) {
        ans = true;
    }
    
    cout << (ans ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define endl '\n'
const int mod=1e9+7,u=1e5+5;

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

    int n,k;
    cin>>n>>k;
    vector<int> h(n+1),dp(n+1,1e18);
    for(int i=1;i<=n;i++){
        cin>>h[i];
    }   

    dp[1]=0;
    for(int i=2;i<=n;i++){
        for(int j=1;j<i and j<=k;j++){
            dp[i]=min(dp[i-j]+abs(h[i]-h[i-j]),dp[i]);
        }
    }
    cout<<dp[n];

    return 0;
}

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
#include <vector>
#include <map>
#include <functional>
using namespace std;

#define mp make_pair

int main() {
        int n;
        scanf("%d", &n);
        vector<vector<int>> g(n);
        map<pair<int, int>, int> edge_i;
        map<int, pair<int, int>> i_edge;
        for (int i = 0; i < n - 1; i ++) {
                int a, b;
                scanf("%d%d", &a, &b);
                a --, b --;
                g[a].push_back(b);
                g[b].push_back(a);
                edge_i[mp(min(a, b), max(a, b))] = i;
                i_edge[i] = mp(min(a, b), max(a, b));
        }
        vector<long long> s(n);
        for (int i = 0; i < n; i ++) scanf("%lld", &s[i]);
        vector<int> sz(n);
        vector<long long> ans(n);
        //dfs
        function<void (int, int)> dfs = [&](int u, int prev) {
                sz[u] = 1;
                for (auto v : g[u]) if (v != prev) {
                        dfs(v, u);
                        sz[u] += sz[v];
                        long long diff = (n - sz[v]) - sz[v];
                        long long res = (diff == 0 ? 0 : (s[v] - s[u]) / diff);
                        ans[edge_i[mp(min(u, v), max(u, v))]] = res;
                }
        };
        //
        dfs(0, -1);
        for (int i = 0; i < n - 1; i ++) if (ans[i] == 0) {
                int u, v;
                tie(u, v) = i_edge[i];
                long long res = 0;
                //dfs2
                function<void (int, int)> dfs2 = [&](int u, int prev) {
                        for (auto v : g[u]) if (v != prev) {
                                dfs2(v, u);
                                res += sz[v] * ans[edge_i[mp(min(u, v), max(u, v))]];
                        }
                };
                //
                dfs2(0, -1);
                ans[i] = (s[0] - res) / (n / 2);
                break;
        }
        for (int i = 0; i < n - 1; i ++) printf("%lld\n", ans[i]);
        return 0;
}



Measured memory_bytes: 34816
#include<stdio.h>
int main(){
    int x[30000],y[30000],i=0;

     while(1){
        scanf("%d%d",&x[i],&y[i]);
        if(x[i]==0&&y[i]==0){
            break;
        }
        i++;
    }

    i=0;

    while(x[i]!=0&&y[i]!=0||x[i]!=0&&y[i]==0||x[i]==0&&y[i]!=0){
        if(x[i]>y[i]){
            printf("%d %d\n",y[i],x[i]);
        }else{
            printf("%d %d\n",x[i],y[i]);
        }
        i++;
    }

    return 0;
}

Measured memory_bytes: 624
package main

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

type bufReader struct {
	r   *bufio.Reader
	buf []byte
	i   int
}

var reader = &bufReader{
	bufio.NewReader(os.Stdin),
	make([]byte, 0),
	0,
}

func (r *bufReader) readLine() {
	if r.i < len(r.buf) {
		return
	}
	r.buf = make([]byte, 0)
	r.i = 0
	for {
		line, isPrefix, err := r.r.ReadLine()
		if err != nil {
			panic(err)
		}
		r.buf = append(r.buf, line...)
		if !isPrefix {
			break
		}
	}
}

func (r *bufReader) next() string {
	r.readLine()
	from := r.i
	for ; r.i < len(r.buf); r.i++ {
		if r.buf[r.i] == ' ' {
			break
		}
	}
	s := string(r.buf[from:r.i])
	r.i++
	return s
}

func (r *bufReader) nextLine() string {
	r.readLine()
	s := string(r.buf[r.i:])
	r.i = len(r.buf)
	return s
}

var writer = bufio.NewWriter(os.Stdout)

func next() string {
	return reader.next()
}

func nextInt64() int64 {
	i, err := strconv.ParseInt(reader.next(), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func nextInt() int {
	return int(nextInt64())
}

func nextLine() string {
	return reader.nextLine()
}

func out(a ...interface{}) {
	fmt.Fprintln(writer, a...)
}

func max64(x, y int64) int64 {
	if x > y {
		return x
	}
	return y
}

func max(x, y int) int {
	return int(max64(int64(x), int64(y)))
}

func min64(x, y int64) int64 {
	if x < y {
		return x
	}
	return y
}

func min(x, y int) int {
	return int(min64(int64(x), int64(y)))
}

func abs64(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}

func abs(x int) int {
	return int(abs64(int64(x)))
}

func joinInt64s(a []int64, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.FormatInt(v, 10)
	}
	return strings.Join(b, sep)
}

func joinInts(a []int, sep string) string {
	b := make([]string, len(a))
	for i, v := range a {
		b[i] = strconv.Itoa(v)
	}
	return strings.Join(b, sep)
}

func divUp64(x, y int64) int64 {
	return (x + y - 1) / y
}

func divUp(x, y int) int {
	return int(divUp64(int64(x), int64(y)))
}

func gcd64(x, y int64) int64 {
	if x < y {
		x, y = y, x
	}
	for y != 0 {
		x, y = y, x%y
	}
	return x
}

func gcd(x, y int) int {
	return int(gcd64(int64(x), int64(y)))
}

func lcm64(x, y int64) int64 {
	return x * y / gcd64(x, y)
}

func lcm(x, y int) int {
	return int(lcm64(int64(x), int64(y)))
}

func pow64(x, y int64) int64 {
	return int64(math.Pow(float64(x), float64(y)))
}

func pow(x, y int) int {
	return int(pow64(int64(x), int64(y)))
}

func main() {
	solve()
	writer.Flush()
}

func solve() {
	a, b, c := nextInt(), nextInt(), nextInt()
	if a == b+c || b == a+c || c == a+b {
		out("Yes")
	} else {
		out("No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define inf 0x7fffffff
#define ll long long
#define inf INT_MAX
#define REP(i,a,b) for(int i=a;i<=b;i++)
using namespace std;

int main() {
        ios_base::sync_with_stdio(false); 
        cin.tie(NULL);
        // Code Starts...
        ll n;
        cin>>n;
        vector<ll > v(n);
        for (int i=0;i<n;i++)
            cin>>v[i];
        vector<ll > dp(n,inf);
        dp[0] = 0;
        for (int i=0;i<n;i++)
        {
            if (i+1 < n) dp[i+1] = min(dp[i+1],dp[i] + abs(v[i]-v[i+1]));
            if (i+2 < n) dp[i+2] = min(dp[i+2],dp[i] + abs(v[i]-v[i+2]));
        }
        cout<<dp[n-1];
        // Code Ends...
        return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
	public static void main(String[] args){
    //データ取り込み
		Scanner sc = new Scanner(System.in);
		//String S = sc.next();
    //int B = sc.nextInt();
    //System.out.println();
		String S = sc.next();
		String S2 = S.replace("2017","2018" );
		System.out.println(S2);
	}
}

Measured memory_bytes: 21844
import itertools
s=list(input())
n=len(s)
sum1=0

for v in itertools.product(["+",""],repeat=n-1):
    a=""
    for i in range(n-1):
        if v[i]=='+':
            a+=s[i]+v[i]
        else:
            a+=s[i]
    
    a+=s[-1]
    sum1+=eval(a)
print(sum1)

Measured memory_bytes: 3060
//??????????????§????????¨?°????????????????
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br =
				new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();
		
		String str = br.readLine();
		int strLength = str.length();
		
		for(int i=0; i<strLength; i++) {
			
			if(Character.isUpperCase(str.charAt(i))) {
				String a =  String.valueOf(str.charAt(i));
				sb.append(a.toLowerCase());
			}	
			else if(Character.isLowerCase(str.charAt(i))) {
				String a =  String.valueOf(str.charAt(i));
				sb.append(a.toUpperCase());
			}
			else {
				String a =  String.valueOf(str.charAt(i));
				sb.append(a);
			}
		}
		System.out.println(sb.toString());
	}	
}

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

using namespace std;
using ll=long long;

void solve() {
    int n; cin >> n;
    vector<ll> a(n+1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        a[i] += a[i-1];
    }
    
    ll mi = 1ll<<62;
    for (int i = 1; i < n; i++) {
        ll d = abs(a[n]-2*a[i]);
        mi = min(mi, d);
    }
    cout << mi;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


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

int  main()
{
    int a, b;
    scanf("%d%d", &a, &b);
    int c = 1;
    for(int i = 0; i < a; ++i)
    {
        if(c * 2 <= c + b)
        {
            c *= 2;
        }
        else
        {
            c += b;
        }
    }
    cout << c << endl;
    return 0;
}


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

public class Main{

  public static void main(String[] args){
    InputReader in = new InputReader();
    String a = in.next();
    String b = in.next();
    if(a.equals(b)){
      System.out.println(0);
    }
    else{
      char[] arr_a = a.toCharArray();
      char[] arr_b = b.toCharArray();
      int n = arr_a.length;
      int ans= 0;
      for(int i=0;i<n;i++){
        if(arr_a[i]!=arr_b[i]){
          ans++;
        }
      }
      System.out.println(ans);
    }
    
    
  }
static class InputReader {
		public BufferedReader reader;
		public StringTokenizer st;
 
		public InputReader() {
			reader = new BufferedReader(new InputStreamReader(System.in));
		}
 
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(nextLine());
			}
			return st.nextToken();
		}
 
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return null;
		}
 
		public int nextInt() {
			return Integer.parseInt(next());
		}
	}


}

 


Measured memory_bytes: 37572
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;
ll A[100000], B[100000], C[100000];
ll sumB[100000];
ll dp[100000];
bool used[100000];
vector<int> G[100000];
struct UnionFind {
	vector<int> par;

	UnionFind(int n) {
		par = vector<int>(n);
		for (int i = 0; i < n; i++) par[i] = i;
	}

	int find(int x) {
		if (x == par[x]) return x;
		return par[x] = find(par[x]);
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}

	void unite(int x, int y) { // x->y
		x = find(x);
		y = find(y);
		if (x == y) return;
		par[x] = y;
	}
};
bool cmp(int i, int j) {
	return C[i] < C[j];
}
int main() {
	int N, M;
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
		C[i] = max(A[i] - B[i], 0LL);
	}
	for (int i = 0; i < M; i++) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	vector<int> ord(N);
	iota(ord.begin(), ord.end(), 0);
	sort(ord.begin(), ord.end(), cmp);
	UnionFind U(N);
	for (int i = 0; i < N; i++) {
		int u = ord[i];
		set<int> adj;
		for (int to : G[u]) {
			if (!used[to]) continue;
			adj.insert(U.find(to));
		}
		sumB[u] = B[u];
		for (int v : adj) {
			sumB[u] += sumB[v];
			U.unite(v, u);
		}
		dp[u] = C[u] + sumB[u];
		for (int v : adj) {
			dp[u] = min(dp[u], max(dp[v], C[u]) + sumB[u] - sumB[v]);
		}
		used[u] = 1;
	}
	cout << dp[U.find(0)] << endl;
}

Measured memory_bytes: 12284
#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 mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
const ll mod=1e9+7;
ll powmod(ll a,ll b)
{
    ll res=1;
    for(;b;b>>=1){
        if(b&1) res=res*a%mod;
        a=a*a%mod;
    }
    return res;
}
map<pair<ll,ll>, ll>mp;
vector<pair<ll,ll> >G;
int n;
void solve()
{
    scanf("%d",&n);
    ll sum=0,ans=1;
    rep(i,1,n)
    {
        ll fz,fm;
        scanf("%lld%lld",&fz,&fm);
        ll gc=gcd(fz,fm);
        if(gc==0){sum++;continue;}

        fz/=gc,fm/=gc;
        if(fz<0) fm=-fm,fz=-fz;
        mp[{fz,fm}]++;
        G.push_back({fz,fm});
    }


    sort(G.begin(),G.end());
    G.erase(unique(G.begin(),G.end()),G.end());
    //for(auto now:G) printf("now.r:%lld s:%lld mp:%lld\n",now.first,now.second,mp[now]);


    for(auto now:G)
    {

        if(mp[now]==0) continue;
        ll fz=now.first,fm=now.second;
        //printf("fz:%lld fm:%lld\n",fz,fm);

        ll d=powmod(2,mp[now]);

        fm=-fm;
        if(fm<0) fz=-fz,fm=-fm;

        if(mp[{fm,fz}]){
            //printf("fm:%lld fz:%lld\n",fm,fz);
            d=(d+powmod(2,mp[{fm,fz}])-1)%mod;

            mp[{fm,fz}]=0;
        }
        //printf("d:%lld\n",d);
        //d--;
        ans=ans*d%mod;
    }
    ans=(ans+sum-1+mod)%mod;
    printf("%lld\n",ans);
}
int main()
{
	solve();
}
/*
3
1 2
-1 1
2 -1

*/


Measured memory_bytes: 31252
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	m := scanInt(sc)
	cs := make([]int, m)
	for i := 0; i < m; i++ {
		cs[i] = scanInt(sc)
	}

	dp := make([]int, 50001)
	for i := 0; i < len(dp); i++ {
		dp[i] = 100000
	}
	dp[0] = 0
	for i := 0; i < m; i++ {
		for x := 0; x+cs[i] <= n; x++ {
			dp[x+cs[i]] = min(dp[x+cs[i]], dp[x]+1)
		}
	}
	fmt.Println(dp[n])
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}



Measured memory_bytes: 1500
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
//const ll MOD=(ll)998244353;
const ll INF=(ll)1e18+10;
const double PI = 2.0*acos(0);
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};
const int D=365;
const int beam = 100;
int c[26];
int s[D][26];
int ans[D];

struct State{
    ll val = 0;
    int out[D]={0};
    int cnt[26]={0};
};

bool operator< (const State &a, const State &b){
    return a.val<b.val;
}
bool operator> (const State &a, const State &b){
    return a.val>b.val;
}

void itr(){
    priority_queue<State> pq[2];
    pq[0].push(State());
    for (int i = 0; i < D; ++i) {
        int prev=i&1,next = prev^1;
        //cout<<prev<<" "<<next<<endl;
        for (int j = 0; !pq[prev].empty()&&j < beam; ++j) {
            auto state = pq[prev].top();
            pq[prev].pop();
            ll dec=0;
            for (int k = 0; k < 26; ++k) { //開催しなかったときのへる値
                //cout<< state.cnt[k]<<endl;
                state.cnt[k]++;
                dec+=(ll)c[k]*state.cnt[k];
            }
            for (int k = 0; k < 26; ++k) {
                const ll inc = (ll)c[k]*state.cnt[k];
                const int tmp = state.cnt[k];
                const int tmp_val = state.val;
                state.val = state.val-dec+inc+s[i][k];
                state.cnt[k]=0;
                state.out[i]=k;
                pq[next].push(state);
                //cout<<"called"<<endl;
                state.cnt[k]=tmp;
                state.val = tmp_val;
                //if(i==0)cout<<state.val
            }
        }
        pq[prev]=priority_queue<State>();
    }
    auto best = pq[D&1].top().out;
    for (int i = 0; i < D; ++i) {
        ans[i]=best[i]+1;
    }
}

void solve(int ca){
    int waste;
    scanf("%d",&waste);
    for (int i = 0; i < 26; ++i) {
        scanf("%d",c+i);
    }
    for (auto & i : s) {
        for (int & j : i) {
            scanf("%d",&j);
        }
    }

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

}

//#define MULTI
int main() {
#ifdef MULTI
    int N; cin>>N;
    for (int i = 0; i < N; ++i) {
        solve(i+1);
    }
#else
    solve(0);
#endif
    return 0;
}


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

long long N;

int main(){
	cin >> N;
	long long temp = N;
	long long i=1;
	stack<long long> s;
	while(temp!=0){
		if(temp%(i*-2)==0) s.push(0);
		else {
			s.push(1);
			temp-=i;
		}
		i*=-2;
	}
	if(s.empty()) cout << "0" << "\n";
	else {
		while(!s.empty()){
			cout << s.top();
			s.pop();
		}
		cout << "\n";
	}
	return 0;
}


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

N = int(input())

T,A = map(int, input().split())

for i in range(N-1):
    t,a = map(int, input().split())
    tmp1,tmp2 = 1,1
    # ループで足していくより、1回で出せる方法にする
    if t < T:
        # 切り上げはmath.ceilより演算子のみのが速い
        tmp1 = -(-T // t)
    if a < A:
        tmp2 = -(-A // a)
    # 多く増やす必要のある方に合わせて、同じ比で両方増やす
    T = t * max(tmp1,tmp2)
    A = a * max(tmp1,tmp2)

print(T + A)

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

#define dlog(str) cout << "====" << str << endl;
#define INF 999999999
#define MOD 1000000009
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s; i <= e; i++)
#define LLI long long int
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

int main() {
    int N;
    cin >> N;
    vector<int> v(N);
    REP(i, N) { cin >> v[i]; }
    int cnt = 0;
    REP(i, N - 2) {
        if(v[i] < v[i + 1] && v[i + 1] < v[i + 2])
            cnt++;
        if(v[i + 2] < v[i + 1] && v[i + 1] < v[i])
            cnt++;
    }
    cout<<cnt;

    return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())
LR=[]
for i in range(M):
  LR.append(list(map(int,input().split())))
l,r=LR[0][0],LR[0][1]
for i in range(M):
  if LR[i][1]<=r:
    r=LR[i][1]
  if l<=LR[i][0]:
    l=LR[i][0]
ans=r-l+1
if ans>0:
  print(ans)
else:
  print(0)

Measured memory_bytes: 27340
package main

import "fmt"

func main() {
	var N, all int
	fmt.Scan(&N)
	a := make([]int, N)
	m := map[int]int{}
	for i := 0; i < N; i++ {
		fmt.Scan(&a[i])
		m[a[i]]++
	}
	for _, v := range m {
		all += v * (v - 1) / 2
	}
	for i := 0; i < N; i++ {
		ans := all
		ans -= m[a[i]] * (m[a[i]] - 1) / 2
		ans += (m[a[i]] - 1) * (m[a[i]] - 2) / 2
		fmt.Println(ans)
	}
}


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

int main()
{
  int N, A;
  cin >> N;

  double sum = 0;

  for (int i = 0; i < N; i++)
  {
    cin >> A;
    sum += 1.0 / A;
  }

  cout << fixed << setprecision(5) << 1.0 / sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define INF 2e9
#define mod 1000000007
#define y1 solai
#define fi first
#define se second
typedef long long ll;
void read(ll &x)
{
	scanf("%lld",&x);
}
void read(ll &x, ll &y)
{
	scanf("%lld%lld",&x,&y);
}
void read(ll &x, ll &y, ll &z)
{
	scanf("%lld%lld%lld",&x,&y,&z);
}
void print(ll x)
{
	printf("%lld ",x);
}
void println(ll x)
{
	printf("%lld\n",x);
}
const ll N=100000;
ll n,a[N],sz,c[4444444];
bitset<4444444>d;
set<ll>s;
int main()
{
	//freopen("c.cpp","r",stdin);
 
	cin>>n;
	for(ll i=1;i<=n;i++)
		read(a[i]);
	sort(a,a+n);
	d[0]=1;
	for(ll i=1;i<=n;i++)
		d|=(d<<a[i]);
	for(ll i=1;i<=4000000;i++)
		if(d[i]==1)
			c[++sz]=i;
	cout<<c[(sz+1)/2];
}

Measured memory_bytes: 17664
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <ctime>

using namespace std;
#define RN cout << "\r\n";
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define REP(i, n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef long long int ll;
typedef pair<ll, ll> P;

// combination
const int MAX = 510000;
const int MOD = 1000000007;

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

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

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

// gcd, lcm
ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll getScore(vector<bool> givingList) {
    ll ans = 0;
    for (bool b : givingList) {
        if (b) {
            ans++;
        }
    }
    return ans;
}

ll calcPath(vector<ll> holdingTrashes, ll X) {
    ll score = 0;
    ll cost = 1;
    score += holdingTrashes[0];
    holdingTrashes.push_back(0);
    FOR(i, 1, holdingTrashes.size()) {
        cost++;
        score += (holdingTrashes[i - 1] - holdingTrashes[i]) * cost * cost;
    }
    score += X * holdingTrashes.size();
    return score;
}

int main() {
    ll a, b;
    cin >> a >> b;
    cout << a + b / 2;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <map>
#include <vector>
#include <iomanip>

using namespace std;

int main(void) {
  string S;
  cin >> S;
  if (S.substr(0, 4) == "YAKI") {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 888
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second

int main(){
    int A, B;
    cin >> A >> B;
    string S;
    cin >> S;
    bool flag = true;
    if(S[A] != '-') flag = false;
    else S[A] = '1';
    for(char s : S){
        if(s < '0' or '9' < s) flag = false;
    }
    if(flag) puts("Yes");
    else puts("No");
}


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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n;
    cin >> n;
    double sum = 0.0;
    rep(i, n) {
        int a;
        cin >> a;
        sum += 1.0 / a;
    }
    double ans = 1.0 / sum;
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
using namespace std;
#define MAXN 1005
char s[MAXN];
bool d[4];
int main()
{
	scanf("%s",s);
	int len=strlen(s);
	for(int i=0;i<len;i++)
	{
		if(s[i]=='S')
			d[0]=1;
		if(s[i]=='N')
			d[1]=1;
		if(s[i]=='E')
			d[2]=1;
		if(s[i]=='W')
			d[3]=1;
	}
	for(int i=0;i<4;i++)
		if((d[0]!=d[1])||(d[2]!=d[3]))
		{
			printf("No\n");
			return 0;
		}
	printf("Yes\n");
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < int(n); ++i)
#define REPE(i, a, b) for (int i = (a); i <= int(b); ++i)
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
#define PB push_back
#define EB emplace_back
using LL = long long;
using PII = pair<int, int>;
#define F first
#define S second

const int maxn = 1e5 + 10;
int n;
PII a[maxn];
long long ans[maxn];

int main() {
  scanf("%d", &n);
  REP(i, n) {
    a[i].S = i;
    scanf("%d", &a[i].F);
  }
  sort(a, a + n);
  LL sum = 0;
  LL cnt = 0;
  int mi = n;
  for (int i = n - 1; i >= 0; ) {
    int j = i;
    while (j >= 0 && a[j].F == a[i].F) {
      mi = min(mi, a[j].S);
      sum += a[j--].F;
      cnt++;
    }
    i = j;
    int nh = i >= 0 ? a[i].F : 0;
    LL delta = sum - cnt * nh;
    ans[mi] += delta;
    sum -= delta;
  }
  REP(i, n) printf("%lld\n", ans[i]);
  return 0;
}



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

typedef long long ll;

const int MOD = 998244353;
const int INF = 1001001001;

#define rep(i, n)  for(int i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()

class FermatCombination {
public:
    vector<ll> factrial;
    vector<ll> inverse;
    ll MOD;

    FermatCombination(ll size, ll mod) {
        factrial = vector<ll>(size+1, 0);
        inverse = vector<ll>(size+1, 0);

        MOD = mod;
        factrial[0] = 1;
        inverse[0] = 1;

        for(int i = 1; i <= size; i++) {
            factrial[i] = (factrial[i - 1] * i) % MOD;
            inverse[i] = (ll)modpow(factrial[i], MOD - 2) % MOD;
        }
    }

    ll modpow(ll x, ll n) {
        ll ans = 1;
        while(n > 0) {
            if((n & 1) == 1) {
                ans = ans * x % MOD;
            }
            x = x * x % MOD;
            n >>= 1;
        }
        return ans;
    }

    long long combine(int n, int k) {
        return factrial[n] * inverse[k] % MOD * inverse[n - k] % MOD;
    }
};

int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    FermatCombination fermat = FermatCombination(n+5, MOD);
    ll ans = 0;
    ll colors = m;
    for(int i = 0; i < n; i++) {
        if (n-i-1 <= k) {
            ans += (colors * fermat.combine(n-1, n-i-1)) % MOD;
            ans %= MOD;
        }
        colors *= (m-1);
        colors %= MOD;
    }

    cout << ans << endl;
}

Measured memory_bytes: 6232
import java.util.Scanner;

/**
 * ZAKIREN第5章
 *
 * @author K.Yamauchi
 *
 */
public class Main {

	/** 入力用 */
	private static Scanner scan = new Scanner(System.in);

	/** 出力用 */
	private static StringBuilder stringBuilder = new StringBuilder();

	/**
	 *
	 * @param args
	 */
	public static void main(String[] args) {

		int n = Integer.parseInt(scan.next()); // 要素数

		// ソート対象配列の読み込み
		int[] targetArray = new int[n];
		for (int i = 0; i < n; i++) {
			targetArray[i] = Integer.parseInt(scan.next());
		}

		// 読み込み終了
		scan.close();
		scan = null;

		// シェルソートを実行
		shellSort(targetArray, n);

		// 結果出力
		for (int i = 0; i < targetArray.length; i++) {
			stringBuilder.append(targetArray[i]);
			stringBuilder.append('\n');
		}		System.out.print(stringBuilder.toString());

	}

	/**
	 *
	 * @param array
	 * @param number
	 * @param g
	 * @param cnt
	 * @return
	 */
	private static int insertionSort(int[] array, int number, int g) {

		// gからn-1まで
		int cnt = 0;
		for (int i = g, j = 0; i < number; i++) {
			int temp = array[i];
			j = i - g;

			// 自分より大きいやつが見つかるまで
			while (j >= 0 && array[j] > temp) {
				array[j + g] = array[j];
				j = j - g;
				cnt++;
			}
			array[j + g] = temp;
		}
		return cnt;
	}

	/**
	 *
	 * @param array
	 * @param number
	 */
	private static void shellSort (int[] array, int number) {

		// Gの準備
		int[] G = new int[15];

		int gSize = 0;
		for (int i = 1; i <= number; i = i * 3 + 1) {
			// 3g + 1
			G[gSize++] = i;
		}

		// ソートしながら結果出力
		int cnt = 0;
		stringBuilder.append(gSize);
		stringBuilder.append('\n');
		for (int i = gSize - 1; i >= 0 ; i--) {
			stringBuilder.append(G[i]);
			if (i != 0)
				stringBuilder.append(' ');
			cnt += insertionSort(array, number, G[i]);
		}
		G = null;

		// 結果出力
		stringBuilder.append('\n');
		stringBuilder.append(cnt);
		stringBuilder.append('\n');
	}
}



Measured memory_bytes: 189620
#include<stdio.h>
int main(void){
long long x;
  scanf("%lld",&x);
  long long a=100;
  int c=0;
  while(1){if(a>=x){
    printf("%d",c);
    return 0;}
	c++;
         a+=a/100;
          // printf("%d %d\n",c,a);
          }
  return 0;
}

Measured memory_bytes: 1736
#include "bits/stdc++.h"
#include <chrono> 
 
using namespace std;
using namespace std::chrono; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
#define gcd(a,b) __gcd(a,b)
#define vi vector<int>
#define vll vector<ll>
#define vs vector<string>
#define vc vector<char>
#define pb(n) push_back(n)
#define pp pop_back()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define type(a) typeid(a).name();
#define print(arr) cout << "[" ;for(unsigned int i=0;i<(unsigned int) arr.size();i++){ (i==arr.size()-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define Arr(arr,l) cout << "[" ;for(unsigned int i=0;i<(unsigned int) l;i++){ (i==l-1)?cout << arr[i]:cout << arr[i] << ",";}cout << "]" << endl
#define console(arr) cout << "["<<endl; for(ll i=0;i<(ll)arr.size();++i){cout << " [";for(ll j=0;j<(ll)arr[i].size();++j){(j==(int)arr[i].size()-1)?cout << arr[i][j]:cout << arr[i][j] << ",";}cout << "]"<<endl;} cout << "]"<<endl
#define starting() auto start = high_resolution_clock::now()
#define ending() auto stop = high_resolution_clock::now();auto duration = duration_cast<microseconds>(stop - start);cout << endl << endl << "Execution Time : "<<duration.count()/1000 << " ms" << endl
 
template <typename T1,typename T2>
void mapped(map<T1,T2>m){for(auto ite=m.begin();ite!=m.end();++ite){cout << "'" << ite->first << "'"<<" : "<<ite->second <<endl;}}
 
template <typename T1 , typename T2>
void mappedArr(map<T1,vector<T2>>m){for(auto ity=m.begin();ity!=m.end();++ity){cout << "'"<< ity->first <<"'"<<" : "<<"[";
for(int i=0;i<(int)ity->second.size();++i){(i==(int)ity->second.size()-1)?cout << ity->second[i]:cout << ity->second[i] << ",";}cout << "]"<<endl;}}
 
string int_to_string(int x){ stringstream ss; ss << x; string ni = ss.str(); return ni;}
int char_to_int(char c){ int n = (int)c - 48; return n; }
int string_to_int(string x){ int n; stringstream s(x); s >> n; return n; }
 
template <typename T1,typename T2>
void ArrPair(vector<pair<T1,T2>>vp){for(int i=0;i<(int)vp.size();++i){
cout << "(" << vp[i].first << "," << vp[i].second << ")"<<endl ;}}
 
const int MOD = 1e9 + 7;
const ll INF = 1e18L + 5;
 
unordered_map<int,int> um;
unordered_set<int> us;
set<int> s;
// v.front() gives the first element of vector 
// v.back()  gives the last element of vector
// insert erase substr
//g++ -o Legendary-Grandmaster Legendary-Grandmaster.cpp&Legendary-Grandmaster.exe 
//cd C:\Users\158si\Desktop\Algorithim\codeForces\elite
// for-bash cd C:/Users/158si/Desktop/Algorithim/codeForces/elite

int main(){
	int n,k;
	cin >> n >> k;
	vector<long long> v(n);
	for(int i=0;i<n;++i){
		cin >> v[i];
	}
	long long summed = 0;
	sort(v.begin(),v.end());
	for(int i=0;i<n-k;++i){
		summed += v[i];
	}
	cout << summed;
	return 0;
}

























Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define ll long long
#define inf 1<<30
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
il void readl(ll &x){
    x=0;ll f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
il void read(int &x){
    x=0;int f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
using namespace std;
/*===================Header Template=====================*/
#define N 100010
int n;
void dfs(int sum){
	if(sum==n){puts("Yes");exit(0);}
	if(sum>n)return;
	dfs(sum+4);dfs(sum+7);	
}
int main(){
	in1(n);
	dfs(0);
	puts("No");
	return 0;
}

Measured memory_bytes: 256
// Author : Sarthak Kapoor
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define rep(i,n) for(int i=0;i<n;++i)
#define repa(i,a,n) for(int i=a;i<n;++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define repba(i,b,a) for(int i=b;i>=a;--i)
#define repab(i,a,b) for(int i=a;i<b;++i)
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define msi map<string,int>
#define mii map<int,int>
#define viip vector<pair<int,pair<int,int> > > 
#define mp make_pair
#define vip vector<pair<int,int> >
#define pb push_back 
#define po pop_back
#define fi first
#define sec second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define s(v) v.size()
ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());//use rng()%n for numbers in range [0,n-1]
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    vi v(n);
    rep(i,n){
        cin>>v[i];
    } 
    ll fac[n+1];
    fac[0] = 1;
    fac[1] = 1;
    repa(i,2,n+1){
        fac[i] = fac[i-1]*i;
        fac[i] %= mod;
    }
    ll ans[n+1];
    ans[0] = 0;
    ans[1] = 1;
    repa(i,2,n+1){
        ans[i] = ans[i-1]*(i);
        ans[i] %= mod;
        ans[i] += fac[i-1];
        ans[i] %= mod;
        // cout<<ans[i]<<" ";
    }
    ll mul = 1;
    repr(i,n-1){
        mul *= (i+1);
        mul %= mod;
        ans[i] *= mul;
        ans[i] %= mod;
        // cout<<ans[i]<<" ";
    }
    ll res = 0;
    rep(i,n-1){
        ll temp = v[i+1]-v[i];
        temp *= ans[i+1];
        temp %= mod;
        res += temp;
        // cout<<temp<<" "<<res<<"\n";
        res %= mod;
    }
    cout<<res;
    return 0;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

ll a,b,c;
int main() {
    cin >> a >> b >> c;

    if((a%2 == 0) || (b%2 == 0) || (c%2 == 0)) printf("0\n");
    else printf("%lld\n",min(a*b,min(a*c,b*c)));
	return 0;
}

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

using namespace std;

#define all(v)				((v).begin()), ((v).end())
#define allr(v)				((v).rbegin()), ((v).rend())
#define sz(v)				((int)((v).size()))
#define ll long long
#define pb					push_back
#define fIO ios_base::sync_with_stdio(0);cin.tie(0);

const ll oo = 1e8;
const double pi = 3.1415926535897;


const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}


typedef vector<int>                vi;
typedef vector<pair<int,int>>      vii;
typedef vector<ll>                 vll;
typedef vector<double>             vd;
typedef vector< vi >               vvi;
typedef vector< vd >               vvd;
typedef vector<string>             vs;
typedef pair<int, int>             pii;

/**
    * PLEASEEE READDD PROBLEEEM CARFULLY ****
    * Always check for OVERFLOW ll vs int
    * Always check for array bounds
    * Check for function return
    * READ OUTPUT SECTION AGAIN!!!
**/

struct edge{
    int from, to, w;

    edge(){}
    edge(int x, int y, int we): from(x), to(y), w(we){}

    bool operator < (const edge &rhs) const{
        return w > rhs.w;
    }

};

const int N = 2e5 + 5;

vi adj[N];
int cnt[N];

void dfs(int nd) {

    for(auto ch : adj[nd]) {
        dfs(ch);
        cnt[nd] += 1 + cnt[ch];
    }
}

int main(){
    fIO
//    freopen("", "r", stdin);
//    freopen("", "w", stdout);


    int n;
    cin >> n;

    for(int i = 2; i <= n; i++) {
        int p;
        cin >> p;

        adj[p].pb(i);
    }

    //dfs(1);

    for(int i = 1; i <= n; i++) cout << sz(adj[i]) << "\n";
}








Measured memory_bytes: 14596
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define il inline
#define outy printf("Yes\n")
#define outn printf("No\n")
#define outf printf("First\n")
#define outs printf("Second\n")
#define FOR(a,b,c) for(int a=b;a<=c;a++)
#define FORD(a,b,c) for(int a=b;a>=c;a--)
#define FORL(a,b) for(int a=head[b];a;a=nxt[a])
#define in(a)  a=read()
#define in2(a,b)  a=read(),b=read()
#define in3(a,b,c)  a=read(),b=read(),c=read()
#define in4(a,b,c,d)  a=read(),b=read(),c=read(),d=read()
#define inl(a)  a=readl()
#define inl2(a,b)  a=readl(),b=readl()
#define inl3(a,b,c)  a=readl(),b=readl(),c=readl()
#define inl4(a,b,c,d)  a=readl(),b=readl(),c=readl(),d=readl()
#define out(a) printf("%d\n",a)
#define out2(a,b) printf("%d %d\n",a,b)
#define out3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out4(a,b,c,d) printf("%d %d %d %d\n",a,b,c,d)
#define outl(a) printf("%lld\n",a)
#define outl2(a,b) printf("%lld %lld\n",a,b)
#define outl3(a,b,c) printf("%lld %lld %lld\n",a,b,c)
#define outl4(a,b,c,d) printf("%lld %lld %lld %lld\n",a,b,c,d)
#define clr(x,y) memset(x,y,sizeof(x))
inline int read(){
    char c;int s=0,t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
inline ll readl(){
    char c;ll s=0;int t=1;
    while(!isdigit(c=getchar()))if(c=='-')t=-1;
    do{s=s*10+c-'0';}while(isdigit(c=getchar()));
    return s*t;
}
/*------------------------------------------------------------*/
#define mod 1000000007
#define maxn 100010
/*------------------------------------------------------------*/
int n,m;
int main(){
	char a,b;
	cin>>a>>b;
	if(a>b)cout<<'>';
	if(a<b)cout<<'<';
	if(a==b)cout<<'=';	
} 

Measured memory_bytes: 256