akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
#include <vector>
#include <tuple>
#include <string>
#include <algorithm>

 
using namespace std;

typedef long long ll;
typedef long double ld;
#define L(ID) ((ID*2)+1)
#define R(ID) ((ID*2)+2)
#define M(L,R) ((L+R)/2)
#define forr(start,end) for(int i = start; i < end; i++)
#define gap ' '
 
const int MAXN = 1e5 + 5;
string s;int n;ll m = 0,a = 0, r = 0, c = 0, h = 0;
int P [10]={0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2};
int Q [10]={1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3};
int R [10]={2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4};

ll largest(ll a, ll b){
	return (a<b)?b:a;
}
ll smallest(ll a, ll b){
	if(a < b)return a;
	return b;
}

int main(){
	cin >> n;
	for(int i = 0; i < n; ++i){
		cin >> s;
		if(s[0] == 'M')m++;
		if(s[0] == 'A')++a;
		if(s[0] == 'R')++r;
		if(s[0] == 'C')++c;
		if(s[0] == 'H')++h;
	}
	ll d[5];
	d[0] = m, d[1] = a, d[2] = r, d[3] = c, d[4] = h;
	ll ans = 0;
	for(int i = 0; i < 10; ++i){
		ans+=d[P[i]]*d[Q[i]]*d[R[i]];
	}
	cout << ans << endl;


    return 0;
}


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

int main(int argc, char const *argv[]) {

    string s;
    string p;

    cin >> s >> p;

    s += s;

  if(s.find(p)!=string::npos) {
      cout<<"Yes"<<endl;
  } else {
    cout<<"No"<<endl;
  }

    return 0;
}



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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#define REP(i, n) for (int i = 0; i < int(n); i++)
#define REPD(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

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

int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };

int main()
{
    int n;
    cin >> n;
    vector<int> vi(n);
    REP(i, n)
    cin >> vi[i];
    int allxor = 0;
    REP(i, n)
    allxor ^= vi[i];
    REP(i, n)
    {
        cout << (allxor ^ vi[i]);
        if (i != n - 1)
            cout
                << " ";
        else
            cout << endl;
    }
}

Measured memory_bytes: 4044
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define INF 10000000000

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
	int N;
	cin>>N;
	vector<int>X(N);
	vector<int>Y(N);
	REP(i,N){
		cin>>X[i];
		Y[i]=X[i];
	}
	std::sort(Y.begin(),Y.end());
	int a=Y[N/2],b=Y[N/2-1];
		REP(i,N){
			if(X[i]<a)cout<<a<<endl;
			else cout<<b<<endl;
		}
	
	return 0;
}

Measured memory_bytes: 3840
import bisect

def main():
    N = int(input())
    A = tuple(map(int, input().split()))
    B = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    a = sorted(A)
    c = sorted(C)
    cnt = 0
    for i in B:
        x = bisect.bisect_left(a, i)
        y = bisect.bisect_right(c, i)
        cnt += x * (N - y)

    print(cnt)

main()


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
//const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

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

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

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

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

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

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > A(N), B(N);
  cin >> A >> B;
  // 偶数距離動かすと表面
  // 奇数距離動かすと裏面
  auto dp = make_v< int >(1 << N, N);
  fill_v(dp, inf);
  for(int i = 0; i < N; i++) {
    dp[1 << i][i] = i;
  }
  for(int i = 1; i < (1 << N); i++) {
    int now = __builtin_popcount(i);

    for(int j = 0; j < N; j++) {
      if((~i >> j) & 1) continue;
      int add = 0;
      for(int k = 0; k < N; k++) {
        if((i >> k) & 1) continue;
        int pre = abs(j - (now - 1)) % 2 == 0 ? A[j] : B[j];
        int cur = abs(k - now) % 2 == 0 ? A[k] : B[k];
        if(pre <= cur) chmin(dp[i | (1 << k)][k], dp[i][j] + add);
        ++add;
      }
    }
  }
  int ret = inf;
  for(int i = 0; i < N; i++) chmin(ret, dp[(1 << N) - 1][i]);
  if(ret >= inf) ret = -1;
  cout << ret << endl;
}

Measured memory_bytes: 26880
n, k = map(int, input().split())
gu, choki, pa = map(int, input().split())
t = list(input())

total = 0
for i, v in enumerate(t):
    if i >= k and v == t[i-k]:
        t[i] = 'd'
    elif v == 'r':
        total += pa
    elif v == 's':
        total += gu
    else:
        total += choki
print(total)

Measured memory_bytes: 4084
S = input()
result = None
for i in range(1, len(S)):
    for j in range(2, len(S)):
        if S[:i] + S[j:] == 'keyence':
            result = True
            break
        else:
            result = False
    if result:
        break

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

Measured memory_bytes: 3060
n, k = map(int,input().split())
r, s, p = map(int,input().split())
t = input()
ans = 0
flag = [0 for _ in range(k)]
d = {"r":p, "s":r, "p":s}

for i in range(k):
    ans += d[t[i]]

for i in range(1, len(t)//k+1):
    if i == len(t)//k :
        for j in range(len(t)%k):
            if t[i*k+j] != t[(i-1)*k+j]:
                ans += d[t[i*k+j]]
                flag[j] = 0
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 0:
                flag[j] = 1
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 1:
                ans += d[t[i*k+j]]
                flag[j] = 0
    else:
        for j in range(k):
            if t[i*k+j] != t[(i-1)*k+j]:
                ans += d[t[i*k+j]]
                flag[j] = 0
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 0:
                flag[j] = 1
            elif t[i*k+j] == t[(i-1)*k+j] and flag[j] == 1:
                ans += d[t[i*k+j]]
                flag[j] = 0

print(ans)
 

Measured memory_bytes: 4084
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)

template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL A,B,C; cin>>A>>B>>C;
    if((A+B)>=C){
        cout<<B+C<<endl;
    }else{
        cout<<A+2*B+1<<endl;
    }

    
}


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

int main(){ 
    int a,b,c;
    cin>>a>>b>>c;
    int d=a-c;
    int e=0;
    while(d>=b+c){
        d-=b+c;
        e++;
    }
    cout<<e;
    return 0;
}


Measured memory_bytes: 256
#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 ALL(x) x.begin(),x.end()
#define PB push_back
#define LL long long

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(typename set<T>::iterator it = v.begin();it != v.end();it++)
    os << *it <<" ";
    return os;
}

int N,M;

const int maxn = 1e5+5;
set<int> q;
set<int> si;

int f[maxn];

int finds(int x){
    if(x == f[x]) return x;
    else{
        return (f[x] = finds(f[x]));
    }
}

int main()
{
    cin >> N >> M;

    _rep(i,1,N){
        f[i] = i;
    }

    _rep(i,1,M){
        int a,b,c;scanf("%d %d %d",&a,&b,&c);
        int aroot = finds(a);
        int broot = finds(b);
        if(aroot != broot) f[aroot] = broot;
    }

    _rep(i,1,N){
        int a = finds(i);
        //cout << a << endl;
        q.insert(a);
    }
    cout << q.size() <<endl;

    return 0;
}


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

using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))

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

#define FF first
#define SS second
template<class S, class T>
istream& operator>>(istream& is, pair<S,T>& p){
  return is >> p.FF >> p.SS;
}
template<class S, class T>
ostream& operator<<(ostream& os, const pair<S,T>& p){
  return os << p.FF << " " << p.SS;
}
template<class T>
void maxi(T& x, T y){
  if(x < y) x = y;
}
template<class T>
void mini(T& x, T y){
  if(x > y) x = y;
}


const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL MOD = 1e9+7;

int dp_mn_x[2001][2001][2];
int dp_mx_x[2001][2001][2];
int dp_mn_y[2001][2001][2];
int dp_mx_y[2001][2001][2];

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

  string S; cin >> S;
  int K; cin >> K;
  int N = SZ(S);

  fill((int*)dp_mn_x, (int*)dp_mn_x+2001*2001*2, 1e9);
  fill((int*)dp_mx_x, (int*)dp_mx_x+2001*2001*2, -1e9);
  fill((int*)dp_mn_y, (int*)dp_mn_y+2001*2001*2, 1e9);
  fill((int*)dp_mx_y, (int*)dp_mx_y+2001*2001*2, -1e9);
  dp_mn_x[0][0][0] = dp_mx_x[0][0][0] = dp_mn_y[0][0][0] = dp_mx_y[0][0][0] = 0;

  REP(i,N){
	REP(k,K+1){
	  REP(f,2){
		if(S[i] == 'L' || S[i] == 'R'){
		  mini(dp_mn_y[i+1][k][f], dp_mn_y[i][k][f]);
		  maxi(dp_mx_y[i+1][k][f], dp_mx_y[i][k][f]);

		  int dx = (S[i]=='L'?-1:1) * (f==0?1:-1);
		  mini(dp_mn_x[i+1][k][f], dp_mn_x[i][k][f] + dx);
		  mini(dp_mn_x[i+1][k+1][f^1], dp_mn_x[i][k][f] + dx * -1);
		  maxi(dp_mx_x[i+1][k][f], dp_mx_x[i][k][f] + dx);
		  maxi(dp_mx_x[i+1][k+1][f^1], dp_mx_x[i][k][f] + dx * -1);
		}
		else{
		  mini(dp_mn_x[i+1][k][f], dp_mn_x[i][k][f]);
		  maxi(dp_mx_x[i+1][k][f], dp_mx_x[i][k][f]);

		  int dx = (S[i]=='D'?-1:1) * (f==0?1:-1);
		  mini(dp_mn_y[i+1][k][f], dp_mn_y[i][k][f] + dx);
		  mini(dp_mn_y[i+1][k+1][f^1], dp_mn_y[i][k][f] + dx * -1);
		  maxi(dp_mx_y[i+1][k][f], dp_mx_y[i][k][f] + dx);
		  maxi(dp_mx_y[i+1][k+1][f^1], dp_mx_y[i][k][f] + dx * -1);
		}
	  }
	}
  }

  int ans = -1e9;
  REP(k1,K+1) REP(k2,K+1){
	if(k1+k2 > K) continue;
	REP(f1,2) REP(f2,2)
	  maxi(ans, max(-dp_mn_x[N][k1][f1], dp_mx_x[N][k1][f1])
		   + max(-dp_mn_y[N][k2][f2], dp_mx_y[N][k2][f2]));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 128332
# %%

N, M, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

# %%
AA = [0] * (N + 1)
BB = [0] * (M + 1)
for i, v in enumerate(A):
    AA[i + 1] += v + AA[i]
for i, v in enumerate(B):
    BB[i + 1] += v + BB[i]

ans = 0
b_cnt = M
for a_cnt in range(N + 1):
    if AA[a_cnt] > K:
        continue
    while AA[a_cnt] + BB[b_cnt] > K:
        b_cnt -= 1

    ans = max(ans, a_cnt + b_cnt)

print(ans)




Measured memory_bytes: 47688
use itertools::iproduct;
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        k: u64
    }

    let ans: u64 = iproduct!(1..=k, 1..=k, 1..=k)
        .map(|(a, b, c)| gcd(gcd(a, b), c))
        .sum();

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

fn gcd(n: u64, m: u64) -> u64 {
    if m == 0 {
        n
    } else {
        gcd(m, n % m)
    }
}


Measured memory_bytes: 2140
from bisect import *

N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
cnt = []

for b in B:
    cnt.append(bisect_left(A,b) * (N - bisect_right(C,b)))
print(sum(cnt))



Measured memory_bytes: 29332
#include<bits/stdc++.h>
using namespace std;
int i,j,k,n,m,ans;
int yinshu[110];
void fenjie(int sum){
    for(int i=2;i<=sum;i++){
        while(sum%i==0){
            sum/=i;
            ++yinshu[i];
        }
    }
}
int main(){
    cin>>n;
    for(i=1;i<=n;i++)
        fenjie(i);
    for(i=1;i<=100;i++)
        if(yinshu[i]>=74)++ans;
    for(i=1;i<=100;i++)
        for(j=i+1;j<=100;j++){
            if(yinshu[i]>=2&&yinshu[j]>=24)++ans;
            if(yinshu[i]>=24&&yinshu[j]>=2)++ans;
            if(yinshu[i]>=4&&yinshu[j]>=14)++ans;
            if(yinshu[i]>=14&&yinshu[j]>=4)++ans;
        }
    for(i=1;i<=100;i++)
        for(j=i+1;j<=100;j++)
            for(k=j+1;k<=100;k++){
                if(yinshu[i]>=2&&yinshu[j]>=4&&yinshu[k]>=4)++ans;
                if(yinshu[i]>=4&&yinshu[j]>=2&&yinshu[k]>=4)++ans;
                if(yinshu[i]>=4&&yinshu[j]>=4&&yinshu[k]>=2)++ans;
            }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <queue>
#define PIE 3.14159265358979
#define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;

bool dp[100005]; //0:Secondの勝ち

int main(){
    int N,K;
    int a[100];
    cin>>N>>K;
    for(int i  = 0;i < N;i++){
        cin>>a[i];
    }
    for(int i  = 0;i < K;i++){
        bool next_win = 0;
        if(dp[i]==0)
            next_win = 1;
        for(int j  = 0;j < N;j++){
            int next_k = i+a[j];
            if(next_k>K){
                continue;
            }
            if(dp[next_k]==0&&next_win==1){
                dp[next_k]=1;
            }
        }
    }
    
    if(dp[K]==1){
        cout<<"First"<<endl;
    }else{
        cout<<"Second"<<endl;
    }

}


Measured memory_bytes: 384
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
#define double long double
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef vector<pii> VP;
typedef vector<string> VS;
typedef priority_queue<int> PQ;
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; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define eps 1e-12 
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int A[] = { 6,4,3,2 };
	REP(i, 4) {
		int a, b; cin >> a >> b;
		a--;
		cout << A[a] * b * 1000<< endl;
	}

	return 0;
}




Measured memory_bytes: 3172
#include <cstdio>

using namespace std;

int a[100];
int dp[100001];

int main() {
    int n, k, i, j;
    
    scanf("%d %d", &n, &k);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = 1; i <= k; i++) {
        for (j = 0; j < n; j++) {
            if (a[j] > i) break;
            
            if (dp[i - a[j]] == 0) {
                dp[i] = 1;
                break;
            }
        }
    }
    
    if (dp[k] == 1) {
        puts("First");
    } else {
        puts("Second");
    }
    
    return 0;
}


Measured memory_bytes: 512
x, y, z, k = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

d = [e1+e2 for e1 in a for e2 in b]
d.sort(reverse=True)
d = d[:k]

e = [e1+e2 for e1 in d for e2 in c]
e.sort(reverse=True)

for i in range(k):
  print(e[i])

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

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
 
using namespace std;
 
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
 
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

using namespace std;
 
int r;

int main() {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("in", "r", stdin);
#endif
	
	cin >> r;
	cout << r *r << endl;

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}

Measured memory_bytes: 256
public class Main{
  public void run(java.io.InputStream in, java.io.PrintStream out){
    java.util.Scanner sc = new java.util.Scanner(in);
    String s;
    char[] c;
    int i;

    s = sc.nextLine();
    c = new char[s.length()];
    for(i = 0;i < s.length();i++)c[i] = s.charAt(i);
    for(i = 0;i < s.length() - 4;i++){
      if(c[i] == 'a' && c[i + 1] == 'p' && c[i + 2] == 'p'
        && c[i + 3] == 'l' && c[i + 4] == 'e'){
          c[i] = 'p'; c[i + 1] = 'e'; c[i + 2] = 'a';
          c[i + 3] = 'c'; c[i + 4] = 'h';
      }else if(c[i] == 'p' && c[i + 1] == 'e' && c[i + 2] == 'a'
        && c[i + 3] == 'c' && c[i + 4] == 'h'){
          c[i] = 'a'; c[i + 1] = 'p'; c[i + 2] = 'p';
          c[i + 3] = 'l'; c[i + 4] = 'e';
      }
    }

    for(i = 0;i < s.length();i++)out.print(c[i]);
    out.println();

    sc.close();
  }
  public static void main(String[] args){
    (new Main()).run(System.in, System.out);
  }
}

Measured memory_bytes: 17164
A_B = input()
A_B_list = A_B.split(" ")

A = int(A_B_list[0])
B = int(A_B_list[1])

socket = 1
result = 0


# if A == 2:
#     print(B-1)
# else:
#     result = (B // (A - 1)) + 1
#     if (A-1) * (result-1) + 1 == B:
#         result -= 1
# 
#     print(result)
    
while True:
    if socket >= B:
        print(result)
        break
    socket += (A-1)
    result += 1


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> apples(N);
  for (int i = 0; i < N; ++i) {
    cin >> apples[i];
  }
  for (auto x : apples) {
    if (x % 2 == 1) {
      cout << "first" << endl;
      return 0;
    }
  }
  cout << "second" << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
const int maxn=8000005;
const int mod=1e9+7;
int n,k,jc[maxn],inv[maxn],f[2005][2005];
int poww(int x,int y){
    int res=1; 
    while(y){
        if(y&1){
        	res=res*x%mod;
        }
        x=x*x%mod;
        y>>=1;
    }
    return res;
}
int C(int n,int k){
    return ((jc[n]*inv[k]%mod)*inv[n-k])%mod;
}
signed main(){
    jc[0]=1;
    for(int i=1;i<maxn;i++){
    	jc[i]=jc[i-1]*i%mod;
    } 
    inv[maxn-1]=poww(jc[maxn-1],mod-2);
    for(int i=maxn-2;i>0;i--){
    	inv[i]=(inv[i+1]*(i+1))%mod;
    } 
    inv[0]=1;
    cin>>n>>k;
    if(k==1){
    	cout<<'1';
    	return 0;
    }
    f[0][0]=1;
    for(int i=1;i<=n;i++){
    	for(int j=0;j<=i;j++){
    		f[i][j]=f[i-1][j];
            if(!j) continue;
    		f[i][j]=f[i-1][j]+(((f[i][j-1]*(n-j+1))%mod)*C(n*k-i-(j-1)*(k-1)-1,k-2)%mod)%mod;
    	}
            
    }
    cout<<f[n][n]<<endl;
}

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

int main()
{
    int r, g, b;
    cin >> r >> g >> b;
    if ((r*100 + g*10 + b) % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
}


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

long long x(long long a) {
    if (a % 4 == 0) return a;
    if (a % 4 == 1) return 1;
    if (a % 4 == 2) return a + 1;
    return 0;
}
int main() {
    long long a, b;
    cin >> a >> b;
    cout << (x(b) ^ x(a - 1)) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    int a,b;
    a = y-2*x;
    b = 4*x-y;
    if(a>=0 && b>=0 && a%2==0 && b%2==0){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3584
# coding: utf-8

data = map(int, raw_input().split())

if data[1] <= data[2]:
    if data[2] <= data[1] + data[0]:
        print 0
    else :
        print data[2] - (data[1] + data[0])
else:
    if data[1] > data[2]:
        if data[2] + data[0] >= data[1]:
            print 0
        else:
            print data[1] - (data[2] + data[0])


Measured memory_bytes: 2568
#include<bits/stdc++.h>
#define pb push_back
#define rint register int
#define endl '\n'
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int n,k;

int main(){
	scanf("%d%d",&n,&k);
	int m=(1<<n)-1;
	if(k>m||k<0) return puts("-1"),0;
	if(n==1){
		if(k==0) puts("0 0 1 1");
		else puts("-1");
		return 0;
	}
	printf("%d ",k);
	for(rint i=0;i<=m;++i) if(i!=k) printf("%d ",i);
	printf("%d ",k);
	for(rint i=m;i>=0;--i) if(i!=k) printf("%d ",i);
	return 0;
}

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

int main(){
    int N,Q;
    cin >> N >> Q;
    dsu d(N);
    rep(i,Q){
        int t,u,v;
        cin >> t >> u >> v;
        if (t == 0){
            d.merge(u,v);
        }
        if (t == 1){
            if (d.same(u,v)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 4008
#include <stdio.h>

void syuturyoku( int A[], int N )
{
   int i;
   for ( i = 0; i < N; i++ ) {
      if ( i > 0 ) {
         printf(" ");
      }
      printf("%d", A[i]);
   }
   printf("\n");
}

void insertionSort( int A[], int N )
{
   int i, j, v;
   for ( i = 1; i < N; i++ ) {
      v = A[ i ];
      j = i - 1;
      while ( j >= 0 && A[ j ] > v ) {
         A[ j + 1 ] = A[ j ];
         j--;
      }
      A[ j + 1 ] = v;
      syuturyoku( A, N );
   }
}

int main()
{
   int N, i, j;
   int A[100];

   scanf("%d", &N);
   for ( i = 0; i < N; i++ ) {
      scanf("%d", &A[i]);
   }
   syuturyoku( A, N );
   insertionSort( A, N );

   return 0;
}

Measured memory_bytes: 1804
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, core.bitop;

enum inf = 1L << 50;
enum mod = 10L^^9 + 7;

void main() {
    int n;
    scan(n);
    auto adj = new int[][](n, 0);
    foreach (i ; 0 .. n-1) {
        int x, y;
        scan(x, y);
        x--, y--;
        adj[x] ~= y;
        adj[y] ~= x;
    }

    auto dp = new long[][](n, 2);
    fillAll(dp, -1);

    long dfs(int v, int p, int col) {
        if (dp[v][col] != -1) {
            return dp[v][col];
        }

        dp[v][col] = 1;

        foreach (u ; adj[v]) {
            if (u == p) continue;
            long t = 0;
            t += dfs(u, v, 0);
            t %= mod;

            if (col == 0) {
                t += dfs(u, v, 1);
                t %= mod;
            }

            dp[v][col] *= t;
            dp[v][col] %= mod;
        }

        return dp[v][col];
    }



    auto ans = dfs(0, -1, 0) + dfs(0, -1, 1);
    ans %= mod;

    debug {
        writefln("%(%s\n%)", dp);
    }

    writeln(ans);
}







void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

Measured memory_bytes: 18684
package main

import "fmt"
import "os"
import "strings"

var S string
var letter map[string]int

func main() {
	fmt.Scan(&S)
	letter = make(map[string]int)
	for _, s := range strings.Split(S, "") {
		if _, ok := letter[s]; ok {
			fmt.Println("no")
			os.Exit(0)
		} else {
			letter[s] = 1
		}
	}
	fmt.Println("yes")
}


Measured memory_bytes: 640
r, g, b, n = map(int, input().split())

max_ = n // min(r, g, b)
t = 0
for i in range(max_+1):
    for j in range(max_ + 1):
        if (n - r * i - g * j) % b == 0 and n >= r * i + g * j:
            t += 1
print(t)

Measured memory_bytes: 41068
#include <bits/stdc++.h>
#define inf 1000000007
#define N 1007
using namespace std;

int h, w;
char path[N][N];
long long mem[N][N];

long long dp(int i, int j)
{
    if(i == (h - 1) && j == (w - 1))
        return 1;
    if(mem[i][j] != -1)
        return mem[i][j];
    long long ans = 0;
    if((j + 1) != w && path[i][j + 1] != '#')
        ans = ((ans % inf) + (dp(i, j + 1) % inf)) % inf;
    if((i + 1) != h && path[i + 1][j] != '#')
        ans = ((ans % inf) + (dp(i + 1, j) % inf)) % inf;
    mem[i][j] = ans;
    return ans;
}

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> h >> w;
    for(int i = 0;i < h;i++)
        for(int j = 0;j < w;j++)
            cin >> path[i][j];
    memset(mem, -1, sizeof(mem));
    cout << dp(0, 0) << endl;
    return 0;
}

Measured memory_bytes: 12636
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstdio>
#include <stack>

using namespace std;
typedef long long ll;

#define _SI(arr) (sizeof(arr)/sizeof(arr[0])

int main() {
	ll N;
	cin >> N;
	ll max_cnt = 0;
	ll ans = 1;

	for (ll i = 2; i <= N; i++) {
		ll cnt = 0;
		ll temp = i;
		ll temp_cnt = 0;
		if (temp % 2 != 0) {
			continue;
		}

		while (temp % 2 == 0)
		{
			temp /= 2;
			temp_cnt++;
		}

		if (temp_cnt > max_cnt) {
			max_cnt = temp_cnt;
			ans = i;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define M 998244353
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,i,j,c;
    cin>>n>>m;
    pair <pair<ll,ll> ,ll> q[m];
    for(i=0;i<m;i++)
        cin>>q[i].ff.ff>>q[i].ff.ss>>q[i].ss;
    sort(q,q+m);
    
    multiset <pair<ll,ll>> ms;
    multiset <ll> cst;
    j = 0;
    cst.insert(0);
    ms.insert(mp(1,0));
    for(i=1;i<=n;i++)
    {
        if(cst.size() == 0)
        {
            cout<<-1;
            return 0;
        }
        if(i == n)
        {
            cout<<*cst.begin();
            return 0;
        } 
        while(j<m and q[j].ff.ff == i)
        {
            c = *cst.begin();
            cst.insert(c+q[j].ss);
            ms.insert(mp(q[j].ff.ss, c+q[j].ss));
            j++;
        }
        while(ms.size() and ms.begin()->ff == i)
        {
            cst.erase(cst.find(ms.begin()->ss));
            ms.erase(ms.begin());
        }

    }
    return 0;
}


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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  ll n;
  cin >> n;
  vll p(n);
  rep(i, n) {
    cin >> p[i];
    p[i]--;
  }

  vll order(n);
  rep(i, n) {
    order[p[i]] = i;
  }

  vll a(n), b(n);
  a[0] = 4e8 + order[0];
  b[0] = 4e8;

  REP(i, n) {
    a[i] = a[i - 1] + 1;
    b[i] = b[i - 1] - 1;
    if (order[i] > order[i - 1]) {
      a[i] += abs(order[i] - order[i - 1]);

    } else {
      b[i] -= abs(order[i] - order[i - 1]);
    }
  }

  for (auto it : a)
    cout << it << " ";
  cout << endl;
  for (auto it : b)
    cout << it << " ";
  cout << endl;

  return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = b - 1; i >= a; i--)
#define int ll
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

signed main() {
    int n, d;
    cin >> n >> d;
    int x[n], y[n];
    int ans = 0;
    rep(i, 0, n) {
        cin >> x[i] >> y[i];
        if (d * d >= x[i] * x[i] + y[i] * y[i]) {
            ans++;
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 6732
#include <stdio.h>
int main()
{
	int A,B,C,D;
	scanf("%d %d %d %d",&A,&B,&C,&D);
	if(A+B>C+D)
	{
		printf("Left\n");
	}
	
	else if(A+B<C+D)
	{
		printf("Right\n");
	}
	else
	{
		printf("Balanced\n");
	}
	return 0;
}
	

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

#define int long long
#define ALL(x) x.begin(),x.end()
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb(x) push_back(x)
#define eb emplace_back
#define SORT(ls) sort(ls.begin(), ls.end())
#define DESC(ls) sort(ls.rbegin(), ls.rend()) 
#define mp(x, y) make_pair(x, y)
#define INF 1000000000
#define MOD 1000000007
#define F(i, a, n) for(i=a;i<n;i++)
#define SI(x) cin>>x
#define DI(x, y) cin>>x>>y
#define TI(x, y, z) cin>>x>>y>>z
#define FI(w, x, y, z) cin>>w>>x>>y>>z
#define SO(x) cout<<x<<"\n"
#define DO(x, y) cout<<x<<" "<<y<<"\n"
#define TO(x, y, z) cout<<x<<" "<<y<<" "<<z<< "\n"
#define FO(w, x, y, z) cout<<w<<" "<<x<<" "<<y<<" "<<z<<"\n"
#define FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

bool comp(ii a, ii b)
{
    return atan2(a.second, a.first) < atan2(b.second, b.first);
}

double eps = 1e-11;


int32_t main(void)
{
    FASTER;
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    int i, j;
    int n;
    SI(n);
    vii points(n);
    F(i, 0, n)
        DI(points[i].first, points[i].second);
    double ans = 0;
    sort(points.begin(), points.end(), comp);
    F(i, 0, n)
    {
        F(j, 0, n)
        {
            int end = (j < i) ? j + n : j;
            pair<double, double> res = {0, 0};
            for(int k = i; k <= end; k++)
            {
                res.first += points[k%n].first;
                res.second += points[k%n].second;
            }
            if(hypot(res.first, res.second) + eps > ans)
                ans = hypot(res.first, res.second);
        }
    }
    cout << setprecision(13) << ans << "\n";
    #ifdef LOCAL
    	cout<<endl<<endl<<"Time: "<<(float)clock()/CLOCKS_PER_SEC<<" seconds"<<endl;
    #endif
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main(){
  int k,n,len;
  string s;
  cin >> k;
  cin >> s;
  len=s.size();
  if(len>k){
   for(n=0;n<k;n++){
  	char c = s[n];
  	cout << c;
  	}
  cout << "..." <<endl;
  }
  else{
    cout << s<<endl;
  }
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

int main() {
  int n;
  cin >> n;
  if(n/100>12||n/100==0){
    if(n%100>12||n%100==0){
      cout << "NA" << endl;
    }else{
      cout << "YYMM" << endl;
    }
  }else{
    if(n%100>12||n%100==0){
      cout << "MMYY" << endl;
    }else{
      cout << "AMBIGUOUS" << endl;
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  char A,B,C,D;
  cin >> A >> B >> C >> D;
  int inA = A - '0';
  int inB = B - '0';
  int inC = C - '0';
  int inD = D - '0';
  if (inA + inB + inC + inD == 7) cout << A << '+' << B << '+' << C << '+' << D << "=7" << endl;
  else if (inA + inB + inC - inD == 7) cout << A << '+' << B << '+' << C << '-' << D << "=7" << endl;
  else if (inA + inB - inC - inD == 7) cout << A << '+' << B << '-' << C << '-' << D << "=7" << endl;
  else if (inA - inB - inC - inD == 7) cout << A << '-' << B << '-' << C << '-' << D << "=7" << endl;
  else if (inA - inB + inC - inD == 7) cout << A << '-' << B << '+' << C << '-' << D << "=7" << endl;
  else if (inA + inB - inC + inD == 7) cout << A << '+' << B << '-' << C << '+' << D << "=7" << endl;
  else if (inA - inB + inC + inD == 7) cout << A << '-' << B << '+' << C << '+' << D << "=7" << endl;
  else if (inA - inB - inC + inD == 7) cout << A << '-' << B << '-' << C << '+' << D << "=7" << endl;
  return 0;
}

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

int main() {
	int N, M;
	cin >> N >>  M;
	vector<pair<int, int>>A(N);
	vector<pair<int, int>>C(M);
	for (int i = 0;i<N;++i) {
		int x, y;
		cin >> x >> y;
		A[i] = make_pair(x,y);
	}
	for (int i = 0; i < M; ++i) {
		int x, y;
		cin >> x >> y;
		C[i] = make_pair(x, y);
	}
	for (int i = 0;i<N;++i) {
		int ans = -1;
		int dist = 1e9;
		for (int j = 0;j<M;++j) {
			int x = abs(A[i].first - C[j].first) + abs(A[i].second - C[j].second);
			if (dist>x) {
				ans = j;
				dist = x;
			}
		}
		cout <<ans +1 << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
// {{{
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <complex>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>
#if __cplusplus >= 201103
#include <numeric>
#endif
using namespace std;

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()

//#if __cplusplus >= 201103
typedef long long ll;
//#endif
typedef pair<int, int> P;
typedef pair<int, P> IP;

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

const int INF = 100000000;
//#if __cplusplus >= 201103
const ll LINF = 10000000000000000ll;
//#endif
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
// }}}

void init()
{
}

void solve()
{
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    //if(n == 2) cout << "Draw" << endl;
    if(false) cout << "Draw" << endl;
    else{
        int par = (b - a - 1) % 2;
        if(par == 0) cout << "Borys" << endl;
        else cout << "Alice" << endl;
    }
    return 0;
}

// vim:set foldmethod=marker:


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,f[100001];
    cin>>n;
    f[0]=2;
    for(int i=1;i<=n;i++)
        f[i]=f[i-1]*2+2;
    cout<<f[n]<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int main() {
  int n, a, b;
  scanf("%d", &n);
  if(n == 1) puts("Hello World");
  else if(n == 2) {
    scanf("%d%d", &a, &b);
    printf("%d", a + b);
  }
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
int compare(const void *x, const void *y)
{
	return *(int*)y - *(int*)x;
}
int main(void)
{
	int N, i;
	long a[300000], ans = 0;
	scanf("%d", &N);
	for (i = 0; i < N * 3; ++i) scanf("%ld", &a[i]);
	qsort(a, N * 3, sizeof(long), compare);
	for (i = 1; i < N * 2; i += 2) ans += a[i];
	printf("%ld", ans);
	return 0;
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

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

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n,cnt=0,ans=0,a,b,c,cmp=0,cmpp=INF,data,m,h,w,x,y,xcmp,ycmp,sum=0;

string s,ww;

vector<int> z;

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

       cin >> s;
       bool fl=false;
      rep(i,s.size()){
          if(s[i]==s[i+1]){
             fl=true;
             ww[0]=s[i];
             break;
          }
          if(s[i]==s[i+2]){
              fl=true;
              ww[0]=s[i];
              break;
          }
      }
      if(!fl){
          cout << -1 << " " << -1 << endl;
      }
      else{
          rep(i,s.size()){
              if(ww[0]==s[i]){
                  cmp=i+1;
                  if(s[i]==s[i+1]){
                      cmpp=i+2;
                      break;
                  }
                  else if(s[i]==s[i+2]){
                      cmpp=i+3;
                      break;
                  }
              }
          }
          cout << cmp << " " << cmpp << endl;;
      }
return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define endl "\n"
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 2e+9 + 10;
typedef pair<ll, ll> P;

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

  int N; cin >> N;
  vec D(101);
  rep(i, N) {
    int d; cin >> d;
    D[d]++;
  }
  int res = 0;
  rep(i,101) {
    if(D[i])res++;
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <string>
#include <cstring>
#include <cctype>
#include <ctime>
#include <climits>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <tuple>
#include <bitset>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <complex>
#include <random>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <functional>
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#ifndef M_PI
#define M_PI 3.141592653589793238462643383279
#endif
 
#define int long long
 
#define mp make_pair
#define mt make_tuple
#define fr first
#define sc second
#define pb push_back
#define pp pop_back
#define all(x) x.begin(), x.end()
#define get0 get<0>
#define get1 get<1>
#define get2 get<2>
#define get3 get<3>
 
#define debug(x) cerr << #x << " = " << x << ", line = " << __LINE__ << endl
 
typedef long long ll;
typedef long double ld;
typedef unsigned int ui;
typedef tuple<long long, long long, long long> tlll;
typedef tuple<int, int, int> tiii;
typedef tuple<int, int, int, int> tiiii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
const int MOD = 1e9 + 7;
const int SZ = 2e5 + 1;
int n;
pii a[SZ];
 
int get(int sx, int sy) {
    int mn = 0, mx = 0;
 
    for (int i = 1; i < n; ++i) {
        if (a[i].fr * sx + a[i].sc * sy < a[mn].fr * sx + a[mn].sc * sy) {
            mn = i;
        }
        if (a[i].fr * sx + a[i].sc * sy > a[mx].fr * sx + a[mx].sc * sy) {
            mx = i;
        }
    }
    return abs(a[mn].fr - a[mx].fr) + abs(a[mn].sc - a[mx].sc);
}
 
 
int32_t main()
{
#ifdef chikibambony
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i].fr >> a[i].sc;
    }
 
    cout << max(get(1, 1), get(1, -1)) << endl; 
    return 0;
}

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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    int counto = count(s.begin(), s.end(), 'o');
    cout << 700+100*counto << endl;

    return 0;
}


Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
// #define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()

int main(){
	int N; cin>>N;
	if(N==1){
		ote("Hello World");
	}
	else{
		int a,b; cin>>a>>b;
		ote(a+b);
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
string str;
map<string, long long> cnt;

long long c2(long long x){
	return (x * (x - 1)) / 2;
}

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

	cin >> n;

	for(int i = 0; i < n; i++){
		cin >> str;
		sort(str.begin(), str.end());
		cnt[str]++;
	}

	long long ans = 0;
	for(auto it : cnt){
		ans += c2(it.second);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 11264
#include<stdio.h>
#include<limits.h>

int main(void) {
    int i, j, k;
    int wholeFlag = 0;
    int N, M, X;
    int mini = INT_MAX;
    int C[100000];
    int A[100000][12];
    scanf("%d %d %d", &N, &M, &X);
    for(i = 0;i < N;i++) {
        scanf("%d", &C[i]);
        for(j = 0;j < M;j++) scanf("%d", &A[i][j]);
    }
    for(i = 0;i < 1LL << N;i++) {
        int money = 0;
        int flag = 1;
        int rikai[12] = {};
        for(j = 0;j < N;j++) {
            if(i & (1LL << j)) {
                money += C[j];
                for(k = 0;k < M;k++) rikai[k] += A[j][k];
            }
        }
        for(j = 0;j < M;j++) {
            if(rikai[j] < X) flag = 0;
        }
        if(flag) {
            wholeFlag = 1;
            mini = mini < money ? mini : money;
        }
    }
    if(wholeFlag) printf("%d\n", mini);
    else puts("-1");
    return 0;
}


Measured memory_bytes: 1704
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
#define SORT(v) std::sort(v.begin(), v.end())
ll n, ans = 0;
void dfs(ll x,int a,int b,int c) {
	if (x <= n) {
		if (a + b + c == 3) ans++;
		dfs(x * 10 + 3,1,b,c);
		dfs(x * 10 + 5, a, 1, c);
		dfs(x * 10 + 7, a, b, 1);
	}
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> n;
	dfs(0ll,0,0,0);
	cout << ans << endl;
	return 0;
}


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

void push(int A);
int pop(void);

int S[1000];
int Top = 0;

int main(void) {

	string str;
	int a, b;
	Top = 0;
	while (cin >> str) {

		if (str == "+") {
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (str == "-") {
			b = pop();
			a = pop();
			push(a - b);
		}
		else if (str == "*") {
			a = pop();
			b = pop();
			push(a * b);
		}
		else {
			push(atoi(str.c_str()));
		}
	}
	cout << pop() << endl;

	return 0;
}

void push(int A) {
	S[++Top] = A;
}

int pop(void) {
	Top--;
	return S[Top + 1];
}


Measured memory_bytes: 3220
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw_2(62,1);


int main(){
    ll N; cin>>N;
    ll cnt2=0,cnt4=0;
    rep(i,N){
        ll X; cin>>X;
        if(X%4==0) cnt4++;
        else if(X%2==0) cnt2++;
    }
    if(cnt2==0){
        if(cnt4>=N/2) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    else{
        if(N-cnt4*2<=cnt2) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
        
}



Measured memory_bytes: 3636