akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    vec a(N+1, 0);
    rep1(i, N) cin >> a[i];
    sort(all(a));
    rep(i, N+1){
        if(i%2) a[i] = 24-a[i];
    }
    ll res = INF;
    rep(i, N+1){
        Rep(j, i+1, N+1){
            int tmp = abs(a[i]-a[j]);
            res = min(res, (ll)min(tmp, 24-tmp));
        }
    }
    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


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

const int n_MAX = 100,x_MAX = 300;
int n[n_MAX], x[x_MAX];

int input(){
	int i = 0;

	for (;; i++){
		cin >> n[i] >> x[i];
		if (n[i] == 0 && x[i] == 0)break;
	}

	return i;
}

int combination(int n, int x){
	int count = 0;
	for (int i1 = 0; i1 < n - 2; i1++){
		for (int i2 = i1 + 1; i2 < n - 1; i2++){
			for (int i3 = i2 + 1; i3 < n; i3++){
				if (i1 + i2 + i3 + 3 == x)count++;
			}
		}
	}
	return count;
}

int main(){
	int i=
		input();

	for (int j = 0; j < i; j++){
		cout << combination(n[j], x[j]) << endl;
	}

	return 0;
}


Measured memory_bytes: 3048
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans=0
small=0
large=0
for i in range(N):
  for k in range(small,N):
    if A[k]>=B[i]:
      small=k
      break
  else: small=N
  for k in range(large,N):
    if C[k]>B[i]:
      large=k
      break
  else: large=N
  ans+=small*(N-large)
print(ans)

Measured memory_bytes: 105444
#include<iostream>
#include<string>
#include<algorithm>

typedef long long ll;
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a + b > 9) {
		cout << "error" << endl;
	}
	else {
		cout << a + b << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    long long int n,a,b,c,d;
    cin>>n>>a>>b>>c>>d;
    n=n-1;
    int flag=1;
    
    long long int x=b-a;
    long long int sup=(d*n-x)/(c+d);
    long long int inf=(c*n-x+c+d-1)/(c+d);
    
    if(sup<inf){
        cout<<"NO";
        flag=0;
    }
    if(sup<0){
        cout<<"NO";
        flag=0;
    }
    if(inf>n){
        cout<<"NO";
        flag=0;
    }
    if(flag){
        cout<<"YES";
    }
}


Measured memory_bytes: 256
// Atcoder
  // Practice Problems
  // A - Buttons
  #include <bits/stdc++.h>
  #include <iostream>
  #include <map>
  #include <queue>
  #include <set>
  #include <string>   
  #include <vector>
  #include <numeric>
  using namespace std;
  typedef long long int ll;
  typedef pair<ll, int> PLI;
  typedef pair<int, int> PII;
  const ll mxsize = 1e5 + 5;
  #define fastIO                                                                 \
    ios_base::sync_with_stdio(false);                                            \
    cin.tie(NULL);                                                               \
    cout.tie(NULL);
  
  /******************************************* IMPORTANT CODE SNIPPETS ************************************************/ 
  
  ll pow(ll x, ll n) {
    if (n == 0)
      return 1ll;
    ll temp;
    temp = pow(x, n / 2);
    if (n % 2 == 0)
      return temp * temp;
    else
      return x * temp * temp;
  }

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

  int sum_digit(int val) {
    if (val < 0)
      return -1;
    if (val == 0)
      return 0;
    int ans = 0;
    while (val > 0) {
      ans = ans + val % 10;
      val = val / 10;
    }
    return ans;
  }

  ll count_div(ll l, ll r, ll val) {
    if (l % val == 0)
      return (((r / val) - (l / val)) + 1);
    else
      return ((r / val) - (l / val));
  }

  int powmod(int x, int y, int m) {
    int res = 1;
    // x = x % mod;
    while (y > 0) {
      if (y & 1)
        res = (res * x) % m;
      cout << res << endl;
      y = y / 2;
      cout << x << endl;
      x = (x * x) % m;
    }
    // cout << res << endl;
    return res;
  }
  /******************************************** CODE STARTS FROM HERE *************************************************/ 
  
  int main()
  {
    int n;
    cin >> n;
    int arr[n];
    for(int i = 0 ; i < n ; i++) cin >> arr[i];
    int ans = 1;
    int hmax = arr[0];
    for(int i = 1 ; i < n ; i++)
    {
      if(arr[i] >= hmax)
      {
        hmax = arr[i];
        ans++;
      }
    }
    cout << ans << endl;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,x;
	int ans=0;
	cin>>a>>b>>c>>x;

	for(int i=0;i<=a;i++)
	{
		for(int j=0;j<=b;j++)
		{
			for(int k=0;k<=c;k++)
			{
				int z=i*500+100*j+k*50;
				if(z==x)
				{
					ans++;
				}
			}
		}
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
const ll INF = 1e16;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}
//--------------------------------------------------------------------------------//
struct dice{
    int u, d, f, b, l, r;
    void init(int up,int down,int front, int back, int left, int right){
        u = up, d = down, f = front, b = back, l = left, r = right;
    }
    void goup(){    int tmp = u; u = b, b = d, d = f, f = tmp; }
    void godown(){  int tmp = u; u = f, f = d, d = b, b = tmp; }
    void goleft(){  int tmp = u; u = r, r = d, d = l, l = tmp; }
    void goright(){ int tmp = u; u = l, l = d, d = r, r = tmp; }

    void rotateleft() {  int tmp = f; f = r, r = b, b = l, l = tmp; }
    void rotateright() { int tmp = f; f = l, l = b, b = r, r = tmp; }

    void reversefb() { swap(f, b), swap(u, d); }
    void reverselr() { swap(l, r), swap(u, d); }
};
int main() {
    init();
    int u, b, r, l, f, d;
    cin >> u >> b >> r >> l >> f >> d;
    dice dic;
    dic.init(u, d, f, b, l, r);

    dice dd[6];
    dd[0] = dic;
    dic.reversefb(),    dd[1] = dic;
    dic.goleft(),       dd[2] = dic;
    dic.reversefb(),    dd[3] = dic;
    dic.goup(),         dd[4] = dic;
    dic.reversefb(),    dd[5] = dic;


    ll N;
    cin>>N;
    rep(i,N){
        cin >> u >> b;
        rep(j,6){
            if (dd[j].u != u) continue;

            rep(k,4){
                if(dd[j].b==b){
                    cout << dd[j].r << endl;
                }
                dd[j].rotateleft();
            }
        }
    }
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int MAXN = 100005;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

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

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

int n, dp[MAXN];
int son[MAXN], cnt;

struct Edge {
	int v, nxt;
}e[MAXN];
int first[MAXN], eCnt;

inline void AddEdge(int u, int v) {
	e[++eCnt].v = v;
	e[eCnt].nxt = first[u];
	first[u] = eCnt;
}

void DFS(int u) {
	for (int i=first[u];i;i=e[i].nxt) {
		DFS(e[i].v);
	}
	cnt = 0;
	for (int i=first[u];i;i=e[i].nxt) {
		son[++cnt] = dp[e[i].v];
	}
	sort(son+1, son+cnt+1);
	for (int i=1;i<=cnt;++i) {
		cmax(dp[u], son[i] + cnt-i+1);
	}
}

void init() {
	read(n);
	for (int i=2,fa;i<=n;++i) {
		read(fa);
		AddEdge(fa, i);
	}
}

void solve() {
	DFS(1);
	printf("%d\n", dp[1]);
}

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


Measured memory_bytes: 4992
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#define INF (int)1e9
#define N 55
using namespace std;
int a[N], n, cnt;

int main() {
    int mx = -INF, mn = INF, ln, lx;
    scanf("%d", &n);
    for(int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        if(a[i] > mx) {
            mx = a[i];
            lx = i;
        }
        if(a[i] < mn) {
            mn = a[i];
            ln = i;
        }
    }
    if(mx == mn) printf("0\n");
    else if(mn >= 0) {
        printf("%d\n", n-1);
        for(int i = 1; i < n; i++)
            printf("%d %d\n", i, i+1);
    }else if(mn < 0){
        if(mx <= 0) {
            printf("%d\n", n-1);
            for(int i = n; i > 1; i --) 
                printf("%d %d\n", i, i-1);
        }else {
            if(-mn > mx) {
                printf("%d\n", 2*n-1);
                for(int i = 1; i <= n; i++) 
                    printf("%d %d\n", ln, i);
                for(int i = n; i > 1; i --) 
                    printf("%d %d\n", i, i-1);
            }else {
                printf("%d\n", 2*n-1);
                for(int i = 1; i <= n; i++) 
                    printf("%d %d\n", lx, i);
                for(int i = 1; i < n; i++)
                    printf("%d %d\n", i, i+1);
            }
        }
    }    

    return 0;
}

Measured memory_bytes: 128
# https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d
n,s = [input() for i in range(2)]
c = 0
for i in range(1000):
    v = str(i).zfill(3)
    p1 = s.find(v[0])
    if p1 >= 0:
        p2 = s.find(v[1], p1 + 1)
        if p2 >= 0:
            if s.find(v[2], p2 + 1) >= 0:
                c += 1
print(c)


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

using ll=long long; 

void solve(){
	int n;
	string s;
	cin>>n>>s;
	for(int i=0; i<s.size(); i++){
		int c=int(s[i]);
		c-=int('A');
		c+=n;
		c%=26;
		s[i]=char('A'+c);
	}
	cout<<s<<endl;
}

signed main(){
	//while(1)
	solve();
}

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

using namespace std;

int
main(void){
	int n; cin >> n;
	vector<int> vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i];
	map<int, int> mp1;
	for(int i = 0; i < n; i++) mp1[vec[i]]++;
	int ans = 0;
	for(map<int, int> :: iterator It = mp1.begin(); It != mp1.end(); It++){
		if(It->second % 2 != 0) ans++;
	}
	cout << ans;
}

Measured memory_bytes: 5376
S=str(input())
T=str(input())
min_count=len(T)
for i in range((len(S)-len(T))+1):
    count=0
    for j in range(len(T)):
        if S[i+j]!=T[j]:
            count+=1
    min_count=min(count,min_count)
print(min_count)

        

Measured memory_bytes: 9040
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int r, D;
    vector<int> x(11,0);

    cin >> r >> D >> x.at(0);

    for(int i=1;i<=10;i++){
        x.at(i) = r * x.at(i-1) - D;
        cout << x.at(i) << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n;
    cin >> n;

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

    int f = 0, r = 0;
    for (int i = 0; i < n; i++) {
        if (f) r += t[i];
        if (s[i] == x) {
            f = 1;
        }
    }

    cout << r << endl;

    return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
using ull = unsigned long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v){
    is >> e;
    e--;
  }
  return is;
}

int main(){
  ll k,a,b; cin >> k >> a >> b;
  ll ans = 0;
  ChangeMax(ans,1+k);
  k -= a - 1;
  if(k>0)ChangeMax(ans,a+(k/2)*(b-a)+k%2);
  cout << ans << endl;
}



Measured memory_bytes: 3624
#include<iostream>

int main(){
	int n, m, mass[1001], action[1001];
	while(std::cin >> n >> m, n){
		for(int i=1;i<=n;i++){
			std::cin >> mass[i];
		}
		for(int i=1;i<=m;i++){
			std::cin >> action[i];
		}
	
		int pos = 1, result = -1;
		for(int i=1;i<=m;i++){//action
			pos += action[i];
			if(pos >= n){
				result = i;
				break;
			}
			pos += mass[pos];
			if(pos >= n){
				result = i;
				break;
			}		
		}

		std::cout << result << std::endl;
	}
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;
typedef vector<int> vi;
using Graph = vector<vector<int>>;

int main() {
  int N;
  cin >> N;
  int d[N];
  int sum = 0;

  rep (i, N) cin >> d[i];

  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (i == j) continue;
      sum += d[i] * d[j];
    }
  }

  int ans = sum / 2;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

struct edge{int to; ll cost;};

const int MAX_V = 4e5;
vector<edge> es[MAX_V];
vector<int> col(MAX_V, -1);
vector<ll> d(MAX_V, INF);

void add_edge(int from, int to, ll cost){
    es[from].eb((edge){to, cost});
    es[to].eb((edge){from, cost});
}

void dijkstra(int n){
    priority_queue<pli, vector<pli>, greater<pli> > que;
    rep(i, n){
        d[i] = 0, col[i] = i;
        que.push(pli(d[i], i));
    }
    while(!que.empty()){
        pli p = que.top();
        que.pop();
        int v = p.second;
        if(p.first > d[v]) continue;
        for(auto &e: es[v]){
            if(chmin(d[e.to], d[v]+e.cost)){
                col[e.to] = col[v];
                que.push(pli(d[e.to], e.to));
            }
        }
    }
}

int main(){
    int N; ll D;
    cin >> N >> D;
    ll A[N];
    rep(i, N){
        cin >> A[i];
        add_edge(i, N+i, A[i]);
    }
    rep(i, N-1) add_edge(N+i, N+i+1, D);
    dijkstra(N);
    ll ans = 0;
    rep(i, 2*N){
        for(auto &e: es[i]){
            int u = col[i], v = col[e.to];
            if(u < v){
                ans += A[u]+A[v]+D*abs(u-v);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 51184
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
int mod = 998244353;
// int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    cin >> a;
    sort(all(a));
    int ans = 0;
    rep(i, k) ans += a[i];
    cout << ans << endl;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>

using namespace std;

int main() {
    int a;
    cin >> a;
    int b = a % 10;
    if (b == 9) {
        cout << "Yes" << endl;
        return 0;
    }
    a -= b;
    if (a == 90) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
//increase stack size
#pragma comment(linker, "/STACK:16777216")

ll mxm() {return LLONG_MIN;}
template<typename... Args>
ll mxm(ll a, Args... args) { return max(a,mxm(args...)); }

ll mnm() {return LLONG_MAX;}
template<typename... Args>
ll mnm(ll a, Args... args) { return min(a,mnm(args...)); }

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

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__,__VA_ARGS__)
template<typename Arg1>
void __f(const char* name,Arg1&& arg1){
	cout<<name<<" : "<<arg1<<endl;
}
template <typename Arg1,typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
	const char* comma=strchr(names+1,',');cout.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...) 1
#endif

#define ld long double
#define pll pair<ll,ll>
#define ii pair<int,int>
#define vll vector<ll>
#define vii vector<ii>
#define vi vector<int>
#define vpll vector<pll>
#define vld vector<ld>
#define vvld vector<vld>
#define vvi vector<vi>
#define vvll vector<vll>
#define vvpll vector<vpll>
#define vvii vector<vii>
#define I insert
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x)	x.begin(),x.end()

const int mod=1e9+7;
// 128 bit: __int128
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int sub(int a,int b){a-=b;if(a<0)a+=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline int inv(int a){return power(a,mod-2);}

struct compare{
	bool operator() (const int &a,const int &b) const{
		return a>b;
	}
};

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int n, m;
	cin >> n >> m;
	if(n % 2 == 0){
		// int c = n / 2;
		// if(c & 1){
		vii segs;
		for(int i = 1; i <= n / 4; i++){
			if(n / 2 - i > i)
				segs.pb({i, n / 2 - i});
		}
		for(int i = n / 2 + 1; i < n; i++){
			if(n - i + n / 2 + 1 > i)
				segs.pb({i, n - i + n / 2 + 1});
		}
		for(int i = 1; i <= m; i++)
			cout << segs[i - 1].F << ' ' << segs[i - 1].S << endl;
		// }
		// else
		// 	for(int i = 1; i <= m; i++)
		// 		cout << i << ' ' << n - i + 1 << endl;
		return 0;
	}
	for(int i = 1; i <= m; i++){
		cout << i << ' ' << n - i + 1 << endl;
	}
}

Measured memory_bytes: 4240
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e9 + 7;

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

  ll n;
  cin >> n;
  double x[n];
  string u[n];
  REP(i, n) cin >> x[i] >> u[i];

  double r = 380000, s = 0;

  REP(i, n){
    if(u[i] == "JPY"){
      s += x[i];
    }
    else{
      s += x[i] * r;
    }
  }
  printf("%lf\n", s);
  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	a := readint()
	b := readint()
	if a < b {
		fmt.Println(strings.Repeat(strconv.Itoa(a), b))
	} else {
		fmt.Println(strings.Repeat(strconv.Itoa(b), a))
	}
}

const (
	iobufsize = 1 * 1024 * 1024 // 1 MB
)

var stdinsc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, iobufsize), iobufsize)
	sc.Split(bufio.ScanWords)
	return sc
}()

func readint() int {
	stdinsc.Scan()
	v, err := strconv.Atoi(stdinsc.Text())
	if err != nil {
		panic(err)
	}
	return v
}

func readstr() string {
	stdinsc.Scan()
	return stdinsc.Text()
}

func pow(x, y int) int {
	if y < 1 {
		return 1
	}
	return x * pow(x, y-1)
}

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func max(x, y int) int {
	if x > y {
		return x
	}
	return y
}


Measured memory_bytes: 640
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]
r=any([r[j:j+m] for r in a[i:i+m]]==b for i in range(n-m+1) for j in range(n-m+1))
print('Yes' if r else 'No')

Measured memory_bytes: 3060
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
int main(){
    int n;cin >> n;
    string s;cin >> s;
    ll count[26];
    for(int i=0;i<26;i++){
        count[i] = 0;
    }
    for(int i=0;i<n;i++){
        count[s[i]-'a'] ++;
    }
    ll ans = 1;
    for(int i=0;i<26;i++){
        ans = (ans*(count[i]+1))%(1000000007);
    }
    if(ans == 0){
        ans = 1000000006;
    }
    else{
        ans -=1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
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 T = sc.nextInt();
		sc.close();

		int cnt = (int) ((T + 0.5) / A);
		System.out.println(B * cnt);
	}
}


Measured memory_bytes: 35820
#include<bits/stdc++.h>
using namespace std;
int c[501];
int s[501];
int f[501];
int t[501];
int main()
{
	int n,i,j,tmp;
	scanf("%d",&n);
	for(i=1;i<n;i++)
	{
		scanf("%d %d %d",&c[i],&s[i],&f[i]);
	}
	if(n==1)
	{
		printf("0");
		return 0;
	}
	for(i=1;i<=n-1;i++)
	{
		tmp=s[i]+c[i];
		for(j=i+1;j<=n-1;j++)
		{
			if(tmp<=s[j])
				tmp=s[j]+c[j];
			else if((tmp-s[j])%f[j]==0)
				tmp+=c[j];
			else
				tmp+=f[j]-(tmp-s[j])%f[j]+c[j];
		}
		t[i]=tmp;
	}
	for(i=1;i<=n;i++)
	{
		printf("%d\n",t[i]);
	}
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define double long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vpiipi vector<piipi>
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 1000000009
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (int i = 0; i < n; i++)
#define repp(i,a,b) for(int i = a ; i<b ; i++)
#define reppr(i,a,b) for(int i = a-1 ; i>=b ; i--)
#define repr(i,n) for (int i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }

//Binomial Coefficients
    const int limbin = 500001;
    int fact[limbin], factinv[limbin] , coefficientflag = 0;
    void Util_nCr()
    {
        fact[0] = 1 , factinv[0] = 1;
        repp(i,1,limbin)
        {
            fact[i] = (fact[i-1] * i)%mod;
            factinv[i] = (factinv[i-1] * inverse(i))%mod;
        }
    }
    int nCr(int n , int r)
    {
        if(!coefficientflag) coefficientflag = 1 , Util_nCr();
        if(n<r) return 0;             
        return ((fact[n] * inverse(fact[n-r]) % mod * inverse(fact[r]))%mod) ;
    }

int hi[90][10] = {};

void solve();
signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    rep(i,90)
    {
        int sd = 0 , cn = i;
        rep(j,10)
        {
            string l = to_string(cn);
            for(auto i : l)
                sd += (i-'0');
            cn++;
            hi[i][j] = sd;
        }
    }
    // cin >> t; 
    rep(i,t)
    {
        // cout << "Case #" << i+1 << ": ";
        solve();
    }
}

int vis[10000001];

void solve() 
{   
    vi primes;
    int n , res = 0;
    cin >> n;
    cout << n*(1+n*(n+1)) << endl;
}   

Measured memory_bytes: 3780
#include <iostream>
#include <string>

using namespace std;

int main(void) {
  string s;

  int ans = 0;

  cin >> s;

  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '+') {
      ans++;
    } else {
      ans--;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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;
}

int main() {
  char b;
  cin >> b;

  char a;
  if (b == 'A') {
    a = 'T';
  }
  if (b == 'T') {
    a = 'A';
  }
  if (b == 'C') {
    a = 'G';
  }
  if (b == 'G') {
    a = 'C';
  }
  cout << a << endl;
}

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

#define FAST_IO                       \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);

using namespace std;

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

const int MOD = 1000000007;


void add_self(int& a, int b) {
	a += b;
	if (a >= MOD) {
		a -= MOD;
	}
}

void sub_self(int& a, int b) {
	a -= b;
	if (a < 0) {
		a += MOD;
	}
}

int dp[100001];

int main() {

	// fast input/output
	FAST_IO;

	int n;
	cin >> n;
	vector<int> h(n + 1);
	for (int i = 1; i <= n; ++i) {
		cin >> h[i];
	}
	dp[1] = 0;
	dp[2] = abs(h[2] - h[1]);
	
	for (int i = 3; i <= n; ++i) {
		dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]));
	}
	cout << dp[n];
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, N;
    cin >> H >> N;
    vector<int> A(N);
    rep(i, 0, N) cin >> A[i];
    int sum = 0;
    rep(i, 0, N) {
        sum += A[i];
    }
    if (sum >= H) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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

int main() {
  int h, n;
  cin >> h >> n;
  
  vector<int> A(n);
  for (int i = 0; i < n; i++){
    cin >> A.at(i);
  }
  
  bool ans = false;
  
  int sum = 0;
  for (int i = 0; i < n ; i++){
    sum += A.at(i);
    if (sum >= h){
      ans = true;
    }
  }
  
  if (ans == true){
    cout << "Yes" << endl;
  }
  
  else {
    cout << "No" << endl;
  }
  
}

Measured memory_bytes: 640
#include <iostream>
 
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000
 
int L[MAX/2+2], R[MAX/2+2];
int cnt;
 
void merge(int A[],int n,int left, int mid, int right) {
  int n1 = mid -left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i] = A[left + i];
  for(int i=0;i<n2;i++) R[i] = A[mid + i];
  L[n1] = R[n2] = SENTINEL;
  int i=0, j=0;
  for(int k=left; k<right; k++) {
    cnt++;
    if(L[i]<=R[j]) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}
 
void mergeSort(int A[],int n,int left,int right) {
  if(left+1 < right) {
    int mid = (left+right) / 2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid, right);
    merge(A,n,left,mid,right);
  }
}
 
int main(void) {
  int A[MAX], n, i;
  cnt = 0;
 
  cin >> n;
  for(i=0;i<n;i++) cin >> A[i];
 
  mergeSort(A, n, 0, n);
  for(i=0;i<n;i++) {
    if(i)cout << " ";
    cout << A[i];
  }
  cout << endl;
 
  cout << cnt << endl;
 
  return 0;
}

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

using namespace std;

int n, k;

int main() {
  scanf("%d %d", &n, &k);
  int ans = 0;
  bool ok = false;
  for (int i = 0; i < n; i++) {
    int foo; scanf("%d", &foo);
    if (foo >= k) ok = true;
    ans = __gcd(ans, foo);
  }
  if (k % ans || !ok) printf("IMPOSSIBLE\n");
  else printf("POSSIBLE\n");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[3][3];
int qwq;
int main(){
	cin>>a[0][0]>>a[0][1]>>a[1][1];
	qwq=a[1][1]*3;
	a[0][2]=qwq-a[0][1]-a[0][0];
	a[2][0]=qwq-a[0][2]-a[1][1];
	a[1][0]=qwq-a[2][0]-a[0][0];
	a[1][2]=qwq-a[1][0]-a[1][1];
	a[2][2]=qwq-a[0][2]-a[1][2];
	a[2][1]=qwq-a[2][0]-a[2][2];
	for(int i=0;i<=2;i++){
		for(int j=0;j<=2;j++)
		cout<<a[i][j]<<" ";
		cout<<"\n";
	}
		
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-9;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    for(;;){
        int h,w;cin>>w>>h;
        if(h==0&&w==0)return 0;
        vector<int> v[h*w];
        int a[2*h-1][w];
        rep(i,0,2*h-1){
            if(i%2==0)rep(j,0,w-1)cin>>a[i][j];
            else rep(j,0,w)cin>>a[i][j];
        }
        rep(i,0,2*h-1){
            if(i%2==0){
                int nh=i/2;
                rep(j,0,w-1){
                    if(a[i][j]==0){
                        v[nh*w+j].push_back(nh*w+j+1);
                        v[nh*w+j+1].push_back(nh*w+j);
                    }
                }
            }
            else{
                int nh=i/2;
                rep(j,0,w){
                    if(a[i][j]==0){
                        v[nh*w+j].push_back(nh*w+w+j);
                        v[nh*w+w+j].push_back(nh*w+j);
                    }
                }
            }
        }
        int dis[h*w];
        rep(i,0,h*w)dis[i]=1000000000;
        dis[0]=0;
        queue<int> q;
        q.push(0);
        while(q.size()>0){
            int now=q.front();
            q.pop();
            rep(i,0,v[now].size()){
                int ne=v[now][i];
                if(dis[ne]<1000000000)continue;
                dis[ne]=dis[now]+1;
                q.push(ne);
            }
        }
        if(dis[h*w-1]==1000000000)cout<<0<<endl;
        else cout<<dis[h*w-1]+1<<endl;
    }
}










Measured memory_bytes: 3188
x, y, z = input().split(" ")
a = int(x)
b = int(y)
c = int(z)
poor = False
if a == b == c:
    print('No')
else:
    if a == b:
        poor = not poor

    if a == c:
        poor = not poor

    if b == c:
        poor = not poor

    if poor:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3060
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = input()

    if n[-1] in '24579':
        print('hon')
    elif n[-1] in '0168':
        print('pon')
    else:
        print('bon')


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 65700
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,t=0;
	string s;
	cin>>n>>s;
	for(i=0;i<n;i++)
	{
		if(s[i]!=s[i+1]){
			t++;
		}
	}
	cout<<t<<endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int A,B,max;
	scanf("%d",&A);
	scanf("%d",&B);
	max=A+B;
	if(max<A-B)
	max=A-B;
	if(max<A*B)
	max=A*B;
	printf("%d\n",max);
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int Q[1010000][2], head, tail, D[810][810];
int n, m, K, sx, sy;
char p[810][810];

void Ins(int x, int y, int d) {
	if (D[x][y] <= d || p[x][y] != '.') return;
	D[x][y] = d;
	tail++;
	Q[tail][0] = x, Q[tail][1] = y; 
}

int main() {
	int i, j, x, y;
	scanf("%d%d%d", &n, &m, &K);
	for (i = 1; i <= n; i++) {
		scanf("%s", p[i] + 1);
		for (j = 1; j <= m; j++) {
			if (p[i][j] == 'S') sx = i, sy = j, p[i][j] = '.';
			D[i][j] = 1e9;
		}
	}
	Ins(sx, sy, 0);
	while (head < tail) {
		head++;
		x = Q[head][0], y = Q[head][1];
		Ins(x + 1, y, D[x][y] + 1);
		Ins(x, y + 1, D[x][y] + 1);
		Ins(x - 1, y, D[x][y] + 1);
		Ins(x, y - 1, D[x][y] + 1);
	}
	int res = 1e9;
	for (i = 1; i <= n; i++) {
		for (j = 1; j <= m; j++) {
			if (D[i][j] <= K) {
				res = min(res, 1 + (min(min(i - 1, n - i), min(j - 1, m - j)) + K - 1) / K);
			}
		}
	}
	printf("%d\n", res);
	return 0;
}

Measured memory_bytes: 8320
#include <stdio.h>
#include <iostream>
#include <vector>
#include <assert.h>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <memory.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
using namespace std;
typedef long long ll;
int main()
{
	string s;
	cin >> s;
	int w;
	cin >> w;
	string r = "";
	for (int i = 0; i < s.size(); i += w)
		r += s[i];
	cout << r << endl;
	return 0;
}

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

using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()
#define int long long
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
#define mod 1000000007
#define INF 10e10
template <typename T>

void print(T x)
{
	std::cout << x << " ";
}

template <typename T>

void println(T x)
{
	std::cout << x << "\n";
}

signed main(void) {
	double n, x;
	int t;
	cin >> n >> x>>t;
	int ans = ceil(n / x);
	print(ans*t);
}


Measured memory_bytes: 3836
import sys
from collections import deque
from collections import defaultdict
import math
input = sys.stdin.readline
sys.setrecursionlimit(20000000)
h,w = map(int,input().split())
s = []
for i in range(h):
        a = [i for i in input().rstrip()]
        s.append(a)
ans = [[1]*w for i in range(h)]
res = 0
for i in range(h):
        res = 0
        for j in range(w):
                if s[i][j] == "." and 0<j and s[i][j-1] == ".":
                        res = res +1
                if s[i][j] == ".":
                        ans[i][j] += res
                else:
                        res = 0

res = 0
for i in range(h):
        res = 0
        for j in range(w-1,-1,-1):
                if s[i][j] == "." and w-1>j and s[i][j+1] == ".":
                        res = res +1
                if s[i][j] == ".":
                        ans[i][j] += res
                else:
                        res = 0
res = 0
for i in range(w):
        res = 0
        for j in range(h-1,-1,-1):
                if s[j][i] == "." and h-1>j and s[j+1][i] == ".":
                        res = res+1
                if s[j][i] == ".":
                        ans[j][i] += res
                else:
                        res = 0
res = 0
for i in range(w):
        res = 0
        for j in range(h):
                if s[j][i] == "." and 0<j and s[j-1][i] == ".":
                        res = res +1
                if s[j][i] == ".":
                        ans[j][i] += res           
                else:
                        res = 0  
ans2 = 0
for i in range(h):
        for j in range(w):
                ans2 = max(ans2,ans[i][j])
print(ans2)

Measured memory_bytes: 217096
#pragma region
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
#pragma endregion

void solve() {
  int n, r;
  cin >> n >> r;
  if (n >= 10) {
    cout << r << endl;
  } else {
    cout << r + 100 * (10 - n) << endl;
  }
}


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

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

    vector<int> a(n);
    rep(i,n) cin >> a[i];

    map<int,int> mp1,mp2;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0) mp1[a[i]]++;
        else mp2[a[i]]++;
    }

    vector<pair<int,int>> vec1,vec2;
    vec1.emplace_back(0,-1);
    vec2.emplace_back(0,-1);
    for(auto i : mp1){
        vec1.emplace_back(i.second,i.first);
    }
    for(auto i : mp2){
        vec2.emplace_back(i.second,i.first);
    }

    sort(vec1.begin(),vec1.end());
    sort(vec2.begin(),vec2.end());
    reverse(vec1.begin(),vec1.end());
    reverse(vec2.begin(),vec2.end());

    int ans = 0;
    if(vec1[0].second == vec2[0].second){
        int res1 = (n / 2) - vec1[0].first + (n / 2) - vec2[1].first;
        int res2 = (n / 2) - vec1[1].first + (n / 2) - vec2[0].first;
        ans = min(res1,res2);
    } else {
        ans = (n / 2) - vec1[0].first + (n / 2) - vec2[0].first;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9592
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        
        for(int i = 1; i <= 50000; i++){
            int a = (int) (i * 1.08);
            if(a == n){
                System.out.println(i);
                return;
            }
        }
        System.out.println(":(");
    }
}

Measured memory_bytes: 21588