akhauriyash/Code-Regression huggingface dataset:
from itertools import accumulate

N, K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]

total = [0] * 1001
total[0] = None
total[1] = 1.0
for i in range(2, 1001):
    total[i] = total[i-1] + 0.5
for i in range(N):
    p[i] = total[p[i]]
p = [0] + list(accumulate(p))

ans = 0
for i in range(0, N-K+1):
    ans = max(ans, p[i+K]-p[i])
print(ans)

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

vector< int > primes;

int main() {
	int MAX = (1L << 15) + 10;
	
	vector< bool > isp(MAX, true);
	
	for_(i,2,MAX) {
		if (isp[i]) {
			primes.push_back(i);
			for (int j = i + i; j < MAX; j += i) isp[j] = false;
		}
	}
	
	int n, m = primes.size();
	
	while (cin >> n, n) {
		int ans = 0;
		
		for_(i,0,m) {
			int q = n - primes[i];
			if (q < primes[i]) break;
			if (binary_search(primes.begin(), primes.end(), q)) ++ans;
		}
		
		cout << ans << endl;
	}
}

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

int main() {
  int64_t N, K;
  cin >> N >> K;
  vector<vector<int64_t>> G(N,vector<int64_t>(0));
  for(int i=0; i<N-1; i++){
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    G.at(a).push_back(b);
    G.at(b).push_back(a);
  }
  
  int64_t ans = K;
  vector<bool> seen(N,false);
  seen.at(0) = true;
  queue<int> Q;
  Q.push(0);
  int64_t MOD = 1e9+7;
  
  while(Q.size()){
    int64_t x = Q.front();
    Q.pop();
    int64_t cnt = K-1;
    if(x != 0){
      cnt--;
    }
    for(int i=0; i<G.at(x).size(); i++){
      if(!seen.at(G.at(x).at(i))){
        ans *= cnt;
        ans %= MOD;
        cnt--;
        Q.push(G.at(x).at(i));
        seen.at(G.at(x).at(i)) = true;
        //cout << ans << " " << x << endl;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 6900
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val (a, b) = (0 until 2).map { sc.nextInt() }
    println((1..2000).find {
        val divA = it * 8 / 100
        val divB = it * 10 / 100
        a == divA && b == divB
    } ?: -1)
}

Measured memory_bytes: 31396
#include<stdio.h>
int main(void){
long long int a,b,c,d,e,f,g;
c=100;
b=1;
scanf("%lld",&a);
e=0;
while(b==1){
d=c/100;
c=c+d;
e=e+1;

if(a<=c)
{
  b=2;  
}
}


printf("%lld",e); 
}

Measured memory_bytes: 1728
A, B, C = [int(i) for i in input().split(' ')]

if A == 7 or B == 7 or C == 7:
    if A == 5 and B == 5:
        print('YES')
    elif A == 5 and C == 5:
        print('YES')
    elif B == 5 and C == 5:
        print('YES')
    else:
        print('NO')


Measured memory_bytes: 3060
/*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⣠⣶⡾⠏⠉⠙⠳⢦⡀⠀⠀⠀
⠀⠀⠀⣴⠿⠏⠀⠀⠀⠀⠀⠀⢳⡀⠀
⠀⠀⢠⣟⣋⡀⢀⣀⣀⡀⠀⣀⡀⣧⠀
⠀⠀⢸⣯⡭⠁⠸⣛⣟⠆⡴⣻⡲⣿⠀
⠀⠀⣟⣿⡭⠀⠀⠀⠀⠀⢱⠀⠀⣿⠀
⠀⠀⠙⢿⣯⠄⠀⠀⠀⢀⡀⠀⠀⡿⠀⠀
⠀⠀⠀⠀⠹⣶⠆⠀⠀⠀⠀⠀⡴⠃⠀⠀
⠀⠀⠀⠀⠀⢸⣷⡦⢤⡤⢤⣞⣁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⢀⣤⣴⣿⣏⠁⠀⠀⠸⣏⢯⣷⣖⣦⡀⠀⠀⠀⠀⠀⠀
⢀⣾⣽⣿⣿⣿⣿⠛⢲⣶⣾⢉⡷⣿⣿⠵⣿⠀⠀⠀⠀⠀⠀
⣼⣿⠍⠉⣿⡭⠉⠙⢺⣇⣼⡏⠀⠀⠀⣄⢸⠀⠀⠀⠀⠀⠀
⣿⣿⣧⣀⣿.........⣀⣰⣏⣘⣆⣀⠀
*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n, k;
	cin >> n >> k;
	vi a(n+1), c(n+2,0), c2(n+2,0);
	l00p(i, 1, n+1)
	{
		cin >> a[i];
		c[max(0, i-a[i])]++;
		c[min(n,i+a[i])+1]--;
	}
	c2=c;
	while(k--)
	{
		fill(all(c),0);
		c=c2;
		fill(all(c2),0);
		l00p(i, 1, n+1)
		{
			c[i]+=c[i-1];
			c2[max(0, i-c[i])]++;
			c2[min(n,i+c[i])+1]--;
		}
		int flag=1;
		l00p(i, 1, n+1)
		{
			if(c[i]!=n)
			{
				flag=0;
				break;
			}
		}
		if(flag)
		break;
	}
	l00p(i,1,n+1)
	cout<<c[i]<<" ";
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;


void solve(std::string S){
	if(S == "ABC") {
		cout << "ARC" << endl;
	}else {
		cout << "ABC" << endl;
	}

}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}



Measured memory_bytes: 3624
import java.util.Scanner;
 
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a<b){
        System.out.println("a < b");
        }else if(a>b){
        System.out.println("a > b");
        }else if(a==b){
        System.out.println("a == b");
        }
    }
}

Measured memory_bytes: 26148
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a[105],n;
int main(){
	while(scanf("%d",&n)!=EOF){
		int sum=0,ans=0;
		memset(a,0,sizeof(a));
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
			sum+=a[i];
		}
		sort(a,a+n);
		if(sum%10!=0) ans=sum;
		else{
			for(int i=0;i<n;i++)
				if((sum-a[i])%10!=0){
					ans=sum-a[i];
					break;
				}
		}
		printf("%d\n",ans);
	}
	return 0;
} 

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    int N; cin>>N;
    set<int> st;
    REP(i,N){
        int a; cin>>a;
        if(st.count(a)) st.erase(a);
        else st.insert(a);
    }
    cout<<st.size()<<endl;
}

Measured memory_bytes: 4864
n = int(input())
h = list(map(int,input().split()))
if n == 1:
    print('Yes')

else:
    ans = 'Yes'
    max_h = h[0]
    for x in h[1:]:
        if x >= max_h - 1:
            max_h = max(max_h, x)
        else:
            ans = 'No'
            break
    print(ans)


Measured memory_bytes: 63984
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = long.Parse(Console.ReadLine());
        //int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();

        // 桁数と、その桁の何番目の文字列かを計算しておく
        var p = 1L;
        var count = 1;
        while (p * 26 < n)
        {
            p *= 26;
            n -= p;
            count++;
        }
        n--; // 2桁の場合だとa

        // 26進数でN番目の文字列を求める
        var a = new char[count];
        for (int i = count - 1; i >= 0; i--)
        {
            a[i] = 'a';
            if (n == 0) continue;
            a[i] += (char)(n % 26);
            n /= 26;
        }
        var ans = new string(a);
        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 27484
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))

A = [(A[i], i) for i in range(N)]
A_sort = sorted(A,reverse = True)

dp = [-float('inf')]*(N+1)
dp[0] = 0

for i in range(N):
    dp_new = [-float('inf')]*(N+1)
    pi = A_sort[i][1]  #もともといた場所
    for l in range(i+1): 
        r = i - l   #右を選んだ回数
        dp_new[l+1] = max(dp_new[l+1],dp[l] + A_sort[i][0] * (pi-l)) 
        dp_new[l] = max(dp_new[l],dp[l] + A_sort[i][0] * ((N-r-1)-pi))
    dp = dp_new
print(max(dp))

Measured memory_bytes: 9688
#include<stdio.h>
int main(){
int min=210000000,a[110][110],dic[10][110],i,j,n,k,b,c,d,e,l,m,ans;
while(1){
scanf("%d %d\n",&n,&l);
if(n==0 && l==0){
break;
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++){
a[i][j]=0;
}
}
for(m=0;m<l;m++){
scanf("%d",&b);
if(b==1){
scanf("%d %d %d\n",&c,&d,&e);
if((a[c][d]!=0 && a[c][d]>e) || a[c][d]==0){
a[c][d]=e;
}
if((a[d][c]!=0 && a[d][c]>e) || a[d][c]==0){
a[d][c]=e;
}
}
else{
scanf("%d %d\n",&c,&d);
for(i=1;i<=n;i++){
dic[0][i]=0;
dic[1][i]=210000000;
}
dic[1][c]=0;
for(k=1;k<=n;k++){
for(j=1;j<=n;j++){
if(min>dic[1][j] && dic[0][j]==0){
ans=j;
min=dic[1][j];
}
}
min=210000000;
for(i=1;i<=n;i++){
if(a[ans][i]!=0 && dic[1][i]>a[ans][i]+dic[1][ans]){
dic[1][i]=a[ans][i]+dic[1][ans];
}
}
dic[0][ans]=1;
}
if(dic[1][d]==210000000){
printf("-1\n");
}
else{
printf("%d\n",dic[1][d]);
}
}
}
}
return 0;
}


Measured memory_bytes: 2048
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define REP(i,p,n) for(int i=p;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

int main()
{
    int k, s, ans = 0;
    cin >> k >> s;
    int dp[2501] = { 0 };
    for(int i = 0; i <= k; ++i)
    {
        for(int j = 0; j <= k; ++j)
        {
            if(i + j > s){ break; }
            if(s - (i + j) <= k)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
  a = max(a,b);
}

template <typename T> void min_self(T& a, T b){
  a = min(a,b);
}

void solve(){	
  int n;
  double d;
  cin>>n>>d;
  const double EPS = 1e-9;
  int ans = 0;
  while(n--){
    double a,b;
    cin>>a>>b;
    double dist = sqrt((a*a)+(b*b));
    if( dist <= d)
      ans++;
  }
  cout<<ans<<endl;
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  //int t; cin >> t;
  //while(t--) solve();
  //
  solve();
  return 0;
}


Measured memory_bytes: 3796
import math

# print('input >>')
D, G = map(int, (input().split()))
pc = []
for _ in range(D):
    p, c = map(int, (input().split()))
    pc.append((p, c))

point = 0
ans = []

def dfs(i, count, point):
    # Gまで到達したかどうか確かめる
    c_ = count
    if point >= G:
        ans.append(count)
        return
    # 途中まで解いてGまで届くかどうか試す
    if point + (i + 1) * 100 * (pc[i][0] - 1) >= G:
        count += math.ceil((G - point) / ((i + 1) * 100))
        ans.append(count)
    # 全部解いてGまで届くかどうか試す
    elif point + (i + 1) * 100 * pc[i][0] + pc[i][1] >= G:
        count += pc[i][0]
        ans.append(count)
    if i == 0:
        return
    # 完全に解く
    dfs(i-1, c_+pc[i][0], point + (i+1)*100 * pc[i][0] + pc[i][1])
    # 完全に解かない
    dfs(i-1, c_, point)

dfs(D-1,0,0)

# print('----------output----------')
print(min(ans))

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

int main(){
	stack<int> st;
	int n, a;

	while(cin >> n){
		if(n!=0){
			st.push( n );
		}else{
			a = st.top();
			cout << a << endl;
			st.pop();
		}
	}
}

Measured memory_bytes: 3096
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<string>
#include<numeric>
using namespace std;
typedef long long ll;
//ll mod = 1e9+7;
ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main(){
    int n, m;
    cin >> n >> m;
    priority_queue<ll> que;
    rep(i, n) {
        ll a;
        cin >> a;
        que.push(a);
    }
    rep(i, m) {
        ll tmp_num = que.top();
        que.pop();
        que.push(tmp_num/2);
    }
    ll ans = 0;
    rep(i, n) {
        ans += que.top();
        que.pop();
    }
    cout << ans << endl;
    return 0;
}


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

const int INF = 1 << 28;
int N;

int create_next(vector<int>& next, vector<int>& p, int now) {
    if (!p[now]) return next[now] = now;
    if (next[now] == -2) return next[now] = INF;
    if (next[now] > -1) return next[now];
    next[now] = -2;
    int now_ = now + p[now];
    if (now_ < 0) now_ = 0;
    else if (now_ >= N) now_ = N - 1;
    return next[now] = create_next(next, p, now_);
}

int main() {
    cin >> N;
    vector<int> p(N);
    for (auto &i : p) cin >> i;

    vector<int> dp(N, INF);
    dp[0] = 0;
    vector<int> next(N, -1);
    for (int i = 0; i < N; i++) {
        if (!p[i]) next[i] = i;
        else create_next(next, p, i);
    }

    priority_queue<int, vector<int>, greater<int> > que;
    que.push(0);

    while (que.size()) {
        int now = que.top(); que.pop();

        for (int  i = 1; i <= 6; i++) {
            int nx = now + i;
            if (nx >= N) nx = N - 1;
            nx = next[nx];

            if (nx == INF) continue;
            if (dp[now] + 1 < dp[nx]) {
                dp[nx] = dp[now] + 1;
                que.push(nx);
            }
        }
    }

    cout << dp[N-1] << endl;

    return 0;
}

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

namespace ABC124_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var a = ab[0];
            var b = ab[1];
            Console.WriteLine(a > b + 1 ? a + a - 1 : (a + 1 < b ? b + b - 1 : a + b));
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    string N;cin >> N;
    int K;cin >> K;
    LL dp[111][2][5] = {0};

    // dp[i][j][k]
    // i : 左から何桁目を含むまで
    // j : 未満フラグ　0でi桁目まで上限 　
    //N = 12345 で i = 3 の時、i-1桁目つまりは左から2桁なので
    //ind=1桁目までが上限かどうか,0で上限
    // k : 左からi桁目まででK=何某　
    
    // 初期化    -1桁目があると仮定してる
    dp[0][0][0] = 1;

    rep(i,N.size()+1) rep(j,2) rep(k,4){
        if(i == 0)continue;
        int c = N[i-1] - '0';
        rep(l,10){
            if(j == 0 && l > c)continue;

            int k2 = k;
            if(l != 0)k2++;

            dp[i][j || c != l][k2] += dp[i-1][j][k];

        }
    }
    
    LL ans = dp[N.size()][0][K] + dp[N.size()][1][K];

//    rep(i,4)cout << dp[N.size()][0][i] << " " << dp[N.size()][1][i] << endl;

    cout << ans << endl;



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=(ll)1e9+7;
const ll INF=(ll)1e18+10;
const double PI=acos(-1);

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dy[]={-1,1,0,0};
int dx[]={0,0,-1,1};

vector<int> tonari[200010];

int main() {
    int a,b;
    string s;

    cin>>a;
    int c[32]={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};
    cout<<c[a-1]<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include <numeric>
#include<map>
#include<unordered_map>
 
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n)cin >> a[i];
    rep(i, n)cin >> b[i];

    vector<ll> moda(n), modb(n);
    ll res = 0;
    rep(i, 29){
        int high = 2<<(i);
        int low = 1<<(i);
        rep(j, n)moda[j]=a[j]%high, modb[j]=b[j]%high;
        sort(ALL(modb));
        int cnt = 0;
        rep(j, n){
            if(low-moda[j] >=  0){
                cnt += lower_bound(ALL(modb), high-moda[j])-lower_bound(ALL(modb), low-moda[j]);
            }
            else{
                cnt += lower_bound(ALL(modb), high-moda[j]) - modb.begin();
                cnt += lower_bound(ALL(modb), high) - lower_bound(ALL(modb),  high+low-moda[j]);
            }
        }
        if(cnt&1)res+=low;
    }
    cout << res << endl;
}

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

int digitsum(int a){
    int sum=0;
    while(a>0){
        sum+=a%10;
        a/=10;
    }
    return sum;
}

int main(){
    int N;cin>>N;
    if(N%digitsum(N)==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

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

int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  REP(i, n) { cin >> a[i]; }
  sort(ALL(a));
  ll ans = 1e18;
  REP(i, n - k + 1) { ans = min(ans, a[i + k - 1] - a[i]); }
  cout << ans << endl;
}

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

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<char> conv(128);
		for(int i=0; i<128; i++) conv[i]=i;
		for(int i=0; i<n; i++){
			char a,b;
			cin >> a >> b;
			conv[a] = b;
		}
		
		int m;
		cin >> m;
		for(int i=0; i<m; i++){
			char a;
			cin >> a;
			cout << conv[a];
		}
		cout << endl;
	}
    return 0;
}

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

long long L[86];

void next_lucas(int x) {
  L[x] = L[x - 1] + L[x - 2];
}

int main() {
  L[0] = 2;
  L[1] = 1;
  int N;
  cin >> N;
  for (int i = 2; i <= N; i++) {
    next_lucas(i);
  }
  cout << L[N];
}

Measured memory_bytes: 384
def make_factorial_table(n):
    result = [0] * (n + 1)
    result[0] = 1
    for i in range(1, n + 1):
        result[i] = result[i - 1] * i % m
    return result


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], m - 2, m) * pow(fac[k], m - 2, m) % m


m = 1000000007

S = int(input())

fac = make_factorial_table(S + 10)

if S < 2:
    print(0)
    exit()

result = 0
for i in range(1, 700):
    t = S - i * 3
    result += mcomb(t + i - 1, i - 1)
    result %= m
print(result)


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

int main(void){
  int N, sum = 0;
  cin >> N;
  vector<int> d(N);
  for(int i = 0; i < N; i++){
    cin >> d[i];
  }
  for(int i = 0; i < N; i++){
    for(int j = i+1; j < N; j++){
      sum += d[i]*d[j];
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))

B=[0 for i in range(N+1)]
for i in range(N):
    B[A[i]] += 1

S=0
for i in range(N+1):
    if B[i]!=0:
        S += int(B[i]*(B[i]-1)/2)

for i in range(N):
    print(S - (B[A[i]] -1))
    
    

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

typedef struct{
  int prefecture;
  int year;
} City;

int main()
{
  int N;
  int M;
  cin >> N >> M;
  City C[110000];
  
  vector<int> Y[110000];
  vector<int>::iterator itr;
  
  for(int i=0;i<M;i++){
    int p;
    int y;
    cin >> p >> y; 
    C[i].prefecture = p;
    C[i].year = y;
    Y[p].push_back(y);
  }

  for(int i=1;i<=N;i++){
    sort(Y[i].begin(),Y[i].end());
  }
    

  for(int i=0;i<M;i++){
    int p, y;
    p = C[i].prefecture;
    y = C[i].year;
    //search year
    itr = lower_bound(Y[p].begin(),Y[p].end(), y);
    printf("%06d%06d\n", p,int(itr - Y[p].begin())+1);
  }

}


Measured memory_bytes: 8064
use proconio::input;

fn main() {
	input!(n: usize);
	input!(m: usize);
	input!(a: [String; n]);
	input!(b: [String; m]);

	let mut an: [u64; 50] = [0; 50];
	for i in 0..n {
		for j in 0..n {
			an[i] <<= 1;
			if a[i].chars().nth(j).unwrap() == '#' {
				an[i] += 1;
			}
		}
	}

	let mut bn: [u64; 50] = [0; 50];
	for i in 0..m {
		for j in 0..m {
			bn[i] <<= 1;
			if b[i].chars().nth(j).unwrap() == '#' {
				bn[i] += 1;
			}
		}
	}

	for y in 0..n-m+1 {
		for x in 0..n-m+1 {
			let mut ng_flag = 0;
			for u in 0..m {
				let at = an[y+u] << (64-n+x) >> (64-m);
				if at != bn[u] {
					ng_flag = 1;
					break;
				}
			}
			if ng_flag == 0 {
				println!("Yes");
				return;
			}
		}
	}
	println!("No");
}



Measured memory_bytes: 2140
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long k = sc.nextLong();
        if (n < k) {
            System.out.println(Math.min(n, Math.abs(k-n)));
        }
        else {
            n -= k*(n/k);
            System.out.println(Math.min(n, Math.abs(n-k)));
        }
    }
}

Measured memory_bytes: 23380
import numpy as np
 
N,K=list(map(int,input().split()))
h=np.zeros(N)
for i in range(N):
    h[i]=int(input())
    
h=np.sort(h)
dh_min=10**9
for i in range(N-K+1):
    dh=h[i+K-1]-h[i]
    if dh<dh_min:
        dh_min=dh
print(int(dh_min))

Measured memory_bytes: 14008
#include <iostream>
#include <utility>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
using namespace std;
#define MAXSIZE 100000
#define MAXL 100
typedef long long int lli;

vector<char> capList = {'M', 'A', 'R', 'C', 'H'};
vector <vector<string>> nameList = {{}, {}, {}, {}, {}};

bool isGoodCap(char c);

void WriteOnNameList(string s);

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

    for(lli i = 0; i < n; i++){
        string s;
        cin >> s;
        if(isGoodCap(s[0])){
            WriteOnNameList(s);
        }
    }

    lli ans = 0;
    for(lli i = 0; i < 5 - 2; i++){
        for(lli j = i + 1; j < 5 - 1; j++){
            for(lli k = j + 1; k < 5; k++){
                ans += (lli)(nameList[i].size()) * (lli)(nameList[j].size()) * (lli)(nameList[k].size());
            }
        }
    }
    cout << ans << endl;
    return 0;
}

bool isGoodCap(char c){
    for(lli i = 0; i < capList.size(); i++){
        if(c == capList[i]){
            return true;
        }
    }
    return false;
}

void WriteOnNameList(string s){
    switch (s[0]){
        case 'M':
            nameList[0].push_back(s);
            break;
        case 'A':
            nameList[1].push_back(s);
            break;
        case 'R':
            nameList[2].push_back(s);
            break;
        case 'C':
            nameList[3].push_back(s);
            break;
        default:
            nameList[4].push_back(s);
            break;
    }
}

Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

vector<long long> get(vector<long long> A){

	
	vector<long long> ret(A.size(),0LL);
	vector<int> ok;
	for(int i=A.size()-1;i>=0;i--){
		if(i+1==A.size())continue;
		ret[i] = ret[i+1];
		int now = i;
		long long c = 0;
		while(true){
			for(int j=0;j<c/2;j++){
				A[now] *= 4;
			}
			if(A[now]<=A[now+1]){
				ok.push_back(now);
				break;
			}
			c=0;
			while(A[now]>A[now+1]){
				c+=2;
				A[now+1]*=4;
			}
			if(ok.size()!=0){
				ret[i] += c*(ok.back()-now);
				if(ok.back()-now==1)c=0;
				now=ok.back();
				ok.pop_back();
			}
			else{
				ret[i] += c*(A.size()-1-now);
				break;
			}
		}
		
	}
	return ret;
}


int main(){
	
	int N;
	cin>>N;
	
	vector<long long> A(N);
	for(int i=0;i<N;i++){
		cin>>A[i];
	}
	
	vector<long long> p = get(A);
	for(int i=0;i<N;i++)A[i]*=2;
	reverse(A.begin(),A.end());
	vector<long long> n = get(A);
	reverse(n.begin(),n.end());
	for(int i=0;i<N;i++){
		n[i] += i+1;
	}
	/*
for(int i=0;i<N;i++){
	cout<<p[i]<<','<<n[i]<<endl;
}*/
	
	long long ans = 1e18;
	for(int i=-1;i<N;i++){
		long long t = 0LL;
		if(i!=-1)t += n[i];
		if(i!=N-1)t += p[i+1];
		ans = min(ans,t);
	}
	
	cout<<ans<<endl;
			
	
	return 0;
}

Measured memory_bytes: 11180
#include<stdio.h> //gomi
int main(void)
{
	long long int a,b;
	double a1,b1,d,r,f;
	scanf("%lld %lld",&a,&b);
		a1=a;
		b1=b;
		f=a1/b1;
	printf("%lld %lld %f\n",a/b,a%b,f);
	return 0;
}

Measured memory_bytes: 2684
#include <bits/stdc++.h>
using namespace std;
//vector <bool>  dpx(8010*2),dpy(8010*2) ;
vector <vector<bool>> dpx( 8010,vector <bool>(8010*2 )),dpy( 8010,vector <bool>(8010*2 )) ;
int shokix=0;
int main(void){
    string s; cin>>s; int n=s.size();
    int x,y,cnt=0; cin>>x>>y;
    vector <int> movex,movey;
    bool flag = true; bool xy=0; //0ならx方向
    for(int i=0;i<n;i++){
        if(s[i]=='T') {
            if(flag) shokix=cnt;
            else if(xy==1) movey.push_back(cnt);
            else if(xy==0) movex.push_back(cnt);
            xy = 1-xy;
            cnt=0;
            flag=false;
            continue;
        }
        //if(flag) {cnt++; continue;}
        cnt++;
    }
    if(flag){
        if(cnt!= x) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
        return 0;
    }else if(cnt){
        if(xy==1) movey.push_back(cnt);
        if(xy==0) movex.push_back(cnt);
    }
    /*for(int i=0;i<movex.size();i++){
        cout<<movex[i]<<'*';
    }
    for(int i=0;i<movey.size();i++){
        cout<<movey[i]<<' ';
    }*/
    //int xl=0, yl=0;
    dpx[0][shokix+8000]=1; dpy[0][8000]=1;
    for(int i=0;i<movex.size();i++){
        for(int j=0;j<8001*2;j++){
            if(dpx[i][j]) {
                if(j+movex[i]<=8001*2) dpx[i+1][j+movex[i]]=1; 
                if(j-movex[i]>=0) dpx[i+1][j-movex[i]]=1;}
        }
    }
    for(int i=0;i<movey.size();i++){
        for(int j=0;j<8001*2;j++){
            if(dpy[i][j]) {
                if(j+movey[i] <= 8001*2) dpy[i+1][j+movey[i]]=1; 
                if(j-movey[i] >=0) dpy[i+1][j-movey[i]]=1;}
        }
    }
    //cout<<dpx[x+4000]<<' '<<dpy[y+4000]<<endl;
    if(dpx[movex.size()][x+8000]&&dpy[movey.size()][y+8000]) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


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

using namespace std;
typedef long long ll;
ll MAX = 1000000000;

int main()
{
    int N, K;
    ll S;
    cin >> N >> K >> S;
    if(S != MAX){
        for(int k=0;k<K;++k){
            cout << S << " ";
        }
        for(int k=K;k<N;++k){
            cout << MAX;
            if(k < N-1){
                cout << " ";
            }
            else cout << endl;
        }
    }
    else{
        for(int k=0;k<K;++k){
            cout << S << " ";
        }
        for(int k=K;k<N;++k){
            cout << 1;
            if(k < N-1){
                cout << " ";
            }
            else cout << endl;
        }
    }
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX;
#define INFL LLONG_MAX;
typedef long long ll;
using namespace std;

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

  ll money = 100;
  ll ans=0;
  while(true){
    money*=1.01;
    ans++;
    if(money>=x) break;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <cmath>
#include <vector>

int main()
{
	int n,count=0;
	bool b = true;
	std::cin >> n;
	std::vector<int> a(n);
	for (int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	while (b) {
		b = false;
		for (auto& i : a) {
			if (i % 2 == 0) {
				i /= 2;
				count++;
				b = true;
				break;
			}
		}
	}
	std::cout << count;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()

L = [0]*(M-1)
for i in range(M-1):
    L[i] = X[i+1]-X[i]
L.sort(reverse=True)

print(X[M-1]-X[0]-sum(L[:N-1]))

Measured memory_bytes: 13960
using System;

namespace AOJapps
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                String input = Console.ReadLine();
                Char[] a = input.ToCharArray();
                int sum = 0;
                if (input == "0")
                {
                    break;
                }
                for (int i = 0; i < a.Length; i++)
                {
                    string b = a[i].ToString();
                    int c = int.Parse(b);
                    sum = sum + c;
                }
                Console.WriteLine(sum);
            }
        }
    }
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int h, w;
char a[10][10];

void dfs(int y, int x) {
   a[y][x] = '*';
   int tx = x + 1;
   if (y >= 0 && y < h && tx >= 0 && tx < w && a[y][tx] == '#') {
      while (1) {
         if (y < 0 && y >= h && tx < 0 && tx >= w && a[y][tx] != '#') break;
         a[y][tx] = '*';
         tx++;
      }
      dfs(y, tx-1);
      return;
   }
   int ty = y + 1;
   if (ty >= 0 && ty < h && x >= 0 && x < w && a[ty][x] == '#') {
      while (1) {
         if (ty < 0 && ty >= h && x < 0 && x >= w && a[ty][x] != '#') break;
         a[ty][x] = '*';
         ty++;
      }
      dfs(ty-1, x);
      return;
   }
}

int main() {
   cin >> h >> w;
   rep (i, h) {
      rep (j, w) {
         cin >> a[i][j];
      }
   }

   // dfs(0, 0);
   int y = 0, x = 0;
   int oy = 0, ox = 0;
   a[y][x] = '*';
   int cnt = 0;
   while (1) {
      if (y+1>=0 && y+1<h && x>=0 && x<w && a[y+1][x]=='#') {
         while (1) {
            y++;
            if (y < 0 || y >= h || x < 0 || x >= w || a[y][x] != '#') break;
            a[y][x] = '*';
         }
         y--;
      }

      if (y>=0 && y<h && x+1>=0 && x+1<w && a[y][x+1]=='#') {
         while (1) {
            x++;
            if (y < 0 || y >= h || x < 0 || x >= w || a[y][x] != '#') break;
            a[y][x] = '*';
         }
         x--;
      }

      if (oy == y || ox == x) {
         cnt++;
      } else {
         cnt = 0;
      }
      oy = y, ox = x;

      if (cnt >= 10) break;

      if (y == h-1 && x == w-1) {
         break;
      }
   }

   rep (i, h) {
      rep (j, w) {
         if (a[i][j] == '#') {
            puts("Impossible");
            return 0;
         }
      }
   }
   puts("Possible");

   return 0;
}

Measured memory_bytes: 256
// lcmとか__builtin_popcountとかはg++ -std=c++17 default.cppみたいなかんじで

#include <bits/stdc++.h>
#define mod 1000000007
#define INF LLONG_MAX
#define ll long long
#define ln cout<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define YES cout<<"YES"<<endl
#define No cout<<"No"<<endl
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace std;
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};

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

    ll  a,b,c,d,e,n,k,maxi=0,f=0,mini=INF,sum=0,q;
	string str,stra,straa;
    ll x,y,w,z;
    char ca,cb,cc;
    cin>>a>>b>>c>>k;
    d=max(max(a,b),c);
    e=d;
    sum=a+b+c;
    rep(i,k){
        d*=2;
    }
    cout<<sum+d-e<<endl;
    return 0;
}


Measured memory_bytes: 3608
n = int(input())
cnt = [0] * 11000

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            value = x*x + y*y + z*z + x*y + y*z + z*x
            if value <= n:
                cnt[value] += 1

for i in range(1,n+1):
    print(cnt[i])

Measured memory_bytes: 74660
#include <cstdio>
#include <algorithm>
using namespace std;

const int INF = 1<<29;

int main(){
    int n, cost[9999], dum[2][10010], *dp[2];
    fill(dum[0], dum[0]+10010, INF);
    fill(dum[1], dum[1]+10010, INF);
    dp[0] = dum[0]+5005;
    dp[1] = dum[1]+5005;
    scanf("%d", &n);
    for(int x = 0; x < n-1; x++){
        scanf("%d", cost+x);
    }
    dp[0][1] = 0;
    for(int x = 0; x < n-1; x++){
        for(int y = -n/2; y <= n/2; y++){
            dp[-~x&1][y+1] = min(dp[-~x&1][y+1], dp[x&1][y]);
            dp[-~x&1][-y+1] = min(dp[-~x&1][-y+1], dp[x&1][y]+cost[x]);
            dp[x&1][y] = INF;
        }
    }
    printf("%d\n", dp[-~n&1][0]);
    return 0;
}

Measured memory_bytes: 1140
K, N = map(int,input().split())
A = list(map(int,input().split()))

dist = K-(A[N-1]-A[0])

for i in range(len(A)-1):
    if A[i+1]-A[i] > dist:
        dist = A[i+1] - A[i]

print(abs(K-dist))

Measured memory_bytes: 26444
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define Yes(condition) if(condition){ cout << "Yes" << '\n'; }else{ cout << "No" << '\n'; }
#define YES(condition) if(condition){ cout << "YES" << '\n'; }else{ cout << "NO" << '\n'; }
#define yes(condition) if(condition){ cout << "yes" << '\n'; }else{ cout << "no" << '\n'; }




int main() {
    ll d;
    cin >> d;
    string ans = "Christmas";
    REP(i, 25 - d){
        ans += " Eve";
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include"iostream"
#include<stdlib.h>
#include<stdio.h>
#include<time.h>
#include<list>
#include<map>
#include<string>
#include<algorithm> 
#include <queue> 
#include <sstream>
#include <fstream>
#include<cmath>
#define INF 1000000000
#define LL long long
using namespace std;

vector<LL> v;

long long N, M,K, ans, A[100000],use[10];
string s;

int main() {
	cin >> s;
	if (s[5] == '0' && s[6] < '5') {
		cout << "Heisei" << endl;
	}
	else {
		cout << "TBD" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S;
  cin >> S;
  int a_c = 0, b_c = 0;
  for(int i = 0; i < 3; i++){
    if(S[i] == 'A') a_c++;
    else b_c++;
  }
  if(a_c > 0 && b_c > 0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
string s;

int main(){
	cin >> s; int c=0;
	REP(i,0,s.size()) if(s[i]=='p') c++;
	
	cout << s.size()/2-c << endl;
	return 0;
}


Measured memory_bytes: 512
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

R,r=range,raw_input
N,K=map(int,r().split())
L=K+1
P,Q=R(K),R(L)
D=[L*[0]for i in Q]
a=b=0
for i in R(N):
 x,y,c=r().split()
 x,y=int(x),int(y)
 p=(x/K+y/K+ord(c))%2
 D[y%K+1][x%K+1]+=1-2*p
 b+=p
for i in P:
 for j in Q:D[i+1][j]+=D[i][j]
for i in P:
 for j in Q:D[j][i+1]+=D[j][i]
for i in Q:
 for j in Q:
  S=D[i][K]+D[K][j]-D[i][j]*2
  a=max(a,S,D[K][K]-S)
print a+b

Measured memory_bytes: 23908
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  string S;in(S);
  map<char,int>m;
  for(auto c:S)m[c]++;
  if(m['A']==3||m['B']==3)out("No");
  else out("Yes");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
// copied by Nurstan Duisengaliev
// skatal
#include <bits/stdc++.h>
 
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define mp make_pair
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <int, int>
#define boost() ios_base::sync_with_stdio(0), cin.tie(0)
#define sz(x) x.size()
#define int ll 
using namespace std;
 
const int N = (int)2e5 + 123;
const int mod = (int)1e9 + 7;
const ll INF = (ll)1e18 + 7;
int n, k, a[N];
map <int, int> m;
void solve () {
	cin >> n >> k;
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
		a[i] += a[i - 1];
	}
	for (int i = 1; i <= n; i ++) {
		a[i] -= i;
		a[i] %= k;
	}
	m[0] = 1;
	int ans = 0;
	for (int i = 1; i <= n; i ++) {
		if (i >= k) m[a[i - k]] --;
		ans += m[a[i]];
		m[a[i]] ++;
	}
	cout << ans;
}
 
main () {
//	freopen (".in", "r", stdin);
//	freopen (".out", "w", stdout);
	boost ();
	int TT = 1;
//	cin >> TT;
	while (TT --) {
		solve ();
	}
	return 0;	
}

Measured memory_bytes: 14336
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int, input().rstrip().split(' ')))
    
num_2 = 0
for a in A:
    while True:
        if a % 2 == 0:
            a /= 2
            num_2 += 1
        else:
            break
        
print(num_2)

Measured memory_bytes: 4148
from collections import Counter

n = int(input())
A = list(map(int,input().split()))

a_c = Counter(A)

ans = 0
for k,v in a_c.items():
    if k==v:
        continue
    if k>v:
        ans+=v
    if k<v:
        ans+=v-k
print(ans)  

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

std::vector<std::vector<long long>> comb(ll n, ll r) {
  std::vector<std::vector<long long>> v(n + 1,std::vector<long long>(n + 1, 0));
  for (ll i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (ll j = 1; j < v.size(); j++) {
    for (ll k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int main(){
  ll N,A,B;
  cin>>N>>A>>B;
  vector <ll> v(N);
  for (ll i(0);i<N;i++) cin>>v[i];
  sort(v.begin(),v.end(),greater<ll>());
  ll sum(0);
  ll cnti(0);
  for (ll i(A-1);i>=0;i--){
    if(v[A-1]==v[i])cnti++;
    sum+=v[i];
  }
	double sumi=(double)sum / A;
  cout <<setprecision(20)<<sumi<<endl; 
  ll cnt(0);
  for (ll i(0);i<N;i++){
    if (v[i]==v[A-1]) cnt++;
  }
  ll ans(0);
	if (cnti==A){
    for (ll i(A);i<=B;i++){
      if (cnt>=i) ans+=comb(cnt,i)[cnt][i];
    }
		cout << ans <<endl;
		return 0;
  }
	ans=comb(cnt,cnti)[cnt][cnti];  
  cout << ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<math.h>
using namespace std;

int main() {
  int w, a, b;
  cin >> w >> a >> b;

  int ans = a > b + w ? a - (b + w) : b - (a + w);

  if(ans < 0) ans = 0;

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int f(int x){
    int ans = 0;
    for(int i = 1; i * i <= x; i++){
        if (x % i == 0) ans += 2;
    }
    return ans;
}

int main(){
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1; i <= n; i += 2){
        if (f(i) == 8) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>

using namespace std;

int main(void)
{
    u_int n;
    cin >> n;

    long min = 1000001, max = -1000001, sum = 0;
    for (u_int i = 0; i < n; i++) {
        int x;
        cin >> x;
        sum += x;
        if (x < min)
            min = x;
        if (x > max)
            max = x;
    }

    printf("%ld %ld %ld\n", min, max, sum);
    return 0;
}

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

ll n, k, ans;

int main() {
  cin >> n >> k;
  ans = k;
  rep (i, n-1) {
    ans *= k-1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;

int main(){
   int n;
   vector<int> num;
   int m,s,i;
   
   while(cin>>n){
      num.clear();
      
      for(;;){
         m=1;
         if(n<1) break;
         
         else{
            for(int i=0;i<10;i++){
               if(m>n) break;
               m*=2;
            }
            m/=2;
            num.push_back(m);
            n-=m;
         }
      }
      
      s=(int)num.size()-1;
      cout<<num[s];
      s--;
      for(i=s;i>=0;i--){
         cout<<" "<<num[i];
      }
      puts("");
   }
   return 0;
}

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

using namespace std;

int n, k;

int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  if (k == 1) {
    cout << "0\n";
    return 0;
  }
  n -= k;
  cout << n << "\n";
  return 0;
}

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

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define For(i,a,b) for(int (i)=(a); (i)<(b); (i)++)

typedef pair<int, string> P;

void printvector3(vector<P> v) {
    REP(i,v.size()-1) {
        cout << v[i].second << v[i].first << " ";
    }
    cout << v[v.size()-1].second << v[v.size()-1].first << endl;
}

void bubblesort2(vector<P> &v) {
    int N = v.size();
    int flag = 1;
    while (flag) {
        flag = 0;
        for (int j = N-1; j > 0; j--) {
            if (v[j].first < v[j-1].first) {
                P temp = v[j];
                v[j] = v[j-1];
                v[j-1] = temp;
                flag = 1;
            }
        }
    }
}

void selectionsort2(vector<P> &v) {
    int N = v.size();
    REP(i,N) {
        int minj = i;
        For(j,i,N) {
            if (v[j].first < v[minj].first) {
                minj = j;
            }
        }
        if (v[i].first != v[minj].first) {
            P temp = v[i];
            v[i] = v[minj];
            v[minj] = temp;
        }
    }
}

bool checkifstable(vector<P> v, vector<P> w) {
    REP(i,v.size()) {
        if (v[i].second != w[i].second) {
            return false;
        }
    }
    return true;
}

int main() {
    int N;
    cin >> N;
    vector<P> v;
    REP(i,N) {
        string j;
        cin >> j;
        int c = j[1]-'0';
        string s; s.push_back(j[0]);
        P p = make_pair(c, s);
        v.push_back(p);
    }
    vector<P> w(v);
    bubblesort2(v);
    printvector3(v);
    cout << "Stable" << endl;
    selectionsort2(w);
    printvector3(w);
    if (checkifstable(v,w)) {
        cout << "Stable" << endl;
    }else {
        cout << "Not stable" << endl;
    }
    return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(int i=0;i<(int)n;i++)
#define PI acos(-1)
#define fast_io ios_base::sync_with_stdio(false) ; cin.tie(0); cout.tie(0);
ll mod=1e9+7;

ll rep_pow(ll a, ll b){//繰り返し2乗法
    if(b==0) return 1;
    else if(b%2==0){
        ll memo = rep_pow(a, b/2);
        return memo*memo%mod;
    }else{
        return rep_pow(a, b-1)*a%mod;
    }
}

ll nCr(ll n, ll r){//mod逆元使ったnCr
    ll ret=1;
    rep(i,r){
        ret *= n-i;//分子
        ret %= mod;
        ret *=rep_pow(r-i, mod-2);//mod逆元によりr!で割ると同値
        ret %= mod;
    }
    return ret;
}
ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b);}

int counter(int x){
    if(x==0) return 0;
    return counter(x>>1)+(x&1);
}


int main(){
    fast_io

    string s;
    cin>>s;
    rep(i,s.size()-1){
        if(s[i]=='A'&&s[i+1]=='C'){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256