akhauriyash/Code-Regression huggingface dataset:
fun main(args: Array<String>) {
    var (N, M) = readInputLine().split(" ").map { it.toLong() }
    val aArr = readInputLine().split(" ").map { it.toLong() / 2L }.toLongArray()

    while (aArr[0] % 2L == 0L) {
        for (i in 0 until N.toInt()) {
            if (aArr[i] % 2L != 0L) {
                println(0)
                return
            }
            aArr[i] /= 2L
        }
        M /= 2L
    }

    if (aArr.any { it % 2L == 0L }) {
        println(0)
        return
    }

    var lcm = aArr[0]

    for (a in aArr) {
        val gcd = gcd(lcm, a)
        lcm = lcm / gcd * a
        if (lcm > M) {
            println(0)
            return
        }
    }

    val ans = if (M / lcm % 2L == 0L) M / lcm / 2L else M / lcm / 2L + 1L

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}

fun gcd(a: Long, b: Long): Long {
    if (b > a) {
        return gcd(b, a)
    }
    if (b == 0L) {
        return a
    }
    return gcd(b, a % b)
}


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

class combination
{
public:
  vector<ll> fac, finv, inv;

  combination(ll M)
  {
    fac = vector<ll>(M, 1);
    finv = vector<ll>(M, 1);
    inv = vector<ll>(M, 1);

    for (ll i = 2; i < M; i++)
    {
      fac.at(i) = fac.at(i - 1) * i % MOD;
      inv.at(i) = MOD - inv.at(MOD % i) * (MOD / i) % MOD;
      finv.at(i) = finv.at(i - 1) * inv.at(i) % MOD;
    }
  }

  ll P(ll N, ll K)
  {
    if (N < K) return 0;
    if (N < 0 || K < 0) return 0;
    return fac.at(N) * finv.at(N - K) % MOD;
  }

  ll C(ll N, ll K)
  {
    if (N < K) return 0;
    if (N < 0 || K < 0) return 0;
    return fac.at(N) * (finv.at(K) * finv.at(N - K) % MOD) % MOD;
  }

  ll H(ll N, ll K)
  {
    return C(N + K - 1, K);
  }
};

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

  vector<vector<vector<ll>>> dp(N + 1, vector<vector<ll>>(300, vector<ll>(N + 1, 0)));
  dp.at(0).at(0).at(0) = 1;
  for (ll i = 0; i < N; i++)
  {
    for (ll j = 0; j < 256; j++)
    {
      for (ll k = 0; k < N; k++)
      {
        dp.at(i + 1).at(j ^ A.at(i)).at(k + 1) += dp.at(i).at(j).at(k);
        dp.at(i + 1).at(j ^ A.at(i)).at(k + 1) %= MOD;
        dp.at(i + 1).at(j).at(k) += dp.at(i).at(j).at(k);
        dp.at(i + 1).at(j).at(k) %= MOD;
      }
    }
  }

  combination com(N + 1);

  ll ans = 0;
  for (ll k = 1; k <= N; k++)
  {
    ans += com.fac.at(k) * (dp.at(N).at(K).at(k) % MOD);
    ans %= MOD;
  }

  cout << ans << endl;
}

Measured memory_bytes: 25344
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

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

	int ans = n / 2 + n % 2;

	col(ans);
	return 0;
}


Measured memory_bytes: 3592
using System;

namespace abc124
{
    class A
    {
        static void Main(string[] args)
        {
            string[] R = Console.ReadLine().Split(' '); ;
            int A = int.Parse(R[0]);
            int B = int.Parse(R[1]);

            int big = Math.Max(A, B);
            if (A != B)
            {
                Console.WriteLine(big + (big - 1));
            } else
            {
                Console.WriteLine(big * 2);
            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
using namespace std;
int main(void){
    // 定義：容器１を「 A 」、容器２「  B 」、水の移動「 C 」と置く
    int A, B, C;
    cin >> A >> B >> C;
    
    int ans = C - (A - B);
    
    // 比較：容器２に見水が残っているか確認する
    if(ans > 0) cout << ans << endl;
    else cout << 0 << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int L[2000][2000];
int R[2000][2000];
int U[2000][2000];
int D[2000][2000];

int main() {
  // 4つのグリッドを用意
  int H, W;
  cin >> H >> W;
  vector<string> S(H);
  rep(i, H) cin >> S[i];
  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') L[i][j] = 0;
      else {
        L[i][j]++;
        if (j < W-1) L[i][j+1] = L[i][j];
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = W-1; j >= 0; j--) {
      if (S[i][j] == '#') R[i][j] = 0;
      else {
        R[i][j]++;
        if (j > 0) R[i][j-1] = R[i][j];
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') U[i][j] = 0;
      else {
        U[i][j]++;
        if (i < H-1) U[i+1][j] = U[i][j];
      }
    }
  }
  for (int i = H-1; i >= 0; i--) {
    for (int j = 0; j < W; j++) {
      if (S[i][j] == '#') D[i][j] = 0;
      else {
        D[i][j]++;
        if (i > 0) D[i-1][j] = D[i][j];
      }
    }
  }
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int temp = L[i][j] + R[i][j] + U[i][j] + D[i][j] - 3;
      if (temp > ans) {
        ans = temp;
      }
    }
  }
  cout << ans << '\n';
  return 0;

}

Measured memory_bytes: 73656
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;++i){
        int a[3];
        cin>>a[0]>>a[1]>>a[2];
        sort(a,a+3);
        if(a[0]*a[0]+a[1]*a[1]==a[2]*a[2]) cout<<"YES\n";
        else cout<<"NO\n";
    }
}

Measured memory_bytes: 3064
// Problem : D - Not Divisible
// Contest : AtCoder - AtCoder Beginner Contest 170
// URL : https://atcoder.jp/contests/abc170/tasks/abc170_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define pb push_back
#define nl cout<<"\n"
#define endl "\n"
#define ll long long
#define ld long double
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define f first
#define s second

inline ll max(ll a,ll b) {return ((a>b)?a:b);}
inline ll min(ll a,ll b) {return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b) {if(b==0) return a; a%=b;return gcd(b,a);}
ll power(ll x, ll y){if(y == 0) return 1; ll a = power(x,y/2);if (y % 2 == 0) return a * a; else return x * a * a; }
ll powermod(ll x, ll ex , ll md) {ll ans = 1ll;while (ex > 0) {if (ex & 1ll) ans = (ans * x) % md; ex >>= 1ll;x = (x * x) % md;}return ans;}

const ll inf = 1e18 + 9;
const ll mod = 1e9 + 7;
const ld PI = acos(-1);
const ld eps = 1e-9;

const ll N = 1e6 + 1;
bool vis[N];
void solve(){
	ll n;
	cin >> n;
	ll a[n];
	ll ct =0 ;
	ll mx = -inf;
	map<ll,ll> cnt;
	rep(i , n) {
		cin >> a[i];
		cnt[a[i]]++;
		mx = max(mx , a[i]);
	}
	sort(a , a + n);
	for(ll i =0 ; i < n ; i++){
		if(vis[a[i]] == 0){
			if(cnt[a[i]] == 1) ct++;
			for(ll j = a[i] ; j <= mx ; j += a[i]) vis[j] = 1;
		}
	}
	cout << ct <<endl;
}
int main(){
    IOS;
    cout << fixed << setprecision(20);
    ll NTC=1;
    // cin>>NTC;
    ll PTC=0;
    while(PTC++<NTC){
        // cout<<"Case #"<<PTC<<":"<<' ';
        solve();
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> a(n),b(n),c(m),d(m);
  for(int i=0;i<n;++i){
    cin >> a[i] >> b[i];
  }
  for(int j=0;j<m;++j){
    cin >> c[j] >> d[j];
  }
  for(int i=0;i<n;++i){
    int ma=1000000000;
    int x,y;
    int ans=-1;
    for(int j=0;j<m;++j){
      int kyori=abs(a[i]-c[j])+abs(b[i]-d[j]);
      if(ma>kyori){
        ans=j+1;
        ma=kyori;
      }
    }
    cout << ans << endl;
  }
}


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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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

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

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;

vector<pii> edge[100005];

int main(){
	ios_base::sync_with_stdio(false);
	int N, ans=0;
	int b[100005]={};

	cin >> N;
	rep(i,N-1){
		int x, y, a;
		cin >> x >> y >> a;
		edge[x].emplace_back(y, a);
		edge[y].emplace_back(x, a);
		b[x] ^= a;
		b[y] ^= a;
	}

	int cnt[16]={};
	rep(i,N) cnt[ b[i] ]++;

	int rest=0;
	rep(i,15){
		ans += cnt[i+1] / 2;
		if( cnt[i+1]%2 ) rest |= (1<<i);
	}
	//cout << "rest: " << bitset<16>(rest) << endl;

	int dp[1<<15];
	Fill(dp, (int)INF);
	dp[0] = 0;
	rep(k,1<<15){
		auto nex = [&](int h, int &mask){
			h += 1;
			while(h&mask) h += (h&mask);
			return h;
		};
		for(int h = nex(0,k); h < (1<<15); h=nex(h,k)){
			int sum = 0, cnt = 0;
			rep(i,15) if(h & (1<<i)) sum ^= (i+1);
			rep(i,15) if(h & (1<<i)) cnt++;
			if( sum == 0 ){
				chmin(dp[k|h], dp[k] + cnt-1);
			}
		}
		//cout << bitset<16>(k) << " " << dp[k] << endl;
	}

	// int MAX = (int)pow(3,16);
	// int dp[MAX] = {};
	// rep(k,MAX){
	// 	int u = 0;
	// 	int i = 0;
	// 	bool z = false;
	// 	int ubit = 0;
	// 	int cnt = 0;
	// 	while(k){
	// 		cnt++;
	// 		u <<= 1;
	// 		i <<= 1;
	// 		if(cnt == 1) z = (k%3 == 0);
	// 		u |= (k%3 == 1);
	// 		i |= (k%3 == 2);
	// 		if( k%3 == 1 ) ubit ^= cnt;
	// 		k /= 3;
	// 	}
	// 	if( z && ubit == cnt ){
	// 	}
	// 	if( (i & (1<<(cnt-1))) && ubit == cnt ){
	// 	}
	// }

	ans += dp[rest];
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 7156
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

int gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}

void solve(void){
    int d,n;
    cin >> d >> n;
    
    int ans =  dig(d);
    if(n != 100)
    cout << ans*n<< endl;
    else cout << ans*101 <<endl;
}

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

Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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

const int MOD = 1e9 + 7;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;




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

	string S; cin >> S;
	int N = S.size();
	bool ok = true;
	REP(i, N) {
		if (i % 2 == 0) {
			if (S[i] == 'R' || S[i] == 'U' || S[i] == 'D') {
				continue;
			}
			else ok = false;
		}
		else {
			if (S[i] == 'L' || S[i] == 'U' || S[i] == 'D') {
				continue;
			}
			else ok = false;
		}
	}
	if (ok)print("Yes") else print("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    int a,b,i;
    bool flag=true;
    cin >> a >> b;
    char s[20];
    scanf("%s",s);
    for(i=0;i<a+b+1;i++){
        if(i!=a){
            if(s[i]<'0'||s[i]>'9'){
                flag =false;
            }
        }else{
            if(s[a]!='-'){
                flag=false; 
            }
        }
    }
    if (flag==true){
        cout << "Yes" <<endl;
    }else{
        cout << "No" <<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    vector<int> x(5);
    for(int i=0; i<5; i++){
        cin >> x[i];
    }
    for(int i=0; i<5; i++){
        if(x[i]==0){
            cout << i+1 << endl;
            return 0;
        }
    }
}




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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')'<<' ';cout<<endl
#define FOR(i,a,b) for (ll i=(ll)(a);i<(ll)(b);++i)
#define OUT(x) cout<<x<<endl
#define OUTP(x) cout<<'('<<x.first<<','<<x.second<<')'<<endl;
#define REP(i,n) FOR(i,0,n)
#define YES(cond) cond ? OUT("YES") : OUT("NO")
#define Yes(cond) cond ? OUT("Yes") : OUT("No")

template<class T> T gcd(const T x,const T y){if(!y){return x;}return gcd(y,x%y);}
template<class T> T lcm(const T x,const T y){return x/gcd(x,y)*y;};
template<class T> T modpow(T x,T n,const T mod) {
  T res=1;while(n>0){if(n%2)res=res*x%mod;x=x*x%mod;n/=2;};return res;
}
template<class T> T modinv(T x,const T mod){return modpow(x,mod-2,mod);}
template<class T> bool alltrue(const T &a){return all_of(ALL(a),[](bool x){return x;});}
template<class T> bool anytrue(const T &a){return any_of(ALL(a),[](bool x){return x;});}
template<class T> bool contain(const T &a,const T &b){for(auto x:b){if (a.find(x)==a.end()){return false;}}return true;}
template<class T> bool mmax(T &m,const T q){ if (m < q) {m = q; return true;} else return false; }
template<class T> bool mmin(T &m,const T q){ if (m > q) {m = q; return true;} else return false; }
template<class T> int siz(const T &a) {return (int)a.size();}
template<class T> set<T> devisers(T n) {
  set<T> res;for(T i=1;i<(T)sqrt(n)+1;i++){if(n%i==0){res.insert(i);res.insert(n/i);}}return res;
}
template<class T> void concat(T &a, const T &b){a.insert(a.end(),ALL(b));}
template<class T> void getand(const T &a,const T &b,T &c) {
  set_intersection(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> void getor(const T &a,const T &b,T &c) {
  set_union(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> void getdiff(const T &a,const T &b,T &c) {
  set_difference(ALL(a),ALL(b),inserter(c,c.end()));
}
template<class T> T deg2rad(T deg) {return deg*2*M_PI/360;}
template<class T> T rad2deg(T rad) {return rad*360/(2*M_PI);}

typedef long long ll;
typedef pair<ll, ll> P;

const ll MOD=1e9+7;
const ll MAX=5e6;

int main() {
  int N;cin>>N;
  string S;cin>>S;
  ll rcnt = count(ALL(S), 'R');
  ll gcnt = count(ALL(S), 'G');
  ll bcnt = count(ALL(S), 'B');
  ll ans = rcnt*gcnt*bcnt;
  int tmp = 0;
  REP(i,N-2) {
    FOR(j,i+1,N-1) {
      int k = j+(j-i);
      if (k > N-1) break;
      if (S[i]!=S[j] && S[j]!=S[k] && S[k]!=S[i]) tmp++;
    }
  }
  OUT(ans-tmp);

  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>
#include <numeric>
#include <iomanip>
#include <cstring> 
using namespace std;
using ll=long long;

#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define LLONG_MAXs 9223372036854775800

#include <iostream>
#include <cmath>
using namespace std;
 

 
bool isPrimeNum( ll x ){ // 素数である場合 true を返す
  if( x <= 1 ){ // 1以下である場合は素数でないことがすぐにわかる
    return false;
  }
  // sqrt( double型 ) は引数の平方根を double型で返すので、int型でキャスト
  int n = (int)sqrt( (double)x );
  for( int i = 2; i <= n; i++ ){
    if( x % i == 0 ){ // 割り切る整数がある場合、即判定終了
      return false;
    }
  }
  return true; // 割り切る整数がない場合、素数である
}

constexpr ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
constexpr ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll abs(ll a,ll b){
if(a>=b)return a-b;
if(a<b)return b-a;
}
constexpr ll min(ll a,ll b){
if(a>=b)return b;
if(a<b)return a;
}

constexpr ll max(ll a,ll b){
if(a>=b)return a;
if(a<b)return b;
}

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

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main() {
  ll N;
  cin>>N;
  ll tmp[5]={};
  ll ans=0;
  FOR(i,0,N-1){
    string S;
    cin>>S;

    if(S[0]=='M')tmp[0]++;
    if(S[0]=='A')tmp[1]++;
    if(S[0]=='R')tmp[2]++;

    if(S[0]=='C')tmp[3]++;
    if(S[0]=='H')tmp[4]++;
  }
  ans=tmp[0]*tmp[1]*tmp[2]+
  tmp[0]*tmp[1]*tmp[3]+
  tmp[0]*tmp[1]*tmp[4]+
  tmp[0]*tmp[2]*tmp[3]+
  tmp[0]*tmp[2]*tmp[4]+
  tmp[0]*tmp[3]*tmp[4]+
  tmp[1]*tmp[2]*tmp[3]+
  tmp[1]*tmp[2]*tmp[4]+
  tmp[1]*tmp[3]*tmp[4]+
  tmp[2]*tmp[3]*tmp[4];

  cout<<ans<<endl;
  return 0;


 
}
 


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
                int b = sc.nextInt();
               
                if (a%3==0 || b%3==0 || (a+b)%3==0){
                        System.out.println("Possible");
                }
                else{
                        System.out.println("Impossible");
                }
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <cstdint>
#include <vector>

template <std::uint_fast64_t Modulus> class modint {
    using u64 = std::uint_fast64_t;

public:
    u64 a;

    constexpr modint(const u64 x = 0) noexcept : a(x% Modulus) {}
    constexpr u64& value() noexcept { return a; }
    constexpr const u64& value() const noexcept { return a; }
    constexpr modint operator+(const modint rhs) const noexcept {
        return modint(*this) += rhs;
    }
    constexpr modint operator-(const modint rhs) const noexcept {
        return modint(*this) -= rhs;
    }
    constexpr modint operator*(const modint rhs) const noexcept {
        return modint(*this) *= rhs;
    }
    constexpr modint operator/(const modint rhs) const noexcept {
        return modint(*this) /= rhs;
    }
    constexpr modint& operator+=(const modint rhs) noexcept {
        a += rhs.a;
        if (a >= Modulus) {
            a -= Modulus;
        }
        return *this;
    }
    constexpr modint& operator-=(const modint rhs) noexcept {
        if (a < rhs.a) {
            a += Modulus;
        }
        a -= rhs.a;
        return *this;
    }
    constexpr modint& operator*=(const modint rhs) noexcept {
        a = a * rhs.a % Modulus;
        return *this;
    }
    constexpr modint& operator/=(modint rhs) noexcept {
        u64 exp = Modulus - 2;
        while (exp) {
            if (exp % 2) {
                *this *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return *this;
    }
};

using Mint = modint<1000000007>;

constexpr Mint mpow(Mint a, int n) {
    Mint res = 1;

    int exp = n;
    while (exp) {
        if (exp % 2) {
            res *= a;
        }
        a *= a;
        exp /= 2;
    }
    return res;
}

template<typename F>
constexpr decltype(auto) fix(F&& f) {
    return[f = std::forward<F>(f)](auto&&... args) {
        return f(f, std::forward<decltype(args)>(args)...);
    };
}

int main() {
    int n, k;
    std::cin >> n >> k;

    std::vector memo(k + 1, -1);
    memo[1] = 1;

    auto count = fix([&](auto f, int m) -> Mint {
        if (memo[m] != -1)
            return memo[m];

        Mint res = mpow(m, n);
        for (int i = 2; i <= m; ++i) {
            if (i > m / 2) {
                res -= m - i + 1;
                break;
            }

            res -= f(f, m / i);
        }

        memo[m] = res.a;
        return res;
    });

    Mint ans = 0;
    for (int i = 1; i <= k; ++i)
        ans += count(k / i) * i;

    std::cout << ans.a << std::endl;
}


Measured memory_bytes: 3752
#include "bits/stdc++.h"
#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl
using namespace std;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
#define vpsi vector<pair<string, int>>
#define pb push_back
template<class T> void print(const T& x){cout << x << endl;}
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
typedef long long ll;
const int inf = 1000000001;
const ll INF = 1e18 * 4;

bool f(psi p1, psi p2){
    if(p1.first == p2.first){
        return p1.second > p2.second;
    }
    return p1.first < p2.first;
}

int main(){
    int N; cin >> N;
    vpsi v;
    map<psi, int> m;
    rep(i, 0, N){
        string s; int j;
        cin >> s >> j;
        v.pb({s, j});
        m[make_pair(s, j)] = i;
    }
    sort(v.begin(), v.end(), f);
    rep(i, 0, N){
        cout << ++m[v[i]] << endl;
    }

    return 0;
}




Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#include <cctype>
#include <locale>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<long long,long long> Pll;
#define fout(num) cout << fixed << setprecision(20) << (num) << endl
//s[i]=tolower(s[i]); islower(s[i]); cout << tolower(s[i])はバグ
//vector<vector<ll>> dp(n,vector<ll>(n))
//exist x map o setconst ll MOD = 1e9+7;return fac[n]*(finv[k]*finv[n-k] % MOD) % MOD;

signed main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n; cin >> n;
    string s; cin >> s;
    int r[n],w[n];
    r[0]=0;
    if(s[0]=='W')r[0]++;
    w[n-1]=0;
    if(s[n-1]=='R')w[n-1]++;
    
    for(int i=1;i<n;i++){
        r[i]=r[i-1];
        if(s[i]=='W'){
            r[i]++;
        }
    }
    for(int i=n-2;i>=0;i--){
        w[i]=w[i+1];
        if(s[i]=='R'){
            w[i]++;
        }
    }
    int ans=n;
    rep(i,n-1){
        chmin(ans,max(r[i],w[i+1]));
    }
    bool ok=1;
    rep(i,n-1){
        if(s[i]=='W'&&s[i+1]=='R') ok=0;
    }
    if(ok)ans=0;
    chmin(ans,r[n-1]);
    chmin(ans,w[0]);
    int b=0,c=0;
    rep(i,n){
        if(s[i]=='W')b++;
        else c++;
    }
    chmin(ans,n-b);
    chmin(ans,n-c);
    cout<<ans<<endl;
}



Measured memory_bytes: 5324
#include <iostream>
#include <iomanip>
#include <vector>

using namespace std;

// dp[i][j] := i番目までみたときに,約数の個数がjとなるような数の個数
int dp[100][100];
vector<int> prime;
int pfact[100];

void make_prime()
{
  for (int i = 2; i <= 100; i++) {
    bool flag = true;
    for (int j = 2; j * j <= i; j++) {
      if (i % j == 0) {
        flag = false;
        break;
      }
    }
    if (flag) prime.push_back(i);
  }
}

void prime_factor(int n)
{
  for (int i = 0; i < prime.size(); i++) {
    while (n % prime[i] == 0) {
      n /= prime[i];
      pfact[i]++;
    }
  }
}

int main()
{
  make_prime();
  
  int N; cin >> N;
  for (int i = 2; i <= N; i++) {
    prime_factor(i);
  }

  /*for (int i = 0; i < prime.size(); i++) {
    cout << pfact[i] << endl;
  }*/

  dp[0][1] = 1;
  for (int i = 0; i < prime.size(); i++) {
    for (int j = 1; j <= 75 ; j++) {
      for (int e = 0; e <= pfact[i]; e++) {
        if (j * (e + 1) < 100) {
          /*cout << "(" << i << " + " << j << "), "
               << "(" << (i + 1) << " + " << (e + 1) << ")" << endl;*/
          dp[i + 1][j * (e + 1)] += dp[i][j];
        }
      }
    }
  }

  /*for (int i = 0; i < prime.size(); i++) {
    for (int j = 0; j <= 75; j++) {
      cout << setw(3) << dp[i][j] << ' ';
    }
    cout << endl;
  }*/
  cout << dp[prime.size()][75] << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define LEN(x) (int)x.size()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

constexpr const int N_MAX = 100010;
constexpr const int sqrtN = (int)sqrt(N_MAX);

int N, K;
int a[N_MAX];
int b[N_MAX / sqrtN + 1];

void build()
{
  for (int i = 1; i <= N; ++i) {
    b[i / sqrtN] = __gcd(b[i / sqrtN], a[i]);
  }
}

int query(int l, int r)
{
  int ret = 0;
  while(l < r && l % sqrtN != 0) ret = __gcd(ret, a[l++]);
  while(l < r && r % sqrtN != 0) ret = __gcd(a[--r], ret);

  for (int i = l/sqrtN; i < r/sqrtN; ++i) {
    ret = __gcd(ret, b[i]);
  }

  return ret;
}

signed main()
{
  cin >> N;
  K = (N + sqrtN - 1) / sqrtN;

  for (int i = 1; i <= N; ++i) {
    cin >> a[i];
  }

  build();

  int maxv = 0;
  for (int i = 1; i <= N; ++i) {
    chmax(
        maxv,
        __gcd(query(1, i), query(i+1, N+1))
    );
  }

  cout << maxv << endl;


  return 0;
}



Measured memory_bytes: 640
import java.io.*
import java.util.*

fun main(args: Array<String>) {
    val inputStream = System.`in`
    val outputStream = System.out
    val inp = Main.InputReader(inputStream)
    val out = PrintWriter(outputStream)
    val solver = Main.TaskA()
    solver.solve(inp, out)
    out.close()
}

class Main {
    internal class TaskA {
        fun solve(inp: InputReader, out: PrintWriter) {
            val a = inp.nextInt()
            out.println(a * a)
        }
    }

    internal class InputReader(stream: InputStream) {
        private var reader: BufferedReader = BufferedReader(InputStreamReader(stream), 32768)
        private var tokenizer: StringTokenizer? = null

        init {
            tokenizer = null
        }

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

        fun nextInt(): Int {
            return Integer.parseInt(next())
        }

        fun nextLong(): Long {
            return next().toLong()
        }
    }
}


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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;

int main(){
  ll n,d;
  cin >> n >> d;

  int ans=0;

  rep(i,n){
    ll x,y;
    cin >> x >> y;
    if(x*x+y*y<=d*d) ans++;
  }

  cout << ans;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

template<class T> inline bool chmax( T &a, const T &b ) { return b>a ? a=b,true : false; }
template<class T> inline bool chmin( T &a, const T &b ) { return b<a ? a=b,true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template<class T, class F=less<T>> void sort_uniq( vector<T> &v, F f=F() ) {
    sort(begin(v),end(v),f);
    v.resize(unique(begin(v),end(v))-begin(v));
}

const int MAX_N = 2e5+10;
LL A[MAX_N];
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string S;
    int n, p;
    cin >> n >> p;
    cin >> S;

    for(int i=0; i<n; i++) {
        A[i] = (S[i] - '0');
    }

    map<int, LL> mp;
    LL s = 0;
    LL ans = 0;
    if(p == 2 || p == 5) {
        for(int i=0; i<n; i++) {
            if(A[i]%p==0) ans += i+1;
        }
    } else {
        for(int i=n-1, d=1; i>=0; i--, d=d*10%p) {
            (s = s + A[i]*d) %= p;
            if(mp.count(s)) {
                ans += mp[s];
            }
            mp[s]++;
            if(s==0) ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main(){
  int h,w;
  cin >> h >> w;
  rep(i,h){
    string s;
    cin >> s;
    cout << s << endl << s << endl;
  }
}

Measured memory_bytes: 3596
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
const int MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int solve(int n, int m, vector<vector<int>> &a){
    vector<int> sports(m, 0);
    int count[m];
    int min_ans = INF;
    int max_num;
    int max_itr;
    for(int loop = 0; loop < m; ++loop){
        for (int i=0; i<m; ++i){
            count[i] = 0;
        }
        for (int i=0; i<n; ++i){
            for (int j=0; j<m; ++j){
                if(sports[a[i][j]] == 0){
                    count[a[i][j]]++;
                    break;
                }
            }
        }
        max_num = -1;
        max_itr = -1;
        for (int i=0; i<m; ++i){
            if(max_num < count[i]){
                max_num = count[i];
                max_itr = i;
            }
        }
        min_ans = min(min_ans, max_num);
        sports[max_itr] = 1;
        debugpair(min_ans, max_itr+1);
    }
    return min_ans;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> a(n);
    for (int i=0; i<n; ++i){
        a[i].resize(m);
        for (int j=0; j<m; ++j){
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    int ans = solve(n, m, a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
using Graph = vector<vector<int>>;
ll mypow(ll x, ll n, ll m) {
	if (n == 0) {
		return 1;
	}
	if (n % 2 == 0) {
		return mypow(x*x%m, n / 2, m);
	}
	else {
		return x * mypow(x, n - 1, m) % m;
	}
}
long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
//テーブルをつくる前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;//mod pにおける1,2,,,nの逆元
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i%INF;
		inv[i] = INF - inv[INF%i] * (INF / i) % INF;
		finv[i] = finv[i - 1] * inv[i] % INF;
	}
}

ll COM(int n, int k) {
	if (n < k)return 0;
	if (n < 0 || k < 0)return 0;
	return fac[n] * (finv[k] * finv[n - k] % INF) % INF;
}
///////////////////////////////////////
ll PowMod_RepeatSquaring(ll N, ll P, ll M) {
	if (P == 0)return 1;
	if (P % 2 == 0) {
		ll t = PowMod_RepeatSquaring(N, P / 2, M);
		return t * t%M;
	}
	return N * PowMod_RepeatSquaring(N, P - 1, M);
}
int main() {
	ll N; cin >> N;
	ll K; cin >> K;
	COMinit();
	ll key = 0;
	vector<ll>sum, SUM;
	sum.push_back(0);
	SUM.push_back(N);
	REP(i, N + 1) {
		sum.push_back(sum[i] + (i + 1));
	}
	REP(i, N+1) {
		SUM.push_back(SUM[i] + (N - 1 - i));
	}
	for (int i = K; i <= N+1;++i) {
		key += (SUM[i - 1] - sum[i - 1] + 1);
		key %= INF;
	}
	cout << key << endl;
	return 0;
}


Measured memory_bytes: 19856
//
// Created by kuroneko on 2019-09-28.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>

using namespace std;

typedef long long ll;

#define INF 1000000000000009LL
#define MOD 1000000007LL

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight):src(src), dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
    int N, K; cin >> N >> K;
    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];
    sort(a.rbegin(), a.rend());

    int res = 0;
    for (int i = 0; i < N; i++) {
        if (a[i] >= K) res++;
        else break;
    }

    cout << res << endl;
    return 0;


}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <array>
#include <tuple>
#include <random>

using namespace std;
typedef long long int ll;

#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = int(a); i < int(b); i++)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep,)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()

#define inf 10000000000

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

    ll n, m;
    cin >> n >> m;
    cout << (n - 1) * (m - 1) << endl;
}


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

using namespace std;

int main(){
	ios_base::sync_with_stdio(false); 
  cin.tie(NULL); cout.tie(NULL); 

  int n, k;
  cin >> n >> k;

  if(k == 1) {
    cout << 0;
  }
  else cout << n - k;

  return 0;
}

Measured memory_bytes: 256
//compiledef
#include <bits/stdc++.h>
#define rep(i, n) for(i=0;i<(n);i++)
#define per(i, n) for(i=(n);i>0;i--)
#define repx(i, n, x) for(i=(x);i<(n);i++)
#define xper(i, n, x) for(i=(n);i>(x);i--)
#define pback push_back

//c++def
using namespace std;
typedef long long int ll;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
bool isprime(int n){
	int x=3;

	if(n==2) return true;
	if(n%2 == 0 || n ==1){
		return false;
	}
		while(x <=(int)sqrt(n)){
			if(n%x ==0) return false;
			x +=2;
		}
	return true;
}
int main(){
	int i;
	int x;
	int n;
	int ans = 0;
	cin >> n;
	rep(i, n){
		cin >> x;
		if(isprime(x)) ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 3100
#include"bits/stdc++.h"

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<LL> PQ_DESC;
typedef priority_queue<LL, VL, greater<LL>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL n,m;cin>>n>>m;
    VVL x(n);
    REP(i,n){
        x[i].resize(2);
        cin>>x[i][0]>>x[i][1];
    }

    SORT_ASC(x);

    LL money = 0;
    LL bin = 0;
    REP(i,n){
        if(bin+x[i][1] >= m){
            LL buy = m-bin;
            money += x[i][0]*buy;
            break;
        }
        money += x[i][0] * x[i][1];
        bin += x[i][1];
    }
    cout<<money<<endl;




    
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
    return 0;
}

Measured memory_bytes: 8744
import sys
n = int(input())
m = int(input())
cost = [[float("inf")] * n for _ in range(n)]
for _ in range(m):
    a, b, c, d = map(int, sys.stdin.readline().split(","))
    cost[a - 1][b - 1] = c
    cost[b - 1][a - 1] = d
s, g, V, P = map(int, sys.stdin.readline().split(","))

for k in range(n):
    for i in range(n):
        c_ik = cost[i][k]
        for j, (c_kj, c_ij) in enumerate(zip(cost[k], cost[i])):
            temp = c_ik + c_kj
            if c_ij > temp:
                cost[i][j] = temp

print(V - P - cost[s - 1][g - 1] - cost[g - 1][s - 1])



Measured memory_bytes: 5632
import java.util.*;

class Main {
	static final int MAX = Integer.MAX_VALUE / 2;
	Scanner sc;
	int N, M, L;
	int[][] C;
	List<Integer>[] to;
	int[] s, t;
	int Q;
	int[] cnt, r;
	List<Integer> que;
	int[][] ans;
	
	public Main() {
		sc = new Scanner(System.in);
		que = new ArrayList<>();
	}
	
	@SuppressWarnings("unchecked")
	private void calc() {
		N = sc.nextInt();
		M = sc.nextInt();
		L = sc.nextInt();
		C = new int[N][N];
		cnt = new int[N];
		r = new int[N];
		to = new List[N];
		for (int i = 0; i < N; i++) to[i] = new ArrayList<>();
		for (int i = 0; i < M; i++) {
			int A = sc.nextInt()-1;
			int B = sc.nextInt()-1;
			to[A].add(B);
			to[B].add(A);
			C[A][B] = sc.nextInt();
			C[B][A] = C[A][B];
		}
		Q = sc.nextInt();
		s = new int[Q];
		t = new int[Q];
		for (int i = 0; i < Q; i++) {
			s[i] = sc.nextInt()-1;
			t[i] = sc.nextInt()-1;
		}
		ans = new int[N][N];
		for (int i = 0; i < N; i++) solve(i);
		for (int i = 0; i < Q; i++) {
			int a = ans[s[i]][t[i]];
			System.out.println( (a>=MAX)?-1:a );
		}
	}
	
	private void solve(int s) {
		Arrays.fill(cnt, MAX);
		Arrays.fill(r, 0);
		que.clear();
		cnt[s] = 0;
		r[s] = L;
		for (int i = 0; i < N; i++) que.add(i);
		while (!que.isEmpty()) {
			int u = -1;
			int minr = -1;
			int minc = MAX;
			for (int n : que) {
				if (cnt[n] < minc || (cnt[n]==minc && r[n]>minr)) {
					u = n; minr = r[n]; minc = cnt[n];
				}
			}
			que.remove(Integer.valueOf(u));
			for (int v : to[u]) {
				int c = cnt[u];
				int re = r[u];
				if (C[u][v] > L) c = MAX;
				else if (re < C[u][v]) { c++; re = L - C[u][v]; }
				else re -= C[u][v];
				if (cnt[v] < c || (cnt[v]==c && r[v]>=re)) continue;
				cnt[v] = c;
				r[v] = re;
			}
		}
		for (int i = 0; i < N; i++)
			if (i != s) ans[s][i] = ans[i][s] = cnt[i];
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 93864
from collections import deque
H,W = map(int,input().split())
S= [[0]* W for _ in range(H)]
for i in range(H):
  S[i] = list("".join(input()))

def BFS(i,j):
  v= deque([[i,j]])
  d= [[-1 for _ in range (W)] for _ in range(H)]
  d[i][j]=0
  
  while len(v)>0:
    a=v.popleft()
    s=a[0]
    t=a[1]
    if s>0:
      if d[s-1][t]==-1 and S[s-1][t]==".":
        d[s-1][t]= d[s][t]+1
        v.append([s-1,t])
    if s<H-1:
      if d[s+1][t]==-1 and S[s+1][t]==".":
        d[s+1][t]= d[s][t]+1
        v.append([s+1,t])
    if t>0:
      if d[s][t-1]==-1 and S[s][t-1]==".":
        d[s][t-1]= d[s][t]+1
        v.append([s,t-1])
    if t<W-1:
      if d[s][t+1]==-1 and S[s][t+1]==".":
        d[s][t+1]= d[s][t]+1
        v.append([s,t+1])
  maxi=0
  for i in range(H):
    for j in range(W):
      maxi=max(maxi,d[i][j])
  #print(d)
  return maxi

ans=0
for i in range(0,H):
  for j in range(0,W):
    if S[i][j]==".":
      ans=max(ans,BFS(i,j))
print(ans)
#BFS(H-1,W-1)

Measured memory_bytes: 3316
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e5 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int x;
	cin >> x;
	while (x != (x & -x)) x -= x & -x;
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 384