akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(void){
    int i, score, sum, max, min;
    double ave;
    int n=1;
    scanf("%d", &n);
    while(n!=0){
        ave=0; max=0; min=1000;
        for(i=0;i<n;i++){
            scanf("%d", &score);
            ave = (ave*i + score)/(i+1);
            if(score>max){
                max=score;
            }
            if(score<min){
                min=score;
            }
        }
        ave=(ave*i-min-max)/(i-2);
        printf("%d\n", (int)ave);
        scanf("%d", &n);
    }
    return 0;
}

Measured memory_bytes: 1028
using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.IO;
    using System.Text;
    using System.Text.RegularExpressions;

    class Program
    {
        static void Main()
        {
            var input = decimal.Parse(Console.ReadLine());
            var ans = ToColumnName(input);
            try
            {
                Output(ans.ToString().ToLower());
            }
            catch
            {
                Output(ans.ToString().ToLower());
            }
        }
        private static void Output(string str)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            Console.WriteLine(str);

            Console.Out.Flush();
        }

        /// <summary>
        /// 数値をExcelのカラム文字へ変換します
        /// </summary>
        /// <param name="column"></param>
        /// <returns></returns>
        private static string ToColumnName(decimal source)
        {
            if (source < 1) return string.Empty;
            return ToColumnName((source - 1) / 26) + (char)('A' + ((source - 1) % 26));
        }
    }

Measured memory_bytes: 27808
#include <iostream>
int binarySerch(int *S, int n, int key){
    int left = 0;
    int right = n;
    int mid;
    while(left<right){
        mid = (left + right) / 2;
        if(S[mid]==key){
            return mid;
        }else if(S[mid]<key){
            left = mid + 1;
        }else{
            right = mid;
        }
    }
    return -1;
}

int main(){
    int n,q,cnt=0;
    std::cin >> n;
    int S[n];
    for(int i=0;i<n;i++){
        std::cin >> S[i];
    }
    std::cin >> q;
    int T[q];
    for(int i=0;i<q;i++){
        std::cin >> T[i];
    }

    for(int i=0;i<q;i++){
        if(binarySerch(S,n,T[i])!=-1){
            cnt++;
        }
    }

    std::cout << cnt << "\n";
    return 0;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
using namespace std;
signed main(){
	int a,n;
	cin >> a >> n;
	int ans = a * a-n;
	cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

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


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}


//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n;
cin>>n;
ll a;
ll cnt=0;
for(ll i=0;i<n;i++){
    cin>>a;
    if(a%2==0){
        while(a%2==0){
            a/=2;
            cnt++;
        }
    }
}
cout<<cnt<<endl;
}








Measured memory_bytes: 256
/*      ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     */

// Author : Udit "luctivud" Gupta @ (https://www.linkedin.com/in/udit-gupta-1b7863135/)


#include <bits/stdc++.h>
#pragma GCC optimize "trapv"

using namespace std;

typedef long long int lld;
typedef unsigned long long int llu;


#define       TESTCASES()  cin >> (T3X0); T353 = T3X0; while(T3X0--)
#define       _input(V3C)  for(auto &V3C_I7 : (V3C)) cin >> (V3C_I7)
#define mems(A77AY, V4LU)  memset((A77AY), (V4LU), sizeof((A77AY)))
#define  CH3K(I7, E4, S7)  (((S7)<0) ? (I7)>(E4) : (I7)<(E4))
#define for4(I7,S4,E4,S7)  for(auto I7=(S4); CH3K(I7,E4,S7); (I7)+=(S7))




void solveEachTest(lld T35TC453N = 1) {
	string a , b; cin >> a >> b;

	lld num = 0ll;

	for4(i, 0ll, (lld)a.length(), 1ll) {
		num *= 10;
		num += a[i] - '0';
	}

	for4(i, 0ll, (lld)b.length(), 1ll) {
		num *= 10;
		num += b[i] - '0';
	}

	lld idx = 0ll;

	// cout << num;
	while (idx * idx < num) {
		idx++;
	}

	puts((idx * idx == num) ? "Yes" : "No");

	return;
}


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

	lld T3X0 = 0, T353 = 1;

	// TESTCASES()
	solveEachTest(T353 - T3X0);
	return 0;
}
// Random Thought :  AtCoder Practice

Measured memory_bytes: 3612
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	int n, i;
	scanf("%d", &n);
	int m=0;
	for(i=1; m+i<n; i++){
		m+=i;
	}
	for(m=i-(n-m); i>m; i--){
		printf("%d\n", i);
	}
	for(i--; i>0; i--){
		printf("%d\n", i);
	}
}


Measured memory_bytes: 128
a,b,c=sorted(map(int,input().split()))
x=0
loopcounter=0
while a!=b or b!=c or c!=a:
    if a+1<=c and b+1<=c:
        a+=1
        b+=1
        x+=1
    elif a+2<=c:
        a+=2
        x+=1
    elif b+2<=c:
        b+=2
        x+=1       
    elif a!=b and b==c:
        a+=2
        b+=1
        c+=1
        x+=2
    if loopcounter>100000:
        break
    loopcounter+=1
print(x)

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

int main()
{
  string S;
  cin >> S;
  
  if(S[2] == S[3] && S[4] == S[5])
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3548
import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Data.List

main :: IO ()
main = do
    [a,b,k] <- map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
    let l = [a..(min (a+k-1) b)]
        r = [(max a (b-k+1))..b]
    mapM_ print $ nub (l++r)

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

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    ll n, p;
    cin >> n >> p;
    vector<ll> D;
    for (ll d = 1; d * d <= p; ++d)
    {
        if (p % d == 0)
        {
            D.push_back(d);
            D.push_back(p / d);
        }
    }
    ll odp = 1;
    for (int i = 0; i < D.size(); ++i)
    {
        if (D[i] == 1)
            continue;
        ll t = p;
        ll j;
        for (j = 0; j < n; ++j)
        {
            if (t % D[i] != 0)
                break;
            t /= D[i];
        }
        if (t >= 1 && j == n)
            odp = max(odp, D[i]);
    }
    cout << odp;
    return 0;
}


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

int bubbleSort(int A[], int N) {
  int sw = 0;
  bool flag = 1;
  for ( int i = 0; flag; i++) {
    flag = 0;
    for ( int j = N - 1; j >= i + 1; j-- ) {
      if ( A[j] < A[j -1] ) {
        swap(A[j], A[j - 1]);
        flag = 1;
        sw++;
      }
    }
  }
  return sw;
}

int main() {
  int A[100], N, sw;
  cin >> N;
  for ( int i = 0; i < N; i++ ) cin >> A[i];

  sw = bubbleSort(A, N);

  for ( int i = 0; i < N; i++ ) {
    if (i) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << sw << endl;

  return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n;
  cin >> n;
  ll a[n],b[n],c[n];
  rep(i,n){
    cin >> a[i];
  }
  rep(i,n) cin >> b[i];
  rep(i,n) cin >> c[i];
  sort(a,a+n);sort(b,b+n);sort(c,c+n);
  ll sum=0;
  rep(i,n){
    ll big=(c+n)-upper_bound(c,c+n,b[i]);
    ll small=upper_bound(a,a+n,b[i]) - a -(upper_bound(a,a+n,b[i]) -lower_bound(a,a+n,b[i]));
    sum +=big*small;
    //    cout << sum << endl;
  }
  cout << sum << endl;

  
  return 0;
    

}


Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int f[n+1][11],i,j,k;
  for(i=0;i<n;i++)
    for(j=0;j<10;j++)
      scanf("%d",&f[i][j]);
  int p[n+1][11];
  for(i=0;i<n;i++)
    for(j=0;j<=10;j++)
      scanf("%d",&p[i][j]);
  int max=-1000000000;
  for(i=1;i<1024;i++){
    int c[n+1];
    for(k=0;k<n;k++)
      c[k]=0;
    int num=i;
    for(j=0;j<10;j++){
      if(num%2==1)
        for(k=0;k<n;k++)
          if(f[k][j]==1)
            c[k]++;
      num/=2;
    }
    int count=0;
    for(j=0;j<n;j++)
      count+=p[j][c[j]];
    if(max<count)
      max=count;
  }
  printf("%d\n",max);
  return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ALL(a) (a).begin(), (a).end()

const int MOD = 998244353;
ll N, A, B, K;

ll fact[300001], fact_i[300001];

ll power(int x, int y) {
    if (y == 1) return x;
    ll p = power(x, y >> 1);
    if (y & 1) return p * p % MOD * x % MOD;
    else return p * p % MOD;
}

ll inv(ll n) {
    return power(n, MOD - 2);
}

void init() {
    fact[0] = 1;
    REP(i, N) fact[i + 1] = fact[i] * (i + 1) % MOD;
    fact_i[N] = inv(fact[N]);
    REP(i, N) fact_i[N - i - 1] = fact_i[N - i] * (N - i) % MOD;
}

ll nCr(ll n, ll r) {
    return fact[n] * fact_i[r] % MOD * fact_i[n - r] % MOD;
}

int main() {
    cin >> N >> A >> B >> K;
    init();

    ll ans = 0;
    REP(x, N + 1) {
        ll rest = K - A * x;
        if (rest < 0 || rest > B * N || rest % B) continue;

        int y = rest / B;
        ans += nCr(N, x) * nCr(N, y) % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
/*
 * author :Sadik Hassan
 *
*/
#include "bits/stdc++.h"
using namespace std;
#define ll            long long
#define nl            "\n"
#define PB            push_back
#define fi            first
#define se            second
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define rep(i,n)      for(int i=0;i<n;i++)
#define repn(i,n)     for(int i=1;i<=n;i++)
#define rrep(i,n)     for(int i=n-1;i>=0;i--)
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
/*---------------------------------------------------------------------*/
const int N = 2e5+10;
const int INF = (int)1e9+5;

int main()
{
    _SAD()
    int n;
    cin>>n;
    set<int>s;
    rep(i,n)
    {
        int a;
        cin>>a;
        s.insert(a);
    }
    if(n==(int)SZ(s))
    {
        cout<<"YES"<<nl;
    }
    else
    {
        cout<<"NO"<<nl;
    }
    return 0;
}


Measured memory_bytes: 9600
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L.insert(0, [0, 0, 0])

for i in range(1, len(L)):
    t = L[i][0] - L[i-1][0]
    x = L[i][1] - L[i-1][1]
    y = L[i][2] - L[i-1][2]
    num = t - abs(x) - abs(y)
    if num < 0 or num % 2:
        print('No')
        sys.exit()
print('Yes')


Measured memory_bytes: 27300
#include<bits/stdc++.h>
#define M 500006
using namespace std;
int c[M][27],n,cnt;
char ch[M];
int lowbit(int x)
{
	return x&-x;
}
void add(int x,int y,int z)
{
	for(;x<=n;x+=lowbit(x))
	{
		c[x][y]+=z;
	}
}
int pre (int x,int y)
{
	int ans=0;
	for(;x;x-=lowbit(x))
	{
		ans+=c[x][y];
	}
	return ans;
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>ch[i];
		add(i,ch[i]-'a'+1,1);
	}
	cin>>cnt;
	for(int i=1;i<=cnt;++i)
	{
		int a,ans=0;
		cin>>a;
		if(a==1){
			int b;char c;
			cin>>b>>c;
			add(b,ch[b]-'a'+1,-1);
			ch[b]=c;
			add(b,ch[b]-'a'+1,1);
		}
		else
		{
			int b,c;
			cin>>b>>c;
			for(int j=1;j<=26;++j)
			{
				if(pre(c,j)-pre(b-1,j))ans++;
			}
			cout<<ans<<endl;
		}
	}	
}

Measured memory_bytes: 53504
package main

import (
	"bufio"
	. "fmt"
	"io"
	"os"
)

func run(_r io.Reader, _w io.Writer) {
	in := bufio.NewReader(_r)
	out := bufio.NewWriter(_w)
	defer out.Flush()

	var n, v int32
	Fscan(in, &n)
	mp := map[int32]int32{}
	for i := int32(0); i < n; i++ {
		Fscan(in, &v)
		mp[v]++
	}
	Fprintln(out, map[bool]string{true: "YES", false: "NO"} [int32(len(mp)) == n])
}

func main() { run(os.Stdin, os.Stdout) }


Measured memory_bytes: 7936
// aribon4-4_b
// CODE FESTIVAL 2016 Tournament Round 3 A ストラックアウト
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

ll dp[333][100005];

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, M, K;
    cin >> N >> M >> K;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];

    //vector<vector<ll>> dp(K+1, vector<ll>(N, -1));
    //dp[0].assign(N, 0);
  	memset(dp, -1, sizeof(dp));
  	REP(i, N) dp[0][i] = 0;

    vector<deque<ll>> deqs(K+1);
    deqs[0].emplace_back(0);

    REP(i, N){

        REPN_REV(k, 1, K+1) {

            if (deqs[k-1].empty()) continue;

            // スライド最大値
            dp[k][i] = dp[k-1][deqs[k-1].front()] + k * A[i];

            // deque更新
            while (not deqs[k].empty() && dp[k][deqs[k].back()] <= dp[k][i]){
                deqs[k].pop_back();
            }
            deqs[k].emplace_back(i);

            // 先頭からpop
            if (deqs[k].front() == i - M){
                deqs[k].pop_front();
            }
        }

    }

//    REP(k, K+1) { print(k, dp[k]); }

    ll ans = 0;
    REP(i, N){
        ans = max(ans, dp[K][i]);
    }
    print(ans);


    return 0;
}


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

using namespace std;

#define int long long

const int INF = 1e18, MAX_NUM_LEN = 20;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector <int> last(MAX_NUM_LEN, -1);
    int p = 0, ans = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        for (int j = 0; j < MAX_NUM_LEN; ++j) {
            if ((x >> j) & 1) {
                p = max(p, last[j] + 1);
                last[j] = i;
            }
        }
        ans += i - p + 1;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4]={1,0,-1,0} , dy[4]={0,1,0,-1} ;

int main(){
    int n,m;
    cin>>n>>m;
    ll a[n][n],d[n][n];
    rep(i,n)rep(j,n)a[i][j]=inf;
    rep(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        x--;y--;
        a[x][y]=a[y][x]=z;
    }
    rep(i,n)rep(j,n)d[i][j]=a[i][j];
    rep(i,n)d[i][i]=0;
    rep(i,n)rep(j,n)rep(k,n)d[j][k]=min(d[j][k],d[i][j]+d[i][k]);
    int ans=0;
    rep(i,n)rep(j,n){
        if(a[i][j]!=inf&&a[i][j]>d[i][j])ans++;
    }
    cout<<ans/2<<endl;
    return 0;
}

Measured memory_bytes: 384
#[allow(dead_code)]
pub struct Scanner<'a> {
    _buf: &'a str,
    iter: ::std::str::SplitWhitespace<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    pub fn new(buf: &'a str) -> Self {
        Scanner {
            _buf: buf,
            iter: buf.split_whitespace(),
        }
    }

    pub fn array<T>(&mut self, n: usize) -> Vec<T>
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        let mut res = Vec::with_capacity(n);
        for _ in 0..n {
            res.push(self.value());
        }
        res
    }

    pub fn value<T>(&mut self) -> T
        where T: ::std::str::FromStr,
              T::Err: ::std::fmt::Debug,
    {
        self.next().parse().unwrap()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.next().chars().collect()
    }

    fn next(&mut self) -> &str {
        self.iter.next().unwrap()
    }
}

fn main() {
    let mut _input = String::new();
    {
        use ::std::io::Read;
        ::std::io::stdin().read_to_string(&mut _input).unwrap();
    }
    let mut sc = Scanner::new(&_input);

    let n = sc.value::<i64>();
    let mut x = sc.value::<i64>();
    let mut a = sc.array::<i64>(n as usize);

    a.sort();
    let mut ans = 0;
    for e in a {
        if x < e { break; }
        x -= e;
        ans += 1;
    }
    if x > 0 && ans == n { ans -= 1; }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define EQ(x, y) (abs(x - y) < 1e-9)
typedef long long ll;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;

	int n;
	cin >> n;
	long double sum = 0;
	for (int i = 0; i < n; ++i){
		long double temp;
		cin >> temp;
		sum += 1 / temp;
	}
	cout << 1 / sum << '\n';
	
#ifdef local
	cout << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
#endif
	return 0;
}

Measured memory_bytes: 256
package main

import "fmt"

func main() {
	// Code for A - Rated for Me
	var R int
	fmt.Scanf("%d", &R)
	if R < 1200 {
		fmt.Println("ABC")
	} else if R < 2800 {
		fmt.Println("ARC")
	} else {
		fmt.Println("AGC")
	}
}


Measured memory_bytes: 1836
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <stack>
#include <set>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()

const int N = (int)3e5+3;

ll mpow(ll a, ll b){
	if(b==0) return 1;
	else if(b%2==0){ll memo = mpow(a,b/2); return memo*memo%MOD;}
	else return mpow(a,b-1) * a % MOD;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b, a%b);
}
vector<ll> kaijo_memo;
ll kaijo(ll n){
	if(kaijo_memo.size() > n) return kaijo_memo[n];
	if(kaijo_memo.size() == 0) kaijo_memo.push_back(1);
	while(kaijo_memo.size() <= n) kaijo_memo.push_back(kaijo_memo[kaijo_memo.size()-1] * kaijo_memo.size() % MOD);
	return kaijo_memo[n];
}
ll nCr(ll n, ll r){
	if(n < r || r < 0) return 0;
	ll ret = 1;
	ret *= kaijo(n); ret %= MOD;
	ret *= mpow(kaijo(r), MOD-2); ret %= MOD;
	ret *= mpow(kaijo(n-r), MOD-2); ret %= MOD;
	return ret;
}

int main(void){
	int n;cin>>n;
	vector<int> X,Y;
	rep(i,n){
		int x;cin>>x;
		X.push_back(x);
		Y.push_back(x);
	}
	sort(all(Y));
	int small = Y[n/2-1], large = Y[n/2];
	rep(i,n){
		if(X[i] <= small){
			cout<<large<<endl;
		}else{
			cout<<small<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3948
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf=1e9+7;

int main(){
    string s;cin>>s;
    int zero=0;
    int one=0;
    rep(i,s.size()){
        if(s[i]=='0')zero++;
        else one++;
    }
    cout<<2*min(zero,one)<<endl;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Arrays;

public class Main {

	static FastScanner sc = new FastScanner();

	public static void main(String[] args) throws Exception {
		int[] hist = new int[256];
		int[][][][] table = new int[16][16][16][256];
		for (int s = 0; s < 16; ++s) {
			for (int a = 0; a < 16; ++a) {
				for (int c = 0; c < 16; ++c) {
					Arrays.fill(hist, 0);
					int r = s;
					for (int i = 0; i < 256; ++i) {
						r = (a * r + c) & 0xFF;
						table[s][a][c][i] = r;
					}
				}
			}
		}
		while (true) {
			int N = sc.nextInt();
			if (N == 0) break;
			int[] I = new int[N];
			for (int i = 0; i < N; ++i) {
				I[i] = sc.nextInt();
			}
			double best = Double.MAX_VALUE;
			int bs = 0;
			int ba = 0;
			int bc = 0;
			for (int s = 0; s < 16; ++s) {
				for (int a = 0; a < 16; ++a) {
					OUT: for (int c = 0; c < 16; ++c) {
						Arrays.fill(hist, 0);
						for (int i = 0; i < N; ++i) {
							hist[(I[i] + table[s][a][c][i]) & 0xFF]++;
						}
						double e = 0;
						for (int i = 0; i < 256; ++i) {
							if (hist[i] != 0) {
								double v = 1.0 * hist[i] / N;
								e -= v * Math.log(v);
								if (e >= best) continue OUT;
							}
						}
						if (e < best - 1e-10) {
							best = e;
							bs = s;
							ba = a;
							bc = c;
						}
					}
				}
			}
			System.out.println(bs + " " + ba + " " + bc);
		}
	}

	static class FastScanner {
		Reader input;

		FastScanner() {
			this.input = new BufferedReader(new InputStreamReader(System.in));
		}

		int nextInt() throws IOException {
			int sign = 1;
			int b = input.read();
			while ((b < '0' || '9' < b) && b != '-' && b != '+') {
				b = input.read();
			}
			if (b == '-') {
				sign = -1;
				b = input.read();
			} else if (b == '+') {
				b = input.read();
			}
			int ret = b - '0';
			while (true) {
				b = input.read();
				if (b < '0' || '9' < b) return ret * sign;
				ret *= 10;
				ret += b - '0';
			}
		}
	}

}

Measured memory_bytes: 28060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    vector<int> y(n);

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

    vector<double> ans(4);
    vector<double> v;

    for(int i = 0; i < 3; i++){
        double sum = 0;
        for(int j = 0; j < n; j++){
            double tmp = 0;
            tmp = fabs(x[j] - y[j]);
            if(i == 0){
                v.push_back(tmp);
            }
            tmp = pow(tmp, i+1);
            //cout << tmp << endl;
            sum += tmp;
        }
        ans[i] = pow(sum, 1/(i+1.0));
    }

    sort(v.begin(), v.end());
    ans[3] = v[v.size()-1];

    for(int i = 0; i < 4; i++){
        printf("%lf\n", ans[i]);
    }

}


Measured memory_bytes: 3424
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
    int n;
  int a[4];
  cin>>n;
  a[0]=0;
  a[1]=0;
  a[2]=0;
  a[3]=0;
  long long int k;
  for(int i=0;i<n;i++){
      cin>>k;
      a[k%4]++;
      
  }

if (a[0]-a[1]-a[3]>=-1){
  if (a[0]-a[1]-a[3]==-1){
    if(a[0]+a[1]+a[3]==n){
     cout<<"Yes";   
    }
    else{
     cout<<"No";   
    }
}
else{
 cout<<"Yes";   
}
}
else{
 cout<<"No";   
}
}

Measured memory_bytes: 256
w,h,x,y = gets.chomp.split(" ").map(&:to_i)
iscenter = ([x,y] == [w/2,h/2]) && (w%2 == 0 && h%2 == 0)
puts "#{w*h/2.0} 1" if iscenter
puts "#{w*h/2.0} 0" if !iscenter

Measured memory_bytes: 14236
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;



int main(){
  int n, m, k;
  cin >> n >> m >> k;
  REP(i,n+1)REP(j,m+1){
    int sum = 0;
    sum = i*m + j*n - 2*i*j;
    //cout <<i <<" " <<  j<< " " << sum << endl;
    if(sum == k){
      cout << "Yes" << endl;
      return 0;
    }
  }

  cout << "No" << endl;

  return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(n), c(m), d(m);
    for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
    for (int i = 0; i < m; ++i) cin >> c[i] >> d[i];
    for (int i = 0; i < n; ++i) {
        int mind = 1010101010;
        int minc;
        for (int j = 0; j < m; ++j) {
            int nd = abs(a[i] - c[j]) + abs(b[i] - d[j]);
            if (mind > nd) {
                mind = nd;
                minc = j + 1;
            }
        }
        cout << minc << endl;
    }
}

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

int ar[120] = {};
int b[120] = {};

int main() {
	int n;
	int ca = 0;
	while (cin >> n) {
		ar[n - 1]++;
		b[n - 1]++;
		ca++;
	}

	sort(b, b + ca);
	int max = b[ca - 1];
	for (int i = 0; i < ca; i++) {
		if (ar[i] == max) {
			cout << i+1 << endl;
		}
	}
	return 0;
}

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

using namespace std;

int n;

char add[] = {'7', '5', '3'};

int dfs(string now, bool t7, bool t5, bool t3)
{
	if (0 < now.size() && n < stoll(now))
		return 0;
	int ret = (t7 == true && t5 == true && t3 == true);
	ret += dfs('7' + now, true, t5, t3);
	ret += dfs('5' + now, t7, true, t3);
	ret += dfs('3' + now, t7, t5, true);

	return ret;
}

int main()
{
	cin >> n;
	cout << dfs("", false, false, false) << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cctype>

int main(){
	char ch;
	
	while(1){
		scanf("%c", &ch);
		
		if(islower(ch)) printf("%c", toupper(ch));
		else if(isupper(ch)) printf("%c", tolower(ch));
		else printf("%c", ch);
		
		if(ch=='\n') break;
	}

	return 0;
}



Measured memory_bytes: 2616
#include <stdio.h>

int main(void)
{
	char str[8][9];
	int i, j;
	
	while (scanf("%s", str[0]) != EOF){
		
		for (i = 1; i < 8; i++){
			scanf("%s", str[i]);
		}
		
		for (i = 0; i < 8; i++){
			for (j = 0; j < 8; j++){
				if (str[i][j] == '1'){
					
					//A
					if (str[i][j+1] == '1' && str[i+1][j] == '1' && str[i+1][j+1] == '1'){
						printf("A\n");
					}
					
					//B
					else if (str[i+1][j] == '1' && str[i+2][j] == '1' && str[i+3][j] == '1'){
						printf("B\n");
					}
					
					//C
					else if (str[i][j+1] == '1' && str[i][j+2] == '1' && str[i][j+3] == '1'){
						printf("C\n");
					}
					
					//D
					else if (str[i+1][j-1] == '1' && str[i+1][j] == '1' && str[i+2][j-1] == '1'){
						printf("D\n");
					}
					
					//E
					else if (str[i][j+1] == '1' && str[i+1][j+1] == '1' && str[i+1][j+2] == '1'){
						printf("E\n");
					}
					
					//F
					else if (str[i+1][j] == '1' && str[i+1][j+1] == '1' && str[i+2][j+1] == '1'){
						printf("F\n");
					}
					
					//G
					else if (str[i][j+1] == '1' && str[i+1][j-1] == '1' && str[i+1][j] == '1'){
						printf("G\n");
					}
				}
			}
		}
	}
	
	return (0);
	}

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

const int inf = 1000000000;

int main() {
	int v, e, r;
	cin >> v >> e >> r;
	vector<vector<pair<int, int>>> graph(v, vector<pair<int, int>>());
	for (int i = 0; i < e; i++) {
		int s, t, d;
		cin >> s >> t >> d;
		graph[s].push_back(make_pair(t, d));
	}
	vector<int> dist(v, inf);
	dist[r] = 0;
	queue<int> q;
	q.push(r);
	while (!q.empty()) {
		int i = q.front();
		q.pop();
		for (auto it = begin(graph[i]); it != end(graph[i]); it++) {
			if (dist[i] + it->second < dist[it->first]) {
				dist[it->first] = dist[i] + it->second;
				q.push(it->first);
			}
		}
	}
	for (auto it = begin(dist); it != end(dist); it++) {
		if (*it == inf) {
			cout << "INF" << endl;
		} else {
			cout << *it << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 12352
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1LL << 30;
int MOD = 1e9+7;
main(){
    int N;
    deque<int> deq;
    cin >> N;
    for(int i = 0;i < N;i++){
        int a;
        cin >> a;
        if(i & 1)deq.push_back(a);
        else deq.push_front(a);
    }
    if(N & 1){
        for(int i = 0;i < N;i++){
            cout << deq.front() << " ";
            deq.pop_front();
        }
    }else{
        for(int i = 0;i < N;i++){
            cout << deq.back() << " ";
            deq.pop_back();
        }
    }
    cout << endl;

}

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

string a;
int check = 0;
int j=0;
int k;


cin >> a;
for(int i=0; i<100; i++){
if(a[i]=='1'){}else if(check==0){

check=1;
j=i;

}

}
cin >> k;

if(check==0){
cout << 1;
}else if(j<k){
cout << a[j] - '0';
}else{
cout << 1;
}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int main()
{
	LL S;
	cin >> S;
	int l = 0, r = 1e9;
	while(l < r) {
		int mid = l + r >> 1;
		if(1LL * mid * mid < S) l = mid + 1;
		else r = mid;
	}
	printf("%d %d %d %d %d %d\n", 0, 0, r, 1, 1LL * r * r - S, r);
	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		int N = Integer.parseInt(in.readLine());
		String[] tokens = in.readLine().split(" ");
		int[] a = new int[N];
		for (int i = 0; i < N; ++i) {
			a[i] = Integer.parseInt(tokens[i]);
		}
		int count = 0;
		for (int i = 0; i < N; ++i) {
			if ((i + 1) % 2 == 1 && a[i] % 2 == 1) {
				++count;
			}
		}
		System.out.println(count);

	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 25400
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <cmath>
#include <cstring>
#include <cstdio>

using namespace std;

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

int N;
int A[200001];
int B[200001];

void check() {
    for (int i = 1; i <= N; i ++) {
        int s = 0;
        for (int j = i; j <= N; j += i) {
            s += B[j];
        }
        if (s % 2 != A[i]) {
            cout << "ng" << endl;
            return;
        }
    }
    cout << "ok" << endl;
}

int main() {
    scanf("%d", &N);
    rep(i, N) scanf("%d", &A[i + 1]);
    for (int i = N; i >= 1; i --) {
        int s = A[i];
        for (int j = 2 * i; j <= N; j += i) {
            s += B[j];
        }
        B[i] = s % 2;
    }
    int count = 0;
    for (int i = 1; i <= N; i ++) if (B[i]) count ++;
    cout << count << endl;
    for (int i = 1; i <= N; i ++) if (B[i]) cout << i << " ";
    cout << endl;
    //check();
    return 0;
}

Measured memory_bytes: 2432
#include <stdio.h>

int main(void){
    int day;
    scanf("%d",&day);
    switch(day){
        case 25:
            printf("Christmas");
            break;
        case 24:
            printf("Christmas Eve");
            break;
        case 23:
            printf("Christmas Eve Eve");
            break;
        case 22:
            printf("Christmas Eve Eve Eve");
            break;
    }
    return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int a[202020], b[202020];
int main()
{
	int num;
	scanf("%d", &num);
	for (int i = 0; i < num; i++)scanf("%d", &a[i]);
	for (int i = 0; i < num; i++)scanf("%d", &b[i]);
	int ans = 0;
	for (int i = 0; i <= 29; i++)
	{
		vector<int>v;
		for (int j = 0; j < num; j++)v.push_back(b[j] % (1 << (i + 1)));
		for (int j = 0; j < num; j++)v.push_back((1 << (i + 1)) + b[j] % (1 << (i + 1)));
		sort(v.begin(), v.end());
		int cnt = 0;
		for (int j = 0; j < num; j++)
		{
			int low1 = lower_bound(v.begin(), v.end(), (4 << i) - a[j] % (1 << (i + 1))) - v.begin();
			int low2 = lower_bound(v.begin(), v.end(), (3 << i) - a[j] % (1 << (i + 1))) - v.begin();
			cnt += low1 - low2;
			cnt %= 2;
		}
		ans += cnt << i;
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 7444
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

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;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin>>n;
	int t=0,x=0,y=0;
	bool flag=true;
	rep(i,n){
		int a,b,c;
		cin>>a>>b>>c;
		int now=abs(x-b)+abs(y-c)-(a-t);
		if(now%2 || now>0){
			flag=false;
		}
		t=a;
		x=b;
		y=c;
	}
	if(flag) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main(){
    int a, b, c, k, i;

    scanf("%d %d %d %d", &a, &b, &c, &k);

    for(i = 0;i < k;i++){
        if(b * 2 < c) b = b * 2;
        else c = c * 2;
    }

    if(a < b && b < c) puts("Yes");
    else puts("No");

    return 0;
}

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
 
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for (int i=a; i<b; i++)
// #define endl "\n"
const int mod = 1000000007;

ll power(ll x, ll y) 
{ 
    ll res = 1;     // Initialize result 
   
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = res*x; 
        res%=mod;
        // n must be even now 
        y = y>>1; // y = y/2 
        x = x*x;
        x%=mod;  // Change x to x^2 
    } 
    return res%mod; 
}

int main() {
    ios_base::sync_with_stdio(false);    //Fast I/O
    cin.tie(NULL);
 
    // freopen("input.txt", "r", stdin);    // Read and write from a file
    // freopen("output.txt", "w", stdout);
    int x, y;
    cin >> x >> y;

    long long ans = 0;
    if(x==3)
        ans+=100000;
    else if(x==2)
        ans+=200000;
    else if(x==1)
        ans+=300000;
    
    if(y==3)
        ans+=100000;
    else if(y==2)
        ans+=200000;
    else if(y==1)
        ans+=300000;
 
    if(x==1 && y==1)
        ans+=400000;
    
    cout << ans << endl;
 
    return 0;
}

Measured memory_bytes: 256
<?php
# 入力部
// fscanf(STDIN, "%s %s", $s, $t);
// fscanf(STDIN, "%d %d", $n, $m);
// fscanf(STDIN, "%s", $u);
// fscanf(STDIN, "%d %d", $k, $x);
// $s1 = fgets(STDIN); //"\n"の2文字
// $s2 = fgets(STDIN);
// fscanf(STDIN, "%d", $r);
// fscanf(STDIN, "%f", $n);
// fscanf(STDIN, "%f", $n);
fscanf(STDIN, "%s", $s1);
fscanf(STDIN, "%s", $s2);
// fscanf(STDIN, "%c", $c);
// fscanf(STDIN, "%s", $s2);
// fscanf(STDIN, "%d %d %d", $a, $b, $c);


# 処理部
$arr1 = str_split($s1);
$arr2 = str_split($s2);
$c = 0;
for ($i = 0; $i < count($arr1); $i++) {
  if ($arr1[$i] == $arr2[$i]) {
    $c++;
  }
}
// $arr1 = explode(" ", $s1);
// $arr2 = explode(" ", $s2);
// for ($i = 0; $n > $x * $i; $i++) {
// }
// if (strpos($s, 'RRR') !== false) {
//   $r = 3;
// } elseif (strpos($s, 'RR') !== false) {
//   $r = 2;
// } elseif (strpos($s, 'R') !== false) {
//   $r = 1;
// } else {
//   $r = 0;
// }
// $s = "No";
// if ($x >= 30) {
//   $s = "Yes";
// }
// for ($i = 0; $i * 1000 < $n; $i++) {
// }
// $c = "a";
// if (ctype_upper($a)) {
//   $c = "A";
// }
// $s = "Yes";
// echo count($arr1);
// for ($i = 0; $i < strlen($s1); $i++) {
//   if ($arr1[$i] != $arr2[$i]) {
//     $s = "No";
//   }
// }
// $unit;
// switch ($n % 10) {
//   case 0:
//   case 1:
//   case 6:
//   case 8:
//     $unit = "pon";
//     break;
//   case 3:
//     $unit = "bon";
//     break;
//   default:
//     $unit = "hon";
//     break;
// }
// if ($s == "ABC") {
//   $r = "ARC";
// } else {
//   $r = "ABC";
// }
// $r = "NG";
// $arr = array("SAT", "FRI", "THU", "WED", "TUE", "MON", "SUN");
// for ($i = 0; $i <= count($arr); $i++) {
//   if ($arr[$i] == $s) {
//     break;
//   }
// }
// $r = "safe";
// if ($s <= $w) {
//   $r = "unsafe";
// }
// $r = "No";
// if (strpos($n, "7") !== false) {
//   $r = "Yes";
// }
// $r = "No";
// if ($arr[2] == $arr[3] && $arr[4] == $arr[5]) {
//   $r = "Yes";
// }
// $r = "Yes";
// if ($s == "AAA" || $s == "BBB") {
//   $r = "No";
// }
// if ($n % 2 == 0) {
//   $r = $n / 2 / $n;
// } else {
//   $r = ($n + 1) / 2 / $n;
// }
// if ($n < 10) {
//   $r += (10 - $n) * 100;
// }
// $arr = array($a, $b, $c);
// $arr = array_unique($arr);
// if (count($arr) == 2) {
//   $r = "Yes";
// } else {
//   $r = "No";
// }
// if ($s == $u) {
//   $a--;
// } else {
//   $b--;
// }
// for ($i = 0; $h > 0; $i++) {
//   $h -= $a;
// }
// $r = "No";
// if ($n == $m) {
//   $r = "Yes";
// }
// $r = "win";
// if ($a + $b + $c >= 22) {
//   $r = "bust
// ";
// }
// $arr = array(1, 2, 3);
// unset($arr[$a - 1]);
// unset($arr[$b - 1]);
// $arr = array_values($arr);
// if ($n < 10 && $m < 10) {
//   $r = $n * $m;
// } else {
//   $r = -1;
// }
// switch ($s) {
//   case "Sunny":
//     $r = "Cloudy";
//     break;
//   case "Cloudy":
//     $r = "Rainy";
//     break;
//   case "Rainy":
//     $r = "Sunny";
//     break;
// }

# 出力部
// echo ($n * ($n - 1) / 2) + ($m * ($m - 1) / 2) . "\n";
// echo $z . " " . $x . " " . $y . "\n";
// echo ($i * 1000) - $n . "\n";
// echo json_encode($arr) . "\n";
// echo $arr[0] . "\n";
// echo $i + 1 . "\n";
// echo $n ** 3 . "\n";
echo $c . "\n";
// echo $a . " " . $b . "\n";
// echo $t . $s . "\n";


Measured memory_bytes: 16164
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()

// int DP[MEM_SIZE][MEM_SIZE] = {0};
// int GMEM[MEM_SIZE][MEM_SIZE] = {0};
template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void DFS(int V,vector<vector<int> >&GRAPH,vector<int>& used,int from,int K,int & res)
{
  // if(used[V] == 1)return;
  used[V] = 1;
  // DEBUG(V);
  int COUNT = K- 2;
  if(from == -1)COUNT = K -1;
  for (int i = 0; i < GRAPH[V].size(); i++)
  {
    if(used[GRAPH[V][i]] == 0)
    {
      DFS(GRAPH[V][i],GRAPH,used,V,K,res);
      res *= COUNT;
      res %= MOD;
      COUNT--;
      // DEBUG(ANS*K%MOD);
    }
  }
  return;
}

void GRAPH_DFS(void)
{
  int N,K;
  cin>>N>>K;
  vector<vector<int> > GRAPH(N);
  for (int i = 0; i < N-1; i++)
  {
    int A,B;
    cin>>A>>B;
    A--;B--;
    GRAPH[A].push_back(B);
    GRAPH[B].push_back(A);
  }
  vector<int> used(N,0);
  int ANS = 1;
  DFS(0,GRAPH,used,-1,K,ANS);
  cout<<ANS*K%MOD<<endl;
  return;
}
void solve(void)
{
  GRAPH_DFS();
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(15);
  solve();

  return 0;
}


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

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

    double prob = 0.0;
    double total_prob = 0.0;
    int score = 0;
    for (int i = 1; i <= n; ++i) {
        prob = 1.0 / n;
        score = i;
        while (score <= k-1) {
            prob *= 0.5;
            score *= 2;
        }
        total_prob += prob;
    }
    printf("%.9f\n", total_prob);

}


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

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
  	cin.tie(0);
	
	int n, m;
	cin >> n >> m;
	int l, r, mx_l = -1, mn_r = INT_MAX;
	for (int i = 0; i < m; i++) {
		cin >> l >> r;
		if (l > mx_l) mx_l = l;
		if (r < mn_r) mn_r = r;
	}
	if (mn_r - mx_l + 1 > 0)
		cout << mn_r - mx_l + 1 << endl;
    else
		cout << 0 << endl;
	return 0;
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int N, D, Q;
ll d[512345], ub[512345], lb[512345];
bool ans[512345];

int main() {
	cin >> N >> D;
	REP(i, N) scanf("%lld", d + i);
	
	ll pos = D;
	REP(i, N) {
		ub[i] = pos;
		pos = min(pos, abs(pos - d[i]));
	}
	
	lb[N - 1] = 1;
	for (int i = N - 2; i >= 0; i--) {
		if (d[i + 1] / 2 >= lb[i + 1]) lb[i] = lb[i + 1];
		else lb[i] = lb[i + 1] + d[i + 1];
	}
	
	cin >> Q;
	REP(i, Q) {
		int q;
		scanf("%d", &q);
		puts(lb[q - 1] <= ub[q - 1] ? "YES" : "NO");
	}
	return 0;
}


Measured memory_bytes: 13824
#include<stdio.h>

int main(){
	int k, tab[]={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};
	scanf("%d", &k);
	printf("%d\n", tab[k-1]);
	return 0;
}


Measured memory_bytes: 128
import itertools
n, m, q = map(int, input().split())
abcd = [tuple(map(int, input().split())) for _ in range(q)]
Max = 0
for A in itertools.combinations_with_replacement(range(1, m + 1), n):
    #score = sum([d for a, b, c, d in abcd if C[b - 1] - C[a - 1] == c])
    score = 0
    for ai, bi, ci, di in abcd:
        if A[bi - 1] - A[ai - 1] == ci:
            score += di
    Max = max(Max, score)
    #print(C)
print(Max)


Measured memory_bytes: 9192
#include <iostream>
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
using namespace std;
#define ll long long

int main(){
  int n,k,q;cin>>n>>k>>q;
  vector<int>a(n);
  vector<int>s(q);
  for(int i=0;i<n;i++)
    a.at(i)=k;
  for(int i=0;i<q;i++)
    cin>>s.at(i);
    for(int i=0;i<q;i++)
    {
      a.at(s.at(i)-1)++;
    }
    for(int i=0;i<n;i++)
    {
      if(a.at(i)-q>0)
        cout<<"Yes"<<endl;
      else
        cout<<"No"<<endl;
    }
}
  
  
  
  

Measured memory_bytes: 1408