akhauriyash/Code-Regression huggingface dataset:
def getans(v,K):
    k=0
    now=v
    while K>0:
        if K&1:
            now=doubling[k][now]
        K=K>>1
        k+=1
    return now

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

doubling=[[-1]*N for i in range(61)]
for i in range(N):
    doubling[0][i]=A[i]-1
for k in range(1,61):
    for i in range(N):
        doubling[k][i]=doubling[k-1][doubling[k-1][i]]
print(getans(0,K)+1)

Measured memory_bytes: 174916
using System;
using System.Linq;

namespace ABC137_C___Green_Bin
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var strs = new string[N];
            for (int i = 0; i < N; i++) strs[i] = Console.ReadLine();
            int[] primes = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101 };
            var strs2 = new long[N];
            for (int i = 0; i < N; i++)
            {
                strs2[i] = 1;
                for (int j = 0; j < strs[i].Length; j++)
                {
                    strs2[i] *= primes[strs[i][j] - 'a'];
                }
            }

            strs2 = strs2.OrderBy(n => n).ToArray();
            long result = 0;
            long count = 1;
            for (int i = 1; i < N; i++)
            {
                if (strs2[i] == strs2[i - 1])
                {
                    count++;
                }
                else
                {
                    result += count * (count - 1) / 2;
                    count = 1;
                }
            }
            result += count * (count - 1) / 2;
            Console.WriteLine(result);
        }

    }
}


Measured memory_bytes: 29404
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n; cin >> n;
	int res = 0;
	for (int i = 0; i < n; i++)
	{
		int a; cin >> a;
		if(i % 2 == 0 && a % 2 == 1) res++;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;scanf("%d",&n);
    vector<int> a(n),p(n,1e9+7);
    for(int i=0;i<n;i++)scanf("%d",&a[n-1-i]);
    for(int i=0;i<n;i++){
        *upper_bound(p.begin(),p.end(),a[i])=a[i];
    }
    int ans=lower_bound(p.begin(),p.end(),1e9+7)-p.begin();
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        var res = 0;
        var left = 0;
        var right = str.Length - 1;
        while (right > left)
            if (str[right] == str[left])
            {
                right--;
                left++;
            }
            else if (str[right] == 'x')
            {
                res++;
                right--;
            }
            else if (str[left] == 'x')
            {
                res++;
                left++;
            }
            else
            {
                WriteLine(-1);
                return;
            }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

using namespace std;

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

template <typename T> inline void print(T val) { cout << val << '\n'; }

template <typename Iterator> inline void print(Iterator begin, Iterator end) {
  for (auto it = begin; it != end; it = next(it)) {
    cout << *it << ' ';
  }
  cout << '\n';
}

void solve() {
  ll n;
  cin >> n;

  vector<int> digits;

  if (n == 1) {
    print('a');
    return;
  }

  while (n > 0) {
    n--;
    digits.push_back(n % 26);
    n /= 26;
  }

  /* print(digits.begin(), digits.end()); */
  string ans;

  for (auto i : digits) {
    char x = 'a' + i;
    ans.push_back(x);
  }
  reverse(ans.begin(), ans.end());
  print(ans);
}

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

#ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  solve();

  return 0;
}


Measured memory_bytes: 3680
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) > *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

int main(void) {
	size_t R;

	scanf("%zu", &R);

	if (R >= 2800) {
		puts("AGC");
	}
	else if (R >= 1200) {
		puts("ARC");
	}
	else {
		puts("ABC");
	}

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pii;
typedef vector<pii> vpii;

ll INF = (1ll << 32);
double EPS = 1e-4;

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

  vi x(N), y(N), z(N);
  for (ll i = 0; i < N; i++) {
    cin >> x[i] >> y[i] >> z[i];
  }

  ll ans = 0;

  for (ll i = 0; i < 2; i++) {
    for (ll j = 0; j < 2; j++) {
      for (ll k = 0; k < 2; k++) {
        vpii v;
        for (ll l = 0; l < N; l++) {
          ll tmp = 0;
          if (i) tmp += x[l]; else tmp -= x[l];
          if (j) tmp += y[l]; else tmp -= y[l];
          if (k) tmp += z[l]; else tmp -= z[l];
          v.push_back(make_pair(tmp, l));
        }
        sort(v.begin(), v.end());
        reverse(v.begin(), v.end());
        {
          ll tmp1 = 0, tmp2 = 0, tmp3 = 0;
          for (ll l = 0; l < M; l++) {
            tmp1 += x[v[l].second];
            tmp2 += y[v[l].second];
            tmp3 += z[v[l].second];
          }
          ans = max(ans, abs(tmp1) + abs(tmp2) + abs(tmp3));
        }
      }
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
constexpr long long INFL = 1LL << 60;
constexpr int INF = 1 << 30;

using namespace std;

using ll = long long;
using P = tuple<int, int>;
using iarr = valarray<int>;

int main()
{
    string s;
    cin >> s;
    char pre = s[0];
    int cnt = 0;

    for(int i = 1; i < s.size(); ++i){
        if(pre != s[i]){
            cnt++;
            pre = s[i];
        }
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 512
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b, ll m) {a %= m;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % m;  a = a * a % m;  b >>= 1; }  return res%m; }
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
using namespace std;
int solve()
{
	int n,p;
	cin>>n>>p;
	string s;
	cin>>s;
	if(p==2)
	{
		int ans=0;
		for(int i=0;i<n;i++)
		{
			if((s[i]-'0')%2==0)		ans+=i+1;
		}
		cout<<ans;
		return 0;
	}
	if(p==5)
	{
		int ans=0;
		for(int i=0;i<n;i++)
		{
			if((s[i]-'0')%5==0)		ans+=i+1;
		}
		cout<<ans<<endl;
		return 0;
	}
	reverse(s.begin(),s.end());
	int ans[n],pref[n];
	int p2=1;
	for(int i=0;i<n;i++)
	{
		int x=(s[i]-'0')*power(10,i,p);
		ans[i]=x;
	}
	pref[0]=ans[0]%p;
	for(int i=1;i<n;i++)
		pref[i]=(pref[i-1]+ans[i])%p;
	int sum=0;
	mii mp;
	for(int i=0;i<n;i++)
	{
		if(pref[i]==0)
			sum++;
		sum+=mp[pref[i]];
		mp[pref[i]]++;
	}
	cout<<sum<<endl;

}
signed main()
{
	fastio;
//	test
		solve();
}


Measured memory_bytes: 4116
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define pi 3.141592653589793
typedef vector<int> vi;
typedef vector<ll> vl;
ll gcd(ll a,ll b){
    if(b>a) swap(a,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 rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}
ll com(ll n,ll r){
    ll x=1,y=1;
    ll tmp=n;
    while(tmp>=n-r+1){
        x=x*tmp%mod;
        tmp--;
    }
    while(r>0){
        y=y*r%mod;
        r--;
    }
    return x*rep_jijo(y,mod-2)%mod;
}

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

    rep(i,n){
        int x;
        cin >> x;
        int y=min(x,k-x);
        y*=2;
        ans+=y;
    }
    cout << ans <<endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char s[200100];
int main(){
    int l,r;
    cin>>s;
    for(int i=0;i<strlen(s);i++)
        if(s[i]=='A'){
            l=i;
            break;
        }
    for(int i=strlen(s)-1;i>=0;i--)
        if(s[i]=='Z'){
            r=i;
            break;
        }
    cout<<r-l+1<<endl;
    return 0; 
} 

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

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

    vector <int> p(N);

    int ans = 0;

    for (int i = 0; i < N; ++i) {
        cin >> p[i];
    }

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

    for (int i = 0; i < K; ++i) {
        ans += p[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3608
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(0, 1); \
                 auto rnd = bind(__dis, __gen);

const int INF = 1E18;
const int mod = 1E9 + 7;

int32_t main() {
    fastIO();
    
    int a, b, c;
    cin >> a >> b >> c;
    
    if ((a == 5) + (b == 5) + (c == 5) == 2 and (a == 7) + (b == 7) + (c == 7) == 1) cout << "YES\n";
    else cout << "NO\n";
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int n,a,b,res;
inline int sum(int x)
{
	int s=0;
	while(x)
	{
		s+=x%10;
		x/=10;
	}
	return s;
}
int main()
{
	scanf("%d%d%d",&n,&a,&b);
	for(register int i=1;i<=n;i++)
		if(sum(i)>=a&&sum(i)<=b) res+=i;
	printf("%d\n",res);
	return 0;
}

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

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

    int ans = 0;
    int c = 1;

    while(1){
        if(c >= b){
            break;
        }
        c -= 1;
        c += a;
        ans++;
    }

    cout << ans << endl;    
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#define STR 1000
int main(){
    long long x;
    long long cnt=0;
    long long money=100;
    scanf("%lld",&x);
    while(money < x){
        money += money / 100;
        cnt+=1;
    }
    printf("%lld",cnt);
    return 0;
}

Measured memory_bytes: 1704
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main(){
  int n,sum=0;
  cin>>n;
  string s1,s2,s3;
  int a[n],b[n];
  for(int i=0;i<n;i++){
    cin>>a[i];
    s2.push_back(a[i]+'0');
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
    s3.push_back(b[i]+'0');
  }
  for(int i=1;i<=n;i++){
    s1.push_back(i+'0');
  }
  string s4=s1;
  int i=0;
  do{
    i++;
    if(s1==s2){
      break;
    }
    //i++
  }while(next_permutation(s1.begin(),s1.end()));
  int fi=i;
  i=0;
  do{
    i++;
    if(s4==s3){
      break;
    }
    //i++
  }while(next_permutation(s4.begin(),s4.end()));
  int se=i;
  cout<<abs(se-fi);
  return 0;
}

Measured memory_bytes: 256
use proconio::input;

#[allow(non_snake_case)]
fn main() {
    input! {
        mut X: u128,
    }
    let mut a = 100u128;
    for i in 1..4000 {
        a = a * 101 / 100;
        if a >= X {
            println!("{}", i);
            return;
        }
    }
}


Measured memory_bytes: 2132
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
#define mall (nxd*)mallxc(sizexf(nxd))
using namespace std;
typedef long long ll;
ll a[200005];
ll b[200005];
ll n;
bool ok(ll x)
{
	for(ll i=1;i<=x;i++)
	{
		ll aa=n-x+i;
		if(a[aa]<=b[i]) return false;
	}
	return true;
}
bool kk(ll x)
{
	for(ll i=1;i<=x;i++)
	{
		ll bb=n-x+i;
		if(a[i]>=b[bb]) return false;
	}
	return true;
}
ll f1(ll l,ll r)
{
	ll m=(l+r)/2;
	if(l==r)
	{
		if(!ok(m)) return m-1;
		return m;
	}
	if(ok(m)) return f1(m+1,r);
	else return f1(l,m);
}
ll f2(ll l,ll r)
{
	ll m=(l+r)/2;
	if(l==r)
	{
		if(!kk(m)) return m-1;
		return m;
	}
	if(kk(m)) return f2(m+1,r);
	else return f2(l,m);
}
int main(void)
{
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(ll i=1;i<=n;i++) scanf("%lld",&b[i]);
	ll a1=f1(1,n);
	ll a2=f2(1,n);
//	printf("%lld %lld\n",a1,a2);
	if(a1+a2>=n)
	{
		puts("Yes");
		for(ll i=n-a2+1;i<=n;i++) printf("%lld ",b[i]);
		for(ll i=1;i<=n-a2;i++) printf("%lld ",b[i]);
	}
	else
	{
		puts("No");
	}
}

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

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

  vector<int64_t> h(n);

  for(int i=0; i<n; i++){
    cin >> h.at(i);
  }

  vector<pair<int, int>> path(m);

  for(int i=0; i<m; i++){
    int f,s;
    cin >> f >> s;
    if(f > s){
      int pool = s;
      s = f;
      f = pool;
    }
    path.at(i) = make_pair(f,s);
  }

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

  vector<bool> checker(n, true);

  int a = path.at(0).first;
  pair<int, int> forward_path;
  for(int i=0; i<m; i++){
    // if(path.at(i) == forward_path) continue;

    if(path.at(i).first == a){
      if(h.at(path.at(i).first-1) < h.at(path.at(i).second-1)){
        checker.at(a-1) = false;
      }else if(h.at(path.at(i).first-1) == h.at(path.at(i).second-1)){
        checker.at(a-1) = false;
        checker.at(path.at(i).second-1) = false;
      }else{
        checker.at(path.at(i).second-1) = false;
      }
    }else if(path.at(i).first != a){
      a = path.at(i).first;
      if(h.at(path.at(i).first-1) < h.at(path.at(i).second-1)){
        checker.at(a-1) = false;
      }else if(h.at(path.at(i).first-1) == h.at(path.at(i).second-1)){
        checker.at(a-1) = false;
        checker.at(path.at(i).second-1) = false;
      }else{
        checker.at(path.at(i).second-1) = false;
      }
    }

    forward_path = path.at(i);
  }

  int count = 0;
  for(int i=0; i<n; i++){
    if(checker.at(i) == true) count++;
  }

  cout << count << endl;
}


Measured memory_bytes: 4772
#define _GLIBCXX_DEBUG

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

int countPrimeNumbers(vector<int>& data, int N){
    int count = 0;
    int sq;

    rep(i, N){
        bool flag = true;
        int num = data.at(i);

        if(num <= 1) continue;
        if(num == 2){
            count++;
            continue;
        }
        if(num % 2 == 0) continue;

        sq = sqrt(num);
        for(int j = 3; j <= sq + 1; j++){
            if(num % j == 0){
                flag = false;
                break;
            }
        }
        if(flag) count++;
    }
    return count;
}

int main(){
    int N;
    int count;
    cin >> N;
    
    vector<int> data(N);
    rep(i, N)
    {
        cin >> data.at(i);
    }

    count = countPrimeNumbers(data, N);
    cout << count << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;

#define imx INT_MAX
#define imn INT_MIN
#define llmx LLONG_MAX
#define llmn LLONG_MIN

#define fi first
#define se second
#define pb push_back
#define f_s(a) sort(a.begin(), a.end())
#define b_s(a) sort(a.rbegin(), a.rend())
#define p(a) cout<<a<<"\n"
// #define l(i, )
// #define rl(i, a, b) for(int i = a; i < b; i++)

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


////////////////////SIEVE OF ERATOSTHENES//////////////////////
vector<int> sieveoferatosthenes(int n)
{
	vector<bool> prime(n+1, true);
	for(int i = 2; i <= sqrt(n); i++)
	{
		if(prime[i])
		{
			for(int j = i*i; j<=n; j+=i)
			{
				prime[j]=false;
			}
		}
	}
	vector<int> all_primes;
	for(int i = 2; i <=n; i++)
	{
		if(prime[i]) all_primes.pb(i);
	}
	return all_primes;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll x;
	cin>>x;
	ll start =100;
	int i = 0;
	while(start < x)
	{
		start= (start+(start*1)/100);
		i++;
	}
	cout<<i<<endl;
}

Measured memory_bytes: 3624
a, b, k = [int(i) for i in input().split()]

counter = 0
for i in range(k):
    if a % 2 == 1:
        a -= 1
    b += int(a/2)
    a = int(a/2)
    counter += 1
    if counter >= k:
        print("{} {}".format(a, b))
        exit()

    if b % 2 == 1:
        b -= 1
    a += int(b/2)
    b = int(b/2)
    counter += 1
    if counter >= k:
        print("{} {}".format(a, b))
        exit()

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

using db = double;
const db eps = 1e-6;

int main() {
	cout << fixed << setprecision(3);
	ios :: sync_with_stdio(false);
	db a, b, c, d, e, f;
	while(cin >> a >> b >> c >> d >> e >> f) {
		db x = (c * e - b * f) / (a * e - b * d);
		db y = (a * f - c * d) / (a * e - b * d);
		if(x > -eps && x < eps) x = 0;
		if(y > -eps && y < eps) y = 0;
		cout << x << ' ' << y << '\n';
	}
	return 0;
}

Measured memory_bytes: 3280
import sys
input = sys.stdin.readline

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

SC=[0,0,0]#1個,2個,3個

for a in A:
    SC[a-1]+=1
one,two,three=SC

DAYSDICT=[[[0.0]*301 for j in range(301)] for k in range(301)]
DAYSDICT[0][0][0]=0
def days(one,two,three):
    ANS=N
    if one>0:
        ANS+=DAYSDICT[one-1][two][three]*one
    if two>0:
        ANS+=DAYSDICT[one+1][two-1][three]*two
    if three>0:
        ANS+=DAYSDICT[one][two+1][three-1]*three
        
    DAYSDICT[one][two][three]=ANS/(one+two+three)


for k in range(three+1):
    for j in range(two+three+1-k):
        for i in range(one+two+three+1-j-k):
            if i==j==k==0:
                continue
            days(i,j,k)

print(DAYSDICT[one][two][three])

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<std::vector<char> > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<std::vector<double> > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<std::vector<bool> > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int d, g; 
    cin >> d >> g;
    
    v_int p(d, 0), c(d, 0);

    irep(i, d) {
        cin >> p[i] >> c[i]; 
    }

    int ans = INF;
    for(int i = 0; i < (1<<d); i++) {
        int sum = 0;
        int cnt = 0;
        for(int j = 0; j < d; j++) {
            if(i & (1 << j)) {
                sum += 100 * (j+1) * p[j] + c[j];
                cnt += p[j];
            }
        }
        if(sum >= g) {
            ans = min(ans, cnt);
        } else {
            int k = 0;
            for(int j = d - 1; j > -1; j--) {
                if((~i) & (1 << j)) {
                    k = j;    
                    break;
                }
            } 
            
            irep(j, p[k]) {
                sum += 100 * (k+1);
                cnt++;    
                if(sum >= g) {
                    ans = min(ans, cnt); 
                    break;
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}
/** atcoder **/


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <cassert>
#include <climits>

using namespace std;

//typedef __int64 lint;

const double EPS = 1e-10;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const int INF = 1001001001;
//const lint INFLL = (__int64)1001001001001001001;

#define clear(a) memset((a), 0, sizeof(a))
#define mclear(a) memset((a), -1, sizeof(a))

#define show(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main()
{
	for (int i = 0; i < 7; i++){
		int x, y;
		scanf("%d %d", &x, &y);
		printf("%d\n", x - y);
	}
	
	return (0);
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FT first
#define SC second
#define MP make_pair
#define PB push_back

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;
const int INF = 1e9;
const double EPS = 1e-9;



int main()
{
  ll n ;
  cin >> n ;
  ll count = 0 ;
  ll ans = 0 ;
  vector<string> str(n) ;
  REP(i,n){
    cin >> str.at(i) ;
    sort(ALL(str.at(i))) ;
  }
  sort(ALL(str)) ;
  
  REP(i,n-1){
    if(str.at(i)==str.at(i+1)){
      count++ ;
      ans += count ;
    }
    else{
      count = 0 ;
    }
  }
  
  cout << ans <<endl ;
      

  return 0 ;
}

Measured memory_bytes: 7296
#include <cstdio>
#include <cstring>
#include <iostream>

int main() {
    std::string s;
    register int tot = 0;

    std::getline(std::cin, s);

    for(register int i=0; i<=s.size(); ++i) {
        if(s[i] == '+') {
            tot++;
        } else {
            tot--;
        }
    }

    tot ++;

    printf("%d", tot);

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        
        for(int i=0;i<line.length();i++){
            char ch = line.charAt(i);
            if(Character.isLowerCase(ch)){
                String s = String.valueOf(ch);
                s = s.toUpperCase();
                System.out.printf("%s",s);
            }else if(Character.isUpperCase(ch)){
                String s = String.valueOf(ch);
                s = s.toLowerCase();
                System.out.printf("%s",s);
            }else{
                System.out.printf("%c",ch);
            }
        }
        System.out.println();
    }
}


Measured memory_bytes: 30288
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using ll=long long;
using ld=long double;
//#define int long long
//#define _CRT_SECURE_NO_WARNINGS
#define rep(i, n) for (int i = 0; i < n; i++)
#define _GLIBCXX_DEBUG
const int MOD = 1e9 + 7;
const int INF = 1e18 + 9;
constexpr long double pi = 3.141592653589793238462643383279;
int fact(int i) {
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int keta(int n) {
    if (n == 0) return 1;
    int count = 0;
    while (n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
int ketasum(int n) {
    int sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
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;
}
int r, g, b;
int main(void) {
    cin >> r >> g >> b;
    ((g * 10 + b) % 4 == 0 ? cout << "YES" << endl : cout << "NO" << endl);
    return 0;
}

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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound

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

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

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

int main() {
  string S;
  cin >> S;
  
  if(S.at(0) == '9' || S.at(1) == '9') cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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

int main() {
    int n, temp;
    bool flag = false;
    vector<vector<int>> bingo(3, vector<int>(3)), check(3, vector<int>(3, 0));
    rep(i, 3) rep(j, 3) cin >> bingo.at(i).at(j);
    cin >> n;
    rep(i, n) {
        cin >> temp;
        rep(j, 3) rep(k, 3) if(temp == bingo.at(j).at(k)) check.at(j).at(k) = 1;
    }
    rep(i, 3) {
        bool t = true;
        rep(j, 3) if(!check.at(i).at(j)) t = false;
        if(t) flag = true;
        bool y = true;
        rep(j, 3) if(!check.at(j).at(i)) y = false;
        if(y) flag = true;
    }
    bool c = true;
    rep(i, 3) if(!check.at(i).at(i)) c = false;
    if(c) flag = true;
    c = true;
    rep(i, 3) if(!check.at(i).at(2 - i)) c = false;
    if(c) flag = true;
    if(flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include<algorithm>
#define ff(i,m,n) for(int i=m;i<n;i++)
#define vi vector<int>
using namespace std;

int main() {
	int x;
	cin >> x;
	int d = x % 10;
	int c = (x % 100) / 10;
	int b = (x % 1000) / 100;
	int a = x / 1000;
	if (a + b + c + d == 7) {
		cout << a << "+" << b << "+" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b + c - d == 7) {
		cout << a << "+" << b << "+" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b - c + d == 7) {
		cout << a << "+" << b << "-" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a + b - c - d == 7) {
		cout << a << "+" << b << "-" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b + c + d == 7) {
		cout << a << "-" << b << "+" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b + c - d == 7) {
		cout << a << "-" << b << "+" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b - c + d == 7) {
		cout << a << "-" << b << "-" << c << "+" << d << "=" << 7 << endl;
		return 0;
	}
	if (a - b - c - d == 7) {
		cout << a << "-" << b << "-" << c << "-" << d << "=" << 7 << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import heapq

T = int(input())

for _ in range(T):
  N = int(input())
  res = 0
  Ls,Rs = [[] for _ in range(N)], [[] for _ in range(N)]
  for _ in range(N):
    K,L,R = map(int,input().split())
    m = min(L,R)
    res += m
    L -= m
    R -= m
    if L>0:
      Ls[K-1].append(L)
    else:
      if K != N:
        Rs[K].append(R)


  pq1 = []
  for i in reversed(range(N)):
    for l in Ls[i]:
      heapq.heappush(pq1, -l)
    if pq1:
      p = -heapq.heappop(pq1)
      res += p

  pq2 = []
  for i in range(N):
    for r in Rs[i]:
      heapq.heappush(pq2, -r)
    if pq2:
      p = -heapq.heappop(pq2)
      res += p

  print(res)

Measured memory_bytes: 102788
#include <bits/stdc++.h>
using namespace std;
const int N=2e4+5;
int n,p;
int a[N],b[N];
int main(){
	scanf("%d",&n);
	for (register int i=1; i<=n; ++i) a[i]=i*20001;
	for (register int i=1; i<=n; ++i) b[i]=(n-i+1)*20001;
	for (register int i=1; i<=n; ++i) 
	{
		scanf("%d",&p);
		b[p]-=(n-i+1);
	}
	for (register int i=1; i<=n; ++i) printf("%d ",a[i]); puts("");
	for (register int i=1; i<=n; ++i) printf("%d ",b[i]);
return 0;	
}

Measured memory_bytes: 768
// by DenyTianly
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long LL;

const int inf = 1 << 26;

int a[300005];

int main(){
	int n;
	scanf("%d", &n);
	for ( int i = 1; i <= n; i ++ ) {
		scanf("%d", &a[i]);
	}
	
	for ( int i = n; i >= 1; i -= 2) {
		printf("%d ", a[i]);
	}
	for ( int i = n%2==0?1:2; i <= n; i += 2 ) printf("%d ", a[i]);
	puts("");

	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;cin>>N;
  string S;cin>>S;
  int cnt=0;
  for(int i=0;i<=9;i++){
    for(int j=0;j<=9;j++){
      for(int k=0;k<=9;k++){
        int n=0;
        for(int d=0;d<S.size();d++){
          if(n==0&&S[d]-'0'==i)n++;
          else if(n==1&&S[d]-'0'==j)n++;
          else if(n==2&&S[d]-'0'==k){
            //cout<<i<<j<<k<<endl;
            n++;cnt++;break;
          }
        }
      }
    }
  }
  cout<<cnt<<endl;
}

Measured memory_bytes: 3692
#include<stdio.h>

int main(void){
  int i,j,a[5],k,flag=0;
  for(i=0;i<5;i++){
    scanf("%d\n",&a[i]);
  }
  scanf("%d",&k);

  for(i=0;i<5;i++){
    for(j=0;j<5;j++){
      if((a[i]-a[j]<-k)||(a[i]-a[j])>k)
        flag=1;
    }
  }

  if(flag==1)
    printf(":(\n");
  else
    printf("Yay!\n");

  return 0;
}


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

template<class T> 
void dbg_vector(const vector<T>& v){
    for(const T& a : v){
        cout << a << " ";
    }
    cout << '\n';
}

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

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

    vector<int> vec;
    for(const auto& a : A){
        if(vec.size() == 0) {
            vec.emplace_back(a);
            continue;
        }

        auto it = upper_bound(vec.begin(), vec.end(), a);
        if(it == vec.end()) vec.emplace_back(a);
        else *it = a;
    }

    cout << vec.size() << endl;
}


Measured memory_bytes: 1276
import bisect
N=int(input())
L=list(map(int,input().split()))
L.sort()
ans=0
for i in range(len(L)-1):
  for j in range(i+1,len(L)):
    left=bisect.bisect_left(L, L[i]+L[j])
    if left > j:
      ans+=left-j-1
print(ans)

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

using namespace std;

int ar[100010], vis[100010], ans;

void dfs(int a) {

    vis[a] = 1;
    if(a == 2) {
        cout << ans;
        exit(0);
    }
    if(!vis[ar[a]]) {
            ++ans;
        dfs(ar[a]);
        //++ans;
    }
    else {
        cout << -1;
        exit(0);
    }


}

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

    dfs(1);

    //cout << ans;

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  vector<int> h(10);
  REP(i, 10) cin >> h[i];
  sort(ALL(h));
  REP(i, 3) cout << h[9 - i] << endl;
  return 0;
}


Measured memory_bytes: 3136
#include<stdio.h>
int ketasum(int);
int main(void){
  int N,A,B,sum=0;
  scanf("%d %d %d",&N,&A,&B);
  for(int i=1;i<=N;i++){
    if(ketasum(i)>=A && ketasum(i)<=B){
      sum+=i;
    }
  }
  printf("%d\n",sum);
  return 0;
}
int ketasum(int x){
  int t=0;
  while(x>0){
    t+=(x%10);
    x/=10;
  }
  return t;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    int k,a,b;
    cin>>k>>a>>b;
    bool ok=false;
    for(int i=a; i<=b; ++i){
        if(i%k==0) ok=true;
    }
    cout<<(ok? "OK": "NG")<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>

#define K 10000

int main(){
  int n,i,num,A[2000001],B[2000001],C[K];

  scanf("%d",&n);

  for(i = 1;i <= n;i++){
    scanf("%d",&A[i]);
  }

  for(i = 0;i <= K;i++) C[i] = 0;

  for(i = 1;i <= n;i++) C[A[i]]++;

  for(i = 1;i <= K;i++) C[i] = C[i] + C[i-1];

  for(i = n;i >= 1;i--){
    B[C[A[i]]] = A[i];
    C[A[i]]--;
  }
  for(i = 1;i <= n;i++){
    if(i > 1) printf(" ");
    printf("%d",B[i]);
  }printf("\n");
  return 0;
}



Measured memory_bytes: 17396
/// 11:59 AM 26/04/20
/// Author: t_bone_289 (An Immature Programmer.... I'm still developing !!)
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
#define pll pair<ll,ll>
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
#define endl '\n'
#define M 1000000007
#define error(x) cout << #x << " = " << x << endl;
#define pi 3.14159265358979323846
typedef long long ll;
typedef long double ld;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

template<typename T>
void ContainerError(T &v);

ll powmod(ll base, ll exp, ll MOD);

ll mpow(ll base, ll exp);

ll gcd(ll a, ll b);

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll n;
    cin>>n;
    set<string> s;
    for(ll i=0;i<n;i++) {
        string a;
        cin>>a;
        s.insert(a);
    }
    ll ans = s.size();
    cout<<ans;
    return 0;
}

template<typename T>
void ContainerError(T &v) {
    cout << "{";
    for (auto &x:v) { cout << x << ','; }
    cout << "}" << endl;
    return;
}

ll powmod(ll base, ll exp, ll MOD) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return (res % MOD);
}

ll mpow(ll base, ll exp) {
    ll res = 1;
    while (exp > 0) {
        if (exp % 2 == 1) res = (res * base);
        base = (base * base);
        exp /= 2;
    }
    return (res);
}

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }



Measured memory_bytes: 19244
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    k, x = map(int, input().split())

    print(*range(x - k + 1, x + k))


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()


Measured memory_bytes: 28908
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main()
{
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i = i + 2) {
		cout << s[i];
	}
	cout << endl;
	return 0;
}

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

using namespace std;
typedef long long LL;
typedef pair<int,int> pii;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define all(x) (x).begin(), (x).end()
#define fori(i, n) for (int i = 0; i < (int)(n); ++i)
#define ford(i, n, e) for (int i = (int)(n); i >= (int)(e); --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
template<typename T> bool mmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool mmin(T &m, const T q) { if (m > q) {m = q; return true;} else return false; }
#define RETURN(x) do{cout << (x) << '\n'; return 0;}while(0)

const int MOD = 1e9+7;
const int MAXN = 5e5+3;
const int INF = 1e9;

int main(int argc, char **argv) {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    function<int(int,int)> pw = [&](int x, int p) {
        if(p == 1) return x;
        int r = pw(x,p/2);
        r = 1LL*r*r%MOD;
        if(p%2) r = 1LL*r*x%MOD;
        return r;
    };

    int n,k; cin >> n >> k;
    vector<int> dp(k+1);
    int ans = 0;
    ford(i,k,1) {
        vector<int> v;
        for(int t = 1; t*i <= k; t++)
            v.pb(t*i);

        dp[i] = pw(v.size(),n);
        fore(t,1,v.size()-1) {
            dp[i] = (dp[i]+MOD-dp[v[t]])%MOD;
        }

        ans = (ans + 1LL*i*dp[i]) %MOD;
    }

    cout << ans << endl;
    return 0;
}


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

void solve(long long N, std::vector<long long> A)
{
    long long ans = 1;
    if (find(A.begin(), A.end(), 0) != A.end())
    {
        cout << 0 << endl;
        return;
    }
    for (int i = 0; i < N; i++)
    {
        if (A[i] > 1000000000000000000 / ans)
        {
            ans = -1;
            break;
        }
        else
            ans *= A[i];
    }
    cout << ans << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4016
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main(){


    string S;
    cin >> S;
    int length = S.length();
    int count = 0;
    bool yes = true;

    while(count < S.length()) {

        string temp = S.substr(count, 5);
        if (temp == "dream" || temp == "erase") {
            if (temp == "dream") {
                if ((count + 6) < length && S.substr(count + 5, 2) == "er") {
                    if ((count + 10) < length && S.substr(count + 5, 5) == "erase") {
                        count += 5;
                    } else {
                        count += 7;
                    }
                } else {
                    count += 5;
                }


            } else { // FOR ERASE
                if (S.substr(count, 6) == "eraser") {
                    count += 6;
                } else {
                    count += 5;
                }
            }


        } else {
            yes = false;
            break;
        }


    }


    if (yes) {
        cout << "YES";
    } else {    
        cout << "NO";
    }
    





    return 0;
}

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

int main()
{
    char a,b;
    scanf("%c %c",&a,&b);
    int at=0,top=0;
    if(a=='H')
        at=1;
    if(b=='H')
        top=1;
    if( at==1 && top==1)
        printf("H");
    else if(at==0 && top ==0)
        printf("H");
    else if(at==1 && top ==0)
        printf("D");
    else if(at==0 && top ==1)
        printf("D");
}


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

int main(){
  int x; //動物
  int y; //足
  cin >> x >> y;
  
  for ( int i = 0; i <= x; i++){
    if ( i*2+(x - i)*4 == y ){
      cout << "Yes" << endl;
      break;
    }
    
    if (i == x){
      cout << "No" << endl;
      break;
    }
  }
  
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x,y,m;
  cin>>x>>y;
  if(y%2!=0)
  {
    cout<<"No";
  }
  else
  {
    m=x*2 - (y/2);
    if(m>=0 && m<=x)
    {
      cout<<"Yes";
    }
    else
      cout<<"No";
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
string Yes[2] = {"Yes", "No"};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}

using Graph = vector<vector<int>>;
Graph G;

/*------------------------------------------------------------------*/

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

    int n; cin >> n;
    int ans = 0;
    for(int a = 1; a < n; a++){
        int b = n / a;
        if(a * b >= n) b--;
        ans += b;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3652
#include<stdio.h>

int main()
{
    int k,i,j,c=0;
    scanf("%d",&k);
    if(k>=2&&k<=100)
    {
        for(i=2;i<=k;i++)
        {
            if(i%2==0)
            {
                for(j=1;j<=k;j++)
                {
                    if(j%2!=0)
                        c=c+1;
                }
            }
        }
        printf("%d",c);
    }
    return 0;
}



Measured memory_bytes: 128