akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>

using namespace std;
long long n,m,p;
int main()
{
	cin>>n>>m;
	if(n%3==0)p=1;
	if(m%3==0)p=1;
	if((n+m)%3==0)p=1;
	if(p==1)
	{
		cout<<"Possible"<<endl;
	}
	else
	{
		cout<<"Impossible"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(long long int i=0;i<n;i++)
#define lli long long int
#define ll long long 
#define dd double
#define endl "\n"
#define mod 1000000007
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define limit 1000000000000000000
const double pi=3.14159265358;
const double pie=2*acos(0.0);
	
using namespace std;
lli power(lli a,lli b)
{
	lli res=1;
	while(b>0)
	{
		if(b%2!=0)
		{
			b--;
			res=(res%mod*a%mod)%mod;
		}
		else
		{
			a=(a%mod*a%mod)%mod;
			b/=2;
		}
	}
	return res%mod;
}
bool sortinrev(const pair<lli,lli> &a,  
               const pair<lli,lli> &b) 
{ 
       return (a.first > b.first); 
}

int main() {
	fast
	char str;
	cin>>str;
	if((int)str>=65 && (int)str<=90)cout<<"A"<<endl;
	else cout<<"a"<<endl;
	
}

Measured memory_bytes: 3604
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int d,s,t;

	cin>>d>>s>>t;

	long double time=d/(long double)t;

	if(time<=s)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}

}

Measured memory_bytes: 3652
/*
    By Prabal Aggarwal
*/
#include <bits/stdc++.h>
#define fastIo                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
using namespace std;
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
    cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define trace(...)
#endif
#define ll long long
#define MOD 1000000007
const int N = 2005;
ll dp[N];
ll f(ll n)
{
    if(n==0)
    {
        return 1;
    }
    
    ll ans = 0;
    if(dp[n]!=-1)
        return dp[n];

    for(ll i=3;i<=n;i++)
    {
        ans = (ans+f(n-i))%MOD;
    }

    return dp[n] = ans;
}
int main()
{
    fastIo;
    memset(dp,-1,sizeof dp);
    ll n;
    cin>>n;

    cout<<f(n);


    return 0;
}

Measured memory_bytes: 3684
def main():
    h, w = map(int, input().split())
    s = ["#" * (w + 2)]
    for _ in range(h):
        s.append("#" + input() + "#")
    s.append("#" * (w + 2))

    b = [[0] * (w + 2) for _ in range(h + 2)]
    for hi in range(h + 2):
        for wi in range(w + 2):
            if s[hi][wi] == ".":
                b[hi][wi] = 1

    u = [[0] * (w + 2) for _ in range(h + 2)]
    d = [[0] * (w + 2) for _ in range(h + 2)]
    l = [[0] * (w + 2) for _ in range(h + 2)]
    r = [[0] * (w + 2) for _ in range(h + 2)]

    for hi in range(1, h + 1):
        for wi in range(1, w + 1):
            if b[hi][wi]:
                u[hi][wi] = u[hi-1][wi] + 1
                l[hi][wi] = l[hi][wi-1] + 1

    for hi in range(h, 0, -1):
        for wi in range(w, 0, -1):
            if b[hi][wi]:
                d[hi][wi] = d[hi+1][wi] + 1
                r[hi][wi] = r[hi][wi+1] + 1

    ans = 0
    for hi in range(1, h + 1):
        for wi in range(1, w + 1):
            cnt = u[hi][wi] + d[hi][wi] + l[hi][wi] + r[hi][wi] - 3
            ans = max(ans, cnt)

    print(ans)


if __name__ == "__main__":
    main()


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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"


template <typename T, typename K> struct P {
	T a; K b;
};

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
vector <P <ll, ll> >prime_factorize( ll N );
ll pow( ll a, ll n );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
int main( void ){
	// initialize();
	int N, D; cin >> N >> D;
	vector<vector<int>> vec(N, vector<int>(D));
	rep(i,0,N){
		rep(j,0,D)
			cin >> vec[i][j];
	}
	int ans = 0;
	rep(i,0,N){
		rep(j,i+1,N){
			ll sum = 0;
			rep(d, 0, D){
				sum += (vec[i][d] - vec[j][d])*(vec[i][d] - vec[j][d]);
			}
			double r = sqrt((double)sum);
			if (ceil(r) == floor(r))
				ans++;
		}
	}
	cout << ans << endl;
}

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

/*
 * @fn eratosthenes
 * @brief O(NloglogN)~=(N)
 * @param N: その数まで
 * @return 0 or 1 の配列 (boolは都合が悪い)
 */
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}

/*
 * @fn prime_factorize
 * @brief O(√N): 素因数分解
 * @param N: 素因数分解する数
 * @return vec: (a: 素数, b: 個数)
 */
vector <P <ll, ll> >prime_factorize( ll N ){
	vector <P <ll, ll> > vec;
	int lim = sqrt( N ) + 1;
	rep( i, 2, N + 1 ){
		if (i >= lim){
			vec.push_back( P <ll, ll>{N, 1} );
			break;
		}
		if (N % i == 0){
			vec.push_back( P <ll, ll>{i, 0} );
			while(N % i == 0){
				N /= i;
				vec.back().b++;
			}
		}
	}
	return vec;
}
/*
 * @fn pow
 * @brief a^n
 * @param a: 基数
 * @param n: 指数
 */
ll pow( ll a, ll n ) {
	ll res = 1;
	while (n > 0){
		if (n & 1) res = res * a;
		a = a * a;
		n >>= 1;
	}
	return res;
}

void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  REP(i, n) {
    cin >> a[i];
    a[i]--;
  }
  vector<ll> num(n, -1);
  ll p = 0, t = 0;
  while (true) {
    if (num[p] != -1) {
      t -= num[p];
      break;
    }
    num[p] = t;
    p = a[p];
    t++;
    if (t == k) {
      cout << p + 1 << endl;
      return 0;
    }
  }

  while (true) {
    if ((k - num[p]) % t == 0) {
      cout << p + 1 << endl;
      return 0;
    }
    p = a[p];
  }
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
#define printArr(harry, tam) range(tam) cout << harry[i] << " \n"[i == tam -1];
#define range(n) for(int i = 0; i < n; i++)
#define maxn 100000
#define mod 1000000007
#define modL 1000000007LL
#define md(x) ((((x) % mod) + mod) % mod)
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define EPS 1e-9
#define INF INT_MAX
#define INFd 1e9

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;

//Trace dinamico
template<typename T>
void trace(T a) { cout << a << "\n"; }
template<typename T, typename... Args>
void trace(T a, Args... args) { cout << a << " "; trace(args...); }

//DP debug
int recNum = 0;
void prTabs() { range(recNum) cout << "    "; }
template<typename... Args>
void recInit(Args... args) { prTabs(); trace("rec(", args..., ")"); recNum++; }
template<typename T>
void recEnd(T a) { prTabs(); trace("->", a); recNum--;}
int n, m, a, b, c;
ll modExpo(ll x, ll y) {
	if(y == 0) return 1LL;
	if (y & 1) return x * modExpo(x, y-1LL) % modL;
	ll r = modExpo(x, y>>1);
	return r*r%modL;
}
int li[200];
int dpt[100001][201];
ll fact[201];
ll invFact[201];
int dp(int x, int i) {
	//recInit(x, i);
	if (i == 0) {//recEnd(x);
	return x;}
	if(dpt[x][i] == -1) {
		int s = 0;
		for(int j = 0; j < i; j++) {
			int prox = x%li[j];
			int k = 0;
			for(; k < i; k++) {
				if (li[k] > prox) break;
			}
			//trace("prox", prox, "i-1", i-1, "k", k, "i-k-1", i-k-1, "fact[i-1]", fact[i-1], "invFact[i-k-1]", invFact[i-k-1], "invFact[k]", invFact[k]);
			ll res = 1LL * dp(prox, k) * fact[i-1]  % modL * invFact[i-k-1] % modL * invFact[k] % modL * fact[i-k-1] % modL;
			//trace(res);
			s = (s + ((int)res)) % mod;
		}
		dpt[x][i] = s;
	}
	//recEnd(dpt[x][i]);
	return dpt[x][i];
}
int resp(int m) {
	int s = 0;
	for(int j = 0; j < n; j++) {
		int prox = m%li[j];
		int k = 0;
		for(; k < n; k++) {
			if (li[k] > prox) break;
		}
		//trace("prox", prox, "i-1", i-1, "k", k, "i-k-1", i-k-1, "fact[i-1]", fact[i-1], "invFact[i-k-1]", invFact[i-k-1], "invFact[k]", invFact[k]);
		ll res = 1LL * dp(prox, k) * fact[n-1]  % modL * invFact[n-k-1] % modL * invFact[k] % modL * fact[n-k-1] % modL;
		//trace(res);
		s = (s + ((int)res)) % mod;
	}
	return s;
}

int main(){
	memset(dpt, -1, sizeof dpt);
	fact[0] = 1LL;
	for(ll i = 1LL; i < 201; i++) {
		fact[i] = fact[i-1]*i % modL;
	}
	for(int i = 0; i < 201; i++) {
		invFact[i] = modExpo(fact[i], modL-2LL);
	}
	sc("%d %d", &n, &m);
	for(int i = 0; i < n; i++) {
		sc("%d", li+i);
	}
	sort(li, li+n);
	int i = 0;
	for(; i < n; i++) {
		if (li[i] > m) break;
	}

	pr("%d\n", resp(m));
 	return 0;
}


Measured memory_bytes: 78720
#include <stdio.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <math.h>
#include <vector>
#include <list>
#define inf 200
using namespace std;

int n;
list<int> adj[101];
int d[101];
bool f[101];
void BFS(int v)
{
    int m = 0;
    f[v] = false;
    while (!adj[v].empty())
    {
        d[adj[v].front()] = min(d[v] + 1, d[adj[v].front()]);
        adj[v].pop_front();
    }
    for (int i = 1; i <= n; i++)
    {
        if (f[i] && d[i] < d[m])
            m = i;
    }
    if (m > 0)
        BFS(m);
}

void print()
{
    for (int i = 1; i <= n; i++)
    {
        if (d[i] == inf)
            d[i] = -1;
        printf("%d %d\n", i, d[i]);
    }
}

int main()
{
    int u, k, v;
    cin >> n;
    for (int i = 0; i <= n; i++)
    {
        d[i] = inf;
        f[i] = true;
    }
    for (int i = 0; i < n; i++)
    {
        cin >> u >> k;
        while (k > 0)
        {
            cin >> v;
            adj[u].push_back(v);
            k--;
        }
    }
    d[1] = 0;
    BFS(1);

    print();

    return 0;
}


Measured memory_bytes: 3244
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<cstring>
#include<stack>
#include<cstdlib>
#include<cmath>
using namespace std;

int main()
{
	int n, k, d, t;
	int a[100] = { 0 };
	cin >> n >> k;
	for (int i = 0; i < k; i++) {
		cin >> d;
		for (int j = 0; j < d; j++) {
			cin >> t;
			a[t - 1]++;
		}
	}
	int cnt = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == 0)
			cnt++;
	}
	cout << cnt << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
int main() {
  int n;
  cin >> n;
  int a = n%1000;
  if(a == 0) cout << 0 << endl;
  else cout << 1000 - a << endl;
}



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

int main() {
  double w1 , w2 , s1 , s2 , n , s;
  cin >> w1 >> w2 >> s1 >> s2 >> n >> s;
  int bs=0;
  int bw=w1*100;
  map<double,double> mw;
  map<double,double> ms;
  for (double i=0;i<=s;i+=w2*100) {
    for (double j=i;j<=s;j+=w1*100) {
      mw[j]=1;
    }
  }
  for (double i=0;i<=s;i+=s2) {
    for (double j=i;j<=s;j+=s1) {
      ms[j]=1;
    }
  }
  for (auto pw:mw) {
    for (auto ps:ms) {
      if (pw.first+ps.first > s) {
        continue;
      }
      else if (ps.first <= pw.first / 100 * n 
          && double(bs) / double(max(1,bw)) < double(ps.first) / double(pw.first)) {
        bs = ps.first;
        bw = pw.first;
      }
    }
  }
  cout << bw+bs << " " << bs;
}

Measured memory_bytes: 764
import sys


Nx = input().split()
an = input().split()

anx = list()

for item in an:
    anx.append(int(item))

x = int(Nx[1])
N = int(Nx[0])
i = 0
count = 0
while i < N - 1:
    sum = anx[i] + anx[i + 1]
    
    if sum > x:
        count += sum - x
        num = sum - x
        anxi = anx[i+1]
        anxi -= num
        if anxi < 0:
            anxi2 = anx[i] + anxi
            anx[i] = anxi2
            anxi = 0
        anx[i+1] = anxi
    i += 1
print(count)


Measured memory_bytes: 14276
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, c;
  cin >> n >> c;
  vector<vector<int>> cost(c, vector<int>(c));
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < c; j++) {
      cin >> cost[i][j];
    }
  }
  vector<vector<int>> in(3);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int x;
      cin >> x;
      in[(i + j) % 3].push_back(--x);
    }
  }
  vector<vector<int>> res(3, vector<int>(c));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < c; j++) {
      int cur = 0;
      for (int x : in[i]) {
        cur += cost[x][j];
      }
      res[i][j] = cur;
    }
  }
  int ans = 1 << 30;
  for (int i = 0; i < c; i++) {
    for (int j = 0; j < c; j++) {
      for (int k = 0; k < c; k++) {
        if (i == j || j == k || k == i) continue;
        ans = min(ans, res[0][i] + res[1][j] + res[2][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1516
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <math.h>
#include <bitset>
 
using namespace std;
 
 
int main()
{
	int N;
	cin >> N;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}

	sort(a.begin(), a.end());

	cout << a[N-1]-a[0] << endl;

	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	if ((tmp & ma0) ^ ma0) {
		int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
		tmp = tmp << dig & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += (72 - dig >> 3);
	}
	else {
		tmp = tmp & ma1;
		tmp = tmp * 10 + (tmp >> 8) & ma2;
		tmp = tmp * 100 + (tmp >> 16) & ma3;
		tmp = tmp * 10000 + (tmp >> 32) & ma4;
		ci += 8;
		if ((ct = *ci++) >= '0') {
			tmp = tmp * 10 + ct - '0';
			if (*ci++ == '0') {
				tmp = tmp * 10;
				ci++;
			}
		}
	}
	return tmp;
}

int A[200000];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N = getint();
	int saidai = 1;
	rep(i, N) {
		A[i] = getint();
		if (A[i] > saidai) saidai = A[i];
	}
	nth_element(A, A + N / 2, A + N);

	if (N % 2) {
		ll kotae = -A[N / 2] - saidai;
		for (int i = N / 2; i < N; i++) {
			kotae += 2 * A[i];
		}
		printf("%lld\n", kotae);
	}
	else {
		ll kotae = - saidai;
		for (int i = N / 2; i < N; i++) {
			kotae += 2 * A[i];
		}
		printf("%lld\n", kotae);
	}


	Would you please return 0;
}

Measured memory_bytes: 4580
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3 4 9 0");
            //5.00000000000000000000
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("3 4 10 40");
            //4.56425719433005567605
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        int A = wkArr[0];
        int B = wkArr[1];
        int H = wkArr[2];
        int M = wkArr[3];


        //合計分数を求める
        double TotalMin = 60 * H + M;

        double HourDec = 0; //時針の角度(度数法)
        double MinuteDec = 0; //分針の角度(度数法)

        //時針は1分で0.5度進む
        //分針は1分で6度進む

        HourDec = (TotalMin * 0.5) % 360;
        MinuteDec = (TotalMin * 6) % 360;

        double ThetaDec = Math.Abs(HourDec - MinuteDec);
        ThetaDec = Math.Min(ThetaDec, 360 - ThetaDec);

        double ThetaRad = ThetaDec * Math.PI / 180;

        Console.WriteLine(Math.Sqrt(A * A + B * B - 2 * A * B * Math.Cos(ThetaRad)));
    }
}


Measured memory_bytes: 28652
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int cnt = 0;
    
    String num = sc.next();
    
    for(int i=0; i<num.length(); i++){
      if(num.charAt(i) == '1'){
        cnt++;
      }
    }
    
    System.out.println(cnt);
  }
}


Measured memory_bytes: 23764
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define LL long long
#define INF 1000000001
#define mod 1000000007
using namespace std;
int keta(int n,int k){return (n/int(pow(10,double(k-1)))) % 10;} //nの下からk桁目
ll gcd(ll n,ll m){
	if(n<m){ll a=m;m=n;n=a;}
	ll r=n%m;
	while(r!=0){
		n=m;
		m=r;
		r=n%m;
	}
	return m;
}
ll lcm(ll n,ll m){
	return n*m/gcd(n,m);
}

int main(){
	
	int n;
	cin>>n;
	int *a;
	a=new int[n];
	rep(i,n){
		cin>>a[i];
	}
	sort(a,a+n);
	int ans=0;
	int b=0;
	rep(i,n){
		if(a[i]==b){
			ans--;
			b=0;
		}else{
			ans++;
			b=a[i];
		}
	}
	cout<<ans<<endl;
	delete[]a;
}



Measured memory_bytes: 640
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
}

Measured memory_bytes: 21844
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.AbstractCollection;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.util.Comparator;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();

            PriorityQueue<int[]> que = new PriorityQueue<>(Comparator.comparingInt(o -> o[0]));
            for (int i = 0; i < N; i++) {
                int t = in.Int();
                int x = in.Int();
                int y = in.Int();
                que.add(new int[]{t, x, y});
            }

            int[] c = new int[]{0, 0, 0};
            while (!que.isEmpty()) {
                int[] q = que.poll();
                int t = c[0] + Math.abs(c[1] - q[1]) + Math.abs(c[2] - q[2]);
                int d = q[0] - t;
                if (q[0] < t || d < 0 || d % 2 == 1) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 46680
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vll path;
//***********//
int main() {
	ll A, B, C, D, E, F, G;
	cin >> A >> B >> C >> D >> E >> F >> G;
	ans += B;
	//C,F,Gは実は使用できない？
	//A,D,Eをまずは偶数個使う
	if (A >= 1 && D >= 1 && E >= 1) {
		ll pre = 0;
		if (A % 2 == 1) pre++;
		if (D % 2 == 1) pre++;
		if (E % 2 == 1) pre++;
		if (pre == 0 || pre == 3) ans += A + D + E;
		else ans += A + D + E - 1;
	}
	else {
		ans += (A / 2) * 2 + (D / 2) * 2 + (E / 2) * 2;
	}
	co(ans);
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define range(i,l,h) for(int i=l;i<h;i++)
#define endl '\n'
#define I INT_MAX
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define ll long long
#define ull unsigned long long
#define ff first
#define ss second
#define vt vector
using namespace std;
using std::ios;
constexpr int MOD=1e9+7;
constexpr int mod=998244353;
template<typename T> T power(T a,T b){T r=1;while(b){if(b&1)r*=a;b/=2;a*=a;}return r;}


int main()
{
  fastio;
 

  string s;
  cin>>s;
  if(s[s.length()-1]=='s')
    s=s+"es";
  else s=s+'s';
  cout<<s;
  

}

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

#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
using Graph = vector<vector<int>>;
// using P = pair<ll, ll>;
const int dx[] = {0, 1, -1, 0};
const int dy[] = {1, 0, 0, -1};
const ll mod = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //////////////////////////////////////
  int n;
  cin >> n;
  rep(i, n) cout << "ACL";
  cout << endl;
  return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

const int MAX = 1e5 + 10;
char strbuf[MAX];
string next() {
scanf("%s", strbuf);
return strbuf;
}

string S, T;
int N;
int sb[MAX], tb[MAX];

int main(void) {
    S = next();
    T = next();
    REP(i, S.size()) sb[i] = (S[i] == 'B') + 1;
    REP(i, (int)S.size() - 1) sb[i + 1] += sb[i];
    REP(i, T.size()) tb[i] = (T[i] == 'B') + 1;
    REP(i, (int)T.size() - 1) tb[i + 1] += tb[i];
    scanf("%d", &N);
    REP(i, N) {
        int a, b, c, d;
        scanf("%d%d%d%d", &a, &b, &c, &d);
        --a;--b;--c;--d;
        int ss = (a == 0 ? sb[b] : sb[b] - sb[a - 1]);
        int tt = (c == 0 ? tb[d] : tb[d] - tb[c - 1]);
        printf("%s\n", (ss % 3 == tt % 3 ? "YES" : "NO"));
    }
}


Measured memory_bytes: 1664
import java.io.*;
import java.util.*;

public class Main{
  public static void main(String args[]) {
    Scanner s=new Scanner(System.in);
    int x=s.nextInt();
    int y=s.nextInt();
    int a[]={300000,200000,100000};
    int sum=0;
    if(x<=3)
      sum+=a[x-1];
    if(y<=3)
      sum+=a[y-1];
    if(x==1&&y==1)
      sum+=400000;
    System.out.println(sum);
  }
}

Measured memory_bytes: 22740
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef pair<ll,ll> p;
const int inf=(1<<30);
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
	
bool pairComparesecond(const p& firstElof, const p& secondElof)
{
    return firstElof.second > secondElof.second;
}
 
int main(){
	ll n,m;
	cin>>n>>m;
	vector<p> v;
	rep(i,0,m){
		ll a,b;
		cin>>a>>b;
		v.push_back(p(b,a));
	}
	sort(v.begin(),v.end());
	ll s=0;
	ll ans=0;
	rep(i,0,m){
		if(v[i].second>s)
		{
			ans++;
			s=v[i].first-1;
		}
	}
	cout<<ans<<endl;
			
}

Measured memory_bytes: 2420
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    int cur, nxt, price;
    while (cin >> cur >> nxt >> price, cur) {
        int ma = 0;
        for (int sum = 0; sum <= 2000; sum++) {
            for (int x = 1; x < sum; x++) {
                int y = sum - x;
                int cur_x = x * (100 + cur) / 100;
                int cur_y = y * (100 + cur) / 100;
                if (cur_x + cur_y != price) continue;
                int nxt_x = x * (100 + nxt) / 100;
                int nxt_y = y * (100 + nxt) / 100;
                ma = max(ma, nxt_x + nxt_y);
            }
        }
        cout << ma << endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ACC ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mod 1000000007
#define MAXN 10000001
int spf[MAXN];
void solve()
{
	int i,j;
	for(i=0;i<MAXN;i++)
	spf[i]=i;
	for(i=4;i<MAXN;i+=2)
	spf[i]=2;
	for(i=3;i*i<MAXN;i++)
	{
		if(spf[i]==i)
		{
			for(j=i*i;j<MAXN;j+=i)
			{
				if(spf[j]==j)spf[j]=i;
			}
		}
	}
}
int32_t main()
{
    ACC
        solve();
        int n,i,j;
        cin>>n;
        int a[n],b[n];
        set<int> s;
        bool flag=true;
        for(i=0;i<n;i++)
        {
            cin>>a[i];b[i]=a[i];
        }
        map<int,int> m;
        for(i=0;i<n;i++)
        {
            for(j=2;j*j<=a[i];j++)
            {
                if(a[i]%j==0)
                {
                    if(m[j])
                    {
                        flag=false;break;
                    }
                    while(a[i]%j==0)
                    {
                        a[i]/=j;
                        m[j]++;
                    }
                }
            }
            if(a[i]>1)
            {
                if(m[a[i]])
                {
                    flag=false;
                }
                else
                {
                    m[a[i]]++;
                }
            }
            if(!flag)break;
        }
        int p=__gcd(b[0],b[1]);
        for(i=2;i<n;i++)
        {
            p=__gcd(p,b[i]);
        }
        if(flag)
        {
            cout<<"pairwise coprime\n";
        }
        else if(p==1)
        {
            cout<<"setwise coprime\n";
        }
        else cout<<"not coprime\n";
    return 0;
}

Measured memory_bytes: 97320
#coding:utf-8
#1_7_A
class Node():
    def __init__(self, node_id, children):
        self.node_id = node_id
        self.parent = -1
        self.depth = 0
        self.typ = "root"
        self.children = children

    def set_child(self, child):
        """ Overwrite child's attribute """
        child.parent = self.node_id
        child.depth = self.depth + 1
        if child.children:
            child.typ = "internal node"
        else:
            child.typ = "leaf"

    def set_children(self, tree):
        """ Repeat set_child starting from root node """
        stack = []
        stack.append(self.node_id)

        while stack:
            node = tree[stack.pop()]
            for child_id in node.children:
                node.set_child(tree[child_id])
            stack.extend(node.children)

n = int(input())
tree = [None for i in range(n)]
children = []
for i in range(n):
    info = list(map(int, input().split()))
    tree[info[0]] = Node(info[0], info[2:])
    children.extend(info[2:])

root_id = list(set([x for x in range(n)]) - set(children)).pop()

tree[root_id].set_children(tree)

for node in tree:
    print("node {}: parent = {}, depth = {}, {}, {}".format(node.node_id, node.parent, node.depth, node.typ, node.children))

Measured memory_bytes: 62844
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,k;
vector<int>G[2222];
int uk,uk1;
void dfs(int u,int p,int c)
{
	if(c<=k/2)uk++;
	else if(c==(k+1)/2)uk1++;
	for(int i=0;i<G[u].size();i++)
	{
		if(G[u][i]==p)continue;
		dfs(G[u][i],u,c+1);
	}
}
main()
{
	cin>>n>>k;
	for(int i=1;i<n;i++)
	{
		int a,b;cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	int ans=n;
	for(int i=1;i<=n;i++)
	{
		uk=1;
		uk1=0;
		int ma=0;
		for(int j=0;j<G[i].size();j++)
		{
			int pre=uk1;
			dfs(G[i][j],i,1);
			ma=max(ma,uk1-pre);
		}
		ans=min(ans,n-uk-ma);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

using namespace std;
using P = pair<int, int>;

template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}

template<typename T>
class Union_Find {
  private:
	vector<T> t, s;

  public:
	explicit Union_Find(T max_length) {
		for (int i = 0; i < max_length + 1; ++i) {
			t.push_back(i);
			s.push_back(1);
		}
	}

	void Union(T x, T y) {
		if (same(x, y)) return;
		T tx = Find(x), ty = Find(y);
		if (s[tx] < s[ty]) {
			s[ty] += s[tx];
			t[tx] = ty;
		}
		else if (s[tx] > s[ty]) {
			s[tx] += s[ty];
			t[ty] = tx;
		}
		else if (tx > ty) {
			t[tx] = ty;
			s[ty] += s[tx];
		}
		else {
			t[ty] = tx;
			s[tx] += s[ty];
		}
	}
	T Find(T n) {
		if (t[n] == n)
			return n;
		else
			return t[n] = Find(t[n]);
	}

	bool same(T x, T y) {
		return Find(x) == Find(y);
	}

	T get_Size(size_t a) {
		return s[a];
	}
};

//(ノ)>◡<(ヾ)ﾓﾁﾓﾁ
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;
    int n,m;
    cin>>n>>m;
    vector<P> vec(n,{1,false});
    vec[0].second=true;
    int ans=1;
    rep(i,m){
        int x,y;
        cin>>x>>y;
        x--;
        y--;
        vec[y].first++;
        if(vec[y].second == 0 && vec[x].second != 0){
            vec[y].second=true;
            ans++;
        }
        vec[x].first--;
        if(vec[x].first==0&&vec[x].second){
            ans--;
            vec[x].second=false;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

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

  ll k, n;
  cin >> k >> n;

  ll ans = k;
  vector<ll> a(n);
  rep(i, n) cin >> a[i];

  for (int i = 1; i < n; i++) {
    chmin(ans, k - (a[i] - a[i-1]));
  }

  chmin(ans, k - (k - (a.back())) - a[0]);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define LIMIT(d_in, d_min, d_max) max(d_min, min(d_max, d_in))
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int N;
	cin >> N;
	int ans = 0;

	for (int i = 0; i < N; i++)
	{
		int r, l;
		cin >> l >> r;
		ans += r - l + 1;
	}
	cout << ans << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

int main(){
	int n, ans = 0;
	cin >> n;
	vector<int> cp(n);
	for (int i = 0; i < n; ++i) {
		cin >> cp[i];
	}
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		cp[i] -= x;
		if (cp[i] > 0) ans += cp[i];
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
// ███▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬▓█
// ███▓███████▓▓╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▓▓▓█▓╬╬╬▓█
// ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
// ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
// ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
// ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
// ███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
// █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
// █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
// ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
// ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
// ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
// ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
// █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
// ██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
// ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
// ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
// ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████
//#include "grader.h"
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define read(FILENAME) assert(freopen((FILENAME + ".in").c_str(), "r", stdin))
#define write(FILENAME) assert(freopen((FILENAME + ".out").c_str(), "w", stdout))
#define files(FILENAME) read(FILENAME), write(FILENAME)
using namespace std;
template <typename A, typename B> void chkmin(A &x, B y) {if (x > y) x = y;}
template <typename A, typename B> void chkmax(A &x, B y) {if (x < y) x = y;}
     
typedef pair <int, int> point;
     
const string FILENAME = "input";
const int MAXN = 1e5, p = 1e9 + 7;

int n;
map <int, int> cnt;

int main() {
	//read(FILENAME);
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int a;
		cin >> a;
		++cnt[a];
	}
	if (cnt.size() > 2) {
		cout << "No" << endl;
	} else if (cnt.size() == 1) {
		int k = (*cnt.begin()).x;
		if (k != (n - 1) && n < 2 * k) {
			cout << "No" << endl;
		} else {
			cout << "Yes" << endl;
		}
	} else {
		int k = (*cnt.begin()).x;
		if (cnt[k + 1] <= 1) {
			cout << "No" << endl;
			return 0;
		}
		int L = cnt[k] + 1, R = cnt[k] + (n - cnt[k]) / 2;
		//cout << L << ' ' << R << endl;
		if (L <= (k + 1) && (k + 1) <= R) {
			cout << "Yes" << endl;
		} else {
			cout << "No" << endl;
		}
	}
}








Measured memory_bytes: 4992
#include <string>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
	cin >> s;
	int n = s.size();
	int ret = n;
	for (int i = 1; i < s.size(); i++) {
		if (s[i - 1] != s[i]) {
			ret = min(ret, max(i, n - i));
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
#define ll long long
#define MAX 2002
inline int read()
{
    int x=0;bool t=false;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=true,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return t?-x:x;
}
struct Line{int v,next;}e[MAX<<1];
int h[MAX],cnt=1;
inline void Add(int u,int v){e[cnt]=(Line){v,h[u]};h[u]=cnt++;}
int n,K,dep[MAX],tot,ans=1e9;
void dfs(int u,int ff)
{
    dep[u]=dep[ff]+1;
    if(dep[u]>K/2)++tot;
    for(int i=h[u];i;i=e[i].next)
        if(e[i].v!=ff)dfs(e[i].v,u);
}
int main()
{
    n=read();K=read();
    for(int i=1;i<n;++i)
    {
        int u=read(),v=read();
        Add(u,v);Add(v,u);
    }
    dep[0]=-1;
    if(K%2==0)
        for(int i=1;i<=n;++i)tot=0,dfs(i,0),ans=min(ans,tot);
    else
        for(int u=1;u<=n;++u)
            for(int i=h[u];i;i=e[i].next)
                dep[e[i].v]=-1,tot=0,dfs(u,e[i].v),dep[u]=-1,dfs(e[i].v,u),ans=min(ans,tot);
    printf("%d\n",ans);
    return 0;
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < n; i++)
#define REP(n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
using INT64 = long long;
using UINT64 = unsigned long long;
#define MOD 1000000007

int main(void)
{
    IOS
    int n,x;
    cin >> n >> x;
    vector<int> l(n);
    REP(n) cin >> l[i];

    int count = 1;
    int a = 0;

    REP(n) {
        a += l[i];
        if (a > x) break;
        count++;
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int h1,h2;
	cin>>h1>>h2;
	int k1,k2;
	cin>>k1>>k2;
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(h1*a + h2*b + h1/10*c + h2/20*d >k1*a + k2*b + k1/10*c + k2/20*d){
		cout<<"hiroshi"<<endl;
	}
	else if(h1*a + h2*b + h1/10*c + h2/20*d <k1*a + k2*b + k1/10*c + k2/20*d){
		cout<<"kenjiro"<<endl;
	}
	else{
		cout<<"even"<<endl;
	}
	return 0;
	}


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

using namespace std;
using ll = long long;



int main()
{
    string s, t;
    cin >> s >> t;
    s += t;
    int n = stoi(s);

    cout << (pow((long double)n, 0.5) == (int)pow((long double)n, 0.5) ? "Yes" : "No") << endl;

}

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

ll mod = 1e9+7;
  
// 検索タグ
int main() {
	// 入力
	ll H,A;cin>>H>>A;

	// 解法
	ll ans = H/A;
	if (H%A!=0) ans++;

	//出力
	printf("%lld\n", ans);
}


Measured memory_bytes: 256
S=input()
T=input()

def revolve(letters):
    last_l=letters[-1]
    letters_1=letters[:-1]
    letters_new=last_l+letters_1
    return letters_new


count=0
word=S
while count<=len(S):
    revolve(word)
    if revolve(word)==T:
        print("Yes")
        break
    else:
        if count==len(S):
            print("No")
            break
        else:
            word=revolve(word)
            count+=1


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef vector<ld> vd;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<ll>> vvll;
typedef vector<pair<ll, ll>> vpll;
typedef priority_queue<ll, vector<ll>, greater<ll>> spqll;  // 小さい順に取り出し
typedef priority_queue<ll, vector<ll>, less<ll>> bpqll;     // 大きい順に取り出し

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for (ll i = (ll)a; i < (ll)b; i++)
#define IREP(i, v) for (auto i = (v).begin(); i != (v).end(); i++)
#define FI first
#define SE second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define TS to_string
#define NP next_permutation
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) (ll) x.size()
#define SP(x) setprecision((ll)x)


ll INF = 1e9;
ll NIL = -1;
ll MOD = 1000000007;
ll LINF = 1e18;
ld EPS = 1e-9;
ld PI = M_PI;
vll dx = {1, 0, -1, 0, 1, -1, -1, 1};
vll dy = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a;} //最大公約数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b;}     //最小公倍数

void yes(){ cout << "Yes" << endl;}
void no(){ cout << "No" << endl;}

//-----------------------------------------
ll n;
const ll N = 100000+10;
ll nm[3][N];
ll dp[3][N];


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

    cin >> n;

    REP(i,n){
        REP(j,3){
            cin >> nm[j][i];
        }
    }

    REP(i,n){
        REP(j,3){
            if(i==0) dp[j][i] = nm[j][i];
            else{
                dp[j][i] = -LINF;
                REP(k,3){
                    if(k!=j){
                        ll tmp = dp[k][i-1]+nm[j][i];
                        dp[j][i] = max(dp[j][i],tmp);
                    }
                }
            }
        }
    }

    cout << max({dp[0][n-1],dp[1][n-1],dp[2][n-1]});

    
    return 0;
}



Measured memory_bytes: 8244
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#include <algorithm>
using namespace std;
int n;
long long a[1000];
long long gcd(long long x,long long y)
{
    return !y?x:gcd(y,x%y);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
    long long tmp=a[1];
    for(int i=1;i<n;i++)
        tmp=tmp/gcd(tmp,a[i+1])*a[i+1];
    printf("%lld",tmp);
    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.util.Collections;


public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
		String str[] = br.readLine().split(" ");
		String in[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int k = Integer.parseInt(str[1]);
		Integer arr[] = new Integer[n];
		for(int i=0;i<n;i++) {
		    arr[i] = Integer.parseInt(in[i]);
		}
		Arrays.sort(arr, Collections.reverseOrder());
		int ans = 0;
		for(int i=0;i<k;i++) {
		    ans += arr[i];
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 21204