akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define mset(x, y) memset(x, y, sizeof x)
#define mcpy(x, y) memcpy(x, y, sizeof x)
using namespace std;

typedef long long LL;
typedef pair < int, int > pii;

inline int Read()
{
	int x = 0, f = 1, c = getchar();
	for (; !isdigit(c); c = getchar())
		if (c == '-')
			f = -1;
	for (;  isdigit(c); c = getchar())
		x = x * 10 + c - '0';
	return x * f;
}

const int MAXN = 105;

int c, n, m;
LL f[2];

int main()
{
#ifdef wxh010910
	freopen("data.in", "r", stdin);
#endif
	n = Read(), m = Read();
	f[0] = 1;
	for (int i = 1; i <= n; i ++)
		if (Read() & 1)
			f[0] += f[1], f[1] = f[0];
		else
			f[1] <<= 1, f[0] <<= 1;
	return printf("%lld\n", f[m]), 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

#define DIV 1000000007

using namespace std;
using ll = long long;
using ldb = long double;
int main(){
 int N;
 double ans = 0.0, a;
 cin >> N;
 for(int i = 1; i <= N; ++i){
 cin >> a;
 ans += 1.0 / a;
 }
 ans = 1.0 / ans;
printf("%.10lf\n", ans);
 }

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int n,k;
    string s,a;
    cin >> n >> k;
    cin >> s;
    a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    for(int i=0; i<26; i++){
        if(a[i]==s[k-1]){
            s[k-1] = a[i+26];
        }
    }
    cout << s << endl;
}

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

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

void make753(vector<int> &x,string now){  
  bool flag3=false;
  bool flag5=false;
  bool flag7=false;
  for(int i=0;i<now.size();i++){
    int num=now.at(i)-'0';
    if(num==3)  flag3=true;
    else if(num==5) flag5=true;
    else if(num==7) flag7=true;
  }
  if(flag3 && flag5 && flag7){
    int n=stoi(now);
    x.push_back(n);
  }

  if(now.size()>8)  return;
  
  vector<string> a={"3","5","7"};
  for(int i=0;i<3;i++){
    make753(x,now+a.at(i));
  }

  return;
}

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

  vector<int> x;
  make753(x,"");
  int ans=0;
  for(int i=0;i<x.size();i++){
    if(N>=x.at(i))  ans++;
  }
  cout << ans << endl;

  return 0;
}


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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const ll INF = 1e18;
const double PI = acos(-1.0);
const ll MOD = 1e9 + 7;
vii v;
vector<ll> xs;

int main() {
    ios_base::sync_with_stdio(false);
    ll a,b; cin >> a >> b;

    ll last;
    ll ans = 0;
    ll minX, minY;
    ll maxX, maxY;

    for(int i = 0; i < a; i++) { ll x; cin >> x; xs.pb(x); }

    for(int i = 0; i < b; i++) {
        ll y; cin >> y;
        if(i) {
            ll possibles = (i*(b-i))%MOD;
            ll area = (y-last)%MOD;
            ans = (ans+((area*possibles)%MOD))%MOD;
        } else minY = y;
        last = y;
        maxY = y;
    }

    ll ans1 = ans;
    ans = 0;

    for(int i = 0; i < a; i++) {
        ll x = xs[i];
        if(i) {
            ll possibles = (i*(a-i))%MOD;
            ll area = (x-last)%MOD;
            ans = (ans+((area*possibles)%MOD))%MOD;
        }
        last = x;
    }

    cout << (ans*ans1)%MOD << endl;
    return 0;
}



Measured memory_bytes: 1400
import java.util.*;
class Main
{
    public static void main (String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[100002];
        for(int i = 0; i < n; i++){
            int a = sc.nextInt() + 1;
            x[a]++;
            x[a-1]++;
            x[a+1]++;
        }
        Arrays.sort(x);
        System.out.print(x[100001]);
    }
}

Measured memory_bytes: 50432
#include <bits/stdc++.h>
#include <stdio.h>
#include <string>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;

int n,l;
string s[105];
string ans="";

int main(){

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

cin>>n>>l;

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

sort(s,s+n);

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

cout<<ans<<endl;

}



Measured memory_bytes: 256
N = int(input())
L = list(map(int, input().split()))
L.sort()
cnt = 0

for i in range(N - 2):
  for j in range(i + 1, N - 1):
    for k in range(j + 1, N):
      a = L[i]
      b = L[j]
      c = L[k]
      
      if a != b and b != c and a + b > c:
        cnt += 1

print(cnt)

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

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

        int[] weight = new int[110];
        int[] value = new int[110];
        for (int i = 0; i < n; i++){
            weight[i] = scan.nextInt();
            value[i] = scan.nextInt();
        }

        long[] result = new long[110000];

        for (int i = 0; i < n; i++){
            for (int j = w; j >= 0; j--){
                if (j + weight[i] <= w){
                    result[j + weight[i]] = Math.max(result[j + weight[i]],result[j]+value[i]);
                }
               
            }
        }
        
        long res = 0;
        for (int i = 0; i <= w; i++){
            res = Math.max(res,result[i]);
        }   
      

        System.out.println(res);

        scan.close();
    }
}   

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

int main(void)
{
    int N;
    cin >> N;

    int cake = 4;
    int donut = 7;
    bool found = false;
    for (int i = 0; i < (100 / cake); i++)
    {
        for (int j = 0; j < (100 / donut); j++)
        {
            if ((cake * i + donut * j) == N)
            {
                // printf("cake = %d, donut = %d\n", i, j);
                found = true;
                break;
            }
        }
        if (found == true)
        {
            break;
        }
    }

    if (found == true)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return (0);
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<deque>
#include<unordered_map>
#include<unordered_set>
#include<queue>
#include<algorithm>
#include<cmath>
#include<numeric>
using namespace std;

typedef long long LL;
const int MOD = 1e9+7;

void solve(){
	string s;
	int k;
	cin>>k;
	cin>>s;
	int n = s.size();
	for(int i=0;i<min(k,n);i++){
		cout<<s[i];
	}
	if(n>k){
		cout<<"...";
	}
	cout<<endl;
}


int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int T = 1;
	// cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <typename T> bool chmax(T &a, const T &b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> bool chmin(T &a, const T &b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
const long long INFLL = 1LL << 60;
const long long MOD = 1e9 + 7;

int main() {
    ll N, A, B;
    cin >> N >> A >> B;
    ll p = N / (A + B);
    ll r = N % (A + B);
    ll ans = p * A + min(r, A);
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include<stdio.h>

int main(void)
{
	int w;
	int n;
	int a;
	int b;
	int c;
	int i;
	int bar[30];
	char camma;
	
	scanf("%d", &w);
	scanf("%d", &n);
	
	for(i = 0; i < w; i++){
		bar[i] = i + 1;
	}
	for(i = 0; i < n; i++){
		scanf("%d%c%d", &a, &camma, &b);
		c = bar[a - 1];
		bar[a - 1] = bar[b - 1];
		bar[b - 1] = c;
	}
	for(i = 0; i < w; i++){
		printf("%d\n", bar[i]);
	}
	
	return (0);
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
using namespace std;
char s,a[5]={'a','e','i','o','u'};
int main()
{
    cin>>s;
    for(int i=0;i<5;i++)
	{
        if(s==a[i])
		{
            cout<<"vowel"<<endl;
        	return 0;
		}
	}
    cout<<"consonant"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF mugen
#define dump(x) cerr<<#x<<"="<<x<<endl
#define ALL(a) (a).begin(),(a).end()
#define EACH(e,v) for(auto& e:v)
#define SORT(v) sort(ALL(v))
#define PERM(v) SORT(v);for(bool c##p=1;c##p;c##p=next_permutation(ALL(v)))
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<vii> viii;
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
template <typename T>
string to_string(const T &n){ostringstream stm;stm << n;return stm.str();}
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = 1000'000'007;
 
#define int long long 
int lcm(int a,int b){
    return a*b/__gcd(a,b);
}
signed main(){
 int a,b;
 cin>>a>>b;
 cout<<lcm(a,b)<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		sc.close();

		char[] ca = s.toCharArray();
		for (char c : ca) {
			System.out.print((char) (((c + n) - 65) % 26 + 65));
		}
	}
}

Measured memory_bytes: 25556
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		A();

	}

	private static void A() throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int N = Integer.parseInt(br.readLine());
		int kosuu = 0;
		br.close();

		for (int i = 0; i <= N; i++) {

			kosuu += i;

		}

		System.out.println(kosuu);
		;

	}

}


Measured memory_bytes: 8020
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define MSET(x,y) memset(x,y,sizeof(x))
#define M 1005
#define MOD 1000000007
using namespace std;
int n,m,dp[M][M];
char in[M][M];
int main()
{
    scanf("%d %d", &n, &m);
    REP(i,1,n) scanf("%s", in[i] + 1);

    dp[1][1] = 1;
    REP(i,1,n)REP(j,1,m) if(in[i][j] != '#') {
        if (i==1 && j==1) continue;
        dp[i][j] = dp[i-1][j] + dp[i][j-1];
        dp[i][j] %= MOD;
    }
    printf("%d\n", dp[n][m]);
    return 0;
}


Measured memory_bytes: 8656
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
//for gcc (未test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// 入力をpush_back(d)やarray[d]に使う時に1行で書ける
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// 最大公約数（Greatest Common Divisor）
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// 最小公倍数（Least Common Multiple）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y年はうるう年か否か
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	// for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;
	bool dbgF = true;

	//コードはここから書く.
	LL N;
	cin >> N;
	LL nowx = 0, nowy = 0;
	string ans = "Yes";
	LL back_t = 0;
	FOR(i, 0, N) {
		LL t, x, y;
		cin >> t >> x >> y;
		if (t-back_t < abs(nowx - x) + abs(nowy - y) || (x+y)%2!=t%2) {
			ans = "No";
		}


		nowx = x;
		nowy = y;
		back_t = t;
	}
	cout << ans << endl;

	return 0;
}

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

int main() {
    int A, B, C;
    cin >> A >> B >> C;

    if(A-B>C) cout << 0 << endl;
    else cout << C-(A-B) << endl;  
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <bitset>
#include <string>
#include <cstdio>
#include <math.h>
using namespace std;

const long long int INF = 1000000007;

int main(void)
{
    int N;
    cin >> N;
    cout << 1 - N << endl;
}

Measured memory_bytes: 3628
# 入力 =stdin.readline().rstrip()
# 分割 = stdin.readline().rstrip().split()

'''
条件に合うものを絞り込む
data = [1, 2, 3]
s = [x for x in data if x % 3 == 0]
'''

'''
文字配列を数値に
l_si = ['-10', '0', '100']

l_si_i = [int(s) for s in l_si]
'''

'''
a = [2, 4, 6, 8]
b = [3, 6, 9]

print(list(set(a) | set(b)))  # 和集合
print(list(set(a) & set(b)))  # 積集合
'''

'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
    A = list(map(lambda y: y / 2, A))
    count += 1
print(count)
'''

'''
.append(要素)
.extend(要素)
.insert(場所,要素)
del 配列名[場所]
-1で末尾で末尾から一つ前
'''
'''
間に空白追加
' '.join(lis)
'''
'''
copy.copy(配列名)6

'''
'''
sort()50
sorted(reverse=true)
'''
'''
2分探索
bisect.bisect_left(リスト, 要素)
'''


from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from decimal import *
l_si_i = [int(s) for s in stdin.readline().rstrip().split()]
n = l_si_i[0]
a = l_si_i[1]
b = l_si_i[2]

a = Decimal(a)
b = Decimal(b)
n = Decimal(n)
num = b - a


if num % 2 == 0:
    res = Decimal(num)/Decimal(2)
    print(res)
elif num % 2 == 1:

    res1 = a - 1
    b1 = b - (a - 1)
    a1 = 1
    num1 = b1 - a1
    if num1 % 2 != 0:
        res1 += 1
        b1 -= 1
    res1 += (b1 - a1)/2

    res2 = n - b
    a2 = n-b+a
    b2 = n
    num2 = b2 - a2
    if num2 % 2 != 0:
        res2 += 1
        a2 += 1
    res2 += (b2 - a2) / 2
    res = 0
    if res1 <= res2:
        res = res1
    else:
        res = res2
    print(int(res))


Measured memory_bytes: 5628
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using pq = priority_queue<int>;
template<class T>
using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int under = (1 << 31);
int upper = under - 1;
ll UNDER = (1LL << 63);
ll UPPER = UNDER - 1;
const int MOD = 1e9 + 7;
const long double pi = 3.141592653589793;
int main(){
	int n;
	cin >> n;
	V a(n);
	rep(i, n) {
		cin >> a[i];
	}
	sort(all(a), greater<int>());
	int ans = 0;
	rep(i, n) {
		ans = (i % 2) ? ans - a[i] : ans + a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;
#define ll long long
#define MOD 1000000007
#define INF (int)1e9
#define EPS 1e-9
/*
    This is H.Grid 1
*/

int main(){
    int m,n; cin>>m>>n;
    char arr[m][n];
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            cin>>arr[i][j];
        }
    }
    int dp[m+1][n+1];
    memset(dp,0,sizeof(dp));
    dp[0][0]=1;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            for(int k:{i,i+1}){
                int l=j;
                if(k==i){
                    l=j+1;
                }
                if((k<m)&&(l<n)&&(arr[k][l]=='.'))
                    dp[k][l]=(dp[k][l]%MOD+dp[i][j]%MOD)%MOD;
            }
        }
    }
    cout<<dp[m-1][n-1]<<endl;
    return 0;
}



Measured memory_bytes: 5120
import sys

l, n = map(int, input().split())
x = [int(input()) for _ in range(n)]

x_sum = [0]
for i in range(n):
	x_sum.append(x_sum[-1] + x[i])
ans = x[-1]
for i in range(n-1):
	num = x[i]
	e = (i+n) // 2
	if (n-1-i) % 2 == 1:
		num += l * (n-1-i)
		num += 2 * (x_sum[e] - x_sum[i]) - x[i]
		num -= 2 * (x_sum[n] - x_sum[e]) - x[e]
	else:
		num += l * (n-1-i)
		num += 2 * (x_sum[e] - x_sum[i]) - x[i] + x[e]
		num -= 2 * (x_sum[n] - x_sum[e+1])

	ans = max(ans, num)

x = [l-x[n-i] for i in range(1, n+1)]

x_sum = [0]
for i in range(n):
	x_sum.append(x_sum[-1] + x[i])
for i in range(n-1):
	num = x[i]
	e = (i+n) // 2
	if (n-1-i) % 2 == 1:
		num += l * (n-1-i)
		num += 2 * (x_sum[e] - x_sum[i]) - x[i]
		num -= 2 * (x_sum[n] - x_sum[e]) - x[e]
	else:
		num += l * (n-1-i)
		num += 2 * (x_sum[e] - x_sum[i]) - x[i] + x[e]
		num -= 2 * (x_sum[n] - x_sum[e+1])

	ans = max(ans, num)

print(ans)

Measured memory_bytes: 78124
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define square(x) pow(x 2.0)
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define max_queue(x) priority_queue<x>
#define min_queue(x) priority_queue<x, vector<x>, greater<x>>
#define big_sort(v) sort(all(v), [](int a, int b) { return a > b; })//大きい順にソート
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
/*
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
*/
int main() {
  char x;
  rep(i,3){
    cin >> x;
    if(x == '7'){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m;
	scanf("%lld %lld",&n,&m);
	for(ll i=m/n;i>=1;i--)
	{
		if(m%i==0)
		{
			if(m/i>=n)
			{
				printf("%lld\n",i);
				return 0;
			}
		}
	}
	printf("%d\n",1);
	return 0;	
}

Measured memory_bytes: 384
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
#INF = float("inf")
N,M = map(int,input().split())
H = list(map(int,input().split()))
AB = [list(map(int,input().split())) for _ in range(M)]
ans = [1]*N
for i in range(M):
    A,B = AB[i]
    if H[A-1] < H[B-1]:
        if ans[A-1] == 1:
            ans[A-1] = 0
    elif H[A-1] > H[B-1]:
        if ans[B-1] == 1:
            ans[B-1] = 0
    else:
        if ans[B-1] == 1:
            ans[B-1] = 0
        if ans[A-1] == 1:
            ans[A-1] = 0
s = 0
for i in ans:
    s += i
print(s)

Measured memory_bytes: 32028
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <array>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

int main() {
    char c[3][3];
    for(int i=0;i<3;i++){
        for(int k=0;k<3;k++){
            cin>>c[i][k];
        }
    }
    cout<<c[0][0]<<c[1][1]<<c[2][2]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 10000000000000000
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;

//M-SOLUTIONS
signed main(void){
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);

    int n; cin>>n;
    cout<<180*(n-2)<<endl;

}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int A[100],i,j,k,N,v;
	scanf("%d",&N);

	for(i=0;i<N;i++) scanf("%d",&A[i]);

	for(i=1;i<=N-1;i++){
		for(k=0;k<N;k++){
			printf("%d",A[k]);
			if(k!=N-1) printf(" ");
		}
		printf("\n");
		v=A[i];
		j=i-1;
		while(j>=0 && A[j]>v){
			A[j+1]=A[j];
			j--;
			A[j+1]=v;
		}
	}

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

	return 0;
}

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

const ll mod = 1e9 + 7;

template <typename T> inline bool chmax(T &a, const T &b) {
    if(a >= b) {
        return false;
    }
    a = b;
    return true;
}
template <typename T> inline bool chmin(T &a, const T &b) {
    if(a <= b) {
        return false;
    }
    a = b;
    return true;
}

/*-------------------------------------------*/

template <typename T> T mpow(T x, T n) {
    T ret = 1;
    while(n > 0) {
        if(n & 1)
            (ret *= x) %= mod;
        (x *= x) %= mod;
        n = n >> 1;
    }
    return ret;
}

int n;
vector<ll> x;

ll kaijo(int x) { return x ? (x * kaijo(x - 1)) % mod : 1; }

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

    cin >> n;
    x.resize(n);
    /*
    rep(i, n) x[i] = i, st.insert(i);
    vector<ll> a = x;
    int sum[10] = {};
    do {
        vector<ll> y = x;
        int num = 0;
        rep(i, n - 1) {
            auto itr = lower_bound(y.begin(), y.end(), a[i]);
            num += *(itr + 1) - a[i];
            FOR(j, a[i], *(itr + 1)) sum[j]++;
            y.erase(itr);
            cout << a[i] << " ";
        }
        cout << " " << num << endl;
    } while(next_permutation(a.begin(), a.end() - 1));
    rep(i, n - 1) cout << sum[i] << " "; */

    rep(i, n) cin >> x[i];
    ll sum = 0, num = kaijo(n - 1);
    rep(i, n - 1) {
        sum += num * (x[n - 1] - x[i]);
        num = (num * (i + 1)) % mod * mpow(i + 2, mod - 2);
        num %= mod;
        sum %= mod;
    }
    cout << sum << endl;
}

Measured memory_bytes: 2560
main :: IO ()
main = do
  n <- readLn
  if n == 0
    then return ()
    else do
      let ans = counter' n
      putStrLn $ show ans
      main


counter :: Int -> Int -> Int
counter 1 count = count
counter n count
  | n `mod` 2 == 0 = counter (div n 2) (count+1)
  |otherwise = counter (n*3+1) (count+1)

counter' :: Int -> Int
counter' n = counter n 0

Measured memory_bytes: 4044
#include<stdio.h>
#include<string.h>

int main(void){
    int n, c=0;
    char s[100];
    
    scanf("%s", &s);
    n = strlen(s);
    
    for(int i=0; i<(n-1)/2; ++i){
        if(s[i]!=s[i+(n+1)/2])
            c=c+1;  
    }
    if(c==0)
        printf("Yes");
    else
        printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(){
	int H, W;
	int i, j;
	
	while( scanf("%d %d", &H, &W) != EOF )

	if (H == 0 && W == 0) {
		break; 
	} else {
		for(i=0; i<H; i++) {
			for(j=0; j<W; j++) {
				if((i+j)%2 == 0) {
					printf("#");
				} else {
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
	}
	
	return 0;
}

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> Binary(10000);
    ll count = 0;
    ll bina = abs(N);
    for (int i = 0; bina>0 ; i++){
        Binary[i] = bina%2;
        bina = bina/2;
        count++;
    }

    // for(ll i=0; i<count+2; i++){
    //     cout << Binary[i];
    // }
    // cout << endl;

    if(N == 0){
        cout << 0 << endl;
        return 0;
    }
    if(N > 0){
        for(ll i=0; i< count; i++){
            if(i%2 == 1){
                if(Binary[i] == 1){
                    Binary[i+1]++;
                }
            }
        }
    }
    if(N < 0){
        for(ll i=0; i< count; i++){
            if(i%2 == 0){
                if(Binary[i] == 1){
                    Binary[i+1]++;
                }
            }
        }
    }
    // for(ll i=0; i<count+2; i++){
    //     cout << Binary[i];
    // }
    // cout << endl;

    for(ll i=0; i<count+10; i++){
        if(Binary[i]==2 && Binary[i+1] == 1){
            Binary[i] = 0;
            Binary[i+1] = 0;
        }
        if(Binary[i]==2){
            Binary[i] = 0;
            Binary[i+1]++;
            Binary[i+2]++;
        }
        if(Binary[i]==3){
            Binary[i] = 1;
            Binary[i+1]++;
            Binary[i+2]++;
        }
        if(Binary[i]==4){
            Binary[i] = 0;
            Binary[i+2]++;
        }
    }
    
    // for(ll i=0; i<count+2; i++){
    //     cout << Binary[i];
    // }
    // cout << endl;

    reverse(Binary.begin(), Binary.end());

    bool check = false;
    for(auto v: Binary){
        if(v == 1){
            check = true;
        }
        if(check){
            cout << v;
        }
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 384
a,b,c,x,y = map(int, input().split())

sum1 = a*x + b*y

num = min(x, y)
sum2 = num * 2 * c + a*(x-num) + b*(y-num)
sum3 = max(x,y) * 2 * c

print(min(sum1, sum2, sum3))

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
using P = pair<long long int, long long int>;

int main(){
    int n;
    cin >> n;
    vector<long long int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    long long int ans = 1000;
    for(int start = 0, end = 1; end < n && start < n; start++){
        end = start+1;
        while(end < n && a[end-1] <= a[end]) end++;
        long long int kabu = ans / a[start];
        long long int zankin = ans % a[start];
        long long int coans = kabu*a[end-1]+zankin;
        if(ans < coans){
            ans = coans;
            start = end-1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3556
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))

dais = list(range(1, N+1))
notg = []
for i in range(M):
    A, B = list(map(int, input().split()))
    if H[A-1] > H[B-1]:
        notg.append(B)

    if H[A-1] < H[B-1]:
        notg.append(A)

    if H[A-1] == H[B-1]:
        notg.append(A)
        notg.append(B)

print(len(list(set(dais) - (set(notg)))))

Measured memory_bytes: 29672
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
using lli = long long int;

vector<lli> input(int N) { vector<lli> r(N); for (int i = 0; i < N; i++)cin >> r[i]; return r; }

int main() {
	int N;
	cin >> N;
	vector<queue<int>> d(N);
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N - 1; j++) {
			int tmp;
			cin >> tmp;
			d[i].push(tmp - 1);
		}
	}

	int day = 0;
	//初日ダメなマッチはマッチして変動した人としかマッチしえない
	//全マッチ確認は1回ずつで済む
	vector<pair<int, int>> today_match;
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (d[i].front() == j && d[j].front() == i) {
				today_match.push_back(make_pair(i, j));
			}
		}
	}

	while (true) {
		//cout << "day : " << day << endl;
		vector<pair<int, int>> nx_match;
		if (today_match.size() == 0) { break; }
		for (auto p : today_match) {
			//マッチするので次の人と比較して追加
			int x = p.first, y = p.second;
			//cout << x << " vs " << y << endl;
			d[x].pop();
			d[y].pop();
			if (!d[x].empty()) {
				int nx_x = d[x].front();
				if (d[nx_x].front() == x)nx_match.push_back(make_pair(x, nx_x));
			}
			if (!d[y].empty()) {
				int nx_y = d[y].front();
				if (d[nx_y].front() == y)nx_match.push_back(make_pair(y, nx_y));
			}
		}
		day++;
		today_match = nx_match;
	}

	bool end = true;
	for (int i = 0; i < N; i++)
		if (d[i].size() != 0)end = false;
	cout << (end ? day : -1) << endl;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int A,B,T;
	cin>>A>>B>>T;
	int ret=0;
	for(i=A;i<=T;i+=A) ret+=B;
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 892
/*GRATITUDE*/
/*1916057*/
//Arise Awake and Stop Not Till the Goal is reached. 
//Break through all barriers..
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define vi              vector<int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define endl            "\n"
#define PI                 acos(-1)
#define w(t)              int t; cin>>t; while(t--)
#define for_f(a,b,c)      for(int i=a;i<=b;i=i+c)
#define for_r(a,b,c)      for(int i=a;i>=b;i=i-c) 
#define trace1(x) cout << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
void ash_god()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
}

/*************************************************************************************************/
//Write your functions here..............................
 


/***************************************************************************************************/

void solve() {
/*Write your code here*/
 int n; cin>>n;
 int a[n];
 for_f (0,n-1,1) cin>>a[i];
 int res=0,x=a[0];
 for_f (1,n-1,1) {
  res+=max(x-a[i],0LL);
  x=max(x,a[i]);

 }
 cout<<res;

}
int32_t main()
{
ash_god();
bool tc=0;
if(tc)  {
    w(t) solve();
}
else solve();

return 0;
} 

Measured memory_bytes: 5168
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
 
int get_digits(long val) {
    int i = 0;
    for (; val != 0; val /= 10) {
        i++;
    }
 
    return i;
}
 
int main(void) {
    long N;
    std::cin >> N;
 
    long sqrt = static_cast<long>(std::sqrt(N));
 
    int min = 0x7fffffff;
    for (int i = 1; i <= sqrt; i++) {
        if (N % i == 0) {
            long val = N / i;
 
            min = std::min(min, get_digits(val));
        }
    }
 
    std::cout << min << std::endl;
}


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

void solve() {
    int n;
    cin >> n;
    ll ans = 0;
    vector<ll> lefters[n], righters[n+1];
    rep(i, n) {
        ll k, l, r;
        cin >> k >> l >> r;
        k--;
        ans += min(l, r);
        if (l > r) {
            lefters[k].push_back(l - r);
        } else {
            righters[k+1].push_back(r - l);
        }
    }
    priority_queue<ll, vector<ll>, greater<ll>> pql, pqr;
    rep(i, n) {
        for (ll val : lefters[i]) pql.push(val);
        while ((ll)pql.size() > i + 1) pql.pop();

        for (ll val : righters[n - i - 1]) pqr.push(val);
        while ((ll)pqr.size() > i + 1) pqr.pop();
    }
    while (!pql.empty()) {
        ans += pql.top();
        pql.pop();
    }
    while (!pqr.empty()) {
        ans += pqr.top();
        pqr.pop();
    }
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}

Measured memory_bytes: 19644
def yagi(a , b):
    ans = ""

    if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
        ans = "Possible"
    else:
        ans = "Impossible"

    return ans

def main():
    a , b= map(int , input().split())
    print(yagi(a , b))

if __name__ == '__main__':
    main()

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

int main() {
  int x, y, a, b, c;
  ll sum_a = 0;
  ll sum_b = 0;
  cin >> x >> y >> a >> b >> c;
  priority_queue<ll> A;
  priority_queue<ll> B;
  priority_queue<ll> C;
  ll a1, b1, c1;
  ll ans = 0;
  rep(i, a){
    cin >> a1;
    sum_a += a1;
    A.push(a1);
  }
  rep(i,b){
    cin >> b1;
    B.push(b1);
    sum_b += b1;
  }
  rep(i,c){
    cin >> c1;
    C.push(c1);
  }
  rep(i, x){
    ll tmp_a = A.top();
    A.pop();
    C.push(tmp_a);
  }
  rep(i, y){
    ll tmp_b = B.top();
    B.pop();
    C.push(tmp_b);
  }
  rep(i, x + y){
    ans += C.top();
    C.pop();
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8048
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
class Main {
    public static void main(String[] args) {
        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        try {
            String[] list = br.readLine().split(" ");
            int count = 0;
            int from = Integer.parseInt(list[0]);
            int to = Integer.parseInt(list[1]);
            int num = Integer.parseInt(list[2]);
            for (; from <= to; from++) {
                if (num % from == 0) {
                    count++;
                }
            }
            System.out.println(count);
 
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}


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

using namespace std;

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int main() {
    int n, i, j, t;
    vector<int> a;
    cin >> n;
    for (i = 0; i <n; i++) {
        cin >> t;
        a.push_back(t);
    }
    vector<int> left(n + 1, 0), right(n + 1, 0);
    for (i = 0; i < n; i++) {
        left[i + 1] = gcd(left[i], a[i]);
    }
    for (i = n - 1; i >= 0; --i) {
        right[i] = gcd(right[i + 1], a[i]);
    }
    int ans = -1;
    for (i = 0; i < n; i++) {
        ans = max(ans, gcd(left[i], right[i + 1]));
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 1528
a,b,x = map(int,input().split())
import math
if a*a*b/2>x:
  #print((-1*(math.atan((2*x)/(a*b*b))-(2/math.pi)))*180/math.pi)
  print((math.atan(a*b*b/(2*x))*180/math.pi))
elif a*a*b/2 == x:
  print((math.atan(b/a))*180/math.pi)
else:
  print((math.atan((2*a*a*b-2*x)/a**3))*180/math.pi)
  
  

Measured memory_bytes: 3060
import itertools
import numpy 

N, M, X = list(map(int, input().split()))

price = []
tmp = []

for i in range(N):
  _ = list(map(int, input().split()))
  price.append(_[0])
  tmp.extend(_[1:])
price = numpy.array(price)
learn = numpy.array(tmp).reshape((N, M))

if min(numpy.sum(learn, axis=0)) < X:
  print(-1)
else:
  success_combs = []
  for k in range(1, N+1):
    for comb in itertools.combinations(range(N), k):
      if min(numpy.sum(learn[comb, :], axis=0)) >= X:
        success_combs.append(comb)

  min_p = None
  for comb in success_combs:
    p = sum(numpy.take(price,comb))
    if min_p is None:
      min_p = p
    elif min_p > p:
      min_p = p
  print(min_p)
  

Measured memory_bytes: 27644
/*
 * Author: Anmol Choudhary
 */
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nextl cout<<"\n"
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<"["<<#x<<"="<<x<<"] , ["<<#y<<"="<<y<<"]"<<"\n"
const ll mod = 1000000007;
const ll maxn = 100005;
const double mm = 1e+30;
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x) % mod;
    }
    return res;
}
void solve()
{
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    rep0(i,n) cin>>arr[i];
    sort(arr,arr+n);
    ll an=0;
    rep0(i,n-k) an+=arr[i];
    pr(an);
}
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
        //nextl;
    }
    return 0;
}


Measured memory_bytes: 1792
import java.util.*;

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

Measured memory_bytes: 21460
import itertools
import math

N = int(input())
P = [[int(x) for x in input().split()] for _ in range(N)]
ans=0
for p in itertools.permutations(P):
    for (x1, y1), (x2, y2) in zip(p, p[1:]):
        ans += ((x1-x2)**2 + (y1-y2)**2)**.5
print(ans/math.factorial(N))

Measured memory_bytes: 3188
import math
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

N = int(input())
l = list(map(int, input().split()))

MODp = 1000000007
K = 1
for i in range(N):
  K = lcm(K,l[i])

Ans = 0
for i in range(N):
  Ans += ((K // l[i]))

Ans = Ans % MODp
print(Ans)

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

static const int INF = 1e9+7;

int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0; i<n; i++)  cin>>a[i];
    sort(a.begin(),a.end(),greater<int>());

    int find = a[0]/2;
    int dif = INF;
    int idx = -1;

    for(int i=0; i<n; i++){
        if(dif > (abs(a[i] - find))  && i != 0){
            dif = abs(a[i] - find);
            idx = i;
        }
    }

    cout<<a[0]<<" "<<a[idx]<<endl;

    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}



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

	ll n;
	cin >> n;
	Graph g(n);
	REP(i, n - 1) {
		ll a, b;
		cin >> a >> b;
		a--; b--;
		add_edge(g, a, b, i, true, i);
	}

	Array used(n, false);
	Array ans(n - 1, -1);

	queue<P> que;
	que.push(make_pair(0,0));
	used[0] = true;
	ll max = 0;

	while (que.size() > 0) {
		ll v = que.front().first;
		ll c = que.front().second;
		que.pop();
		
		ll next = 1;
		for (auto e : g[v]) {
			if (!used[e.to]) {
				used[e.to] = true;
				if (next == c) next++;
				ans[e.cap] = next;
				que.push(make_pair(e.to, next));
				next++;
			}
		}
		chmax(max, next - 1);
	}

	cout << max << endl;

	for (auto i : ans) {
		cout << i << endl;
	}

	return 0;
}

Measured memory_bytes: 11136
#include <cstdio>
#include <climits>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <cstdio>
#include <climits>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cstring>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
long long MOD = 998244353;
long long INF = 1000000000000000;
#define MAX_V 330

typedef long long ll;

int main(void) {
  int n, p[200010];
  cin >> n;
  rep(i, n) cin >> p[i];

  int table[200010];
  rep(i, n + 1) table[i] = -1;
  int lg[200010] = {};
  lg[n - 1] = 1;
  table[p[n - 1]] = n - 1;
  int ans = 1;
  for (int i = n - 2; i >= 0; i--) {
    table[p[i]] = i;
    lg[i] = 1 + lg[table[p[i] + 1]];
    ans = max(ans, lg[i]);
  }
  cout << n - ans << endl;
  return 0;
}
  


Measured memory_bytes: 2560
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
MOD = 10**9 + 7

x,a,b = map(int,input().split())
li = list(map(int,input().split()))
diff = []
for i in range(len(li)-1):
    c = li[i+1]-li[i]
    diff.append(c)
for i in range(len(diff)):
    diff[i] = min(diff[i]*a,b)
print(sum(diff))

Measured memory_bytes: 14612
flag=false
loop do
  n= gets.to_i
  break if n==0
  puts if flag
  hash = Hash.new
  list = Array.new
  n.times do
    key,w,l,d=gets.split
    hash[key]=3*w.to_i+d.to_i
    list<<key
  end
  i=0
  list.sort_by{|x|[-hash[x],i+=1]}.each do |key|
    print key,",",hash[key],"\n"
  end
  flag = true
end

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

int main() {
  	long long int N, K;
  	cin >> N >> K;
  	long long int count = 0;
  
  	for (int i = K; i <= N + 1; i++){
      	count += i * (N - i + 1) + 1;
      	count %= 1000000007;
    }
  
  	cout << count << endl;
}

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

using namespace std;

using ll = long long;
constexpr int mo = 1e9+7;
constexpr int inf = 1<<30;
constexpr ll infl = 1ll<<60;
constexpr ll mo2 = 998244353;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll n,k;
    cin>>n>>k;
    cout << min(n%k,k-n%k) << endl;
    return 0;
}

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

const int inf = 1e9;
const ll linf = 1e18;

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

    int a, b, c; cin >> a >> b >> c;
    cout << ((a + b + c >= 22) ? "bust" : "win") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
 	int n;
  	cin >> n;
  	int a[n], dp[n];
  	for(int i=0;i<n;i++) cin >> a[i];
  	dp[0] = 0;
  	dp[1] = abs(a[1] - a[0]);
  	for(int i=2;i<n;i++){
      dp[i] =  min(dp[i-1] + abs(a[i] - a[i-1]), dp[i-2] + abs(a[i] - a[i-2]));
    }
  	cout << dp[n-1] << endl;
 	return 0; 
}

Measured memory_bytes: 4368
/*
Author: Babin Dutta
*/

#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353

ll b[500001];

void solve(){
	ll n; ll m; cin>>n>>m;
	ll a[n+1];
	f(i,n) cin>>a[i+1];
	ll st = 1;
	set<ll> s;
	ll x = -1;
	ll f = 1;
	for(int i=1;i<=500000;i++){
		st = a[st];
		b[i] = st;
		if(s.find(st) != s.end() && f){
			x = st;
			f = 0;
		}
		s.insert(st);
	}
	if(m <= 500000) {
		cout<<b[m]<<endl;
		return;
	}
	ll ss = -1;
	ll i;
	for(i=1;;i++){
		if(b[i] == x) break;
	}
	m -= (i-1);
	st = i;
	ll cnt = 0;
	i++;
	for(;;i++){
		cnt++;
		if(b[i] == x) break;
	}
	m %= cnt;
	m = (m-1+cnt)%cnt;
	cout<<b[st+m]<<endl;
}

int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

Measured memory_bytes: 18256