akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#define YES "YES"
#define NO "NO"
#define Yes "Yes"
#define No "No"
#define DEFAULT LL ans=solve();\
 	if(ans==NONE){\
 	}else{\
 		cout << ans << endl;\
 	}
#define YESNO three(solve(),OUT(YES),OUT(NO))
#define YesNo three(solve(),OUT(Yes),OUT(No))
#define ECHO OUT(solve())
#define three(A,B,C) ((A)?(B):(C))
#define FOR(i,a,b)  for(LL i=(a);i< (LL)(b);i++)
#define EFOR(i,a,b) for(LL i=(a);i<=(LL)(b);i++)
#define RFOR(i,a,b) for(LL i=(b-1);i>=(LL)(a);i--)
#define REP(i,b) FOR(i,zero,b)
#define rep REP
#define EREP(i,b) EFOR(i,zero,b)
#define RREP(i,b) RFOR(i,zero,b)
#define ALL(c) c.begin(),c.end()
#define UNIQUE(c) sort(ALL(c));c.erase(unique(ALL(c)),c.end())
#define MAX(c) (*max_element(ALL(c)))
#define MIN(c) (*min_element(ALL(c)))
#define MP make_pair
#define FI first
#define SE second
#define SI(x) (LL(x.size()))
#define PB push_back
#define DEBUG(a) OUT(a)
#define DEBUG2(a,b) OUT2(a,b)
#define cat cout << __LINE__ << endl
#define OUT(a) cout << (a) << endl
#define OUT2(a,b) cout << (a) <<" "<<(b) << endl
#define zero 0LL
#define all ALL
#define pb emplace_back
#define eb pb
#define int long long
using namespace std;
template<typename T> inline void maximize(T &a, T b) { a = max(a, b); }
template<typename T> inline void minimize(T &a, T b) { a = min(a, b); }
template<typename T> inline bool middle(T a, T b, T c) { return b <= a && a <= c; }
template<class T> inline bool MX(T &l, const T &r) { return l < r ? l = r, 1 : 0; }
template<class T> inline bool MN(T &l, const T &r) { return l > r ? l = r, 1 : 0; }
typedef int LL;
typedef double ld;
typedef int ut;
typedef vector<ut> VI;
typedef vector<VI> VII;
typedef pair<ut, ut> pr;
typedef pair<ut, pr> ppr;
typedef vector<pr> Vpr;
typedef vector<ppr> Vppr;
typedef tuple<int, int, int, int> tapu;
typedef vector<tapu> Vtapu;
typedef priority_queue<pr, Vpr > PQ;
inline void outputVI(VI x) { REP(i, SI(x)) { cout << three(i, " ", "") << x[i]; }OUT(""); }
const int SIZE1 = 5e5 + 1000;
const int SIZE2 = 2010;
const int SIZE3 = 430;
const int SIZE = SIZE1;
const int MAPSIZE = 40;
const LL p = 998244353;
const LL INF = 1LL << 60;
const long double EPS = 1e-7;
const LL NONE=-2;
#define endl "\n"
ut N, M,K,  Q, D, H, W;
VI edges[SIZE];
LL vals[SIZE], answer = zero;
LL A[SIZE],B[SIZE],C[SIZE];
LL DP[SIZE];
LL last[SIZE];
bool able[SIZE];
LL solve(){
	cin >> N;
	DP[0]=true;
	EFOR(i,0,N){
		EFOR(j,100,105){
			DP[i+j]|=DP[i];
		}
	}
	return DP[N];
	return NONE;
}
 signed main() {
 
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	string s;
	LL T;
	DEFAULT;
	
	
//	YesNo;
//	YESNO;
//	three(solve(),OUT("First"),OUT("Second"));
	//cin >> N;
	return 0;
 
}


Measured memory_bytes: 15488
#include <bits/stdc++.h>
using namespace std;
int64_t MOD = 1000000007;
int64_t DP[100][3][3]; // n, top, down (R, G, B)

int main()
{
  int64_t N, ans = 0;
  string f, s;
  cin >> N >> f >> s;
  for (int n = 0; n < N; n++)
  {
    if (f.at(n) == s.at(n)) // 縦に置かれている場合
    {
      if (n)
      {
        for (int i = 0; i < 3; i++)
        {
          for (int j = 0; j < 3; j++)
          {
            if (i != j)
            {
              DP[n][i][j] = 0;
              continue;
            }
            int64_t x = 0;
            for (int k = 0; k < 3; k++)
            {
              for (int m = 0; m < 3; m++)
              {
                if (k != i && m != i)
                {
                  x = (x + DP[n - 1][k][m]) % MOD;
                }
              }
            }
            DP[n][i][j] = x;
          }
        }
      }
      else
      {
        for (int i = 0; i < 3; i++)
        {
          for (int j = 0; j < 3; j++)
          {
            if (i != j)
              DP[0][i][j] = 0;
            else
              DP[0][i][j] = 1;
          }
        }
      }
    }
    else // 横に置かれている場合
    {
      if (n)
      {
        for (int i = 0; i < 3; i++)
        {
          for (int j = 0; j < 3; j++)
          {
            if (i == j)
            {
              DP[n][i][j] = 0;
              DP[n + 1][i][j] = 0;
              continue;
            }
            int64_t x = 0;
            for (int k = 0; k < 3; k++)
            {
              for (int m = 0; m < 3; m++)
              {
                if (k == m)
                {
                  if (k != i && k != j)
                  {
                    x += DP[n - 1][k][m];
                  }
                }
                else
                {
                  if (i != k && j != m)
                  {
                    x += DP[n - 1][k][m];
                  }
                }
              }
            }
            DP[n][i][j] = x;
            DP[n + 1][i][j] = x;
          }
        }
      }
      else
      {
        for (int i = 0; i < 3; i++)
        {
          for (int j = 0; j < 3; j++)
          {
            if (i == j)
            {
              DP[n][i][j] = 0;
              DP[n + 1][i][j] = 0;
            }
            else
            {
              DP[n][i][j] = 1;
              DP[n + 1][i][j] = 1;
            }
          }
        }
      }
      n++;
    }
  }
  for (int i = 0; i < 3; i++)
  {
    for (int j = 0; j < 3; j++)
    {
      ans = (ans + DP[N - 1][i][j]) % MOD;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007
#define INF 10000000000000000LL

ll dp[100010];

int main() {
	ll n,a,b;
	cin>>n>>a>>b;
	rep(i,0,100010){
		dp[i] = INF;
	}
	dp[0] = 0;
	ll now;
	cin>>now;
	rep(i,1,n){
		ll l;
		cin>>l;
		ll d = l-now;
		dp[i] = min(dp[i-1]+d*a,dp[i-1]+b);
		now = l;
	}
	printf("%lld\n",dp[n-1]);
	return 0;
}

Measured memory_bytes: 1024
enemyNum,hissatsu = map(int, input().split())
point = input().split()
point = sorted(point, key = int)
count = 0
if enemyNum - hissatsu <= 0:
  print(0)
else:
  for i in range(enemyNum - hissatsu):
    count += int(point[i])
  print(count)

Measured memory_bytes: 29428
import java.util.*;

class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
      	long a = sc.nextLong();
      	long b = sc.nextLong(); 
      
      	System.out.println(lcm(a, b));
    }
  	
  	public static long lcm(long a, long b) {
    	long g = gcd(a, b);
      	return g * (a / g) * (b / g);
    }
  
  	public static long gcd(long a, long b) {
    	if (a > b) {
        	long tmp = a;
          	a = b;
          	b = tmp;
        }
      	if (a == 0) { return b; }
      	return gcd(b % a, a);
    }
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;
const double INF = 1e9;
const double eps = 1e-6;

int main(){
  int n, k;
  cin >> n >> k;
  ll a[n];
  rep(i,n) cin >> a[i];
  ll l = 0, r = INF;
  while(r-l > 1) {
    ll m = (l+r) / 2;
    ll val = 0;
    rep(i,n) {
      val += a[i]/m;
      if(a[i] % m == 0) val--;
    }
    if(val <= k) r = m;
    else l = m;
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 5116
#include<stdio.h>
int main()
{
	long long int n, x;
	scanf("%lld %lld", &n, &x);
	long long int i, j;
	long long int a[2003];
	for (i = 0; i < n; i++)
		scanf("%lld", &a[i]);
	long long int min[2003][2003];
	for (i = 0; i < n; i++)
	{
		min[i][0] = a[i];
		for (j = 1; j < n; j++)
		{
			if (min[i][j - 1] > a[(i - j + n) % n])
				min[i][j] = a[(i - j + n) % n];
			else
				min[i][j] = min[i][j - 1];
		}
	}
	long long int ans = 1000000000000000018, v;
	for (i = 0; i < n; i++)
	{
		v = i * x;
		for (j = 0; j < n; j++)
			v += min[j][i];
		if (ans > v)
			ans = v;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 31488
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <vector>

//#define PI 3.141592653589

using namespace std;

map<char, bool> cup;


int main()
{
	char cup1, cup2;
	bool temp;
	
	cup['A'] = true;
	cup['B'] = false;
	cup['C'] = false;
	
	while (~scanf("%c,%c\n", &cup1, &cup2))
	{
		//cout << cup1 << " " << cup2 << endl;
		temp = cup[cup1];
		cup[cup1] = cup[cup2];
		cup[cup2] = temp;
	}
	if (cup['A']) cout << "A" << endl;
	if (cup['B']) cout << "B" << endl;
	if (cup['C']) cout << "C" << endl;
	
	return 0;
}

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

bool isAC(const string &S) {
    if (S[0] != 'A') return false;

    int cnum = 0; // S の 3 文字目と末尾から 2 文字目の間の 'C' の個数
    bool exist = false; // S の先頭を除いた文字列が 'C' 以外の大文字を含むか

    // for 文の添字 i は、予め先頭 (0 文字目) を除外して 1 始まりとする
    for (int i = 1; i < S.size(); ++i) {
        // i が 3 文字目から末尾から 2 文字目の間の範囲にあるときを調べる
        if (i >= 2 && i + 1 < S.size() && S[i] == 'C') ++cnum;

        // 'C' 以外の大文字であるかどうか
        if (S[i] >= 'A' && S[i] <= 'Z' && S[i] != 'C') exist = true;
    }

    if (cnum != 1) return false;
    if (exist) return false;

    return true;
}

int main() {
    string S;
    cin >> S;
    if (isAC(S)) cout << "AC" << endl;
    else cout << "WA" << endl;
}

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

#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define ll long long
#define bit __builtin_popcountll
#define sqr(x) (x) * (x)
#define forit(it,S) for(__typeof((S).begin()) it = (S).begin(); it != (S).end(); it++)
#define debug(x) cout << #x <<" = " << x << endl
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define printvpair(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i].first  <<" " << v[i].second << endl;
#define printv(v) for(int i = 0 ; (i) < (v.size()) ; ++i) cout << v[i] << " "; cout << endl;

using namespace std;

typedef pair<int, int> pii;

const double eps = 1e-9;
const double pi = acos(-1.0);
const int INF = 1000000000;

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

const int N = 100001;
int a[N];
string s[10] = {"gray","brown","green","cyan","blue","yellow","orange","red"};
set<string> ans;
bool used[N];
int main() {
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	forn(i,n) cin >> a[i];
	int mn;
	int c = 0;
	forn(i,n){
		if(a[i] >= 1 && a[i] <= 399)
			ans.insert(s[0]);
		if(a[i] >= 400 && a[i] <= 799)
			ans.insert(s[1]);
		if(a[i] >= 800 && a[i] <= 1199)
			ans.insert(s[2]);
		if(a[i] >= 1200 && a[i] <= 1599)
			ans.insert(s[3]);
		if(a[i] >= 1600 && a[i] <= 1999)
			ans.insert(s[4]);
		if(a[i] >= 2000 && a[i] <= 2399)
			ans.insert(s[5]);
		if(a[i] >= 2400 && a[i] <= 2799)
			ans.insert(s[6]);
		if(a[i] >= 2800 && a[i] <= 3199 )
			ans.insert(s[7]); 
		if (a[i] >= 3200)
			c++;
	}
	
	mn = ans.size();
	
	cout << max(1,mn) <<" " << mn + c << endl;
  	return 0;
}




Measured memory_bytes: 256
n, m = map(int, input().split())
p = 1000000007
if abs(n-m)>1:
	print("0")
else:
	def fact(n, mod):
		ans = 1
		for i in range(1, n+1):
			ans = ans * i % mod
		return ans

	ans = fact(n, p) * fact(m, p) % p
	print(ans*2%p if n==m else ans)

Measured memory_bytes: 3060
n,m=map(int,input().split())
h=list(map(int,input().split()))
ab=[list(map(int,input().split())) for i in range(m)]
h1=list(True for _ in range(n))
for i in range(m):
    if h[ab[i][0]-1]>=h[ab[i][1]-1]:
        h1[ab[i][1]-1]=False
    if h[ab[i][0]-1]<=h[ab[i][1]-1]:
        h1[ab[i][0]-1]=False

print(sum(h1))


Measured memory_bytes: 31972
#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;

vi solve(int h, int a){
	vi res(h + 1);
	res[h] = 1;
	for(int i = h - 1; i > 0; i--) res[i] = i + a > h ? -h : res[i + a] + 1;
	//dbg(res);
	return res;
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int h, w, a, b; cin >> h >> w >> a >> b;
	if(h % a == 0 && w % b == 0){
		cout << "No" << endl;
		return 0;
	}
	cout << "Yes" << endl;
	
	vi s = h % a ? solve(h, a) : solve(w, b);
	vector<vi> ans(h, vi(w));
	
	if(h % a) rep(j, w) rep(i, h) ans[i][j] = s[i + 1] - s[i];
	else rep(i, h) rep(j, w) ans[i][j] = s[j + 1] - s[j];
	
	rep(i, h) rep(j, w) cout << ans[i][j] << (j==w-1?"\n":" ");
	
	return 0;
}

Measured memory_bytes: 2304
/*
オーダー
10**6	余裕を持って間に合う	
10**7	おそらく間に合う	余裕を持って間に合う
10**8	非常にシンプルな処理でない限り厳しい	おそらく間に合う
10**9		非常にシンプルな処理でない限り厳しい
logn	:OK
n		:10^7
nlogn	:10^6
n**2	:10^4
n**3	:300
2**n	:20
n!		:10



// 各桁の和を計算する関数
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

sort(a, a + N, greater<int>());  // a[0:N] を大きい順にソート

int num[110] = {0};  // バケット
for (int i = 0; i < N; ++i) {
    num[d[i]]++;  // d[i] が 1 個増える
}

map<string, int> mp; // 連想配列 map<キー型, 値型> オブジェクト名
for (int i = 0; i < N; ++i) {
    auto itr = mp.find(s[i]);        // s[i] が設定されているか？
    if(itr != mp.end() ) {
         mp[s[i]] += 1;
    }
    else {
         mp[s[i]] += 1 ;
    }
}
stack<int> s;	//intをデータとするスタックを用意
s.push(1);		//{} -> {1}
printf("%d\n", s.top());	// 3
s.pop();

queue<int> que;	//intをデータとするキューを用意
que.push(1);		//{} -> {1}
printf("%d\n", que.front());	// 1
que.pop();
*/

#include <iostream>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <string.h>

using namespace std;

// #define for(i,a,b) for (int i=(a);i<(b);++i)
typedef long long ll;
typedef pair<ll,ll> P;
#define REP(i,n) for(long long i = 0; i < (long long)(n); i++)
#define pb push_back // vectorに要素追加
#define INF (ll)1e18
// int 
// // 各桁の和を計算する関数
// int findSumOfDigits(int n) {
//   int amari = 0;
//   int keta = 0;
//   while (n > 0) { // n が 0 になるまで
//     amari += n % 2;
//     if (keta%2==0)
//     n /= 10;
//   }
//   return sum;
// }
 
ll gcd(ll a, ll b) {
	if(b == 0) return a;
	return gcd(b, a % b);
}

// const ll MAX_N = 1e5;
// ll N;
// ll h[MAX_N];
// ll dp[MAX_N+1]; // メモ化テーブル
 
// // i番目以降の品物から重さの総和がj以下になるように選ぶ
// void rec(ll i){
// 	if (i==0) dp[i] = 0;
// 	else if (i==1) dp[i] = abs(h[1]-h[0]);
// 	else dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
// 	return;
// }
 
// https://cf17-relay-open.contest.atcoder.jp/tasks/relay2_e
int main() {
	// 入力
	ll N,Prob;
	cin >> N>>Prob;
	ll w[N], b[N];
	for (ll i = 0; i < N; ++i) cin >> w[i]>>b[i];
 
	// 解法
	ll tmp = 0; // tmp>=0なら条件が成り立つ
	REP(i,N) tmp += -Prob*b[i];
	ll x[N];
	REP(i,N){
		x[i] = w[i]*(100-Prob) + b[i]*Prob; // 議員iが寝返ることによる差分
	}
	sort(x, x+N, greater<ll>());
	ll ans = 0;
	while (tmp<0){
		tmp += x[ans];
		ans++;
	}
	
	//出力
	cout << ans << endl;
}


Measured memory_bytes: 2560
#include <iostream>
 int main() {
  int S, h, m, s;
   std::cin >> S ;
    h = S/3600;
    m = S%3600/60;
    s = S%3600%60;
      std::cout << h << ":" << m << ":" << s <<std::endl;





 return 0;




}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>
#define FOR(i,k,n)  for(int i = (k);i < (n);++i)
#define REP(i,n)    FOR(i,0,n)
#define ALL(x) begin(x),end(x)

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  int st = 5*5*5;
  vector<vecint> dp(n+1, vecint(st));
  a = min(a, 4);
  b = min(b, 4);
  c = min(c, 4);
  auto id = [](int x, int y, int z) {
    x = min(x, 4);
    y = min(y, 4);
    z = min(z, 4);
    return x*25 + y*5 + z;
  };
  dp[0][id(a,b,c)] = 1;
  vector<string> vq(n);
  REP(i,n) {
    string s;
    cin>>s;
    vq[i] = s;
    REP(j,st) {
      if (!dp[i][j]) continue;
      int x = j / 25;
      int y = (j / 5) % 5;
      int z = j % 5;
      if (s == "AB") {
        if (x == 0 && y == 0) continue;
        if (x <= y) {
          dp[i+1][id(x+1,y-1,z)] = 'A' * st + j;
        }
        if (x >= y) {
          dp[i+1][id(x-1,y+1,z)] = 'B' * st + j;
        }
      } else if (s == "AC") {
        if (x == 0 && z == 0) continue;
        if (x <= z) {
          dp[i+1][id(x+1,y,z-1)] = 'A' * st + j;
        }
        if (x >= z) {
          dp[i+1][id(x-1,y,z+1)] = 'C' * st + j;
        }
      } else {
        if (y == 0 && z == 0) continue;
        if (y <= z) {
          dp[i+1][id(x,y+1,z-1)] = 'B' * st + j;
        }
        if (y >= z) {
          dp[i+1][id(x,y-1,z+1)] = 'C' * st + j;
        }
      }
    }
  }
  int cur = find_if(ALL(dp[n]), [](auto&& x) { return x > 0; }) - begin(dp[n]);
  if (cur == st) {
    cout << "No\n";
    return 0;
  }
  vector<char> res;
  REP(i,n) {
    int j = n-i;
    string s = vq[j-1];
    res.push_back(dp[j][cur] / st);
    cur = dp[j][cur] % st;
  }
  cout<<"Yes\n";
  reverse(ALL(res));
  for(auto&& ch : res) {
    cout<<ch<<"\n";
  }
  return 0;
}


Measured memory_bytes: 59008
#include<bits/stdc++.h>
using namespace std;
char a[5],b[5];
int cnt;
int main(){
	scanf("%s%s",a,b);
	for(int i=0;i<3;i++){
		if(a[i]==b[i])cnt++;
	}
	printf("%d",cnt);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fr first
#define se second
#define r_0 return 0
#define ll long long
#define pb push_back
using namespace std;
 
const long long INF = 1e7;
const long long N = 1e5+ 7;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
 
long double a, n, b, c = 1, d , cnt , m , ans;
string s , s1 , s2;
set<int>st;
ll used[N];
vector<int>v;
int main()
{
   /// freopen("symposium.in" ,"r" ,stdin);
///freopen("symposium.out" , "w" ,  stdout);
    ios_base::sync_with_stdio(0);
cin >> n;
for( int i=  0;i < n;i++ )
    cin >> a , st.insert(a);
if( st.size() == n )
    cout << "YES";
else
    cout << "NO";
}

Measured memory_bytes: 9600
#include <iostream>

using namespace std;

int main()
{
		int N;
		cin >> N;
		int max = 0;
		int result = 1;
		for(int i = 1; i <= N; i++)
		{
				int temp = i;
				int count = 0;
				while((temp % 2) == 0)
				{
					temp /= 2;
					count++;	
				}
				if(max < count)
				{
						max = count;
						result = i;
				}
		}
		cout << result << endl;
		return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<stdio.h>
using namespace std;
int aa(string s,int i,int n){
    int alpha[26],alpha2[26];
    for(int i=0;i<26;i++){
        alpha[i]=0;
        alpha2[i]=0;
    }
    for(int j=0;j<=i;j++){
        int a=s[j]-'a';
        alpha[a]++;
    }
    for(int j=i+1;j<n;j++){
        int a=s[j]-'a';
        alpha2[a]++;
    }
    int a=0;
    for(int i=0;i<26;i++){
        if(alpha[i]!=0&&alpha2[i]!=0){
            a++;
        }
    }
        return a;
    
    
}

int main(){
   /* int n;
    string s;
    cin>>n>>s;
    
    int max=0;
    int premax=0;
    for(int i=0;i<=n;i++){
        
            int max=aa(s,i,n);
            
        if(premax<=max){
            premax=max;
        }
        
        
    }
    cout<<premax;*/
    
    
   int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i <= s.size(); i++) {
        int cnt = 0;
        for (char c = 'a'; c <= 'z'; c++) {
            if (s.rfind(c, i) != -1 && s.find(c, i + 1) != -1)
                cnt++;
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    /*string s="abcde";
    std::string::size_type n;
    n=s.rfind("a",2);
    cout<<n<<endl;*/
return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#define MAXN 100010
int gcd(int a,int b)
{
	while(b)
	{
		int t=a;a=b;b=t%b;
	}
	return a;
}
int n,a[MAXN];
bool dfs()
{
	int cnt0=0,cnt1=0;
	for(int i=1;i<=n;i++)
		(a[i]&1)?cnt1++:cnt0++;
	if(cnt0&1) return 1;
	if(cnt1>1) return 0;
	for(int i=1;i<=n;i++)
		if(a[i]&1)
		{
			if(a[i]==1) return 0;
			a[i]--;
			break;
		}
	int d=a[1];
	for(int i=2;i<=n;i++)
		d=gcd(a[i],d);
	for(int i=1;i<=n;i++)
		a[i]/=d;
	return !dfs();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	if(dfs()) printf("First\n");
	else printf("Second\n");
}


Measured memory_bytes: 640
object Main {

  def main(args: Array[String]): Unit = {
    val input = io.StdIn.readLine.split(" ")
    val n = input(0).toInt
    println(solve(n))
  }

  private def solve(n: Int): Int ={
    val collection = (1 to n).toList
    def loop(range: List[Int], sum: Int): Int = {
      if (range.isEmpty) sum
      else {
        val head = range.head
        if (head.toString.length % 2 != 0) loop(range.tail, sum + 1)
        else loop(range.tail, sum)
      }
    }
    loop(collection, 0)
  }
}

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

int main(){
	int n,a[100],count=0,add=0;
	int judge[9];
	int min=0,max=0;

	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];

	for(int i=0;i<9;i++)judge[i]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<8;j++)
			if(400*j<=a[i]&&a[i]<400*(j+1)){
				judge[j]=1;
			}
		if(a[i]>=3200){
			judge[8]=1;
			add++;
		}
	}
	for(int i=0;i<8;i++)min+=judge[i];
	max=min+add;
	if(min==0&&judge[8]==1){
		min=1;
		max=add;
	}
	cout<<min<<" "<<max<<endl;
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	
	if ( b > a) {
		cout << c;
	}
	else {
		a -= b;
		if(a>c){
			cout << 0;
		}
		else {
			c -= a;
			cout << c;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);
		 int N = scan.nextInt();
		 int A = scan.nextInt();
		 int B = scan.nextInt();
		 
		 int sum = 0;
		 for (int i = 1; i <= N; i++) {
			 int keta = Integer.toString(i).length();
			 
			 int wk = i,sum_digit = 0;
			 for (int j = keta; j > 0; j--) {
				 sum_digit += wk / (int)(Math.pow(10,j-1));
				 wk = wk % (int)(Math.pow(10,j-1));
			 }
			 
			 if (sum_digit >= A && sum_digit <= B) {
				 sum += i;
			 }
		 }
		 
		 System.out.println(sum);
		 
		 scan.close();

	}

}


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

struct node
{
    int x,y;
} red[105],blue[105];

const int MAXN = 1005;
const int MAXM = 100000;
const int INF = 0x3f3f3f3f;
int N;
struct Edge
{
    int to,next,cap,flow,cost,from;
} edge[MAXM];
int head[MAXN],tol;
int pre[MAXN],dis[MAXN];
bool vis[MAXN];

void addedge(int u,int v,int cap,int cost)
{
    edge[tol].from=u;
    edge[tol].to = v;
    edge[tol].cap=cap;
    edge[tol].cost = cost;
    edge[tol].flow = 0;
    edge[tol].next = head[u];
    head[u] = tol++;
    edge[tol].from=v;
    edge[tol].to = u;
    edge[tol].cap = 0;
    edge[tol].cost = -cost;
    edge[tol].flow = 0;
    edge[tol].next = head[v];
    head[v] = tol++;
}
bool spfa(int s,int t)
{
    queue<int>q;
    for(int i = 0; i <= N; i++)
    {
        dis[i] = INF;
        vis[i] = false;
        pre[i] = -1;
    }
    dis[s] = 0;
    vis[s] = true;
    q.push(s);
    while(!q.empty())
    {
        int u = q.front();
        q.pop();
        vis[u] = false;
        for(int i = head[u]; i != -1; i = edge[i].next)
        {
            int v = edge[i].to;
            //printf("i=%d\n",i);
            //printf("dis[v]=%d dis[u]=%d edge[i].cost=%d cap=%d flow=%d\n",dis[v],dis[u],edge[i].cost,edge[i].cap,edge[i].flow);
            if(edge[i].cap > edge[i].flow && dis[v] > dis[u] + edge[i].cost )
            {
                dis[v] = dis[u] + edge[i].cost;
                pre[v] = i;
                if(!vis[v])
                {
                    vis[v] = true;
                    q.push(v);
                }
            }
        }
    }
    if(pre[t] == -1)
        return false;
    else
        return true;
}
//返回的是最大流，cost 存的是最小费用
int minCostMaxflow(int s,int t,int &cost)
{
    int flow = 0;
    cost = 0;
    while(spfa(s,t))
    {
        int Min = INF;
        for(int i = pre[t]; i != -1; i = pre[edge[i^1].to])
        {
            if(Min > edge[i].cap - edge[i].flow)
                Min = edge[i].cap - edge[i].flow;
        }

        for(int i = pre[t]; i != -1; i = pre[edge[i^1].to])
        {
            edge[i].flow += Min;
            edge[i^1].flow -= Min;
            cost += edge[i].cost * Min;
        }
        flow += Min;
    }
    return flow;
}

int main()
{
    int S,T;
    cin>>N;
    S=0,T=2*N+1;
    memset(head,-1,sizeof(head));
    for(int i=1; i<=N; i++)
    {
        cin>>red[i].x>>red[i].y;
        addedge(i+N,T,1,0);
    }
    for(int i=1; i<=N; i++)
    {
        cin>>blue[i].x>>blue[i].y;
        addedge(S,i,1,0);
    }
    for(int i=1;i<=N;i++)
    {
        for(int j=1;j<=N;j++)
        {
            if(blue[i].x>red[j].x&&blue[i].y>red[j].y)
                addedge(i,j+N,1,0);
        }
    }
    N=2*N+1;
    int co;
    cout<<minCostMaxflow(S,T,co);
    return 0;
}


Measured memory_bytes: 384
import math

inputValue = input()
inputValues = list(map(int,inputValue.split(' ')))

n = inputValues[0]
d = inputValues[1]

count = 0
for i in range(n):
    x, y = list(map(int,input().split(' ')))

    if math.sqrt(pow(x, 2)+pow(y, 2)) <= d:
        count += 1

print(count)


Measured memory_bytes: 9116
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <string>
#include <bitset>
#include <fstream>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
typedef vector<pii> vii;

#define INF 1000000007ll
#define PB push_back
#define MP make_pair
#define X first
#define Y second
#define Min(a,b) (((a) < (b))?(a):(b))
#define Max(a,b) (((a) > (b))?(a):(b))
#define Abs(a) (((a) > 0)?(a):(-1)*(a))
#define cil(a,b) ( ((a)%(b) == 0)?((a)/(b)):((a)/(b)+1) )
#define SIZE 0

int r[10] = {0};
int main() {
   int n, a, mx = 0, mn = 0, cnt = 0;
   cin >> n;
   for (int i = 0 ; i < n ; ++i) {
      cin >> a;
      if (a >= 3200) ++cnt;
      for (int j = 1 ; j < 9 ; ++j) {
         if (a < j*400) {
            r[j]++;
            break;
         }
      }
   }
   for (int i = 1 ; i < 9 ; ++i) {
      if (r[i] != 0) ++mn;
   }
   cout << Max(mn, 1) << " " << mn + cnt << endl;


   return 0;
}

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

ll exp(ll x, ll k, ll mod) {
	if (k == 0)
		return 1;
	if (k%2 == 1)
		return x*exp(x, k-1, mod)%mod;
	ll y = exp(x, k/2, mod);
	return y*y%mod;
}

ll n, m, binom[3005][3005], s[3005][3005], e2[10005], e22[10000005];

int main() {
	cin >> n >> m;
	for (int i = 0; i < 3005; ++i)
		for (int j = 0; j <= i; ++j) {
			if (j == 0)
				binom[i][j] = 1;
			else
				binom[i][j] = (binom[i-1][j] + binom[i-1][j-1])%m;
		}

	e2[0] = 1;
	for (int i = 1; i < 10005; ++i)
		e2[i] = 2*e2[i-1]%(m-1);
	e22[0] = 1;
	for (int i = 1; i < 10000005; ++i)
		e22[i] = 2*e22[i-1]%m;
	
	for (int i = 0; i < 3005; ++i)
		for (int j = 0; j <= i; ++j) {
			if (j == 0) {
				if (i == 0)
					s[i][j] = 1;
				continue;
			}
			s[i][j] = (j*s[i-1][j] + s[i-1][j-1])%m;
		}

	ll ans = 0;

	for (int j = 0; j <= n; ++j) {
		ll mult = 1;
		if (j%2 == 1)
			mult = m-1;
		mult = mult*binom[n][j]%m;
		//everything grouped
		ll x = exp(2, e2[n-j], m);
		for (int k = 0; k <= j; ++k) {
			ans = (ans + mult*s[j][k]%m*x%m*e22[k*(n-j)])%m;
		}
		//some not full group
		for (int k = 1; k <= j; ++k) {
			ans = (ans + mult*s[j][k]%m*k%m*x%m*e22[(k-1)*(n-j)])%m;
		}

		// cout << ans << endl;
	}

	cout << ans << endl;
}


Measured memory_bytes: 219520
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <iomanip>
#include <numeric>
#include <climits>
#include <algorithm>
#include <cstdint>
using namespace std;
 
int main()
{
    int a, b;
    cin >> a >> b;
    if (b % a == 0)
        cout << a+b;
    else cout << b-a;
}

Measured memory_bytes: 3608
import javax.rmi.CORBA.Util;
import java.io.*;
import java.util.*;

public class Main {

    public static void main(String args[]) {
        FastReader sc = new FastReader();
        PrintWriter pw = new PrintWriter(System.out);
        String a, b, c;
        a = sc.next().toUpperCase();
        b = sc.next().toUpperCase();
        c = sc.next().toUpperCase();
        pw.println(a.charAt(0) + "" + b.charAt(0) + "" + c.charAt(0));
        pw.close();
    }


    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 23124
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int par[10010], rk[10010];
void init(int n) {
	for (int i = 0; i < n; i++) {
		par[i] = i;
		rk[i] = 0;
	}
}

int find(int x) {
	if (par[x] == x)return x;
	else
		return par[x] = find(par[x]);
}

void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;

	if (rk[x] < rk[y])
		par[x] = y;
	else {
		par[y] = x;
		if (rk[x] == rk[y])rk[x]++;
	}
}

bool same(int x, int y) {
	return find(x) == find(y);
}

struct edge {
	ll u, v, cost;
};

bool comp(const edge& e1, const edge& e2) {
	return e1.cost < e2.cost;
}


edge es[10010];
int n, m;

ll kruskal() {
	sort(es, es + m, comp);
	init(n);
	ll res = 0;
	for (int i = 0; i < m; i++) {
		edge e = es[i];
		if (!same(e.u, e.v)) {
			unite(e.u, e.v);
			if(e.cost != 0)
			res += (e.cost) / 100 - 1;
		}
	}
	return res;
}

int main()
{
	while (cin >> n, n) {
		cin >> m;
		for (int i = 0; i < m; i++) {
			ll a, b, d;
			scanf("%d,%d,%d", &a, &b, &d);
			es[i].u = a, es[i].v = b, es[i].cost = d;
		}
		cout << kruskal() << endl;
	}
	return	0; 
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF 9223372036854775807

int n,m,l,r,memo[100010],ans;

signed main() {
    cin >> n >> m;
    rep(i,m) cin >> l >> r,memo[l]++,memo[r+1]--;
    rep11(i,n+2) memo[i] += memo[i-1];
    rep(i,n+1) if (memo[i] == m) ans++;
    cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()

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

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

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

    vector<int> a(n);
    rep(i, k){
        int x;
        cin >> x;

        rep(j, x){
            int y;
            cin >> y;
            a[y-1]++;
        }
    }

    int ans = 0;
    rep(i, n){
        if(a[i] == 0)ans++;
    }


    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3656
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

'''

#a = list(map(int, input().split()))

k, n =list(map(int, input().split()))
a = list(map(int, input().split()))

maxim = a[0] + (k-a[n-1])

for i in range(n-1):
    b = a[i+1]-a[i]
    if(maxim<b):
        maxim = b
        
print(k-maxim)











Measured memory_bytes: 103496
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

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

    unordered_map<int, int> m;

    for (int i = 0; i < N; ++i) {
        int Di;
        cin >> Di;
        m[Di]++;
    }

    int M;
    cin >> M;

    for (int i = 0; i < M; ++i) {
        int Ti;
        cin >> Ti;
        m[Ti]--;

        if (m[Ti] < 0) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


Measured memory_bytes: 9596
package main

import (
	"fmt"
	"reflect"
)

type (
	//   1
	// 4 2 3 5
	//   6
	Dice struct {
		face [6]int
	}
)

func (d *Dice) Rotate(direction rune) int {
	switch direction {
	case 'W':
		d.face[0], d.face[2], d.face[5], d.face[3] =
			d.face[2], d.face[5], d.face[3], d.face[0]
	case 'E':
		d.face[0], d.face[2], d.face[5], d.face[3] =
			d.face[3], d.face[0], d.face[2], d.face[5]
	case 'N':
		d.face[0], d.face[1], d.face[5], d.face[4] =
			d.face[1], d.face[5], d.face[4], d.face[0]
	case 'S':
		d.face[0], d.face[1], d.face[5], d.face[4] =
			d.face[4], d.face[0], d.face[1], d.face[5]
	default:
		panic(fmt.Sprintf("Undefind direction: %c", direction))
	}
	return d.Get()
}

func (d *Dice) Roll(direction rune) int {
	switch direction {
	case 'R':
		d.face[3], d.face[1], d.face[2], d.face[4] =
			d.face[1], d.face[2], d.face[4], d.face[3]
	default:
		panic(fmt.Sprintf("Undefined derection: %c", direction))
	}
	return d.Get()
}

func (d *Dice) Get() int {
	return d.face[0]
}

func (d Dice) String() string {
	return fmt.Sprintf(
		`  %d
%d %d %d %d 
  %d
`, d.face[0], d.face[3], d.face[1], d.face[2], d.face[4], d.face[5])
}

func (d1 *Dice) Equal(d2 Dice) bool {
	for i := 0; i < 4; i++ {
		for j := 0; j < 4; j++ {
			for k := 0; k < 4; k++ {
				if reflect.DeepEqual(d1.face, d2.face) {
					return true
				}
				d1.Roll('R')
			}
			d1.Rotate('N')
		}
		d1.Roll('R')
	}
	return false
}

func main() {

	var n int
	fmt.Scan(&n)

	var dices = make([]Dice, 0, n)
	for l := 0; l < n; l++ {
		var dice Dice
		for m := 0; m < len(dice.face); m++ {
			fmt.Scan(&dice.face[m])
		}
		if len(dices) == 0 {
			dices = append(dices, dice)
			continue
		}

		for _, d := range dices {
			if dice.Equal(d) {
				fmt.Println("No")
				return
			}
		}
		dices = append(dices, dice)
	}
	fmt.Println("Yes")
}



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

int main(void) { 
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == ',') cout << " ";
        else cout << s[i];
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#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 <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
//#include <unordered_set> //unordered_set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
//It is so troublesome that I include bits/stdc++.h !
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 long long INF = 10010010010010;
const long long MOD = 1000000007;
typedef pair<int,int> P;

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}

int main() {
    long long N;cin >> N;
    map<long long,int> M;
    while(true){
        long long prv = N;
        long long now = N;
        for(long long i = 2;i<=(long long)sqrt(N);i++){
            if(N % i == 0){
                N /= i;
                now = N;
                M[i]++;
                break;
            }
        }
        if(prv == now){
            M[prv]++;
            break;
        }
    }
    //retuには1+2+3+4+…50までが入る
    vector<int> retu(51);
    retu.at(1) = 1;
    for(int i = 2;i<=50;i++){
        retu.at(i) = retu.at(i-1)+i;
    }
    int ans = 0;
    for(auto V : M){
        if(V.first == 1) continue;
        int times = V.second;
        for(int i = 1;i<=50;i++){
            if(times >= retu.at(i)){
                ans++;
            }
            else break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3688
N = int(input())
H = list(map(int,input().split()))
count = 0
tmp2 = 0
for i in range(N):
  tmp = H.pop(0)
  if(i == 0):
    count += 1
    tmp2 = tmp
  else:
    if(tmp2 <= tmp):
      count += 1
      tmp2 = tmp
print(str(count))

Measured memory_bytes: 3060
/*
*         ****FOX****
*/
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <limits>
//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#include <utility>
#include <list>
#include <cstdio>
#include<forward_list>
#include<algorithm>
#include<string>
#define Omar_Hafez ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 3.1415926536
#define ll long long
#define ull unsigned long long
#define lli long long int
using namespace std;
int main()
{
    Omar_Hafez
   int n; cin >> n;
    vector<int> v(n,0); 
    for (int i = 1; i < 100; i++)
    {
        for (int j = 1; j < 100; j++)
        {
            for (int z = 1; z < 100; z++)
            {
                int res = (i * i) + (j * j) + (z * z) + (i * j) + (j * z) + (i * z);  
                if (res <= n)  v[--res]++;
                else break;
            }
        }
    }
    for (int i = 0; i< v.size(); i++) cout << v[i] << "\n";
    return 0;
}



Measured memory_bytes: 3644
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }


    // int N = Integer.parseInt(scanner.nextLine());
    // int N = scanner.nextInt(), M = scanner.nextInt();
    // scanner.nextLine();
    // int[] n = Arrays.stream(scanner.nextLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    static void solve(Scanner scanner) {
        int A = scanner.nextInt(), B = scanner.nextInt(), Q = scanner.nextInt();
        scanner.nextLine();
        TreeSet<Long> shrine = new TreeSet<>();
        TreeSet<Long> temple = new TreeSet<>();
        for (int i = 0; i < A; i++) {
            shrine.add(Long.parseLong(scanner.nextLine()));
        }
        for (int i = 0; i < B; i++) {
            temple.add(Long.parseLong(scanner.nextLine()));
        }
        for (int i = 0; i < Q; i++) {
            long q = Long.parseLong(scanner.nextLine());
            long ans = Long.MAX_VALUE;
            {
                Long l1 = shrine.floor(q);
                Long l2 = temple.floor(q);
                if (l1 != null && l2 != null) {
                    ans = Math.min(ans, q - Math.min(l1, l2));
                }
            }
            {
                Long r1 = shrine.ceiling(q);
                Long r2 = temple.ceiling(q);
                if (r1 != null && r2 != null) {
                    ans = Math.min(ans, Math.max(r1, r2) - q);
                }
            }
            {
                Long l = shrine.floor(q);
                Long r = temple.ceiling(q);
                if (l != null && r != null) {
                    ans = Math.min(ans, r - l + Math.min(r - q, q - l));
                }
            }
            {
                Long l = temple.floor(q);
                Long r = shrine.ceiling(q);
                if (l != null && r != null) {
                    ans = Math.min(ans, r - l + Math.min(r - q, q - l));
                }
            }
            System.out.println(ans);
        }
    }

}


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

using namespace std;


int main(){
 int n;
  cin>>n;
  double goukei=0.0;
  
  for(int i=0;i<n;i++){
    double kin;
    string tani;
    cin>>kin>>tani;
    if(tani=="JPY"){goukei+=kin;}
    else{goukei+=kin*380000.0;}
  }
 cout<<goukei<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  ll n;
  cin>>n;
  ll ans=0;
  if(n<3){
    cout<<"0"<<endl;
    return 0;
  }
  ans+=n-1;
  for(ll i=1;i*i < n;i++){
    if(i==1){
      continue;
    }
    if(n%i==0&&i*(i+1)!=n){
      ans+=n/i;
      ans--;
    }
  }
  cout<<ans<<endl;
}


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

int main(){
	long long n, m;
	cin >>n>>m;
	vector<pair<long long, long long>> stores;
	
	while (n--){
		long long a, b;
		cin >> a>> b;
		stores.push_back(make_pair(a,b));
	}
	sort (stores.begin(), stores.end());
	long long sum=0;
	long long money=0;
	int i=0;
	while (sum<m){
		sum+= stores[i].second;	//sumamos la cantidad que llevamos
		money+= stores[i].first*stores[i].second; //sumamos el dinero
		++i;
	}
	sum -=m; //la suma que tenemos menos la requerida para ver cuantos sobran
	if (sum>0)
		money-= stores[i-1].first*sum; //le restamos el dinero de las bebidas extra
	cout << money<<'\n';
}

Measured memory_bytes: 2420
# # Make IO faster
# import sys
# input = sys.stdin.readline

# # get single (or) multiple str
# X = input()

# # get single int
# N = int(input())
# # get multiple int (e.g., 2)
# X, Y = map(int, input().split())
# # get multiple int (e.g., 2) for N lines
# XY = [list(map(int, input().split())) for _ in range(N)]

# from IPython import embed; embed(); exit();

# 全部入り
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
l = sorted(list(MAP()), reverse=True)

print(sum(l[:K]))


Measured memory_bytes: 27108