akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

// Begin {{{
using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, s, n) for (i64 i = (s); i <= (n); ++i)
#define VAR(Type, ...) Type __VA_ARGS__; IN(__VA_ARGS__)

#ifdef DEBUG
#define dump(...) dump_(#__VA_ARGS__, __VA_ARGS__);
#else
#define dump(...)
#endif

using i64 = int_fast64_t;
using pii = pair<i64, i64>;

template <class A, class B>
inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }

template <class A, class B>
inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

// IN
void IN() {}
template <class Head, class... Tail>
void IN(Head&& head, Tail&&... tail) {
  cin >> head;
  IN(forward<Tail>(tail)...);
}

// OUTS
void OUTS() {}
template <class Head, class... Tail>
void OUTS(Head&& head, Tail&&... tail) {
  cout << head << " \n"[sizeof...(tail)==0];
  OUTS(forward<Tail>(tail)...);
}

template <class T>
void OUTS(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e==&vec.back()]; }

template <class T>
void OUTS(vector<vector<T>> &df) { for (auto &vec : df) OUTS(vec); }

// OUTL
void OUTL() {}
template <class Head, class... Tail>
void OUTL(Head&& head, Tail&&... tail) {
  cout << head << "\n";
  OUTL(forward<Tail>(tail)...);
}

template <class T>
void OUTL(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

// OUTN
void OUTN() {}
template <class Head, class... Tail>
void OUTN(Head&& head, Tail&&... tail) {
  cout << head;
  OUTN(forward<Tail>(tail)...);
}

template <class T>
void OUTN(vector<T> &vec) { for (auto &e : vec) cout << e; }

// DEGUG
template <class T>
void dump_(const char *s, T&& x) {
  clog << '{';
  while(*s != '\0') clog << *(s++);
  clog << ": " << x << '}' << "\n";
}

template <class Head, class... Tail>
void dump_(const char *s, Head&& head, Tail&&... tail) {
  clog << '{';
  while(*s != ',') clog << *(s++);
  clog << ": " << head << "}, ";
  for (++s; !isgraph(*s); ++s);
  dump_(s, forward<Tail>(tail)...);
}
// }}} End

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

  VAR(int, N, i);
  OUTL(N - i + 1);

  return 0;
}


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

constexpr int MaxN = 200000;
constexpr int64_t mod = 1000000007;

int main()
{
	int64_t N, K;

	cin >> N >> K;

	auto l = [&](int64_t k) {
		int64_t a = k * N;
		int64_t b = k * (k - 1);
		return a - b + 1;
	};

	int64_t sum = 0;
	for (int64_t i = K; i <= N + 1; ++i)
	{
		sum = (sum + l(i)) % mod;
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), L = sc.nextInt();
		String[] array = new String[N];
		String buff="";
		for(int i=0;i<N;i++) {
			array[i] = sc.next();
		}
		Arrays.sort(array);
		for(int i=0;i<N;i++) {
			buff+=array[i];
		}

		System.out.println(buff);//Yes or YES注意

	}
	public static int sample(int n) {
		return n;
	}

}


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

int x(int a) {
	if (a == 0) return 1;
	else return x(a - 1)*100;
}

int main() {
	int n, m, t;
	cin >> n >> m;

	if (m == 100) {
		if (n == 0) t = 101;
		else if (n == 1) t = 10100;
		else t = 1010000;
		cout << t << endl;
	}
	else {
		cout << x(n) * m << endl;
	}
	//cin >> n;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 998244353
using namespace std;
#define MAX 500000
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(ll n, ll k) {
    if(n < k)
        return 0;
    if(n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll modpow(ll a, ll n, ll mod = MOD) {
    ll res = 1;
    while(n > 0) {
        if(n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
int main() {
    ll n, m, k;
    cin >> n >> m >> k;
    ll ans = 0;
    COMinit();
    for(int i = 0; i <= k; i++) {
        ll tmp = COM(n - 1, i);
        tmp = (tmp * m) % MOD;
        tmp = (tmp * modpow(m - 1, n - i - 1)) % MOD;
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 15392
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main(){
	let a: u32 = read();
    let b: u32 = read();
    let ans = if(a * b) % 2 == 0 {"Even"} else {"Odd"};
    println!("{}", ans);
    }

Measured memory_bytes: 4352
h,w,k = map(int,input().split())
board = [list(input())for _ in range(h)]
ans = 0

for paint_h in range(2**h):#全行の塗り潰し方を数値に当てはめ
    for paint_w in range(2**w):#全列の塗り潰し方を数値に当てはめ
        cnt = 0
        for i in range(h):
            for j in range(w):
                if (paint_h >> i) & 1 == 0 and (paint_w >> j) & 1 == 0:
#各行のi番目のビットと各列のj番目のビットが共に0であればそのマスは塗られていない
                    if board[i][j]=='#':#塗られていなくてマスが黒ならば
                        cnt+=1
        if cnt==k:#各塗りかたに対して個数を確認するためにこのインデントになる
            ans+=1
print(ans)

Measured memory_bytes: 9100
#pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);
constexpr double EPS = 1e-10;

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

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

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

    cout << t + s << endl;

    return 0;
}

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

using ll = long long;
#define repi(n) for (int i = 0; i < (n); i++)
#define repj(n) for (int j = 0; j < (n); j++)
#define repk(n) for (int k = 0; k < (n); k++)
#define rep(i, n) for (int i = 0; (i) < (n); i++)
#define repr(i, a, b) for (auto i = (a); i < (b); i++)
#define repv(itr) for (auto&& v : (itr))
#define updatemax(t, v) (t = max((t), (v)))
#define updatemin(t, v) (t = min((t), (v)))
const int dx[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const int dy[] = {0, -1, 1, 0, -1, 1, -1, 1};
template <typename T>
T minptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i < *re) re = i;
  }
  return re;
}
template <typename T>
T maxptr(T begin, T end) {
  T re = begin;
  for (T i = begin + 1; i != end; i++) {
    if (*i > *re) re = i;
  }
  return re;
}
int __vmax(int x) {
  return INT_MAX;
}
double __vmax(double x) {
  return 1e+300;
}
ll __vmax(ll x) {
  return LLONG_MAX;
}
int __vmin(int x) {
  return INT_MIN;
}
double __vmin(double x) {
  return -1e+300;
}
ll __vmin(ll x) {
  return LLONG_MIN;
}
template <typename T>
vector<T> lis(T begin, T end, bool allowequal = false, bool lds = false) {
  using V = typename iterator_traits<T>::value_type;
  int n = end - begin;
  vector<V> a(n, lds ? __vmin(*begin) : __vmax(*begin));
  vector<int> id(n);
  if (lds && allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (lower_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (lds) {
    for (int i = 0; i < n; i++) {
      id[i] = n - 1 -
              (upper_bound(a.rbegin(), a.rend(), begin[i]) - 1 - a.rbegin());
      a[id[i]] = begin[i];
    }
  } else if (allowequal) {
    for (int i = 0; i < n; i++) {
      id[i] = upper_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  } else {
    for (int i = 0; i < n; i++) {
      id[i] = lower_bound(a.begin(), a.end(), begin[i]) - a.begin();
      a[id[i]] = begin[i];
    }
  }
  int m = *maxptr(id.begin(), id.end());
  vector<T> re(m + 1);
  for (int i = n - 1; i >= 0; i--) {
    if (id[i] == m) re[m--] = begin + i;
  }
  return re;
}
template <typename T>
class segtree {
 private:
  int n;
  vector<T> data, lazy;

 public:
  segtree(int n_) {
    n = pow(2, ceil(log2(n_)));
    data.resize(n);
    lazy.resize(n);
    auto __x = data[0];
    repi(n) {
      data[i] = __vmin(__x);
      lazy[i] = 0;
    }
  }
};

int main() {
  int n, p[10];
  cin >> n;
  repi(n) cin >> p[i];
  sort(p, p + n, greater<int>());
  int re = 0;
  repi(n) re += i ? p[i] : p[i] / 2;
  cout << re << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
using static CS_Contest.Utils;

namespace CS_Contest {
	using Li = List<int>;
	using LLi = List<List<int>>;
    class Program {
        static void Main(string[] args) {
			new Calc().Solve();
			return;
        }

		private class Calc {
			public void Solve() {
				var HW = ReadInt(' ');
				var N = ReadInt();
				var a = ReadInt(' ');
				Li cols = new Li();
				foreach (var item in a.Select((v,i)=>new { V = v, I = i+1 })) {
					cols.AddRange(Enumerable.Repeat(item.I, item.V));
				}
				LLi box = new LLi();
				int idx = 0;
				REP(HW[0], x => {
					box.Add(new Li());
					REP(HW[1], k => {
						box[x].Add(0);
					});
				});
				REP(HW[0], x => {
					if (x % 2 == 0) {
						REP(HW[1], k => {
							box[x][k] = cols[idx];
							idx++;
						});
					}
					else {
						RREP(HW[1], k => {
							box[x][k] = cols[idx];
							idx++;
						});
					}
				});
				string s = "";
				REP(HW[0], x => {
					s += string.Join(" ", box[x]);
					s += "\n";
				});
				s.WL();
				return;
			}
		}
    }

	
	
    public static class Utils {
        public static void WL(this object obj) => WriteLine(obj);
        public static void WL(this string obj) => WriteLine(obj);
        public static void WL<T>(this IEnumerable<T> list) => list.ToList().ForEach(x => x.WL());
		public static int ReadInt() => int.Parse(ReadLine());
		public static List<int> ReadInt(char s) => ReadLine().Split(s).Select(int.Parse).ToList();
		public static long ReadLong() => long.Parse(ReadLine());
		public static List<long> ReadLong(char s) => ReadLine().Split(s).Select(long.Parse).ToList();
		public static void REP(int n,Action<int> act) {
			for (int i = 0; i < n; i++) {
				act(i);
			}
		}
		public static void RREP(int n,Action<int> act) {
			for (int i = n-1; i >=0; i--) {
				act(i);
			}
		}
		public static void Yes() => "Yes".WL();
		public static void No() => "No".WL();
    }
}


Measured memory_bytes: 23136
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

  vector<P> l,r;
  rep(ni,n){
    string s;
    cin >> s;
    int h = 0, b = 0;
    rep(i,s.size()){
      if(s[i]=='(') ++h; else --h;
      b = min(b,h);
    }
    if(h>=0) l.emplace_back(b,h); 
    else r.emplace_back(b-h,-h);
  }
  sort(l.rbegin(),l.rend());
  sort(r.rbegin(),r.rend());

  int ls = [&]{
    int t = 0;
    rep(i,l.size()){
      if(t+l[i].first<0) return -1;
      t += l[i].second;
    }
    return t;
  }();
  int rs = [&]{
    int t = 0;
    rep(i,r.size()){
      if(t+r[i].first<0) return -1;
      t += r[i].second;
    }
    return t;
  }();
  if(ls>=0&&rs>=0&&ls==rs){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 11224
#include<cstdio>
#include<cstring>
using namespace std;
int nxt[200010],dp[200010],ans[200010],to[200010];
char ch[200010];
int main() {
    scanf("%s",ch+1);
    int len=strlen(ch+1);
    for (int i=1; i<=26; i++) nxt[i]=len+1;
    for (int i=1,ii=len+1; i<=ii; i++) dp[i]=2019201920/2;
    dp[len+2]=0;
    for (int i=len; i>=1; i--) {
        nxt[ch[i]-'a'+1]=i;
        for (int j=1; j<=26; j++)
            if (dp[nxt[j]+1]+1<dp[i]) {
                dp[i]=dp[nxt[j]+1]+1;
                ans[i]=j;
                to[i]=nxt[j]+1;
            }
    }
    int num=1;
    while (num<=len) {
        printf("%c",ans[num]+'a'-1);
        num=to[num];
    }
    return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
string s;
bool flag=true;
int main(){
    cin>>s;
    for(int i=0;i<int(s.size());i++){
        if((i+1)%2==0&&s[i]=='R'){flag=false;break;}
        if((i+1)%2==1&&s[i]=='L'){flag=false;break;}
    }
    cout<<(flag?"Yes":"No")<<endl;
}


Measured memory_bytes: 256
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main implements Runnable {

	class Edge {
		int src, dst;
		long cost;

		public Edge(int src_, int dst_, long cost_) {
			src = src_;
			dst = dst_;
			cost = cost_;
		}
	}

	long[] min = { Long.MAX_VALUE, Long.MAX_VALUE };

	boolean dfs(int cur, long[] num, ArrayList<Edge>[] g, int c) {
		boolean ret = true;
		for (Edge e : g[cur]) {
			if (num[e.dst] != -1) {
				ret &= (num[e.dst] + num[cur] == e.cost);
				continue;
			}
			num[e.dst] = e.cost - num[cur];
			min[c ^ 1] = Math.min(min[c ^ 1], num[e.dst]);
			ret &= dfs(e.dst, num, g, c ^ 1);
		}
		return ret;
	}

	void solver(int R, int C, int N, int[] r, int[] c, int[] a) {
		ArrayList<Edge>[] g = new ArrayList[R + C];
		for (int i = 0; i < g.length; ++i) {
			g[i] = new ArrayList<>();
		}
		for (int i = 0; i < N; ++i) {
			g[r[i]].add(new Edge(r[i], c[i] + R, a[i]));
			g[c[i] + R].add(new Edge(c[i] + R, r[i], a[i]));
		}
		long[] num = new long[R + C];
		Arrays.fill(num, -1);
		for (int i = 0; i < num.length; ++i) {
			if (num[i] != -1)
				continue;
			num[i] = 0;
			min[0] = 0;
			min[1] = Long.MAX_VALUE;
			if (!dfs(i, num, g, 0) || (min[0] + min[1] < 0)) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}

	void input() {
		Scanner sc = new Scanner(System.in);
		int R = sc.nextInt();
		int C = sc.nextInt();
		int N = sc.nextInt();
		int[] r = new int[N];
		int[] c = new int[N];
		int[] a = new int[N];
		for (int i = 0; i < N; ++i) {
			r[i] = sc.nextInt();
			c[i] = sc.nextInt();
			a[i] = sc.nextInt();
			--r[i];
			--c[i];
		}
		solver(R, C, N, r, c, a);
	}

	public void run() {
		input();
	}

	public static void main(String[] args) throws FileNotFoundException {
		new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start();
		;
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 116280
#include<bits/stdc++.h>
#define pb push_back
#define pf push_front
#define re(i , n) for(Long i = 0; i < (Long)n ; i++)
#define rer(i, a, b) for (Long i = a, to = b; i < to; i++)
 
using namespace std;
typedef long long Long;
const Long MX=2e5 + 1;
const Long MOD=1000000007;
const Long MX2=9223372036854775806;


int main(){
	ios::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	Long n,m;cin>>n>>m;
	vector<pair <Long,Long > > v(n,pair<Long,Long> (0,true));
	re(i,n){
		cin>>v[i].first;
	}
	re(i,m){
		Long a,b;cin>>a>>b;
		a--;b--;
		if(v[a].first<v[b].first){
			v[a].second=false;
		}else{
			if(v[b].first<v[a].first){
				v[b].second=false;
			}else{
				v[a].second=false;v[b].second=false;
			}	
		}
	}	
	Long conta=0;
	re(i,n){
		if(v[i].second==true){
			conta++;
		}
	}
	cout<<conta;
}

Measured memory_bytes: 4748
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

int A[100];

int main()
{
  int N;
  int ans = 0;
  cin >>N;
  for(int i = 0;i < N;i++){
    cin >>A[i];
  }
  for(int i = 0;i < N;i++){
    for(int j = N-1;j >i;j--){
      if(A[j] <A[j-1]){
	swap(A[j],A[j-1]);
	ans++;
      }
    }
  }
  for(int i = 0;i < N;i++){
    cout <<A[i];
    if(i !=N-1)
      cout <<" ";
  }
  cout <<endl;
  cout <<ans<<endl;
  return 0;
}

Measured memory_bytes: 1160
//  Copyright © 2020 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
#define forn(i,a,b) for (int i = a; i <= b; i ++ )
#define mod(n,k) (((n%k)+k)%k)
using namespace std;
typedef long long ll;

int main()
{
    optimiza_io
    int S, W;
    cin >> S >> W;
    cout << ( W >= S ? "unsafe\n" : "safe\n" );
    return 0;
}

// CHECAR LIMITES 

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#define ll long long
#define pb push_back

int main(){

	int N;
	double sum = 0;
	vector<double> A;
	cin >> N;
	for(int i = 0; i < N; i ++){
		double a;
		cin >> a;
		A.pb(a);
		sum += a;
	}
	double ave = sum / (double) N;
	for(int i = 0; i < N; i ++){
		A[i] = abs(A[i] - ave);
	}
	double min = A[0], pos = 0;
	for(int i = 0; i < N; i ++){
		if(A[i] < min){
			min = A[i];
			pos = i;
		}
	}
	cout << pos << endl;

	return 0;
}

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

ll x[100002], y[100002];

int main(){
	int n, m, a, b;
	scanf("%d%d%d", &n, &m, &a);
	f(i, 1, n){
		b = a;
		scanf("%d", &a);
		int z = a - b;
		if (z < 0)z += m;
		y[1] += z;
		if (z == 1)continue;
		b += 2;
		if (b > m)b -= m;
		if (b <= a){
			int d = a - b + 1;
			--x[b];
			++x[a + 1];
			y[a + 1] += d;
		}else {
			--x[1];
			++x[a + 1];
			y[1] -= m - b + 1;
			y[a + 1] += a - b + m + 1;
			--x[b];
		}
	}
	f(i, 2, m + 1)x[i] += x[i - 1];
	f(i, 1, m + 1)x[i] += x[i - 1] + y[i];
	ll an = 1e18;
	f(i, 1, m + 1)an = min(an, x[i]);
	printf("%lld\n", an);
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000ll
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
string s[13],t[13];
int H,W;
int used[13];
vector<int> p;
bool ans = false;
int b;
bool check(){
	vector<string> vec;
	for(int i=0;i<H;i++){
		string rt = t[i];
		reverse(all(rt));
		bool found = false;
		for(int j=0;j<vec.size();j++){
			if(vec[j]==rt){
				vec.erase(vec.begin()+j);
				found = true;
				break;
			}
		}
		if(!found)vec.pb(t[i]);
	}
	if(vec.size()==0)return true;
	else if(vec.size()==1){
		string u = vec[0];
		reverse(all(u));
		if(vec[0]==u)return true;
		else return false;
	}
	return false;
}
void dfs(int n){
	if(n==W){
		for(int i=0;i<H;i++){
			for(int j=0;j<W/2;j++){
				t[i][j]=s[i][p[j*2]];
				t[i][W-1-j]=s[i][p[j*2+1]];
			}
		}
		ans |= check();
		return;
	}
	if(n+1==W){
		/*for(int i=0;i<p.size();i++)cout << p[i] << ' ';
		cout << endl;*/
		for(int i=0;i<H;i++){
			for(int j=0;j<W/2;j++){
				t[i][j]=s[i][p[j*2]];
				t[i][W-1-j]=s[i][p[j*2+1]];
			}
		}
		for(int i=0;i<H;i++)t[i][W/2]=s[i][b];
		ans |= check();
		return;
	}
	int f = -1;
	for(int i=0;i<W;i++){
		if(!used[i]){
			f=i;
			break;
		}
	}
	p.pb(f);
	used[f]=true;
	for(int i=f+1;i<W;i++){
		if(used[i])continue;
		p.pb(i);
		used[i]=true;
		dfs(n+2);
		p.pop_back();
		used[i]=false;
	}
	p.pop_back();
	used[f]=false;
}
int main(){
	cin >> H >> W;
	for(int i=0;i<H;i++){
		cin >> s[i];
		t[i]=s[i];
	}
	if(W%2==0)dfs(0);
	else{
		for(int i=0;i<W;i++){
			b = i;
			used[i]=true;
			dfs(0);
			used[i]=false;
		}
	}
	if(ans)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 764
using System;
using System.Collections.Generic;

namespace C {
    class Program {
        static void Main(string[] args) {
            var numList = new List<int>();
            foreach (var str in Console.ReadLine().Split(' ')) {
                numList.Add(int.Parse(str));
            }
            var numArray = numList.ToArray();
            Console.WriteLine($"{numArray[0] * numArray[1]} {numArray[0] * 2 + numArray[1] * 2}");
        }
    }
}



Measured memory_bytes: 17940
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <queue>
#include <iomanip>
#include <set>

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

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

using namespace std;
using ll = long long int;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vvll> vvvll;
const int MOD=1000000007;
//const int MOD=998244353;
const int INTMAX=1001001000;
const ll LLMAX=1010010010010010000;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N;
    cin>>N;
    
    vll d(101);
    for(int i=1;i<=N;i++){
        ll A=i;
        for(int j=2;j<=100;j++){
            if(j>A)break;
            while(A%j==0){
                d[j]++;
                A/=j;
            }
        }
    }
    
    int n75=0,n25=0,n15=0,n5=0,n3=0;
    for(int i=0;i<d.size();i++){
        //if(d[i]>0)printf("d[%d]=%d\n",i,d[i]);
        if(d[i]>=3-1) n3++;
        if(d[i]>=5-1) n5++;
        if(d[i]>=15-1) n15++;
        if(d[i]>=25-1) n25++;
        if(d[i]>=75-1) n75++;
    }
    
    //printf("%d,%d,%d,%d,%d\n",n3,n5,n15,n25,n75);
    cout<<n75+n25*max(n3-1,0)+n15*max(n5-1,0)+max(0,n5*(n5-1)/2*(n3-2))<<endl;
    
    return 0;
}


Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
# define rep(i,a,n) for (int i=a; i<=n; ++i)
# define per(i,a,n) for (int i=a; i>=n; --i)
# define bug puts("H");
# define pb push_back
# define mp make_pair
# define all(x) (x).begin(), (x).end()
# define SZ(x) (int)x.size()
# define fi first
# define se second
# define lch p<<1,l,mid
# define rch p<<1|1,mid+1,r
# define mem(a,b) memset(a,b,sizeof(a))
# define INF 1000000001
# define MOD (1ll<<32)
typedef vector<int> Vi;
typedef long long i64;
typedef pair<int, int> Pi;
mt19937 mrand(random_device{}());
int rnd(int x) {return mrand()%x;}
i64 powmod(i64 a, i64 b){i64 res=1;a%=MOD;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
i64 Inv(i64 b){return powmod(b,(i64)MOD-2);}
const int N = 300005;
const double eps = 1e-9;
const long long inf = 1e18;

int a[N];

int seg[N<<4];

void push_up(int p){seg[p]=max(seg[p<<1],seg[p<<1|1]);}

void update(int p, int l, int r, int L, int R, int val){
    if (L>r||R<l) return ;
    if (L<=l&&R>=r) seg[p]=max(seg[p], val);
    else {
        int mid=(l+r)>>1;
        update(lch,L,R,val); update(rch,L,R,val); push_up(p);
    }
}
int query(int p, int l, int r, int L, int R){
    if (L>r||R<l) return 0;
    if (L<=l&&R>=r) return seg[p];
    int mid=(l+r)>>1;
    return max(query(lch,L,R),query(rch,L,R));
}
int main()
{
    int n, k, x, nn = 600005;
    scanf("%d%d", &n, &k);
    rep(i,1,n) {
        scanf("%d", &x);
        ++x;
        int tmp = query(1,1,nn,max(1,x-k),x+k);
        update(1,1,nn,x,x,tmp+1);
    }
    printf("%d\n", seg[1]);
    return 0;
}


Measured memory_bytes: 7940
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=2e5+5;
int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,t;cin>>n>>t;
    ll a[n];for(ll i=0;i<n;i++)cin>>a[i];
    ll ans=0;
    for(ll i=1;i<n;i++)ans+=min(a[i]-a[i-1],t);
    cout<<ans+t;
}




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

public class AtCoderA
{
    static void Main()
    {
        var sc = new Scanner();

        string s = sc.Next();

        int a = s.IndexOf("A");
        int b = s.LastIndexOf("Z");

        int answer = b - a + 1;

        Console.WriteLine(answer);
    }

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            while (_index >= _line.Length)
            {
                _line = Console.ReadLine().Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            _line = Console.ReadLine().Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 14944
#include <bits/stdc++.h>
#include <string>
#include <cmath>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<ll> vll;
 
#define all(v) v.begin(),v.end()
#define test() int t;cin>>t;while(t--) 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9+7;

vpii prime_fact;
vi store;

int power(int x, int a)
{
    if(a==0)return(1);
    int z = power(x, a/2);
    z*=z;
    if(a%2)z*=x;
    return(z);
}
 
int main()
{   
    fastio
    int d, t, s;
    cin>>d>>t>>s;
    if(t*s>=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 3608
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;
	int n;
	int[] dx = {-1,-1,-1,0,1,1,1,0};
	int[] dy = {1,0,-1,-1,-1,0,1,1};
	
	void run() {
		Scanner sc = new Scanner(System.in);
		for(;;) {
			n = sc.nextInt();
			if(n == 0) break;
			
			int S = 0;
			for(int i=0;i<n;i++) {
				String str = sc.next();
				for(int j=0;j<n;j++) {
					switch (str.charAt(j)) {
					case '.': break;
					case '#': S |= 1<<(i*n+j+6); break;
					case '@': S |= j<<3; S |= i; break;
					}
				}
			}
			
			HashSet<Integer> used = new HashSet<Integer>();
			used.add(S);
			LinkedList<P> que = new LinkedList<P>(); que.add(new P(S, 0));
			boolean ok = false;
			for(;!que.isEmpty();) {
				P cur = que.remove();
				if( (cur.s >> 6) == 0 ) {
					ok = true;
					System.out.println(cur.d);
					break;
				}
				short x = (short)((cur.s>>3)&7), y = (short)(cur.s&7);
				boolean map[][] = new boolean[n][n];
				for(int i=0;i<n*n;i++) map[i/n][i%n] = ((cur.s>>(i+6))&1) == 1;
				
//				debug(x, y);
//				for(boolean[] a: map) debug(a);

				for(int i=0;i<8;i++) {
					int px = x + dx[i], py = y + dy[i];
					if(!out(px, py) && !map[py][px]){
//					debug(px, py);
						map[py][px] = true;
						int NS = (px<<3)|py;
						for(int j=0;j<n;j++) for(int k=0;k<n;k++) {
							if( px == k && py == j ) continue;
							int cnt = 0;
							for(int l=0;l<8;l++) {
								int nx = k+dx[l], ny = j+dy[l];
								if(!out(nx, ny) && map[ny][nx])cnt++;
							}
							if(map[j][k] && ( cnt == 2 || cnt == 3)) NS |= 1<<(j*n+k+6);
							else if(!map[j][k] && cnt == 3) NS |= 1<<(j*n+k+6);
						}
						
						if(!used.contains(NS)){
							used.add(NS);
							que.add(new P(NS, cur.d+1));
						}
						map[py][px] = false;
					}
				}
			}
			
			if(!ok) System.out.println(-1);
		}
	}
	
	boolean out(int x, int y) {
		return x < 0 || y < 0 || x >= n || y >= n;
	}
	
	class P {
		int s; int d;
		P(int s, int d) {
			this.s = s; this.d = d;
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 61136
a,b,c=map(int,input().split())

X=[a,b,c]
X.sort()
x=X[2]
y=X[1]
z=X[0]


sabun1=x-y
sabun2=x-z

if sabun1%2==0 and sabun2%2==0:
    res=(sabun1+sabun2)/2
elif sabun1%2==1 and sabun2%2==1:
    res=(sabun1//2+sabun2//2)+1
elif sabun1%2==0 and sabun2%2==1:
    res=(sabun1/2)+(sabun2//2)+2
else:
    res=(sabun1//2)+(sabun2/2)+2

print(int(res))

Measured memory_bytes: 3064
#include<stdio.h>

int A[1000000];
int n;

int binarySearch(int key){
  int left = 0;
  int right = n;
  int mid;
  while( left < right ){
    mid = (left + right ) /2;
    if ( key == A[mid] ) return 1;
    if ( key > A[mid] ) left = mid+1;
    else if ( key < A[mid] ) right = mid;
  }
  return 0;
}

int main(){
  int i, q, k, sum = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }

  scanf("%d", &q);
  for (i = 0; i < q; i++){
    scanf("%d", &k);
    if (binarySearch(k)) sum++;
  }
  printf("%d\n", sum);

  return 0;
}


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

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

  if (a/1000%10 == a/100%10 && a/100%10 == a/10%10) {
    cout << "Yes" << endl;
  }
  else if (a/100%10 == a/10%10 && a/10%10 == a%10) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  ll x, y;
  cin >> x >> y;
  vector<ll> a;
  a.push_back(x);
  while(a[a.size()-1]*2<=y){
    a.push_back(a[a.size()-1]*2);
  }
  cout << a.size() << endl;
  return 0;
}


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

using namespace std;

int main() {
  int H, W;
  cin >> H >> W;
  char a[100][100];

  vector<int> remI, remJ;
  for (int i = 0; i < H; i++) {
    bool flag = false;
    for (int j = 0; j < W; j++) {
      cin >> a[i][j];
      if (a[i][j] == '#')
        flag = true;
    }
    if (!flag) {
      remI.push_back(i);
    }
  }

  for (int j = 0; j < W; j++) {
    bool flag = false;
    for (int i = 0; i < H; i++) {
      if (a[i][j] == '#')
        flag = true;
    }
    if (!flag) {
      remJ.push_back(j);
    }
  }

  // output
  for (int i = 0; i < H; i++) {
    if (std::find(remI.begin(), remI.end(), i) != remI.end())
      continue;
    for (int j = 0; j < W; j++) {
     if (std::find(remJ.begin(), remJ.end(), j) != remJ.end())
       continue;
     cout << a[i][j];
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    string w;
    map<char, int> m;
    cin >> w;
    for (char c='a'; c<='z'; c++) {
        m[c] = 0;
    }
    for (char c: w) {
        m[c]++;
    }
    for (char c='a'; c<='z'; c++) {
        if ((m[c] != 0) && (m[c] % 2 != 0)) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han Elmuzaffer Daima
//Bismillahirrahmanirrahim

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

#include <bits/stdc++.h>

using namespace std;

typedef long long int lo;
typedef pair< int,int > PII;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

lo n,m,cev,b,a[li],k;
string s;
vector<lo> v;

int main(void){
	scanf("%lld %lld",&n,&k);
	printf("%lld\n",n-k+1);
	return 0;
}


Measured memory_bytes: 256
// --------------------<optimizations>--------------------
#pragma GCC optimize("O3")
//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)
#pragma GCC optimize("unroll-loops")
// -------------------</optimizations>--------------------
 
#include <bits/stdc++.h>
 
using namespace std;
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) ll(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
 
typedef long long ll;
typedef long double ld; 
typedef pair<ll,ll> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
 
const ll mod = 1e9 + 7;
const int inf = 1e9 + 5;
const int N = 1e5 + 5;

int a[4][4],b[15],c[105];

signed main(){
    fastio;
    int i,j,n;
    for(i=1;i<=3;++i){
        for(j=1;j<=3;++j){
            cin>>a[i][j];
        }
    }
    cin>>n;
    for(i=1;i<=n;++i){
        cin>>b[i];
        c[b[i]]=1;
    }
    bool ok=0;
    for(i=1;i<=3;++i){
        if(c[a[i][1]] && c[a[i][2]] && c[a[i][3]]){
            ok=1;
            break;
        }
    }
    for(i=1;i<=3;++i){
        if(c[a[1][i]] && c[a[2][i]] && c[a[3][i]]){
            ok=1;
            break;
        }
    }
    if(c[a[1][1]] && c[a[2][2]] && c[a[3][3]])
        ok=1;
    if(c[a[1][3]] && c[a[2][2]] && c[a[3][1]])
        ok=1;
    if(ok)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
N,M,C = map(int,input().split())
A_list = []
check = 0
kosuu = 0
B_list = list(map(int,input().split()))
for i in range(N):
    A_list = list(map(int,input().split()))
    check = 0
    for j in range(M):
        check += A_list[j]*B_list[j]
    if(check + C > 0):
        kosuu += 1
print(kosuu)

Measured memory_bytes: 3064
//  यस्य स्मरणमात्रेण जन्मसंसारबन्धनात् ।  विमुच्यते नमस्तस्मै विष्णवे प्रभविष्णवे ॥
 
 
 
/****
*     Author- Indrajeet Mishra
*             MNNIT Allahabad, Prayagraj
*             Chemical Engineering undergraduate
 
 
 
****/
 
#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")
 
#include <bits/stdc++.h>
#define ll long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define test(s) if (!(s)) { cout << __LINE__ << " " << #s << endl; exit(-1); }
#define debug(x) do { std::cerr << x; } while (0)
#define endl "\n"
#define pb push_back
#define pf push_front
#define vll vector<ll>
#define dll deque<ll>
#define sll set<ll, greater <ll>>
#define mll map<ll, ll>
#define vii vector<int>
#define dii deque<int>
#define sii set <int, greater <int>>
#define mii map<int, int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mod 1000000007
#define inv2 500000004
#define inv6 166666668
#define N 1000005
#define inf 200000000
#define eps 1e-10
#define PI 3.14159265359
#define all(v) (v).begin(),(v).end()
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#define gcd(a,b) __gcd(a,b)

ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 

using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n=0;cin>>n;
    ll a[n]={0},sum=0;
    rep(i,0,n){
        cin>>a[i];
    }
    rep(j,0,n-1){
        rep(k,j+1,n){
            sum+=(a[j]*a[k]);
        }
    }
    cout<<sum;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())

l = 0
r = (10**5)+1

for i in range(m):
    a,b = map(int,input().split())
    l = max(l,a)
    r = min(r,b)

ans = r-l+1
if ans>=0:
    print(ans)
else:
    print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  // ARC086C - Not so Divers
  int N, K; cin >> N >> K;
  vector<int> A(200001, 0);
  REP(i, N){
    int tmp; cin >> tmp;
    A[tmp]++;
  }
  sort(A.begin(), A.end(), greater<int>());
  int ans = 0;
  for(int i = K; i <= 200000; i++){
    ans += A[i];
  }
  cout << ans << endl;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
using namespace std;
#define N 105
int n,a[N],cnt[N];
int main(){
	scanf("%d",&n);
	rep (i,1,n) scanf("%d",&a[i]),cnt[a[i]]++;
	sort(&a[1],&a[n+1]);
	rep (i,a[1]+1,a[n]) if (cnt[i]<2) return puts("Impossible"),0;
	if ((cnt[a[1]]==2)!=(a[n]&1)) return puts("Impossible"),0;
	puts("Possible");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std; 
#define mod 1000000007
#define N 100005
#define ll long long int
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i=j; i<k; i+=step)
#define loop(i, j, k) for (int i=j; i<k; i++) 
#define rloop1(i, j, k, step) for (int i=j; i>=k; i-=step)
#define rloop(i, j, k) for(int i=j; i>=k; i--)
#define rep(i, k) for(int i = (0); i < (k); i++ )
#define rrep(i, k) for(int i = k-1; i >= 0; i-- )

#define forall(it, l) for(auto it=l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;


void solve()
{
	ll n,i,j,l,z=0,flag=0,a,b,k;
	cin>>k;
	l=100;
	loop(i,1,3800){
		l=l+(l*0.01);
		if(l>=k){
			cout<<i<<endl;
			break;
		}
	}
}
signed main() 
{
	auto start=clock();
	fast_io;
    int t=1;
    //cin>>t;
    while(t--)
    	solve();
    auto stop =clock();
    cerr<<"time taken:"<<double(stop-start)/double(CLOCKS_PER_SEC)<<" s"<<endl;
	return 0; 
}

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

int main()
{
  vector<int> a(3);
  rep(i, 3) cin >> a[i];
  sort(a.begin(),a.end());
  int s = abs(a[2]-a[0]) + abs(a[2]-a[1]);
  if (s%2 == 0) cout << s/2 << endl;
  else cout << s/2+2 << endl;

  return 0;
}


Measured memory_bytes: 256
n,m = map(int,input().split())
x = list(map(int,input().split()))
x = sorted(x)
s = [0]*m
for i in range(1,m):
    s[i] = x[i] - x[i-1]
s = sorted(s)
if n < m:
    print(sum(s[:m-n+1]))
else:
    print(0)

Measured memory_bytes: 20472
n = input()
k = int(input())


dp0 = [[0]*5 for i in range(len(n)+1)]
dp1 = [[0]*5 for i in range(len(n)+1)]

dp0[0][0] = 1


for i in range(1, len(n)+1):
    nn = int(n[i-1])
    for j in range(4):
        dp0[i][j] += dp0[i-1][j]*(nn==0)
        dp1[i][j] += dp1[i-1][j] + dp0[i-1][j]*(nn!=0)
        dp0[i][j+1] += dp0[i-1][j]*(nn!=0)
        dp1[i][j+1] += dp1[i-1][j]*9 + dp0[i-1][j]*(nn-1)*(nn!=0)

print(dp0[len(n)][k]+dp1[len(n)][k])

Measured memory_bytes: 3064
a, b = map(int, input().split())
a1 = [0 for i in range(100005)]
b1 = [0 for i in range(100005)]
x = 2
while a != 1:
    if not (a % x):
        a = a // x
        a1[x] += 1
    else:
        x += 1
x = 2
while b != 1:
    if not (b % x):
        b = b // x
        b1[x] += 1
    else:
        x += 1
lcm = 1
for i in range(100003):
    if a1[i] or b1[i]:
        lcm *= pow(i, max(a1[i], b1[i]))
print(lcm)


Measured memory_bytes: 4760
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define pb push_back
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
#define endl '\n'
#define ll long long
#define f first
#define s second
#define int long long
#define FAST cin.tie(0), cout.tie(0), ios::sync_with_stdio(0)
#define debug(x) cout << "DEBUG " << x << endl
#define debug2(x, y) cout << "DEBUG " << x << " " << y << endl
#define debug3(x, y, z) cout << "DEBUG " << x << " " << y << " " << z<< endl
#define debug4(x, y, z, o) cout << "DEBUG " << x << " " << y << " " << z<< " " << o << endl
using namespace std;
typedef pair<ll, ll> pii;
typedef vector<vector<ll>> mat;
const ll mod = 1e9+7;
const int MAXN = 1e6+5;


int32_t main() {
	ll r;
	cin >> r;
	cout << fixed << setprecision(10) << 2*3.14*r << endl;
}


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


using namespace std;


int maxN=2e5+5;
int n,k;
vector<int>a(maxN);

bool isValid(int mid){
    int kk = 0; 
    if(mid==0)
        return false;
    for(int i=0;i<n;i++){
        if(a[i]<=mid)
            continue;
        int t=a[i]/mid;
        kk += t; ////t ta cut korsi ei log ke
    }
    return (kk<=k);///kk<=k hole EI MID or largest log value possibel
}
void solve(){
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    int i=0,j=1e9+10;
    while(i<j){
        int mid=i+(j-i)/2;
        if(isValid(mid)){
            j=mid;
        }
        else
            i=mid+1;
    }
    cout<<i;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve(); 
    return 0;
}


Measured memory_bytes: 3860
import java.util.Scanner;

public class Main {

	public static void main (String[] args) {

		Scanner sc = new Scanner (System.in);

		String s = sc.next();
		
		String[] list =new String [s.length()];
		
		list = s.split("");
		boolean flag = true;
		
		for (int index=0; index<s.length(); index++) {
			if (index%2==1) {
				if (list[index].equals("R")) {
					flag=false;
				}
			} else {
				if (list[index].equals("L")) {
					flag=false;
				}
			}
		}
		
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 23636
import sys
input = sys.stdin.readline

h, n = map(int, input().split())
A = []
B = []
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)

Ama = max(A)

dp=[float("inf")]*(h+Ama+1)
dp[0]=0

for i in range(h+1):
    for j in range(n):
        dp[i+A[j]]=min(dp[i+A[j]],dp[i]+B[j])
print(min(dp[h:]))

Measured memory_bytes: 41964
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main () {
    long long  n = 0, k = 0;
    cin >> n >> k;
    long long ans = 0;
    long long mod = n % k;
    long long div = n / k;
    ans += div;
    if (div > 0) {
        ans += div*(div-1)*3;
    }
    if (div > 1) {
        ans += div*(div-1)*(div-2);
    }
    if (k%2 == 0) {
        if (k / 2 <= mod) div++;
        ans += div;
        if (div > 0) ans += div*(div-1)*3;
        if (div > 1) ans += div*(div-1)*(div-2);
    }
    cout << ans << endl;
    return 0;    
}


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

int main(void) {
  char *type[4] = {"A", "B", "AB", "O"};
  int num[4]  = {0}, no, i;
  char type2[2];

  while (scanf("%d,%s", &no, type2) != EOF) {
    for (i = 0; i < 4; i++) {
      if (strcmp(type[i], type2) == 0) {
	num[i]++;
	break;
      }
    }
  }
  for (i = 0; i < 4; i++)
    printf("%d\n", num[i]);

  return 0;
}

Measured memory_bytes: 608
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#define LL long long
using namespace std;
const LL Maxn = 1e5+10;
LL a[Maxn], n;
int main() {
	LL i, j, k;
	scanf("%lld", &n);
	for(i = 1; i <= n; i++) scanf("%lld", &a[i]);
	LL mn = 2, mx = 2;
	bool bk = true;
	for(i = n; i >= 1; i--){
		mn = ((mn-1)/a[i]+1)*a[i];
		mx = mx/a[i]*a[i];
		if(mn > mx){ bk = false; break; }
		mx += a[i]-1;
	}
	if(bk == false) printf("-1\n");
	else printf("%lld %lld\n", mn, mx);
	return 0;
}

Measured memory_bytes: 896
#include <stdio.h>

int main(void)
{
    int n;
    int a[100];
    int dum;
    scanf("%d", &n);
    for( int l = 0 ; l < n ; l++ ){
        scanf("%d", &a[l]);
    }
    for( int i = 1 ; i <= n ; i++ ){
        dum = n - i;
        printf("%d", a[dum]);
        if( dum > 0 )   printf(" ");
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2112
a, b, k = map(int, input().split())

def exchange(n, m):
  if n % 2:
    n = (n-1) // 2
  else:
    n = n // 2
  m += n
  return n, m


for i in range(k):
  if i % 2:
    b, a = exchange(b, a)
  else:
    a, b = exchange(a, b)

print('{0} {1}'.format(a, b))


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

int main() {

    while(true){
    
        // 1. input end check.
        int a = -1, b = -1;
        cin >> a >> b;
        
        // 2. exit conditions.
        if(a == -1 && b == -1) break;
        
        // 3. output answer.
        int c = a + b;
        string ans = to_string(c);
        cout << ans.size() << endl;
    }
    
    return 0;
    
}


Measured memory_bytes: 3272