akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
#define MAX 1e6
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int mod = 1e9 + 7;

ll power(ll a,ll n){
	if(n == 0) return 1;
	ll small = power(a,n/2);
	small = (small * small) % mod;
	if(n % 2) small = (small * a) % mod;
	return small;
}
int main() 
{
	ll n,k;
	cin>>n>>k;
	ll sum = 0;
	ll arr[k+2] = {0};
	REPI(i,1,k+1){
		ll val = power(k/i,n);
		for(ll j = i;j <= k;j += i){
			val = (val - arr[j] + mod) % mod;
		}
		arr[i] = val;
		sum = (sum + (arr[i]*i) % mod) % mod;
	}
	cout<<sum<<endl;
	return 0;
}  


Measured memory_bytes: 4364
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i]
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion



int32_t main() {
    make(int, n, w);
    vector<PII> a(n);
    for(auto& p : a){
        cin >> p.first >> p.second;
    }
    VI dp(1'000 * n + 1, w + 1);
    dp[0] = 0;
    for(int i = 0; i < n; ++i){
        for(int j = static_cast<int>(dp.size()) - 1 - a[i].second; j >= 0; --j){
            dp[j + a[i].second] = min(dp[j + a[i].second], dp[j] + a[i].first);
        }
    }
    int ans = dp.size() - 1;
    while(dp[ans] > w){
        ans--;
    }
    cout << ans;

    return 0;
}

Measured memory_bytes: 1024
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

dp = [[0] * 3 for i in range(N+1)]
for i in range(1, N+1):
    # print(i)

    if T[i-1] == 'r':
        if i < K:
            dp[i][0] = 0
            dp[i][1] = 0
            dp[i][2] = P
        else:
            dp[i][0] = max(dp[i-K][1], dp[i-K][2])
            dp[i][1] = max(dp[i-K][0], dp[i-K][2])
            dp[i][2] = max(dp[i-K][0]+P, dp[i-K][1]+P)

    elif T[i-1] == 's':
        if i < K:
            dp[i][0] = R
            dp[i][1] = 0
            dp[i][2] = 0
        else:
            dp[i][0] = max(dp[i-K][1]+R, dp[i-K][2]+R)
            dp[i][1] = max(dp[i-K][0], dp[i-K][2])
            dp[i][2] = max(dp[i-K][0], dp[i-K][1])

    else:
        if i < K:
            dp[i][0] = 0
            dp[i][1] = S
            dp[i][2] = 0
        else:
            dp[i][0] = max(dp[i-K][1], dp[i-K][2])
            dp[i][1] = max(dp[i-K][0]+S, dp[i-K][2]+S)
            dp[i][2] = max(dp[i-K][0], dp[i-K][1])
    # print(max(dp[i]))
ans = 0
for i in range(K):
    ans += max(dp[N-i])
print(ans)


Measured memory_bytes: 61420
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A[100001];
    int n,d;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>A[i];
    }
    int dp[100001];
    dp[0]=0;        dp[1]=abs(A[1]-A[0]);
    for(int i=2;i<n;i++)
    {
        dp[i]=min(dp[i-1]+abs(A[i]-A[i-1]), dp[i-2]+abs(A[i]-A[i-2]));
    }
    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define all(container) container.begin(),container.end()
#define fast ios::sync_with_stdio(0); cin.tie(0)
// #ifndef ONLINE_JUDGE
// #include "debug.cpp"
// #endif
#define int long long
const int mod = 1e9+7;  
int power(int a,int b) { if(b==0) return 1; int res = power(a,b/2); if(b&1) return res * res * a; else return res * res; }

int sq(int n){
  return n*n;
}

long double calcdistance(pair<int,int> p1,pair<int,int> p2){
  
  int x1 = p1.first;
  int y1 = p1.second;
  int x2 = p2.first;
  int y2 = p2.second;

  long double d = sq(x2-x1)+sq(y2-y1);
  long double tt = sqrtl(d);

  return tt;
}


int32_t main(){
    
  fast;
  int n; cin >> n;
  map<int,pair<int,int>> mp;
  vector<int> vec;


  for(int i=1;i<=n;i++){
    int x,y; cin >> x >> y;
    mp[i] = {x,y};
    vec.push_back(i);
  }

  long double sum = 0;
  long double cnt = 0;

  do{
    
    long double dis = 0;

    for(int i=1;i<n;i++){
      pair<int,int> p1 = mp[vec[i-1]];
      pair<int,int> p2 = mp[vec[i]]; 
      dis = dis + calcdistance(p1,p2);
    }
    sum+=dis;
    cnt++;
    
  }while(next_permutation(vec.begin(),vec.end()));


  long double ans = sum/cnt;

  cout << setprecision(12) << ans <<  '\n';

  

  return 0;
}

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

int top, S[1000];

void push(int x)
{
	S[++top] = x;	// top 加1之后将元素插入top所在位置 
}

int pop()
{
	top --;
	return S[top + 1];	// 返回top所指的元素 
}

int main()
{
	int a, b;
	top = 0;
	char s[100];
	while(scanf("%s", s) != EOF)
	{
		if(s[0] == '+')
		{
			a = pop();
			b = pop();
			push(a + b);
		}
		else if(s[0] == '-')
		{
			a = pop();
			b = pop();
			push(b - a);
		}
		else if(s[0] == '*')
		{
			a = pop();
			b = pop();
			push(a * b);
		}
		else
		{
			push(atoi(s));
		}
	}
	
	printf("%d\n", pop());
	
	return 0;
}


Measured memory_bytes: 2128
// Created by sz
#include <bits/stdc++.h>
using namespace std;

const int N = 500 + 5;
int n, c, d[30+1][30+1], g[N][N];

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    cin>>n>>c;
    
    for (int i = 1; i <= c; i++){
        for (int j = 1; j <= c; j++){
            cin>>d[i][j];
        }
    }
    
    map<int, map<int, int> > cnt;
    
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            cin>>g[i][j];
            cnt[(i + j)%3][g[i][j]] ++;
        }
    }
    
    int ans = int(1e9);
    for (int i = 1; i <= c; i++){
        for (int j = 1; j <= c; j++){
            for (int k = 1; k <= c; k++){
                if(i==j || i == k||j==k)continue;
                int cur_ans = 0;
                for(auto it: cnt[0]){
                    cur_ans += d[it.first][i]*it.second;
                }
                for(auto it: cnt[1]){
                    cur_ans += d[it.first][j]*it.second;
                }
                for(auto it: cnt[2]){
                    cur_ans += d[it.first][k]*it.second;
                }
                ans = min(ans, cur_ans);
            }
        }
    }
    
    cout<<ans<<endl;
    
    
    return 0;
}



Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    double R;
    cin >> R;

    cout << fixed << setprecision(6);
    cout << R*2.0*3.14159265 << endl;

    return 0;
}

Measured memory_bytes: 3752
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	//static long mod =1000000007;
	//static 	ArrayList<Integer> cc = new ArrayList<>(100);
	
	
	
	
	//for(int i=0;i<N;i++) {}
	public static void main(String[] args) {
		//int N=sc.nextInt();for(int i=0;i<N;i++) {}
		String S=sc.next();
		
		int a=0;
		boolean x=true;
		for(int i=0;i<4;i++) {
			int t=S.charAt(i);
			if(a==t)x=false;
			a=t;
		}
		if(x)p("Good");
		else p("Bad");
		
	}
	

	
	
	
	

	


	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 23764
#include<bits/stdc++.h>
#define rep(i,x,y) for (int i=(x); i<=(y); i++)
#define per(i,x,y) for (int i=(x); i>=(y); i--)
#define ll long long
#define ld long double
#define inf 1000000000
#define INF 1000000000000000000ll
#define pii pair<int,int>
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define sqr(x) ((x)*(x))
#define y1 y1_
#define cmin(x,y) (x)=(y)<(x)?(y):(x)
#define cmax(x,y) (x)=(y)>(x)?(y):(x)
#define mset(x,y) memset((x),(y),sizeof(x))
#define mcpy(x,y) memcpy((x),(y),sizeof(y))
using namespace std;
const ld pi=acos(-1);
const ld eps=1e-8;
//////////////////////// header files ////////////////////////
ll read(){
	char ch=getchar(); ll x=0; int op=1;
	for (; !isdigit(ch); ch=getchar()) if (ch=='-') op=-1;
	for (; isdigit(ch); ch=getchar()) x=(x<<1)+(x<<3)+ch-'0';
	return x*op;
}
void write(ll a){
	if (a<0) putchar('-'),a=-a;
	if (a>=10) write(a/10); putchar(a%10+'0');
}
////////////////////////// fast i/o //////////////////////////
#ifdef mod
ll ksm(ll x,ll p){
	ll ret=1;
	for (; p; p>>=1,x=x*x%mod) if (p&1) ret=ret*x%mod;
	return ret;
}
ll get_inv(ll x){
	return ksm(x,mod-2);
}
#else
ll ksm(ll x,ll p){
	ll ret=1;
	for (; p; p>>=1,x=x*x) if (p&1) ret=ret*x;
	return ret;
}
#endif
//////////////////////////// qpow ////////////////////////////
#define N 100005
int n,m,k; ll ans[10];
map<pii,int> Mp;
//#define local
int main(){
#ifdef local
	freopen("test.in","r",stdin); freopen("test.out","w",stdout);
#endif
	n=read(),m=read(),k=read();
	rep (i,1,k){
		int x=read(),y=read();
		rep (i,0,2) rep (j,0,2){
			int x_=x-i,y_=y-j;
			if (x_>=1 && y_>=1 && x_<=n-2 && y_<=m-2) Mp[pii(x_,y_)]++;
		}
	}
	ans[0]=(ll)(n-2)*(m-2);
	for (map<pii,int>::iterator it=Mp.begin(); it!=Mp.end(); it++) ans[it->S]++,ans[0]--;
	rep (i,0,9) cout<<ans[i]<<endl;
	return 0;
}
// sample data:
/*
4 5 8
1 1
1 4
1 5
2 3
3 1
3 2
3 4
4 4

0
0
0
2
4
0
0
0
0
0

======
10 10 20
1 1
1 4
1 9
2 5
3 10
4 2
4 7
5 9
6 4
6 6
6 7
7 1
7 3
7 7
8 1
8 5
8 10
9 2
10 4
10 9

4
26
22
10
2
0
0
0
0
0
*/

// rest:
/*

*/

/*
If you find any bug in my code or solution, please tell me. Thanks so much.
email: 2411280037@qq.com
*/

Measured memory_bytes: 56576
n , m = map(int,input().split())
L = []
R = []
for i in range(m):
    l , r = map(int,input().split())
    L.append(l)
    R.append(r)
Lmax = max(L)
Rmin = min(R)
s = range(Lmax,Rmin+1)
print(len(s))

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

using ll = long long int;
using P = pair<ll, ll>;
using P3 = pair<double,P>;
using PP = pair<P, P>;
constexpr int INF = 1 << 30;
constexpr ll MOD = ll(1e9+7);
constexpr int di[] = {0, 1, 0, -1};
constexpr int dj[] = {1, 0, -1, 0};
constexpr double EPS = 1e-8;

ll n;
vector<vector<int> > g;
vector<vector<ll> > v;

ll power(ll x, ll k){
    ll res = 1;
    while(k>0){
        if(k&1) res = res*x%MOD;
        x = x*x%MOD;
        k >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return power(x, MOD-2);
}

ll dfs(int now, int pre){
    ll res = 0;
    for(auto nxt : g[now]){
        if(nxt == pre) continue;
        ll cnt = dfs(nxt, now);
        v[now].push_back(cnt);
        res += cnt;
    }
    v[now].push_back(n-1-res);
    return res+1;
}

int solve(){
    cin >> n;
    g.resize(n);
    v.resize(n);
    for(int i=0;i<n-1;i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    dfs(0,-1);
    ll ans = 0;
    vector<vector<ll> > dp(2, vector<ll>(n));
    for(int i=0;i<n;i++){
        int m = v[i].size();
        fill(dp[0].begin(), dp[0].begin()+m+1, 0);
        fill(dp[1].begin(), dp[1].begin()+m+1, 0);
        dp[0][0] = 1;
        for(int j=0;j<m;j++){
            ll p = power(mod_inv(2),v[i][j]);
            dp[0][j+1] = dp[0][j]*p % MOD;
            dp[1][j+1] = (dp[0][j]*(1-p+MOD) % MOD + dp[1][j]*p) % MOD;
        }
        ans += mod_inv(2)*(1-(dp[0][m]+dp[1][m])%MOD+MOD)%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

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

Measured memory_bytes: 40448
b,c=map(int,input().split())
a=list(map(int,input().split()))
d=sum(a)
new_a=sorted(a)
e=-1
f=0
g=4*c

while new_a[e] >= d/g:
    e=e-1
    f=f+1
    if -e>b:
        break

if f >= c:
    print("Yes")
else :
    print("No")

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Text;


namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            //??\?????????????????????????????????
            string s = Console.ReadLine();

            //??????????????´??°????????°????????????
            int x =int.Parse(s);


            Console.Write(x * x * x);
            Console.Write("\n");

                 
       
           
        }
    }
}

Measured memory_bytes: 5600
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    int n;
    cin>>n;
    int mx=-1,ans=0;
    for(int i=1; i<=n; ++i){
        int cnt=0,x=i;
        while(x!=1){
            x/=2;
            cnt++;
        }
        if(mx<cnt)mx=cnt,ans=i;
    }
    cout<<ans<<endl;
    return 0;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;
#define LL long long
struct point{LL x; LL y;};

void solve(long long N, long long K, std::vector<long long> x, std::vector<long long> y){
    vector<point> p(N);
    for(LL i=0; i<N; i++)p[i]=point{x[i], y[i]};
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    LL ans = (x[N-1]-x[0])*(y[N-1]-y[0]);
    for(LL x1=0; x1<N; x1++){
        for(LL x2=x1; x2<N; x2++) {
            for (LL y1=0; y1<N; y1++) {
                for (LL y2=y1; y2<N; y2++) {
                    LL cnt = 0;
                    for(LL i=0; i<N; i++)
                        if(p[i].x >= x[x1] && p[i].x <= x[x2] && p[i].y >= y[y1] && p[i].y <= y[y2])
                            cnt++;
                    if(cnt < K)continue;
                    LL area = (x[x2]-x[x1])*(y[y2]-y[y1]);
                    ans = min(ans, area);
                }
            }
        }
    }
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
    }
    solve(N, K, std::move(x), std::move(y));
    return 0;
}


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

int main() {
	// your code goes here
	int n,m;
	cin>>n>>m;
	int a[10000];
	for(int i=1;i<=m;i++)
	{
		cin>>a[i];
	}
	int sum=0;
	for(int i=1;i<=m;i++)
	{
		sum+=a[i];

	}
	if(sum>n)
	cout<<"-1";
      else
	cout<<n-sum<<endl;
	return 0;
}

Measured memory_bytes: 3660
d={1:1,3:1,5:1,7:1,8:1,10:1,12:1,4:2,6:2,9:2,11:2,2:3}
a=list(map(int,input().split()))
if d[a[0]]==d[a[1]]: 
    print('Yes')
else: 
    print('No')

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

namespace my {
template <typename T>
void input_vec(vector<T> &a, ll n) {
  if (!a.empty()) {
    cout << "wrong argument in input_vec" << endl;
    exit(1);
  }
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.push_back(tmp);
  }
}
template <typename T>
void input_set(set<T> &a, ll n) {
  if (!a.empty()) {
    cout << "wrong argument in input_set" << endl;
    exit(1);
  }
  for (ll i = 0; i < n; i++) {
    T tmp;
    cin >> tmp;
    a.insert(tmp);
  }
}

char itoc(int i) { return i + '0'; }
int ctoi(char c) { return c - '0'; }

ll gcd(ll a, ll b) {  // O( log(a) )
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b != 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}
ll lcm(ll a, ll b) { return a * (b / my::gcd(a, b)); }  // O( log(a) )

bool isPrime(ll n) {  // O( sqrt(n) )
  bool flag = true;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}

vector<pair<ll, ll>> primeFac(ll n) {  // O( sqrt(n) )
  vector<pair<ll, ll>> ret;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i != 0) continue;
    ll exp = 0;
    while (n % i == 0) {
      n /= i;
      exp++;
    }
    ret.push_back(make_pair(i, exp));
  }
  if (n != 1) ret.push_back(make_pair(n, 1));
  return ret;
}
}  // namespace my
////////////////////////////////////////////////

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 1e7;
  for (int i = 0; i < s.size() - (t.size() - 1); i++) {
    string s_ = s.substr(i, t.size());
    int tmp = 0;
    for (int j = 0; j < t.size(); j++) {
      if (s_.at(j) != t.at(j)) tmp++;
    }

    ans = min(ans, tmp);
  }

  cout << ans << endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <functional>
#include <fstream>
#include <cstdlib>
typedef long long ll;
const ll MOD = 1e9+7;


#define REP(i, N) for (ll i = 0; i < (N); i++)
#define REPP(i, a, b) for (ll i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define VSORT(c) sort((c).begin(),(c).end())
#define SZ(x) ((ll)(x).size())
//vvintを作る　マクロで　 #define vvint(N,M) vector<vector<ll>>

using namespace std;
// 変数初期化
vector<ll> bsv; // binary_search用のvector
ll a,b,c,n,m;
typedef pair<ll, ll> Pll;
vector<Pll> facts; // 素因数分解の結果格納用(基数:乗数)
vector<vector<ll> > bit_search_v; //nit全探索の結果格納用

// index が条件を満たすかどうか
bool isOK(ll index, ll key) {
    if (bsv[index] >= key) return true;
    else return false;
}

// 汎用的な二分探索のテンプレ
ll binary_search(int key) {
    int ng = -1;
    int ok = (ll)bsv.size();

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key)) ok = mid;
        else ng = mid;
    }
    // OK(key以上となる)のindex番号を返す
    return ok;
}

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

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

//　素因数分解
void prime_fact(ll target){
    ll base=2, exp=0;
    while (base*base<=target) {
        while (target%base==0) {
            target /= base; exp++;
        }
        if (exp>0) {
            facts.push_back(make_pair(base, exp));
        }
        base++; exp=0;
    }
    if (target>1) facts.push_back(make_pair(target,1));
}
// prime_factの結果の確認用
void print_facts(){
    for (int i=0; i<facts.size(); i++) {
        cout << facts[i].first << " " << facts[i].second << endl;
    }
}

// bit全探索
void bit_search(ll target){
    for (ll i=0; i<(1<<target); ++i) {
        if (i==0) continue;
        vector<ll> v;
        for (ll j=0; j<target; ++j) {
            if (i&(1<<j)) v.push_back(j);
            if (i&(1<<j)) cout << i << "  :  " << j << endl;
        }
        bit_search_v.push_back(v);
    }
}
// bit全探索の結果確認用
void print_bit_search(){
    for (ll i=0; i<bit_search_v.size(); ++i) {
        for (ll j=0; j<bit_search_v[i].size(); ++j) {
            cout << bit_search_v[i][j] << " ";
        }
        cout << endl;
    }
}



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

    ll k;
    cin >> n >> k;
    vector<ll> st(n+1,0);

    ll d;
    for(ll i = 0; i < k;i++){
        cin >> d;
        ll t;
        for(ll l = 0; l < d;l++){
            cin >> t;
            st[t]++;
        }
    }
    ll ans = 0;
    for(ll i = 1; i < n+1;i++){
        if(st[i] == 0){
            ans++;
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3196
n = int(input())
xs, us = [], []
for _ in range(n):
  x, u = input().split(' ')
  xs.append(float(x))
  us.append(u)
total_yen = 0
for x, u in zip(xs, us):
  if u == 'BTC':
    total_yen += (x*380000.0)
  else:
    total_yen += x
print(total_yen)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; 
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const int N = 200000 + 5;
int a[N];

int main()
{
	int n,k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	sort(a+1,a+n+1);
	ll sum = 0;
	for(int i = 1; i <= n - k; i++){
		sum += a[i];
	}
	cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1024
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 初期値用:十分小さい数(-100億)
    # -INF = float("inf")
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N,M = (int(_) for _ in input().split())
    a = []
    b = []
    c = []
    d = [INF]*N
    
    for i in range(M):
        s1, s2, s3 = (int(_) for _ in input().split())
        a.append(s1)
        b.append(s2)
        c.append(-s3)
    d[0] = 0
    cnt = [0]*N
    for j in range(N):
        update=False
        for i in range(M):
            if math.isinf(d[a[i]-1]):
                continue
            if(d[b[i]-1] > d[a[i]-1]+c[i]):
                d[b[i]-1] = d[a[i]-1]+c[i]
                cnt[b[i]-1]+=1
                update=True
        if not update:
            break
    if cnt[N-1] < N:
        ans = -d[N-1]
    else:
        ans = 'inf'
    
    # negative = [False]*N
    # for j in range(N):
    #     for i in range(M):
    #         if(d[a[i]-1] == 1e10):
    #             continue
    #         if(d[b[i]-1] > d[a[i]-1]+c[i]):
    #             d[b[i]-1] = d[a[i]-1]+c[i]
    #             negative[b[i]-1] = True
    #         if(negative[a[i]-1]):
    #             negative[b[i]-1] = True
    print(ans)
if __name__ == '__main__':
    main()


Measured memory_bytes: 3808
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(), (a).end()
using lint = long long;
template< typename T > using Vec = vector< T >;

template< typename T > bool inRange(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool inRange(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }
template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }
int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//
int main() {
	int N, M;
	cin >> N >> M;
	Vec< int > k(M);
	Vec< Vec< int > > s(M, Vec< int >(N));
	for_(i,0,M) {
		cin >> k[i];
		for_(j,0,k[i]) {
			cin >> s[i][j];
			--s[i][j];
		}
	}
	Vec< int > p(M);
	for_(i,0,M) cin >> p[i];
	int ans = 0;
	for_(S,0,1<<N) {
		bool isok = true;
		for_(i,0,M) {
			int cnt = 0;
			for_(j,0,k[i]) if (S >> s[i][j] & 1) ++cnt;
			isok &= (cnt % 2 == p[i]);
		}
		if (isok) ++ans;
	}
	cout << ans << endl;
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

int main(){
  int n, index;

  cin >> n;

  int nums[n];

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

  for(int j = (n - 1); j >= 0; j--){
    index = j;
    cout << nums[index];
    if(j != 0)cout << " ";
  }
  cout << endl;
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
int64_t MOD=1000000007;

int main() {
  int64_t N,ans=0;
  cin>>N;
  int64_t n=N;
  if(N==1) cout<<0;
  else{
    for(int64_t i=2;i*i<=n;i++){
      if(N%i==0){
        int temp=0;
        while(N%i==0){
          temp++;
          N/=i;
        }
        int k=1;
        while(temp>=k){
          temp-=k;
          k++;
          ans++;
        }
      }
    }
    if(N!=1)ans++;
    cout<<ans;
  }
}


Measured memory_bytes: 3636
/**
 *    author:  FromDihPout
 *    created: 2020-08-08
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    long long n;
    cin >> n;
    long long ans = 0;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            long long j = n / i;
            ans = i + j;
        }
    }
    cout << ans - 2 << '\n';
    return 0;
}

Measured memory_bytes: 3568
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }

        static int[] Solve(int N, int[][] edges)
        {
            var colors = new int[N - 1];
            var visited = new bool[N];
            var lists = new List<Tuple<int, int>>[N];
            for (int i = 0; i < N; ++i) { lists[i] = new List<Tuple<int, int>>(); }
            for (int i = 0; i < N - 1; ++i)
            {
                var edge = edges[i];
                int a = edge[0];
                int b = edge[1];
                lists[a].Add(new Tuple<int, int>(i, b));
                lists[b].Add(new Tuple<int, int>(i, a));
            }
            var q = new Queue<Tuple<int, int>>();
            q.Enqueue(new Tuple<int, int>(0, 0));
            visited[0] = true;
            while (q.Count > 0)
            {
                var t = q.Dequeue();
                int i = t.Item1;
                int color = 1;
                foreach (var tuple in lists[i])
                {
                    int e = tuple.Item1;
                    int j = tuple.Item2;
                    if (!visited[j])
                    {
                        if (color == t.Item2) { ++color; }
                        visited[j] = true;
                        colors[e] = color;
                        q.Enqueue(new Tuple<int, int>(j, color));
                        ++color;
                    }
                }
            }
            return colors;
        }

        static void Main(string[] args)
        {
            int N = ReadInt();
            var edges = new int[N - 1][];
            for (int i = 0; i < N - 1; ++i)
            {
                edges[i] = ReadInts().Select(j => j - 1).ToArray();
            }
            var values = Solve(N, edges);
            Console.WriteLine(values.Max());
            foreach (var value in values)
            {
                Console.WriteLine(value);
            }
        }
    }
}


Measured memory_bytes: 40200
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int n, a[20];
map<pi,ll> dp[20][20];
ll rec(int l, int r, int x, int y){
	if(l + 1 >= r) return 0;
	if(dp[l][r].count(pi(x, y))) return dp[l][r][pi(x, y)];
	ll &res = dp[l][r][pi(x, y)];
	res = 1e18;
	for(int i = l + 1; i < r; i++)
		res = min(res, rec(l, i, x, x + y) + rec(i, r, x + y, y) + (ll)(x + y) * a[i]);
	return res;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	cin >> n;
	rep(i, n) cin >> a[i];
	ll ans = rec(0, n - 1, 1, 1) + a[0] + a[n - 1];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 16512
import java.util.*;

public class Main {
    
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(),x,y;
        int n = sc.nextInt(),a,b;
        for(int i=0;i<n;i++){
            x=sc.next();a=sc.nextInt();b=sc.nextInt();
            if(x.equals("print"))System.out.println(s.substring(a,b+1));
            else if(x.equals("replace")){
                y=sc.next();s=s.substring(0,a)+y+s.substring(b+1);
            }
            else {
                 y = s.substring(a,b+1);char[] lst=new char[y.length()];
                for(int j=0;j<y.length();j++){
                    lst[j]=y.charAt(y.length()-j-1);
                }
                s=s.substring(0,a)+s.valueOf(lst)+s.substring(b+1);
            }
        }
    }
}


Measured memory_bytes: 29768
import java.util.*;
import java.io.*; //printwiter

//このように絞った方が良いかも
//import java.io.Closeable;
//import java.io.File;
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//import java.io.IOException;
//import java.io.InputStream;
//import java.io.PrintWriter;
//import java.util.NoSuchElementException;
//import java.util.Scanner;


/**
 * Base_version with PrintWriter and FastScanner
 */ 
 
class Main { 
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();//Scanner→FastScanner, Delete(System.in)
      	long x = sc.nextLong();
      	//int→long[actually using int is better], nextInt()→nextLong
      	long t = sc.nextLong();//int→long, nextInt()→nextLong
      	PrintWriter out = new PrintWriter(System.out);
        out.println(Math.max(x - t, 0));
      	out.flush();
    }
}

//add 
class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    public boolean hasNext() { skipUnprintable(); return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
}


Measured memory_bytes: 21076
sx, sy, tx, ty = map(int, input().split())
y = ty - sy
x = tx - sx
print("U"*y+"R"*x+"D"*y+"L"*x+"L"+"U"*(y+1) +
      "R"*(x+1)+"D"+"R"+"D"*(y+1)+"L"*(x+1)+"U")

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

int main() {
  long long num,kashi;
  int cnt = 0;
  
  cin >> num >> kashi;
  
  vector<int> vec(num);
  for(int i = 0; i < num; i++) cin >> vec.at(i);
  
  sort(vec.begin(), vec.end());
  for(int i = 0; i < num; i++){
    if(vec.at(i) <= kashi){
      kashi -= vec.at(i);
      cnt++;
    }else{
      break;
    }
  }

  if(kashi > 0 && cnt == num) cnt--;
  cout << cnt;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        String w = "SUNMONTUEWEDTHUFRISAT";
        String s = scanner.next();
        int i = w.indexOf(s) / 3;
        System.out.println(7 - i);
    }
}


Measured memory_bytes: 21716
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize,
        l: usize,
        mut v: [chars; n]
    }
    v.sort();
    for i in 0..n {
        print!("{}", v[i].iter().cloned().collect::<String>());
    }
    println!("");
}


Measured memory_bytes: 4352
import sys
def ii(): return int(sys.stdin.readline())

N = ii()
S = [sys.stdin.readline().rstrip() for _ in range(N)]
ans = 0
count = [0, 0, 0]
for s in S:
    ans += s.count("AB")
    if s[0] == "B" and s[-1] == "A":
        count[0] += 1
    elif s[0] == "B":
        count[1] += 1
    elif s[-1] == "A":
        count[2] += 1
if count[0]:
    ans += count[0] - 1
    if count[1]:
        ans += 1
        count[1] -= 1
    if count[2]:
        ans += 1
        count[2] -= 1
ans += min(count[1:])
print(ans)
    


Measured memory_bytes: 40304
#include <valarray>
#include <cstdio>
using namespace std;
typedef valarray<int>V;
int n,m;
V s,x,z;
V &Me(const V &_x,const V &_y){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_y[slice(j,n,n)]).sum()%m;
	return z;
}
void Mx(const V &_x){
	int i=0,j;
	for(;i<n;i++)for(j=0;j<n;j++)z[i*n+j]=(_x[slice(i*n,n,1)]*_x[slice(j,n,n)]).sum()%m;
	x=z;
}
void O(const V &r){
	int i=0;
    for(;i<n-1;i++)printf("%d ",(r[slice(i*n,n,1)]*s).sum()%m);
    printf("%d\n",(r[slice(i*n,n,1)]*s).sum()%m);
}
main(){
	int i,a,b,c,t;
	for(;scanf("%d%d%d%d%d%d",&n,&m,&a,&b,&c,&t),n;){
		s.resize(n);
		for(i=0;i<n;i++)scanf("%d",&s[i]);
		x.resize(0);
		x.resize(n*n);
		V e(n*n);
		//e.resize(0);
		//e.resize(n*n);
		z.resize(n*n);

		x[0]=b;
		x[1]=c;
		e[0]=1;
		for(i=1;i<n-1;i++){
			x[i*n+i-1]=a;
			x[i*n+i]=b;
			x[i*n+i+1]=c;
			e[i*n+i]=1;
		}
		x[i*n+i-1]=a;
		x[i*n+i]=b;
		e[i*n+i]=1;
		for(;t;t>>=1){
			if(t&1)e=Me(e,x);
			Mx(x);
		}
		O(e);
	}
}

Measured memory_bytes: 1092
<?php
	$stdin = explode(" ", trim(fgets(STDIN)));
	$a = $stdin[0];
	$b = $stdin[1];

	if ($a > $b) {
		echo "a > b" . PHP_EOL;
	} else if ($a < $b) {
		echo "a < b" . PHP_EOL;
	} else {
		echo "a == b" . PHP_EOL;
	}

Measured memory_bytes: 15300
#include <iostream>
#include <string>
using namespace std;
int main()
{

  string s;
  cin >> s;
  int counter = 0;

  for(int i = 0; i < s.length(); i++){
    if(s[i] == '1') ++counter;
  }

  cout << counter << endl;

  return 0;
}

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

int main(){
  int X;cin>>X;
  int l=0;
  while(true){
    if((l+1)*(l+1)<=X) l++;
    else break;
  }
  priority_queue<int> A;
  A.push(1);
  for(int i=2;i<=l;i++){
    int j=i*i;
    while(true){
      if(j<=X){
        A.push(j);
        j*=i;
      }
      else break;
    }
  }
  cout<<A.top()<<endl;
}

Measured memory_bytes: 3596
import math
import statistics

n = int(input())
xL = list(map(int, input().split(" ")))

xL2 = []
for i in range(n):
    xL2.append([i, xL[i]])
xL2 = sorted(xL2, key=lambda x: x[1])

if n % 2 == 0:
    center = n // 2
    centers = [xL2[center - 1], xL2[center]]
    for i in range(n):
        if i == centers[0][0] or i == centers[1][0]:
            print(statistics.median(xL[:i] + xL[i + 1:]))
        else:
            if centers[0][1] < xL[i]:
                print(centers[0][1])
            else:
                print(centers[1][1])
else:
    center = n // 2
    centers = [xL2[center - 1], xL2[center], xL2[center + 1]]
    for i in range(n):
        if i == centers[0][0] or i == centers[1][0] or i == centers[2][0]:
            print(statistics.median(xL[:i] + xL[i + 1:]))
        else:
            if centers[0][1] < xL[i]:
                print((centers[0][1] + centers[1][1]) / 2)
            else:
                print((centers[1][1] + centers[2][1]) / 2)

Measured memory_bytes: 48196
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

N, M = map(int, input().split())
S = input()
T = input()

g = gcd(N,M)
l = N * M // g

n = N // g
m = M // g

for i in range(g):
    if S[n*i] != T[m*i]:
        print(-1)
        break
else:
    print(l)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define int long long int
signed main() 
{
int n,k;
cin>>n>>k;
int count0=0,count=0;
for(int i=1;i<=n;i++)
{
          if(i%k==0) count0++;
          
          if(k%2==0 && i%k==(k/2)) count++;
}
int ans=count0*count0*count0;
ans+=count*count*count;
cout<<ans<<"\n";
}

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


using namespace std;

#define fastio() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long
#define mk make_pair
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int) (x).size()


void go(){
	int n;
	string s;
	cin>>n>>s;
	int x=0;
	int ans=0;
	for(char c : s) {
		if(c=='I') {
			x++;
			ans=max(x,ans);
		}
		if(c=='D') x--;
	}
	cout << ans;
}
int main(){
   
   fastio();
   cin.tie(0);
   cout.tie(0);

   go();

   return 0;
}




Measured memory_bytes: 3648
<?php
fscanf(STDIN,"%d",$n);
$arr=explode(' ',trim(fgets(STDIN)));
//print_r($arr);
$cnt=0;
for($i=0;$i<($n-2);$i++){
	$t=array();
	$t[0]=$arr[$i];
	$t[1]=$arr[$i+1];
	$t[2]=$arr[$i+2];
	$r=array();
	$r[0]=$arr[$i];
	$r[1]=$arr[$i+1];
	$r[2]=$arr[$i+2];
	sort($r,SORT_ASC);
	if($t[1]==$r[1]){
		$cnt++;
	}
}
echo $cnt;
?>

Measured memory_bytes: 3828
#include<bits/stdc++.h>
using namespace std;
#define int long long
bool vis[100005];

signed main(){
    
    int n,k;
    cin >> n >> k;
    int r,s,p;
    cin >> r >> s >> p;

    string t;
    cin >> t;
    int ans = 0;

    for(int i = 0;i<n;i++){
      //int R = 0, S = 0, P = 0;
      string st = "";
      if(!vis[i]){
        for(int j = i; j<n;j+=k){
         // if(t[j]=='r')R++;
          //else if(t[j]=='s')S++;
          //else P++;
          st+=t[j];
          vis[j] = true;
        }
      st+=to_string(0);
      for(int k = 0;k<st.size();k++){
        if(st[k] != '0' ){
          if(st[k]==st[k+1]){ st[k+1] = '0'; }
            if(st[k]=='r')ans+=p;
            else if(st[k]=='p')ans+=s;
            else ans+=r;
          
        }
      }
    }
      //ans+= ( p*((R+1)/2) + r*((S+1)/2) + s*((P+1)/2) );
    }

    cout << ans << endl;
  return 0;
}
    
  


Measured memory_bytes: 640