akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;


int main(){
    int N=0,A=0,B=0,C=0,D=0;
    string str;
    int count = 0;
    int ans=0;
    bool check=true,CC=false;


    cin>>str;

    if(str[0]=='A'){
        for(int i=1;i<str.size();i++){
            
            if(str[i]=='C'&&1<i&&i<str.size()-1){
                if(CC){
                check=false;
                }else{
                    CC=true;
                }
            }

            else if(str[i]<'a'||'z'<str[i]){
                check=false;

            }
        }
    }

if(check&&CC){
    cout<<"AC"<<endl;
}else{
    cout<<"WA"<<endl;
}





}


Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/
const int MAXN = 210000;

int n;
int p[MAXN];
int pos[MAXN];

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> p[i];
		--p[i];
		pos[p[i]] = i;
	}
	int ans = 0;
	int lst = n - 1;
	for (int i = n - 2; i >= 0; --i) {
		if (ans == 0) {
			if (pos[i] > pos[i + 1]) {
				lst = i + 1;
				++ans;
			}
		}
		else {
			int a = pos[lst];
			int b = pos[i];
			int c = pos[i + 1];
			if ((a < b && b < c) || (c < a && a < b) || (b < c && c < a)) {
				continue;
			}
			else {
				++ans;
				lst = i + 1;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}




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

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> s(h);
    for(int i=0;i<h;i++) cin>>s[i];

    vector<vector<int>> token(h-1,vector<int>(w-1,0));
    for(int i=0;i<h-1;i++){
        for(int j=0;j<w-1;j++){
            token[i][j]=s[i][j]^s[i][j+1]^s[i+1][j]^s[i+1][j+1];
        }
    }
    vector<vector<int>> height(h,vector<int>(w,0));
    for(int i=0;i<w-1;i++) height[0][i]=1;
    for(int i=0;i<h-1;i++){
        for(int j=0;j<w-1;j++){
            if(token[i][j]) height[i+1][j]=1;
            else height[i+1][j]=height[i][j]+1;
        }
    }
    int res=h;
    for(int i=0;i<h;i++){
        stack<pair<int,int>> st;
        st.push({0,-1});
        for(int j=0;j<w;j++){
            pair<int,int> ret;
            while(ret=st.top(),height[i][j]<ret.first){
                st.pop();
                int lef=st.top().second;
                int size=(j-lef)*ret.first;
                res=max(res,size);
            }
            st.push({height[i][j],j});
        }
    }
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 35712
#include<bits/stdc++.h>
#define pdd              pair<double, double>
#define ll               long long
#define mod              1000000007
#define endl              "\n"
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
ll factorial(ll n)
{
    return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
ll lcm(ll a, ll b)
 {
    return (a*b)/gcd(a, b);
 }
bool sortByVal(const pair<int, int> &a,
               const pair<int, int> &b)
{
    return (a.second < b.second);
}
ll Powb(ll b,ll n)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2);
    if(n%2==0){return (temp*temp)%mod;}
    else{return (b*((temp*temp)%mod))%mod;}
}
int main()
{
    fast;
    ll i,j,n,c=0,d=0,e=0,f=0,m,sum=0;
    cin>>n>>m;
    c=n*(n-1);
    sum+=(c/2);
    d=m*(m-1);
    sum+=(d/2);
  cout<<sum;
}


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

# assert N % 2 == 1
x_sum = sum(As)
x_n = x_sum - sum(As[0::2][:-1]) * 2
Xs = list()
for i in range(N):
    if i == 0:
        Xs.append(x_n)
    else:
        x = 2 * As[N - i - 1] - Xs[-1]
        Xs.append(x)

Xs = reversed(Xs)
print(' '.join(map(str, Xs)))

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

int main(){

  string n;
  int a;

  cin>>n;
  a=stoi(n);

  int sum=0;
  for(int i=0;i<n.size();i++) sum+=n[i]-'0';

  if(a%sum==0) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<cmath>
#include<map>
#include<functional>
#include<queue>
#include<set>
#include<stack>
#include<iomanip>
#include<algorithm>
#include<unordered_map>
#include <numeric>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0;i<(n);i++)
template<typename T =ll> using v = vector<T>;
template<typename T =ll> using vv = v<v<T>>;
template<typename T =ll,typename U =ll> using p = pair<T,U>;
template<typename T> T chmin(T &a,T b) {return a=min(a,b);}
template<typename T> T chmax(T &a,T b) {return a=max(a,b);}
const ll INF = (ll)1e9;
template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

void a(){
    ll N; cin >> N;
    if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9) cout << "hon" << endl;
    else if(N%10==0||N%10==1||N%10==6||N%10==8)cout << "pon"<<endl;
    else cout << "bon"<<endl;
}
void b(){
}

void c(){
}

void d(){
}
void e(){
}
void f(){}
int main(){
    a();
    return 0;
}


Measured memory_bytes: 3632
<?php
list($_s) = strs();
list($t) = strs();
$len_s = strlen($_s);
$len_t = strlen($t);
for ($i = $len_s - $len_t; $i >= 0; --$i) {
    $_sub = substr($_s, $i, $len_s);
    $flag = true;
    for ($j = 0; $j < $len_t; ++$j) {
        if ($_sub[$j] !== '?' && $_sub[$j] !== $t[$j]) {
            $flag = false;
            break;
        }
    }
    if ($flag) {
        $_s = substr_replace($_s, $t, $i, $len_t);
        $_s = str_replace('?', 'a', $_s);
        echo $_s;
        exit;
    }
}
echo 'UNRESTORABLE';
function strs()
{
    return explode(' ', trim(fgets(STDIN)));
}


Measured memory_bytes: 4856
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;

int main(){
	while(1){
		int n;
		cin >> n;
		if(n==0) break;
		
		vector<int> M(n, 0);
		vector<lli> L(n);
		for(int i=0; i<n; i++){
			int num;
			cin >> num >> L[i];
			for(int j=0; j<num; j++){
				int s,e;
				cin >> s >> e;
				s-=6; e-=6;
				for(int k=s; k<e; k++){
					M[i] |= (1<<k);
				}
			}
		}
		
		vector<lli> dp(1<<16, 0);
		for(int i=0; i<n; i++){
			for(int j=0; j<(int)dp.size(); j++){
				if((j & M[i]) == M[i]){
					if(dp[j^M[i]] +L[i] > dp[j]){
						dp[j] = dp[j^M[i]] +L[i];
					}
				}
			}
		}
		
		lli ans=0;
		for(int j=0; j<(int)dp.size(); j++){
			ans = max(dp[j], ans);
		}
		cout << ans << endl;
	}
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    for (int i = 0; i < n; i++)
    {
        cin >> s[i];
    }

    int ac = 0, wa = 0, tle = 0, re = 0;
    for (int j = 0; j < n; j++)
    {
        if (s[j] == "AC")
            ac++;
        else if (s[j] == "WA")
            wa++;
        else if (s[j] == "TLE")
            tle++;
        else if (s[j] == "RE")
            re++;
    }

    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}

Measured memory_bytes: 6424
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int a, b, c, k;
    cin >> a >> b >> c >> k;

    if (k <= a+b)
        cout << min(a, k) << "\n";
    else
        cout << a - (k-a-b) << "\n";
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#if 1
#define int long long
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define stoi stoll
#else
#define MAX INT_MAX
#define MIN INT_MIN
#endif
#define ALL(obj) (obj).begin(), (obj).end()
#define fi first
#define se second
const int NIL = -1;
const int MOD = 1000000007;
#define REP(i,n) for (int i=0; i < (n); ++i)
#define FOR(i,a,b) for (int i=(a); i < (b); ++i)
using namespace std;

int pow(int x, int n) {int res=1; while(n){if(n&1)res*=x;x*=x;n>>=1;} return res;}
int get_gcd(int a, int b){while(1){if (a < b) swap(a, b); if (b == 0) return a; a %= b;}}
int get_lcm(int a, int b){return a * b / get_gcd(a, b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//-------------------------テンプレここまで-------------------------//

#define N 50001
int dp[N]; //i円支払うときの最小枚数

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

  int n, m;
  cin >> n >> m;
  vector<int> c(m);
  REP(i,m) cin >> c[i];

  fill_n((int*)dp, N, MAX);
  dp[0] = 0;

  REP(i,N) {
    REP(j,m) {
      if (i+c[j] < N) {
        dp[i+c[j]] = min(dp[i+c[j]], dp[i] + 1);
      }
    }
  }

  cout << dp[n] << endl;

  return 0;
}



Measured memory_bytes: 3556
#include<bits/stdc++.h>
#include<iostream>
#define ll long long 
#define ld long double
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define sz(v) sizeof(v)
#define MOD 1000000007
#define MAX (ll)1e12+5


using namespace std;


int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
//////
// prime Seive
/*
bitset<1000005> bt;
//unordered_map<ll,bool> is_prime;
vector<ll> primes;
void pS(ll n){
    ll val = min(n+1,(ll)1000006);
    for(ll i=3;i<=val;i+=2){
        bt[i] =true;
    }
    bt[0] =false;
    bt[1] =false;
    bt[2] =false;
    //is_prime[2] =true;
    primes.pb((ll)2);
    for(ll i=3;i<=val;i+=2){
        if(bt[i])
            for(ll j=i*i;j<=val;j+=2*i)
                bt[j] =false;
    }
    for(ll i=3;i<=val;i+=2){
        if(bt[i]){primes.pb(i);
        //is_prime[i]=true;
        //cout<<i<<" :PRIME\n";
        }
    }
    return;
}
*/          
/////
// Fenwick Tree
/*
BIT[200005] ={0};
//BUILD BIT
// for(int i=1;i<1;i++){ cin>>a[i];update(i,a[i],n);};
 
void update(int i,int val,int n){
    while(i<=n){
    BIT[i]+= inc;
    i+= (i&(-i));
    }
}
ll query(int i){
    ll ans =0;
    while(i>0){
        ans+= BIT[i];
        i-=(i&(-i));
    }
    return ans;
}
 
*/
//__builtin_popcount(4)
ll logPow(ll a,ll b){
    ll ans=1;
    while(b>0){
        if(b&1){
            ans*=a;
        }
        a*=a;
        b= b>>1;
    }
    return ans;
}

ll gcd(ll a,ll b){
    return b==0?a:gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return (a*b)/gcd(a,b);
}



/*
// dsu
const int N = 500009;
int p[N],cmp[N];
int getP(int cn){
    return ((cn==p[cn])?cn:(p[cn]=getP(p[cn])));
}

void unite(int a,int b){
    a = getP(a);
    b = getP(b);
    if(a==b) return ;
    if(cmp[a]<cmp[b])
        swap(a,b);
    p[b] = a;
    cmp[a] += cmp[b];
}
*/

/*
//dfs
bool dfs(ll src ,ll dest,unordered_map<ll,bool> &vis,unordered_map<ll,vector<ll>> &g){
    vis[src] =true;
    if(src== dest) return true;
    bool  ans =false;
    for(auto nbr: g[src]){
        if(!vis[nbr])
            ans = ans|dfs(nbr,dest,vis,g);
    }
    return ans;
}

*/
// bfs
/*
ll bfs(ll i,unordered_map<ll,bool> &vis){
    queue<ll> q;q.push(i);vis[i] =true;ll ans =0;
    while(!q.empty()){
        ans++;ll cur = q.front();q.pop();
        for(auto nbr: g[cur]){
            if(!vis[nbr]){
                vis[nbr] =true;q.push(nbr);
    }}}
    return ans;
}
*/

unordered_map<ll,vector<ll>> g;

ll modPow(ll a,ll b){
    ll ans =1;
    while(b>0){
        if(b&1){
            ans*=a;
            ans= (ans+MOD)%MOD;
        }
        a*=a;
        a= (a+MOD)%MOD;
        b = b>>1;
    }
    return  ans;
}


int main(){
    ll t=1; 
    //cin>>t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    while(t--){
        int ans=0,n;
        cin>>n;
        string balls; cin>>balls;
        int r=0;
        for(auto it: balls) if(it=='R') r++;
        if(r==n || r==0){
            cout<<"0\n";
        }
        else{
            int cnt =0;
            for(int i=0;i<r;i++){
                if(balls[i]=='R') cnt++;
            }
            cout<<r-cnt<<"\n";
        }
        
    }
    return 0;
}

Measured memory_bytes: 3712
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
char s[200050];
int cnt[200050][26],f[1<<26],n,i,j;
int main()
{
	scanf("%s",s);n=strlen(s);cnt[0][s[0]-'a']=1;
	for (i=1;i<n;i++)
	for (j=0;j<26;j++) if (s[i]-'a'==j) cnt[i][j]=cnt[i-1][j]^1;else cnt[i][j]=cnt[i-1][j];
	memset(f,0x7f,sizeof(f));f[0]=0;
	for (i=0;i<n;i++){
		int x=0;
		for (j=0;j<26;j++) x=(x<<1)|cnt[i][j];
		int jb=f[x]+1;
		for (j=0;j<26;j++) jb=min(jb,f[x^(1<<j)]+1);
		if (i==n-1) printf("%d\n",jb);
		f[x]=min(f[x],jb);
	}
	return 0;
}

Measured memory_bytes: 282880
#include <iostream>
using namespace std;
int main()
{
    int A, B;
    cin >> A >> B;
    while (A >= 0 && A <= 100 && B >= 2 && B <= 1000)
    {
        if (B % 2 == 0)
        {
            if (A >= 13) 
            {
                cout << B << endl;
                break;
            }
                
            else if (A<=12&&A>=6)
            {
                cout << B / 2 << endl;
                break;
            }
            else if (A<=5)
            {
                cout << "0\n";
                break;
            }    
        }
        else
        {
            cin>> B;
            continue;
        }
    }

    return 0;
}


Measured memory_bytes: 256
K=int(input())
if K<10:
  print(K);exit()
def dfs(v,n):
  u=[]
  for x in v:
    for d in [-1,0,1]:
      if(0<=x%10+d<=9):
        u.append(x*10+x%10+d)
  if(n+len(u)>=K):
    u.sort()
    print(u[K-n-1])
  else:
    dfs(u,n+len(u))
dfs(range(1,10),9);

Measured memory_bytes: 11700
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;

LL inf = 1000000000000;
LL mod = 1000000007;

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

	if (c > a+b) {
		if (c*c + a*a + b*b - 2*a*b - 2*a*c - 2 *b*c > 0) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}
	else {
		cout << "No\n";
	}
}

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

const int M = 1e6 + 7;
int a[M];

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    int n;
    cin >> n;

    for(int i = 0; i < n; i++)
        cin >> a[i];

    int res = 0;
    for(int i = 1; i < n; i++){
        if(a[i - 1] == a[i]){
            res++;
            i++;
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count=0

for i in range(n):
    if b[i]<=a[i]:
        count+=b[i]
    elif b[i]>a[i]:
        count+=a[i]
        b[i]-=a[i]
        if b[i]<=a[i+1]:
            a[i+1]-=b[i]
            count+=b[i]
        elif b[i]>a[i+1]:
            count+=a[i+1]
            a[i+1]=0
print(count)

Measured memory_bytes: 18752
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

int main()
{
    ll n;
    cin >> n;
    ll a[1001], t[1001];
    for(int i = 0; i < n; i++){
        cin >> a[i] >> t[i];
    }
    for(int i = 1; i < n; i++){
        if(a[i] < a[i - 1] || t[i] < t[i - 1]){
            ll r = max((a[i - 1] - 1) / a[i], (t[i - 1] - 1) / t[i]) + 1;
            a[i] *= r;
            t[i] *= r;
        }
    }
    cout << a[n - 1] + t[n - 1] << endl;
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        v: [i32; n],
    }

    let max_ope = std::cmp::min(n, k);
    let mut get_ball_a = Vec::new();
    let mut get_point_a = 0;
    let mut ans = 0;

    for a in 0..=max_ope {
        let mut get_ball = get_ball_a.clone();
        let mut get_point_b = 0;

        for b in 0..=(max_ope - a) {
            let mut get_point_all = get_point_a + get_point_b;

            if get_ball.len() > 0 {
                get_ball.sort();
                for i in 0..std::cmp::min(k - a - b, get_ball.len()) {
                    if get_ball[i] < 0 {
                        get_point_all -= get_ball[i];
                    } else {
                        break;
                    }
                }
            }
            if ans < get_point_all {
                ans = get_point_all;
            }
            if b < n - 1 {
                get_point_b += v[n - b - 1];
                get_ball.push(v[n - b - 1]);
            }
        }
        if a < n {
            get_point_a += v[a];
            get_ball_a.push(v[a]);
        }
    }

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

Measured memory_bytes: 2160
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
 
char ma[105][105];
int vis[105][105];
int ans;int w,h;
 
int dx[]={1,0,0,-1};
int dy[]={0,-1,1,0};
 
void dfs(int x,int y,char ch)
{
    if(vis[x][y]) return ;
    vis[x][y]=1;
    for(int i=0;i<4;i++)
    {
        int xx=x+dx[i];
        int yy=y+dy[i];
        if(xx>=0&&xx<w&&yy>=0&&yy<h&&ma[xx][yy]==ch)
        dfs(xx,yy,ma[xx][yy]);
    }
}
 
 
int main()
{
 
    while(scanf("%d%d",&w,&h)&&w!=0)
    {
        memset(vis,0,sizeof(vis));
        ans=0;
        for(int i=0;i<w;i++)
            scanf("%s",&ma[i]);
 
        for(int i=0;i<w;i++)
        {
            for(int j=0;j<h;j++)
            {
                if(vis[i][j])continue;
                dfs(i,j,ma[i][j]);ans++;
            }
 
 
        }
        printf("%d\n",ans);
 
    }
    return 0;
}


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

struct TCoordinate
{
	double x;
	double y;
};

bool JudgeSameSide(TCoordinate T1, TCoordinate T2, TCoordinate L1, TCoordinate L2)
{
	if(L1.x == L2.x){
		if((T1.x - L1.x) * (T2.x - L2.x) > 0){
			return true;
		}else{
			return false;
		}
	}else{
		if(((L2.x - L1.x) * (T1.y - L1.y) - (L2.y - L1.y) * (T1.x - L1.x)) * ((L2.x - L1.x) * (T2.y - L1.y) - (L2.y - L1.y) * (T2.x - L1.x)) > 0){
			return true;
		}else{
			return false;
		}
	}
}

int main()
{
	bool SameSideFlagA1A2, SameSideFlagA2A3, SameSideFlagA3A1;
	while(true){
		TCoordinate A1, A2, A3, Ap;
		cin >> A1.x >> A1.y >> A2.x >> A2.y >> A3.x >> A3.y >> Ap.x >> Ap.y;
		if(cin.eof() == true) break;
		SameSideFlagA1A2 = JudgeSameSide(A3, Ap, A1, A2);
		SameSideFlagA2A3 = JudgeSameSide(A1, Ap, A2, A3);
		SameSideFlagA3A1 = JudgeSameSide(A2, Ap, A3, A1);
		if(SameSideFlagA1A2 == true && SameSideFlagA2A3 == true && SameSideFlagA3A1 == true){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3192
import math
from functools import reduce

def getD(num):
    input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
    input_list[0] = 0
    bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
    sqrt = int(math.sqrt(num))
    
    for serial in range(3, sqrt + 1, 2):
        if bool_list[serial]:
            for s in range(serial ** 2, num+1, serial):
                if bool_list[s]:
                    input_list[s] = serial
                    bool_list[s] = False
    return input_list

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

D = getD(max(A))

flag = True

d_set = set()
for a in A:
    while a != 1:
        d = D[a]
        if d in d_set:
            flag = False
            break
        else:
            d_set.add(d)
        
        while a % d == 0 and a > 1:
            a = a // d

if flag:
    print('pairwise coprime')
    exit()

if reduce(math.gcd, A) == 1:
    print('setwise coprime')
else:
    print('not coprime')


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

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (ll)(n) - 1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1LL << 62)

#define PI (acos(-1))
#define print(x) cout << x << endl
 
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; }
typedef pair <ll,ll> P;

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

int main()
{
    string S;
    ll K;
    cin >> S >> K;
    string tmp = S;
    ll c1 = 0;
    for(ll i = 0; i < (ll)S.size()-1; ++i) {
        if (tmp[i] == tmp[i+1]) {
            tmp[i+1] = '#';
            c1++;
        }
    }
    tmp = S+S;
    ll c2 = 0;
    for(ll i = 0; i < (ll)tmp.size()-1; ++i) {
        if (tmp[i] == tmp[i+1]) {
            tmp[i+1] = '#';
            c2++;
        }
    }
    tmp = S+S+S;
    ll c3 = 0;
    for(ll i = 0; i < (ll)tmp.size()-1; ++i) {
        if (tmp[i] == tmp[i+1]) {
            tmp[i+1] = '#';
            c3++;
        }
    }
    ll t1 = c2 - c1;
    ll t2 = c3 - c2;
    if (K == 1) {
        print(c1);
    } else {
        ll even = K/2;
        ll odd = (K-1)/2;
        print(c1 + even * t1 + odd * t2);
    }
    return 0;
}

Measured memory_bytes: 256
object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in(0).split(' ').map(_.toInt)
  val A = ls(0)
  val B = ls(1)
  val TA = A * 100 / 8
  val TB = B * 100 / 10
  //println(TB)
  val min = Math.min(TA,TB)
  
  private def func():Int = {
   	(min to 100 * 100 / 8 + 8).foreach{ i =>
    val a = i *  8 / 100
    val b = i * 10 / 100
    if(a==A && b==B) return i  
    }
    return -1
  }
  println(func())
}



Measured memory_bytes: 27352
from itertools import groupby
N,K,Q = map(int,input().split())
Alist = [0 for i in range(Q)]
result = [(K-Q) for i in range(N)]
for i in range(Q):
    Alist[i] = int(input())
newAlist = list([list(g) for k,g in groupby(sorted(Alist))])

for i in range(len(newAlist)):
    result[newAlist[i][0]-1] = result[newAlist[i][0]-1] + len(newAlist[i])
for i in range(N):
    if result[i] > 0:
        print('Yes')
    else:
        print('No')

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using llu = long long unsigned int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    ll D;
    Scd(N); Scll(D);
    D*=D;

    ll x,y;
    int ans = 0;
    Rep(i,N){
        Scll2(x,y);
        ans += (x*x+y*y)<=D;
    }

    printf ("%d\n", ans );

    return 0;
}




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

int main() {
	int n;
	cin >> n;
	long long sum = 0;
	for(int i = 1; i <= n; ++i) {
		if(i % 5 == 0 || i % 3 == 0)
			continue;
		sum += i;
	}
	cout << sum;
}


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

int main() {
  int N ;
  cin >> N ;
  int N2 = N;
  int k=0 ;
  for ( int i = 0; i<8 ; i++ ){
    k += N % 10;
    N = N/10;
  }
  if ( N2 % k == 0 ){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 3600
import sys
sys.setrecursionlimit(100000)

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.root = [-1] * (n + 1)
        self.rnk = [0] * (n + 1)
    def findroot(self, x):
        if (self.root[x] < 0):
            return x
        else:
            self.root[x] = self.findroot(self.root[x])
            return self.root[x]
    def unite(self, x, y):
        x = self.findroot(x)
        y = self.findroot(y)
        if x == y:
            return
        elif self.rnk[x] > self.rnk[y]:
            self.root[x] +=self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1
    def issamegroup(self, x, y):
        return self.findroot(x) == self.findroot(y)
    def count(self, x):
        return -self.root[self.findroot(x)]


N, M = map(int, input().split())
AB = [list(map(int,input().split())) for _ in range(M)]
s = N * (N - 1) // 2
t = []
uf = UnionFind(N)
for A, B in AB[::-1]:
    t.append(s)
    if uf.issamegroup(A, B):
        continue
    s -= uf.count(uf.findroot(A)) * uf.count(uf.findroot(B))
    uf.unite(A, B)
    

for i in t[::-1]:
    if i < 0:
        print(0)
    else:
        print(i)


Measured memory_bytes: 34992
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
#include<iostream>
#define MP make_pair
#define fi first
#define se second 
#define pb push_back
#define rep(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int N=200010;
int a[N];
ll ans;
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int i,n;
	scanf("%d",&n);
	rep(i,1,n)	scanf("%d",&a[i]);
	rep(i,1,n)	a[i]-=i;
	sort(a+1,a+1+n);
	rep(i,1,n)	ans=ans+abs(a[i]-a[(n+1)/2]);
	printf("%lld\n",ans);
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  
  bool flag = true;
  for (int i=0; i<s.size(); ++i) {
    if (flag == false) break;
    for (int j=0; j<s.size(); ++j) {
      if (flag == false) break;
      if (i != j && s.at(i) == s.at(j)) {
        flag = false;
      }
    }
  }
  
  if (flag == true) cout << "yes" << endl;
  else cout << "no" << endl;
}
        

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

int main()
{
	int N, M;
	scanf("%d%d", &N, &M);

	if (min(N, M) == 1)
	{
		if (max(N, M) == 1)
			printf("1\n");
		else
			printf("%d\n", max(N, M) - 2);
	}
	else if (min(N, M) == 2)
		printf("0\n");
	else
		printf("%lld\n", N*(LL)M - 2 * (LL)(N + M - 2));

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

typedef struct{
  int parent;
  int left;
  int right;
}Node;

Node T[25];
int n;

void maigoCenter(void);
int findSibling(int);
int countDegree(int);
int findDepth(int);
int findHeight(int);
void printType(int);

int main(){
  int i, id;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%d", &id);
    scanf("%d%d", &T[id].left, &T[id].right);
    T[id].parent = -1;
  }

  maigoCenter();

  for(i=0; i<n; i++){
    printf("node %d: parent = %d, sibling = %d, ", i, T[i].parent, findSibling(i));
    printf("degree = %d, ", countDegree(i));
    printf("depth = %d, ", findDepth(i));
    printf("height = %d, ", findHeight(i));
    printType(i);
  }


  return 0;
}

void maigoCenter(void){
  int i;

  for(i=0; i<n; i++){
    if(T[i].left != -1){
      T[T[i].left].parent = i;
    }
    if(T[i].right != -1){
      T[T[i].right].parent = i;
    }
  }

} 

int findSibling(int n){
  if(T[n].parent != -1){
    if(T[T[n].parent].left == n){
      return T[T[n].parent].right;
    }else {
      return T[T[n].parent].left;
    }
  }
    return -1;
}

int countDegree(int n){
  int count = 0 ;

  if(T[n].left != -1) count++;
  if(T[n].right != -1) count++;

  return count;
}

int findDepth(int n){ 
  int depth, parent;

  if(T[n].parent == -1) return 0;

  parent = T[n].parent;

  for( depth = 1; T[parent].parent != -1; depth++){
    parent = T[parent].parent;
  }

  return depth;
}

int findHeight(int n){
  int left, right;

  if(T[n].left == -1 && T[n].right == -1) return 0;

  if( T[n].left == -1) {
    left = 0;
  }else {
    left = findHeight(T[n].left);
  }
  if( T[n].right == -1) {
    right = 0;
  }else {
    right = findHeight(T[n].right);
  }

  return (left > right ? left+1 : right+1);

}

void printType(int n){
  if(T[n].parent == -1) printf("root\n");
  else if(T[n].left == -1 && T[n].right == -1) printf("leaf\n");
  else printf("internal node\n");
}

Measured memory_bytes: 612
#include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


ll n, ans = 0;
map<ll, ll> m;
int main() {
	cin >> n;
	REP(i, n) {
		ll a;
		cin >> a;
		m[a]++;
	}
	FORR(i, 40, 1) {
		ll now = 1ll << i;
		for (auto i : m)
		{
			if (now - i.first == i.first) {
				ans += i.second / 2;
				m[i.first] -= i.second / 2;
			}
			else {
				if (m.find(now - i.first) != m.end()) {
					ans += min(i.second, m[now - i.first]);
					m[i.first] -= min(i.second, m[now - i.first]);
					m[now - i.first] -= min(i.second, m[now - i.first]);
				}
			}
		}
	}
	cout << ans << endl;
}




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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

using namespace std;
using ll = long long;
using P = pair<int, int>;

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    string s; cin >> s;
    int ans = 0;

    REP( i, s.size() ){
        int t = 0;
        while( i < s.size() && s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T' ){
            t++;
            i++;
        }
        chmax( ans, t );
    }

    cout << ans << endl;
}


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

using namespace std;

typedef long long LL;

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

int main() {
	int n;
	cin >> n;
	int mn = INT_MAX;
	int ans = 0;
	REP(i, n) {
		int x;
		cin >> x;
		if (i == 0) {
			++ans;
		} else if (x <= mn) {
			++ans;
		}
		mn = min(mn, x);
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lim 1000000000000000007
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(),v.end()
#define mod ((int)1e9+7)
using namespace std;
typedef long long int ll;
typedef pair<int,int> pi;
const int N = (int)1e5+5;

void solve() {
  string s;
  cin>>s;
  int sum_of_digits = 0;
  for(char digit : s) {
    sum_of_digits += (digit - '0');
  }
  if(sum_of_digits % 9) cout<<"No";
  else cout<<"Yes";
}

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

  int T=1;
  //cin>>T;
  REP(TC,1,T) {
      //cout<<"Case #"<<TC<<": ";
      solve();
      cout<<"\n";
  }
}


Measured memory_bytes: 3732
import math

N = int(input())
stations = []
for _ in range(N-1):
    tmp = tuple(map(int, input().split()))
    stations.append(tmp)

ans_list = []
for i in range(len(stations)):
    C, S, F = stations[i]
    time = S + C
    index = i+1
    while index < N-1:
        next_C, next_S, next_F = stations[index]
        if next_S > time:
            time = next_S + next_C
        else:
            n = math.ceil(time / next_F)
            time = next_F * n + next_C
        index += 1
    ans_list.append(time)

ans_list.append(0)

for ans in ans_list:
    print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <ctime>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define fs first
#define sc second
#define INF 1000000000
#define MOD 1000000007
#define EPS 0.00000001

int main() {
    int N, M; cin >> N >> M;
    vector<int> A(M);
    vector<int> B(M);
    vector<int> C(M);
    for(int i=0; i<M; i++){
        cin >> A[i] >> B[i];
        for(int j=0; j<B[i]; j++){
            int c; cin >> c;
            c--;
            C[i] += (1 << c);
        }
    }
    
    
    
    vector<vector<int>> dp(M+1, vector<int>(1<<N, INF));
    for(int i=0; i<M+1; i++){
        dp[i][0] = 0;
    }
    
    for(int i=0; i<M; i++){
        for(int j=0; j<(1<<N); j++){
            dp[i+1][j|C[i]] = min(dp[i+1][j|C[i]], min(dp[i][j] + A[i], dp[i][j|C[i]]));
            dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
        }
    }
    
    cout << (dp[M][(1<<N)-1] == INF? -1 : dp[M][(1<<N)-1]) << endl;
    

    return 0;
}




Measured memory_bytes: 16384
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A = LIST()

print("bust" if sum(A) >= 22 else "win")

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

bool cant[10];

bool pay(int n) {
	while (n) {
		if (cant[n % 10]) return 0;
		n /= 10;
	}
	return 1;
}

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

	int n, k, t;
	cin >> n >> k;

	while (k--) {
		cin >> t;
		cant[t] = 1;
	}

	while (1) {
		if (pay(n)) {
			cout << n;
			return 0;
		}
		n++;
	}
}

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

#define fast ios::sync_with_stdio(false);cin.tie(NULL)
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;

ll n, ans;
int p[100010];
vector<pll> v;
set<ll> S;

int main() {
	fast;

	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> p[i];
		v.eb(p[i], i);
	}

	sort(all(v));
	reverse(all(v));

	S.insert(-1);
	S.insert(n);
	S.insert(v[0].se);

	for(int i=1; i<n; i++) {
		set<ll>::iterator it = S.upper_bound(v[i].se);
		set<ll>::iterator it1 = it, it2 = it;
		it1--;

		ll cnt = 0;
		if(++it2 != S.end()) {
			cnt += (*it2 - *it) * (v[i].se - *it1);
		}
		it2 = it1;
		if(it2-- != S.begin()) {
			cnt += (*it1 - *it2) * (*it - v[i].se);
		}

		S.insert(v[i].se);
		
		ans += cnt * v[i].fi;
	}

	cout << ans;
}

Measured memory_bytes: 6896
n=int(input())
lst=[]
d=[False for I in range(55556)]
for i in range(2,55555):
    if d[i]==False:
        lst.append(i)
        for j in range(i,55555,i):
            d[j]=True
ans=[]
for i in lst:
    if i%5==1:
        ans.append(i)
print(*ans[:n])

Measured memory_bytes: 72276
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int a[5];
    int t = 0;
    while(1){
        int n,k;
        cin >> n >> k;
        if(n == 0 && k == 0)break;
        vector<int>l(n);
        for(int i = 0;i < n;i++){
            cin >> l[i];
        }
        int s = 0;
        int max = 0;
        for(int i = 0;i < k;i++){
            s += l[i];
        }
        max = s;
        for(int i = k;i < n;i++){
            s += l[i];
            s -= l[i - k];
            if(s > max){
                max = s;
            }
        }
        a[t] = max;
        t++;

    }
    for(int i = 0;i < t;i++){
        cout << a[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
int main(){
	int cnt=0;
	int max=0;
	int n;
	cin>>n;
	while(n--){
		int x;
		cin>>x;
		if(x>=max){
			max=x;
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d,e,f;
	cin>>a>>b>>c>>d>>e>>f;
	cout<<a+b+c+d+e+f-min({a,b,c,d})-min(e,f)<<endl;
}


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

using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    vector<int> a(n);
    for(int i=0;i<n;i++) scanf("%d",&a[i]);
    vector<int> v(n+1,0);
    for(int t:a) v[t]=max(v[t],v[t-1]+1);
    int res=0;
    for(int i=1;i<=n;i++) if(v[i]==i) res=i;
    if(res!=0) printf("%d\n",n-res);
    else printf("-1\n");
    return 0;
}


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

int main(){
  int n;cin>>n;
  map<string,int> mp;
  vector<string> s;
  REP(i,n){
    string t;
    cin>>t;
    mp[t]++;
  }
  int ma=0;
  for(auto p:mp){
    if(p.second>ma) ma=p.second;
  }
  for(auto p:mp){
    if(p.second==ma) s.push_back(p.first);
  }
  sort(s.begin(),s.end());
  REP(i,s.size()) cout<<s.at(i)<<endl;
}

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

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

Measured memory_bytes: 256
n=input()
import re
n2 = re.split('(..)',n)[1::2]


if len(n) % 2 != 0:
    print('No')
else: 
    cnt = 0
    for i,s in enumerate(n2):
        if 'hi' in s:
            cnt += 1
    if cnt == len(n2):
        print('Yes')
    else:
        print('No') 

Measured memory_bytes: 3188
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
mod = 10**9 + 7
ans = pow(2,N//2,mod)
c = Counter(A)
for e in c.items():
    if (e[0] == 0 and e[1] >= 2) or  e[1] >= 3:
        ans = 0
        break
print(ans)

Measured memory_bytes: 14820
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

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

    for(int i=1; i<10; i++){
        result += 111;
        if(n <= 111*i){
            break;
        }
    }
    cout << result << endl;

    return 0;
}


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

using namespace std;

int sum (int n) {
  int s = 0;
  while (n) {
    s += n % 10;
    n /= 10;
  }
  return s;
}
int minn = INT_MAX, n;

int main()
{
  cin >> n;
  for (int i = 1; i <= n / 2; i++) {
    if (sum(i) + sum(n - i) < minn)
      minn = sum(i) + sum(n - i);
  }
  cout << minn;
  return 0;
}


Measured memory_bytes: 256
import scala.collection.mutable
import scala.io.StdIn.readLine

object Main extends App {
  val num = readLine
  var ans = num.toLong

  for (e <- 0 until (1 << num.length - 1)) {
    var bit = e.toBinaryString.toCharArray
    while (bit.length != num.length) {
      bit = '0' +: bit
    }

    var formula = num
    var count = 0
    val index = bit.zipWithIndex.filter(_._1 == '1').map(_._2)
    for (a <- index) {
      formula = formula.patch(a + count, "+", 0)
      count += 1
      if (count == index.length) {
        ans += formula.split('+').map(_.toInt).sum
      }
    }
  }

  println(ans)

}


Measured memory_bytes: 30732
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	long long N;
	cin>> N;
	int Shuzu[2][100];
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < N; j++)
			scanf(" %d", &Shuzu[i][j]);
	long long max = 0;
	long long count1 = 0;
	for (int i = 0; i < N; i++){
		count1 += Shuzu[0][i];
		long long count2 = 0;
		for (int j = i; j < N; j++)
			count2 += Shuzu[1][j];
		if (count1 + count2 > max)
			max = count1 + count2;
	}
	cout<< max <<endl;
	return 0;	
}

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

int main() {
    long long a,b,c;
    cin >> a >> b >> c;
    if(a < b && b <c){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}



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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { 1,  0, -1,  0,  1, -1,  1, -1};
static const int dy[8] = { 0,  1,  0, -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;
const int mod = 1e9+7;

struct work{
    int ed;
    int ttime;
    work(int ed,int ttime):ed(ed),ttime(ttime){;}
    bool operator<(const work& w){
        return ed > w.ed;
    }
};

const int maxn = 2e5+5;
LL A[maxn];
map<LL,LL> mp;

int main()
{
    //vector<work> vw;
    int N = get_int();
    _for(i,0,N){
        int A,B;
        cin >> A >> B;
        mp[B]+=A;
        //vw.push_back(work(B,A));
    }

    //sort(ALL(vw));
    int ok = 1;
    LL sum = 0;
    for(auto a:mp){
        sum += a.second;
        if(sum > a.first) ok = 0;

    }


    if(ok) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 12800
#include<stdio.h>

int main(void){
	int a,b,c,i;
	int d=0;
	scanf("%d %d %d",&a,&b,&c);
	for(i=a;i<=b;i++){
		if((c%i)==0){
		d++;
		}
	}
	printf("%d\n",d);	

return 0;
}



Measured memory_bytes: 2108