akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }
 
using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;
 
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};
 
const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod


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

signed main(){
    string S; cin>>S;
    int s = S.size();
    string S1(s,'0'),S2(s,'1');
    for(int i=1; i<s; i+=2) S1[i]='1';
    for(int i=1; i<s; i+=2) S2[i]='0';
    int ans1 =0,ans2=0;
    REP(i,s){
        if(S[i]!=S1[i]) ans1++;
    }
     REP(i,s){
        if(S[i]!=S2[i]) ans2++;
    }
    cout<<min(ans1,ans2)<<endl;
}

Measured memory_bytes: 592
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int DP1[200005], DP2[200005];

int main(){
  int N, K, C; cin >> N >> K >> C;
  string S; cin >> S;

  int now = 1, Index = 1;
  while (Index <= N && now <= K){
    if (S[Index - 1] == 'x') Index++;
    else{
      DP1[Index] = now;
      now++; Index += C + 1;
    }
  }

  if (now < K){
    cout << endl;
    return 0;
  }
  
  now = K; Index = N;
  while (Index > 0 && now > 0){
    if (S[Index - 1] == 'x') Index--;
    else{
      DP2[Index] = now;
      now--; Index -= C + 1;
    }
  }

  if (now >= 1){
    cout << endl;
    return 0;
  }
  
  bool flag = false;
  for (int i = 1; i <= N; i++){
    if (DP1[i] == DP2[i] && DP1[i] != 0){
      cout << i << endl;
      flag = true;
    }
  }
  if (!flag) cout << endl;

  return 0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N, K; cin >> N >> K;
  ll A[N]; rep(i,N) cin >> A[i];
  ll sum = 0; rep(i,N) sum += A[i];
  ll result = 1, count = 0, tu = 0, td = 0;
  ll tmpa[N], s1[N], s2[N];
  for (int i=1; i*i<=sum; i++) {
    if (sum%i!=0) continue;
    tu = 0, td = 0;
    rep(j,N) tmpa[j] = A[j] % i; sort(tmpa,tmpa+N);
    rep(j,N) s1[j] = (j==0) ? tmpa[j] : s1[j-1] + tmpa[j];
    for (int j=N-1; j>=0; j--) s2[j] = (j==N-1) ? i-tmpa[j] : s2[j+1] + i-tmpa[j];
    if (tmpa[N-1]==0) result = i;
    else {
      ll ppp = 0;
      rep(j,N-1) if (s1[j]==s2[j+1]) { ppp = s1[j]; break; }
      if (ppp<=K) result = i;
    }
    tu = 0, td = 0;
    rep(j,N) tmpa[j] = A[j] % (sum/i); sort(tmpa,tmpa+N);
    rep(j,N) s1[j] = (j==0) ? tmpa[j] : s1[j-1] + tmpa[j];
    for (int j=N-1; j>=0; j--) s2[j] = (j==N-1) ? sum/i-tmpa[j] : s2[j+1] + sum/i-tmpa[j];
    if (tmpa[N-1]==0) { result = sum/i; break; }
    else {
      ll ppp = 0;
      rep(j,N-1) if (s1[j]==s2[j+1]) { ppp = s1[j]; break; }
      if (ppp<=K) { result = sum/i; break; }
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
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;
}
 
using namespace std;

ll dp[105][10005];
void solve(){
  int n,W;
  cin>>n>>W;
  memset(dp,0,sizeof(dp));
  vector<ll>v(n),w(n);
  rep(i,n)cin>>v[i]>>w[i];
  rep(i,n){
    rep(j,W+1){
      if(j-w[i]>=0)chmax(dp[i+1][j],dp[i][j-w[i]]+v[i]);
      chmax(dp[i+1][j],dp[i][j]);
    }
  }
  cout<<dp[n][W]<<endl;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}



Measured memory_bytes: 11424
#include <iostream>
#include <string>
#include <set>
using namespace std;

int main() {
    int N;
    cin >> N;
    set<string> s;
    int last = -1;
    for(int i = 0; i < N; i++) {
        string str;
        cin >> str;
        if (last == -1 || last == str[0]) {
            last = str.back();
            if (s.count(str)) {
                cout << "No" << endl;
                return 0;
            }
            s.emplace(str);
        } else {
            cout << "No" << endl;
            return 0;
        }
    }    
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N, T;
  cin >> N >> T;
  vector<pll> C(N);
  REP(i, N) {
    ll a, b;
    cin >> a >> b;
    C[i] = make_pair(a, b);
  }
  sort(ALL(C));
  vl DP(T + 1, 0);
  ll m = 0;
  vl M(N + 1, 0);
  REP(i, N) {
    m = max(m, C[N - 1 - i].second);
    M[N - 1 - i] = m;
  }
  ll ans = 0;
  REP(i, N) {
    auto CP = DP;
    REP(t, T) {
      if (t >= C[i].first) {
        DP[t] = max(CP[t], CP[t - C[i].first] + C[i].second);
      }
    }
    REP(t, T) { ans = max(ans, DP[t] + M[i + 1]); }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int a, b;
    cin >> a >> b;
    int x, y, z;
    x = a + b;
    y = a - b;
    z = a * b;

    int ans = max(x, y);
    ans = max(ans, z);
    cout << ans << endl;
    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

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); }

void prime_map(map<ll, ll> &m, ll num) {
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }

    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }
        return;
    } else {
        prime_map(m, num);
    }
}


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

int main() {
    int N, T;
    cin >> N >> T;

    int cost = 1001;

    int c, t;
    for (int i = 0; i < N; i++) {
        cin >> c >> t;

        if (t <= T && c < cost) {
            cost = c;
        }
    }

    cout << ((cost < 1001) ? to_string(cost) : "TLE") << endl;

    return 0;
}

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

using namespace std;

long long int MOD = 1000000007;

long long int POW(long long int K, long long int p) {

	if (p == 0) { return 1; }
	else if (p == 1) { return K; }

	if ((p % 2) == 1) { return (POW(K, p - 1)*K) % MOD; }

	long long int tmp = POW(K, p / 2);

	return (tmp*tmp) % MOD;
}

long long int INV(long long int K){

	return POW(K, MOD - 2);
}

long long int b[200005];

long long int N, A, B, C;

int main(void) {

	cin >> N >> A >> B >> C;

	b[0] = 1;
	b[1] = 1;

	for (long long int i = 2; i <= 200000; i++) {
		b[i] = b[i - 1] * i;
		b[i] %= MOD;
	}

	long long int ans = 0;

	long long int p, q;
	p = (A*INV(100 - C)) % MOD;
	q = (B*INV(100 - C)) % MOD;


	for (int k = 0; k <= N - 1; k++) {
		long long int fac = b[N + k];
		fac *= INV(b[k]);  fac %= MOD;
		fac *= INV(b[N - 1]); fac %= MOD;
		long long int tmp;
		tmp = fac*((POW(q, k)*POW(p, N) + POW(p, k)*POW(q, N)) % MOD) % MOD;
		ans += tmp;
	}

	ans = (ans * 100) % MOD;
	ans *= INV(100 - C); ans %= MOD;

	cout << ans << endl;




	return 0;
}

Measured memory_bytes: 1792
/*
 * kadai3_4
 * kamecha
 */
#include<stdio.h>

int main(void){
    int num;
    int devided = 0;
    scanf("%d", &num);
    /*
     * 1~9のどれかで割り切れたらOK
     */
    int flag = 0;  //どれかで割り切れたらflag = 1
    for(int i = 1; i <= 9; i++){
        if(num%i == 0){
            /*
             * 商が1~9だとOK
             */
            devided = num/i;
            if(devided >= 1 && devided <= 9){
                puts("Yes");
                flag = 1;
                break;
            }
        }
    }
    /*
     * どれにも当てはまらなかった
     */
    if(!flag)   puts("No");
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long int 
#define w(x) int x; cin>>x; while(x--)
#define pb push_back
#define mp make_pair
#define mod 1000000007
using namespace std;
int main(){
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll a,b;
	cin>>a>>b;
	ll c=1,d=0;
	while(c<b){
		c=c+a-1;
		d++;
	}
	cout<<d;
}


Measured memory_bytes: 3616
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int a, b;
    cin >> a >> b;
    int s = min(a, b);
    int l = max(a, b);
    for (int i = 0; i < l; ++i)
    {
        cout << s;
    }
    cout << endl;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace abc127_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int age = int.Parse(input[0]);
            int price = int.Parse(input[1]);
            if (age < 13)
            {
                if(age <= 5)
                {
                    price = 0;
                }
                price = price / 2;
            }
            Console.WriteLine(price);
        }
    }
}

Measured memory_bytes: 13140
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;
using static Reader;

public static class P
{
    public static void Main()
    {
        var n = NextInt;
        var m = NextInt;
        int[] imos = new int[n + 1];
        for (int i = 0; i < m; i++)
        {
            var a = NextInt;
            var b = NextInt;
            imos[Min(a, b) - 1]++;
            imos[Max(a, b) - 1]--;
        }
        int[] accum = new int[n + 1];
        accum[0] = imos[0];
        for (int i = 1; i < accum.Length; i++)
        {
            accum[i] = accum[i - 1] + imos[i];
        }
        Console.WriteLine(accum.All(x => x % 2 == 0) ? "YES" : "NO");
    }
}


static class Reader
{
    const int BUF_SIZE = 1 << 12;
    static Stream Stream = Console.OpenStandardInput();
    static byte[] Buffer = new byte[BUF_SIZE];
    static int ptr = 0;
    static void Move() { if (++ptr >= Buffer.Length) { Stream.Read(Buffer, 0, BUF_SIZE); ptr = 0; } }


    public static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0; while (Buffer[ptr] < 48) Move();
            do { res = res * 10 + (int)(Buffer[ptr] ^ 48); Move(); } while (48 <= Buffer[ptr]);
            return res;
        }
    }
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var nm = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var n = nm[0];
        var m = nm[1];
        var cards = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
        var bs = new int[m];
        var cs = new int[bs.Length];
        for (int i = 0; i < bs.Length; i++)
        {
            var bc = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            bs[i] = bc[0];
            cs[i] = bc[1];
        }

        Array.Sort(cards);
        Array.Sort(cs, bs);
        Array.Reverse(cs);
        Array.Reverse(bs);

        int op = 0;
        for (int i = 0; i < cards.Length; i++)
        {
            while (op < cs.Length && bs[op] < 1)
            {
                op++;
            }
            if (op >= cs.Length || cards[i] >= cs[op])
            {
                break;
            }
            
            cards[i] = cs[op];
            bs[op]--;
        }

        Console.WriteLine(cards.Sum());
    }
}


Measured memory_bytes: 31712
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size() 
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)


/****************************** CODE IS HERE ***********************************/


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

    ll n; cin >> n;
    ll ans = n + n *n + n*n*n;
    cout << ans;

    return 0;
}


Measured memory_bytes: 3644
n, k = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**10
for i in range(n - k + 1):
  ans = min(ans, max(0, -x[i]) + max(0, 2 * x[i + k - 1]),
            max(0, -2 * x[i]) + max(0, x[i + k - 1]))
print(ans)


Measured memory_bytes: 14228
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e16;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

const ll mod = 1e9+7;

ll modpow(ll x, ll n){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = (res * x) % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

vl f;

ll nckm(ll n, ll k){
    return (f[n] * modpow(f[n-k], mod-2) % mod) * modpow(f[k], mod-2) % mod;
}

int main(){
    ll H, W, A, B; cin >> H >> W >> A >> B;
    
    f = vl(H+W+100, 1);
    FOR(i, 1, H+W+100-1) f[i+1] = (f[i] * (i+1)) % mod;
    
    ll ans = nckm(H+W-2, H-1);
    
    vl pre(B), post(B);
    REP(i, B) pre[i] = nckm(H-A+(i+1)-2, H-A-1);
    REP(i, B) post[i] = nckm(A+W-i-2, A-1);
    
    ll rem = 0;
    REP(i, B){
        rem =  (rem + pre[i]*post[i]) % mod;
    }
    cout << (ans - rem + mod)%mod << endl;
    return 0;
}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(i,n,m) for(int i=(int)(n);i<(int)(m);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int main(){
    const int MOD = 1000000007;
    vector<ll> kaijou(200010,1);
    rep(i,200000) kaijou.at(i+1)=kaijou.at(i)*(i+1)%MOD;
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    ll ans=0;
    irep(i,1,h-a+1){
        ll bunbo=kaijou.at(b+i-2)*kaijou.at(h-i+w-b-1)%MOD;
        ll bunshi=kaijou.at(b-1)*kaijou.at(i-1)%MOD*kaijou.at(h-i)%MOD*kaijou.at(w-b-1)%MOD;
        ans+=(bunbo*modinv(bunshi,MOD))%MOD;
    }
    cout<<ans%MOD<<endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>
using namespace std;

int digitsum(int n) {
    int sum = 0;
    while (n > 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}

int main(int argc, const char * argv[]) {
    
    int N, L;
    cin >> N >> L;
    vector<string> S(N);
    for (int i = 0; i < N; i++) {
        cin >> S.at(i);
    }
    
    sort(S.begin(), S.end());
    
    for (int i = 0; i < N; i++) {
        cout << S.at(i);
        if (i == N - 1) cout << endl;
    }
    
    return 0;
}


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

using namespace std;

const int N = 1e5 + 10;

int n, k, ans = 0, prt[N];
vector<int> g[N];

int dfs(int u, int fa) {
  int res = 0;
  for (auto v : g[u]) {
    res = max(res, dfs(v, u));
  }
  if (res == k - 1 && fa != 1) {
    res = -1;
    ans++;
  }
  return res + 1;
}

int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &prt[i]);
    if (i > 1) {
      g[prt[i]].push_back(i);
    }
  }
  if (prt[1] != 1) {
    ans ++;
    prt[1] = 1;
  }
  dfs(1, 1);
  printf("%d\n", ans);
  return 0;
}

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

char nxt(string s,char i){
	if(i> 'z') return '\n';
	return s.find(i)==string::npos ? i : nxt(s,i+1); 
}

int main(){
    string s; cin >> s;
	auto t = s;
	if(s.size() <26) {
		cout << s << nxt(s,'a');
		return 0;
	}
	if(next_permutation(s.begin(),s.end())){
		int c =0;
		for(c=0;s[c]==t[c];c++) cout <<s[c];
		cout << s[c];
	}else{
		cout << -1;
	}

  	return 0;
}

Measured memory_bytes: 256
;; C - Fennec vs Monster

(defun drop (n lst)
  (if (plusp n) (drop (1- n) (cdr lst)) lst))

(let* ((n (read))
       (k (read))
       (h (loop repeat n collect (read))))
  (setf h (sort h #'>))
  (princ (reduce #'+ (drop k h))))


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

ll inf=9223372036854775806;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int c[3][3],i,j;
	for (i=0;i<3;i++){
		for (j=0;j<3;j++){
			cin>>c[i][j];
		}
	}
	if (c[0][0]+c[1][1]==c[1][0]+c[0][1]&&c[0][1]+c[1][2]==c[0][2]+c[1][1]&&c[1][0]+c[2][1]==c[1][1]+c[2][0]&&c[1][1]+c[2][2]==c[1][2]+c[2][1]){
		cout<<"Yes";
	}
	else {
		cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 256
x1,y1,x2,y2 = map(int,input().split())
directionvector = [x2-x1,y2-y1]
x3 = x2 - directionvector[1]
y3 = y2 + directionvector[0]
x4 = x3 - directionvector[0]
y4 = y3 - directionvector[1]
print(str(x3)+" "+str(y3)+" "+str(x4)+" "+str(y4))

Measured memory_bytes: 3060
#include<cstdio>
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    int l_max=1,r_min=n;
    for(int i=0;i<m;i++){
        int l,r;
        scanf("%d%d",&l,&r);
        if(l>l_max)l_max=l;
        if(r<r_min)r_min=r;
    }
    int ans=r_min-l_max+1;
    printf("%d\n",(ans>0)?ans:0);
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;

int main() {
	int N, T, A, X;
	cin >> N >> T >> A;
	int ans=0;
	int cc = 99999999999;
	for (int i = 1; i <= N; i++) {
		int X;
		cin >> X;
		int d = (T * 1000 - X * 6) - A * 1000;
		if (d < 0) d = -d;
		if (cc > d) cc = d, ans = i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main() {
    let i1: Vec<u32> = read_vec();
    let mut i2: Vec<String> = Vec::new(); // parse to char from string
    for i in 0..i1[0] as i32 {
        let sub_str: String = read();
        i2.push(sub_str);
    }
    let v = vec![-1, 0, 1];
    for i in 0..i1[0] as i32 {
        for j in 0..i1[1] as i32 {
            let mut ans = 0;
            for k in 0..3 {
                for l in 0..3 {
                    let x = j + v[l];
                    let y = i + v[k];
                    if 0 <= y && y < i1[0] as i32 && 0 <= x && x < i1[1] as i32 {
                        if i2[y as usize].chars().nth(x as usize).unwrap() == '#' {
                            ans += 1;
                        }
                    }
                }
            }
            if i2[i as usize].chars().nth(j as usize).unwrap() == '#' {
                print!("#");
            } else {
                print!("{}", ans);
            }
        }
        println!("");
    }
}

Measured memory_bytes: 4352
#include <stdio.h>
int main ()
{
  int a,b,c;
  char s[100];
  
  scanf("%d %d",&a,&b);
  c=(a*b)%2;
  
  if(c==0)
  {
     printf("Even");
  }
  else
  {
         printf("Odd");
  }
 
  
  return 0;
}

Measured memory_bytes: 128
N = gets.to_i
S = gets.chomp

sum_w = [0]
sum_e = [0]

1.upto(S.length) do |i|
  if S[i - 1] == 'W'
    sum_w[i] = sum_w[i - 1] + 1
    sum_e[i] = sum_e[i - 1]
  elsif S[i - 1] == 'E'
    sum_w[i] = sum_w[i - 1]
    sum_e[i] = sum_e[i - 1] + 1
  end
end

min = S.length + 1
0.upto(S.length - 1) do |i|
  count = sum_w[i] + sum_e[S.length] - sum_e[i + 1]
  if min > count
    min = count
  end
end

puts min


Measured memory_bytes: 7156
#include<bits/stdc++.h>
#define fo(i,a,b)for(int i=a,_e=b;i<=_e;++i)
#define fd(i,a,b)for(int i=b,_e=a;i>=_e;--i)
#define ll long long
using namespace std;
const int N=255,mo=1e9+7;
int n,k,ans,g,Ga,Gb;
int c[N][N],st[N];
char s[N];
void calc(){
	int ga=g,gb=g,tot=0;
	fo(i,1,k)
		if(s[i]=='r'&&ga)--ga;else
		if(s[i]=='b'&&gb>ga&&st[gb]>1)tot+=st[gb]-2,--gb;else
		if(tot)--tot;
	for(;st[gb]==1;)--gb;
	if(ga||gb||tot)return;
	tot=1;
	for(int i=1,j=0;i<=g;i=j+1){
		for(;j<g&&st[j+1]==st[i];)++j;
		tot=(ll)tot*c[j][j-i+1]%mo;
	}
	ga=Ga-1;gb=Gb+Ga;
	ans=((ll)tot*c[n-ga+gb][gb]+ans)%mo;
}
void find(int _n,int _k,int len){
	calc();
	++g;
	int la=Ga,lb=Gb;
	for(int i=len;_n+(i==1?2:i*2-2)<=n+1&&_k+i<=k;++i)
		Ga=la+(i==1?2:i*2-2),Gb=lb+(i>1)*2,st[g]=i,find(_n+(i==1?2:i*2-2),_k+i,i);
	--g;
}
int main(){
	scanf("%d%d\n%s",&n,&k,s+1);
	fo(i,0,250){
		c[i][0]=1;
		fo(j,1,i)c[i][j]=(c[i-1][j]+c[i-1][j-1])%mo;
	}
	find(0,0,1);
	cout<<ans;
}

Measured memory_bytes: 512
#include <algorithm>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = long long;
using ull = unsigned long long;

using vll = vector<ll>;

void solve();

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

  solve();

  return 0;
}

#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)

#define inl(...)  \
  ll __VA_ARGS__; \
  in(__VA_ARGS__)

#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__);

#define inc(...)      \
  char __VA_ARGS__; \
  in(__VA_ARGS__);

void in() {}
template <typename T, class... U>
void in(T& t, U&... u) {
  cin >> t;
  in(u...);
}

void out() {
  cout << endl;
}
template <typename T, class... U>
void out(const T& t, const U&... u) {
  cout << t;
  if (sizeof...(u))
    cout << " ";
  out(u...);
}

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

void solve();
#ifndef ONLINE_JUDGE
#include "./lib.hpp"
#endif

void solve() {
  ini(N, K);
  vll A(N);
  rep(i, N) cin >> A[i];

  for (ll i = 0; i < N - K; i++) {
    if (A[i] < A[i + K])
      out("Yes");
    else
      out("No");
  }
}


Measured memory_bytes: 4776
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;


public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        int[] score = new int[3];

        ArrayList<Integer> list = new ArrayList<>();

        list.add(a + b);
        list.add(a - b);
        list.add(a * b);

        System.out.println(Collections.max(list));
    }

    static char[] toCharArray(String str) {
    	char[] chAr = new char[str.length()];
    	chAr = str.toCharArray();
    	return chAr;
    }

    static String[] toStringArray(String str, String delim) {
    	String[] stAr = str.split(delim);
    	return stAr;
    }

    static int[] toIntArray(String str, String delim) {
    	String[] strAr = str.split(delim);
    	int[] intAr = new int[strAr.length];
    	for(int i = 0; i < strAr.length; i++) {
    		intAr[i] = Integer.parseInt(strAr[i]);
    	}
    	return intAr;
    }

    static int toInt(String str) {
    	int num = Integer.parseInt(str);
    	return num;
    }
}

Measured memory_bytes: 21460
import math
n, m = input().split()
m = int(m)
n = int(n)
if n == 1 or n == 0:
	nNum = 0
else:
	nNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))
if m == 1 or m == 0:
	mNum = 0
else:
	mNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))
print(int(mNum + nNum))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    vvi G(N * 3);
    rep(i, 0, M) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        rep(k, 0, 3) {
            G[u * 3 + k].push_back(v * 3 + (k + 1) % 3);
        }
    }
    int S, T;
    cin >> S >> T;
    S--, T--;

    queue<int> q;
    q.push(S * 3 + 0);
    vi dist(N * 3, INF);
    dist[S * 3] = 0;
    while (sz(q)) {
        int v = q.front();
        q.pop();
        for (int w : G[v]) {
            if (chmin(dist[w], dist[v] + 1)) {
                q.push(w);
            }
        }
    }
    cout << (dist[T * 3] == INF ? -1 : dist[T * 3] / 3) << endl;
    return (0^_^0);
}



Measured memory_bytes: 19072
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cout<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
const int INTMAX = 2147483647;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

template <typename T>
struct SegmentTree{
  using F = function<T(T,T)>;
  int n;
  F f;
  T ti;
  vector<T> dat;
  SegmentTree(){};
  SegmentTree(F f,T ti):f(f),ti(ti){}
  void init(int n_){    
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,ti);
  }
  void build(const vector<T> &v){
    int n_=v.size();
    init(n_);
    for(int i=0;i<n_;i++) dat[n+i]=v[i];
    for(int i=n-1;i;i--)
      dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
  }
  void set_val(int k,T x){
    dat[k+=n]=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);  
  }
  void add(int k, T x){
    dat[k+=n]+=x;
    while(k>>=1)
      dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
  }
  T query(int a,int b){
    T vl=ti,vr=ti;
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) vl=f(vl,dat[l++]);
      if(r&1) vr=f(dat[--r],vr);
    }
    return f(vl,vr);
  }
};

int main(){
    int n;cin >> n;
    vector<int> v(n);
    rep(i,n) cin >> v[i];
    SegmentTree<int> tr([](int a, int b){return __gcd(a,b);}, 0);
    tr.build(v);
    ll ans = 0;
    rep(i,n){
        if(i==0){
            //cout << tr.query(1,n) << endl;
            chmax(ans, tr.query(1,n));
        }else if(i==n-1){
            //cout << tr.query(0,n-1) << endl;
            chmax(ans, tr.query(0,n-1));
        }else{
            //cout << tr.query(0,i) << " " << tr.query(i+1,n) << endl;
            chmax(ans, __gcd(tr.query(0,i), tr.query(i+1,n)));
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1664
while True: 
    n,x=map(int,input().split())
    if n==0 and x==0:
        break
    a=0
    for i in range(1,n+1):
        for j in range(1+i,n+1):
            for k in range(j+1,n+1):
                if (i+j+k)==x:
                    a+=1
    print(a)


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


using namespace std;
 
int main(){
  int c[3][3];
  int a[3];
  int b[3];

  for(int i = 0; i < 3; i++){
    for(int j = 0; j < 3; j++){
      cin >> c[i][j];
    }
  }

  int c1[2][3];
  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 3; j++){
      c1[i][j] = c[i + 1][j] - c[i][j]; //a[i+1] - a[i];
    }
  }

  for(int i = 0; i < 2; i++){
    for(int j = 0; j < 2; j++){
      if(c1[i][j] != c1[i][j+1]){
        cout << "No";
        return 0;
      }
    }
  }

  cout << "Yes";

}

Measured memory_bytes: 256
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end
N, a_list = gets_n_and_i_list

dpp a_list
sum_list = []
sum_list[0] = a_list[0]
1.upto(N - 1) do |i|
  sum_list[i] = sum_list[i-1] + a_list[i]
end

dpp sum_list
total = sum_list.pop
diffs = []
sum_list.each do |e|
  x = e
  y = total - e
  diffs.push((x - y).abs)
end
puts diffs.min


Measured memory_bytes: 20092
#include <bits/stdc++.h>
 
using namespace std;
 
int main() {
	int D, N; cin >> D >> N;
 
	int S = 1; S = pow(100,D);
	if (N <= 99) {
		cout << S * N << endl;
	}
	else {
		cout << S * 101 << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define rep(i,q) for(int i = 0; q > i; i++)
int main(){
  int N;
  cin >> N;
  int T[N];
  rep(i,N){
    cin >> T[i];
  }
  int M;
  cin >> M;
  int P_X[2*M];
  rep(i,2*M){
    cin >> P_X[i];
  }
  rep(i,M){
    int kekka = 0;
    rep(j,N){
      if(j+1 != P_X[i*2]){
        kekka += T[j];
      } else {
        kekka += P_X[i*2+1];
      }
    }
    cout << kekka << endl;
  }
  return 0;
}

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

using namespace std;


void Main() {
    string T;
    cin >> T;

    int N = T.size();
    for (int i = N - 1; i >= 0; --i) {
        if (T[i] == 'P' || T[i] == 'D') {
            continue;
        }
        if (i == N - 1) {
            T[i] = 'D';
            continue;
        }
        T[i] = 'D';
    }

    cout << T << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);
#define ppp(a) (cout << (a) << endl);
#define cop(a) for(auto x:(a)){cout << x << endl;}


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

constexpr char sp = ' ';
constexpr char cmm = ',';
constexpr int MOD = 1e9+7;
constexpr int INF = 1e9;
constexpr ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powmod(ll b, ll e){ll r=1;while(e>0){if(e&1)r=(r%MOD)*(b%MOD)%MOD;b=(b%MOD)*(b%MOD)%MOD;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        // comment this out when you use scanf or printf
        // cin.tie(0); ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n;
    cin >> n;
    vector<pint> x(n);
    rep(i, n) {
        int a;
        scanf("%d", &a);
        x[i] = {a, i+1};
    }
    sort(x.begin(), x.end());
    rep(i, n){
        cout << x[i].second << sp;
    }
    cout << endl;


    return 0;
}


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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

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

// -------------------------------------------------------------------
// sort 1 2 3 4

bool in(char c) { return c == 'A' or c == 'T' or c == 'G' or c == 'C'; }

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    string s;
    cin >> s;

    int cnt = 0;
    int ans = 0;
    repall (c, s) {
        cnt = in(c) ? cnt + 1 : 0;
        ans = max(ans, cnt);
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.System.in;

public class Main {
    static int n,m,C;
    //static int[] A,B;
    static HashSet<Integer>[] graph;
    public static void main(String[] args)throws IOException {
        //BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt(); m = sc.nextInt();
        int[][] rec = new int[n][2];
        for(int i=0;i<n;i++){
            int a=sc.nextInt(), b=sc.nextInt();
            rec[i][0] = a; rec[i][1] = b;
        }
        Arrays.sort(rec,(a,b)->(a[0]-b[0])); // sort by price each
        long ans = 0, num = 0;
        for(int i=0;i<n;i++){
            long cur = Math.min(rec[i][1],m-num);
            ans += ((long)rec[i][0])*cur;
            num += cur;
            if(num==m) break;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 93952
#include<bits/stdc++.h>
using namespace std;int N,M,P,i,j,s[1<<17];main(){cin>>N>>M>>P;for(;i<M;++i)cin>>s[i],s[i]=(s[i]+N-P)%N;sort(s,s+M);P=min(s[M-1],N-s[0]);for(;j<M-1;++j)P=min({P,s[j]*2+N-s[j+1],(N-s[j+1])*2+s[j]});cout<<P*100<<endl;}


Measured memory_bytes: 3164
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#include <algorithm>
#include <bitset>
#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 <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define rep(i,n) for(int i=0;i<(lint)(n);i++)
#define REP(i,n) for(int i=1;i<=(lint)(n);i++)
#define all(V) V.begin(),V.end()
#define stackReplaceBegin(size)\
	void* p=malloc(size);\
	esp_new=(lint)p+size-1;\
	void * stack_extend_memory_ = malloc(size);\
	void * stack_extend_origin_memory_;\
	char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);\
	*stack_extend_dummy_memory_ = 0;\
	asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
typedef long long lint;
typedef unsigned long long ulint;
typedef std::pair<int, int> P;
constexpr int INF = INT_MAX/2;
constexpr lint LINF = LLONG_MAX/2;
constexpr double eps = DBL_EPSILON;
constexpr double PI=3.141592653589793238462643383279;
lint esp_new;
template<class T>
class prique :public std::priority_queue<T, std::vector<T>, std::greater<T>> {};
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
inline lint gcd(lint a, lint b) {
	while (b) {
		lint c = a;
		a = b; b = c % b;
	}
	return a;
}
inline lint lcm(lint a, lint b) {
	return a / gcd(a, b) * b;
}
bool isprime(lint n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
template<typename T>
T mypow(T a, unsigned int b) {
	T res(1),now(a);
	while(b){
		if(b&1)res*=now;
		b>>=1;
		now*=now;
	}
	return res;
}
template<typename T>
void printArray(std::vector<T>& vec) {
	rep(i, vec.size() - 1)std::cout << vec[i] << " ";
	std::cout << vec.back() << std::endl;
}
template<typename T>
void printArray(T l, T r) {
	T rprev = r;
	rprev--;
	for (T i = l; i != rprev; i++) {
		std::cout << *i << " ";
	}
	std::cout << *rprev << std::endl;
}
int n,a[10000010];
int main() {
	std::cin>>n;
	lint ans=0;
	REP(i,n){
		for(int j=i;j<=n;j+=i)ans+=j;
	}
	std::cout<<ans<<std::endl;
	return 0;
}

Measured memory_bytes: 3656