akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3
#define MAX_V 100010

struct UnionFind{
  vector<int> v;
  UnionFind(int n) : v(n, -1) {}
  void init(){ for(int i = 0;i < v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};

string s;
ll n,m;
ll l[101010],r[101010];
ll a[101010];
ll sum[101010];

int main(){
	cin>>s>>n;
  m=s.size();
  rep(i,n){
    cin>>l[i]>>r[i];
    l[i]--;
  }
  rep(i,m-1){
    a[i+1]=s[i+1]-s[i];
  }
  m++;
  UnionFind uf(m);
  rep(i,n){
    uf.unite(l[i],r[i]);
  }
  rep(i,m/2){
    uf.unite(i,m-1-i);
  }
  rep(i,m){
    if(uf.same(i,0))continue;
    sum[uf.find(i)]+=a[i];
  }
  rep(i,101010){
    if((sum[i]+26LL*1000000000LL)%26!=0){
      cout<<"NO"<<endl;
      return 0;
    }
  }
  cout<<"YES"<<endl;

	return 0;
}


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

int main(){
	string s;
	cin >> s;
    vector<char> vec(26);
    for(int i=0; i<s.size(); i++){
        vec[s[i]-'a']++;
    }

    string ans="yes";
    if(*max_element(vec.begin(), vec.end())>=2) ans="no";
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1000 * 100000;

int main(void){
  int n;
  cin >> n;
  vector< vector<pair<int, int> > > g(n);
  for(int i=0; i < n; i++){
    int v; cin >> v;
    int k; cin >> k;
    for(int j=0; j < k; j++){
      int v0, c; cin >> v0 >> c;
      g[v].push_back(make_pair(v0, c));
    }
  }
  vector<ll> d(n, INF);
  vector<bool> used(n, false);
  priority_queue<pair <int, int> > pq;
  d[0] = 0;

  pq.push(make_pair(0, 0));

  while(!pq.empty()){
    pair<int, int> f = pq.top(); pq.pop();
    int u = f.second;
    used[u] = true;
    if(d[u] < f.first * (-1)) continue;

    for(int i=0; i < g[u].size(); i++){
      int v = g[u][i].first;
      if(used[v] == true) continue;
      if(d[v] > d[u] + g[u][i].second){
        d[v] = d[u] + g[u][i].second;
        pq.push(make_pair(d[v] * (-1), v));
      }
    }
  }
  for(int i=0; i < n; i++){
    cout << i << " " << d[i] << endl;
  }

  return 0;
}

Measured memory_bytes: 6092
def getxy(P,x,y,ans):
	for dy in range(m):
		for dx in range(m):
			if P[dy][dx] > -1:
				xy = [x+dx+1,y+dy+1]
				if xy[1] < ans[1] or (xy[1] == ans[1] and xy[0] < ans[0]):
					return xy
				else:
					return ans

# try-except is necessary
while 1:
	try:
		n,m = map(int,raw_input().split())
		if n == 0: break
		S = [map(int,raw_input().split()) for i in range(n)]
		P = [map(int,raw_input().split()) for i in range(m)]
		ans = [n+1,n+1]
		for rot in range(4):
			for y in range(min(ans[1],n-m+1)):
				for x in range(n-m+1):
					flag = 0
					for dy in range(m):
						for dx in range(m):
							if P[dy][dx] > -1 and S[y+dy][x+dx] - P[dy][dx] != 0:
								flag = 1
								break
						if flag == 1: break
					if flag == 0:
						ans = getxy(P,x,y,ans)
						break
				if flag == 0: break
			P = [[P[j][i] for j in range(m-1,-1,-1)] for i in range(m)]
		print "NA" if ans == [n+1,n+1] else " ".join(map(str,ans))
	except:
		pass

Measured memory_bytes: 4536
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto tmp = readln.split.to!(long[]);
    const N = tmp[0], A = tmp[1], B = tmp[2], C = tmp[3];
    auto ls = N.iota.map!(_ => readln.chomp.to!long).array.sort!((a,b) => a < b).array;

    long func(long[] ls, long[] a, long[] b, long[] c) {
        if (ls.empty) {
            if (a.empty) return long.max;
            if (b.empty) return long.max;
            if (c.empty) return long.max;

            return 
                  (a.length-1) * 10 + abs(a.sum - A)
                + (b.length-1) * 10 + abs(b.sum - B)
                + (c.length-1) * 10 + abs(c.sum - C);
        }
        return [
            func(ls[1..$], a.dup ~ ls[0], b.dup, c.dup),
            func(ls[1..$], a.dup, b.dup ~ ls[0], c.dup),
            func(ls[1..$], a.dup, b.dup, c.dup ~ ls[0]),
            func(ls[1..$], a.dup, b.dup, c.dup)
        ].reduce!min;
    }
    func(ls, [], [], []).writeln;
}


Measured memory_bytes: 1276
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define pb push_back
#define pf push_front
#define all(c) (c).begin(),(c).end()
#define sz size()
#define put puts("")
#define print(x) cout << x << endl
#define print2(x,y) cout << x << " " << y << endl
#define print3(x,y,z) cout << x << " " << y << " " << z << endl

int main(){
  int a,b,c,d,n;
  cin >> a >> b >> c >> d >> n;
  if(b > a*2)b = a*2;
  if(c > b*2)c = b*2;
  if(d > c*2)d = c*2;
  print((ll)(n/2)*d+(n%2)*c);
  return 0;
}


Measured memory_bytes: 256
{
  const main = (input: string) => {
    const read = reader(input)
    const [H, W] = read.ns()
    const s = read.lines

    const l: number[][] = _arr2D(H, W)
    const r: number[][] = _arr2D(H, W)
    const t: number[][] = _arr2D(H, W)
    const d: number[][] = _arr2D(H, W)

    for (let i = 0; i < H; i++) {
      for (let j = 0; j < W; j++) {
        if (s[i][j] !== '#') l[i][j] = (l[i][j - 1] || 0) + 1
        if (s[i][j] !== '#') t[i][j] = (i > 0 ? t[i - 1][j] : 0) + 1
        if (s[i][W - j - 1] !== '#') r[i][W - j - 1] = (r[i][W - j] || 0) + 1
        if (s[H - i - 1][j] !== '#')
          d[H - i - 1][j] = (i > 0 ? d[H - i][j] : 0) + 1
      }
    }

    // console.log(t.map(ll => ll.join('')).join('\n'))
    // console.log(d.map(ll => ll.join('')).join('\n'))
    let max = 0

    for (let i = 0; i < H; i++) {
      for (let j = 0; j < W; j++) {
        if (s[i][j] === '#') continue

        const score = l[i][j] + r[i][j] + t[i][j] + d[i][j] - 3

        max = Math.max(max, score)
      }
    }
    console.log(max)
  }
  const _arr2D = (h: number, w: number, fill = 0) => {
    return new Array(h)
      .fill(0)
      .reduce((p, c) => p.concat([Array(w).fill(fill)]), [])
  }

  const reader = (str: string) => {
    const lines = str.trim().split('\n')
    const s = () => lines.shift() || ''
    const n = () => Number(s())

    const ss = () => s().split(' ')
    const ns = () => ss().map(Number)
    const nls = () => lines.map(Number)

    return { lines, s, n, ss, ns, nls }
  }

  const getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')

  main(getInput())
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}
int main() {
	int n = ri();
	std::string s[n];
	for (int i = 0; i < n; i++) std::cin >> s[i];
	
	int res = -1;
	for (int i = 0; i < n; i++) {
		std::queue<int> que;
		que.push(i);
		std::vector<int> dist(n, -1);
		dist[i] = 0;
		bool can = true;
		while (que.size()) {
			int i = que.front();
			que.pop();
			for (int j = 0; j < n; j++) {
				if (s[i][j] == '1') {
					if (dist[j] != -1) {
						if ((dist[j] & 1) == (dist[i] & 1)) {
							can = false;
							break;
						}
					} else {
						dist[j] = dist[i] + 1;
						que.push(j);
					}
				}
			}
			if (!can) break;
		}
		if (can) res = std::max(res, 1 + *std::max_element(dist.begin(), dist.end()));
	}
	std::cout << res << std::endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e10
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
// 昇順sort
#define sorti(x) sort(x.begin(), x.end())
// 降順sort
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
  ll n, k;
  cin >> n >> k;

  vector<ll> a(n), sum(n+1, 0);
  rep(i,n) {
    cin >> a[i];
    sum[i+1] = sum[i] + a[i];
  }

  vector<ll> num;
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j <= n; ++j) {
      ll tmp = sum[j] - sum[i-1];
      num.pb(tmp);
    }
  }

  vector<ll> pw;
  ll tt = 1;
  for (int i = 1; i <= 40; ++i) {
    pw.pb(tt);
    tt *= 2;
  }

  ll res = 0;
  for (int i = 39; i >= 0; --i) {
    ll cnt = 0, target = pw[i];
    vector<ll> tmp;
    for (auto itr : num) {
      if ((itr & target) == target) {
        cnt++;
        tmp.pb(itr);
      }
    }

    if (cnt >= k) {
      num = tmp;
      res += target;
    }
  }

  cout << res << endl;
}


Measured memory_bytes: 6388
# コードを取得
S = str(input())

# リストに分割をして隣接する数値を比較
c_list = list(S)
cnt = 1
judge = "Good"
for cnt in range(1,4,1):
    if c_list[cnt-1] == c_list[cnt]:
        judge = "Bad"

# 結果を出力
print(judge)

Measured memory_bytes: 8956
s = input()
dp = [False]*4

for c in s:
	if c == "N":
		dp[0] = True
	elif c == "S":
		dp[1] = True
	elif c == "E":
		dp[2] = True
	elif c == "W":
		dp[3] = True

if dp[0] == dp[1] and dp[2] == dp[3]:
	print("Yes")
else:
	print("No")

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2018/02/23  Problem: 003_agc_b / Link: https://agc003.contest.atcoder.jp/tasks/agc003_b?lang=en ----- */
/* ------問題------

高橋君は 1 から N までの整数のうちのどれかが書かれたカードをたくさん持っています。 高橋君は整数 i が書かれたカードを Ai 枚持っています。

2 枚のカードについて、それらに書かれた整数の差の絶対値が 1 以下のとき、これらをペアにすることができます。

高橋君は、同じカードが複数のペアに使われないように、できるだけ多くのペアを作りたいです。高橋君が作れるペアの個数の最大値を求めてください。

-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;

LL ans = 0LL;

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

	cin >> N;
	VL a(N);

	FOR(i, 0, N) {
		cin >> a[i];
	}

	FOR(i, 0, N) {
		ans += a[i] / 2;
		a[i] = a[i] % 2;
		if (i != N - 1) {
			LL cnt = min(a[i], a[i + 1]);
			assert(cnt < 2);
			a[i] -= cnt;
			a[i + 1] -= cnt;
			ans += cnt;
		}
	}


	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
    int A=0,B=0,N,K,X,Y,S,T;
    cin>>N>>K>>X>>Y;
    S=N-K;

    if(N>=1 && K<=10000 && (Y>=1 && (X>Y && X<=10000)) )
    {
        for(int i=1; i<=N; i++)
        {
            if(N<K)
            {


            for(int j=1; j<=K; j++)
            {
                A=(N*X);



            }
            }
            else if(N>=K)
            {
                for(int j=1; j<=K; j++)
            {
                A=(K*X);



            }

            }





            for(int l=1; l<=S; l++)
            {
                B=(S*Y);



            }
        }

        }
        T=A+B;
        cout<<T;

    return 0;

}


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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

const int MAX = 555;
const string COLORS = "RYGB";

int H, W, D;

void solveOdd() {
    REP (h, H) {
        REP (w, W) {
            cout << COLORS[(w+h)%2];
        }
        cout << "\n";
    }
}

inline int diff(int h, int w, int ch, int cw) {
    return abs(h-ch) + abs(w-cw);
}

void solveEven() {
    int ch = D/2-1;
    int cw = D/2-1;
    REP (h, H) {
        REP (w, W) {
            int k = (w/D+h/D)%2;
            int hh = h-h/D*D;
            int ww = w-w/D*D;
            if (diff(hh,ww,ch,cw)<D/2 || diff(hh,ww,ch,cw+1)<D/2) {
                cout << COLORS[k];
            } else if ((hh-ch)*(ww-cw) > 0) {
                cout << COLORS[2+k];
            } else {
                cout << COLORS[3-k];
            }
        }
        cout << "\n";
    }
}

void solve() {
    if (D%2 == 1) {
        solveOdd();
    } else {
        solveEven();
    }
}

int main() {
    cin >> H >> W >> D;
    solve();
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ll long long
template <typename T>
bool PN(T x){ if (x <= 1) return false; if (x == 2) return true; for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false; return true;}
const ll MOD = 1e9+7;
long long Comb(int n, int i){long long ans = 1; if(i>n || i < 0) return 0; if(i == 0 || i == n) return 1; else {for(int j = 1; j <= i; ++j){ans *=(n+1-j); ans /= j; ans %= MOD;} }return ans;}

void solve(){
  int n, t, x;
  cin >> n >> x >> t;
  cout << (n+x-1)/x * t << endl;
}

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


Measured memory_bytes: 3616
from numpy.linalg import solve

x, y = map(int, input().split())
left = [[1, 1],
        [2, 4]]

right = [x, y]

a = solve(left, right)

left = [[1, 1],
        [4, 2]]

right = [x, y]
b = solve(left, right)
if (a[0] >= 0 and a[1] >= 0) or (b[0] >= 0 and b[1] >= 0):
    if (a[0].is_integer() is True and a[1].is_integer() is True) or (b[0].is_integer() is True and b[1].is_integer() is True):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Measured memory_bytes: 27488
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
using namespace std;

typedef long long ll;

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

class State{
public:
  int x,y,d,idx;
  State(){}
  State(int _x,int _y,int _d,int _idx){
    x = _x;
    y = _y;
    d = _d;
    idx = _idx;
  }
};

int sx,sy;
int gx,gy;

int h,w,n;
int next_dir[1000002][4];
bool closed[1002][1002][4];
char t[1002][1002];
string s;

int dir[1000002];

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

bool solve(){
  queue<State> open;
  memset(closed,0,sizeof(closed));

  open.push(State(sx,sy,0,0));

  while(!open.empty()){
    State st = open.front();
    open.pop();

    if(closed[st.x][st.y][st.d]){
      continue;
    }
    closed[st.x][st.y][st.d] = true;

    if(st.x == gx && st.y == gy){
      return true;
    }

    rep(i,4){
      if(next_dir[st.idx][i] != -1){
        int nx = st.x + dx[i];
        int ny = st.y + dy[i];

        if(nx < 0 || w <= nx || ny < 0 || h <= ny || t[ny][nx] == '#'){
          nx -= dx[i];
          ny -= dy[i];
        }

        open.push(State(nx,ny,i,next_dir[st.idx][i]));
      }
    }
  }

  return false;
}

int main(){
  while(cin>>h>>w>>n,h||w||n){
    cin>>s;

    rep(i,h){
      cin>>t[i];
      rep(j,w){
        if(t[i][j] == 'S'){
          sx = j;
          sy = i;
        }
        else if(t[i][j] == 'G'){
          gx = j;
          gy = i;
        }
      }
    }

    memset(next_dir,-1,sizeof(next_dir));

    int d = 0;

    rep(i,n+1){
      dir[i] = d;
      if(s[i] == 'L'){
        d = (d + 3) % 4;
      }
      else{
        d = (d + 1) % 4;
      }
    }

    int table[4];
    memset(table,-1,sizeof(table));

    for(int i=n;i>=0;i--){
      table[dir[i]] = i;
      rep(j,4){
        next_dir[i][j] = table[j];
      }
    }

    bool flg = solve();
    cout<<(flg ? "Yes" : "No")<<endl;
  }
}

Measured memory_bytes: 21000
//#include <bits/stdint.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bitset>

using namespace std;

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

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

//typedef
//------------------------------------------
typedef long long LL;

typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

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

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

//constant
//--------------------------------------------
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const LL MOD = 1e9+7; 
//vector <vector<int>> x(20, vector<int> (20)), y(20,vector<int> (20));
/*int counter_1 (int x) {
    if(x == 0) return 0;
    return counter_1(x >> 1) + (x & 1);
}*/

int main(){
  LL x;
  cin >> x;
  LL f = 100;
  LL ans;
  LL cnt=0;
  while(true){
    cnt++;
    LL k;
    k=f;
    f+=k*0.01;
    if(f>=x){
      ans=cnt;
      break;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3636
// J'aime
// Chemise Blanche

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

#define int long long

#define ii pair<int,int>
#define fi first
#define sc second

#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr << __LINE__ << " > " << #x << " = " << (x) << endl

void MAIN() {
  int n, m;
  cin >> n >> m;
  if (n == m) cout << "Yes" << '\n';
  else cout << "No" << '\n';
}

signed main() {
#ifdef _DEBUG
  // freopen("in" , "r", stdin );
  // freopen("out", "w", stdout);
#endif
  ios::sync_with_stdio(0); cin.tie(0);
  int T = 1;
  // cin >> T;
  while (T--) MAIN();
}


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

#define F first
#define S second

int t1,t2;

int n;
set<int> g[10005];
vector<int> leaf;

pair<int,int> c[10005];

int ans0=0;
int ans1[10005];

int main()
{
    #ifdef NOT_DMOJ
    freopen("data.txt","r",stdin);
    #endif // NOT_DMOJ
    scanf("%d",&n);
    for (int i=1; i<n; i++) {
        scanf("%d%d",&t1,&t2);
        g[t1].insert(t2);
        g[t2].insert(t1);
    }
    for (int i=1; i<=n; i++) {
        if (g[i].size()==1) leaf.push_back(i);
        scanf("%d",&c[i].F);
        c[i].S=i;
    }
    sort(c+1,c+n+1);
    for (int i=1; i<=n; i++) {
        t1=leaf.back();
        leaf.pop_back();
        t2=*g[t1].begin();
        g[t1].erase(t2);
        g[t2].erase(t1);
        if (g[t2].size()==1) leaf.push_back(t2);
        ans0+=c[i].F;
        ans1[t1]=c[i].F;
    }
    printf("%d\n",ans0-c[n].F);
    for (int i=1; i<=n; i++) printf("%d ",ans1[i]);
}


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

struct Card {
  char suit;
  int value;
};

void BubbleSort(struct Card c[], int n) {
  for (int i = 0; i < n; ++i) {
    for (int j = n - 1; i < j; --j) {
      if (c[j].value < c[j - 1].value) {
        Card tmp = c[j];
        c[j] = c[j - 1];
        c[j - 1] = tmp;
      }
    }
  }
}

void SelectionSort(struct Card c[], int n) {
  int minj;
  for (int i = 0; i < n - 1; ++i) {
    minj = i;
    for (int j = i; j < n; ++j) {
      if (c[j].value < c[minj].value) {
        minj = j;
      }
    }
    Card tmp = c[i];
    c[i] = c[minj];
    c[minj] = tmp;
  }
}
bool isStable(struct Card c1[], Card c2[], int n) {
  for (int i = 0; i < n; ++i) {
    if (c1[i].suit != c2[i].suit) return false;
  }
  return true;
}
void printarr(struct Card c[], int n) {
  for (int i = 0; i < n; ++i) {
    cout << c[i].suit << c[i].value << ((i == n - 1) ? '\n' : ' ');
  }
}
int main() {
  int n;
  cin >> n;
  Card c1[n], c2[n];
  for (int i = 0; i < n; ++i) {
    cin >> c1[i].suit >> c1[i].value;
  }
  for (int i = 0; i < n; ++i) {
    c2[i] = c1[i];
  }
  BubbleSort(c1, n);
  SelectionSort(c2, n);
  printarr(c1, n);
  cout << "Stable" << endl;
  printarr(c2, n);
  if (isStable(c1, c2, n)) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }
}



Measured memory_bytes: 3100
#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 choose2(ll n){
	return n*(n-1)/2;
}

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	rep(i,n) a[i]--;
	vector<int> cnt(n);
	rep(i,n) cnt[a[i]]++;
	ll tot = 0;
	rep(i,n){
		tot += choose2(cnt[i]);
	}
	rep(i,n){
		ll ans = tot;
		ans -= choose2(cnt[a[i]]);
		ans += choose2(cnt[a[i]]-1);
		cout << ans << endl;
	}
}

// cout << fixed << setprecision(15) <<  << endl;

Measured memory_bytes: 4792
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define ll long long
const int INF=1e9+7;

int main(){
#ifndef ONLINE_JUDGE
	freopen("C:\\Users\\User\\Documents\\input.txt","r",stdin);
#endif
	int T,i,j;
	ll n,wt;
	cin>>n>>wt;

	vector<int> w(n),v(n);

	int tot_v=0;
	for(i=0;i<n;++i){
		scanf("%d %d",&w[i],&v[i]);
		tot_v+=v[i];
	}
	vector<ll> dp(tot_v+1,INF);
	dp[0]=0;
	for(i=0;i<n;++i){
		for(j=tot_v-v[i];j>=0;--j){
			dp[j+v[i]]=min(dp[j+v[i]],dp[j]+w[i]);
		}
	}
	int res=0;
	for(i=0;i<=tot_v;++i){
		if(dp[i]<=wt) res=i;
	} 
	printf("%d\n",res);


	return 0;
}

Measured memory_bytes: 4100
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        if (n == 1) {
            System.out.println(1);
        } else {
            double count = 0;
            for (int i = 1; i <= n; i++) {
                if ((i % 2) == 0) {
                    continue;
                }
                count++;
            }
            System.out.println(count / n);
        }
        sc.close();
    }
}


Measured memory_bytes: 35636
while True:
    m,f,r = map(int,input().split())
    s = m + f
    if m == f == r == -1:
        break
    if m == -1 or f == -1:
        print("F")
    elif s >= 80:
        print("A")
    elif 80 > s >= 65:
        print("B")
    elif 65 > s >= 50:
        print("C")
    elif 50 > s >= 30:
        if r >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")


Measured memory_bytes: 5596
#include <stdio.h>
#include <stdio.h>

int main(void){
  char s[11],t[11],u[11];
  int a,b;
  
  scanf("%s %s", s, t);
  scanf("%d %d", &a, &b);
  scanf("%s", u);
  
  if(strcmp(u,s)==0){
    a = a-1;
    printf("%d %d", a, b);
  }
  else if(strcmp(u,t)==0){
    //b=b-1;
    printf("%d %d", a, b-1);
  }
  return 0;
}

  


Measured memory_bytes: 1708
n = int(input())
a = list(map(int, input().split()))
m = 0
for i,j in enumerate(a):
  if i%2==1:
    m+=-1*j
  else:
    m+=j
ans = [m]
for i in range(n-1):
  b = -1*m+2*a[i]
  ans.append(b)
  m = b
print(' '.join(map(str,ans)))

Measured memory_bytes: 24896
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
  ll n, m, c;
  cin >> n >> m >> c;
  vi b(m);
  rep(i,m){
    cin >> b[i];
  }
  vii a(n, vector<ll>(m));
  rep(i,n){
    rep(j,m){
      cin >> a[i][j];
    }
  }
  ll count = 0;
  rep(i,n){
    ll sum = c;
    rep(j, m){
      sum += a[i][j] * b[j];
    }
    if(sum>0){
      count++;
    }
  }
  print(count);
}

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

using namespace std;

int main(){
    string n;
    cin >> n;
    int k;
    cin >> k;
    vector<vector<vector<int64_t>>> DP(n.size() + 1, vector<vector<int64_t>>(2, vector<int64_t>(5)));
    DP[0][1][0] = 1;
    for (int i = 0; i < n.size(); i++){
        for (int j = 0; j < 4; j++){
            if (n[i] != '0'){
                DP[i + 1][1][j + 1] += DP[i][1][j];
                DP[i + 1][0][j] += DP[i][1][j];
                DP[i + 1][0][j + 1] += (n[i] - '0' - 1) * DP[i][1][j];
            } else {
                DP[i + 1][1][j] += DP[i][1][j];
            }
            DP[i + 1][0][j] += DP[i][0][j];
            DP[i + 1][0][j + 1] += 9 * DP[i][0][j];
        }
    }
    cout << DP[n.size()][1][k] + DP[n.size()][0][k] << endl;
}

Measured memory_bytes: 256
cards = {}
for i in ['S', 'H', 'C', 'D']:
    cards.setdefault(i, [])
n = input()
for i in range(int(n)):
    suit, rank = input().split()
    cards[suit].append(rank)
for suit in cards.keys():
    if len(cards[suit]) != 13:
        print('\n'.join([f'{suit} {rank}' for rank in range(1, 14, 1) if str(rank) not in cards[suit]]))


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

using namespace std;

int main() {
    int m, n;
    cin>>m>>n;
    int a[m][n];
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
            char c;
            cin>>c;
            if (c == '.') a[i][j] = 1;
            else a[i][j] = 0;
        }
    }
    int d[m][n];
    d[0][0] = 1;
    int mod = pow(10, 9) + 7;
    for (int i = 1; i < m; i++) d[i][0] = a[i][0]&d[i-1][0];
    for (int i = 1; i < n; i++) d[0][i] = a[0][i]&d[0][i-1];
    for (int i = 1; i < m; i++) {
        for (int j = 1; j < n; j++) {
                if (a[i][j] == 0) d[i][j] = 0;
                else d[i][j] = (d[i-1][j] + d[i][j-1])%mod;
        }
    }
    cout<<d[m-1][n-1]<<endl;
    return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using ll = long long;

int main(){
    ll A,B,C;
    ll K;
    cin>>A>>B>>C>>K;

    if(K<=A){
        cout<<K<<endl;
    }else if(K<=A+B){
        cout<<A<<endl;
    }else{
        cout<<A-(K-A-B)<<endl;
    }
    return 0;

}

Measured memory_bytes: 3624
#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>;

const int MAX_N = 200005;
const int INF = 1001001001;

vector<int> a, ans;
vector<int> to[MAX_N];
int dp[MAX_N];

void dfs(int v, int p=-1) {
  int i = lower_bound(dp, dp+MAX_N, a[v]) - dp;
  int old = dp[i];
  dp[i] = a[v];
  ans[v] = i;
  if (p != -1) ans[v] = max(ans[v], ans[p]);
  for (int u : to[v]) {
    if (u == p) continue;
    dfs(u, v);
  }
  dp[i] = old;
}

int main() {
  int n;
  cin >> n;
  a = ans = vector<int>(n);
  rep(i,n) cin >> a[i];
  rep(i,n-1) {
    int u, v;
    cin >> u >> v;
    --u; --v;
    to[v].push_back(u);
    to[u].push_back(v);
  }
  rep(i,MAX_N) dp[i] = INF;
  dp[0] = -INF;
  dfs(0);
  rep(i,n) cout << ans[i] << endl;
  return 0;
}

Measured memory_bytes: 30928
#include<bits/stdc++.h>
#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 ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll A, B, C, X, Y;
  cin >> A >> B >> C >> X >> Y;

  if(X < Y){
    ll tmp;

    tmp = X;
    X = Y;
    Y = tmp;
    tmp = A;
    A = B;
    B = tmp;
  }

  if(A + B <= 2*C){
    cout << X*A + Y*B << endl;
    return 0;
  }

  ll price = 0;

  price += 2*C*Y;
  X -= Y;

  if(A > 2*C){
    price += 2*C*X;
  } else{
    price += A*X;
  }

  cout << price << endl;
  
  return 0;
}


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

using namespace std;

int main(){
	
	
	array<int, 100> a;
	
	int n, m, sum = 0, l = 0;
	
	cin >> n >> m;
	
	for (int i = 0; i < n; i++){
		cin >> a[i];
		sum = sum + a[i];	
	}
	
	float o = 1 / float((4*m)) * sum;
	
	for (int i = 0; i < n; i++){
		if (a[i] >= o){ 
			l++;
		}
	}
	
	if (l >= m){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	
}	




Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

ll H,W,K;
ll dp[105][10]={};

ll ModPow(ll a,ll b){
    ll ret=1;
    while(b>0){
        if(b&1)ret=(ret*a)%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return ret;
}

ll pat[10]={};
ll Pattern(ll w){
    if(w<1)return 1;
    if(w==1)return 2;
    if(pat[w]!=0)return pat[w];
    return pat[w]=Pattern(w-1)+Pattern(w-2);
}

int main(){
    cin>>H>>W>>K;
    if(W==1){
        cout<<1;
        return 0;
    }
    dp[0][1]=1;
    for(ll i=1;i<=H;i++){
        for(ll j=1;j<=W;j++){
            if(1<j){
                ll tmp = (dp[i-1][j-1]*Pattern((j-2)-1)*Pattern(W-(j+1))  ) %MOD;
                dp[i][j]=(dp[i][j]+tmp)%MOD;
            }
            if(j<W){
                ll tmp = (dp[i-1][j+1]*Pattern((j-1)-1)*Pattern(W-(j+2)) )%MOD;
                dp[i][j]=(dp[i][j]+tmp)%MOD;
            }
            ll tmp=(dp[i-1][j]*Pattern((j-1)-1)*Pattern(W-(j+1)) )%MOD;
            dp[i][j]=(dp[i][j]+tmp)%MOD;
        }
    }
    cout<<dp[H][K]<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

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

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b, c;
  cin >> a >> b >> c;
  if(a+b==c || a+c==b || b+c==a) cout << "Yes" << endl;
  else cout << "No" << endl;
} 






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

vector<string> v;

int main(){
  ll n;cin >> n;
  queue<string> q;
  q.push("a");


  while( !q.empty() ){
    string s = q.front();q.pop();
    if( s.size() > n ) break;
    if( (ll)s.size() == n ){
      v.push_back(s);
    }
    string tmp = s;
    set<char> count_kind;
    rep(i,s.size()) count_kind.insert(s.at(i));
    rep(i,count_kind.size()+1){
      if( 'a'+i <= 'z' ){
        tmp.push_back('a'+i);
        q.push(tmp);
        tmp = s;
      }
    }
  }
  sort(v.begin(),v.end());
  for( auto p : v ){
    cout << p << '\n';
  }
  return 0;
}

Measured memory_bytes: 28984
#include<bits/stdc++.h>
 
typedef long long ll;
 
using namespace std;
 
int main(){
	stack<int> s;
	
	string str;
	while(cin>>str){
		if(str[0] == '+'){
			int t = s.top(); s.pop();
			t += s.top(); s.pop();
			s.push(t);
		}
		else if(str[0] == '-'){
			int t = s.top()*(-1) ; s.pop();
			t += s.top(); s.pop();
			s.push(t);
		}
		else if(str[0] == '*'){
			int t = s.top(); s.pop();
			t *= s.top(); s.pop();
			s.push(t);
		}
		else if(str[0] == '/'){
			int a = s.top(); s.pop();
			int b = s.top(); s.pop();
			s.push(b/a);
		}
		else{
			s.push(atoi(str.c_str()));  //atoi()?????????????????? 
                                                    //string???c_str():?????????????
		}
	}
	cout<<s.top()<<endl;
	return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll l,r;
        cin>>l>>r;
        ll m=min(r-l+1,2019LL);
        ll mini=INF;
        rep(i,m){
            rep2(j,i+1,m){
                ll res=(l+i)*(l+j)%2019;
                chmin(mini,res);
            }
        }
        cout<<mini<<endl;
    }

Measured memory_bytes: 256
temp = input().split(" ")
N = int(temp[0])
K = int(temp[1])

kashi = []
for i in range(K):
    input()
    temp = input().split(" ")
    kashi.extend(temp)

ans = 0
for i in range(N):
    if str(i+1) not in kashi:
        ans += 1

print(ans)

Measured memory_bytes: 9456
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


// ----------------------------------------------------------------------------
int main(){
  string S;
  getline(cin,S);
  for(int i=0; i<(int)S.size(); i++){
    if(isupper(S[i])){
      S[i] = S[i] - 'A' + 'a';
    }else if(islower(S[i])){
      S[i] = S[i] - 'a' + 'A';
    }
  }
  cout << S << endl;
  return 0;
}



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

L = [[0] * N for _ in range(N)]

def nasu(l, r, x):
  if l == r:
    return
  if r - l == 1:
    return
  m = (r + l) // 2
  for i in range(l, m):
    for j in range(m, r):
      L[i][j] = x
  nasu(l, m, x + 1)
  nasu(m, r, x + 1)

nasu(0, N, 1)

for i in range(N - 1):
  t = ""
  for j in range(i + 1, N - 1):
    t += str(L[i][j]) + " "
  t += str(L[i][N - 1])
  print(t)


Measured memory_bytes: 5236
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

string T;
void input(){
    fast_io();
    cin >> T;
}

int solve(){
    int ans = 0;
    for (int i = 0; i < T.length(); i++)
    {
        if(T[i]=='?') T[i] = 'D';
    }
    cout << T << endl;

    return 0;
}   

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

Measured memory_bytes: 3768
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<cmath>
#include<cstring>
#include<climits>
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define LL long long
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 21) + 1], *p1 = buf, *p2 = buf;
inline int read() {
	bool f=0;int x=0;char c=getchar();
	while(c<'0'||'9'<c){if(c==EOF)exit(0);if(c=='-')f=1;c=getchar();}
	while('0'<=c&&c<='9') x=(x<<3)+(x<<1)+(c^48),c=getchar();
	return !f?x:-x;
}
#define MAXN 100
#define INF 0x3f3f3f3f
char S[MAXN+5];
int main(){
	scanf("%s",S);
	int len=strlen(S),k=read();
	if(k==1){
		printf("%d\n",S[0]-'0'+(len-1)*9);
		return 0;
	}
	if(k==2){
		int ans=(len-1)*(len-2)/2*9*9+(S[0]-'0'-1)*(len-1)*9;
		for(int i=1;i<len;i++)
			if(S[i]-'0'){
				ans+=(len-1-i)*9+S[i]-'0';
				break;
			}
		printf("%d\n",ans);
		return 0;
	}
	int ans=(len-1)*(len-2)*(len-3)/6*9*9*9+(S[0]-'0'-1)*(len-1)*(len-2)/2*9*9;
	
	for(int i=1;i<len;i++)
		if(S[i]-'0'){
			ans+=(len-1-i)*(len-2-i)/2*9*9+(S[i]-'0'-1)*(len-1-i)*9;
			for(int j=i+1;j<len;j++)
				if(S[j]-'0'){
					ans+=(len-1-j)*9+S[j]-'0';
					break;
				}
			break;
		}
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int x, max=0, min=0;
        long sum = 0;

        for(int i = 0; i < n; i++){
            x = scanner.nextInt();
            if(i == 0){
                max = x;
                min = x;
            }
            else{
                if(max < x)max = x;
                if(min > x)min = x;
            }
            sum += x;
        }
        System.out.println(min+" "+max+" "+sum);
    }
}



Measured memory_bytes: 41540
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] h = new int[n];
		for (int i = 0; i < n; i++) {
			h[i] = sc.nextInt();
		}
		sc.close();

		int ans = 0;
		int max = 0;
		for (int i = 0; i < n; i++) {
			if (max <= h[i]) {
				ans++;
				max = h[i];
			}
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23252
/**
 *Code Author: codeknight13
 *Institution: IIT(ISM)
**/

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

/*
use these format of input when number of inputs not provided
while(scanf("%lld",&n)!=EOF)
*/

#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define vi vector< ll >
#define vii vector< vi >
#define viii vector< vii >
#define pii pair< ll , ll >
#define vpii vector< pii >
#define mii unordered_map< ll , ll >
#define mci map< char , ll >
#define pq priority_queue
#define str string
#define len length()
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl cout <<  endl
#define sp " "
#define all(ar) ar.begin(), ar.end()
#define itern(n) for (int i=0; i<n; i++)
#define ritern(n) for (int i=n-1; i>=0; i--)
#define sz(x) ((int)(x).size())
#define pi acos(1);                   /* pi */
#define inf (int(1e9+7))
#define fl(x) int(x)
#define mod %(inf)
#define yes "YES"
#define no "NO"
#define null NULL
//debugger
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
//functions
int gcd(int a, int b) {return b == 0 ? a : gcd(b, a % b);}


//#------------------------------complete template------------------------------#//



int main()
{
	fast;
	char c;
	cin >> c;
	if (c=='A')cout << 'T';
	else if (c=='T')cout << 'A';
	else if (c=='G')cout << 'C';
	else cout << 'G';
	return 0;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())

lists = list(map(int, input().split()))
ans = []

for i in lists:
    temp = t - i*0.006
    b = a - temp
    ans.append(abs(b))

answer = min(ans)
    
for i in range(len(lists)):
    temp = t-lists[i]*0.006
    b = abs(a-temp)
    if b == answer:
        print(i+1)
        break

Measured memory_bytes: 3064
from collections import deque
days = int(input())
clast = list(map(int,input().split()))


def scoreing(givenlist):
    global days,clast,allpref
    resultlist = []
    result = 0
    donelist = [deque([0])]*26
    for i in range(days):
        held = givenlist[i]

        donelist[held-1].append(i+1)
        zanen = sum([clast[j]*((i+1)-donelist[j][-1]) for j in range(26)])

        result += allpref[i][held-1] - zanen
        resultlist.append(result)
    donelist.append(resultlist[days-1])
    return donelist

allpref = [] #allpref[day][contest]
for i in range(days):
    allpref.append(list(map(int,input().split())))
donelist = [0]*26
contestlist = []
for i in range(days):
    max = -10**10
    result = 0
    contest = False
    for held in range(26):
        tempdonelist = donelist[:]
        tempdonelist[held] = i+1
        zanen = sum([clast[j]*((i+1)-tempdonelist[j]) for j in range(26)])
        result = allpref[i][held] - zanen
        if result >= max:
            max = result;contest = held


    donelist[contest] = i+1
    contestlist.append(contest+1)

for cont in contestlist:
    print(cont)


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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

char to_lower(char c){
    ll diff = 'A' - 'a';
    return c - diff;
}

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

    // input
    ll N, K;
    cin >> N >> K;

    // メモリ確保テスト
    int dp[1000][1000];
    dp[123][456] = 777;
    // 32bit * 1000000 = 4000KB増えるはず

    string s;
    cin >> s;

    s[K-1] = to_lower(s[K-1]);
    p(s);
        
    return 0;
}


Measured memory_bytes: 256