akhauriyash/Code-Regression huggingface dataset:
//2017-10-10
//miaomiao
//
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define pb push_back
#define For(i, a, b) for(int i = (a); i <= (int)(b); ++i)

#define N (2000+5)
const int oo = 0x3f3f3f3f;

int n, rk, ans, siz[N], f[N][N], Min[N][N];
vector<int> G[N];

#define v G[now][i]

int Dfs(int now, int F, int D){
	siz[now] = 1;

	int mxd = D;
	For(i, 0, G[now].size()-1) if(v != F){
		mxd = max(mxd, Dfs(v, now, D+1));
		siz[now] += siz[v];
	}
	int down = mxd - D + 1;
	
	Min[now][0] = f[now][0] = siz[now] - 1;

	int r, sum, cc;
	For(j, 1, min(rk, down)){
		f[now][j] = oo; r = max(min(j-1, rk-j-1), -1);
		sum = 0; cc = 0;

		For(i, 0, G[now].size()-1)
			if(v != F){
				if(r != -1){
					sum += Min[v][r];
					cc = max(cc, Min[v][r] - f[v][j-1]);
				}else{
					sum += f[v][0] + 1;
					cc = max(cc, (f[v][0]+1) - f[v][j-1]);
				}
			}

		sum -= cc; f[now][j] = min(f[now][j], sum);
		Min[now][j] = min(Min[now][j-1], f[now][j]);
	}

	int beg = min(rk, down);
	For(j, beg+1, rk) Min[now][j] = Min[now][j-1], f[now][j] = oo;
	
	For(j, 0, rk) ans = min(ans, f[now][j] + (n - siz[now]));

//	For(j, 0, rk) printf("f[%d][%d] = %d\n", now, j, f[now][j]);
//	puts("================");
	return mxd;
}

#undef v

int main(){
	int u, v;

	scanf("%d%d", &n, &rk);

	For(i, 1, n-1){
		scanf("%d%d", &u, &v);
		G[u].pb(v); G[v].pb(u);
	}

	ans = oo;
	Dfs(1, 0, 1);
	printf("%d\n", ans);

	return 0;
}

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

int charCount(string s1, string s2) {
    int cnt = 0;
    for (char c = 'a'; c <= 'z'; c++) {
        bool findS1 = false, findS2 = false;
        for (int i = 0; i < s1.size(); i++) {
            if (s1[i] == c) findS1 = true;
        }
        for (int i = 0; i < s2.size(); i++) {
            if (s2[i] == c) findS2 = true;
        }
        if (findS1 && findS2) cnt++;
        
    }
    return cnt;
}

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

    int cnt = 0;
    int nChar = 0;
    for (int i = 1; i < n; i++) {
        string front = s.substr(0, i);
        string back = s.substr(i);
        nChar = max(nChar ,charCount(front, back));
    }

    cout << nChar << endl;
    
    return 0;
}

Measured memory_bytes: 256
import Data.Bool

main :: IO ()
main = do
  (a:b:_) <- map read . words <$> getLine
  putStr $ solve a b

solve :: Int -> Int -> String
solve a b = bool "No" "Yes" $ isSqNum $ connect a b

isSqNum :: Int -> Bool
isSqNum x = x `elem` sqNums

sqNums :: [Int]
sqNums = [ x ^ 2 | x <- [0 .. 1000] ]

connect :: Int -> Int -> Int
connect a b = a * k + b
  where k = head [ 10 ^ i | i <- [0 ..], 10 ^ i > b ] 


Measured memory_bytes: 508
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> T;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define REP(i, n) for (ll i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using vvec = vector<vector<int>>;
using vec = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    int a,b;
    cin>>a>>b;
    rep(i,max(a,b)){
        cout<<min(a,b);
    }
    cout<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <numeric>

using namespace std;


int main() {
	int a;
	cin >> a;
	cout << a + a * a + a * a * a;
}


Measured memory_bytes: 3612
ans = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
       1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(ans[int(input())-1])


Measured memory_bytes: 2940
///   ***   ---   |||		 In the name of ALLAH		|||   ---   ***   ///



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


typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef double dl;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define sz(x) (int)x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a,b) memset(a, b, sizeof(a) )
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0)
void faltu () {			cerr << endl;}
template < typename T, typename ... hello>void faltu( T arg, const hello &... rest) {cerr << arg << ' ';faltu(rest...);}

ll gcd ( ll a, ll b ) { return __gcd ( a, b ); }
ll lcm ( ll a, ll b ) { return a * ( b / gcd ( a, b ) ); }


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

int main()
{
	optimize();

	int n;
	string s;
	cin >> n >> s;

	int r = 0;

	for ( auto c : s ) if ( c == 'R' ) r++;

	int cnt = 0;
	for ( int i = 0; i < r; i++ ) {
		if ( s[i] == 'W' ) cnt++;
	}

	cout << cnt << endl;

	return 0;
}


















Measured memory_bytes: 3784
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int siz=2e5;
const long inf=1e9;
int main(){
	int N; cin>>N;
	int a,t; cin>>t;
	long v = 1000; int k = 0;
	rep(i,1,N){
		cin>>a;
		if(t < a) v += (a - t) * (v / t);
		t = a;
	}cout<<v<<endl;
}

Measured memory_bytes: 3632
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**5)

def main():
    N,M = map(int,input().split())
    use = [False for _ in range(N)]
    formula = 0
    
    I = [i for i in range(N)]
    rank = [1 for _ in range(N)]
    def root(x):
        if x == I[x]:
            return x
        I[x] = root(I[x])
        return I[x]
    
    def unite(x,y):
        px,py = root(x),root(y)
        if x < y:
            I[py] = px
        else:
            I[px] = py

    for i in range(M):
        x,y,z = map(int,input().split())
        x -= 1
        y -= 1
        px,py = root(x),root(y)
        if px == py:
            continue
        else:
            unite(x,y)
            formula += 1

    print(N-formula)

if __name__ == "__main__":
    main()

Measured memory_bytes: 8600
using System;
using System.Linq;

class Node{
  public int key = 0;
  public int parent = 0;
  public int left = 0;
  public int right = 0;
}

class Max{
  public void maxHeap(ref Node[] node,int i){
    int left = i * 2, right = i * 2 + 1,large = i;
    Node change = new Node();
    if(left < node.Length && node[left].key > node[i].key){
      large = left;
    }if(right < node.Length && node[right].key > node[large].key){
      large = right;
    }if(large != i){
      change = node[large];
      node[large] = node[i];
      node[i] = change;
      maxHeap(ref node,large);
    }
  }
}

class B9{
  public static void Main(){
   int n = int.Parse(Console.ReadLine());
   Node[] node = new Node[n + 1];
   for(int i = 0;i <= n;i++){
     node[i] = new Node();
   }
   int[] input = Array.ConvertAll(Console.ReadLine().Split(' '),int.Parse);
   for(int i = 0;i < n;i++){
     node[i + 1].key = input[i];
   }
   for(int i = 1;i <= n;i++){
     if(i / 2 > 0){
       node[i].parent = node[i / 2].key;
     }
     if(i * 2 <= n){
       node[i].left = i * 2;
     }
     if(i * 2 + 1 <= n){
       node[i].right = 2 * i + 1;
     }
   }
   Max max = new Max();
   for(int i = n / 2;i > 0;i--){
     max.maxHeap(ref node,i);
   }
   for(int i = 1;i <= n;i++){
     Console.Write(" " + node[i].key);
   }
   Console.WriteLine();
  }
}



Measured memory_bytes: 76468
import sys

def main():
    S = sys.stdin.readline()
    for i, s in enumerate(S):
        j = i+1
        if j % 2 == 1 and s == 'L' or j % 2 == 0 and s == 'R':
            print('No')
            sys.exit()
    print('Yes')

if __name__=='__main__':
    main()

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int check[100005];

int N, M, p[100005], w[100005];
string S[100005];

int main(void) {

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

	int ac = 0;
	int wa = 0;

	for (int i = 1; i <= M; i++) {
		if (S[i] == "AC") { check[p[i]] = 1; }
		else if (check[p[i]] == 0) { w[p[i]]++; }
	}

	for (int i = 1; i <= N; i++) {
		if (check[i] == 1) { ac++;  wa += w[i]; }
	}


	cout << ac << " " << wa << endl;

	return 0;
}


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

int main() {
  int n,a,b,c,d,e;
  string s;
  a=0;
  b=0;
  c=0;
  d=0;
  cin >> n;
  rep(i,n) {
    cin>> s;
    if (s=="AC") a++;
    if (s=="WA") b++;
    if (s=="TLE") c++;
    if (s=="RE") d++;
  }
  cout << "AC x " << a << endl;
  cout << "WA x " << b << endl;
  cout << "TLE x " << c << endl;
  cout << "RE x " << d << endl;
}

Measured memory_bytes: 3628
#!/usr/bin/env python3
import sys


def solve(N: int):
    print(N * (N-1) // 2)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int use[4]={0,0,0,0};
  bool ans = true;
  for (int i = 0; i < 6; i++)  {
    int n;
    cin >> n;
    use[n-1]++;
  }
  for (int i = 0; i < 4; i++) {
    if (use[i] >= 3) ans = false;
  }

  if (ans) {
    cout << "YES" << "\n";
  } else {
    cout << "NO" << "\n";
  }
  return 0;
}

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

using namespace std;

#define N 300000

int main(int argc, char const *argv[])
{
	int n;
	int cnt;
	int ch[N];
	vector<int> v;

	int i1,i2;

	ch[0]=0;
	ch[1]=0;
	ch[2]=1;
	v.push_back(2);
	for(i1=3;i1<N;i1++){
		for(i2=0;i2<v.size();i2++){
			if(i1%v[i2]==0) {
				ch[i1]=0;
				break;
			}
		}
		if(i2==v.size()) {
			ch[i1]=1;
			v.push_back(i1);
		}
	}


	while(1){
		cin>>n;
		if(n==0) break;

		cnt=0;
		for(i1=n+1;i1<=2*n;i1++){
			if(ch[i1]==1) cnt++;
		}

		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 2592
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <limits.h>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	int n,k;
	int cnt=0;
	ll x[50];
	ll y[50];
	ll Mx;
	ll mx;
	ll My;
	ll my;
	ll ans=LLONG_MAX;
	
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>x[i]>>y[i];
	}

	for(int xi=0;xi<n;xi++)
	{
		for(int xj=xi+1;xj<n;xj++)
		{
			for(int yi=0;yi<n;yi++)
			{
				for(int yj=yi+1;yj<n;yj++)
				{
					cnt=0;
					Mx = max(x[xi],x[xj]);
					mx = min(x[xi],x[xj]);
					My = max(y[yi],y[yj]);
					my = min(y[yi],y[yj]);
					for(int h=0;h<n;h++)
					{
						if(x[h]>=mx && x[h]<=Mx && y[h]>=my && y[h]<=My)
							cnt++;
					}
					if(cnt>=k)
						ans=min((Mx-mx)*(My-my),ans);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template <typename T> using vec = vector<T>;

int main()
{
	int a,b,c,d,e;
	cin >> a >> b >> c >> d >> e;
	if (a==0)
	{
		cout << 1 << endl;
	}
	if (b==0)
	{
		cout << 2 << endl;
	}
	if (c==0)
	{
		cout << 3 << endl;
	}
	if (d==0)
	{
		cout << 4 << endl;
	}
	if (e==0)
	{
		cout << 5 << endl;
	}
	
	
	
}


Measured memory_bytes: 3584
S=input()

ans="No"
n=0
w=0
e=0
s=0
tate=0
yoko=0

for str in S:
  if str=="N":
    n +=1
  elif str=="E":
    e +=1
  elif str=="S":
    s +=1
  else:
    w +=1

if (n>0 and s>0) or (n==0 and s==0):
  tate=True
if (e>0 and w>0) or (e==0 and w==0):
  yoko=True
  
if tate and yoko:
  ans="Yes"
  
print(ans)

Measured memory_bytes: 3064
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

class Dice:
    def __init__(self,a):
        self.dice = [0 for i in range(len(a))]
        for i in range(len(a)):
            self.dice[i] = a[i]

    def N(self):
        self.dice[0],self.dice[1],self.dice[4],self.dice[5] = self.dice[1],self.dice[5],self.dice[0],self.dice[4]

    def S(self):
        self.dice[0],self.dice[1],self.dice[4],self.dice[5] = self.dice[4],self.dice[0],self.dice[5],self.dice[1]

    def E(self):
        self.dice[0],self.dice[2],self.dice[3],self.dice[5] = self.dice[3],self.dice[0],self.dice[5],self.dice[2]

    def W(self):
        self.dice[0],self.dice[2],self.dice[3],self.dice[5] = self.dice[2],self.dice[5],self.dice[0],self.dice[3]

    def R(self):
        self.dice[1],self.dice[2],self.dice[3],self.dice[4] = self.dice[3],self.dice[1],self.dice[4],self.dice[2]

    def L(self):
        self.dice[1],self.dice[2],self.dice[3],self.dice[4] = self.dice[2],self.dice[4],self.dice[1],self.dice[3]

    #確認用
    def output(self):
        print(self.dice)


dice1 = Dice(a)
dice2 = Dice(b)
dir = 'RRRRNRRRRSWRRRREERRRRWSRRRRNNNRRRR'
for c in dir:
    if c == "R":
        dice1.R()
    elif c == "N":
        dice1.N()
    elif c == "S":
        dice1.S()
    elif c == "W":
        dice1.W()
    elif c == "E":
        dice1.E()
    elif c == "L":
        dice1.L()
    if dice1.dice == dice2.dice:
        break

if dice1.dice == dice2.dice:
    print('Yes')
else:
    print('No')



Measured memory_bytes: 5624
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

ll N, K, A[100010],  ans;

ll cnt[40][2];
ll cost[40];
ll value[40];

int main(){

    cin >> N >> K;
    for(int i=0; i < N; i++){
        cin >> A[i];
        ans += A[i];
        for(ll j = 1,k=0;k<40;k++,j*=2){
            if(A[i] & j)cnt[k][1]++;
            else cnt[k][0]++;
        }
    }
    for(ll i=0, b=1;i<40;i++, b*=2){
        cost[i] = b;
        value[i] = b * (cnt[i][0] - cnt[i][1]);
    }

    for(ll i = 39, tmp = ans; i >= 0; i--){
        if(!(cost[i] & K)){
            continue;
        }
        ll sum = tmp;
        for(ll j=i-1;j>=0;j--){
            sum += max(0LL, value[j]);
        }
        ans = max(ans, sum);
        tmp += max(0LL, value[i]);
        ans = max(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<set>
#include<map>
#include<stdbool.h>
#include<math.h>
#include<sstream>
#include<math.h>
#include<vector>
#include<functional>
#include<queue>
#include<utility>
#include<bitset>
typedef long long ll;
#define N (1000000000+7)
#define INF 1e16
using namespace std;
typedef pair<ll, ll> P;
ll gcd(ll a, ll b) {
	if (b > a) {
		ll tmp = b;
		b = a;
		a = tmp;
	}
	if (a%b == 0)return b;
	else return gcd(b, a%b);
}

int main(void) {
	ll n, x;
	cin >> n >> x;
	ll a, ans = 0;
	for (ll i = 0;i < n;i++) {
		cin >> a;
		if (i == 0)ans = (ll)abs(a - x);
		else ans = gcd(ans, (ll)abs(a - x));
	}
	cout << ans << endl;
}

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

typedef long long int lli;
#define MAXN 200003
#define LOGMAXN  20  

lli M[MAXN][LOGMAXN];
lli logTable[MAXN];
lli aux[MAXN];

struct SparseTable {
  int n;
  SparseTable(int t) : n(t) {}

  void add(lli idx, lli a) {
    aux[idx] = a;
  }

  void process(){
    int i, j;
    for(i = 2; i <= n; i++)
      logTable[i] = logTable[i >> 1] + 1;

    for (i = 0; i < n; i++)
      M[i][0] = aux[i];

    for (j = 1; 1 << j <= n; j++)
      for (i = 0; i + (1 << j) - 1 < n; i++) {
      	M[i][j] = __gcd(M[i][j - 1], M[i + (1 << (j - 1))][j - 1]);
      }
  }

  lli query(int i, int j){
    int k = logTable[j - i + 1];
    return __gcd(M[i][k], M[j - (1<<k) + 1][k]);
  }
};

int main () {
	
	int n=0, x=0, f=0, i=0, j=0;
	vector <int> v; 

	cin >> n;

	for (i=0; i<n; i++) {
		cin >> x;
		v.push_back(x);
	}

	for (i=0; i<n; i++) {
		v.push_back(v[i]);
	}

	int t = v.size();
	SparseTable st(t);

	long long int res = -1;
	for (i=0; i<t; i++) {
		//cout << v[i] << " ";
		st.add(i, v[i]);
	}
	//cout << endl;

	st.process();
	for (i=0; i<=n; i++) {
		res = max(res, st.query(i, i+(n-2)));
	}

	//for (i=0; i<t; i++) {
	//	for (j=0; j<=3; j++)cout << M[i][j] << " ";
	//	cout << endl;
	//}


	cout << res << endl;

	return 0;
}

Measured memory_bytes: 35572
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main(){
    int i,n,ans;
    cin >> n;
    vector <int> v(n);
    for(i=0;i<n;i++){
        cin >> v[i];
    }
    sort(v.begin(),v.end());
    ans = (unique(v.begin(),v.end()) - v.begin());
    if((n-ans)%2==1){
        cout << ans-1 << endl;
    }else{
        cout << ans << endl;
    }
}

Measured memory_bytes: 640
#include<cstdio>
#include<algorithm>
int a[110];
int main()
{
	int n;scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	if(n&1) n++;
	std::sort(a+1,a+n+1);
	int ans=0;
	for(int i=1;i<=n;i+=2) ans+=a[i+1]-a[i];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdio.h>
#include<string.h>
using namespace std;
typedef long long ll;
int main()
{
    long long a,b=0;
    cin>>a;
    for(int i=1;i<=a;i++)
    {
        if(i%3==0||i%5==0);
    else b=b+i;
    }
    cout<<b;
    return 0;

}

Measured memory_bytes: 3556
A,B,C,D= list(map(int, input().split()))
i = 0
k = 0
while A > 0 and C > 0:
    C -= B
    i += 1
    if C <= 0:
        break
    A -= D
    k += 1

if (A>C):
    print("Yes")
else:
    print("No")




Measured memory_bytes: 9176
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		sc.close();
		
		int t = m * 1900 + (n-m) * 100;
		System.out.println(t*(int)Math.pow(2, m));
	}
}


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

using namespace std;

typedef long long ll;


ll dp( ll H )
{
    if ( H == 1 ) return 1;
    if ( H % 2 ) H--;

    return ( 1 + 2 * dp( H / 2 ) );
}

int main()
{
    ll H; cin >> H;

    cout << dp(H);
    return 0;
}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};
int a,b,c,d, A[100], B[100], C[100][100], D[100][100][100];
string s, t, r;




int main(){
	cin >> a;
	cout << a/2 * (a/2+(a%2)) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>  
#include<cstring>  
#include<algorithm>  
#include<cmath>  
#define LL long long  
  
using namespace std;  
const int maxn=56;  
const int MAXN=330000;   
int prime[MAXN];//保存素数     
bool vis[MAXN];//初始化  
int ans[66];  
int Prime(int n)    
{    
    int cnt=0;    
    memset(vis,0,sizeof(vis));    
    for(int i=2;i<n;i++)    
    {    
        if(!vis[i])    
        prime[cnt++]=i;    
        for(int j=0;j<cnt&&i*prime[j]<n;j++)    
        {    
            vis[i*prime[j]]=1;    
            if(i%prime[j]==0)//关键 如果i是之前素数的倍数 说明之后的i的倍数已经被筛选了    
            break;    
        }    
    }    
    return cnt;//返回小于n的素数的个数     
}     
int main()  
{  
    Prime(55556);  
    int n;  
    cin>>n;  
    int cnt=1;  
    cout<<11;  
    for(int i=6;i<5300;i++){  
        if( cnt<n && prime[i]%10 == 1){  
            cnt++;  
            cout<<" "<<prime[i];  
        }  
    }  
    cout<<endl;  
}  
/*
要想5个数任意一个都可以被整除，不如就规定好被5整除，那么每个数只要n×5+1就行了。
#include <iostream>
using namespace std;
int an[55566];
void search() {
    an[0] = 1,an[1] = 1;
    for(int i=2;i<=55555;i++){
        if(!an[i]){
            for(int j=2;j*i<=55555;j++){
                an[i*j] = 1;
            }
        }
    }
}
int main() {
  int n, count = 2;
  search();
  cin >> n;
  int prime[n];
  for (int i = 0; i < n;) {
    if ( !an[count] && count % 5 == 1) {
      prime[i] = count;
      i++;
    }
    count++;
  }
  for (int i = 0; i < n; i++) {
    cout << prime[i] <<" ";
  }
  cout<<endl;
  return 0;
}
#include <iostream>
using namespace std;
int an[55566];
void search() {
    an[0] = 1,an[1] = 1;
    for(int i=2;i<=55555;i++){
        if(!an[i]){
            for(int j=2;j*i<=55555;j++){
                an[i*j] = 1;
            }
        }
    }
}
int main() {
  int n, count = 2;
  search();
  cin >> n;
  int prime[n];
  for (int i = 0; i < n;) {
    if ( !an[count] && count % 5 == 1) {
      prime[i] = count;
      i++;
    }
    count++;
  }
  for (int i = 0; i < n; i++) {
    cout << prime[i] <<" ";
  }
  cout<<endl;
  return 0;
}*/

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

int main(){
    char A[101]={},B[101]={};
    scanf("%s",A);
    scanf("%s",B);
    if(strlen(A)!=strlen(B)){
        if(strlen(A)>strlen(B)) puts("GREATER\n");
        else puts("LESS");
    }else{
        if(strcmp(A,B)>0){
            puts("GREATER");
        }else if(strcmp(A,B)<0){
            puts("LESS");
        }else{
            puts("EQUAL");
        }
    }
    return 0;
}

Measured memory_bytes: 128
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int mod=1e9+7;
int dp[5005][5005];
char s[5005];
typedef long long ll;
ll qmod(ll a,ll b)
{
    ll ans=1;
	while(b)
    {
        if(b&1)
        {
            ans=(a*ans)%mod;
        }
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}
int main()
{
	int n;
	cin>>n;
	scanf("%s",s);
	int m=strlen(s);
	dp[0][0]=1;
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=i;j++)
		{
			dp[i+1][j+1]=(0ll+dp[i+1][j+1]+2ll*dp[i][j])%mod;
			dp[i+1][max(0,j-1)]=(0ll+dp[i+1][max(0,j-1)]+dp[i][j])%mod;
		}
	}
	cout<<dp[n][m]*qmod(qmod(2,m),mod-2)%mod<<endl;
	return 0;
}

Measured memory_bytes: 96512
#include<iostream>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
int main(){
   long long a,b,c,k;
   cin>>a>>b>>c>>k;
   long long ans=0;
   if(k<=a) ans+=k;
   else{
       ans+=a;
       k-=a;
       if(k>b){

        k-=b;
        ans-=k;
       }

   }
   cout<<ans<<endl;

}


Measured memory_bytes: 3620
n,k = map(int,input().split())
l = [0]*(10**5+1)
for i in range(n):
    ai,bi = map(int,input().split())
    l[ai]+=bi
for index,i in enumerate(l):
    if i:
        k-=i
        if k<=0:
            break
print(index)

Measured memory_bytes: 11660
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;
public class Main{
	  public static void main(String[] args){
		  Scanner sc = new Scanner(System.in);

		  int N = sc.nextInt();
		  Set<Integer> set = new TreeSet<Integer>();

		  for(int i = 0; i < N; i++) {
			  set.add(sc.nextInt());
		  }
		  System.out.println(set.size());
	  }
}

Measured memory_bytes: 22996
#include<iostream>
#include<vector>
using namespace std ;
using ll = long long ;

ll gcd(ll a,ll b){
	if(b==0) return a ;
	return gcd(b,a%b) ;
}

int main(){
	ll a,b ;
	cin >> a >> b ;
	ll g = gcd(a,b) ;
	ll cnt = 1 ;
	for(ll i=2;i*i<=g;i++){
		if(g%i==0){
			cnt++ ;
			while(g%i==0) g /= i ;
		}
	}
	if(g!=1) cnt++ ;
	cout << cnt << endl ;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int mn(int a,int b,int c)
{
	return min(a,min(b,c));
}
int main()
{
	string s;
	int n,num1,num2,num3,ans=0;
//	nemset(num,0,sizeof num);
	num1=num2=num3=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>s;
		int len=s.size();
		if(s[0]=='B'&&s[len-1]=='A')
			 num1++;
		else if(s[0]=='B') num2++;
		else if(s[len-1]=='A') num3++;
		for(int j=1;j<len;j++)
			if(s[j]=='B'&&s[j-1]=='A') ans++;
		s.clear();
	}
//	if(num1>1) 
//	{
//		ans+=(num1-1);
//		num1=1;
//	}
//	if(num2>0&&num3>0)
//	{
////		ans+=min(num2,num3);
////		if(num2!=num3&&num1>0) ans++;
//		if(num3>0&&num2>0) 
//		{
//			ans+=(num1+1);
//			num3--;
//			num2--;
//		}
//		else if(num3>0||num2>0) ans++;
//		ans+=min(num2,num3);
//	 } 
	int x=mn(num1,num2,num3);
	ans+=x*2;
	num1-=x;
	num2-=x;
	num3-=x;
	if(num1>1&&x) 
	{
		ans+=(num1);
		num1=0;
	}
	else if(num1>1&&!x) 
	{
		ans+=(num1-1);
		num1=1;
	}
	if(!num1) ans+=min(num2,num3);
	else if(!num2) ans+=min(num1,num3);
	else if(!num3) ans+=min(num1,num2);
//	else if(num2>0) ans+=(1);
//	else if(num3>0) ans+=1;
	cout<<ans;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int L[105];
	int D[105];
	int n,x;
	int count = 0;
	cin>>n>>x;
	for(int i=1;i<=n;i++)
	{
		cin>>L[i];
	}
	D[1]=0;
	for(int i=2;i<=n+1;i++)
	{
		D[i]=D[i-1]+L[i-1];
	}
	for(int i=1;i<=n+1;i++)
	{
//		cout<<D[i]<<endl;
		if(D[i]<=x) count++;
	}
	cout<<count<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x1 = sc.nextInt();
        int y1 = sc.nextInt();
        int x2 = sc.nextInt();
        int y2 = sc.nextInt();

        int x_diff = x2 - x1;
        int y_diff = y2 - y1;

        int x3 = x2 - y_diff;
        int y3 = y2 + x_diff;

        int x4 = x1 - y_diff;
        int y4 = y1 + x_diff;

        System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
    }
}

Measured memory_bytes: 25300
//abc141_b.cpp
//Sun Sep 15 20:57:54 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	string s;
	cin >> s;

	int flag = 1;
	for (int i=0;i<s.length();i++){
		if ((i+1)%2==1 && s[i]!='L'){
		}else if ((i+1)%2==0 && s[i] != 'R'){
		}else {
			flag = 0;
		}
	}

	if (flag){
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 256
while True:
  h,w = map(int, input().split())
  if not h:
    break
#dp[R][U][""]
  h -= 1
  w -= 1
  mp = {(0,2,"UU") : 1, (2,0,"RR") : 1, (1,1,"UR") : 1, (1,1,"RU") : 1}
  for i in range(h + 1):
    for j in range(w + 1):
      if i + j <= 2:
        continue
      mp[(i, j, 'UU')] = 0
      if (i, j - 1, 'UU') in mp:
        mp[(i, j, 'UU')] += mp[(i, j - 1, 'UU')]
      if (i, j - 1, 'RU') in mp:
        mp[(i, j, 'UU')] += mp[(i, j - 1, 'RU')]
      mp[(i, j, 'RR')] = 0
      if (i - 1, j, 'RR') in mp:
        mp[(i, j, 'RR')] += mp[(i - 1, j, 'RR')]
      if (i - 1, j, 'UR') in mp:
        mp[(i, j, 'RR')] += mp[(i - 1, j, 'UR')]
      mp[(i, j, 'UR')] = 0
      if (i - 1, j, 'UU') in mp:
        mp[(i, j, 'UR')] += mp[(i - 1, j, 'UU')]
      mp[(i, j, 'RU')] = 0
      if (i, j - 1, 'RR') in mp:
        mp[(i, j, 'RU')] += mp[(i, j - 1, 'RR')]
  print((mp[(h, w, 'UU')] + mp[(h, w, 'UR')] + mp[(h, w, 'RU')] + mp[(h, w, 'RR')]) % 100000)





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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

const lli e5 = 1 << 20;
const lli mod = 1000000007;

lli n;
lli a[e5];
unordered_map<lli,lli> mem;
lli ans = 0;

int main(){
	cin >> n;
	for(lli i = 0;i < n;i++) cin >> a[i];
	sort(a,a+n);
	for(lli i = n-1;i >= 0;i--){
		if(mem[a[i]] > 0){
			ans++;
			mem[a[i]]--;
		}else{
			lli b = 1;
			while(b <= a[i]) b *= 2;
			mem[b-a[i]]++;
		}
	}
	cout << ans << endl;

}


Measured memory_bytes: 18420
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

int main() {
  i64 a, b;
  cin >> a >> b;
  cout << max(0ll, a - 2 * b) << endl;
}


Measured memory_bytes: 256
import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    A = list(mi())

    s = 0
    t = 0
    for i in range(N):
        s += A[i]*A[i]
        t += A[i]

    print(((t*t-s)//2)%MOD)

if __name__ == '__main__':
    main()


Measured memory_bytes: 32000
s=input()
if 'N' in s and not 'S' in s:
  print('No')
elif 'S' in s and not 'N' in s:
  print('No')
elif 'W' in s and not 'E' in s:
  print('No')
elif 'E' in s and not 'W' in s:
  print('No')
else:
  print('Yes')

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
using namespace std;
 
int main() {
    fast();
   /* ll t;
    cin>>t;
    while(t--)			
    {
        
    }*/
    ll k;
    cin>>k;
    string s;
    cin>>s;
    if(s.length()<=k)
    cout<<s;
    else
    {
        for(int i=0;i<k;i++)
        cout<<s[i];
        cout<<"...";
    }
}


Measured memory_bytes: 3668
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N, A, B = input_number_list()
    S = input()
    total = 0
    total_f = 0
    for c in S[:-1]:
        isNg = False
        if c == 'a' and total < A + B:
            total += 1
        elif c == 'b' and total < A + B and total_f < B:
            total += 1
            total_f += 1
        else:
            isNg = True
        print('YNeos'[isNg::2])


if __name__ == '__main__':
    main()


Measured memory_bytes: 4144
#include <bits/stdc++.h>
using namespace std;
 int main() {
 int N, R, G, B, count;
 cin >> R >> G >> B >> N;
 count = 0; 
 for(int r = 0; r <= N; r++){
   for(int g = 0; g <= N; g++){
     int P = N - (G*g + R*r);
     if(P >= 0 && P % B == 0){
       count++;
     }
   }
 }
   cout << count << endl;
 }

Measured memory_bytes: 256
#include <stdio.h>
         
typedef struct dice{
  int up;
  int front;
  int right;
  int left;
  int back;
  int down;
} dice;
      
dice *rotate(dice *d,char c){
  int temp;
     
  if(c=='N'){
    temp=d->front;
    d->front=d->down;
    d->down=d->back;
    d->back=d->up;
    d->up=temp;
  } else if(c=='S') {
    temp=d->back;
    d->back=d->down;
    d->down=d->front;
    d->front=d->up;
    d->up=temp;
  } else if(c=='E') {
    temp=d->left;
    d->left=d->down;
    d->down=d->right;
    d->right=d->up;
    d->up=temp;
  } else if(c=='W') {
    temp=d->right;
    d->right=d->down;
    d->down=d->left;
    d->left=d->up;
    d->up=temp;
  }
      
  return d;
}
 
int dice_judge(dice *d){
  int num=0;
 
  if(d->up==d->front)  num++;
  if(d->up==d->right)  num++;
  if(d->up==d->back)  num++;
  if(d->up==d->left)  num++;
  if(d->up==d->down)  num++;
  if(d->front==d->right)  num++;
  if(d->front==d->back)  num++;
  if(d->front==d->left)  num++;
  if(d->front==d->down)  num++;
  if(d->right==d->back)  num++;
  if(d->right==d->left)  num++;
  if(d->right==d->down)  num++;
  if(d->back==d->left)  num++;
  if(d->back==d->down)  num++;
  if(d->left==d->down)  num++;
 
  return num;
}
    
int main(void){
  dice d1,d2;
  dice *root;
  int judge;
          
  root=&d1;
  scanf("%d%d%d%d%d%d",&d1.up,&d1.front,&d1.right,&d1.left,&d1.back,&d1.down);
  scanf("%d%d%d%d%d%d",&d2.up,&d2.front,&d2.right,&d2.left,&d2.back,&d2.down);
 
  judge=dice_judge(root);
  if(judge>=10){
    printf("Yes\n");  return 0;
  }
 
  root=&d2;
  if(d1.up==d2.up) ;
  else if(d1.up==d2.front)  root=rotate(root,'N');
  else if(d1.up==d2.right)  root=rotate(root,'W');
  else if(d1.up==d2.left)  root=rotate(root,'E');
  else if(d1.up==d2.back)  root=rotate(root,'S');
  else if(d1.up==d2.down){
    root=rotate(root,'N');  root=rotate(root,'N');
  }
      
  if(d1.front==d2.down)  printf("No\n");
  else if(d1.front==d2.front){
    if(d1.right==d2.right && d1.back==d2.back && d1.left==d2.left)  printf("Yes\n");
    else printf("No\n");
  } else if (d1.front==d2.right) {
    if(d1.right==d2.back && d1.back==d2.left && d1.left==d2.front)  printf("Yes\n");
    else printf("No\n");
  } else if(d1.front==d2.back) {
    if(d1.right==d2.left && d1.back==d2.front && d1.left==d2.right)  printf("Yes\n");
    else printf("No\n");
  } else if(d1.front==d2.left) {
    if(d1.right==d2.front && d1.back==d2.right && d1.left==d2.back)  printf("Yes\n");
    else printf("No\n");
  }
   
  return 0;
}

Measured memory_bytes: 580
#include "bits/stdc++.h"
using namespace std;

const int N=1e5+20;

int n,q,x,y,f[N];
long long ans;

int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&x);
		f[x]++;
		ans+=x;
	}

	scanf("%d",&q);
	while(q--)
	{
		scanf("%d%d",&x,&y);
		ans-=1ll*f[x]*x;
		ans+=1ll*f[x]*y;
		f[y]+=f[x];
		f[x]=0;
		
		printf("%lld\n",ans);
	}
}

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

#define endl '\n'
#define lfs cout<<fixed<<setprecision(10)
#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define test cout<<"test"<<endl;
#define fi first
#define se second
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (m) - 1; i >= (ll)(n); i--)
using ll = long long;
using ld = long double;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T>
void chmin(T &a,T b){if(a>b)a=b;}
template<typename T>
void chmax(T &a,T b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
ll median(ll a,ll b, ll c){return a+b+c-max({a,b,c})-min({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>
void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}  
template<typename T>
void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cout<<v[i][0];for(ll j=1;j<w;j++)cout spa v[i][j];cout<<endl;}};
void debug(vector<string>&v,ll h,ll w){for(ll i=0;i<h;i++)
{for(ll j=0;j<w;j++)cout<<v[i][j];cout<<endl;}};
template<typename T>
void debug(vector<T>&v,ll n){if(n!=0)cout<<v[0];
for(ll i=1;i<n;i++)cout spa v[i];cout<<endl;};
template<typename T>
vector<vector<T>>vec(ll x, ll y, T w){
  vector<vector<T>>v(x,vector<T>(y,w));return v;}
ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;}
vector<ll>dx={1,0,-1,0,1,1,-1,-1};
vector<ll>dy={0,1,0,-1,1,-1,1,-1};
template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}
ostream &operator<<(ostream &os, pair<ll, ll>&p){
  return os << p.first << " " << p.second;
}  
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  ll res=0,buf=0;
  bool judge = true;
  //ll a;cin>>a;
  ll a,b;cin>>a>>b;
  //ll a,b,c;cin>>a>>b>>c;
  //ll a,b,c,d;cin>>a>>b>>c>>d;
  //string s;cin>>s;
  //cout<<<<endl;
  //ans1();
  //ans(,"","");
  //ans(,,);
  rep(i,0,3){
    if(a!=i+1&&b!=i+1)cout<<i+1<<endl;
  }
  return 0;
}

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

class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            var inputs = Array.ConvertAll<String, int>(input.Split(' '), s => int.Parse(s));

            List<Person> persons = new List<Person>();
            for (int i = 0; i < inputs[0]; i++)
            {
                var personLine = Console.ReadLine();
                persons.Add(new Person(personLine));
            }

            List<Food> everyoneLoved = persons[0].GetLikeFoods();
            for (int i = 1; i < persons.Count; i++)
            {
                everyoneLoved = everyoneLoved.Where(f => persons[i].GetLikeFoods().Any(s => s.FoodNumber == f.FoodNumber)).ToList();
            }

            Console.WriteLine(everyoneLoved.Count);
        }
    }

    public class Person
    {
        private List<Food> likeFoods = new List<Food>();
        public Person(String line)
        {
            var inputs = Array.ConvertAll<String, int>(line.Split(' '), s => int.Parse(s));
            var answerCount = inputs[0];

            var likeFoods = new List<Food>();
            for (int i = 1; i <= answerCount; i++)
            {
                likeFoods.Add(new Food() { FoodNumber = inputs[i] });
            }
            this.likeFoods = likeFoods;
        }

        public List<Food> GetLikeFoods()
        {
            return this.likeFoods;
        }
    }

    public class Food
    {
        public int FoodNumber { get; set; }
    }

Measured memory_bytes: 13396
#include<iostream> 
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
#define ll long long
#define N 110
char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>'z')&&(c<'0'||c>'9')) c=getchar();return c;}
int gcd(int n,int m){return m==0?n:gcd(m,n%m);}
int read()
{
	int x=0,f=1;char c=getchar();
	while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
	while (c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
int n,a[N],s,ans=0;
int calc(int k){return abs(s-a[k]*n);}
int main()
{
/*#ifndef ONLINE_JUDGE
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	const char LL[]="%I64d\n";
#else
	const char LL[]="%lld\n";
#endif*/
	n=read();
	for (int i=1;i<=n;i++) s+=a[i]=read();
	for (int i=2;i<=n;i++)
	if (calc(i)<calc(ans+1)) ans=i-1;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int DP[200005];

int main() {
  int cnt;
  for(int i=1;i<200005;++i){
    cnt = 0;
    for(int j=0;j<32;++j){
      if((i&(1<<j))!=0) cnt++;
    }
    DP[i] = DP[i%cnt] + 1;
  }
  int N;
  cin>>N;
  string S;
  cin>>S;
  cnt = 0;
  for(int i=0;i<S.size();++i) {
    if(S[i]=='1') cnt++;
  }
  if(cnt==0){
    for(int i=0;i<N;++i) cout<<1<<endl;
    return 0;
  }
  int amarimin = 0, amariadd = 0;
  int two = 1;
  if(cnt>1){
    for(int i=S.size()-1;i>=0;--i){
      if(S[i]=='1') {
        amarimin += two%(cnt-1);
        amarimin %= cnt-1;
      }
      two *= 2;
      two %= cnt-1;
    }
  }
  two = 1;
  for(int i=S.size()-1;i>=0;--i){
    if(S[i]=='1') {
      amariadd += two%(cnt+1);
      amariadd %= cnt+1;
    }
    two *= 2;
    two %= cnt+1;
  }
  vector<int> ans(N);
  bool zero[N];
  for(int i=0;i<N;++i) zero[i] = false;
  int twoadd = 1, twomin = 1;
  for(int i=S.size()-1;i>=0;--i){
    if(S[i]=='1'){
      if(cnt==1) zero[i] = true;
      else {
        ans[i] = (amarimin - twomin + (cnt-1))%(cnt-1);
      }
    }
    else{
      ans[i] = (amariadd + twoadd) % (cnt+1);
    }
    twoadd *= 2;
    twoadd %= cnt+1;
    if(cnt>1){
      twomin *= 2;
      twomin %= cnt-1;
    }
  }
  for(int i=0;i<N;++i){
    if(zero[i]) cout<<0<<endl;
    else cout<<1+DP[ans[i]]<<endl;
  }
}



Measured memory_bytes: 5428
#include <bits/stdc++.h>
using namespace std;
 
#define sws ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define INFINITO 1000000000
#define ll long long
#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define fo(i, n) for( int i = 0; i < n; i++ )


int main() {

    ll x;
    cin >> x;

    ll at = 100;
    int i = 0;
    while ( at < x ) {
        i++;
        at *= 1.01;
    }

    cout << i << endl;

    return 0;
}

Measured memory_bytes: 3612
N=int(input())
ans=0
for i in range(1,N):
    j=N-i
    i_s=sum(map(int,list(str(i))))
    j_s=sum(map(int,list(str(j))))
    S=i_s+j_s
    if ans==0:
        ans=S
    else:
        if S<ans:
            ans=S
        else:
            continue

print(ans)

Measured memory_bytes: 3060
diceface = { "TOP":0,"FRONT":1,"RIGHT":2,"LEFT":3,"BACK":4,"BOTTOM":5 }

dice = [ int( i ) for i in raw_input( ).split( " " ) ]
roll = raw_input( )
for i in roll:
	if "E" == i:
		t = dice[ diceface["TOP"] ]
		dice[ diceface["TOP"] ] = dice[ diceface["LEFT"] ]
		dice[ diceface["LEFT"] ] = dice[ diceface["BOTTOM"] ]
		dice[ diceface["BOTTOM"] ] = dice[ diceface["RIGHT"] ]
		dice[ diceface["RIGHT"] ] = t
	elif "N" == i:
		t = dice[ diceface["TOP"] ]
		dice[ diceface["TOP"] ] = dice[ diceface["FRONT"] ]
		dice[ diceface["FRONT"] ] = dice[ diceface["BOTTOM"] ]
		dice[ diceface["BOTTOM"] ] = dice[ diceface["BACK"] ]
		dice[ diceface["BACK"] ] = t
	elif "S" == i:
		t = dice[ diceface["TOP"] ]
		dice[ diceface["TOP"] ] = dice[ diceface["BACK"] ]
		dice[ diceface["BACK"] ] = dice[ diceface["BOTTOM"] ]
		dice[ diceface["BOTTOM"] ] = dice[ diceface["FRONT"] ]
		dice[ diceface["FRONT"] ] = t
	elif "W" == i:
		t = dice[ diceface["TOP"] ]
		dice[ diceface["TOP"] ] = dice[ diceface["RIGHT"] ]
		dice[ diceface["RIGHT"] ] = dice[ diceface["BOTTOM"] ]
		dice[ diceface["BOTTOM"] ] = dice[ diceface["LEFT"] ]
		dice[ diceface["LEFT"] ] = t	

print( dice[ diceface["TOP"] ] )

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; i++) {
  cin >> p.at(i);
  }
  int a=0;
  int b=1000000;
  for (int i = 0; i < N; i++) {
    
      if(p.at(i)<b){

          a++;
          b=min(b,p.at(i));
        
      }
    }
  cout<<a<<endl;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const int INF = INT_MAX;
const ll MOD = 1e9+7;


ll dp[55][55][2510];

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,A;cin>>N>>A;
  vint x(N);
  repeat(i,N)cin>>x[i];
  dp[0][0][0]=1;
  for(int i=1;i<=N;i++){
    repeat(j,i+1){
      repeat(k,i*50+1){
        dp[i][j][k] = dp[i-1][j][k];
        if(j>0&&k>=x[i-1])dp[i][j][k] += dp[i-1][j-1][k-x[i-1]];
      }
    }
  }
  ll ans = 0;
  repeat(i,N){
    ans += dp[N][i+1][(i+1)*A];
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 53504
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 07/11/20 19:53:47
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int l,r,d; cin>>l>>r>>d;
  int ans = 0;
  for (int k = l; k <= r; k++) {
    if (k%d == 0)
      ans++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3640
from collections import defaultdict, deque
N,M=map(int, input().split())
G = {i: [] for i in range(1, N+1)}
deg = [0]*(N+1)
for _ in range(M):
    x,y=map(int,input().split())
    G[x].append(y)
    deg[y] += 1

from collections import deque, defaultdict
S = [i for i in range(1, N+1) if deg[i]==0]
dp = [0]*(N+1)

def topological_sort(adj, indeg):
    """
    幅優先探索によるトポロジカルソート
    O(|V|+|E|)

    adj: 隣接リスト
    indeg: 各ノード入次数を管理するリスト

    ret: トポロジカルソートされたリスト
    """
    is_visited = [0]*(N+1)
    ret = []
    def bfs():
        """
        sからBFSする
        """
        queue = deque(S)
        while queue:
            u = queue.popleft()
            # queueには入次数0のノードが入っているのでretに追加
            # ret.append(u)

            for v in adj[u]: # uの子ノードを探索
                indeg[v] -= 1 #探索したら子の次数を減らす
                if (indeg[v] == 0):
                    # 入次数0かつ未訪問なら
                    queue.append(v)
                    dp[v] = max(dp[v], dp[u]+1)
                    is_visited[v] = 1
    
    bfs()
    
    # return ret

topological_sort(G, deg)
print(max(dp))

Measured memory_bytes: 91120
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin >> s >> t;
  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  reverse(t.begin(),t.end());
  if(s < t)cout << "Yes" << endl;
  else cout << "No" << endl;

}


Measured memory_bytes: 256