akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int n, sum[2] = { 0,0 }, buffer;
	cin >> n;
	vector<int> w(n);
	int f = -1, e = n,flag=0;
	for (int i = 0; i < n; i++) cin >> w[i];
	while (flag==0)
	{
		if (sum[0] <= sum[1])
		{
			f++;
			sum[0] += w[f];
		}
		else
		{
			e--;
			sum[1] += w[e];
		}
		if (e == f+1) flag = 1;
	}
	cout << abs(sum[0] - sum[1]);
}

Measured memory_bytes: 256
#!/usr/bin/python3

import os
import sys


def main():
    V, E, R = read_ints()
    D = [tuple(read_ints()) for _ in range(E)]
    print(*solve(V, E, R, D), sep='\n')


def solve(V, E, R, D):
    INF = 10001 * 1000
    dists = [INF] * V
    dists[R] = 0
    for _ in range(V - 1):
        for s, t, d in D:
            if dists[s] != INF and dists[t] > dists[s] + d:
                dists[t] = dists[s] + d

    for s, t, d in D:
        if dists[s] != INF and dists[s] + d < dists[t]:
            return ['NEGATIVE CYCLE']

    return ['INF' if d == INF else d for d in dists]


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()



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

using namespace std;

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

int N, sz[5001];
int64 mt[5001];
vector< int > g[5000];
vector< int > dp[5001][2];

void dfs(int idx, int par) {

  sz[idx] = 1;
  dp[idx][0] = {0, 1};
  dp[idx][1] = {0, 0};

  for(auto &to : g[idx]) {
    if(to == par) continue;
    dfs(to, idx);

    vector< int > dp2[2];
    dp2[0].resize(sz[idx] + sz[to] + 1);
    dp2[1].resize(sz[idx] + sz[to] + 1);

    for(int i = 0; i < 2; i++) {
      for(int j = 0; j < 2; j++) {
        for(int k = 0; k <= sz[idx]; k++) {
          for(int l = 0; l <= sz[to]; l++) {
            if(k && l) (dp2[i ^ j][k + l] += 1LL * dp[idx][i][k] * dp[to][j][l] % mod) %= mod; // 覆う
            if(l % 2 == 0) (dp2[i ^ j ^ 1][k] += 1LL * dp[idx][i][k] * dp[to][j][l] % mod * mt[l / 2] % mod) %= mod;
          }
        }
      }
    }
    dp[to][0].clear();
    dp[to][1].clear();
    swap(dp[idx], dp2);
    sz[idx] += sz[to];
  }
}

int main() {
  mt[0] = 1;
  for(int i = 1, j = 1; i < 5001; i++, j += 2) {
    mt[i] = mt[i - 1] * j % mod;
  }

  cin >> N;
  for(int i = 1; i < N; i++) {
    int x, y;
    cin >> x >> y;
    --x, --y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(0, -1);
  int64 sum1 = 0, sum2 = 0;
  for(int j = 0; j <= sz[0]; j += 2) {
    sum1 += 1LL * dp[0][0][j] * mt[j / 2] % mod;
    sum2 += 1LL * dp[0][1][j] * mt[j / 2] % mod;
  }
  cout << (sum1 % mod + mod - sum2 % mod) % mod << endl;
}


Measured memory_bytes: 70016
#include <iostream>

/*
[x^Ny^K]  \sum_{t=0}^\infty [(M-1)(x+yx^2+y^2x^3+...)]^t
[x^Ny^K]  1/[1- (M-1)(x+yx^2+y^2x^3+...)]
[x^Ny^K]  1/[1- (M-1)x/(1-yx)]
[x^Ny^K]  (1-yx)/[1-yx - (M-1)x]
[x^Ny^K]  (1-yx) \sum_{i=0}^\infty (yx+(M-1)x)^i

[y^K]  (y+(M-1))^N - y (y+(M-1))^{N-1}
\binom{N}{K} (M-1)^{N-K} - \binom{N-1}{K-1} (M-1)^{N-K}
(M-1)^{N-K} \binom{N-1}{K}

\sum_{i=0}^K (M-1)^{N-i} \binom{N-1}{i}
*/

int n, m, k;

constexpr int mod = 998244353;

using u64 = unsigned long long int;

int modpow(int a, int n){
  int r = 1;
  for(; n; n >>= 1){
    if(n & 1) r = (u64) r * a % mod;
    a = (u64) a * a % mod;
  }
  return r;
}

int main(){
  std::cin >> n >> m >> k;

  u64 ans = 0;
  u64 binom = 1;
  for(int i = 0; i <= k; i++){
    ans += (u64) modpow(m-1, n-i-1) * binom % mod;
    binom = binom * (n-1-i) % mod * modpow(i+1, mod-2) % mod;
  }
  ans %= mod;
  ans = ans * m % mod;
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pw(x) (1ll << (x))
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define rep(i,l,r) for(int i=(l);i<(r);++i)
#define per(i,l,r) for(int i=(r)-1;i>=(l);--i)
#define dd(x) cout << #x << " = " << x << ", "
#define de(x) cout << #x << " = " << x << endl

//-----

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
  int a, b, x; cin >> a >> b >> x;
  cout << (x >= a && x <= a + b ? "YES" : "NO");
	return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>

uint64_t mod = 1000000000 + 7;

uint64_t factorial(uint64_t v)
{
    uint64_t ans = 1;
    for (uint64_t i = 1; i <= v; ++i)
    {
        ans *= i;
        ans %= mod;
    }
    return ans;
}

uint32_t check(int64_t n, int64_t m)
{
    if (std::abs(n-m) > 1) return 0;

    uint64_t n_value = factorial(n);
    uint64_t m_value = factorial(m);

    uint64_t ans = (n_value * m_value) % mod;

    if (n == m) {
        ans *= 2;
        ans %= mod;
    }

    return ans;
}

int main(void)
{
    int64_t n, m;

    std::cin >> n >> m;

    std::cout << check(n, m) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>

using namespace std;
long long int training(long long int n);
long long int mod=pow(10,9)+7;

int main(){
    long long int n;
    cin>>n;
    long long int i;
    long long int ans=1;
    for(i=1;i<=n;i++){
        ans=(ans*i)%mod;
    }
    
    cout<<ans<<endl;
    return 0;
}

long long int training(long long int n){
    if(n==1) return 1;
    else return n*training(n-1)%mod;

}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int sum,n,a[105];
bool cmp(int x,int y){return x>y;}
int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n,cmp);
	for(int i=0;i<n;i+=2){
		sum+=a[i]-a[i+1];
	}
	cout<<sum<<endl;
	return 0;
}

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

namespace V0001{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            sr.Next<int>(10).OrderByDescending(x => x).Take(3).ToList().ForEach(Console.WriteLine);
            //---------------------------------
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = Console.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T) typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T) Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var result = new T[x];
            for(var i = 0; i < x; ++i){
                result[i] = Next<T>();
            }
            return result;
        }

        public T[,] Next<T>(int y, int x){
            var result = new T[y, x];
            for(var i = 0; i < y; ++i){
                for(var j = 0; j < x; ++j){
                    result[i, j] = Next<T>();
                }
            }
            return result;
        }
    }
}

Measured memory_bytes: 10468
from collections import Counter
#from scipy.special import comb
# a = comb(n, r)
# >> cannot use in Contest (like AtCoder)


def cmb(n, r):
    if n - r < r:
        r = n - r
    if r == 0:
        return 1
    if r == 1:
        return n
    if n <= 1:
        return 0

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


N = int(input())
data = list(map(int, input().split()))
count = Counter(data)
#print(count) > Counter({1: 4, 2: 2, 4: 2})
countMost = count.most_common()

lis = [0] * (2 * 10 ** 5)
combination = [0] * (2 * 10 ** 5)
tot = 0
for i, v in countMost:
    #print(i, v)
    lis[i - 1] = v
    val = cmb(v, 2)
    tot += val
    combination[i - 1] = val
#print('TOT', tot)
# print(lis[0])
for i, v in enumerate(data):
    num = lis[v - 1]
    if (num == 2):
        #    print('a')
        ans = tot - 1
    else:
        ans = tot - combination[v-1] + cmb(num-1, 2)

    print(ans)
'''
dataSort = data.sort()
print(countMost)
print(len(countMost))
'''


Measured memory_bytes: 31516
#include <iostream>
using namespace std;
typedef long long ll;  
  
int main(){
  ll a,b,c,d,e,f,g;
  cin>>a>>b>>c>>d>>e>>f>>g;
  ll ans=b;
  if(a>0&&d>0&&e>0){
    ll cnt=a%2+d%2+e%2;
    if(cnt>=2){
      ans+=3;a--;d--;e--;
      }
    }
  
  ans+=(a/2+d/2+e/2)*2;
  cout<<ans<<endl;
  return 0;
  }


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

// #define ANS  //for answer
#define CMP  //for compe

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
#define nv(x) #x,(x)
#define ncv(x) #x,":",(x)
#define ncvc(x) #x,":",(x),","
using ll = long long;
void pPRINT(std::ostream& ost) {}
template <class T, class... U>void pPRINT(std::ostream& ost,const T t,const U... u) {ost<<t<<" ";pPRINT(ost, u...);}
template <class... T>void PRINT(const T... t) {pPRINT(std::cout, t...);}
template <class... T>void PRINTl(const T... t){pPRINT(std::cout,t...);std::cout<<"\n";}
template <class T>void PRINTa(const T* const t,const ll size){REP(i,size)PRINT(t[i]);PRINTl();}
template <class T>void PRINTal(const T* const t,const ll size){REP(i,size)PRINTl(i,":",t[i]);}
#ifdef CMP
using namespace std;
#else
#endif
#ifndef DBG
#define DEBUG(...)
void init(){}
#else
#define DEBUG(...) PRINT("##DEBUG##","file :",__FILE__,", line :",__LINE__,"[");PRINT(__VA_ARGS__);PRINTl("]");
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}
#endif
#ifdef ANS
#else
#endif

void solve();

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

  init();
  DEBUG();
  solve();

  return 0;
}

void solve(){

  DEBUG("SOLVE START");
  string s;cin>>s;
  REP(i,3)if(s[i]=='1')cout<<'9';else if(s[i]=='9')cout<<'1';else cout<<s[i];


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n;
    ll T, now;
    cin >> n >> T;
    ll ans = 0;
    ll so_far = -1;
    for(int i = 0; i < n; i++) {
        cin >> now;
        if (now >= so_far) {
            ans += T;
        } else {
            ans += (now+T) - so_far;
        }
        so_far = now+T;
    }
    cout << ans << 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;
using ll =long long;
using P =pair<int,int>;

int main(){
    string s;
    cin >> s;
    int l;
    l=s.size();
    rep(i,l){
        s[i]='x';
    }
    cout << s << endl;
    

    return 0;
}

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

#define rep(i, n) for(int (i) = 0; i < (n); ++(i))

using ll = long long int;
const ll MOD = 1e9 + 7;

int main() {
  int K;
  std::cin >> K;

  std::queue<ll> q;
  rep(i, 9) {
    q.push(i+1);
  }

  rep(i, K - 1) {
    ll x = q.front(); q.pop();
    int r = x % 10;
    if(r > 0) {
      q.push(x * 10 + r - 1);
    }
    q.push(x * 10 + r);
    if(r < 9) {
      q.push(x * 10 + r + 1);
    }
  }

  std::cout << q.front() << '\n';
}


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

using namespace std;

#define intt long long
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);

const int MOD = 1e9 + 7;

int n;

int main() {

	FAST;

	cin >> n;
	vector <int> a(n + 1);
	for (int i = 1; i <= n; i ++) {
		cin >> a[i];
	}
	vector <int> suff(n + 1);
	suff[n] = a[n];
	for (int i = n - 1; i >= 1; i --) {
		suff[i] = 1LL * (suff[i + 1] + a[i]) % MOD;
	}
	int ans = 0;
	for (int i = 1; i < n; i ++) {
		int plus = 1LL * a[i] * suff[i + 1] % MOD;
		ans = 1LL * (ans + plus) % MOD;
	}
	cout << ans << '\n';
	return 0;
}

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

int main(){
  int N,K;
  string S;
  cin>>N>>S>>K;
  for(int i=0;i<N;i++){
    if(S.at(K-1)!=S.at(i))
      S.at(i)='*';
  }
  cout<<S<<endl;
}


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

int main(void)
{
    long long D;
    cin >> D;
    vector<long long> c(26);
    vector<vector<long long>> used(26);
    for (long long i = 0; i < 26; i++)
    {
        cin >> c[i];
        used[i].push_back(-1);
    }
    vector<vector<long long>> s(D,vector<long long>(26));
    for (long long i = 0; i < D; i++)
    {
        for (long long j = 0; j < 26; j++)
        {
            cin >> s.at(i).at(j);
        }
    }

    long long lastnum = 0;
    vector<long long> ans(D);
    for (long long i = 0; i < D; i++)
    {
        long long pena = 0;
        for (long long j = 0; j < 26; j++)
        {
            pena += c[j] * (i - used.at(j).at(used[j].size() - 1));
        }
        ans[i] = -1;
        long long cnt = -100000000;
        for (long long j = 0; j < 26; j++)
        {
            pena -= c[j] * (i - used.at(j).at(used[j].size() - 1));
            if (s.at(i).at(j) - pena > cnt)
            {
                ans[i] = j;
                cnt = s.at(i).at(j) - pena;
            }
            pena += c[j] * (i - used.at(j).at(used[j].size() - 1));
        }
        used[ans[i]].push_back(i);
        lastnum += cnt;
    }

    time_t start_time = time(NULL); 
    while(clock() <  1.9 * CLOCKS_PER_SEC)
    {
        long long cnt = 100000000;
        long long ranD = rand() % D;
        long long ranq;
        for (long long i = 0; i < 26; i++)
        {
            if (i != ans[ranD])
            {
                if (abs(s.at(ranD).at(ans[ranD]) - s.at(ranD).at(i)) < cnt)
                {
                    ranq = i;
                    cnt = abs(s.at(ranD).at(ans[ranD]) - s.at(ranD).at(i));
                }
            }
        }

        used[ans[ranD]].erase(remove(used[ans[ranD]].begin(), used[ans[ranD]].end(), ranD), used[ans[ranD]].end());
        used[ranq].push_back(ranD);
        sort(used[ranq].begin(), used[ranq].end());
        long long oldans = ans[ranD];
        ans[ranD] = ranq;

        long long newnum = 0;
        for (long long i = 0; i< D; i++)
        {   
            newnum += s.at(i).at(ans[i]);
        }
        for (long long j = 0; j < 26; j++)
        {
            long long pena = 0;
            for (long long i = 1; i < used[j].size(); i++)
            {
                pena += c[j] * (used[j][i] - used[j][i - 1]) * (used[j][i] - used[j][i - 1] + 1) / 2;
            }
            newnum -= pena;
        }
        
        if(newnum <= lastnum)
        {
            used[ranq].erase(remove(used[ranq].begin(), used[ranq].end(), ranD), used[ranq].end());
            used[ans[ranD]].push_back(ranD);
            sort(used[ans[ranD]].begin(), used[ans[ranD]].end());
            ans[ranD] = oldans;
        }
        else
        {
            lastnum = newnum;
        }
    }

    for (long long i = 0; i < D; i++)
    {
        cout << ans[i]+1 << endl;
    }
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define task "MAXFRAME"

#define nguyen_dz the_best
#define ll long long
#define ld long double
#define pb push_back
#define endl "\n"
#define ff first
#define ss second
#define pll pair<ll,ll>
#define YES cout <<"YES"<<endl;
#define NO cout <<"NO"<<endl;
#define Yes cout <<"Yes"<<endl;
#define No cout<<"No" <<endl;


using namespace std;
const ll  maxn= 4e6+100;

ll a[maxn];
ll dp[maxn];
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r",stdin);
    if (fopen(task".INP","r"))
    {
        freopen(task".INP", "r", stdin);
        freopen(task".OUT", "w", stdout);
    }
   ll n;
   cin>> n;
   for (int i=0;i<=n;i++)
   {
       cin>>a[i];
   }
   ll res=1;

   for (int i=0;i<=n;i++)
   {
       //  ans=ans+res;
     //    cout <<res<<endl;
     dp[i]=res;
       if (res<a[i])
       {
           cout <<-1;
           return 0;
       }
       else
       {
           res-=a[i];
       }
     //  cout <<res<<endl;
  // if(i!=n) ans=ans+res+a[i];
       res*=2;
      // ll p =min(i+1,60);
       res=min(res,(ll)1e17);

   //   if (i!=n)

   }
   //ans/=2;
   ll nw=0;
   ll ans=0;
  for (int i=n;i>=0;i--)
  {

      nw+=a[i];
      ans=ans+min(nw,dp[i]);
  }
  cout <<ans;


}



Measured memory_bytes: 5228
import java.util.*;
public class Main{

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

      Map<Integer, Set<Integer>> graph = new HashMap<>();
      for(int i = 1; i <= n; i++) {
          graph.put(i, new HashSet<>());
      }

      for(int i = 0; i < m; i++) {
          int u = sc.nextInt();
          int v = sc.nextInt();
          graph.get(u).add(v);
          graph.get(v).add(u);
      }

      for(int island : graph.get(1)) {
          if(graph.get(island).contains(n)) {
            System.out.println("POSSIBLE");
            return;
          }
      }
      System.out.println("IMPOSSIBLE");
  }
}


Measured memory_bytes: 179460
import itertools

[n,m] = [int(x) for x in input().split()]
data = [[int(x) for x in input().split()] for _ in range(m)]

total = 0
for x in itertools.permutations(range(2,n+1)):
    
    route = [1,]+list(x)
    
    for x in range(len(route)-1):
        flg = False
        
        for y in data:
            if {route[x],route[x+1]} == set(y):
                flg = True
                break
                
        if flg == False:
            break
            
    else:
        total += 1
        
print(total)
        

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

int main()
{
  string s, res="";
  cin>>s;
  for(int i = 0; i < s.size(); i++)
  {
    if(s[i] == '0')
      res += '0';
    else if(s[i] == '1')
      res += '1';
    else
    {
      if(res.size() != 0)
        res.pop_back();
    }
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <stack>
#include <queue>
#include <deque>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <bitset>

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

using ld = long double;
using vld = std::vector<ld>;
using ll = long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using str = std::string;
using vstr = std::vector<str>;
using vb = std::vector<bool>;
using vvb = std::vector<vb>;

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

template<typename T> bool chmin(T a, T &b) { return a < b ? b = a, true : false; }
template<typename T> bool chmax(T a, T &b) { return a > b ? b = a, true : false; }
template<typename T> T sqr(T a) { return a * a; }

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

constexpr ld PI = 3.141592653589793L;
constexpr ld EPS = std::numeric_limits<ld>::epsilon();

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

ll gcd(ll n, ll m) { return m != 0 ? gcd(m, n % m) : n; }
ll lcm(ll n, ll m) { return n / gcd(n, m) * m; }
bool is_prime(ll n) {
    if (n == 1) return false;
    for (ll i = 2; sqr(i) <= n; i++)
        if (n % i == 0) return false;
    return true;
}
ll popcnt(ll n) {
    n = ((n & 0xaaaaaaaaaaaaaaaa) >> 1) + (n & 0x5555555555555555);
    n = ((n & 0xcccccccccccccccc) >> 2) + (n & 0x3333333333333333);
    n = ((n & 0xf0f0f0f0f0f0f0f0) >> 4) + (n & 0x0f0f0f0f0f0f0f0f);
    n = ((n & 0xff00ff00ff00ff00) >> 8) + (n & 0x00ff00ff00ff00ff);
    n = ((n & 0xffff0000ffff0000) >> 16) + (n & 0x0000ffff0000ffff);
    n = ((n & 0xffffffff00000000) >> 32) + (n & 0x00000000ffffffff);
    return n;
}

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

void solve();

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

int main() {
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15);

    solve();
}

void solve() {
    vll fib(45, 1);
    for (ll i = 2; i < 45; i++)
        fib[i] = fib[i - 1] + fib[i - 2];

    ll n; std::cin >> n;

    std::cout << fib[n] << '\n';
}



Measured memory_bytes: 3176
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(declaim (inline simple-base-string40=))
(defun simple-base-string40= (s1 s2)
  (declare #.OPT
           ((simple-base-string 40) s1 s2))
  (string= s1 s2))

(declaim (inline sxhash-sbs40))
(defun sxhash-sbs40 (string)
  (declare #.OPT
           ((simple-base-string 40) string))
  (macrolet ((set-result (form)
               `(setf result (ldb (byte 64 0) ,form))))
    (let ((result 0))
      (declare (uint64 result))
      (dotimes (i 5)
        (set-result (+ result (sb-kernel:%vector-raw-bits string i)))
        (set-result (+ result (ash result 10)))
        (set-result (logxor result (ash result -6))))
      (set-result (+ result (ash result 3)))
      (set-result (logxor result (ash result -11)))
      (set-result (logxor result (ash result 15)))
      (logand result most-positive-fixnum))))

(sb-ext:define-hash-table-test simple-base-string40= sxhash-sbs40)

(declaim (inline extract))
(defun extract (mask s)
  (let* ((res (make-string 40 :element-type 'base-char :initial-element #\Nul)))
    (loop with red-i = 0
          with blue-i = 20
          for pos below (length s)
          do (if (logbitp pos mask)
                 (progn (setf (aref res red-i) (aref s pos))
                        (incf red-i))
                 (progn (setf (aref res blue-i) (aref s pos))
                        (incf blue-i))))
    res))

(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (s (read-line))
         (s1 (coerce (nreverse (subseq s 0 n)) 'simple-base-string))
         (s2 (coerce (subseq s n (* 2 n)) 'simple-base-string))
         (table (make-hash-table :test #'simple-base-string40= :size #.(expt 2 20))))
    (declare (string s) ((integer 1 18) n))
    (dotimes (mask (expt 2 n))
      (let ((key (extract mask s1)))
        (multiple-value-bind (value presentp) (gethash key table)
          (if presentp
              (setf (gethash key table) (1+ (the uint32 value)))
              (setf (gethash key table) 1)))))
    (let ((res 0))
      (declare (fixnum res))
      (dotimes (mask (expt 2 n))
        (let* ((key (extract mask s2))
               (value (gethash key table)))
          (when value
            (incf res (the uint32 value)))))
      (println res))))

#-swank(main)


Measured memory_bytes: 90340
#include<bits/stdc++.h>
using namespace std;
int main() {
	int i,n, ans = 0;
	long long remain;
	cin >> n >> remain;

	vector<long long> child(n);
	for (int i = 0; i < n; i++) {
		cin >> child[i];
	}

	sort(child.begin(), child.end());
	for (i = 0; i < n; i++) {
		if (remain - child[i] >= 0)remain -= child[i], ans++;
		else break;
	}
	if (remain && ans > 0 &&i == n)ans--;
	cout << ans << endl;
}

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

const int MAXN = 1e2+10;
int a[MAXN];

int main(void){
    int n, ans=0, cnt = MAXN;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
        ans += a[i];
        if(a[i]%10){
            cnt = min(cnt, a[i]);
        }
    }
    if(ans%10) cout << ans << endl;
    else if(cnt != MAXN) cout << ans - cnt << endl;
    else cout << 0 << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int k = kb.nextInt();
		int a = kb.nextInt();
		int b = kb.nextInt();
		boolean t = false;
		for (int i = a; i <= b; i++) {
			if (i % k == 0) {
				System.out.println("OK");
				t = true;
				break;
			}
		}
		if (t == false)
			System.out.println("NG");
		kb.close();
	}

}


Measured memory_bytes: 27056
#include <stdio.h>

int main(void){
	char a[3];int am,pm,i;
	for(i=0;i<9;i++){
		scanf("%s %d %d",a,&am,&pm);
		printf("%s %d %d\n",a,am+pm,am*200+pm*300);
	}
	return 0;
}

Measured memory_bytes: 596
#include <cstdio>

int c11, c12, c13;
int c21, c22, c23;
int c31, c32, c33;

int a1, a2, a3;
int b1, b2, b3;

bool solve() {
  for (int i = 0; i <= c11; i++) {
    a1 = i;
    b1 = c11 - a1;
    a2 = c21 - b1;
    b2 = c22 - a2;
    a3 = c32 - b2;
    b3 = c33 - a3;

    if ((a1 + b1 == c11) && (a1 + b2 == c12) && (a1 + b3 == c13) &&
        (a2 + b1 == c21) && (a2 + b2 == c22) && (a2 + b3 == c23) &&
        (a3 + b1 == c31) && (a3 + b2 == c32) && (a3 + b3 == c33)) {
      return true;
    }
  }
  return false;
}

int main() {
  scanf("%d %d %d", &c11, &c12, &c13);
  scanf("%d %d %d", &c21, &c22, &c23);
  scanf("%d %d %d", &c31, &c32, &c33);

  if(solve()) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}


Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

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

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }


int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    cin >> h;
    map<int, int> mp;
    ll cnt = 0;
    rep(i, n) {
        cnt += mp[(i + 1) - h[i]];
        mp[h[i] + (i + 1)]++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 21148
#include<bits/stdc++.h>
using namespace std;
const long long INF=1LL<<62;
inline void read(int &x){
    x=0;int f=1;
    char ch=getchar();
    while(!isdigit(ch)) {if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();x*=f;
}
int main(){
    int a,b,c;
    read(a),read(b),read(c);
    if(a>b) swap(a,b);
    if(a>c) swap(a,c);
    if(b>c) swap(b,c);
    cout<<a<<' '<<b<<' '<<c<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;

ll mod=1e9+7;
ll B=1999;

ll mod_pow(ll x,ll n){
  ll res=1;
  while(n){
    if(n%2) res=res*x%mod;
    x=x*x%mod;
    n/=2;
  }
  return res;
}

int main(){
  string s;
  int n,m;
  set<pair<ll,ll> > st;
  
  cin>>n>>m>>s;
  ll d=mod_pow(B,mod-2),dv=1,l=0,r=0,h=s[0];
  
  string q;
  while(m--){
    cin>>q;
    
    if(q=="L++"){
      h+=(mod-s[l])*dv;
      h%=mod;
      dv= (dv*d) %mod;
      l++;
    }
    
    if(q=="L--"){
      l--;
      dv= (dv*B) %mod;
      h+=s[l]*dv;
      h%=mod;
    }
    
    if(q=="R++"){
      r++;
      h=(h*B+s[r])%mod;
      dv=(dv*B)%mod;
    }
    
    if(q=="R--"){
      h=(h-s[r]+mod)%mod;
      h=h*d%mod;
      dv=dv*d%mod;
      r--;
    }
    st.insert(make_pair(h,r-l));
  }
  cout<<st.size()<<endl;
  return 0;
}

Measured memory_bytes: 21912
using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;

static class P
{
    static void Main()
    {
        var ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(Max(ab.Max() * 2 - 1, ab.Sum()));
    }
}



Measured memory_bytes: 11348
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;
#[allow(dead_code)]
const MOD:i64 = 1e9 as i64 + 7;


#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}


#[allow(unused_imports)]
use std::f64;


fn main() {
    input!{n:usize, p:[i64;n]};
    let mut mn = p[0];
    let mut ans = 0i64;
    for i in 0..n {
        mn = min(mn, p[i]);
        if p[i] <= mn { ans += 1; }
    }
    println!("{}", ans);
}

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

int p[15], c[15], s[15];

int search(long res, int t){
    int ch, ans=1000000000;
    for(int i=1; i<=t; ++i){
        if(s[i]){
            --s[i];
            if(res<=p[i]*i*100) ch=(res-1)/(i*100)+1;
            else if(res<=p[i]*i*100+c[i]) ch=p[i];
            else ch=p[i]+search(res-(p[i]*i*100+c[i]), t);
            ans=min(ans, ch);
            ++s[i];
        }
    }
    return ans;
}
int main() {
	int D; long G;
	cin >> D >> G;
	for(int i=1; i<=D; ++i){
	    cin >> p[i] >> c[i];
	    s[i]=1;
	}
	cout << search(G, D) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;



int main(void){
  ll n;
  cin >> n;
  ll s = 0;
  while (1) {
    if (s * (s + 1) >= 2 * n) {
      break;
    }
    s++;
  }
  while (n > 0 && s > 0) {
    if (n >= s) {
      cout << s << endl;
      n -= s;
    }
    s--;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<sstream>
using namespace std;

	int stoi(string a){
		int b;
		stringstream ss;
		ss<<a;
		ss>>b;
		return b;
	}
	string itos(int a){
		stringstream ss;
		ss >>a;
		string b;
		b=ss.str();
		return b;
	}

int main(){
	int w,n,ans[40]={0};
	cin>>w>>n;
	for(int i=0;i<40;i++)ans[i]=i+1;
	for(int i=0;i<n;i++){
		string a,maes,usis;int kan,mae,usiro;
		cin>>a;
		kan=a.find(',');
		maes=a.substr(0,kan);
		usis=a.substr(kan+1,a.size()-kan);
		mae=stoi(maes);
		usiro=stoi(usis);
		swap(ans[mae-1],ans[usiro-1]);
	}
	for(int i=0;i<w;i++)cout<<ans[i]<<endl;
    return 0;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	vector<int>a(n);
	for (int i = 0; i < n; i++)cin >> a.at(i);
	for (int i = 0; i < n - k; i++) {
		if (a.at(i) >= a.at(i + k)) {
			cout << "No" << endl;
		}
		else cout << "Yes" << endl;
	}
}

Measured memory_bytes: 4048
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<map>
#include<queue>
#include<vector>
#include<cstdlib>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x) cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long ll;
const int N=2e5+11;
const ll INF=1e18+11;
struct Edge{int nxt,to;ll w;}edge[N<<2];
int r,c,n,num_edge,head[N];
ll val[N],mn1,mn2;
bool vis[N];
ll read(){
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return f*x;
}
void add_edge(int from,int to,ll w){
	edge[++num_edge].nxt=head[from];
	edge[num_edge].to=to;
	edge[num_edge].w=w;
	head[from]=num_edge;
}
void back(){
	puts("No");
	exit(0);
}
void dfs(int u,ll sh){
	if(vis[u]){
		if(sh!=val[u]) back();
		return;
	}
	val[u]=sh;vis[u]=1;
	if(u>=r) mn2=min(mn2,val[u]);else mn1=min(mn1,val[u]);
	for(int i=head[u];i;i=edge[i].nxt){
		int v=edge[i].to;
		dfs(v,edge[i].w-val[u]);
	}
}
int main(){
//	freopen("ex.in","r",stdin);
	r=(int)read();c=(int)read();n=(int)read();
	rep(i,n){
		int x=(int)read(),y=(int)read();ll z=read();x--;y--;
		add_edge(x,r+y,z);add_edge(r+y,x,z);
	}
	rep(i,r+c) if(!vis[i]){
		mn1=mn2=INF;
		dfs(i,0);
		if(mn1+mn2<0) back();
	}
	puts("Yes");
	return 0;
}

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

using namespace std;
using ll = long long;
using ii = pair<ll, ll>;

const int MAX { 200010 };
const ll MOD { 1000000007 }, oo { 1LL << 62 };

ll solve(int X, int Y, vector<ll>& xs, vector<ll>& ys, vector<ll>& zs)
{
    sort(xs.begin(), xs.end(), greater<ll>());
    sort(ys.begin(), ys.end(), greater<ll>());
    sort(zs.begin(), zs.end(), greater<ll>());

    priority_queue<ll, vector<ll>, greater<ll>> pq;

    ll ans = 0;

    for (int i = 0; i < X; ++i)
    {
        ans += xs[i];
        pq.push(xs[i]);
    }

    for (int i = 0; i < Y; ++i)
    {
        ans += ys[i];
        pq.push(ys[i]);
    }

    for (auto z : zs)
    {
        if (pq.empty() or z <= pq.top())
            break;

        ans -= pq.top();
        ans += z;

        pq.pop();
    }

    return ans;
}

int main()
{
    ios::sync_with_stdio(false);

    int X, Y, A, B, C;
    cin >> X >> Y >> A >> B >> C;

    vector<ll> xs(A), ys(B), zs(C);

    for (int i = 0; i < A; ++i)
        cin >> xs[i];

    for (int i = 0; i < B; ++i)
        cin >> ys[i];

    for (int i = 0; i < C; ++i)
        cin >> zs[i];

    auto ans = solve(X, Y, xs, ys, zs);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 7724
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <list>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <fstream>
#include <sstream>
#include <unordered_map>
#include <ctime>
#include <assert.h>
using namespace std;

#define ATCODER

#ifdef ATCODER
#include <atcoder/all>
#endif

const unsigned long long MOD = (unsigned long long)(1e9 + 7);

#define FROM_0(i, n) for(int i = 0; i < (n); i++)
#define FROM_S(i, s, e) for(int i = (s); i < (e); i++)
#define ITER_BEGIN_END(iter, vec) for(auto iter = vec.begin(); iter != vec.end(); iter++)

struct Town
{
    int x;
    int y;
    int idx;

    bool operator < (const Town & t2)
    {
        return this->x < t2.x;
    }
};

struct ListY
{
    ListY(int yy = 0, int ii = -1, int nn = -1) : y(yy), idx(ii), next(nn) {}
    int y;
    int idx;
    int next;
};

int main()
{
    int n;
    cin >> n;
    vector<Town> town(n);
    FROM_0(i, n)
    {
        cin >> town[i].x >> town[i].y;
        town[i].idx = i;
    }

    //sort
    std::sort(town.begin(), town.end());

    // make min and max y
    vector<ListY> minY(n), maxY(n);
    minY[0] = ListY(town[0].y, town[0].idx, -1);
    FROM_S(i, 1, n)
    {
        if (town[i].y < minY[i - 1].y)
            minY[i] = ListY(town[i].y, town[i].idx, i - 1);
        else
            minY[i] = minY[i - 1];
    }
    maxY[n - 1] = ListY(town[n - 1].y, town[n - 1].idx, n);
    for (int i = n - 2; i >= 0; i--)
    {
        if (town[i].y > maxY[i + 1].y)
            maxY[i] = ListY(town[i].y, town[i].idx, i + 1);
        else
            maxY[i] = maxY[i + 1];
    }

    // graph
    atcoder::dsu graph(n);
    FROM_S(i, 0, n)
    {
        int before = i - 1;
        while (before >= 0 && minY[before].y < town[i].y)
        {
            graph.merge(minY[before].idx, town[i].idx);
            before = minY[before].next;
        }
        int next = i + 1;
        while (next < n && maxY[next].y > town[i].y)
        {
            graph.merge(maxY[next].idx, town[i].idx);
            next = maxY[next].next;
        }
    }
    auto groups = graph.groups();
    vector<int> ret(n);
    ITER_BEGIN_END(pGroup, groups)
    {
        const vector<int> & x = *pGroup;
        ITER_BEGIN_END(pIdx, x)
        {
            ret[*pIdx] = (int)x.size();
        }
    }
    FROM_0(i, n)
        cout << ret[i] << endl;

    return 0;
}

Measured memory_bytes: 18252
X, K, D = [int(i) for i in input().split()]
# K = int(input())
X = abs(X)
rem = X % D
count = (X - rem) // D
if count <= K:
  if (K - count) % 2 == 0:
    print(rem)
  else:
    print(abs(rem-D))
else:
  print(X - D * K)


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

int main(){
  while(1){
    int n,x;
    cin>>n>>x;
    if(n == 0 && x == 0) break;
    int ans = 0;
    for(int a = 1; a <= n ; a++)
      for(int b = a + 1; b <= n ; b++)
        for(int c = b + 1; c <= n ; c++){
          if(a + b + c != x) continue;
          ans++;
        }
    cout<<ans<<endl;
  }
  return 0;
}



Measured memory_bytes: 3096
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        a = (int)(Math.abs(x-a));
        b = (int)(Math.abs(x-b));
        if(a<b) {
            System.out.println("A");
        }else {
            System.out.println("B");
        }
    }
}

Measured memory_bytes: 20692
#include <stdio.h>

#define N 55000
#define M 235

int main(){
  int a,b,c;
  int tbl[N];
  for(a=1;a<N;a++) tbl[a]=1;
  for(a=2;a<=M;a++) if(tbl[a]) for(b=2;a*b<=N;b++) tbl[a*b]=0;

  while(scanf("%d",&a)!=EOF){
    for(b=a-1;b>=2;b--) if(tbl[b]) break;
    for(c=a+1;c<N;c++) if(tbl[c]) break;
    printf("%d %d\n",b,c);
  }
  return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
#define ll long long int
#define tc int t; cin>>t; while(t--)
#define fora(i,n) for(int i=0;i<n;i++)
#define forb(i,a,n) for(int i=a;i<n;i++)
#define mod 1000000007

template<class T> T power(T N,T P){ return (P==0)?  1: N*power(N,P-1);}

int32_t main()
{
    fastio
    int a;
    cin>>a;
    cout<<a+a*a+a*a*a;
    


    return 0;


}

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

//wierd debugging stuff
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << "\n" ; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
//end of weird debugging stuff
using ll= long long;
using ld = long double;
using vi = vector<int> ;
using ii = pair<int,int>;
using vll = vector<ll> ;
using vvi = vector<vi>;
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)(x).size()
 
#define F_OR(i, a, b, s) for (int i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define F_OR1(e) F_OR(i, 0, e, 1)
#define F_OR2(i, e) F_OR(i, 0, e, 1)
#define F_OR3(i, b, e) F_OR(i, b, e, 1)
#define F_OR4(i, b, e, s) F_OR(i, b, e, s)
#define GET5(a, b, c, d, e, ...) e
#define F_ORC(...) GET5(__VA_ARGS__, F_OR4, F_OR3, F_OR2, F_OR1)
#define fo(...) F_ORC(__VA_ARGS__)(__VA_ARGS__)
#define foe(i,x) for(auto& i: x)
#define ar array
#define pb push_back
#define vt vector
#define F first
#define S second

template<class T> bool umin(T& a,const T& b){return b<a?a=b,1:0;}
template<class T> bool umax(T& a,const T& b){return b>a?a=b,1:0;}

template<class A> void read(vt<A>& v);
template<class A, size_t S> void read(ar<A, S>& a);
template<class T> void read(T& x) {cin>>x;}
void read(double& d) {string t;read(t);	d=stod(t);}
void read(long double& d) {	string t;read(t);d=stold(t);}
template<class H, class... T> void read(H& h, T&... t) {read(h);read(t...);}
template<class A> void read(vt<A>& x) {	foe(a, x)read(a);}
int nxt(){int a;read(a);return a;}   // iota(all(v),0); genrate(all(v),nxt);

// no change 
const ll MOD = 1e9+7;  
const int mx = 1e5;
int n,m;
void Titan(){
	read(n,m);
	vi v(n);
	read(v);
	for(int i = m ,j = 0;i<n;i++,j++){
		if(v[i]>v[j])cout << "Yes" <<endl;
		else cout << "No" << endl;
	}

	


}

	

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T = 1;
	//cin >> T;		//cmt if one test case
    fo(T){
		//cout << "Case #" << i+1 << ": " ;
		Titan();
	}
}
/*///////////////////////////////////////////////////////////
Important Notes : 
* check long long 
* check base cases
* do not loose Hope
* if case fails on 2nd test case maybe some cases are missing check them
* do not sit idle
* try to do it using pen/paper.
* in recurance first build a base case then preprocessig(means the the tasks to be perform everyturn the recrursice calls the then post processing which you do after hitting the base case or the last possibble values of recursrion"
*/


Measured memory_bytes: 3964
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int a, b = 0; cin >> a;
	rep(i, a) b += 1 - i % 2;
	printf("%.20f\n", b * 1.0 / a);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i)
#define All(x) begin(x),end(x)
#define rAll(x) rbegin(x),rend(x)
using namespace std;
using ll = long long;

int main(){
    string s;cin>>s;
    REP(i,s.size()) rep(j,i,s.size()+1){
        string t=s;
        t.erase(t.begin()+i,t.begin()+j);
        if(t=="keyence"){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}


Measured memory_bytes: 256