akhauriyash/Code-Regression huggingface dataset:
//#define LOCAL
//#define BUG
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <list>
#include <bitset>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>

using namespace std;

#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
#define pb push_back
#define ins insert
#define rsz resize
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#ifdef BUG
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " /";
    __f(comma + 1, args...);
}
#endif

template <class T> bool mini(T& a, T b) { return a > b ? (a = b, 1) : 0; }
template <class T> bool maxi(T& a, T b) { return a < b ? (a = b, 1) : 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;

const ll INF = (ll)1e9 + 7;
const int N = 3e3 + 3;

int n;
char s[N];
ll f[N][N];

int main() {
#ifdef LOCAL
    freopen("CP.inp", "r", stdin);
//    freopen("CP.out", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    cin >> (s + 1);
    fort(i, 1, n) f[1][i] = i;
    fort(i, 2, n) {
        if (s[i - 1] == '<') {
            fort(j, 1, i) f[i][j] = (((f[i][j - 1] + f[i - 1][j - 1] - f[i - 1][0]) % INF) + INF) % INF;
        } else {
            fort(j, 1, i) f[i][j] = (((f[i][j - 1] + f[i - 1][i - 1] - f[i - 1][j - 1]) % INF) + INF) % INF;
        }
    }
    cout << f[n][n] << '\n';
    return 0;
}


Measured memory_bytes: 68992
#include <cstdio>
#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <functional>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <memory>
#include <valarray>
#include <climits>

using namespace std;

using ll = long long int;

#define loop(i, N) for (int i = 0; i < N; ++i)
#define scanInt(x) int x; scanf("%d", &x); getchar();
#define scanLLInt(x) ll x; scanf("%lld", &x); getchar();
#define scanVecInt(A, N) vector<int> A(N); loop(i, N){scanf("%d", &(A[i])); getchar();}
#define scanVecLLInt(A, N) vector<ll> A(N); loop(i, N){scanf("%lld", &(A[i])); getchar();}

int main()
{
    scanInt(N);
    scanVecInt(S, N);
    sort(S.begin(), S.end());
    int sum = 0;
    int first_non_ten = -1;
    loop(i, N){
        sum += S[i];
        if (first_non_ten == -1 && S[i] % 10 != 0){
            first_non_ten = S[i];
        }
    }
    if (sum % 10 != 0){
        printf("%d\n", sum);
    }else if (first_non_ten != -1){
        printf("%d\n", sum - first_non_ten);
    }else{
        printf("%d\n", 0);
    }
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		solve2440();
	}

	public static void solve2440() {
		Scanner sc = new Scanner(System.in);
        while(true){
            int n = sc.nextInt();
            int p = sc.nextInt();
            int pfst = p;
            int out = 0;
            if(0 == n&&0 == p){
                break;
            }
            int[] s = new int[n];
            int i = 0;
            while(true){
            	if(p>0) {
		        	s[i]+=1;
		        	p-=1;
		        }
            	else if(s[i]>0) {
		        	p=s[i];
		        	s[i]=0;
		        }

	        	for(int j=0;j<n;j++) {
	        		if(s[j]==pfst) {
	        			System.out.println(j);
	        			pfst = 0;
	        			break;
	        		}
	        	}
		        if(pfst==0) {
		        	break;
		        }
		        i++;
		        if(i==n) {
		        	i=0;
		        }
            }
        }
	}
}


Measured memory_bytes: 27228
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc129/tasks/abc129_a

import itertools
d = [int(x) for x in input().split()]
li = []
for t1, t2 in itertools.permutations(d, 2):
    li.append(t1 + t2)
print(min(li))


Measured memory_bytes: 3060
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1
//{
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1;

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

main(){
	int n,t,a,mem=MOD,ans;
	cin>>n>>t>>a;
	t*=1000;
	a*=1000;
	int h[n];
	rep(i,n)cin>>h[i];
	rep(i,n)h[i]=t-h[i]*6;
	rep(i,n)mem>abs(a-h[i])?mem=abs(a-h[i]),ans=i+1:0;
	dans;
}


Measured memory_bytes: 256
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

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

    int n = 1000;

    Int x;
    cin >> x;
    vector<Int> ab;
    for (Int i = -n; i < n; i++) {
        ab.push_back(i * i * i * i * i);
    }

    n = ab.size();
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (ab[i] - ab[j] == x) {
                cout << i - 1000 << ' ' << j - 1000 << endl;
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
int n, k;
vector<int> ds;
int main() {
  cin>>n>>k;
  ds.clear();
  for (int i = 0; i < k; ++i) {
  	int d;
    cin>>d;
    ds.push_back(d);
  }
  set<int> dss(ds.begin(), ds.end());
  for (int i = n; i <= 1000000; ++i) {
  	vector<int> tds;
    tds.clear();
    int j =i;
    while(j) {
      tds.push_back(j % 10);
      j /= 10;
    }
    int t;
    for (t=0;t < tds.size(); ++t) {
      if (dss.find(tds[t]) != dss.end()) break;
    }
    if (t>=tds.size()) {
      cout<<i<<endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>

using namespace std;

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

    int a, b, c;
    cin >> a >> b >> c;

    if(a == 5 && b == 5 && c == 7 ||
            a == 5 && b == 7 && c == 5 ||
            a == 7 && b == 5 && c == 5
    ) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define Would
#define you
#define please


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

	int N;
	cin >> N;
	vector<int> eda[100001];
	rep(i, N - 1) {
		int a, b;
		cin >> a >> b;
		eda[a].push_back(b);
		eda[b].push_back(a);
	}

	int kyoriF[100001] = {};
	int kyoriS[100001] = {};

	vector<pair<int, int>> que;
	que.push_back(make_pair(1, 0));
	while (que.size()) {
		vector<pair<int, int>> que2;
		for (auto itr : que) {
			if (kyoriF[itr.first] == 0) {
				kyoriF[itr.first] = itr.second + 1;
				for (auto itr2 : eda[itr.first]) {
					que2.push_back(make_pair(itr2, itr.second + 1));
				}
			}
		}
		que = que2;
	}

	que.push_back(make_pair(N, 0));
	while (que.size()) {
		vector<pair<int, int>> que2;
		for (auto itr : que) {
			if (kyoriS[itr.first] == 0) {
				kyoriS[itr.first] = itr.second + 1;
				for (auto itr2 : eda[itr.first]) {
					que2.push_back(make_pair(itr2, itr.second + 1));
				}
			}
		}
		que = que2;
	}
	int fen = 0;
	rep1(i, N) {
		if (kyoriF[i] <= kyoriS[i]) fen++;
	}
	if (fen > N - fen) co("Fennec");
	else co("Snuke");

	Would you please return 0;
}

Measured memory_bytes: 7988
#!/usr/bin/env python3
import sys
from bisect import bisect_left
INF = float("inf")


def solve(N: int, a: "List[int]"):
    a.sort()
    lower, upper = 0, 2
    m = 1
    while lower < 10**5:
        m = max(m, bisect_left(a, upper+1)-bisect_left(a, lower))
        lower += 1
        upper += 1
    print(m)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


Measured memory_bytes: 14452
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <climits>
using namespace std;
typedef long long ll;
int main(void){
    int a,b,t;
    cin >> a >> b >> t;
    int tmp = t/a;
    cout << b*tmp << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Tarek
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTravelingSalesmanAroundLake solver = new CTravelingSalesmanAroundLake();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTravelingSalesmanAroundLake {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int k = in.nextInt();
            int n = in.nextInt();
            int[] houses = new int[n];
            for (int i = 0; i < n; i++) houses[i] = in.nextInt();
            long sum = houses[n - 1] - houses[0];
            for (int i = 0; i < n - 1; i++) {
                sum = Math.min(sum, (k - houses[i + 1] + houses[i]));
            }
            out.println(sum);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 46320
n = int(input())
input_list = [int(i) for i in input().split(' ')]

count = 0
past = None
past_diff = None
for i in input_list:
    if past:
        if past_diff is not None and (i - past) * past_diff > 0:
            count += 1
        past_diff = i - past
    past = i

print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <iomanip>
using namespace std;

int main() {
    int h, a;
    cin >> h >> a;
    int count = 0;
    while (h > 0) {
        h -= a;
        count++;
    }
    cout << count << endl;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORd(i, a, b) for (int i = (a) ; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define sp system("pause")
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
const int N = (int) 1e5 + 10;
void TimeExecution() {
    cout << "\n\n===>> Time Execution: " << clock() / (double)1000 << " sec(s).";
}
ll sqr(ll a)
{
    return ((a % MOD) * (a % MOD)) % MOD;
}
ll msub(ll a, ll b)
{
    return ((a - b) % MOD + MOD) % MOD;
}
ll madd(ll a, ll b)
{
    return (a + b) % MOD;
}
ll mmul(ll a, ll b)
{
    return ((a % MOD) * (b % MOD)) % MOD;
}
int t;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    /*
    #ifndef ONLINE_JUDGE
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    #endif
    */
    int k, a, b;
    cin >> k >> a >> b;
    FOR(i, a, b) if(i % k == 0)
    {
        cout << "OK";
        return 0;
    }
    cout << "NG";
    return 0;
}


Measured memory_bytes: 3652
#include <stdio.h>

int main() {
    char a;
    scanf(" %c%*c%*c ", &a);
    printf("%c", a);
    scanf(" %*c%c%*c ", &a);
    printf("%c", a);
    scanf(" %*c%*c%c ", &a);
    printf("%c\n", a);
}


Measured memory_bytes: 128
// In the name of God

#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#include <complex>

using namespace std;

#define rep(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }
template<typename T> inline bool smin(T &a, const T &b)   { return a > b ? a = b : a;    }
template<typename T> inline bool smax(T &a, const T &b)   { return a < b ? a = b : a;    }

typedef long long LL;

const int N = (int) 605;
int dp[N][N], mod, comb[N][N], accumulate[N][N];
void sadd(int &x, int y) {
	x += y;
	if (x >= mod) x -= mod;
}
int main() {
	int n, m;
	cin >> n >> m >> mod;
	for (int i = 0; i < N; ++i)
		for (int j = 0; j <= i; ++j)
			comb[i][j] = (i == j || j == 0) ? 1 : (comb[i - 1][j] + comb[i - 1][j - 1]) % mod;
	for (int k = 1; k <= m; ++k)
		dp[1][k] = k % mod, dp[0][k] = 1;
	dp[0][0] = 1;
	for (int sz = 2; sz <= n; ++sz) {
		dp[sz][1] = 1;
		for (int col = 2; col <= m; ++col) {
			dp[sz][col] = dp[sz][col - 1];
			for (int lsz = 1; lsz <= sz; ++lsz) {
				// x0 + x1 + ... + xlsz - 2 = sz - lsz + 1
				// x0 + x1 + ... + xlsz - 2 = sz
				sadd(dp[sz][col], dp[lsz - 1][col - 1] * (LL) dp[sz - lsz][col] % mod * comb[sz][lsz - 1] % mod);
			}
		}
	}
	cout << dp[n][m] << endl;
}






Measured memory_bytes: 2944
N, K = map(int, input().split())
d = []
A = []
for i in range(K) :
    d.append(int(input()))
    A.append(list(map(int,input().split())))

a = set()
ans = 0
for i in range(K) :
    for j in range(len(A[i])) :
        a.add(A[i][j])

for i in range(1,N+1):
    if i not in a :
        ans += 1
print(ans)

Measured memory_bytes: 9204
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int ans[11][11],map[11][11],f[11];
int main(){
	int i,j,k,x,y,n;
	
	scanf("%d",&n);
	for(k=0;k<n;k++){
		memset(ans,0,sizeof(ans));
		if(k!=0)printf("\n");
		for(i=0;i<9;i++){
			memset(f,-1,sizeof(f));
			for(j=0;j<9;j++){
				scanf("%d",&map[i][j]);
				if(f[map[i][j]]==-1)f[map[i][j]]=j;
				else{
					ans[i][j]=1;
					ans[i][f[map[i][j]]]=1;
				}
			}
		}
		for(j=0;j<9;j++){
			memset(f,-1,sizeof(f));
			for(i=0;i<9;i++){
				if(f[map[i][j]]==-1)f[map[i][j]]=i;
				else{
					ans[i][j]=1;
					ans[f[map[i][j]]][j]=1;
				}
			}
		}
		for(i=0;i<9;i++){
			memset(f,-1,sizeof(f));
			for(j=0;j<9;j++){
				x=(i%3)*3+j%3;
				y=(i/3)*3+j/3;
				if(f[map[y][x]]==-1)f[map[y][x]]=j;
				else{
					ans[y][x]=1;
					ans[(i/3)*3+f[map[y][x]]/3][(i%3)*3+f[map[y][x]]%3]=1;
				}
			}
		}
		for(i=0;i<9;i++){
			for(j=0;j<9;j++){
				printf("%s%d",(ans[i][j]==1)?"*":" ",map[i][j]);
			}
			printf("\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 600
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<cstdlib>
#include<queue>
#include<vector>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef ostream_iterator<int> os_iter_int;

ll n,pos[200010],ans,L;
ll lsum[200010],rsum[200010];

template<typename inp_t>
void readx(inp_t& x)
{
	x=0; int k=1; char ch=0;
	while (ch<'0' || ch>'9') { ch=getchar(); if (ch=='-') k=-1; }
	while (ch>='0' && ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	x*=k;
}

int main()
{
	readx(L); readx(n);
	for (int i=0;i<n;i++) readx(pos[i]);
	
	for (int i=1;i<=n;i++) lsum[i]=lsum[i-1]+pos[i-1]*2;
	for (int i=n-1;i>=0;i--) rsum[i]=rsum[i+1]+(L-pos[i])*2;
	
	// start pos and turing time can determine only one legal move sequence
	// a b 0 c d e
	// 0→c→d→Turn→Turn→Turn ..
	for (int i=0;i<n;i++) 
	{
		ll tmp=pos[i]+lsum[i]+rsum[i+1];
		// 减去第一阶段走过的树的 lsumrsum 贡献
		if (i>=n-(i+1)) tmp-=lsum[i-(n-(i+1))];
		else tmp-=rsum[i+1+i+1];
		ans=max(ans,tmp);
	}
	// right dir
	for (int i=0;i<n;i++)
	{
		ll tmp=(L-pos[i])+lsum[i]+rsum[i+1];
		if (i<=n-(i+1)) tmp-=rsum[i+1+i];
		else tmp-=lsum[i-(n-(i+1))-1];
		ans=max(ans,tmp);
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);

#define nl "\n"
#define fr first
#define sc second
#define MP make_pair
#define pb push_back
#define VI vector<int>
#define VII vector<ll>
#define MAP map <int,int>
#define PI pair < int , int >
#define sz(v) (int)(v).size()
#define all(v) v.begin(),v.end()
#define mem(a,val) memset(a,val,sizeof(a))
#define precise(n) fixed(cout);cout<<setprecision(n)

const int N = (int)4e7;
const int MOD = (int)1e9 + 7;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;

typedef long long ll;
typedef double db;

using namespace std;

int main()
{
    io;
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);

    ///Let the showdown begin

    int t;
    cin >> t;

    VI v,v1;
    v.clear();
    v1.clear();
    while(t--)
    {
        int x,y;
        cin >> x>>y;
        v.pb(x);
        v1.pb(y);
    }

    bool vlid=false;
    for(int i=0 ; i<sz(v)-2 ; i++)
    {
        if(v[i]==v1[i] && v[i+1]==v1[i+1] && v[i+2]==v1[i+2])
        {
            vlid =true;
            break;
        }
    }
    if(vlid)
        cout << "Yes" << nl;
    else
        cout << "No" << nl;

    ///Happily DONE

    return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main()
{
	long long a, b, x, y, t;
	cin >> a >> x >> b >> y >> t;
	long long d = a - b > 0 ? a - b : b - a;
	if ((x - y) * t >= d) cout << "YES";
	else cout << "NO";

	return 0;
}

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

#include<random>  

#define int long long  

#define pp pair<int,int>  

#define ss second  

#define ff first  

#define pb push_back  

#define mod 1000000007  

using namespace std;  

void fastio()  

{    

  

  #ifndef ONLINE_JUDGE                  

  freopen("INPUT.txt","r",stdin);              

  freopen("OUTPUT.txt","w",stdout);              

  #endif    

     ios_base :: sync_with_stdio(false);   

     cin.tie(NULL) ;                             

      cout.tie(NULL);                              

   } 

   

signed main()  {    

        fastio();         

         int t=1;           

          // cin>>t;                

           while(t--)                  

              {                        

                   int n;

                   cin>>n;

                   int a[n],b[n+1];

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

                   cin>>a[i];

                   b[a[i]]=i+1;

                   }

                   for(int i=1;i<=n;i++)

                   cout<<b[i]<<" ";

               }  

                      

                            

    }     

Measured memory_bytes: 5072
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <queue>
#include <unordered_set>

using namespace std;
typedef long long ll;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
#define rep(i, n) for(int i = 0;i < n;i++)
const int INF = 1LL << 30;

int MOD = 1000000007;

typedef pair<int,int> pii;

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

    int n,m; cin >> n >> m;
    std::vector<pii> v;

    rep(i,n){
        int a,b; cin >> a >> b;
        v.push_back(pii(a,b));
    }

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

    priority_queue<int> q;
    ll count = 0LL;

    int j = 0;
    rep(i,m){
        int day = i+1;

        while(v[j].first <= day && j<n){
            q.push(v[j].second);
            j++;
        }

        if(!q.empty()){count += q.top(); q.pop();}
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 1908
import copy

N = int(input())
C = input().split(' ')

def bubble_sort(bubble_C, N):
    for i in range(N):
        for j in range(i+1, N)[::-1]:
            if int(bubble_C[j][1]) < int(bubble_C[j-1][1]):
                tmp = bubble_C[j]
                bubble_C[j] = bubble_C[j-1]
                bubble_C[j-1] = tmp
    return bubble_C

def selection_sort(sel_C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if int(sel_C[j][1]) < int(sel_C[minj][1]):
                minj = j
        tmp = sel_C[i]
        sel_C[i] = sel_C[minj]
        sel_C[minj] = tmp
    return sel_C

def check_stable(C1, C2):
    C_order_table = {}
    sorted_C_order_table = {}
    for i in range(len(C1)):
        if C_order_table.get(C1[i][1]):
            C_order_table[C[i][1]] += C1[i][0]
        else:
            C_order_table[C1[i][1]] = C1[i][0]
        
        if sorted_C_order_table.get(C2[i][1]):
            sorted_C_order_table[C2[i][1]] += C2[i][0]
        else:
            sorted_C_order_table[C2[i][1]] = C2[i][0]
    
    is_stable = True
    for n in range(1, 10):
        if C_order_table.get(str(n)) != sorted_C_order_table.get(str(n)):
            is_stable = False
            break
    
    if is_stable:
        print('Stable')
    else:
        print('Not stable')

bubble_C = copy.copy(C)
sel_C = copy.copy(C)

sorted_C = bubble_sort(bubble_C, N)
print(" ".join(sorted_C))
check_stable(C, sorted_C)

sorted_C = selection_sort(sel_C, N)
print(" ".join(sorted_C))
check_stable(C, sorted_C)


Measured memory_bytes: 6348
#include <iostream>
#include <string>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

int H, W;
std::string fld[51];

int main()
{
  std::cin >> H >> W;
  rep( i, H )
    std::cin >> fld[i];
  
  rep( i, H ) rep( j, W )
  {
    if( fld[i][j] == '#' ) 
    {
      bool fl = false;

      rep( k, 4 )
      {
        int ni = i+dy[k], nj = j+dx[k];

        if( ni >= 0 && ni < H && nj >= 0 && nj < W && fld[ni][nj] == '#' )
        { fl = true; break; }
      }

      if( !fl )
      {
        puts( "No" );

        return 0;
      }
    }
  }

  puts( "Yes" );

  return 0;
}

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

/*
int main() {
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    int num_atack_t = ceil(d/a);
    int num_atack_a = ceil(b/c);
    string ans = "No";
    if( num_atack_t <= num_atack_a )
        ans = "Yes";
    cout << ans << endl;
    return 0;
} */

int main(){
    int a,b,c,d;
    cin >> a >> b >>c >> d;
    string ans;
    int stage = min( ceil(d/a), ceil(b/c));
    while(1){
        c = c - b;
        if(c <= 0) {
            ans = "Yes";
            break;
        }
        a = a - d;
        if(a <= 0){
            ans ="No";
            break;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#define ll long long

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

int main()
{
    int n;
    cin >> n;
    ll a[100010];
    ll cnt[100010];
    memset(cnt, 0, sizeof cnt);
    ll ans[100010];
    ll sum = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        cnt[a[i]]++;
        sum += a[i];
    }
    int q;
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        ll b, c;
        cin >> b >> c;
        sum -= b * cnt[b];
        sum += c * cnt[b];
        ans[i] = sum;
        cnt[c] += cnt[b];
        cnt[b] = 0;
    }
    for (int i = 0; i < q; i++)
    {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 5912
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

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());
    cout << a.back() - a[0] << endl;
}

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

int main(){
	ll n;
	cin >>n;
	bool is=true; 

	for (int i = 1; i < 10; ++i)
	{
		for (int x = 1; x < 10; ++x)
		{
			if((i*x)==n){
				is=false;
			}
		}
	}
	if(is==false){
		cout << "Yes";
	}
	else {
		cout << "No";
	}
}

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

using namespace std;

int dp[100010];

vector<int> L;

int main()
{
    int n;
    cin >> n;
    for ( int d=6; d<=n; d*=6 )
    {
        L.push_back(d);
    }
    for ( int d=9; d<=n; d*=9 )
    {
        L.push_back(d);
    }
    dp[0] = 0;
    for ( int c=1; c<=n; c++ )
    {
        dp[c] = dp[c-1] + 1;
        for ( int d=0; d<L.size(); d++ )
        {
            if ( L[d] > c )
                continue;
            dp[c] = min(dp[c], dp[c-L[d]]+1);
        }
    }
    cout << dp[n];
}


Measured memory_bytes: 640
#include <iostream>
#include <map>

using namespace std;

bool card[3][3];

bool check()
{
    for(int i=0; i<3; i++) {
        if(card[i][0] && card[i][1] && card[i][2])
            return true;

        if(card[0][i] && card[1][i] && card[2][i])
            return true;
    }

    if(card[0][0] && card[1][1] && card[2][2])
        return true;

    if(card[0][2] && card[1][1] && card[2][0])
        return true;

    return false;
}

int main()
{
    map<int, pair<int, int> > ref;

    for(int i=0; i<3; i++) {
        for(int j=0; j<3; j++) {
            int num;
            cin >> num;

            ref[num] = {i, j};
        }
    }

    int q;
    cin >> q;

    bool bingo = false;

    while(q--)
    {
        int num;
        cin >> num;

        if(ref.count(num))
        {
            int x = ref[num].first;
            int y = ref[num].second;
            card[x][y] = true;
            bingo = bingo or check();
        }
    }

    cout << (bingo ? "Yes" : "No") << '\n';

    return 0;
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<int> a(n);
	REP(i, n) cin >> a[i];
	vector<int> b = a;
	REP(i, n) a[i] -= i;
	int ans = 0;
	map<int, int> mp;
	for(int i = n - 1; i >= 0; i--){
		if(i != n - 1){
			ans += mp[-b[i] - i];
		}
		mp[a[i]]++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 28976
#include <stdio.h>
#include <algorithm>
#include <vector>

class Node {
public:
    Node()
    {}

public:
    int location;
    int p;
    int l;
    int r;
};

class Point {
public:
    Point()
    {}

    Point(int id, int x, int y)
        : id(id)
        , x(x)
        , y(y)
    {}

    bool operator < (const Point& p) const
    {
        return id < p.id;
    }

    void print()
    {
        printf("%d\n", id);
    }

public:
    int id;
    int x;
    int y;
};

static const int MAX = 1000000;
static const int NIL = -1;

static int N;
static Point P[MAX];
static Node T[MAX];
static int np;

static bool lessX(const Point& p1, const Point& p2)
{
    return p1.x < p2.x;
}

static bool lessY(const Point& p1, const Point& p2)
{
    return p1.y < p2.y;
}

static int makeKDTree(int l, int r, int depth)
{
    if (l >= r)
        return NIL;

    int mid = (l + r) / 2;
    int t = np++;
    if (depth % 2 == 0) {
        std::sort(P + l, P + r, lessX);
    } else {
        std::sort(P + l, P + r, lessY);
    }
    T[t].location = mid;
    T[t].l = makeKDTree(l, mid, depth + 1);
    T[t].r = makeKDTree(mid + 1, r, depth + 1);
    return t;
}

static void find(int v, int sx, int tx, int sy, int ty, int depth, std::vector<Point>& ans)
{
    int x = P[T[v].location].x;
    int y = P[T[v].location].y;

    if (sx <= x && x <= tx && sy <= y && y <= ty) {
        ans.push_back(P[T[v].location]);
    }

    if (depth % 2 == 0) {
        if (T[v].l != NIL) {
            if (sx <= x) {
                find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
            }
        }
        if (T[v].r != NIL) {
            if (x <= tx) {
                find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
            }
        }
    } else {
        if (T[v].l != NIL) {
            if (sy <= y) {
                find(T[v].l, sx, tx, sy, ty, depth + 1, ans);
            }
        }
        if (T[v].r != NIL) {
            if (y <= ty) {
                find(T[v].r, sx, tx, sy, ty, depth + 1, ans);
            }
        }
    }
}

int main()
{
    int x, y;
    scanf("%d", &N);
    for (int i = 0; i < N; i++) {
        scanf("%d %d", &x, &y);
        P[i] = Point(i, x, y);
        T[i].l = T[i].r = T[i].p = NIL;
    }

    np = 0;

    int root = makeKDTree(0, N, 0);

    int q;
    scanf("%d", &q);
    int sx, tx, sy, ty;
    std::vector<Point> ans;

    for (int i = 0; i < q; i++) {
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);
        ans.clear();
        find(root, sx, tx, sy, ty, 0, ans);
        std::sort(ans.begin(), ans.end());
        for (int j = 0; j < ans.size(); j++) {
            ans[j].print();
        }
        printf("\n");
    }

    return 0;
}


Measured memory_bytes: 15848
import java.util.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        String b = sc.next();

        long B = 0;
        B += b.charAt(0) - '0';
        B *= 10;
        B += b.charAt(2) - '0';
        B *= 10;
        B += b.charAt(3) - '0';


        long res = (long) (A * B / 100);
        //long res = (A * (long)(B * 100)) / 100;

        System.out.println(res);
    }
}

/*
999999999999999 9.99
 */

Measured memory_bytes: 35744
#include<cstdio>
#include<algorithm>
using namespace std;
int f(int x,int y)
{
    return x<y?y-x:x-y;
}
int main()
{
    int n,a[200],sum=0,ans=1000000009;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        sum+=x;
        a[i]=sum;
    }
    for(int i=1;i<=n;i++)
        ans=min(ans,f(a[i],a[n]-a[i]));
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
# coding: utf-8
# Here your code !
 
from collections import Counter
 
def func():
    inputdata=""
    while(True):
        try:
            line=input()
            inputdata+=line
        except EOFError:
                break
        except:
            return inputError()

    alphabets_small=[ chr(i) for i in range(97,97+26) ]

    counter=Counter(inputdata.lower())
    data=dict(counter)

    for char in alphabets_small:
        try:
            print(char+" : "+str(data[char]))
        except:
            print(char+" : 0")
    

def inputError():
    print("input Error")
    return -1
 
func()

Measured memory_bytes: 7772
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	ll x, now = 100;
	cin >> x;

	for (int i = 1; ; i++){
		now *= 1.01;
		if (now >= x){
			cout << i << endl;
			return 0;
		}
	}
	
	return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
//const ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
const ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
ll myctoi(char C) {return C - '0';}
char myitoc(ll N) {return '0' + N;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N, K;
  cin >> N >> K;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++)
  {
    cin >> A.at(i);
  }

  ll ans = INF;
  for (ll b = 0; b < (1LL << N); b++)
  {
    bitset<15> B = b;
    if (!B.test(0))
      continue;
    if (B.count() != K)
      continue;

    vector<ll> AA(N);
    for (ll i = 0; i < N; i++)
    {
      AA.at(i) = A.at(i);
    }

    ll mx = AA.front();
    ll tmp = 0;
    for (ll i = 1; i < N; i++)
    {
      if (B.test(i))
      {
        ll dh = max(0LL, mx + 1 - AA.at(i));
        tmp += dh;
        AA.at(i) += dh;
      }
      chmax(mx, AA.at(i));
    }
    chmin(ans, tmp);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {

	int a, b, c,tmp;

	scanf("%d%d%d", &a, &b, &c);

	if (a > b) {
		tmp = b;
		b = a;
		a = tmp;
	}
	if (b > c) {
		tmp = c;
		c = b;
		b = tmp;
	}
	if (a > b) {
		tmp = b;
		b = a;
		a = tmp;
	}

	printf("%d %d %d\n", a, b, c);

}


Measured memory_bytes: 2032
#include <stdio.h>

int main(void) {
	int a,b,c,d,e;
	int na,nb,nc;
	int price,minprice;
	int i;
	while(1) {
		scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
		if((a|b|c|d|e)==0)break;
		scanf("%d%d%d",&na,&nb,&nc);
		minprice=0x7fffffff;
		for(i=0;i<=na+nb;i++) {
			if(i>nb) {
				price=a*(i-nb)+b*nb+c*nc;
			} else {
				price=b*i+c*nc;
			}
			if(i+nc>=d) {
				if(price>(i+nc)*e)price=(i+nc)*e;
			} else {
				if(price>d*e)price=d*e;
			}
			if(i>nb) {
				price+=a*(na-(i-nb));
			} else {
				price+=a*na+b*(nb-i);
			}
			if(price<minprice)minprice=price;
		}
		printf("%d\n",minprice);
	}
	return 0;
}

Measured memory_bytes: 600
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include<stack>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) for(auto r:v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define pc() pop_back()
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
#define ll long long
#define endl '\n'
#define st stack<int>
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first> 
#define vpii vector<pii>
#define vvi vector<vi>
#define vs vector<string>
#define mii map<int,int>

int power(int a, int b) {
    int res = 1;
    while (b != 0) {
        if (b & 1) {
            res *= a;
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
template<typename T, typename U> inline void amin(T& x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T& x, U y) {
    if (x < y) x = y;
}
bool comp(int n) {
    vi v(4);
    int i = 0;
    while (n) {
        v[i] = n % 10;
        n /= 10;
        i++;


    }
    set<int> s(all(v));
    if (s.size() != 4) return false;
    else return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k;
    cin >> n >> k;
    vi v(n);
    rep(i, n) cin >> v[i];
    vi dp(n, 1e9);
    dp[0] = 0;
    dp[1] = abs(v[0] - v[1]);
    int t;
    for (int j = 2; j < n; j++) {
        t = 1;
        while (t<=k&&j-t>=0) {
            dp[j] = min(dp[j], dp[j-t]+abs(v[j - t] - v[j]));
            t++;
        }
    }
    cout << dp[n - 1];



}

Measured memory_bytes: 1024
#include<stdio.h>
int main(){
	int W,H,x,y,r,a;
	scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
	if (W>=x+r && 0<=x-r && H>=y+r && 0<=y-r) printf("Yes\n");//??????
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 584
import math
N, D = map(int, input().split( ))
A = []
def d(a,b):
  s = 0
  for i in range(len(a)):
    s += (a[i] - b[i])**2
  return math.sqrt(s)

for _ in range(N):
  A.append(list(map(int, input().split( ))))
ans = 0
for i in range(N):
  for j in range(i+1,N):
    s = d(A[i],A[j])
    if s.is_integer():
      ans += 1
print(ans)  

Measured memory_bytes: 9112
#include <stdio.h>
int main(void)
{
    long a, b, c, d, tmp;
    while (scanf("%ld %ld", &a, &b) != EOF) {
        d = a * b;
        if(a < b) {
            tmp = a;
            a = b;
            b = tmp;
        }
 
    c = a % b;
    while(c != 0) {
        a = b;
        b = c;
        c = a % b;
    }
 
    printf("%ld\n", b);
    }
       return 0;
}


Measured memory_bytes: 1980
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

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




Measured memory_bytes: 3648
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
#define all(ppp) ppp.begin(),ppp.end()
#define out(ppp) cout<<(ppp)<<endl
#define out1(ppp) cout<<(ppp) 

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define pb push_back

typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<pll> vpll;
typedef vector<pi> vpi;
typedef vector<cd> vcd;
typedef vector<vpi> vvpi;

typedef set<pi> spi;

const int INF=INT_MAX;

ll solve(ll n){
    if(n==1){
        return 1;
    }else if(n<1){
        return 0;
    }
    return 1+2*solve(n/2);
}



int main(){
    ll H,N;
    cin>>H>>N;
    vpll AB(N);
    F0R(i,N){
        cin>>AB[i].first>>AB[i].second;
    }
    sort(all(AB));
    vvll dp(N+1,vll(H+1,0));
    for(int j=1;j<=H;j++){
        if(j<=AB[0].first){
            dp[1][j]=AB[0].second;
        }else{
            dp[1][j]=dp[1][j-AB[0].first]+AB[0].second;
        }
    }

    for(int i=1;i<N;i++){
        for(int j=1;j<=H;j++){
            if(j<=AB[i].first){
                dp[i+1][j]=min(AB[i].second,dp[i][j]);
            }else{
                dp[i+1][j]=min(dp[i+1][j-AB[i].first]+AB[i].second,dp[i][j]);
            }
        }
    }

    out(dp[N][H]);
    return 0;
}


Measured memory_bytes: 78592
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author koneko096
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    CStones solver = new CStones();
    solver.solve(1, in, out);
    out.close();
  }

  static class CStones {
    private static final int N = 200004;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      int[] B = new int[N], W = new int[N];

      int n = in.nextInt();
      char[] s = in.next().toCharArray();

      for (int i = 1; i <= n; i++) {
        B[i] = B[i - 1] + boolToInt(s[i - 1] == '#');
        W[i] = W[i - 1] + boolToInt(s[i - 1] == '.');
      }

      int ans = N;
      for (int i = 0; i <= n; i++) {
        ans = Math.min(ans, B[i] + W[n] - W[i]);
      }
      out.println(ans);
    }

    private int boolToInt(boolean b) {
      return (b ? 1 : 0);
    }

  }


  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream), 32768);
      tokenizer = null;
    }

    public String next() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          tokenizer = new StringTokenizer(reader.readLine());
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
      }
      return tokenizer.nextToken();
    }

    public int nextInt() {
      return Integer.parseInt(next());
    }

  }
}



Measured memory_bytes: 28116
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <cmath>

#define mst(a,b)memset(a, b, sizeof(a))
#define repi(a,b)for(ll i = a; i < b; i++)
#define repj(a,b)for(ll j = a; j < b; j++)
#define pii pair<int,int>

#ifdef LOCAL
#define fre()freopen("in.txt","r",stdin)
#endif
#ifndef LOCAL
#define fre()
#endif

//static int x = []() {
//	std::ios::sync_with_stdio(false);
//	std::cin.tie(NULL);
//	return 0;
//}();

#define FASTIO
#ifdef FASTIO
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
//#define scanf abcabc
//#define printf abcabc
#endif
//#ifndef FASTIO
//#define cin abcabc
//#define cout abcabc
//#endif

typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;

using namespace std;


int main() {
	int r, d, x; cin >> r >> d >> x;
	repi(0, 10) {
		x = r * x - d;
		cout << x << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        int n = bubbleSort(a);
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
        System.out.println(n);
    }

    private static int bubbleSort(int[] a) {
        int n = 0;
        for (int i = 0; i < a.length; i++) {
            for (int j = a.length - 1; j > i; j--) {
                if (a[j] < a[j - 1]) {
                    int t = a[j];
                    a[j] = a[j - 1];
                    a[j - 1] = t;
                    n++;
                }
            }
        }
        return n;
    }
}

Measured memory_bytes: 26416
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			int h = int.Parse(Console.ReadLine());
			int w = int.Parse(Console.ReadLine());
			int n = int.Parse(Console.ReadLine());

			if (h > w)
			{
				if (n % h == 0)
				{
					Console.WriteLine(n / h);
				}
				else
				{
					Console.WriteLine(n / h + 1);
				}
			}
			else
			{
				if (n % w == 0)
				{
					Console.WriteLine(n / w);
				}
				else
				{
					Console.WriteLine(n / w + 1);
				}
			}

		}

	}
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  
  int ans=0;
  
  for(int a=1;a<sqrt(N)+1;a++){
    for(int b=a;b<N/a+1;b++){
      if(N-a*b>0){
        if(a==b)ans++;
        else ans +=2;
      }
    }
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3680