akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;

int main(){
  int n; cin >>n;
  vector<string> s(n);
  rep(i,n) cin >>s[i];
  sort(s.begin(), s.end());
  int cnt = 1;
  for(int i = 1; i<n; i++){
    if(s[i]!=s[i-1]) cnt++;
  }
  cout << cnt << endl;
  return 0; 
}


Measured memory_bytes: 9504
# import sys
# readline = sys.stdin.readline
# generator = (readline().strip() for _ in range(N))

# N, M = map(int, input().split())
# As = list(map(int, input().split()))
# queries = (input() for _ in range(N))


def solve():
    N = int(input())
    Ls = list(map(int, input().split()))

    count = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            for k in range(j+1, N):
                l1 = Ls[i]
                l2 = Ls[j]
                l3 = Ls[k]

                if l1 == l2 or l2 == l3 or l3 == l1:
                    continue
                if l1 + l2 <= l3:
                    continue
                if l2 + l3 <= l1:
                    continue
                if l3 + l1 <= l2:
                    continue
                count += 1
    return count


def main():
    print(solve())


if __name__ == "__main__":
    main()


Measured memory_bytes: 9200
// :)
// "Khodaya, be man "Tagwaye setiz" biamooz ta
//  dar anbuh masuliat nalaghzam ..." -Shariati
#include <bits/stdc++.h>
 
using namespace std;
typedef long long int64;
typedef pair<int,int> pii;
typedef pair<int64,int64> pii64;
 
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
 
const int maxn = 1e5+7;
const int64 M = 1e9+7;
const int64 I = 1e9;
 
vector <pii> v1;
 
int A[maxn], B[maxn];
 
int N;
int64 ans;
 
int main () {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	// 
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
		v1.PB( MP( A[i] + B[i], i ) );
	}
	//
	sort(all(v1));
	reverse(all(v1));
	for (int i = 0; i < v1.size(); i++)
		if (i % 2)
			ans -= B[v1[i].S];
		else 
			ans += A[v1[i].S];
	//
	cout << ans << "\n";
}


Measured memory_bytes: 1912
n = int(input())
bra = []
ket = []
c = []
for _ in range(n):
  s = input()
  mini = 0
  now = 0
  l = len(s)
  for i in range(l):
    if s[i] == '(':
      now += 1
    else:
      now -= 1
      mini = min(mini,now)
  if now >= 0:
    bra.append([-mini,now])
  c.append(now)
  s = s[::-1]
  mini = 0
  now = 0
  for i in range(l):
    if s[i] == ')':
      now += 1
    else:
      now -= 1
      mini = min(mini,now)
  if now >= 0:
    ket.append([-mini,now])  
check = 0
for x in c:
  #print(x)
  check += x
if check != 0:
  print('No')
  exit()
bra.sort()
now = 0
here = -1
n = len(bra)
#print(bra)
import heapq
pool = []
for i in range(n):
  while here != n-1:
    if bra[here+1][0] <= now:
      here += 1
      heapq.heappush(pool,-bra[here][1])
    else:
      break
  #print(i,'#',pool)
  if not pool:
    print('No')
    exit()
  else:
    now -= heapq.heappop(pool)

ket.sort()
now = 0
here = -1
n = len(ket)
#print(bra)
pool = []
for i in range(n):
  while here != n-1:
    if ket[here+1][0] <= now:
      here += 1
      heapq.heappush(pool,-ket[here][1])
    else:
      break
  #print(i,'#',pool)
  if not pool:
    print('No')
    exit()
  else:
    now -= heapq.heappop(pool)
print('Yes')

Measured memory_bytes: 226064
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;

string s;
string t;
string ans;
llong dp[3005][3005];

int main() {
    cin >> s >> t;

    for (int i = 0; i < s.length(); i++) {
        for (int j = 0; j < t.length(); j++) {
            if (s[i] == t[j]) {
                dp[i + 1][j + 1] = max({dp[i][j + 1], dp[i + 1][j], dp[i][j] + 1});
            }
            else {
                dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
            }
        }
    }

    int i, j;
    i = s.length();
    j = t.length();
    while (i > 0 && j > 0) {
        if (s[i - 1] == t[j - 1] && dp[i][j] > dp[i - 1][j - 1]) {
            ans.push_back(s[i - 1]);
            i--; j--;
        }
        else {
            if (dp[i - 1][j] > dp[i][j - 1]) {
                i--;
            }
            else {
                j--;
            }
        }
    }

    reverse(ans.begin(), ans.end());

    cout << ans << endl;
}


Measured memory_bytes: 70656
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;

int main(){
  int n,m;
  cin>>n>>m;
  vector<int> x(m,0);
  vector<int> b(m-1,0);
  ll ans=0;

  rep(i,m){
     cin>>x[i];
  }
  sort(x.begin(),x.end());

  if(n>=m){
     cout<<0;
     return 0;
  }

  rep(i,m-1){
     b.push_back(x[i+1]-x[i]);
     ans+=x[i+1]-x[i];
  }
  sort(b.begin(),b.end(),greater<int>());

  rep(i,n-1){
     ans-=b[i];
  }
  cout<<ans;





return 0;
}


Measured memory_bytes: 1408
use std::collections::HashSet;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().unwrap();
    let mut h: HashSet<usize> = HashSet::new();

    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let a: usize = s.trim().parse().unwrap();
        if h.contains(&a) {h.remove(&a);} else {h.insert(a);}
    }

    println!("{}", h.len());
}



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

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

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

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

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

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(std::string S)
{
    ll ans = 0;

    for (int i = 0; i < S.size(); i++)
    {
        if (S[i] != S[S.size() - i-1])
        {
            ans++;
        }
    }

    cout << ans/2 << endl;
}

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


Measured memory_bytes: 256
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string n;int c=0;
    cin>>n;
    while(c<n.size()){
        if(n[c]==n[c+1]){
            cout<<"Bad"<<endl;
            break;
            } c++;

            if(c==n.size()){cout<<"Good"<<endl;}

    }
}


Measured memory_bytes: 256
import re

int_a, int_b = map(int, input().split())
int_s = input()

pattern = '\d{' + str(int_a) + '}-\d{' + str(int_b) + '}$'

r = re.compile(pattern)

if r.match(int_s):
    print("Yes")
else:
    print("No")






Measured memory_bytes: 3188
#[allow(unused_imports)]
use {
   proconio::{fastout, input, marker::*},
   std::cmp::*,
   std::collections::*,
};

const INF: usize = std::usize::MAX;

#[fastout]
fn main() {
   input! {
      n: usize,
      m: usize,
      mut uv: [(Usize1, Usize1); m+1],
   }

   if m == 0 {
      println!("-1");
      return;
   }
   let (s, t) = uv[m];
   uv.pop();

   let mut to = vec![vec![]; n];
   for &(u, v) in uv.iter() {
      to[u].push(v);
   }

   let mut d = vec![vec![INF; 3]; n];
   d[s][0] = 0;
   let mut q = VecDeque::new();
   q.push_back((s, 0usize));
   while let Some((v, w)) = q.pop_front() {
      let tv = w % 3;
      if w != d[v][tv] {
         continue;
      }
      let tu = (tv + 1) % 3;
      for &u in to[v].iter() {
         if d[u][tu] > w + 1 {
            d[u][tu] = w + 1;
            q.push_back((u, w + 1));
         }
      }
   }
   if d[t][0] == INF {
      println!("-1");
      return;
   }
   let ans = d[t][0] / 3;
   println!("{}", ans);
}


Measured memory_bytes: 15784
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<unordered_map>
#include<set>
#include<cmath>
#include<random>

//#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define ALL(v) (v).begin() , (v).end()
#define fast ios::sync_with_stdio(false); cin.tie(NULL);
const double eps = 1e-6;

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

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

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

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

#define int long long

void solve(){

	int n;
	cin>>n;
	vector<pair<int,int>> a(n+1);
	for(int i = 1 ; i <= n ; ++i){
		cin>>a[i].ff;
		a[i].ss = i;
	}

	sort(a.begin()+1,a.end() , greater<pair<int,int>>());

	int dp[n+1][n+1];
	memset(dp , 0 , sizeof dp);

	for(int i = 1 ; i <= n ; ++i){

		int x = a[i].ff;
		int pos = a[i].ss;
		for(int j = 0 ; j <= i ; ++j){

			int val = 0;
			if(j > 0)
				val = dp[i-1][j-1] + x*(pos - j);

			if(j!=i)
				val = max(val , dp[i-1][j] + x*(n - (i - j - 1)-pos));

			dp[i][j] = val;

			//debug(dp[i][j] , i , j);
		}
	}

	int ans = *max_element(dp[n] , dp[n]+n+1);

	cout<<ans<<endl;

}

signed main(){

    fast;
    //freopen("output.txt" , "w" , stdout);
    int t = 1;
   // cin>>t;
    for(int i = 1 ; i <= t; ++i){

    	solve();
    }
}


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


using namespace std;
#define ll  long long
#define ld  long double
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1e9 + 7;
const double PI = 3.141592653589793238463;
const int MAXN = 2e3 + 5;
bool isPrime[MAXN];
void sevie() {
    memset(isPrime, 1, sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for (ll i = 2; i * i <= MAXN; i++) {
        if (isPrime[i]) {
            for (ll j = i * 2; j <= MAXN; j += i) {
                isPrime[j] = 0;

            }
        }
    }
}
ll fastPow(ll x, ll b) {
    if (b == 0)
        return 1;
    else if (!(b & 1)) {
        return fastPow(x * x, b / 2);
    } else
        return x * fastPow(x * x, (b - 1) / 2);
}
//__builtin_popcount ();
bool isPrim(int n) {
    if (n == 1 || n == 0)
        return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0)
            return false;
    }
    return true;
}


int main() {
    FAST
int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#表計算を行うプログラムを作成。

r,c=gets.split(" ").map(&:to_i)
h = Array.new(r+1).map{Array.new(c+1,0)} 

for i in 1..r                                       # 変数 i を1からrまで増やして繰り返し処理する。
    
a= gets.split.map(&:to_i)
    for j in 1..c                                   # 変数 i を1からcまで増やして繰り返し処理する。
    h[i-1][j-1] = a[j-1]
    h[i-1][c] += a[j-1]
    h[r][j-1] += a[j-1]
    h[r][c] += a[j-1]
    end
end
for i in 0..r
    for j in 0..c
      print " " unless j == 0
      print h[i][j]
    end
    print "\n"
  end




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

int N, ar[4], vis[302][302][302],tot;
double dp[302][302][302];

double calc(int m) {
	double r = ((double)N-m)/N;
	double r1 = 1-r;
	double x = (double)m/N;
	double ans = x * ((1/r1) + (r/(r1*r1)));
	return ans;
}

double rec(int one, int two, int three) {
	int zero = N - one - two - three;
	int num = one + two*2 +three*3;
	if(vis[one][two][three]!=-1) {
		return dp[one][two][three];
	}
	int fl = 1, cnt = 0;
	double ans;
	if(one) {
		ans = rec(one-1, two, three)*one;
		fl = 0;
		++cnt;
	}
	if(two) {
		if(fl)
			ans = rec(one+1, two-1, three)*two;
		else
			ans = ans + rec(one+1, two-1, three)*two;
		fl = 0;
		++cnt;
	}
	if(three) {
		if(fl)
			ans = rec(one, two+1, three-1)*three;
		else
			ans = ans + rec(one, two+1, three-1)*three;
		fl = 0;
		++cnt;
	}
	if(fl)
		return 0;
	ans = ans/(one+two+three) + calc(one+two+three);
	dp[one][two][three] = ans;
	vis[one][two][three] = 1;
	return ans;
}

int main() {
	scanf("%d", &N);
	memset(vis, -1, sizeof(vis));
	for(int i=0;i<N;++i) {
		int t;
		scanf("%d", &t);
		ar[t]++;
		tot+=t;
	}
	printf("%.11lf\n", rec(ar[1], ar[2], ar[3]));
	return 0;
}

Measured memory_bytes: 323072
//---------------------------------------------------------------
#include <bits/stdc++.h>
using namespace std;
#include <cstdlib>
#include <cmath>
#include <math.h>
#include <sstream>
#include <numeric>
#include <cassert>
//---------------------------------------------------------------
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define SIZE 100005
#define INF 1e18
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define vec vector
using pint = pair<int,int>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
//---------------------------------------------------------------
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; }
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const double pi = acos(-1);
//---------------------------------------------------------------
const int mod = 1e9+7;
struct mint {
int64_t x;
mint(int64_t x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {if ((x += a.x) >= mod) x -= mod;return *this;}
mint& operator-=(const mint a) {if ((x += mod-a.x) >= mod) x -= mod;return *this;}
mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
mint operator+(const mint a) const { return mint(*this) += a;}
mint operator-(const mint a) const { return mint(*this) -= a;}
mint operator*(const mint a) const { return mint(*this) *= a;}
mint pow(int64_t t) const {if (!t) return 1;mint a = pow(t>>1);a *= a;if (t&1) a *= *this;return a;}
mint inv() const { return pow(mod-2);}
mint& operator/=(const mint a) { return *this *= a.inv();}
mint operator/(const mint a) {return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

map<ll,ll> mp;
void pf(ll n) {
  for(ll i=2;i*i<=n;i++) {
    ll index=0;
    while(n%i==0) {
      n/=i;
      index++;
    }
    mp[i]+=index;
  }
  if(n!=1) mp[n]++;
}

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

    int n;
    cin>>n;

    for(int i=2;i<=n;i++){
        pf(i);
    }

    mint ans=1;
    for(auto x:mp){
        ans*=(x.second+1)%mod;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 3604
N,M = map(int,input().split())

AB = [list(map(int,input().split())) for _ in range(N)]

CD = [list(map(int,input().split())) for _ in range(M)]

for a,b in AB:
    tmp_point = -1
    tmp_root = 100000000000
    for i,cd in enumerate(CD):
        c,d = cd
        if abs(a-c)+abs(b-d) < tmp_root:
            tmp_root = abs(a-c)+abs(b-d)
            tmp_point = i+1
    print(tmp_point)

Measured memory_bytes: 68436
n = int(input())
N = 10**9
x1=0
y1=0
x2=N
y2=1
x3=N-n%N
y3=n//N+1
if n==10**18:
    x3=0
    y3=n//N

print(x1,y1,x2,y2,x3,y3)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef long double ld;
typedef std::vector<long double> vld;
typedef std::vector<std::vector<long double>> vvld;
using namespace std;
void yesno(bool state);

void Main(){
    ll X,Y;
    cin >> X >> Y;
    bool ans = false;
    for (ll i = 0; i <= X; i++)
    {
        if(2*i + 4*(X-i) == Y)
            ans =true;
    }
    yesno(ans);
}

int main(int argc, char const *argv[])
{
    Main();
    return 0;
}

void yesno(bool state){
    if(state)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3632
import itertools
while True:
    n = int(input())
    if n == 0:
        break
    a = [int(input()) for _ in range(n)]
    a[:0] = [0]
    for i in range(1, len(a)):
        a[i] += a[i - 1]
    print(max(map(lambda x:x[1] - x[0], itertools.combinations(a, 2))))

Measured memory_bytes: 7828
import java.util.*;
class Main {
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	long X = Long.parseLong(sc.next());
	long Y = Long.parseLong(sc.next());
	long ans = 0;
	long tmp = X;
        while(tmp<=Y) {
            ans++;
            tmp	*= 2;
        }
	System.out.println(ans);
    }
}

Measured memory_bytes: 23636
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<algorithm>
#include<memory.h>
#include<vector>
#include<stdio.h>
#include<cstdlib>
#include<map>
#include <set>
#include<stack>
#include<cmath>
#include<queue>
#include<bitset>
using namespace std;
typedef long long ll;
const int inf = 1e9;
const int MOD = 1e9 + 7;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;
const int N = 1e9 + 1;
string st ;
set<string> v;
int main() {
	int n; 
	cin >> st >> n;
	
	int len = st.size();
	string x;
	for (int i = 0; i < len; i++){
		x.clear(); 
		for (int j = i; j < i + 5 && j < len; j++){
			x.push_back(st[j]);
			v.insert(x);
		}

	}
	//sort(v.begin(), v.end());
	int cnt = 1;
	for (set<string>::iterator it = v.begin(); it != v.end(); it++){
		if (cnt == n){
			cout << *it << endl;
			return 0;
		}
		++cnt;
	}

	return 0;
}
	


Measured memory_bytes: 1664
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(long long A, long long V, long long B, long long W, long long T){
  long long diff = abs(A-B);

  if (diff == 0) {
    std::cout << "YES" << std::endl;
    return;
  }

  long long sp = V - W;

  if (sp <= 0 || sp * T < diff) {
    std::cout << "NO" << std::endl;
    return;
  } else {
    std::cout << "YES" << std::endl;
    return;
  }
}

int main(){
  long long A;
  scanf("%lld",&A);
  long long V;
  scanf("%lld",&V);
  long long B;
  scanf("%lld",&B);
  long long W;
  scanf("%lld",&W);
  long long T;
  scanf("%lld",&T);
  solve(A, V, B, W, T);
  return 0;
}


Measured memory_bytes: 3764
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    String n = sc.next();
    int ans = 9 * (n.length() - 1) + Character.getNumericValue(n.charAt(0)) - 1;

    boolean flag = true;
    if (n.length() > 1) {
      for (int i = 1; i < n.length(); i++) {
        if (Character.getNumericValue(n.charAt(i)) != 9) {
          flag = false;
        }
      }
    }

    if (flag == true) {
      ans += 1;
    }

    System.out.println(ans);
  }
}


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

void Solve(){
  string S; cin >>S;
  UL p = 0;
  UL ans = 0;
  rep(i, S.size()){
    if(S[i]=='A' || S[i]=='T' || S[i]=='G' || S[i]=='C') p++;
    else p = 0;
    ans = max(ans, p);
  }
  cout << ans << endl;
}
int main(){
  Solve(); return 0;
}

Measured memory_bytes: 256
N,T = map(int,input().split())
data = [list(map(int,input().split())) for _ in range(N)]

dp1 = [[0 for n in range(N+1)] for t in range(T+1)] #dp1[t][n] := (data[:n]の中からtまでに食べ切る範囲で美味しく）
dp2 = [[0 for n in range(N+1)] for t in range(T+1)] #dp1[t][n] := (data[:n]の中からt-1までに注文する範囲で美味しく)


for t in range(1,T+1):
    for n in range(1,N+1):
        if t-data[n-1][0] >= 0:
            dp1[t][n] = max(dp1[t][n-1],dp1[t-data[n-1][0]][n-1]+data[n-1][1])
            dp2[t][n] = max(dp2[t][n-1],dp2[t-data[n-1][0]][n-1]+data[n-1][1],dp1[t-1][n-1]+data[n-1][1])
        else:
            dp1[t][n] = dp1[t][n-1]
            dp2[t][n] = max(dp2[t][n-1],dp1[t-1][n-1]+data[n-1][1])


print(dp2[T][N])

Measured memory_bytes: 194436
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    for i in range(n, 10 ** 10):
        s = str(i)
        b = True
        for j in range(1, len(s)):
            if s[j] != s[j-1]:
                b = False
                break
        if b:
            print(i)
            exit()


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("3");
            WillReturn.Add("10 40 70");
            WillReturn.Add("20 50 80");
            WillReturn.Add("30 60 90");
            //210
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1");
            WillReturn.Add("100 10 1");
            //100
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("7");
            WillReturn.Add("6 7 8");
            WillReturn.Add("8 8 3");
            WillReturn.Add("2 5 2");
            WillReturn.Add("7 8 6");
            WillReturn.Add("4 6 8");
            WillReturn.Add("2 3 4");
            WillReturn.Add("7 5 1");
            //46
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    struct ABCDef
    {
        internal int A;
        internal int B;
        internal int C;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = { };
        Action<string> SplitAct = pStr =>
            wkArr = pStr.Split(' ').Select(X => int.Parse(X)).ToArray();

        var ABCList = new List<ABCDef>();

        foreach (string EachStr in InputList.Skip(1)) {
            SplitAct(EachStr);
            ABCDef WillAdd;
            WillAdd.A = wkArr[0];
            WillAdd.B = wkArr[1];
            WillAdd.C = wkArr[2];
            ABCList.Add(WillAdd);
        }

        int PrevASumMax = 0; // 直近でAを選択した際の幸福度合計の最大値
        int PrevBSumMax = 0; // 直近でBを選択した際の幸福度合計の最大値
        int PrevCSumMax = 0; // 直近でCを選択した際の幸福度合計の最大値

        for (int I = 0; I <= ABCList.Count - 1; I++) {
            Func<int, int, int, int> wkFunc = (pPrevSum1, pPrevSum2, CurrVal) =>
            {
                return Math.Max(pPrevSum1 + CurrVal, pPrevSum2 + CurrVal);
            };

            int NewPrevASumMax = wkFunc(PrevBSumMax, PrevCSumMax, ABCList[I].A);
            int NewPrevBSumMax = wkFunc(PrevASumMax, PrevCSumMax, ABCList[I].B);
            int NewPrevCSumMax = wkFunc(PrevASumMax, PrevBSumMax, ABCList[I].C);

            PrevASumMax = NewPrevASumMax;
            PrevBSumMax = NewPrevBSumMax;
            PrevCSumMax = NewPrevCSumMax;
        }
        int Answer = Math.Max(PrevASumMax, PrevBSumMax);
        Answer = Math.Max(Answer, PrevCSumMax);
        Console.WriteLine(Answer);
    }
}


Measured memory_bytes: 51308
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
int main(void){
	int a, b, c, d;
	fscanf(stdin, "%d%d%d%d", &a, &b, &c, &d);
	if ((a == b&&c == d) || (a == c&&b == d) || (a == d&&b == c)) puts("yes");
	else puts("no");
	return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
 
using namespace std;
 
const long long MOD=1e9+7;
const double PI=3.14159265359;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n,a;
    cin>>n>>a;
    
    cout<<(n%500<=a?"Yes":"No");
    return 0;
}

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

using namespace std;

int n,m;

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

Measured memory_bytes: 3824
#include <iostream>
using namespace std;
typedef long long ll;
ll n, ma, mb, a, b, c, d[45][500][500], res;
const ll INF = 1000000000000000000;
int main(void){
    // Your code here!
    cin >> n >> ma >> mb;
    for (ll i = 0; i <= 450; i++) {
        for (ll j = 0; j <= 450; j++) {
            for (ll k = 0; k <= n; k++) {
                d[k][i][j] = INF;
            }
        }
    }
    d[0][0][0] = 0;
    for (ll i = 1; i <= n; i++) {
        cin >> a >> b >> c;
        for (ll j = 0; j <= 450; j++) {
            for (ll k = 0; k <= 450; k++) {
                if (d[i - 1][j][k] == INF) continue;
                d[i][j][k] = min(d[i][j][k], d[i - 1][j][k]);
                d[i][j + a][k + b] = d[i - 1][j][k] + c;
            }
        }
    }
    res = INF;
    for (ll i = 1; i <= 400 / max(ma, mb); i++) {
        res = min(res, d[n][i * ma][i * mb]);
    }
    cout << (res == INF ? -1 : res) << endl;
}


Measured memory_bytes: 81920
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXLEN=8000;

char s[MAXLEN+1]; int len;
int tx,ty;

bool reach[MAXLEN+1];

bool can(int want,const vector<int> &a) {
	want=abs(want);
	int sum=0; REPSZ(i,a) sum+=a[i];
	//printf("want=%d sum=%d\n",want,sum);
	if(sum<want||(want+sum)%2==1) return false;
	int need=(want+sum)/2;
	//printf("need=%d\n",need);
	memset(reach,false,sizeof(reach)); reach[0]=true; int sofar=0;
	REPSZ(i,a) { for(int j=sofar;j>=0;--j) if(reach[j]) reach[j+a[i]]=true; sofar+=a[i]; }
	return reach[need];
}

void run() {
	scanf("%s%d%d",s,&tx,&ty); len=strlen(s);
	vector<int> dx,dy;
	int state=-1,cnt=0;
	REPE(i,len) {
		char c=i<len?s[i]:'T';
		if(c=='T') { if(cnt!=0&&state==0) dy.PB(cnt); if(cnt!=0&&state==1) dx.PB(cnt); state=state==0?1:0,cnt=0; }
		if(c=='F') if(state==-1) --tx; else ++cnt;
	}
	//printf("(%d,%d) x:",tx,ty); REPSZ(i,dx) printf(" %d",dx[i]); printf(" y:"); REPSZ(i,dy) printf(" %d",dy[i]); puts("");
	printf("%s\n",can(tx,dx)&&can(ty,dy)?"Yes":"No");
}

int main() {
	run();
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<math.h>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug" << x << endl;
using namespace std;

int main(){
    int n, m;
    while(cin >> n >> m, m){
        int inp, tsum = 0, hsum = 0;
        int ansA = -1, ansB = -1;
        vector<int> taro;
        vector<int> hanako;
        rep(i, n){
            cin >> inp;
            tsum+= inp;
            taro.push_back(inp);
        }
        rep(i, m){
            cin >> inp;
            hsum+= inp;
            hanako.push_back(inp);
        }
        sort(taro.begin(), taro.end());
        sort(hanako.begin(), hanako.end());
        if((tsum + hsum) % 2 == 1){
            cout << -1 << endl;
            continue;
        }
        bool flag = false;
        rep(i, taro.size()){
            if(flag) break;
            rep(j, hanako.size()){
                if(flag) break;
                if(tsum - taro[i] + hanako[j] == hsum - hanako[j] + taro[i]){
                    ansA = i;
                    ansB = j;
                    flag = true;
                }
            }
        }
            if(ansA != -1)
                cout << taro[ansA] << ' ' << hanako[ansB] << endl;
            else
                cout << -1 << endl;
    }
}

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

using namespace std;

int main() {
  string S;
  int K;
  cin >> K >> S;
  if (S.length() <= K) {
    cout << S << endl;
  } else {
    cout << S.substr(0, K) << "..." << endl;
  }
  return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	int n; cin >> n;
	string s; cin >> s;
	if (n % 2 == 1)cout << "No" << endl;
	else
	{
		if (s.substr(0, n / 2) == s.substr(n / 2, n / 2))
		{
			cout << "Yes" << endl;
		}
		else
		{
			cout << "No" << endl;
		}
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define INIT  ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define mp make_pair
#define pb push_back
#define ft first
#define sc second
#define ll long long
#define pii pair<int, int>







int32_t main(){
INIT
string s, t;
cin>>s>>t;
for(int i=0; i<t.length()-1; i++){
    if(s[i]!=t[i]){cout<<"No\n"; return 0;}
}
cout<<"Yes\n";

return 0;
}


Measured memory_bytes: 3640
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n = I()
    ans = float("inf")
    for i in range(n+1):
        m = 0
        k = i
        while k > 0:
            m += k%6
            k //= 6
        k = n-i
        while k > 0:
            m += k%9
            k //= 9
        if m < ans:
            ans = m
    print(ans)
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#I
def I_():
    return

#J
def J():
    return

#Solve
if __name__ == "__main__":
    A()


Measured memory_bytes: 39280
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kein Yukiyoshi
 */

#include "bits/stdc++.h"
#define int long long
#define rep(i, n)           for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b)        for (int i = (int)(a); i < (int)(b); i++)
#define FOR(i, a)           for (auto &i : a)
#define ALL(obj)            begin(obj), end(obj)
#define MAX(x)              *max_element(ALL(x))
#define MIN(x)              *min_element(ALL(x))
#define SUM(x)              accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))

using namespace std;
const int MOD    = (int)(1e9 + 7);
const int INF    = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI  = acos(-1);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int a, int b) {                                                             //return x^y in order(log(y))
  int res = 1;
  for (a %= MOD; b; a = a * a % MOD, b >>= 1)
    if (b & 1) res = res * a % MOD;
  return res;
}

class CTsundoku {
public:
  static void solve(istream &cin, ostream &cout) {
    int N, M, K;
    cin >> N >> M >> K;
    int ans = 0;
    vector<int> A(N + 1);
    vector<int> B(M + 1);
    rep(i, N) cin >> A[i + 1];
    rep(i, M) cin >> B[i + 1];
    rep(i, N) A[i + 1] += A[i];
    rep(i, M) B[i + 1] += B[i];
    rep(i, N + 1) {
      if (A[i] > K) {
        break;
      }
      ans = max(ans, i + UPPER_BOUND(B, K - A[i]) - 1);
    }
    cout << ans << endl;
  }
};


signed main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
  CTsundoku solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}


Measured memory_bytes: 6372
import collections
N = int(input())
As = list(map(int, input().split()))

c = collections.Counter(As)

sum_ = 0
for key, val in c.items():
  sum_ += (val*(val-1)/2)

sum_ = int(sum_)

for i in range(N):
  print(sum_-(c[As[i]]-1))

Measured memory_bytes: 87756
/*
 * atcoder/abc157/a.cpp
 */

// C++ 14
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <math.h>
#include <cstring>

#define ll long long
#define Int ll
#define loop(__x, __start, __end) for(Int __x = __start; __x < __end; __x++)
#define loopdown(__x, __start, __end) for(Int __x = __start; __x > __end; __x--)
#define rep(__n) for(Int __x = 0; __x < __n; __x++)
#define span(__a,__x,__y) __a.begin()+__x,__a.begin()+__y
#define span_all(__a) __a.begin(),__a.end()
#define len(__x) (__x.size())
#define last(__x) (__x[__x.size()-1])

using namespace std;

struct Point {
  Int x, y;
  Point(Int x, Int y): x(x), y(y) {}
  Point(): x(0), y(0) {}

  Point operator + (Point v) { return Point(x + v.x, y + v.y); }
  Point operator - (Point v) { return Point(x - v.x, y - v.y); }
  bool operator == (const Point &v) const {
    return x == v.x && y == v.y;
  }
  bool operator< (const Point &p1) const {
    return x < p1.x && y < p1.y;
  }
};
ostream & operator << (ostream & out, Point const & v) {
  out << "Point(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Point & v) {
  Int x, y;
  in >> x; in >> y; v.x = x; v.y = y;
  return in;
}

// Geometry

#define EPS 0.0000000001

class Vector2 {
public:
  double x, y;
  
  Vector2(double x = 0, double y = 0): x(x), y(y) {}
  
  Vector2 operator + (Vector2 v) { return Vector2(x + v.x, y + v.y); }
  Vector2 operator - (Vector2 v) { return Vector2(x - v.x, y - v.y); }
  Vector2 operator * (double k) { return Vector2(x * k, y * k); }
  Vector2 operator / (double k) { return Vector2(x / k, y / k); }
  
  double length() { return sqrt(norm()); }
  double norm() { return x * x + y * y; }
  double dot (Vector2 v) { return x * v.x + y * v.y; }
  double cross (Vector2 v) { return x * v.y - y * v.x; }
  
  bool operator < (const Vector2 &v) const {
    return x != v.x ? x < v.x : y < v.y;
  }
  
  bool operator == (const Vector2 &v) const {
    return fabs(x - v.x) < EPS && fabs(y - v.y) < EPS;
  }
};

ostream & operator << (ostream & out, Vector2 const & v) { 
  out<< "Vector2(" << v.x << ", " << v.y << ')';
  return out;
}

istream & operator >> (istream & in, Vector2 & v) { 
  double x, y;
  in >> x;
  in >> y;
  v.x = x;
  v.y = y;
  return in;
}

Int N;

void input() {
  cin >> N;
}

void solve() {
  cout << (N/2)+(N%2) << endl;
}

int main() {
  input();
  solve();
  return 0;
}


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

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

    int tmp = min(a, b);
    int cnt = 0;
    for(int i=tmp; i>=1; i--){
        if(a%i==0 && b%i==0){
            cnt++;
        }

        if(cnt==k){
            cout << i << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
n = int(input())
hlst = list(map(int, input().split()))
flglst = []
for i in range(n-1):
    if hlst[i] >= hlst[i+1]:
        flglst.append(1)
    else:
        flglst.append(0)

#print(flglst)
ln = 0
maxln = 0
for j in range(n-1):
    if flglst[j] == 1:
        ln += 1
    elif flglst[j] == 0:
        maxln = max(maxln, ln)
        ln = 0
    maxln = max(maxln, ln)
print(maxln)


Measured memory_bytes: 14252
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<ll,pair<ll,ll>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

ll n, k;
vector<int> p(6000), c(6000);

ll solve(int s){
    vector<bool> b(n, true);
    ll l = 1, now = s;
    while(b[p[now]]){b[now] = false; now = p[now]; l++;}
    vector<ll> score(l, 0); 
    now = s; 
    rep(i, l){
        now = p[now];
        if(i)score[i] += score[i-1];
        score[i] += c[now];
    }

    ll ret = -inf;
    rep(i, min(l, k))chmax(ret, score[i]);
    if(l < k){
        rep(i, l){
            if(k % l <= i && k/l > 0){
                chmax(ret, score[l-1] * (k/l-1) + score[i]);
            }else{
                chmax(ret, score[l-1] * (k/l) + score[i]);
            }
        }
    }
    return ret;
}

int main(){
    cin >> n >> k;
    rep(i, n){cin >> p[i]; p[i]--;}
    rep(i, n)cin >> c[i];
    ll ans = -inf;
    rep(i, n)chmax(ans, solve(i));
    cout << ans << endl;
}

Measured memory_bytes: 3644
/*
* Author. Silviase(@silviasetitech)
* For AtCoder
*/

import java.util.*;
import java.lang.*;
import java.math.*;


public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
     
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println(Math.min(a,b)+" "+Math.max(a+b-n,0));



        sc.close();

    }

    public static void intArrayScan(int[] array) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }
        sc.close();
    }

    public static void longArrayScan(long[] array, int n) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextLong();
        }
        sc.close();
    }

    public static void intArrayPrint(int[] array) {
        for (int i = 0; i < array.length; i++) {
            System.out.println(array[i]);
        }
    }

    public static void intSquareArrayScan(int[][] array, int h, int w) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                array[i][j] = sc.nextInt();
            }
        }
        sc.close();
    }

    public static void intArrayListScan(List<Integer> list, int n) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < n; i++) {
            list.add(sc.nextInt());
        }
        sc.close();
    }

    public static void intArrayListPrint(List<Integer> list) {
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));  
        }
    }
}

Measured memory_bytes: 22996
s = input()
n = len(s)
i = 0
ans = n
flg = 1
while i < n - 1:
  if flg and s[i] == s[i + 1]:
    i += 1
    ans -= 1
    flg = 0
  else:
    flg = 1
  i += 1
print(ans)

Measured memory_bytes: 40560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner scan = new Scanner(System.in);
		 int N = scan.nextInt();
		 int D = scan.nextInt();
		 int result;
		 
		 if (N % (2 * D + 1) == 0) {
			 result = N / (2 * D + 1);
		 } else {
			 result = N / (2 * D + 1) + 1;
		 }
		 
		 
		 System.out.println(result);
		 scan.close();
	}

}


Measured memory_bytes: 21716
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

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

typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define intv(x, a, b)((x)>=a && (x)<=b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define  _for(i, end) for (__typeof(end) i = 0; i < (end); i += 1)
#define all(x) (x).begin(),(x).end()
//#define len(array)  (sizeof(array)/sizeof((array)[0]))
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
const double PI = 2 * acos(.0);
const int INF = 0x3f3f3f3f;
const ll LLINF = 1000000000000000005LL;;
const ll MOD = (ll) (1e9) + 7;
void _mod(ll &x){x = mod(x, MOD);}
//const ll MOD = (ll) 998244353 ;
const double EPS = 1e-10;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *) array, (T *) (array + N), val);
}


//#define int ll

struct rest{
        int id;
        string s;
        int price;
         friend bool operator <(const rest l, const rest r){
            if(r.s == l.s)return l.price > r.price;
            return l.s < r.s;
        }
    };
class BGuidebook {
public:
    rest R[101];

void solve(std::istream& cin, std::ostream& cout) {
    int N;
    cin >> N;
    _for(i,N){
        string s;
        int p;
        cin >> s >> p;
        R[i] = {i+1, s, p};
    }
    sort(R, R+N);
    _for(i,N)cout << R[i].id << endl;
}
};


#undef int
int main() {
	BGuidebook solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
template<typename T = int>inline T in() { T x; cin >> x; return x; }
#define INF           1e9
#define INFL          static_cast<ll>(INF)
#define REP(i,n)      for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)     for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPI(i,ini,n) for(ll i=(ini),i##_len=(n);i<i##_len;++i)
#define REPC(i,obj)   for(auto i:obj)
#define R_UP(a,b)     (((a)+(b)-1)/(b))
#define ALL(obj)      (obj).begin(),(obj).end()
int main()
{
	int n = in();
	if (n % 2 == 0)cout << n << endl;
	else cout << 2 * n << endl;
	return 0;
}

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

int main() {
    int n, m, a, b;
    cin >> n >> m;
    vector<int> h(n+1);
    for (int i = 1; i <= n; i++) cin >> h[i];
    vector<vector<int>> l(n+1);
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        l[a].push_back(b);
        l[b].push_back(a);
    }

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        int ls = l[i].size();
        bool f = true;
        for (int j = 0; j < ls; j++) {
            int k = l[i][j];
            if (h[i] <= h[k]) {
                f = false;
                break;
            }
        }
        if (f) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8724
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;

int main()
{
	LL S;
	cin >> S;
	int l = 0, r = 1e9;
	while(l < r) {
		int mid = l + r >> 1;
		if(1LL * mid * mid < S) l = mid + 1;
		else r = mid;
	}
	if(r >= 1 && r * (r - 1LL) >= S) printf("%d %d %d %d %d %d\n", 0, 0, r, 1, 1LL * r * (r - 1) - S, r - 1);
	else printf("%d %d %d %d %d %d\n", 0, 0, r, 1, 1LL * r * r - S, r);
	return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
const int N=1000005;
int n,a,b,nn;
int ans[N];
int bin[N];
void solve (int n,int A,int B,int l,int r)
{
	if (n==1){ans[l]=A;ans[r]=B;return ;}
	int mid=(l+r)>>1;
	int C=(A^B);
	int t=C&(-C);//找到一位大家不一样的
	int x=A%t+A/(t<<1)*t;//去掉这一位
	int y=B%t+B/(t<<1)*t;//去掉这一位
	int z=x^1;
	solve(n-1,x,z,l,mid);solve(n-1,z,y,mid+1,r); 
	for (int u=l;u<=mid;u++)
	{
		ans[u]=ans[u]%t+ans[u]/t*(t<<1)+(A&t);
	}
	for (int u=mid+1;u<=r;u++)
	{
		ans[u]=ans[u]%t+ans[u]/t*(t<<1)+(B&t);
	}
}
int main()
{ 
//freopen("b.out","w",stdout);
	scanf("%d%d%d",&n,&a,&b);nn=(1<<n)-1;
	for (int u=1;u<=nn;u++) bin[u]=bin[u>>1]+(u&1);
	if ((bin[a]&1)==(bin[b]&1))	{printf("NO\n");return 0;}
	solve(n,a,b,0,nn);
	printf("YES\n");
	for (int u=0;u<=nn;u++) printf("%d ",ans[u]);
	return 0;
}

Measured memory_bytes: 5632