akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <queue>
using namespace std;

int n;
queue<int> q;

int main(){
	cin >> n;
	int tmp;
	for(int I=0;I<n;I++){
		q = queue<int>();
		int a = 0;
		for(int i = 0; i < 10; i++){
			cin >> tmp;
			if(a<tmp){
				a = tmp;
			}
			else{
				q.push(tmp);
			}
		}
		a = 0;
		bool f = false;
		while(q.size() > 0){
			tmp = q.front(); q.pop();
			if(a < tmp){
				a = tmp;
			}
			else{
				f = true;
				break;
			}
		}
		if(f){
			cout << "NO" << endl;
		}
		else{
			cout << "YES" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3012
#include<bits/stdc++.h>
using namespace std;
string s;
int main() {
	cin>>s;
	for(int i=0;i<s.length();i++) 
		if((i%2==1&&s[i]=='R')||(i%2==0&&s[i]=='L')) {
			cout<<"No";
			return 0;
		}
	cout<<"Yes";
	return 0;
}

Measured memory_bytes: 256
from heapq import heapify, heappush, heappop
n, m = map(int, input().split())
a = list(map(lambda x:-int(x), input().split()))
heapify(a)
for _ in range(m):
    x = heappop(a)
    x /= 2
    heappush(a, x)
print(-sum(map(lambda x : int(x), a)))

Measured memory_bytes: 86208
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << endl;
#define qp(f) [](auto i){return f;}
using LL=long long;
using VI=vector<int>;
using VL=vector<LL>;
using VS=vector<string>;
using VVI=vector<vector<int>>;
using PII=pair<int, int>;
template<class T>T Age(T a, T b) { return (a + b - 1) / b; }

/* OUTPUT */
struct boolswitch { string t, f; boolswitch(string tr, string fa) :t(tr), f(fa) {} }yes("yes", "no"), Yes("Yes", "No"), YES("YES", "NO"), Yay("Yay!", ":(");
struct divizer { string s; divizer(string s_) :s(s_) {} }spc(" "), nosp(""), comma(",");
struct outputter {
	bool flag = false; boolswitch bs; divizer di;
	outputter(bool f, boolswitch b, divizer d) :flag(f), bs(b), di(d) {}
	template<class T>outputter operator ,(T o) {
		if (flag)cout << di.s; cout << o;
		outputter t(true, bs, di); return t;
	}
	outputter operator ,(double o) {
		if (flag)cout << di.s; printf("%.20f", o);
		outputter t(true, bs, di); return t;
	}
	outputter operator ,(bool o) {
		if (flag)cout << di.s; cout << (o ? bs.t : bs.f);
		outputter t(true, bs, di); return t;
	}
	template<class T> outputter operator ,(vector<T> o) {
		if (flag)cout << di.s;
		for (int i = 0; i < (int)o.size(); ++i)cout << o[i] << (i == (int)o.size() - 1 ? "" : di.s);
		outputter t(true, bs, di); return t;
	}
	template<class T, class U> outputter operator ,(pair<T, U> o) {
		if (flag)cout << di.s;
		cout << "[" << o.first, ", " << o.second << "]";
		outputter t(true, bs, di); return t;
	}
	outputter operator ,(outputter o) { cout << '\n'; return o; }
	outputter operator ,(boolswitch b) { outputter t(flag, b, di); return t; }
	outputter operator ,(divizer d) { outputter t(flag, bs, d); return t; }
}out(false, Yes, spc);


int main() {
	int n; cin >> n;
	VI c(n - 1), s(n - 1), f(n - 1);
	rep(i, n - 1)cin >> c[i] >> s[i] >> f[i];

	rep(i, n) {
		int now = 0;
		FOR(j, i, n - 1)now = c[j] + s[j] + Age(now - s[j], f[j]) * f[j] * (now > s[j]);
		out, now, out;
	}
}

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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int N, M;
    cin >> N >> M;
    priority_queue<int, vector<int>, less<int>> PQ;
    REP(i, N) {
        int x;
        cin >> x;
        PQ.push(x);
    }
    while (M--) {
        int t = PQ.top();
        PQ.pop();
        t = t >> 1;
        PQ.push(t);
    }
    ll ans = 0;
    while (!PQ.empty()) {
        int t = PQ.top();
        PQ.pop();
        ans += t;
    }
    cout << ans << "\n";

}

Measured memory_bytes: 892
import java.util.Scanner;
public class Main {
	
	static int inf = 1000000000;
	static int n;
	static int a;
	static int b;
	static int c;
	static int []l;
	

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

		 n = Integer.parseInt(sc.next());
		
		 a = Integer.parseInt(sc.next());
		 b = Integer.parseInt(sc.next());
		 c = Integer.parseInt(sc.next());
		
		 l = new int [n];
		
		for(int i = 0 ;i < n ;i++) {
			l[i] = Integer.parseInt(sc.next());
		}
			
		System.out.println(dfs(0,0,0,0));

		
	}
	
	static int dfs(int cnt,int x, int y, int z) {
		
	if(cnt == n) {
		int ans = Math.abs(a-x) + Math.abs(b-y)+ Math.abs(c-z) - 30;
		if(Math.min(Math.min(x, y), z) <= 0) {
			return inf;
		}
		else {
			return ans;
		}
	}
	
	int ret0 = dfs(cnt+1,x, y ,z);
	int ret1 = dfs(cnt+1,x+l[cnt],y, z) + 10; 
	int ret2 = dfs(cnt+1,x, y+l[cnt] ,z) + 10;
	int ret3 = dfs(cnt+1,x,y,z+l[cnt]) + 10;
	
	return min(ret0,ret1,ret2,ret3);
	
		
	}
	
	static int min(int ret0,int ret1, int ret2, int ret3) {
		int a = Math.min(ret0, ret1);
		int b = Math.min(ret2, ret3);
		
		return Math.min(a, b);
	}
}


Measured memory_bytes: 23124
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
using namespace std;
#define int long long


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

    int h,w; cin >> h >> w;
    vector<vector<int> > ss(h+2,vector<int>(w+2));
    for(int i = 0;i < h+2;i ++){
        for(int j = 0;j < w+2;j ++){
            if(i == 0 || i == h+1 || j == 0 || j == w+1) ss.at(i).at(j) = -10000;
        }
    }

    for(int i = 0;i < h;i ++){
        string s;
        cin >> s;
        for(int j = 0;j < w;j ++){
            if(s.at(j) == '#')
            ss.at(i+1).at(j+1) = -10000;
        }
    }

    vector<vector<int> > yoko(h+2,vector<int>(w+2)),tate(h+2,vector<int>(w+2));

    for(int i = 1;i < h+1;i ++){
        for(int j = 1;j < w+1;j ++){
            if(ss.at(i).at(j) == -10000) continue;

            if(ss.at(i).at(j-1) == -10000){
                yoko.at(i).at(j) ++;
                int a = j + 1;
                while(ss.at(i).at(a) != -10000){
                    yoko.at(i).at(j) ++;
                    a ++;
                }
            }else{
                yoko.at(i).at(j) = yoko.at(i).at(j-1);
            }
        }
    }

    for(int j = 1;j < w+1;j ++){
        for(int i = 1;i < h+1;i ++){
            if(ss.at(i).at(j) == -10000) continue;

            if(ss.at(i-1).at(j) == -10000){
                tate.at(i).at(j) ++;
                int a = i + 1;
                while(ss.at(a).at(j) != -10000){
                    tate.at(i).at(j) ++;
                    a ++;
                }
            }else{
                tate.at(i).at(j) = tate.at(i-1).at(j);
            }
        }
    }

    vector<vector<int> > ans(h,vector<int>(w));
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            ans.at(i).at(j) = yoko.at(i+1).at(j+1) + tate.at(i+1).at(j+1);
        }
    }

    int m = 0;
    for(int i = 0;i < h;i ++){
        for(int j = 0;j < w;j ++){
            m = max(m, ans.at(i).at(j));
        }
    }

    cout << m-1 << endl;

/*    for(int i = 0;i < h+2;i ++){
        for(int j = 0;j < w+2;j ++){
            cout << tate.at(i).at(j) << " ";
        }
        cout << endl;
    }
    */
}

Measured memory_bytes: 125824
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);
ll gcd(ll c, ll b){
    if(c==0||b==0)return max(c,b);
    while(1){
        if(c%b!=0){
            ll tmp=b;b=c%b;
            c=tmp;
        }else{
            return b;
        }
    }
}

int main() {
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    vector<ll> r(n+2);
    r[n+1]=0;
    vector<ll> l(n+2);
    l[0]=0;
    for(int i=0;i<n;i++){
        l[i+1]=gcd(l[i],a[i]);
    }
    for(int i=n-1;i>=0;i--){
        r[i]=gcd(a[i],r[i+1]);
    }
    ll ma=0;
    for(int i=0;i<n;i++){
        ll u=gcd(l[i],r[i+1]);
        if(ma<u){

            ma=u;
        }

    }
    cout<<ma<<endl;




        return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define endl        '\n'
#define pi          2*acos(0.0)
#define pb(a)       push_back(a)
#define db          double
#define ld          long double
#define ll          long long
#define ull         unsigned long long
#define mod         1000000007
#define inf         1000000000000000001
#define sqr(x)      (x) * (x)
#define gcd(a, b)   __gcd(a, b)
#define lcm(a, b)   ((a/gcd(a,b)) * b)
#define debug(x) 	cerr << #x << " = " << (x) <<endl
#define all(x)      (x).begin(), (x).end()
#define unsyncIO    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)


using namespace std;

int main()
{
    //freopen("/home/taalpatar_shepai/Documents/my_codes/out.txt", "w", stdout);
    unsyncIO;
    int n, k,ans = 0;
    cin >> n >> k;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin>>p[i];
    sort(all(p));
    for (int i = 0; i < k; i++) {
        ans += p[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3584
s=list(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
d=list(set(s))
d.sort()
ans="None"
for i in range(min(len(a),len(d))):
    if d[i]!=a[i]:
        ans=a[i]
        break
    u=i
if len(d)<len(a) and ans=="None":
    ans=a[u+1]
print(ans)

Measured memory_bytes: 3956
N = int(input())

max_4 = 25
max_7 = 14

answer = 'No'
for i in range(max_4 + 1):
  for j in range(max_7 + 1):
    sum = 4 * i + j * 7
    if sum == N:
      answer = 'Yes'
      break
  if answer == 'Yes':
    break

print(answer)

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

using namespace std;

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

  vector<int> ls(n);
  vector<int> rs(n);
  for (int i = 0; i < n; i++) {
    cin >> ls[i];
    ls[i] *= 2;
    cin >> rs[i];
    rs[i] *= -2;
  }

  sort(ls.begin(), ls.end());
  reverse(ls.begin(), ls.end());
  sort(rs.begin(), rs.end());
  reverse(rs.begin(), rs.end());

  long long sum = 0, max = 0;
  for (int i = 0; i < n && (ls[i] >= 0 || rs[i] >= 0); i++) {
    if (max < sum + ls[i]) max = sum + ls[i];
    if (max < sum + rs[i]) max = sum + rs[i];
    sum += ls[i] + rs[i];
    if (max < sum) max = sum;
  }
  cout << max << endl;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;

class Myon

{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }
    static Scanner cin;

    void calc()
    {
        int N = cin.nextInt();
        long[] A = cin.ArrayLong(N);
        long ALLXOR = 0;
        foreach (var i in A)
        {
            ALLXOR ^= i;
        }


        long[] B = (long[])A.Clone();
        for (int i = 0; i < N; i++)
        {
            B[i] = A[i] & ~ALLXOR;
        }
        int cnt = 0;

        for (int i = 59; i >= 0; i--)
        {
            int ii = cnt;
            if (ii >= N) break;
            bool ok = false;
            for (int j = ii; j < N; j++)
            {
                if((B[j] >> i) % 2 == 1)
                {
                    if (j != ii) B[ii] ^= B[j];
                    ok = true;
                    break;
                }
            }
            if (ok)
            {
                for (int j = ii + 1; j < N; j++)
                {
                    if ((B[j] >> i) % 2 == 1) B[j] ^= B[ii];
                }
                cnt++;
            }
        }

        long ans = 0;
        for (int i = 0; i < N; i++)
        {
            ans = Math.Max(ans, ans ^ B[i]);
        }

        ans += ans ^ ALLXOR;

        Console.WriteLine(ans);
    }
}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }
        
    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}





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

using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifdef ONLINE_JUDGE
    // freopen("", "r", stdin);
    // freopen("", "w", stdout);
#endif
	string s;
	cin >> s;
	int ans = 1, n = s.size();
	bool single = 1;
	for(int i = 1; i < n; i++){
		if(single){
			if(s[i] == s[i - 1]){
				if(i < n - 1)
					ans++, single = 0, i++;
				else
					break;
			}
			else
				ans++;
		}
		else
			ans++, single = 1;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 720
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

struct fast_io {
	fast_io(){
		std::cin.tie(nullptr);
		std::ios::sync_with_stdio(false);
	};
} fio;

bool eq(char a, char b){
	if(a == '?') return true;
	if(b == '?') return true;
	if(a == b) return true;
	return false;
}

signed main(){
	cout<<fixed<<setprecision(10);
	
	vector<string> in;
	vector<vector<int>> hoge;
	int offset = 0, maximum = 0;
	int ans = INF;
	
	in.resize(3);
	
	for(int i = 0; i < 3; i++){
		cin>>in[i];
		maximum = max(maximum, (int)in[i].size());
	}
	
	maximum += 10;
	
	hoge.resize(3, vector<int>(maximum * 4 + 40));
	offset = maximum * 2 + 20;
	
	for(int i = 0; i < in[0].size(); i++){
		for(int j = 0; j < in[1].size(); j++){
			if(!eq(in[0][i], in[1][j])) hoge[0][i - j + offset] = true;
		}
	}
	
	for(int i = 0; i < in[1].size(); i++){
		for(int j = 0; j < in[2].size(); j++){
			if(!eq(in[1][i], in[2][j])) hoge[1][i - j + offset] = true;
		}
	}
	
	for(int i = 0; i < in[0].size(); i++){
		for(int j = 0; j < in[2].size(); j++){
			if(!eq(in[0][i], in[2][j])) hoge[2][i - j + offset] = true;
		}
	}
	
	for(int i = -maximum * 2; i <= maximum * 2; i++){
		for(int j = -maximum * 2; j <= maximum * 2; j++){
			if(!hoge[0][i+offset] && !hoge[1][j-i+offset] && !hoge[2][j+offset]) {
				int l = min({0ll, i, j});
				int r = max({(int)in[0].size(), (int)in[1].size()+i, (int)in[2].size()+j});
				// cout<<"r = "<<r<<" l = "<<l<<endl;
				ans = min(ans, r - l);
			}
		}
	}
	
	cout<<ans<<endl;
	
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<char> S(N);
    for(int i=0; i<N; i++) cin >> S.at(i);
    for (int i=0; i<N; i++) {
        if (S.at(i)=='Y') {
            cout << "Four\n";
            return 0;
        }
    }
    cout << "Three\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
  intc(n);
  cout << (n+1)/2 << endl;
}


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

using namespace std;

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

const int MAX_N=100,MAX_P=50,MAX_C=20;

const int INF=1E8*5;

int n,m,c,s,g;

int G[MAX_C][MAX_N][MAX_N];
int d[MAX_N][MAX_N];

int p[MAX_C];
int q[MAX_C][MAX_P+1];
int r[MAX_C][MAX_P];

void warshall_floyd(int com){
	REP(k,n){
		REP(i,n){
			REP(j,n){
				G[com][i][j]=min(G[com][i][j],G[com][i][k]+G[com][k][j]);
			}
		}
	}
}

int cost(int com,int d){
	//com????????§d?????¢????????????
	int res=0;
	if (d==INF) return INF;
	for (int i=1;i<=p[com];i++){
		res+=max(min(d,q[com][i])-q[com][i-1],0)*r[com][i-1];
	}
	return res;
}

int main(){
	do{
		scanf("%d %d %d %d %d",&n,&m,&c,&s,&g);
		if (n){
			REP(i,n){
				REP(j,n){
					d[i][j]=INF;
					REP(k,c){
						G[k][i][j]=((i==j) ? 0 : INF);
					}
				}
			}
			REP(i,m){
				int x,y,dist,com;
				scanf("%d %d %d %d",&x,&y,&dist,&com);
				x--;
				y--;
				com--;
				G[com][x][y]=G[com][y][x]=min(G[com][x][y],dist);
			}
			REP(i,c){
				scanf("%d",&p[i]);
			}
			REP(i,c){
				q[i][0]=0;
				FOR(j,1,p[i]){
					scanf("%d",&q[i][j]);
				}
				q[i][p[i]]=INF;
				REP(j,p[i]){
					scanf("%d",&r[i][j]);
				}
			}
			REP(i,c){
				warshall_floyd(i);
			}
			REP(i,c){
				REP(j,n){
					REP(k,n){
						G[i][j][k]=cost(i,G[i][j][k]);
					}
				}
			}
			REP(i,n){
				REP(j,n){
					REP(k,c){
						d[i][j]=min(d[i][j],G[k][i][j]);
					}
				}
			}
			REP(k,n){
				REP(i,n){
					REP(j,n){
						d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
					}
				}
			}
			printf("%d\n",d[s-1][g-1]==INF ? -1 : d[s-1][g-1]);
		}
	}while(n);
	return 0;
}

Measured memory_bytes: 2016
import math
a, b = map(int, input().split())

mid_a = 12.5 * a
mid_b = 10 * b

a_range = [
    i for i in range(
        math.ceil(mid_a),
        math.floor(
            mid_a +
            12 +
            1)) if i > 0]
b_range = [
    i for i in range(
        math.ceil(mid_b),
        math.floor(
            mid_b +
            9 +
            1)) if i > 0]

seki = sorted(list(set(a_range) & set(b_range)))

if seki:
    print(seki[0])
else:
    print(-1)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 

using namespace std;
using namespace __gnu_pbds; 
#define     mod             1e9+7
#define     MOD             998244353
#define     ll              long long
#define     mp              make_pair
#define     F               first
#define     S               second
#define     t()             int test;cin>>test;while(test--)
#define     ii              pair<int,int>
#define     que_max         priority_queue <int>
#define     IOS             ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define     endl            "\n"
typedef tree<ii, null_type, less<ii>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>
    void __f(const char* name, Arg1&& arg1){
        cout << name << " : " << arg1 << endl;
        //use cerr if u want to display at the bottom
    }
    template <typename Arg1, typename... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args){
        const char* comma = strchr(names + 1, ','); cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
    }
#else
#define trace(...)
#endif

    vector<bool> isprime(1e7+1,true);

vector<ll int> primes;

void sieve()
{
  ll int i,j;
  isprime[0] = false;
  isprime[1] = false;

  for(i=2; i<=1e7 ;i++)
  {
    if(isprime[i])
    {
      primes.push_back(i);

      for(j=i*i; j<=1e7; j+=i)
      {
        isprime[j]=false;
      }
    }
  }
}

vector<int> primefactors(ll int N)
{
    vector<int> factors;
    ll pf_idx = 0, pf=primes[pf_idx];

    int cnt = 0;
    while(pf*pf<=N)
    {
        cnt =0;
        while(N % pf == 0)
        {
            N/=pf;
            cnt++;
        }
        factors.push_back(cnt);
        if(pf_idx+1<primes.size())
        pf = primes[++pf_idx];
        else 
            break;
    }
    if(N != 1) factors.push_back(1);
    return factors;
}

int32_t main()
 
{  
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    IOS;
    
   // t()
    {

        sieve();

        ll int n;

        cin>>n;

        vector<int> result = primefactors(n);

        ll ans=0;

        for(int i=0; i<result.size(); i++)
        {
            int x = result[i];

            int cnt=1;

            while(x >= cnt)
            {
                ans++;
                x-=cnt;
                cnt++;
            }
        }

        cout<<ans;




        
    }

    

}

Measured memory_bytes: 12772
#include<bits/stdc++.h>
#define LL long long
#define N 1000010
using namespace std;
string A;
bool c,f;
int main()
{
	cin >> A;
	int l=A.size();
	for(int i=0;i<l;i++)
	{
		if(A[i]=='C') c=1;
		if(A[i]=='F'&&c) f=1;
		if(f==1) break;
	}
	if(f) cout << "Yes";
	else cout << "No";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>

using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

    if(a* b % 2 == 0){
        cout << "Even" << endl;
    }else{
        cout << "Odd" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
'use strict'

function main(s) {

  s = s.split('\n')[0].split(' ');
  let ans = '';
  
  if (s[0] !== s[1] && s[1] === s[2]) ans = s[0];
  if (s[0] !== s[1] && s[1] !== s[2]) ans = s[1];
  if (s[0] === s[1] && s[1] !== s[2]) ans = s[2];

  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
//const int mod = 1e18 + 7;
bool sortbyfi(const pair<int,int> &a, const pair<int,int> &b) 
{ 
    return (a.fi < b.fi); 
}
int main()
{
	SPEED
	int n, k, count = 0, temp;
	cin >> n;
	vector<pair<int, int>> v;
	for (int i = 1; i <= n; ++i)
	{
		cin >> temp;
		v.pb(mp(temp,i));
	}
	sort(v.begin(), v.end(), sortbyfi);
	for (int i = 0; i < n; ++i)
	{
		cout << v[i].se << " ";
	}
	return 0;
}

Measured memory_bytes: 1780
#include <bits/stdc++.h> //C++の機能を「全て」読み込むための命令
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll inf=1e18;
const int N=2e5+10;
ll factorial(ll x){
    if(x==0||x==1) return 1;
    return x*factorial(x-1);
}

int main(){
    int a,b;
    cin >> a >> b;
    int x = ((double)a+(double)b)/2.0 + 0.999999999;
    // int x = a+b;
    // if(x%2!=0) x = (x+1)/2;

    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	string N;
	cin >> N;
	int n = N.size(); 
	int K;
	cin >> K;
	vector<vector<vector<ll>>> dp(n+1,vector<vector<ll>>(2,vector<ll>(4,0)));

	//dp[i][j][k]:=i桁目まで,(j=0は等しい,j=1は未満),k回取った場合の数(k=4は4つ以上取った場合)
	dp[0][0][0] = 1;
	for(int i = 0;i < n;i++){
		if(N[i] == '0'){
			for(int k = 0;k < 4;k++)dp[i+1][0][k] += dp[i][0][k];
			for(int k = 0;k < 4;k++)dp[i+1][1][k] += dp[i][1][k];
			for(int k = 0;k < 3;k++){
				dp[i+1][1][k+1] += dp[i][1][k] * 9;
			}
		}
		else{
			for(int k = 0;k < 3;k++)dp[i+1][0][k+1] += dp[i][0][k];
			for(int k = 0;k <= 3;k++){
				dp[i+1][1][k] += dp[i][0][k];//0を取ると0->1に遷移.
				dp[i+1][1][k] += dp[i][1][k];//1->1
			}
			for(int k = 0;k < 3;k++){
				dp[i+1][1][k+1] += dp[i][1][k] * 9;
			}
			for(int k = 0;k < 3;k++){
				dp[i+1][1][k+1] += dp[i][0][k] * (N[i] - '0' - 1);
			}
		}
	}
	cout << dp[n][0][K] + dp[n][1][K] << endl;
}


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>;
ll INF = pow(10,9)+7;

int main(){
    ll d,t,s;
    cin >> d >> t >> s;
    if(d<=t*s){
        cout << "Yes";
    }
    else{
        cout << "No";
    }
}

Measured memory_bytes: 3596
#include<iostream>
using namespace std;
main(){
  int a,b;
  cin>>a>>b;
  if(a<b){
    cout<<"a < b"<<endl;
  }
  else if(a>b){
    cout<<"a > b"<<endl;
  }
  else if(a==b){
    cout<<"a == b"<<endl;
  }
}
    

Measured memory_bytes: 1156
N , K = map(int,input().split())
R , S, P = map(int,input().split())
T = list(input())
Tstr = str(T)
r = Tstr.count('r')
s = Tstr.count('s')
p = Tstr.count('p')

for i in range(N-K):
    if T[K+i] == T[i] == 'r':
        T[K+i] = 'x'
    elif T[K+i] == T[i] == 's':
        T[K+i] = 'x'
    elif T[K+i] == T[i] == 'p':
        T[K+i] = 'x'
    else:
        r = r
Tstr = str(T)
r2 = Tstr.count('r')
s2 = Tstr.count('s')
p2 = Tstr.count('p')
    
print(r2*P+s2*R+p2*S)

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

int main() {
  int n; 
  cin >> n;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < n; i++) {
    cout << s.at(i) << t.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256
from collections import deque
S=deque(input())
Q=int(input())
snt=1
for i in range(Q):
    inp=input().split()
    if inp[0]=="1":
        snt*=(-1)
    else:
        F=int(inp[1])
        C=inp[2]
        if (2*F-3)*snt>0:
            #S=S+C
            S.append(C)
        else:
            #S=C+S
            S.appendleft(C)
if snt==1:
    #print(S)
    for i in range(len(S)):
        print(S.popleft(),end="")
    print()
else:
    for i in range(len(S)):
        #print(S[len(S)-1-i],end="")
        print(S.pop(),end="")
    print()


Measured memory_bytes: 7536
import numpy as np
import gc

if __name__ == '__main__':
    s=int(input())
    l=[]
    l.append(s)
    flag=False
    for i in range(1,1000000):
        if s%2:
            s=3*s+1
        else:
            s=s/2
        l.append(s)
        for j in range(0,i):
            if s==l[j]:
                print(i+1)
                del l
                gc.collect()
                flag=True
                break
        if flag:
            break   


Measured memory_bytes: 12400
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define Repr(i, n, a) for (int i = (n); i >= (a); i--)
#define rep(i, n) Rep(i, 0, n)
#define repr(i, n) Repr(i, n, 0)
#define all(a) a.begin(), a.end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n, x;
    cin >> n >> x;
    vector<int> b(n), l(n), u(n);
    vector<P> v(n);
    int sum = 0;
    rep(i, n)
    {
        cin >> b[i] >> l[i] >> u[i];
        int tmp = b[i] * l[i] + u[i] * (x - b[i]);
        v[i] = P{tmp, i};
        sum += b[i] * l[i];
    }
    sort(v.rbegin(), v.rend());
    Rep(i, 1, n) v[i].first += v[i - 1].first;
    int L = -1, R = n * x;
    while (R - L > 1)
    {
        int mid = (R + L) / 2;
        int q = mid / x, r = mid % x;
        bool f = false;
        rep(i, n)
        {
            int score = -sum;
            if (i < q)
                score += v[q].first - (v[i].first - (i ? v[i - 1].first : 0LL));
            else
                score += q ? v[q - 1].first : 0;
            int id = v[i].second;
            score += l[id] * min(b[id], r);
            score += u[id] * max(0LL, r - b[id]);
            f = f | (score >= 0);
        }
        if (f)
            R = mid;
        else
            L = mid;
    }
    cout << R << endl;
}

Measured memory_bytes: 4224
#include<iostream>
#include<sstream>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<string>
#include<numeric>
#include<set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using vi = vector<int>;
using vl = vector<long>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
using vpii = vector<pii>;
using vpll = vector<pll>;

int main(){
  int M1, D1, M2, D2;
  cin >> M1 >> D1;
  cin >> M2 >> D2;

  if(M1 == M2) cout << 0 << endl;
  else cout << 1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
import java.util.StringTokenizer;

public class Main {
	
	static class Point {
		
		int x, y;
		Point(int x, int y) {
			
			this.x = x;
			this.y = y;
		}
	}

	static char[][] grid;
	
	public static void main(String args[]) throws Exception {

		MyScanner sc = new MyScanner();
		PrintWriter pr = new PrintWriter(System.out);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int x = sc.nextInt() - 1;
		int y = sc.nextInt() - 1;
		int a = sc.nextInt() - 1;
		int b = sc.nextInt() - 1;
		grid = new char[n][m];
		int[][] dist = new int[n][m];
		
		for (int i = 0; i < n; i++) {
			
			grid[i] = sc.next().toCharArray();
			Arrays.fill(dist[i], (int)1e8);
		}
		
		int[] dx = {1, -1, 0, 0};
		int[] dy = {0, 0, 1, -1};
		
		ArrayDeque<Point> q = new ArrayDeque<>();
		q.add(new Point(x, y));
		dist[x][y] = 0;
		
		while(!q.isEmpty()) {
			
			Point p = q.poll();
			//System.out.println(p.x + " " + p.y);
			// 0 cost edges
			for(int i = 0; i < 4; i++) {
				
				int newX = p.x + dx[i];
				int newY = p.y + dy[i];
				
				if(!isSafe(newX, newY))
					continue;
				
				if(dist[newX][newY] > dist[p.x][p.y]) {
					
					dist[newX][newY] = dist[p.x][p.y];
					q.addFirst(new Point(newX, newY));
				}
			}
			
			//1 cost edges
			for(int i = -2; i <= 2; i++) {
				for(int j = -2; j <= 2; j++) {
					
					int newX = p.x + i;
					int newY = p.y + j;
					
					if(!isSafe(newX, newY))
						continue;
					
					if(dist[newX][newY] > dist[p.x][p.y] + 1) {
						
						dist[newX][newY] = dist[p.x][p.y] + 1;
						q.addLast(new Point(newX, newY));
					}
				}
			}
		}
		
		/*for(int[] i : dist) {
			for(int p : i)
				System.out.print(p + " ");
			System.out.println();
				
		}*/
		pr.print(dist[a][b] >= (int)1e8 ? -1 : dist[a][b]);
		pr.close();
	}

	private static boolean isSafe(int x, int y) {

		if (x < 0 || y < 0 || x >= grid.length || y >= grid[0].length || grid[x][y] == '#')
			return false;

		return true;
	}

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}
}


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

namespace ABC153D
{
    class Program
    {
        static void Main(string[] args)
        {
            long h = long.Parse(Console.ReadLine());
            string h2 = Convert.ToString(h,2);

            Console.WriteLine(Math.Pow(2, h2.Length) - 1);
        }
    }
}


Measured memory_bytes: 13268
a, b, m = [int(v) for v in input().split()]
alist = [int(v) for v in input().split()]
blist = [int(v) for v in input().split()]
mlist = [tuple(int(v) for v in input().split()) for _ in range(m)]
mlist = [(ai - 1, bi - 1, c) for ai, bi, c in mlist]

cost = min(alist) + min(blist)
for x, y, c in mlist:
    lc = alist[x] + blist[y] - c
    if lc < cost:
        cost = lc

print(cost)


Measured memory_bytes: 97212
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  if(b<=0&&c>=0) {
cout<<b*c<<endl;
    return 0;
  }

 else if(b<=0) {
cout<<a*c<<endl;
   return 0;
 }
  
 if(d<=0&&a>=0) {
cout<<a*d<<endl;
   return 0;
 }
  else if(d<=0) {
cout<<a*c<<endl;
    return 0;
  }

  cout<<max(a*c,b*d)<<endl;
}
  
  
  
  
  

Measured memory_bytes: 3628
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        D solver = new D();
        solver.solve(1, in, out);
        out.close();
    }

    static class D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String s = in.next();
            char[] cs = s.toCharArray();
            for (int i = 0; i < cs.length - 1; i++) {
                if (cs[i] == cs[i + 1]) {
                    out.println((i + 1) + " " + (i + 2));
                    return;
                }
                if (i < cs.length - 2 && cs[i] == cs[i + 2]) {
                    out.println((i + 1) + " " + (i + 3));
                    return;
                }
            }
            out.println("-1 -1");
        }

    }
}



Measured memory_bytes: 26636
#include <iostream>
#include <map>
#include <vector>
using namespace std;

int W, Q;
int main() {
    while (cin >> W >> Q) {
        if (W == 0 && Q == 0) break;
        vector<bool> wall(W, true);
        map<int, pair<int, int> > cat;
        for (int i = 0; i < Q; i++) {
            char t; int id, w;
            cin >> t;
            if (t == 's') {
                cin >> id >> w;
                bool can_sleep = false;
                for (int j = 0; j <= W-w; j++) {
                    bool found = true;
                    for (int k = 0; k < w; k++) {
                        if (!wall[j+k]) {
                            found = false;
                            break;
                        }
                    }
                    if (found) {
                        for (int k = 0; k < w; k++) {
                            wall[j+k] = false;
                        }
                        cat[id] = make_pair(j, j+w);
                        cout << j << endl;
                        can_sleep = true;
                        break;
                    }
                }
                if (!can_sleep) {
                    cout << "impossible" << endl;
                }
            } else {
                cin >> id;
                int from = cat[id].first;
                int to = cat[id].second;
                for (int j = from; j < to; j++) {
                    wall[j] = true;
                }
            }
            //cout << t << ' ' << id << endl;
        }
        cout << "END" << endl;
    }
    return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

using Graph=vector<vector<int>>;
Graph G;
ll solve(ll n){
  if(n%2==1) return 0;
  ll res=0;
  n/=2;
  while(n){
    res+=n/5;
    n/=5;
  }
  return res;
}
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  cout<<solve(n)<<endl;
}
    

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

using namespace std;

#define sqr(x) ((x) * (x))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef long long ll;

const int MOD = 1000000007;
const int INF = 1000000007;

void solve() {
  string S, T, U;
  int A, B;
  cin >> S >> T >> A >> B >> U;
  if (S == U) A--;
  if (T == U) B--;
  cout << A << ' ' << B << endl;
}

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

  solve();

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000000000000000000;
const char END = '\n';


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	string S;
	cin >> S;
	ll A[10];
	rep(i, S.size())
		A[i] = S[i] - '0';

	ll sub , Ans = 755;
	rep(i, S.size() - 2) {
		sub = 100 * A[i];
		sub += 10 * A[i + 1];
		sub += A[i + 2];

		sub = 753 - sub;
		if (Ans > abs(sub))
			Ans = abs(sub);
	}

	cout << Ans << END;
	return 0;
}


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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
vector<ll> ans(n*n);
rep(i, n){
  cin >> a[i];
  ans[a[i]-1]=i+1;
}
deque<ll> q;
rep(i,n*n){
  if(ans[i]!=0){
    rep(j,ans[i]-1)q.push_back(ans[i]);
  }
}
rep(i,n*n){
  if(ans[i]!=0){
    rep(j,q.size()){
      if(q[j]==ans[i]){
        cout << "No"<< endl;
        return 0;
      }
    }
    rep(j,n-ans[i]){
      q.push_back(ans[i]);
    }
  }
  else {
    if(q.empty()){
      cout << "No"<< endl;
      return 0;
    }
    ans[i]=q.front();
    q.pop_front();
  }
}
cout << "Yes"<< endl;
for(auto an:ans)cout << an << " ";
cout << endl;
return 0;
}

Measured memory_bytes: 4736
import os
import sys
from io import BytesIO, IOBase


def main():
    text = list(input())
    for pos in range(len(text)-1):
        if text[pos] == 'P'and text[pos+1] == '?':
            text[pos+1] = 'D'
        if text[pos] == '?':
            if text[pos+1] == '?':
                text[pos] = 'P'
                text[pos+1] = 'D'
            elif text[pos+1] == 'D':
                text[pos] = 'P'
            else:
                text[pos] = 'D'
    if text[-1] == '?':
        text[-1] = 'D'
    text = ''.join(text)
    print(text)

##############################################################################################################

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

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

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

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

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


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


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

if __name__ == "__main__":
    main()

Measured memory_bytes: 74696
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    H, W = il()
    S = [iss() for _ in range(H)]
    move = [[0, 1], [0, -1], [-1, 0], [1, 0]]

    for h in range(H):
        for w in range(W):
            if S[h][w] != '#': continue
            for mh, mw in move:
                if h + mh >= H or w + mw >= W: continue
                if S[h + mh][w + mw] == '#': break
            else:
                print('No')
                exit()
    else:
        print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 9860
#include <stdio.h>

int now = 0, n, s, ans, be;

int saiki(int a) {
  if(now > s) return 0;
  if(a == n) {
    if(s - now < 10 && s - now > be) ++ans;
    return 0;
  }
  int i, t = be + 1;
  for(i = t; i < 10; ++i) {
    now += i, be = i;
    saiki(a + 1);
    now -= i, be = t - 1;
  }
  return 0;
}

int main(void) {
  int i, j, k;
  while( 1 ) {
    now = 0, ans = 0, be = -1;
    scanf("%d%d", &n, &s);
    if(!n && !s) break;
    saiki(1);
    printf("%d\n", ans);
  }
  return 0;
}


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

int main(){
  int X,Y,Z,K; cin >> X >> Y >> Z >> K;
  vector<long long> A(X),B(Y),C(Z);
  for(int i=0; i<X; i++) cin >> A[i];
  for(int i=0; i<Y; i++) cin >> B[i];
  for(int i=0; i<Z; i++) cin >> C[i];
  
  vector<long long> D(X*Y);
  for(int i=0; i<X; i++){
    for(int j=0; j<Y; j++){
      D[i*Y+j]=A[i]+B[j];
    }
  }
  sort(D.begin(),D.end(),greater<long long>());
  D.resize(min(X*Y,K));
  
  vector<long long> E(D.size()*Z);
  for(int i=0; i<D.size(); i++){
    for(int j=0; j<Z; j++){
      E[i*Z+j]=D[i]+C[j];
    }
  }
  sort(E.begin(),E.end(),greater<long long>());
  E.resize(K);
  
  for(auto s:E) cout << s << endl;
}

Measured memory_bytes: 31616
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,a,b = map(int, input().split())
    print(min(b, n*a))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


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

  int n,k;
  cin >>n >> k;
  int x[n];
  rep(i,n) cin >> x[i];

  /*  if(x[0]>=0){
    cout << x[k-1] << endl;
    return 0;
  }else if(x[n-1]<=0){
    cout << x[n-k] << endl;
    return 0;
    }*/
  int l=0;
  int r=k-1;
  int ans=INT_MAX;
  rep(i,n){
    l=i;
    r=i+k-1;
    if(r==n) break;
    if(x[r]<=0){
      ans = min(ans,abs(x[l]));
    }
    else if(x[l]>=0){
      ans = min(ans,x[r]);
    }
    else{
      if(abs(x[r])>abs(x[l])){
	ans=min(ans,2*abs(x[l])+abs(x[r]));
      }
      else{
	ans=min(ans,2*abs(x[r])+abs(x[l]));
      }

    }

  }

  
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 640
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line = read_as_vec::<u64>();
    let (a, b) = (line[0], line[1]);

    for ans in 1..10000{
        if (ans as f64 * 0.08).floor() as u64 == a &&
            (ans as f64 * 0.10).floor() as u64 == b{
                println!("{}", ans);
                return;
            }
    }
    println!("-1");
    return;
}


Measured memory_bytes: 4352
#include <iostream>
#include <set>

using namespace std;

int main() {
	int n;
  	cin >> n;
  	multiset <long double> s;
  	for (int i = 0; i < n; ++i) {
    	int x;
      	cin >> x;
      	s.insert(x);
    }
  	while (s.size() != 1) {
    	auto it = s.begin();
   		long double a, b;
      	a = *it;
      	s.erase(it);
      	it = s.begin();
      	b = *it;
      	s.erase(it);
      	s.insert((a + b) / 2);
    }
  	cout << *s.begin();
  	return 0;
}

Measured memory_bytes: 256