akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		sc.nextLine();
		String[][] gazo = new String[h][w];
		for(int i = 0; i< h;i++) {
			gazo[i] = sc.nextLine().split("");
		}
		for(int i = 0; i< h;i++) {
			StringBuilder sb = new StringBuilder();
			for(int j = 0; j< w;j++) {
				sb.append(gazo[i][j]);
			}
			System.out.println(sb);
			System.out.println(sb);
		}

	}
}

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

using   namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define  all(v)       (v).begin(),(v).end()
#define  rall(v)      (v).rbegin(),(v).rend()
#define  pb           push_back  
#define  eb           emplace_back
#define  mp           make_pair
#define  ff           first
#define  ss           second
#define  pf           push_front
#define  bs           binary_search
#define  lb           lower_bound
#define  ub           upper_bound
#define  umap         unordered_map
#define  uset         unordered_set
#define  dec(x)       fixed<<setprecision(x)
#define  lcm(a,b)    (a*b/__gcd(a,b))

typedef  priority_queue<ll>  pq;
typedef  priority_queue<ll,vector<ll>,greater<ll>> pqmn;
typedef  pair<ll,ll> pll;

const    ll inf=LLONG_MAX;
const    ll mod=1e9+7;
const    ld pi=acos(-1);
                    
void solution(){
ll n;
cin>>n;
if(n>=30){
    cout<<"Yes";
}
else{
    cout<<"No";
}

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t;
    t=1;
   // cin>>t;
    while(t--){
        solution();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s; cin >> s;
    while(1){
        if(s=="ABC"){
            printf("Yes\n");
            return 0;
        }
        int n=s.size();
        bool change=0;
        for(int i=0;i+2<n;i++){
            if(s.substr(i,3)=="ABC"){
                change=true;
                if(i==0){
                    for(int j=i;j<s.size();j++){
                        if(j+2<s.size()&&s.substr(j,3)=="ABC"){
                            s=s.substr(0,j)+"A"+s.substr(j+3);
                        }
                        else if(s[j]=='A'){
                            printf("No\n");
                            return 0;
                        }
                    }
                }
                else if(s.substr(n-3,3)=="ABC"){
                    for(int j=0;j<s.size();j++){
                        if(j+2<s.size()&&s.substr(j,3)=="ABC"){
                            s=s.substr(0,j)+"C"+s.substr(j+3);
                        }
                        else if(s[j]=='C'){
                            printf("No\n");
                            return 0;
                        }
                    }
                }
                else{
                    for(int j=0;j<s.size();j++){
                        if(j+2<s.size()&&s.substr(j,3)=="ABC"){
                            s=s.substr(0,j)+"B"+s.substr(j+3);
                        }
                        else if(s[j]=='B'){
                            printf("No\n");
                            return 0;
                        }
                    }
                }
                break;
            }
        }
        if(!change)break;
    }
    printf("No\n");
}



Measured memory_bytes: 3280
import java.util.*;

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        Set<Integer> set = new HashSet<>();

        int current = 0;
        for (int i = 0; i < n;i++) {
            current = current ^ sc.nextInt();
        }

        System.out.println(current == 0 ? "Yes": "No");
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Measured memory_bytes: 46692
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const int nmax = 8;
bool graph[nmax][nmax];
const int INF = 1e9;
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}
ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

const string YES = "Yes";
const string NO = "No";

void solve(std::string S)
{
    int n = 0, w = 0, s = 0, e = 0;
    for (int i = 0; i < S.size(); i++)
    {
        switch (S[i])
        {
        case 'N':
            n++;
            break;
        case 'W':
            w++;
            break;
        case 'S':
            s++;
            break;
        case 'E':
            e++;
            break;

        default:
            break;
        }
    }

    if ((n > 0 && s > 0) || (n == 0 && s == 0))
    {
        if ((w > 0 && e > 0) || (w == 0 && e == 0))
        {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
// #define rep(i, n) for(int i = 0; i < n; i++)
// #define rrep(i, n) for(int i = n; i >= 0; i--)
// #define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define INF9 1000000000 //10^9
#define MOD 1000000007 //10^9+7
#define fi first
#define sc second
using ll=long long;
using pii=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
using vb=vector<bool>;
ll n,ans;
vll a,b;

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	cout<<fixed<<setprecision(20);

    string s;
    cin >> s;
    int n=s.size()+1;
    a.resize(n,0);
    // rep(i,n) cout << a[i] << " ";
    // cout << endl;
    rep(i,n-1) if(s[i]=='<') a[i+1] = max(a[i+1], a[i]+1);
    // rep(i,n) cout << a[i] << " ";
    // cout << endl;
    per(i,n-1) if(s[i]=='>')  a[i] = max(a[i], a[i+1]+1);
    // rep(i,n) cout << a[i] << " ";
    // cout << endl;
    cout << accumulate(ALL(a),0LL) << endl;
    return 0;
}


Measured memory_bytes: 4764
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = {}
ans = 0
for i in range(n):
    ans = max(ans, sum(a[0:i+1]) + sum(b[i:]) )
#    print("i=",i)
#    print( "sum(a[0:i+1])",sum(a[0:i+1]) )
#    print( "sum(b[i:])",sum(b[i:]) )
#    print()
print(ans)

Measured memory_bytes: 3064
from collections import Counter

n = int(input())
dl = list(map(int, input().split()))
m = int(input())
tl = list(map(int, input().split()))

ts = list(set(tl))
tc = Counter(tl)
dc = Counter(dl)

for t in ts:
    if tc[t] <= dc[t]:
        continue
    else:
        print('NO')
        break
else:
    print('YES')

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    s = '0' + s + '1';
    int ans = 1;
    for (int i = (n + 1) / 2, j = (n + 2) / 2; i >= 0 && j <= n + 1; i--, j++) {
        if (s[i] != s[(n + 1) / 2] || s[j] != s[(n + 1) / 2]) {
            ans = j - 1;
            break;
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n - 1; i >= 0; i--)

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

int K;
int X;

int main()
{
    cin >> K >> X;
    if (K * 500 >= X)
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
    int H=0, W=0;
    cin >> H >> W;
    char a[H][W];
    bool d_H[H], d_W[W];
    for(int i=0; i<H; ++i)
        for(int j=0; j<W; ++j)
            cin >> a[i][j];
    for(int i=0; i<H; ++i)
        d_H[i] = false;
    for(int i=0; i<W; ++i)
        d_W[i] = false;
    
    for(int i=0; i<H; ++i){
        bool flag = true;
        for(int j=0; j<W; ++j){
            if(a[i][j]=='#'){
                flag = false;
                break;
            }
        }
        if(flag) d_H[i] = true;
    }

    for(int j=0; j<W; ++j){
        bool flag = true;
        for(int i=0; i<H; ++i){
            if(a[i][j]=='#'){
                flag = false;
                break;
            }
        }
        if(flag) d_W[j] = true;
    }

    for(int i=0; i<H; ++i){
        for(int j=0; j<W; ++j){
            if(!d_H[i]&&!d_W[j])
                cout << a[i][j];
        }
        if(!d_H[i])
            cout << endl;
    }
}

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

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<pair<long long, long long>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
		a[i].first += a[i].second;
	}

	sort(a.rbegin(), a.rend());
	
	long long ans = 0;
	for (int i = 0; i < n; i+=2) {
		ans += a[i].first;
	}

	for (int i = 0; i < n; i++) {
		ans -= a[i].second;
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

class Solution {
public:
    long double solve(vector<int>& X, vector<int>& Y) {
        int n = X.size();
        vector<int> A(n, 0);
        iota(A.begin(), A.end(), 0);
        
        auto cmp = [&](int l, int r) {
            int x1 = X[l], y1 = Y[l];
            int x2 = X[r], y2 = Y[r];
            double L = -1234;
            double R = -1234;
            if (x1 != 0 || y1 != 0) {
                L = atan2(y1, x1);
            } 
            if (x2 != 0 || y2 != 0) {
                R = atan2(y2, x2);
            }
            return L < R;
        };
        sort(A.begin(), A.end(), cmp);

        A.resize(n * 2);
        for (int i = 0; i < n; ++i) {
            A[i + n] = A[i];
        }

        long long res = 0;
        for (int l = 0; l < n; ++l) {
            long long x = 0;
            long long y = 0;
            for (int r = l; r - l + 1 <= n; ++r) {
                int idx = A[r];
                x += X[idx];
                y += Y[idx];
                res = max(res, x * x + y * y);
            }
        }
        return sqrt(res);
    }
};

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(16);

    int n;
    cin >> n;
    vector<int> X;
    vector<int> Y;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        X.push_back(x);
        Y.push_back(y);
    }
    Solution sol;

    cout << sol.solve(X, Y) << "\n";

    return 0;
}

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

int main() {
    int A, B;
    char op;
    int answer;

    cin >> A >> op >> B;
    if(op == '+'){
        answer = A + B;
    }
    else if(op == '-') {
        answer = A - B;
    }

    cout << answer << endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

//const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main(){
	ll X, Y;
	cin >> X >> Y;
	if (X%Y == 0){
		cout << -1 << endl;
	}
	else{
		cout << X << endl;
	}

	return 0;
}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if b-a<=k and c-a<=k and d-a<=k and e-a<=k and c-b<=k and d-b<=k and e-b<=k and d-c<=k and e-c<=k and e-d<=k:
  print('Yay!')
else:
  print(':(')

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) for (auto i = mp.begin(); i != mp.end(); ++i) { cout << i->first <<":"<<i->second << endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<" ";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    ll k;
    cin>>n>>k;
    vector<int> h(n);
    for(int i=0; i<n; i++){ 
        cin >> h[i]; 
    } 
    ll cnt=0;
    sort(h.begin(), h.end(),greater<int>());
    for(int i=0; i<n; i++) {
        if(h[i]>=k){
            cnt++;
        }
    }

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


Measured memory_bytes: 640
#include <iostream>

using namespace std;

typedef long long ll;

int main(int argc, char *argv[])
{
	ll N;

	cin >> N;

	if (N % 2 == 1) {
		cout << 0 << endl;
		return 0;
	}

	ll b = 5;
	ll ans = 0;
	for (ll i = 10; i <= N; i *= 5) {
		ans += N / i;
	}

	cout << ans << endl;

	return 0;
}

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

	struct  card{
	char e;
	int n;
	
	};
	
	bool check(card *card1,card *card2,int N){//card2が元
		vector<bool>flag;
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				if(card2[i].n==card2[j].n){
					for(int k=0;i<N;k++){
						if(card1[k].n==card2[i].n&&card1[k].e==card2[i].e){
						break;
						}
						else if(card1[k].n==card2[j].n&&card1[k].e==card2[j].e)return false;
					
					}
				}	
			}
		}
	return true;
}

int main(){
	bool flag;
	
	//int a[100],b[100];string aaa[100];
	 card c1[100],c3[100];
	int N;cin>>N;
	
	for(int i=0;i<N;i++)cin>>c1[i].e>>c1[i].n;

	card c2[100];
		for(int i=0;i<N;i++){c2[i]=c1[i];c3[i]=c2[i];}
		//for(int i=0;i<N;i++)cout<<c2[i].e<<c2[i].n<<endl;
	///バブルソート
	
	for(int i=0;i<N;i++){
		for(int j=0;j<N-1;j++){
			if(c1[j].n>c1[j+1].n)swap(c1[j],c1[j+1]);
		}
	}
	for(int i=0;i<N-1;i++)cout<<c1[i].e<<c1[i].n<<" ";
	cout<<c1[N-1].e<<c1[N-1].n<<endl;
	string em=(check(c1,c3,N)) ? "Stable" : "Not stable";
	cout<<em<<endl;
	
	//選択ソート
	for(int i=0;i<N;i++){
		int mini=i;
		for(int j=i;j<N;j++){
			if(c2[j].n<c2[mini].n)mini=j;
		}
		swap(c2[i],c2[mini]);
	}
	for(int i=0;i<N-1;i++)cout<<c2[i].e<<c2[i].n<<" ";
	cout<<c2[N-1].e<<c2[N-1].n<<endl;
	 em=(check(c2,c3,N)) ? "Stable" : "Not stable";
	cout<<em<<endl;

	return 0;
}

Measured memory_bytes: 1208
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int[] array = new int[5];
		array[0] = sc.nextInt();
		array[1] = sc.nextInt();
		array[2] = sc.nextInt();
        array[3] = sc.nextInt();
        array[4] = sc.nextInt();
        int k = sc.nextInt();
        int count = 0;
        for(int i=0; i<5; i++){
          for(int j=0; j<5; j++){
         	if(Math.abs(array[i] - array[j]) > k){
              count = 1;
              break;
            }
          }
          if(count == 1) break;
        }
		if(count == 1) System.out.println(":(");
        else System.out.println("Yay!");
	}
}

Measured memory_bytes: 23892
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.ByteString.Char8 as B
import Data.Bool
import Data.Maybe

main :: IO ()
main = B.interact $ solve . readQuery . map (fst . fromJust . B.readInt) . tail . B.words

readQuery :: [Int] -> [(Int, Int, Int)]
readQuery [] = []
readQuery (t:x:y:as) = (t, x, y) : readQuery as

solve :: [(Int, Int, Int)] -> B.ByteString
solve qs = bool "No" "Yes" $ all p $ zipWith op qs ((0,0,0):qs)
  where
    op (t, x, y) (u, z, w) = t - u - (abs (x - z)) - (abs (y - w))
    p n = n >= 0 && even n





Measured memory_bytes: 4348
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(nil, 1000000000000)

	n := nextInt()
	as := make([]int, n)
	asum := make([]int, n)

	mod := int(1e9 + 7)

	for i := 0; i < n; i++ {
		as[i] = nextInt() % mod
	}

	asum[n-1] = as[n-1]
	for i := 1; i < n-1; i++ {
		asum[n-1-i] = (asum[n-i] + as[n-1-i]) % mod
	}

	ans := 0
	for i := 0; i < n-1; i++ {
		ans += as[i] * asum[i+1] % mod
		ans = ans % mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7512
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

char x, y;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> x >> y;
	if(x == y) cout << "=\n";
	else if(x > y) cout << ">\n";
	else cout << "<\n";
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main()
{
    long long n,i,sum=1;
    scanf("%lld",&n);
    for(i=1;n>=i;i++)
    {
        sum=(sum*i)%1000000007;
    }
    printf("%lld\n",sum);
    return 0;
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int dp[100100][3];
int N, K;
int point[3];
std::string T;
int U[100100];

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

    std::cin >> N >> K;

    for(int i=0;i<3;++i){
        std::cin >> point[i];
    }

    std::cin >> T;

    for(int i=0;i<N;++i){
        if(T[i] == 'r'){
            U[i] = 2;
        }else if(T[i] == 's'){
            U[i] = 0;
        }else{
            U[i] = 1;
        }
    }

    for(int i=0;i<K;++i){
        dp[i][U[i]] = point[U[i]];
    }

    for(int i=K;i<N;++i){
        for(int j=0;j<3;++j){
            for(int k=0;k<3;++k){
                if(j == k){continue;}

                int x = dp[i-K][j];

                if(k == U[i]){
                    x += point[k];
                }

                dp[i][k] = std::max(dp[i][k], x);
            }
        }
    }

    int score = 0;

    for(int i=N-K;i<N;++i){
        int mx = 0;

        for(int j=0;j<3;++j){
            mx = std::max(mx, dp[i][j]);
        }

        score += mx;
    }

    std::cout << score << std::endl;
}


Measured memory_bytes: 2000
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string S;
    cin >> S;
 
  	vector<int> x(26,0);
    for(int i=0;i<S.size();i++)
    {
      x.at(S.at(i)-'a')++;
    }
  
  	bool flag=true;
  	for(int i=0;i<26;i++){
      if(x.at(i)>0&&x.at(i)%2==1){
        flag=false;
        break;
      }
    }
  
	if(flag)
      cout<<"Yes"<<endl;
    else
      cout<<"No"<<endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;

#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 each(i, mp) for(auto& i:mp)

const int INF = 1001001001;

int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(n+1);
  rep(i,n) {
    cin >> a[i];
    // if (a[i] == 0) a[i] = k;
  }
  a[n] = a[0] + k;
  int ans = 0;
  // cout << a[0] << endl;
  // cout << a[1] << endl;
  // cout << a[2] << endl;
  // cout << "n " << endl;
  rep(i, n){
    ans = max(ans, a[i+1] - a[i]);
  }
  ans = k - ans;
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define  N 200200

const double PI = 3.14159265359;
typedef long long ll;

int a[N];

void solve() {
    int n;
    cin >> n;
    int now = 1;
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        if (x == now) {
            now++;
        }
    }
    if (now == 1) {
        cout << -1 << endl;

    } else
        cout << n - now + 1 << endl;

}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#ifdef qwerty
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif


    int T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }

    return 0;
}

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

int main(){
int N,ans,c,p;
  cin>>N;
  ans=0;
  if(N>3){
  for(int i=2;i<=sqrt(N);i++){
    c=i;
while(c<=N){
  c*=i;
}
    p=c/i;
    ans=max(ans,p);
  }
  }
  else{
    ans=1;
  }
  cout<<ans<<endl;
     

}

Measured memory_bytes: 256
n=int(input())
arr=[int(input()) for _ in range(n)]
ans=True
checked=[0]*n
num=0
for i in range(30,-1,-1):
  cnt=0
  pos=-1
  bit=2**i
  mask=2**i-1
  for j in range(n):
    if (arr[j])&(bit)!=0:
      cnt+=1
      if arr[j]==bit:
        pos=j
    arr[j]&=mask
  if i!=0:
    if cnt%2==0:
      continue
    else:
      if pos==-1:
        ans=False
        break
      else:
        arr[pos]=mask
        checked[pos]=1
        num+=1
        continue
  if i==0:
    if cnt%2==0:
      continue
    else:
      for j in range(n):
        if checked[j]==0:
          num+=1
          break
      else:
        ans=False
if ans==True:
  print(num)
else:
  print(-1)

Measured memory_bytes: 7840
//慣れてきた人向け

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

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

    //unordered_mapを使う
    //参考：
    //https://cpprefjp.github.io/reference/unordered_map/unordered_map.html
    //https://atcoder.jp/contests/abc173/submissions/15053357

    //unordered_map って？
    //参考:http://vivi.dyndns.org/tech/cpp/unordered_map.html

    unordered_map<string, int> mp;

    for (int i = 0; i < n;i++){
        string s;
        cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 3644
import random

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

ans = 0
for i in range(1, n-1):
    if A[i] == A[i-1]:
        ans += 1
        while(1):
            A[i] = random.randrange(10000)+1
            if A[i] != A[i-1] and A[i] != A[i+1]: break

if A[-1] == A[-2]: ans += 1
print(ans)

Measured memory_bytes: 4336
import itertools
n = int(input())
f = [list(map(int,input().split())) for _ in range(n)]
p = [list(map(int,input().split())) for _ in range(n)]
INF = float("inf")
ans = -INF
for i in list(itertools.product([0,1],repeat=10)):
  tmp = 0
  if sum(i)==0: continue
  for j in range(n):
    open_s = sum([1 for p,q in zip(i,f[j]) if p+q==2])
    tmp += p[j][open_s]
  ans = max(tmp,ans)
print(ans)
 

Measured memory_bytes: 3188
#define taskname ""
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int maxN = 1e5;

ll W, H, x, y;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
    cin >> W >> H >> x >> y;
    cout << fixed << setprecision(8) << W * H / 2.0 << ' ' << setprecision(0) << (x == W / 2.0 && y == H / 2.0);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

struct UnionFind {
	vector<int> data;

	UnionFind(int sz) {
		data.assign(sz, -1);
	}

	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y) return;
		if (data[x] > data[y]) swap(x, y);
		data[x] += data[y];
		data[y] = x;
	}

	int find(int k) {
		if(data[k] < 0) return(k);
		return data[k] = find(data[k]);
	}

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

	int size(int k)	{
		return -data[find(k)];
	}
};


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

    int n, q; cin >> n >> q;
    UnionFind uf(n);
    rep(i, q) {
        int x, y, z; cin >> x >> y >> z;
        if (x==0) {
            // unite
            uf.unite(y, z);
        } else {
            cout << uf.same(y, z) << endl;
        }
    }
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int k, p;
        cin >> k >> p;
        cout << (k - 1) % p + 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 3168
void main() {
  problem();
}

void problem() {
  enum CONTESTS = 26;
  const days = scan!int;
  const dec = scan!long(CONTESTS);
  const inc = days.iota.map!(x => scan!long(CONTESTS)).array;

  long solve() {
    long[CONTESTS] desat;
    long sat;
    long prevSat;

    long decideNextContest(long day, const long[] inc, long[] dec) {
      long contestCanditate;
      long score = long.min;
      const sumDec = dec.sum;

      foreach(c; 0..CONTESTS) {
        long testScore = inc[c] + dec[c] - sumDec;
        if (score < testScore) {
          contestCanditate = c;
          score = testScore;
        }
      }
      return contestCanditate;
    }

    foreach(i; 0..days) {
      auto c = decideNextContest(i, inc[i], desat);
      (c + 1).writeln;

      sat += inc[i][c];
      foreach(o; 0..CONTESTS) {
        desat[o] = c == o ? 0 : desat[o] + dec[o];
        sat -= desat[o];
      }

      deb(["satisfaction", prevSat.to!string, "->", sat.to!string]);
      prevSat = sat;
    }
    
    return sat;
  }

  solve();
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


Measured memory_bytes: 3340
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

template<typename T = ll>
vector<T> get_candidate(int n) {
    vector<T> ret;
    ret.push_back(1); ret.push_back(n);

    for (T i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) {
                ret.push_back(n / i);
            }
        }
    }

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

    return ret;
}

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

    ll sum = 0;
    vector<ll> a(n);

    REP(i, n) {
        cin >> a[i];
        sum += a[i];
    }

    ll ans = 0;
    for (ll m : get_candidate(sum)) {
        vector<ll> v;
        REP(i, n) {
            if (a[i] % m) v.push_back(a[i] % m);
        }

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

        const int vn = v.size();
        ll cnt = numeric_limits<ll>::max();
        REP(l, vn + 1) {
            ll ns = 0, ps = 0;
            
            REP(i, vn) {
                if (i < l) {
                    ns += v[i];
                } else {
                    ps += m - v[i];
                }
            }

            if (ns == ps) cnt = min(cnt, ns);
        }

        if (cnt <= k) {
            ans = max(ans, m);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#include<math.h>
int main(void){
  int a,b,c,tmp;
  scanf("%d%d%d",&a,&b,&c);
  tmp=a;
  a=abs(a-b);
  b=abs(b-c);
  c=abs(c-tmp);
  printf("%d",a+b+c-(int)fmax(a,fmax(b,c)));
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define MAX_N 5010
using namespace std;
struct state
{
    int last;
    int len[2*MAX_N],link[2*MAX_N];
    int ch[2*MAX_N][26],tot;
    int ans,size[2*MAX_N];
    state()
    {
        last=1;
        tot=1,ans=0;
        len[1]=0;
        link[1]=0;
        size[tot]=1;
    }
    inline int new_node()
    {
        ++tot;
        len[tot]=link[tot]=size[tot]=0;
        for(register int i=0;i<26;++i)
            ch[tot][i]=0;
        return tot;
    }
    inline void insert(int c)
    {
        int cur=new_node(),p=last;
        size[cur]=1;
        len[cur]=len[last]+1;
        while(p&&!ch[p][c])
        {
            ch[p][c]=cur;
            p=link[p];
        }
        if(!p)
            link[cur]=1;
        else
        {
            int q=ch[p][c];
            if(len[p]+1==len[q])
                link[cur]=q;
            else
            {
                int clone=new_node();
                for(register int i=0;i<26;++i)
                    ch[clone][i]=ch[q][i];
                len[clone]=len[p]+1;
                link[clone]=link[q];
                while(p&&ch[p][c]==q)
                {
                    ch[p][c]=clone;
                    p=link[p];
                }
                link[q]=link[cur]=clone;
            }
        }
        last=cur;
    }
}sam;
int n,l1,l2,ans;
char str[MAX_N],s[MAX_N],t[MAX_N],kmp[MAX_N];
int main()
{
    ios::sync_with_stdio(0);
    cin>>n>>str+1;
	for(register int i=0;i<n;++i)
	{
		if(i)sam.insert(str[i]-'a');
		int p=1,sum=0;
		for(register int j=i+1;j<=n;++j)
		{
			p=sam.ch[p][str[j]-'a'];
			if(p==0)sum=0,p=1;
			else sum++;
			ans=max(ans,sum);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
#include<algorithm>
using namespace std;
int main()
{
	int a[10000];
	int i,j,m,n,count=0;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
		sort(a,a+n+1); 
		for(i=1;i<=n-2;i++)
		{
			for(j=i+1;j<=n-1;j++)
			{
				for(m=j+1;m<=n;m++)
				{
					if(a[i]+a[j]>a[m])
						count++;
					else
						count=count+0;
				}
			}
		}
		printf("%d\n",count);
}


Measured memory_bytes: 256
c=[list(map(int,input().split())) for _ in range(3)]
S=0
for i in range(3):
    S+=sum(c[i])
ans="No"
if S%3==0:
    tmp=S//3
    tmp1=c[0][0]+c[1][1]+c[2][2]
    tmp2=c[0][1]+c[1][2]+c[2][0]
    tmp3=c[0][2]+c[1][0]+c[2][1]
    tmp4=c[0][2]+c[1][1]+c[2][0]
    tmp5=c[0][1]+c[1][0]+c[2][2]
    tmp6=c[0][0]+c[1][2]+c[2][1]
    if tmp==tmp1 and tmp==tmp2 and tmp==tmp3 and tmp==tmp4 and tmp==tmp5 and tmp==tmp6:
        ans="Yes"
print(ans)

Measured memory_bytes: 3064
import java.util.*;
 
public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int count = sc.nextInt();
      	int discount = sc.nextInt();
      	PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
      	int temp = 0;
      	long sum = 0;
      	for(int i = 0; i < count; i++){
        	pq.add(sc.nextInt());
        }
      	for(int l = 1; l <= discount; l++){
          	temp = pq.poll();
          	pq.add(temp/2);
        }
      	for(int n = 0; n < count; n++){
          	sum = sum + pq.poll();
          	
        }
      	System.out.println(sum);
	}
}

Measured memory_bytes: 59984
(n,m),*z=$<.map{|s|s.split.map &:to_i}
P=*0..n
Q=[0]*-~n
F=->x{x==(p=P[x])?x:(
  P[x]=F[p]
  Q[x]+=Q[p]
  P[x]
)}
z.map{|l,r,d|
  pl=F[l]
  pr=F[r]
  pl==pr&&Q[l]+d!=Q[r] ? (
    puts("No")
    exit
  ):(
    P[pr]=pl
    Q[pr]=Q[l]+d-Q[r]
  )
}
puts "Yes"

Measured memory_bytes: 22904
#include <iostream>
#include <string>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;

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

  ll n; cin >> n;
  ll ans = 1e9;
  for(ll i = 1; i*i <= n; ++i) {
    if(n%i == 0) {
      ll a = i;
      ll b = n/i;
      string sa = to_string(a);
      string sb = to_string(b);

      ll f = max(sa.size(), sb.size());
      ans = min(ans, f);
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
/*
 * wafuIroha.cpp
 *
 *  Created on: 2020/02/23
 *      Author: black
 */
#include <iostream>
using namespace std;

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

	if ((c >= a) && (c <= b)){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}


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

int main()
{
    int arr[4]={0};
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        string s;
        cin>>s;
        if(s=="AC")arr[0]++;
        if(s=="WA")arr[1]++;
        if(s=="TLE")arr[2]++;
        if(s=="RE")arr[3]++;
    }
    printf("AC x %d\n",arr[0]);
    printf("WA x %d\n",arr[1]);
    printf("TLE x %d\n",arr[2]);
    printf("RE x %d\n",arr[3]);
}


Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define x first
#define y second

double dist(pair<int,int> a, pair<int,int> b) {
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int n; cin >> n;
    vector<pair<int,int>> v(n);
    for (int i = 0; i < n; i++) {
        int x, y; cin >> x >> y;
        v[i] = {x,y};
    }
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        p[i] = i;
    }
    double sum = 0;
    do {
        for (int i = 0; i < n-1; i++) {
            sum += dist(v[p[i]],v[p[i+1]]); 
        }
    } while (next_permutation(p.begin(),p.end()));
    for (int i = n; i >= 1; i--) {
        sum /= i;
    }
    cout << fixed << setprecision(10) << sum << '\n';
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif

	ll a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << ' ' << b << ' ' << c << '\n';
}


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	if (v.size()) {
		os << v[0];
		for (int i = 1; i < v.size(); i++) os << " " << v[i];
	}
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	int N, K; cin >> N >> K;
	string S; cin >> S;

	vint dats;
	
	bool state = true;
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		if (state && S[i] == '1' || !state && S[i] == '0') {
			cnt++;
		} else {
			state = !state;
			dats.push_back(cnt);
			cnt = 1;
		}
	}
	dats.push_back(cnt);
	if (!state) dats.push_back(0);
	
	int maxv = 0;
	int sum = 0;
	int j = 0;	
	for (int i = 0; i < dats.size(); i += 2) {
		while (j < dats.size() && j-i < K*2+1) {
			sum += dats[j];
			j++;
		}
		chmax(maxv, sum);
		if (i+1 < dats.size()) sum -= dats[i] + dats[i+1];
	}
	cout << maxv << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 4064
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(20) << fixed;
  solve();
}

///////////////////////////////////////////////////////////

string S;
void solve() {
  cin >> S;
  if(S == "AAA" || S == "BBB"){
    cout << "No" <<endl;
  } else{
    cout << "Yes" <<endl;
  }
}

Measured memory_bytes: 256
import sys
input=sys.stdin.readline
n=int(input())
p=[int(input())for _ in range(n)]
num=[-1]*n
for i in range(n):
	num[p[i]-1]=i
ans=0
kari=1
for i in range(n-1):
	if num[i+1]>num[i]:
		kari+=1
	else:
		ans=max(ans,kari)
		kari=1
ans=max(ans,kari)
print(n-ans)

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

using namespace std;

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

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


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

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

//-----------------------------------------
long long power_mod(long long x, long long y, long long m){
    long long res = 1 ;
    if(y>0){
        res = power_mod(x,y/2,m) ;
        if(y%2==0){
            res = (res*res)%m ;
        }
        else{
            res = (((res*res)%m)*x)%m ;
        }
    }
    return res ;
}
//-----------------------------------------

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  ll n;
  cin >> n;
  vll a(n);
  REP(i,n) cin >> a[i];
  ll ans = a[0];
  REP(i,n-1){
    ans = lcm(ans,a[i+1]);
  }
  cout << ans <<endl;




  return 0;
}



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

int main(){
  int N;
  cin>>N;
  
  int ans=0;
    
  for(int i=0;i<N;i++){
    vector<int>vec(2);
    cin>>vec[1]>>vec[2];
    
    ans+=vec[2]+1-vec[1];
  }
  
  cout<<ans<<endl;
}
    
    
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
int main()
{
  int n,m,i,j=0,b,c;
  cin>>n>>m;
  int a[n];
  for(i=0;i<n;i++) cin>>a[i];
  sort(a,a+n);
  vector<pair<int,int>> v;
  for(i=0;i<m;i++)
  {
      cin>>b>>c;
      v.pb({c,b});
  }
  sort(v.begin(),v.end(),greater<pair<int,int>>());
  i=0;
  for(j=0;j<m;j++)
  {
    while(v[j].second>0 && i<n && a[i]<v[j].first)
    {
      a[i]=v[j].first;i++;v[j].second--;
    } 
  }
  long long ans=0;
  for(i=0;i<n;i++) {ans+=a[i];}
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1784
def Main(H, W):
    if H == 1 or W == 1:
        return 1
    else:    
        if W%2:
            if H%2:
                return W*(H//2)+(W//2+1)
            else:
                return W*(H//2)
        else:
            if H%2:
                return W*(H//2)+W//2
            else:
                return W*(H//2)
                

def main():
    H, W = map(int, input().split())
    print(Main(H, W))

if __name__ == '__main__':
    main()

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

  vector<int> d(n);
  for (auto &i : d) cin >> i;
  d.push_back(0);

  if (n >= 24) {
    cout << 0 << endl;
    return 0;
  }
  if (n >= 12) {
    int a[13] = {};
    for (int i = 0; i <= n; ++i) {
      a[d[i]]++;
    }
    // for (int i = 0; i < 13; ++i) {
    //   cout << i << " : " << a[i] << endl;
    // }

    bool f = a[0] < 2 && a[12] < 2;
    for (int i = 1; i < 12; ++i) {
      if (a[i] >= 3) {
        f = false;
      }
    }

    cout << f << endl;

    return 0;
  }

  int ans = 0;
  vector<int> a(n + 1);
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < d.size(); ++j) {
      if (i & (1 << j)) {
        a[j] = d[j];
      } else {
        a[j] = 24 - d[j];
      }
    }

    int diff = 1001001;
    for (int j = 0; j < a.size(); ++j) {
      for (int k = 0; k < a.size(); k++) {
        if (j == k) continue;
        diff = min(diff, min(abs(a[j] - a[k]), 24 - abs(a[j] - a[k])));
      }
    }

    ans = max(diff, ans);
  }

  cout << ans << endl;
}


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


int main() {
  int n; cin >> n;
  vector<int> vec(n+1);
  for(int i=1; i<n+1; i++){
    int a; cin >> a;
    vec[a] = i;
  }
   for(int i=1; i<n+1; i++)cout << vec[i] << ' ';
  cout << endl;
  return 0;
  
}

Measured memory_bytes: 1152