akhauriyash/Code-Regression huggingface dataset:
$island_num = 0
 
def check(x, y)
    return false if x<0 || y<0 || $w<=x || $h<=y || $chart[y][x] == 0
     
    if $history[y][x]
        return false
    else
        $history[y][x] = true
    end
 
    # y → x　の順に push
    $next.push(y)
    $next.push(x)
end
 
loop do
    $w, $h = gets.split.map(&:to_i)
     
    # EOF
    exit if $w == 0 && $h == 0
     
    # 島の個数の初期化
    $island_num = 0
 
    # 海図の作成
    $chart = []
    $h.times do
        $chart << gets.split.map(&:to_i)
    end
     
    # 探索済み地域
    $history = Array.new($h).map{Array.new($w, false)}
 
    $h.times do |hh|
        $w.times do |ww|
            next if $chart[hh][ww] == 0 || $history[hh][ww] == true
         
            $list = [hh, ww]
            $next = []
     
            while (! $list.empty?) do
                while (! $list.empty?) do
                    xx = $list.pop
                    yy = $list.pop
                     
                    check(xx-1, yy-1)
                    check(xx, yy-1)
                    check(xx+1, yy-1)
                    check(xx-1, yy)
                    check(xx+1, yy)
                    check(xx-1, yy+1)
                    check(xx, yy+1)
                    check(xx+1, yy+1)
                end
                 
                $list = [*$next]
                $next.clear
            end
             
            $island_num += 1
        end
    end
     
    puts $island_num
end


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
   char c;cin >>c;
   char x[5]={'a','i','u','e','o'};
   bool flg=false;
    for (int i = 0; i < 5; ++i) {
        if(c==x[i])flg=true;
    }
    if(flg)puts("vowel");
    else puts("consonant");
   return 0;
}

Measured memory_bytes: 256
ABCD = input()

a = int(ABCD[0])
b = int(ABCD[1])
c = int(ABCD[2])
d = int(ABCD[3])

ans = ""
if (a + b + c + d) == 7:
    ans = "+++"
elif (a - b + c + d) == 7:
    ans = "-++"
elif (a + b - c + d) == 7:
    ans = "+-+"
elif (a + b + c - d) == 7:
    ans = "++-"
elif (a + b - c - d) == 7:
    ans = "+--"
elif (a - b + c - d) == 7:
    ans = "-+-"
elif (a - b - c + d) == 7:
    ans = "--+"
elif (a - b - c - d) == 7:
    ans = "---"

print(str(a)+ans[0]+str(b)+ans[1]+str(c)+ans[2]+str(d)+"=7")


Measured memory_bytes: 3064
n=int(input())
count_list=[]
b_a=0
b=0
a=0

for i in range(n):
    s=input()
    length=len(s)
    if s[0]=="B" and s[length-1]=="A":
        b_a=b_a+1
    if s[0]=="B":
        b=b+1
    if s[length-1]=="A":
        a=a+1
    count_list.append(s.count("AB"))
a=a-b_a
b=b-b_a
minimum=min(a+b_a, b+b_a)
if b==0 and a==0 and b_a==0:
    print(sum(count_list))
elif b==0 and a==0:
    print(sum(count_list)+minimum-1)
else:
    print(sum(count_list)+minimum)


Measured memory_bytes: 44776
import math
import bisect

N = int(input())

def printCount(N):
    if N <= 1:
        print(0)
        return

    num = N
    primeDivisions = []

    limit = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406, 435, 465, 496, 528, 561, 595, 630, 666, 703, 741, 780]

    primeCounts = []
    for factor in range(2, int(math.sqrt(N)) + 1):
        if num % factor != 0:
            continue
        count = 0
        while num % factor == 0:
            count += 1
            num //= factor
        primeCounts.append(count)
    if num != 1:
        primeCounts.append(1)

    if len(primeCounts) == 0:
        print(1)
    else:
        result = 0
        for count in primeCounts:
            index = bisect.bisect_right(limit, count)
            result += index
        print(result)

printCount(N)

Measured memory_bytes: 9272
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;

int main(){
    string n;
    cin >> n;
    if(n[0]=='9' or n[1]=='9') out("Yes");
    else out("No");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	for (int i=0;i<1000;i++)
	{
		if(a*i%b==c) 
		{
			cout<<"YES"<<endl;
			return 0;
		}
	}
	cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
/*input
abracadabra
avadakedavra
*/
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define mpr make_pair
#define MX 1000000007
#define ui unsigned int
#define ll long long
#define ld long double
#define fi first
#define se second
#define testcases int testcases;cin>>testcases;while(testcases--)
#define printvector(v) for(int i=0;i<v.size();i++) cout<<v[i]<<" ";  cout<<endl
#define printarray(v,n)  for(int i=0;i<n;i++) cout<<v[i]<<" ";  cout<<endl
#define inputarray(v,n)  for(int i=0;i<n;i++)cin>>v[i]
#define debug(i) cout<<"debug: "<<i<<endl
#define pr(i) cout<<i<<endl
#define timetaken cerr<<clock()/double(CLOCKS_PER_SEC)<<endl
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define toDigit(a) (a-'0')
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

string cal(string s1, string s2){
    int n = s1.length();
    int m = s2.length();
    vector<vector<ll>>dp(n+1,vector<ll>(m+1,0));
    
    for(int i=1;i<=n;++i){
        for(int j=1;j<=m;++j){
            if(s1[i-1] == s2[j-1]){
                dp[i][j] = dp[i-1][j-1]+1;
            }else{
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
        }
    }
    //return dp[n][m];
    string ans;
    int i=n, j=m;
    while(i>=1 && j>=1){
        if(s1[i-1] == s2[j-1]){
            ans = s1[i-1] + ans;
            i--;
            j--;
        }else if(dp[i-1][j] > dp[i][j-1]){
            i--;
        }else j--;
    }
    return ans;
}

int main() {
    fast_io;
    string s1,s2;
    cin>>s1>>s2;
    pr(cal(s1,s2));
    return 0;
}

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

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

    if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
    return 0;
}


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
long double d, x;

long double loop(int n, long double D, long double X) {
	if(n == 0) return 0.0;
	long double nD = (2 * n + 2.0) * D + 5.0 * X;
	long double nX = (2 * n + 4.0) * X;
	long double s = (2.0 * n * D + (2.0 * n - 1.0) * n * X) / (2.0 * n);
	return s + nD / (2.0 * n) * loop(n - 1, 1.0, nX / nD);
}

void solve() {
	cin >> N >> d >> x;
	cout << d * loop(N, 1.0, x / d) << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 19072
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n,m) for(ll i = (n); i<(m); i++)
using ll = long long int;

int main(void){
  int n;
  if (!scanf("%d", &n))
    return 0;
  std::vector<int> vec(n,0);
  int sum = 0;
  int max = 0;
  rep(i,0,n){
    int input;
  if (!scanf("%d", &input))
    return 0;
    sum += input;
    if (max < input)
      max = input;
  }
  sum-=max;
  if (max < sum)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;

}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n, m, q = map(int, input().split())
abcd = [0] * q
for i in range(q):
    abcd[i] = list(map(int, input().split()))

def dfs(seq):
    if len(seq) == n:
        yield seq
        return
    if not seq:
        _max = 1
    else:
        _max = seq[-1]
    for i in range(_max, m+1):
        new_seq = seq.copy()
        new_seq.append(i)
        yield from dfs(new_seq)

ans = 0
for s in dfs([]):
    tmp = 0
    for a, b, c, d in abcd:
        if s[b-1] - s[a-1] == c:
            tmp += d
    ans = max(ans, tmp)
print(ans)


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


int main(){
	int x,y;
	cin>>x>>y;
	
	
	string res="No";
	
	for (int i=0; i<=x; i++){
		int i4=i;
		int i2=x-i;
		
		
		if (4*i4+2*i2==y) res="Yes";
		
	
	}
	
	
	cout<<res<<endl;



}


Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <random>
#include <iomanip>
#include <functional>

using namespace std;

typedef long long ll;

int get_digits_sum(int n)
{
	int sum = 0;
	while (n)
	{
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

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

	int n;
	cin >> n;

	int min_sum = 2e9;
	for (int a = 1; a < n; a++)
	{
		int b = n - a;

		int digits_sum_a = get_digits_sum(a);
		int digits_sum_b = get_digits_sum(b);

		min_sum = min(min_sum, digits_sum_a + digits_sum_b);
	}

	cout << min_sum;
}

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

//define gcd and lcm (using 64bit)
ll gcd(ll a,ll b){
    if (a < b) {
        //^はxor(bitwise operator)。以下三行でswap(a,b)を行っている。
        a ^= b;
        b ^= a;
        a ^= b;
    }
    //only when b==0,this program finds that b means false and returns a.
    return b ? gcd(b, a % b) : a;
}

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


int main(){
    int n;
    double a=1,c=1,m=0;
    cin>>n;
    vector<double> p(n);
    rep(i,n){
        cin>>p[i];
    }
    rep(i,n){
        c*=p[i];
        rep(j,n){
            if(i==j) continue;
            a*=p[j];
        }
        m+=a;
        a=1;
    }
    cout<<setprecision(10)<<(c/m)<<endl;
    return 0;

}

Measured memory_bytes: 256
/*
    ALWAYS REMMEMBER:
        NEVER GIVE UP !
        DON'T MESS WITH ME !!!
        "" THE EXPERT IN ANYTHING WAS ONCE A BEGINNER ""
*/

#include<bits/stdc++.h>
using namespace std;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define f(i,a,b) for(ll i=a; i<=b; i++)
#define fi(i,a,b) for(ll i=a; i>=b; i--)
#define fa(x,b) for(auto x:b)
#define TC ll test_case; cin>>test_case; for(ll number=1 ; number <= test_case ; number ++ )
#define vll vector<ll>
#define pb push_back
#define pll pair<ll,ll>
#define mp make_pair
#define ff first
#define ss second
#define sz(a) (ll)(a).size()
#define sp(x) cout << fixed << setprecision(x);
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define endl "\n"

const ld pi = acos(-1);
const ll M=1e9+7,N=1e7+5,INF=1e18;

void solve()
{
    string s;
    cin >> s;
    if(s[2]==s[3] && s[4]==s[5])
    {
        cout << "Yes" ;
    }
    else
    {
        cout << "No";
    }    
}

int32_t main()
{
    FIO
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int N,M,K,A,res=0;
  int cnt[31]={};
  scanf("%d %d",&N,&M);
  
  for(int i=0;i<N;i++){
    scanf("%d",&K);
    for(int j=0;j<K;j++){
      scanf("%d",&A);
      cnt[A-1]++;
    }
  }
  
  for(int i=0;i<M;i++) if(cnt[i]==N) res++;
  printf("%d\n",res);
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define si(a) scanf("%d",&a)
#define sll(a) scanf("%lld",&a)
#define sl(a) scanf("%ld",&a)
#define pi(a) printf("%d\n",a)
#define pl(a) printf("%ld\n",a)
#define pll(a) printf("%lld\n",a) 
#define sc(a) scanf("%c",&a)a
#define pc(a) printf("%c",a)
#define ll long long
#define mod 1000000007

#define pb push_back
#define mp make_pair
#define f first
#define s second
#define INF INT_MAX
#define fr(i,a,b) for(int i=a;i<=b;i++)
#define VI vector<int>
#define VL vector<ll>
#define PI pair<int,int>
#define PL pair<ll,ll>
long double PIE=acos(-1);
//////////////////////////////////////////////////////////////
const ll N=1e5+5;
ll Ans=1;
bool done[1000009];
vector < ll > primes;

void FindPrime(ll N)
{
    done[1] = 1;
    for(int i=2;i<=N;i++)
	{
        if(done[i]) continue;
        for(int j=i*2;j<=N;j+=i)
		{
            done[j] = 1;
        }
        primes.push_back(i);
    }
}

ll solve(ll Num)
{
    for(int i=0;i<primes.size();i++)
	{
    	int p=primes[i];
        if(p*p*p > Num) break;
        ll Count = 1;
        while(Num%p == 0)
		{
            Num /= p,Count++;
        }
        Ans *= Count;
    }
    ll sq = (ll)sqrt(Num);
    if(!done[Num]) 
	Ans *= 2;
    else if(sq*sq == Num && !done[sq]) 
	Ans *= 3;
    else if(Num != 1) 
	Ans *= 4;
    return Ans;
}


ll fact[N], invfact[N];



ll pow(ll a, ll b, ll m)
{
	ll ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

ll modinv(ll k)
{
	return pow(k, mod-2, mod);
}


ll nCr(ll x, ll y)
{
	if(y>x)
		return 0;
	ll num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}

void initinv()
{
	fact[0]=1;
	fr(i,1,N)
	{
		fact[i]=(i*fact[i-1])%mod;
	}
	invfact[N]=modinv(fact[N]);
	for(int i=N-1;i>=1;i--)
	{
		invfact[i]=((i+1)*invfact[i+1])%mod;
	}
}
///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////
ll dp[3005][3005];
int main()
{
	string s,t;
	cin>>s>>t;
	for(int i=1;i<=s.size();i++)
	{
		for(int j=1;j<=t.size();j++)
		{
			dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			if(s[i-1]==t[j-1])
			{
				dp[i][j]=max(dp[i][j],dp[i-1][j-1]+1);
			}
		}
	}
	int x=s.size();
	int y=t.size();
	string ans="";
	while(x>=1&&y>=1)
	{
		if(dp[x][y]==dp[x-1][y])
		{
			x--;
		}
		else if(dp[x][y]==dp[x][y-1])
		{
			y--;
		}
		else if(dp[x][y]==dp[x-1][y-1]+1)
		{
			ans.pb(s[x-1]);
			x--;
			y--;
		}
	}
	reverse(ans.begin(),ans.end());
	cout<<ans;
    return 0;
}





Measured memory_bytes: 73992
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long 

// fact(n)
int fact(int n){
	if(n == 1)	return 1;
	else return (n * fact(n - 1));
}

// combination(n,r)
int combination(int n, int r){

	if(r == 0 || r == n)	return 1;
	else if(r == 1)	return n;
	return (combination(n - 1, r - 1) + combination(n - 1, r));
}

// gcd(a,b)
int gcd(int a,int b){
	int ret;
	ret = (b == 0) ? a : gcd(b, a % b);
	return ret;
}

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

// qsort(array, size, sizeof(int),comp);
int comp(const int *a,const int *b){
	return (*a - *b);
}

// append(array,*size,addNum)
void append(int *array,int *size,int num){
	realloc(array, sizeof(int) * (*size + 1));
	array[(*size)] = num;
	++(*size);
}

// pop(array,*size) & nongetpop(array,*size)
int pop(int *array,int *size){
	int temp = array[(*size - 1)];
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
	return temp;
}

void nongetpop(int *array,int *size){
	realloc(array,sizeof(int) * (*size - 1));
	--(*size);
}

int main(int argc, char const *argv[]){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if((a + b == c) || (a + c == b) || a == (b + c))	printf("Yes\n");
	else printf("No\n");
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

string s, f;

int main(){

    for(int i = 0; i < 3; i++){
        cin >> s;
        f.push_back(s[i]);
    }

    cout << f;
    
    





}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

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

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;
string sa, sb, sc;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin >> sa >> sb >> sc;
    char t = sa[0];
    sa.erase(0, 1);
    while(1){
        if(t == 'a'){
            if(SZ(sa) == 0){
                cout << "A";
                return 0;
            }
            t = sa.at(0);
            sa.erase(0, 1);
        }else if(t == 'b'){
            if(SZ(sb) == 0){
                cout << "B";
                return 0;
            }
            t = sb.at(0);
            sb.erase(0, 1);
        }else{
            if(SZ(sc) == 0){
                cout << "C";
                return 0;
            }
            t = sc.at(0);
            sc.erase(0, 1);
        }
    }
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

Measured memory_bytes: 256
#include <iostream>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<fstream>
#include<queue>
using namespace std;
void ll(){
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(0);
}
int main()
{
	ll();

	priority_queue<int>pq;
	int arr[1000];
	int n, k, sum = 0;
	cin >> n >> k;
	for (int i = 0; i<n; i++)
	{
		cin >> arr[i];
		pq.push(arr[i]);
	}
	while (k--)
	{
		sum += pq.top();
		pq.pop();
	}
	cout << sum << endl;
}

Measured memory_bytes: 3648
s=list(input())
t=list(input())
flag=False
count=0
while count!=len(s):
    a=s[-1]
    del s[-1]
    s.insert(0,a)
    if s==t:
        flag=True
        break
    count+=1
if flag:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
long long arr[1000000];
int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);   
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    long long i,j,k,x,d,n,y,z;
    cin>>x>>k>>d;
    if (x<0)
    {
    	x=x*(-1);
	}
	z=x;
	y=k;
	x/=d;
	k=k-x;
	if (k<=0)
	{
		cout<<z-d*y<<endl;
	}
	else if (k%2==0)
	{
		cout<<z%d<<endl;
	}
	else
	{
		cout<<d-z%d<<endl;
	}
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using vec = vector<int>;
using intk = int64_t;

int main() {
int s;
  cin >>s;
  bool f =true;
  int i=1;
  vec q = {s} ;
  while(f){
if(s%2==0){
 s /= 2;
  i++;
}
    else{
     s = s * 3 +1; 
      i++;
    }
    for(int j=0;j<i-1;j++){
      if(q[j] == s) f = false;
    }
    q.push_back(s);
  }
  cout << i <<endl;
}
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string> 
using namespace std;
int main(){
  double R;
  cin >> R;
  double PI = 3.141592653589793238;
  double S = R*R*PI;
  double V = 2*R*PI;
  cout << fixed << setprecision(6) << S << " " << fixed << setprecision(6) << V << endl;
}


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

using namespace std;
using ll = long long;

int main()
{
    int n;
    cin >> n;
    int ans = 0;

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

}

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

int a[3][3];

void bingo(int x){
    rep(i, 3){
        rep(j, 3){
            if(a[i][j] == x) a[i][j] = 0;
        }
    }
}

bool judge(){
    int cnt = 0;
    rep(i, 3){
        cnt = 0;
        rep(j, 3){
            cnt += a[i][j];
            
        }
        if(cnt == 0) return true;
    }
    rep(i, 3){
        cnt = 0;
        rep(j, 3){
            cnt += a[j][i];
        }
        if(cnt == 0) return true;
    }
    cnt = 0;
        
    rep(i, 3){
       cnt += a[i][i]; 
    }
    if(cnt == 0) return true;
    cnt = 0;
    rep(i, 3){
        cnt += a[2-i][i];
    }
    if(cnt == 0) return true;
    return false;
}

int main(){
    
    int n;
    rep(i, 3){
        rep(j, 3){
            cin >> a[i][j];
        }
    }
    cin >> n;
    rep(i, n){
        int b;
        cin >>b;
        bingo(b);
    }

    if(judge()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
import itertools
import numpy as np

n, m, x = map(int, input().split())
san = []
for i in range(n):
    san.append(list(map(int, input().split())))

result = []
adds = []
for j in range(1,n+1):
     for conb in itertools.combinations(san, j):
        result.append(list(conb)) #タプルをリスト型に変換

for i in result:
    t = np.zeros([m+1], dtype=int)
    for j in i:
        t = t + np.array(j)

    adds.append(t)

price = -1
ans = 0
for num, i in enumerate(adds):
    use = True
    for j in range(1,m+1):
        if i[j] < x:
            # print(i)
            use = False
            break

    if use:
        # print(i)
        # print(result[num])
        if price == -1 or price > i[0]:
        # if price > i[0]:
            price = i[0]
            ans = num

print(price)


Measured memory_bytes: 28260
using System;
public class Add {
    public static void Main() {
        int N = int.Parse(Console.ReadLine());
        string[] read = new string[N];
        read = Console.ReadLine().Split(' ');
        int odd = 0;
        int even = 0;
        for (int i = 0; i < N; i++) {
            if (int.Parse(read[i]) % 2 == 0) {
                even++;
            } else {
                odd++;
            }
        }
        even += odd / 2;
        odd = odd % 2;
        string outp = "";
        if (odd == 1) {
            if (even == 0) {
                outp = "YES";
            } else {
                outp = "NO";
            }
        } else {
            outp = "YES";
        }
        Console.WriteLine(outp);
    }
}

Measured memory_bytes: 12504
#include<stdio.h>
int max(int a,int b){
    if(a<b)
    return b;
    else
    {
        return a;
    }
    
}
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int count=0;
    int temp=0;
    for(int i=0;i<n-1;i++){
        if(a[i]>=a[i+1]){
            count++;
        }
        temp=max(count,temp);
        if(a[i]<a[i+1]){
            count=0;
        }
    }
    printf("%d",temp);
}

Measured memory_bytes: 2112
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    ll N;
    cin >> N;
    vector<Pll> Ps(N);
    for(int i=0;i<N;i++){
        cin >> Ps[i].second >> Ps[i].first;
    }
    sort(Ps.begin(),Ps.end());
    ll sum=0;
    for(int i=0;i<N;i++){
        sum+=Ps[i].second;
        if(sum>Ps[i].first){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(), v.end()

int main(){
  bool ans = true;
  string a;
  cin >> a;
  int n = a.size();
  int c2 = (n + 3) / 2 - 1;
  string c = a.substr(c2);
  string a1 = a;
  reverse(all(a1));
  if(a!=a1){
    ans = false;
  }
  int b2 = (n - 1) / 2;
  string b = a.erase(b2);
  string b1 = b;
  reverse(all(b1));
  if(b!=b){
    ans = false;
  }
  string c1 = c;
  reverse(all(c1));
  if(c!=c1){
    ans = false;
  }
  if(ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
}

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

ll gcd(ll m, ll n){
    ll tmp;
    while(m%n != 0){
        tmp = n;
        n = m % n;
        m = tmp;
    }
    return n;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    ll e = b - a + 1;
    ll f = b/d - (a/d - (a%d==0));
    ll g = b/c - (a/c - (a%c==0));
    ll lcm = d*c/gcd(d,c);
    ll h = b/lcm - (a/lcm - (a%lcm==0));

    cout << e - f - g + h << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/
int vector_finder(std::vector<string> vec, string str) {
	auto itr = std::find(vec.begin(), vec.end(), str);
	size_t index = std::distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}

int main()
{
	string s;
	int pos;
	vector<string> v;

	cin >> s;
	cin >> pos;

	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < s.size(); j++) {
			if (s[j] == 'a' + i) {
				for (int k = 1; k <= 5; k++) {
					if (j + k - 1 < s.size()) {
						string str=s.substr(j, k);
						if(!(vector_finder(v,str))){
							v.push_back(str);
						}
					}
				}
			}
		}
		sort(v.begin(), v.end());
		if (v.size() >= pos) {
			break;
		}
	}
	cout << v[pos-1] << endl;


	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
using namespace std;
const int maxn = 3100;
ld p[maxn];
int n;

ld dp[maxn][maxn];

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>p[i];
	}

	dp[0][0] = 1.00;
	for(int i=1;i<=n;i++) {
		for(int j=0;j<=n;j++) {
			// ss prvi i, da ima tachno j nagore
			dp[i][j] = dp[i-1][j] * (1.0-p[i]) + dp[i-1][j-1] * p[i];
		}
	}

	ld result = 0.0;
	for(int i=0;i<=n;i++) {
		if(i > (n - i)) result += dp[n][i];
	}
	cout<<fixed<<setprecision(10)<<result<<"\n";
}

Measured memory_bytes: 145664
#include <iostream>
using namespace std;
int main(void){
  int A,B;
  cin >> A >> B;
  
  bool exist = false;
  int ans = 0;
  
  for(int i=1;i<20000;i++){
    if(i / 10 == B && i * 8 / 100 == A){
      ans = i;
      exist = true;
    }
    if(exist) break;
  }
  
  if(exist) cout << ans << endl;
  else cout << -1 << endl;
  
  return 0;
}


Measured memory_bytes: 256
#ALDS1_2_B:   Selection Sort

def selectionSort(A, n):
    res = 0
    for i in range(n):
        minj = i
        for j in range(i, n):
            if A[j] < A[minj]:
                minj = j
                
        if A[i] != A[minj]:
            A[i], A[minj] = A[minj], A[i]        
            res += 1
        
    return A, res

n = int(input())
l = list(map(int, input().split()))
res_l, res = selectionSort(l, n)
print(*res_l)
print(res)


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

#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;
const long long MOD = 1000000007;
int main()
{
    string S;
    cin >> S;

    int len = (int)S.size();

    vector<vector<ll>> dp(len + 1, vector<ll>(13, 0));
    dp[0][0] = 1;
    
    rep(i, len) {
        int st = -1;
        if (S[i] != '?') {
            st = S[i] - '0';
        }
        rep(j, 10) {
            if (st != -1 && st != j) continue;
            rep(k, 13) {
                dp[i + 1][(k * 10 + j) % 13] += dp[i][k];
            }
        }
        rep(j, 13) {
            dp[i + 1][j] %= MOD;
        }
    }

    cout << dp[len][5] << endl;
    return 0;
}

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

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

    std::vector<long long> reminds(13, 0);
    reminds[0] = 1;

    std::reverse(s.begin(), s.end());

    const int mod = 1000000007;
    int pos = 1;
    for (auto c : s) {
        std::vector<long long> new_reminds(13, 0);
        if (c == '?') {
            for (int i = 0; i < 10; i++) {
                for (int j = 0; j < 13; j++) {
                    new_reminds[(i * pos + j) % 13] += reminds[j];
                    new_reminds[(i * pos + j) % 13] %= mod;
                }
            }
        } else {
            int i = c - '0';
            for (int j = 0; j < 13; j++) {
                new_reminds[(i * pos + j) % 13] += reminds[j];
                new_reminds[(i * pos + j) % 13] %= mod;
            }
        }

        pos *= 10;
        pos %= 13;
        reminds = new_reminds;
    }

    std::cout << reminds[5] << std::endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n, m;
    ll a[100005] = {}, b[100005] = {}, c = 0, d = 0, e = 0, f = 0;
    cin >> n >> m;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < m; i++) cin >> b[i];
    for (int i = 0; i < n; i++) c = (c + i * a[i] - e) % mod, e += a[i];
    for (int i = 0; i < m; i++) d = (d + i * b[i] - f) % mod, f += b[i];
    cout << c * d % mod;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define forn(i, n)             for(int i = 0; i < n; i ++)
#define forn1(i, n)            for(int i = 1; i <= n; i ++)
#define pb push_back
#define ll long long int
#define fi first
#define se second
#define ii  pair<long long int, long long int>
#define vi  vector <long long int>
#define vii vector <pair <long long int, long long int > >
#define all(cont)  cont.begin(), cont.end()
#define EPS 1e-9
#define MOD 1000000007
#define range 
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#pragma GCC optimize ("Ofast")

multiset <int > max_set, other_set;
int max1, other;
int n;
int a[1<<18];

int main(){

   // freopen("input.txt","r",stdin);
    IOS;
    clock_t clk = clock();
    cin>>n;

    forn(i, (1<<n)) cin>> a[i];
    
    sort(a, a + (1 << n));
    other = a[(1<<n) - 1];
    other_set.insert(n);
    bool pos = true;
    for(int i = (1<<n) - 2 ; i >= 0 ; i --){
    	if(other > a[i]){
    		max1 = other;
    		other = 0;
    		for(int val : other_set) max_set.insert(val);
   			other_set.clear();
    	}
    	if(max_set.size() == 0){
    		pos = false;
    		break;
    	}

    	auto ptr = max_set.rbegin();

    	other = a[i];
    	int x = *ptr;
    	max_set.erase(max_set.lower_bound(*ptr));
    	x--;
    	if(x){
    		other_set.insert(x);
    		max_set.insert(x);
    	}
    }
    if(pos) cout<<"Yes";
    else cout<<"No";


    cerr << endl << setprecision(10) << fixed << (double)(clock() - clk) / CLOCKS_PER_SEC;
    return 0;
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N,M,X;
    cin >> N >> M >> X;
    int A[M];
    for (int i = 0; i < M ; i++){
        cin >> A[i];
    }
    int left = 0;
    left = lower_bound(A, A + M, X) - A;
    int right = 0;
    right = M - left;
    printf("%d\n", min(left,right));

}

Measured memory_bytes: 256
A,B,C,X,Y=map(int,input().split())
if A+B<=2*C:
  print(X*A+Y*B)
else:
  if X<=Y:
    print(min(2*Y*C,2*X*C+(Y-X)*B))
  else:
    print(min(2*X*C,(X-Y)*A+2*Y*C))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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 (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N + 1), B(N);
    for (int i = 0; i < N + 1; i++) {
        cin >> A.at(i);
    }
    for (int i = 0; i < N; i++) {
        cin >> B.at(i);
    }

    ll sum = 0;
    for (int i = 0; i < N; i++) {
        if (B[i] <= A[i]) {
            sum += B[i];
        } else if (B[i] <= A[i] + A[i + 1]) {
            sum += B[i];
            B[i] -= A[i];
            A[i + 1] -= B[i];
        } else {
            sum += A[i] + A[i + 1];
            A[i + 1] = 0;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    int N,A;
    cin >> N;
    
    bool OK=true;
    for(int i=0;i<N;i++) {
        cin >>A;
        if(A%2==0){
            if(A%3!=0&&A%5!=0) {
                OK=false;
            }
        }
    }
    if(OK==true) {
        cout << "APPROVED" << endl;
    }
    else {
        cout << "DENIED" << endl;
    }
    
}


Measured memory_bytes: 3604
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
  string s;
  cin>>s;
  while(s.length()>0){
    s.erase(s.end()-1, s.end());
    string a=s.substr(0, s.length()/2);
    string b=s.substr(s.length()/2);
    if(a==b)
      break;
  }
  cout<<s.length()<<endl;
  return 0;
}

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

const int N = 2e5 + 10;
typedef long long ll;
int n, fa[N], vis[N], p[N];
ll ans, f[N], sum1[N], sum0[N];
struct node {
    int x, s0, s1;
    /*bool operator > (const node& a) const {
        return 1ll * s1 * a.s0 > 1ll * s0 * a.s1;
        // return 1ll * s1 * a.s0 == 1ll * s0 * a.s1 ? s0 > a.s0 : 1ll * s1 * a.s0 > 1ll * s0 * a.s1;
    }*/
    bool operator < (const node& a) const {
        return 1ll * s1 * a.s0 > 1ll * s0 * a.s1;
        // return 1ll * s0 * a.s1 == 1ll * s1 * a.s0 ? s0 < a.s0 : 1ll * s0 * a.s1 < 1ll * s1 * a.s0;
    }
};
// priority_queue<node, vector<node>, greater<node> > q;
priority_queue<node> q;

int getfa(int x) {
    return fa[x] == x ? x : fa[x] = getfa(fa[x]);
}

void merge(int x, int y) {
    x = getfa(x), y = getfa(y);
    if (x == y) return;
    fa[x] = y;
}

int main() {
    cin >> n;
    rep(i, 1, n) fa[i] = i;
    rep(i, 2, n) scanf("%d", &p[i]);
    rep(i, 1, n) {
        int x; scanf("%d", &x);
        if (!x) {
            sum0[i] = 1;
            q.push((node){i, 1, 0});
        } else {
            sum1[i] = 1;
            q.push((node){i, 0, 1});
        }
    }
    vis[0] = 1;
    int s1 = 0;
    while (q.size()) {
        node t = q.top(); q.pop();
        if (vis[t.x] || t.s1 != sum1[t.x] || t.s0 != sum0[t.x]) continue;
        int x = t.x;
        vis[x] = 1;
        if (vis[getfa(p[x])]) {
            ans += f[x] + 1ll * s1 * sum0[x];
            s1 += sum1[x];
        } else {
            int y = getfa(p[x]);
            f[y] += f[x] + 1ll * sum1[y] * sum0[x];
            sum0[y] += sum0[x];
            sum1[y] += sum1[x];
            q.push((node){y, sum0[y], sum1[y]});
            merge(x, y);
        }
    }
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 13308
#include <iostream>
#include <string>

int main(){
  std::string s;
  long long ans = 0, j = 0;
  
  std::cin>>s;
  
  for(int k = 0; (k = s.find("BC", k)) != std::string::npos;){
    s.replace(k, 2, "D");
  }
  
  for(int i = 0; 0 <= i && i < s.length(); i++){
    if(s[i] == 'A')j++;
    else if(s[i] == 'D')ans += j;
    else j = 0;
  }
  
  std::cout<<ans;
  
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)
const ll INF = 1LL << 60;

int main(){
    int a,b,c,x,y;
    cin >> a >> b >> c >> x >> y;
    vector<ll> p(max(x,y)+1);
    for (int i=0;i <= max(x,y);i++){
        p[i]=2*i*c;
    }
    ll ans=INF;
    for (int i=0;i <= max(x,y);i++){
        ll tmp;
        if (x-i < 0) tmp=(y-i)*b+p[i];
        else if (y-i < 0) tmp=(x-i)*a+p[i];
        else tmp=(x-i)*a+(y-i)*b+p[i];
        ans=min(ans,tmp);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String K = sc.nextLine().replace(" ", "");
        Integer k = Integer.valueOf(K);
        String[] numbers = sc.nextLine().split(" ", 0);
        List<Integer> numbersList = new ArrayList<>();
        for (String n: numbers){
            Integer num = Integer.valueOf(n);
            numbersList.add(num);
        }

        int result = 0;
        int remain ;
        remain = N -k;
        result++;
        if(N==k){
            System.out.println(1);
        }else {
            while (remain >0) {
                remain -= k-1;
                result++;
            }
            System.out.println(result);
        }
    }
}


Measured memory_bytes: 50004
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
 
int main() {

    int x;
    cin >> x;

    if(x)   cout<<0<<endl;
    else    cout<<1<<endl;

 return 0;
}


Measured memory_bytes: 3552
use strict;
use List::Util;
sub func {
  my($k) = shift;
  my($x) = shift;

  my(@a) = ($x-$k+1)..($x+$k-1);
  print "@a";
}

if ($0 eq __FILE__) {
  my($k, $x) = split(" ", <STDIN>);
  func($k, $x);
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
   
using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
 
template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
   
int gcd(int a,int b){ return b ? gcd(b,a % b) : a;}
int lcm(int a,int b){ return a / gcd(a,b) * b;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k,x = 0,res = 0;
    cin >> n >> k;

    vector<int> a(n),cnt(64);
    rep(i,n){
        cin >> a[i];
        if(k == 0) res += 0 ^ a[i];
        int tmp = a[i];
        for(int i = 0;tmp;++i){
            cnt[i] += tmp & 1;
            tmp >>= 1;
        }
    }
    if(k == 0) return cout << res << '\n',0;
    for(int i = 40;i >= 0;--i){
        if(n - cnt[i] > cnt[i] && k >= x + (1ll << i)){
            x |= 1ll << i;
        }
    }
    rep(i,n){
        res += x ^ a[i];
    }
    cout << res << '\n';
    return 0;
}
    

Measured memory_bytes: 1024
from collections import Counter
N = int(input())
D = Counter(list(map(int, input().split())))
M = int(input())
T = Counter(list(map(int, input().split())))
ans = True
for key, value in T.items():
    if D[key] < value:
        ans = False
        break

if ans:
    print('YES')
else:
    print('NO')
    

Measured memory_bytes: 55264
#include<bits/stdc++.h>
using namespace std;
const int N=200010;
int n;
int a[N];
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;++i) scanf("%d",&a[i]);
	sort(a,a+n);
	for(int i=0;i<n;++i){
		if(i==n-1){
			printf("YES\n");
			break;
		}
		if(a[i]==a[i+1]){
			printf("NO\n");
			break;
		}
	}
	return 0;
}

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

#define rep(i, j, n) for(int i=j;i<n;++i)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.end()
#define inf 1e9
#define Puts(x) puts(x? "YES":"NO")
const int mod = 1e9 + 7;

typedef pair<int, int> pi;
typedef long long i64;

template <class T = int> using vt = vector<T>;
template <class T = int> using vvt = vector<vector<T>>;

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

  int n;
  cin >> n;
  if(n == 1) cout << "Hello World\n";
  else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
#define  MP make_pair
#define  PB push_back
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n;
    cin >> n;
    vector<int>v(n);
    vector<bool>flag(n,1);
    vector<bool>y(n);
    vector<pair<int,int> > p;
    rep(i,n){
        char c;
        int a;
        cin >> c >> a;
        if(c=='y'){
            y[i] = 1;
        }
        v[i] = a;
        if(c=='y')p.PB(MP(v[i],i));
    }
    sort(p.begin(),p.end());
    int ans = 0;
    rep(i,p.size()){
        int ind = p[i].second;
        int l=ind,r=ind;
        int h = p[i].first;
        if(!flag[ind])continue;
        ans++;
        for(int k = ind+1;k<n;k++){
            if(!y[k]){
                if(h<=v[k]){
                    break;
                }
            }
            r = k;
        }
        for(int k = ind-1;k>=0;k--){
            if(!y[k]){
                if(h<=v[k]){
                    break;
                }
            }
            l = k;
        }
        for(int k=l;k<=r;k++){
            flag[k] = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3128
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;

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

    if(a < c && c < b) {
        cout << "Yes" << endl;
        return 0;
    }

    if (a > c && c > b) {
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <cmath>
 
using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define EPS (1e-15)
typedef long long int ll;

int main(){
    int a, b = 0;
    cin >> a ;
    b = a + a*a + a*a*a;
    cout << b << endl;
    
}

Measured memory_bytes: 3512
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    ll n, l;
    cin >> n >> l;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    pair<ll,ll> center ={-1, -1};
    rep(i, n - 1){
        if(a[i] + a[i + 1] >= l){
            center = {i, i + 1};
        }
    }

    if(center == make_pair(-1LL, -1LL)){
        cout << "Impossible" << endl;
        return 0;
    }
    vector<ll> ans;
    rep(i, center.first){
        ans.push_back(i + 1);
    }

    for(ll i = n - 1; i >= center.second; i--){
        ans.push_back(i);
    }
    cout << "Possible" << endl;
    rep(i, ans.size()) cout << ans[i] << endl;

}

Measured memory_bytes: 5108
#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;

int main()
{
	int a,b;
	cin>>a>>b;
	if(a*b%2==0) printf("Even\n");
	else
		printf("Odd\n");
	return 0;
}

Measured memory_bytes: 764