akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define Ans(f, y, n) if(f) cout << y << endl; else cout << n << endl;
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i, v.size()){ cout << v[i] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i, m.size()){ REP(j, m[i].size()){ cout << m[i][j] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

template<typename T> void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }

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

int mod = 1000000007;
//int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int A, B, T; cin >> A >> B >> T;
    int ans = B * (T / A);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}

int main() {
	int A, B, C; cin >> A >> B >> C;
	cout << C - min(C, A - B) << "\n";
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# 引数が一つだけのやつ
# n = int(input())
# 引数が複数あるやつ（全部数字）
# target = [int(x) for x in input().split()]

# 引数が複数あるやつ（そうじゃないの）
# target = [int(x) for x in input().split()]

# 最初の行で複数行を受け取って処理するやつ
number = int(input())
target = [input() for i in range(number)]

# 初期
result = {"AC": 0, "WA": 0, "TLE": 0, "RE": 0}

# 判定
for x in target:
    result[x] += 1

# 出力
for title, value in result.items():
    print(title + " x " + str(value))


Measured memory_bytes: 16268
n, m, q = map(int, input().split())

train = [[0 for _ in range(501)] for _ in range(501)]
train_total = [[0 for _ in range(501)] for _ in range(501)]
query = []

for i in range(m):
    a, b = map(int, input().split())
    train[a][b] += 1

for j in range(q):
    x, y = map(int, input().split())
    query.append([x, y])

for left in range(0, 501):
    cnt = 0
    for right in range(0, 501):
        cnt += train[left][right]
        train_total[left][right] = cnt

for left, right in query:
    total = 0
    for row in range(left, right+1):
        num2 = train_total[row][right]
        num1 = train_total[row][left-1]
        total += (num2 - num1)
    print(total)

Measured memory_bytes: 82392
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)
#define rep(i, n) FOR(i, 0, n)
#define ALL(x) begin(x), end(x)
using namespace std;
using ll = long long;
constexpr ll Mod = 998244353;
constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;
const double PI = acos(-1);
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
    return a < b && (a = b, true);
}
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
    return a > b && (a = b, true);
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
    for(int i = 0; i < (int)v.size(); i++)
        os << (i ? " " : "") << v[i];
    return os;
}
/*-------------------------------------------*/

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

    int n;
    cin >> n;
    n %= 1000;
    cout << (n ? 1000 - n : 0) << endl;

    return 0;
}

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

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <utility>
#include <stack>

using namespace std;

int main() {
	stack<int> S1;
	stack<pair<int, int> > S2;
	char c;
	int sum = 0;
	for (int i = 0; cin >> c; ++i) {
		if (c == '\\') S1.push(i);
		else if (c == '/' && S1.size() > 0) {
			int j = S1.top(); S1.pop();
			sum += i - j;
			int a = i - j;
			while (S2.size() > 0 && S2.top().first > j) {
				a += S2.top().second; S2.pop();
			}
			S2.push(make_pair(j, a));
		}
	}

	vector<int> ans;
	while (S2.size() > 0) {
		ans.push_back(S2.top().second);
		S2.pop();
	}
	cout << sum << endl;
	cout << ans.size();
	for (int i = ans.size() - 1; i >= 0; --i)
		cout << " " << ans[i];
	cout << endl;

	return 0;
}


Measured memory_bytes: 3188
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TemplateAlgorithm
{
    class Program
    {
        public const long Inf = (long)1e18;
        public const double eps = 1e-6;
        public const string alfa = "abcdefghijklmnopqrstuvwxyz";
        public const string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const int MOD = 1000000007;
        
        // c ot i
        static int ToInt(char c) => c - '0';

        static void Main(string[] args)
        {
            string A, B;
            A = IO.ReadStr();
            B = IO.ReadStr();

            if (A.Length > B.Length)
            {
                WriteLine("GREATER");
                return;
            }
            else if (A.Length < B.Length)
            {
                WriteLine("LESS");
                return;
            }

            switch (A.CompareTo(B))
            {
                case -1:
                    WriteLine("LESS");
                    break;
                case 0:
                    WriteLine("EQUAL");
                    break;
                case 1:
                    WriteLine("GREATER");
                    break;
            }
        }

        #region  範囲

        public static bool InRange<T>(T begin, T end, T value) where T : IComparable<T> 
            => value.CompareTo(begin) >= 0 && value.CompareTo(end) <= 0;

        #endregion

        #region MIN,MAX

        /// <summary>
        /// 最大値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MaxValue<T>(params T[] vals) => vals.Max();

        /// <summary>
        /// 最小値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MinValue<T>(params T[] vals) => vals.Min();
        #endregion
    }

    #region IO

    /// <summary>
    /// IO
    /// </summary>
    public class IO
    {
        public static string ReadStr(bool isTrim = false) => (isTrim) ? ReadLine().Trim() : ReadLine();
        public static int ReadInt() => int.Parse(ReadStr());

        public static long ReadLong() => long.Parse(ReadStr());

        public static decimal ReadDecimal() => decimal.Parse(ReadStr());
        public static double ReadDouble() => double.Parse(ReadStr());
        public static string[] ReadStrArr(char separator = ' ') => ReadLine().Split(separator);
        public static int[] ReadIntArr() => Array.ConvertAll(ReadStrArr(), int.Parse);
        public static long[] ReadLongArr() => Array.ConvertAll(ReadStrArr(), long.Parse);

        public static decimal[] ReadDecimalArr() => Array.ConvertAll(ReadStrArr(), decimal.Parse);
        public static double[] ReadDoubleArr() => Array.ConvertAll(ReadStrArr(), double.Parse);        
    }

    #endregion    
}


Measured memory_bytes: 13140
H, W, M = map(int, input().split())

A = [0 for _ in range(H)]
B = [0 for _ in range(W)]
C = set()

for _ in range(M):
  h, w = map(int, input().split())
  A[h-1] += 1
  B[w-1] += 1
  C.add((h-1, w-1))
  
d = max(A)
e = max(B)
ans = d+e

F = set()
G = set()
for h in range(H):
  if A[h] == d:
    F.add(h)
for w in range(W):
  if B[w] == e:
    G.add(w)
  
spot = len(F)*len(G)
spt_bm = 0

for c in C:
  if c[0] in F and c[1] in G:
    #print(c)
    spt_bm += 1
    
if spt_bm == spot:
  ans -= 1
  
#print(A, d, F)
#print(B, e, G)
#print(spt_bm, spot)
print(ans)
    
  

Measured memory_bytes: 101980
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1000000007;
int main()
{
    // freopen("input01.txt", "r", stdin);
    // freopen("output01.txt", "w", stdout);
    ll int x, k, d;
    cin >> x >> k >> d;
    x=abs(x);
    ll int steps=min(k,x/d);
    x-=steps*d;
    k-=steps;
    if(k%2)
        cout<<(ll int)abs(d-x);
    else
    {
        cout<<(ll int)abs(x);
    }
    return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
#include<stdlib.h>
#define df 0
#define MAX 100000
int n,m;

int* adj[MAX*3];
int deg[MAX]={};
int Q[MAX*3]={};
int head=0,tail=0;
void inque(int a){
  Q[tail++]=a;
}
int deque(){
  return Q[head++];
}
void print_que(){
  int i;
  printf("Q:[");
  for(i=head;i<tail;i++){
    printf(" %d",Q[i]);
  }
  printf(" ]\n");
}

int main(){
  scanf("%d%d",&n,&m);
    int i,j,u,v;
    for(i=0;i<m;i++){
      scanf("%d%d",&u,&v);
	u--; v--;
	adj[u]=realloc(adj[u],sizeof(int)*(++deg[u]));
	adj[u+n]=realloc(adj[u+n],sizeof(int)*(deg[u]));
	adj[u+2*n]=realloc(adj[u+2*n],sizeof(int)*(deg[u]));
	adj[u][deg[u]-1]=v+n;
	adj[u+n][deg[u]-1]=v+2*n;
	adj[u+2*n][deg[u]-1]=v;
    }
    int s,t;
    scanf("%d%d",&s,&t);
    s--;t--;
    if(df){
      for(i=0;i<3*n;i++){
	printf("vtx %d, deg: %d\n",i,deg[i%n]);
	for(j=0;j<deg[i%n];j++)
	printf(" %d",adj[i][j]);
	printf("\n");
      }
    }
    int temp,next,step[MAX*3];
    for(i=0;i<n*3;i++)step[i]=-3;
    inque(s); step[s]=0;
    while(head!=tail){
      if(df) print_que();
      temp=deque();
      if(temp==t)break;
      if(df){
	printf("search:%d (deg:%d)\n",temp,deg[temp%n]);
	for(i=0;i<deg[temp%n];i++)
	  printf(" %d",adj[temp][i]);
	printf("\n");
      }
      for(i=0;i<deg[temp%n];i++){
	next=adj[temp][i];
	if(df)printf("step[%d]= %d\n",next,step[next]);
	if(step[next]>=0) continue;
	inque(next);
	step[next]=step[temp]+1;
	if(df)printf("      --> %d\n",step[next]);
      }
    }
    printf("%d",step[t]/3);
	
	

    
}


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

using namespace std;

int main() {
	int a, b;
  	cin >> a >> b;
  	string s, t;
  	for (int i = 0; i < a; ++i)
    	s += b + '0';
  	for (int i = 0; i < b; ++i)
      	t += a + '0';
  	cout << min(s, t) << '\n';
  	return 0;
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

s = input()[:-1]

t = input()[:-1]
ans = Max
if len(s) >= len(t):
    for i in range(len(s) - len(t) + 1):
        co = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                co += 1
        ans = min(ans,co)

else:
    for i in range(len(t) - len(s) + 1):
        co = 0
        for j in range(len(s)):
            if s[j] != t[i+j]:
                co += 1
        ans = min(ans,co)

print(ans)

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

#define int long long
const int INF = (1LL << 31) - 1;
const int sqrtN = 512;
struct SqrtDecomposition {
  int N, K;
  vector<int> data;
  vector<bool> lazyFlag;
  vector<int> lazyUpdate;
  SqrtDecomposition(int n) : N(n) {
    K = (N + sqrtN - 1) / sqrtN;
    data.assign(K * sqrtN, INF);
    lazyFlag.assign(K, false);
    lazyUpdate.assign(K, 0);
  }
  void eval(int k) {
    if (lazyFlag[k]) {
      lazyFlag[k] = false;
      for (int i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
        data[i] = lazyUpdate[k];
      }
    }
  }
  // [s, t)
  void update(int s, int t, int x) {
    for (int k = 0; k < K; ++k) {
      int l = k * sqrtN, r = (k + 1) * sqrtN;
      if (r <= s || t <= l)
        continue;
      if (s <= l && r <= t) {
        lazyFlag[k] = true;
        lazyUpdate[k] = x;
      } else {
        eval(k);
        for (int i = max(s, l); i < min(t, r); ++i) {
          data[i] = x;
        }
      }
    }
  }
  int find(int i) {
    int k = i / sqrtN;
    eval(k);
    return data[i];
  }
};

signed main() {
  ios::sync_with_stdio(false);
  int N, Q;
  cin >> N >> Q;
  SqrtDecomposition decomp(N);
  while (Q--) {
    int c;
    cin >> c;
    if (c == 0) {
      int s, t, x;
      cin >> s >> t >> x;
      decomp.update(s, t + 1, x);
    } else {
      int i;
      cin >> i;
      cout << decomp.find(i) << endl;
    }
  }
}

Measured memory_bytes: 3616
n = gets.to_i
d = gets.split.map(&:to_i)
m = gets.to_i
t = gets.split.map(&:to_i)

hd = Hash.new 0
d.each{|x| hd[x] += 1}
ht = Hash.new 0
t.each{|x| ht[x] += 1}

ht.keys.each{|k|
ht[k] -= hd[k]
}
puts ht.values.all?{|x| x <= 0} ? :YES : :NO





Measured memory_bytes: 58164
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main(void){
  long long int a,b;
  char c;
  scanf("%lld %c %lld",&a,&c,&b);
  if(c=='+') printf("%lld\n",a+b);
  else printf("%lld\n",a-b);
  return 0;
}

Measured memory_bytes: 764
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<cstdio>
#include<cmath>
#include<utility>
#include<string>

#define REP(n) for(int i = 0;i < n;i++)
#define LLREP(n) for(long long int  i = 0;i < n;i++)
typedef long long int ll;
using namespace std;
#define MAX_A 1000000007

int main(){

    double x,h;
    while(cin >> x >> h,x != 0){

        double bottom = x*x;
        double height = sqrt(pow(x/2,2.0)+pow(h,2.0));
        double ans = bottom + 4*x*height/2;
        printf("%.6f\n",ans);
    }

    return 0;
}


Measured memory_bytes: 3268
#include<iostream>
#include<cstring>
using namespace std;
int main(){
    string S;
    cin >> S;
    int ce0 = 0;
    int ce1 = 0;
    int co0 = 0;
    int co1 = 0;
    int ans;
    for(int i = 0; i < S.size(); ++i){
        if(i % 2 == 0){
            if(S[i] == '0') co0++;
            else co1++;
        }
        else{
            if(S[i] == '0') ce0++;
            else ce1 ++;
        }
    }
    int a = max(max(ce0, ce1), max(co0, co1));
    if(ce0 == a || co1 == a) ans = ce1 + co0;
    else ans = ce0 + co1;
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.*;
import java.io.*;

public class Main {

    private static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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;
        }
    }

    public static void main(final String[] args) throws IOException {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out, true);

        // Input
        int n = in.nextInt();
        char[] s = in.next().toCharArray();

        int[] we = new int[n];
        we[0] = 0;
        for (int i = 1; i < n; i++) {
            if (s[i - 1] == 'W') {
                we[i] = we[i - 1] + 1;
            } else {
                we[i] = we[i - 1];
            }
        }

        int[] ew = new int[n];
        ew[0] = 0;
        for (int i = n - 2; i >= 0; i--) {
            if (s[i + 1] == 'E') {
                ew[i] = ew[i + 1] + 1;
            } else {
                ew[i] = ew[i + 1];
            }
        }

        int answer = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int difference = Math.abs(we[i] + ew[i]);
            if (difference < answer) {
                answer = difference;
            }
        }
        System.out.println(answer);
    }

}


Measured memory_bytes: 29268
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;

class Program
{


    static void Main(string[] args)
	{
        int a = int.Parse(Console.ReadLine());

        if(a == 1)
        {
            Console.WriteLine(0);
        }
        else
        {
            Console.WriteLine(1);
        }

    }
}

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

void solve(long long X){
    ll k=0;
for(ll i=-120; i<120; i++){
        ll a=i*i*i*i*i;
    for(ll j=-120; j<120; j++){
        ll b=j*j*j*j*j;
        if(a-b==X){
            k=b;
            cout<< i << " " << j <<endl;
            break;
   }     
}
    if(a-k==X){
        break;
    }

}
}


int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


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

struct Fast {Fast() {std::cin.tie(0); ios::sync_with_stdio(false);}} fast;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define MOD 1000000007

ll xorsum(ll n) {
    if (n == 0) {
        return 0;
    }
    else if (n & 1) {
        if ((n >> 1) & 1) {
            return 0;
        }
        else {
            return 1;
        }
    }
    else {
    return n ^ (xorsum(n - 1));
    }

}



int main() {
    ll A,B; cin >> A >> B;
    if(A == 0) cout << xorsum(B) << endl;
    else cout << (xorsum(A-1)^xorsum(B)) << endl;

}





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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// cmd

string data, bef;

bool check()
{
    if (bef == data) return false;
    if (data.size() <= 3) return false;
    return true;
}

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

    cin >> data;

    while (check()) {
        //cout << bef << endl;
        vb app(3, false);
        bef = data;
        data = "";
        int i = 0;
        for (i = 0; i < bef.size()-2; i++) {
            if (bef[i] == 'A' && bef[i+1] == 'B' && bef[i+2] == 'C') {
                data.pb('X');
                i += 2;
            } else {
                data.pb(bef[i]);
                app[bef[i] - 'A'] = true;
            }
        }
        for (; i < bef.size(); i++) {
            data.pb(bef[i]);
            app[bef[i]-'A'] = true;
        }

        //cout << data << endl;

        rep(i, app.size()) {
            if (!app[i]) {
                rep(j, data.size()) {
                    if (data[j] == 'X') data[j] = 'A' + i;
                }
                break;
            }
        }
        //cout << data << endl;
        //cout << "============" << endl;
    }

    cout << ((data == "ABC") ? "Yes" : "No") << endl;


    return 0;
}











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

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

    int N, tmp, i; cin >> N;
    int value[51];
    double min = 1001;
    for(i = 0; i < N; i++)
    {
        cin >> value[i];
        if(value[i] < min)
        {
            min = value[i];
            tmp = i;
        }
    }
    value[tmp] = 1002;

    int tmp3 = N;
    while(N > 1)
    {
        double s_min = 1001;
        int tmp2;
        for(int i = 0; i < tmp3; i++)
        {
            if(value[i] <= s_min)
            {
                s_min = (double) value[i];
                tmp2 = i;
            }
        }
        value[tmp2] = 1002;
        min = ( min + s_min )/2;
        N--;
    }

    printf("%.5f", min);

    return 0;
}

Measured memory_bytes: 256
N, K = map(int, input().split())

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

p = 0
q = 0
ans = 0
for i in range(N):
    for j in range(i, N):
        if A[i] > A[j]:
            p += 1

for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            q += 1

ans = (p * K) % 1000000007 + (q * K * (K-1) // 2) % 1000000007

print(ans % 1000000007)


Measured memory_bytes: 3188
#include <stdio.h>

int main()
{
	long inputN, inputA, inputB;
	long  aBallsInRow, lastRowABalls;

	scanf("%ld %ld %ld", &inputN, &inputA, &inputB);

	// Count all A balls until the last row
	aBallsInRow = (inputN / (inputA + inputB)) * inputA;
	// Count balls in the last row
	lastRowABalls = (inputN % (inputA + inputB));

	// if there are some B balls in the last row, makes it to  count in only  A balls
	if (lastRowABalls > inputA)
	{
		lastRowABalls = inputA;
	}

	aBallsInRow += lastRowABalls;

	printf("%ld \n", aBallsInRow);

	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N>>M;
    vec a(N);
    rep(i,N) {
        cin>>a[i];
        --a[i];
    }
    vec num(M*2,0), minus_num(M*2,0), switch_erase(M*2,0);
    ll sum = 0;
    reps(i,1,N){
        ll last = a[i-1], next = a[i];
        if(next < last) next += M;
        sum += next - last;
        ++num[last]; --minus_num[next];
        switch_erase[next] += next - last - 1;
    }
    ll stock = 0, adv = 0;
    vec memo(M,0);
    rep(i,M*2){
        if(i != 0) adv += stock - num[i-1];
        memo[i%M] += adv;
        stock += num[i] + minus_num[i];
        adv -= switch_erase[i];
    }
    ll ans = sum;
    rep(i,M) ans = min(ans, sum - memo[i]);
    /*rep(i,M){
        if(sum - memo[i] == ans) cout<<i<<endl;
    }*/
    cout<<ans<<endl;
}

Measured memory_bytes: 6528
#pragma optimize("O3")
#pragma GCC target ("sse4")

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

typedef long long int ll;
typedef pair<ll, ll> pii;
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b)  for(ll i=a;i>=b;i--)
#define vll vector<ll>
#define sz(a) ll(a.size())
#define all(v) v.begin(),v.end()
#define pb push_back
#define pf push_front 
#define MAXN 100010
#define N 100010
#define MOD 1000000007
#define mod 998244353
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define nl '\n'
#define MS(x,y) fill_n(*x, sizeof x / sizeof **x, y);
#define mem(x,y) memset(x,y,sizeof(x));
#define INF 1000000000000000000
#define IO                 \
	ios::sync_with_stdio(0); \
	cin.tie(0);              \
	cout.tie(0);

template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
static_assert(D >= 1, "Vector dimension must be greater than zero!");
template<typename... Args>
	Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
	}
};
template<typename T>
struct Vec<1, T> : public vector<T> {
	Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {
	}
};

ll modpower(ll x, ll y,ll p)
{
    ll res = 1;     // Initialize result
    x = x % p;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; // y = y/2
        x = (x*x) % p;  // Change x to x^2
    }
    return res;
}
ll power(ll x, ll y)
{
    ll res = 1;     // Initialize result
    x = x ;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x);
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}
// int gcd(int a, int b) { if (a == 0)return b;return gcd(b % a, a);}

ll modinv(ll a,ll p){return modpower(a,p-2,p);}

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

long long safe_sqrt(long long n) {
    long long res = sqrt((long double) n);
    if (res*res == n) return res;
    const long double eps = 1e-8;
    if ((long double)(res+1)*(res+1) < n + eps) return res+1;
    if ((long double)res*res + eps > n) return res-1;
    return res;
}   
// (a+b-1)/b for ceil
void solve(){
    ll n;
    cin>>n;
    vll a(n);
    ll num = 0;
    f(i,0,n){
        cin>>a[i];
        if (i%2==0 and a[i]%2)
        {
            num++;
        }
    }
    cout<<num<<nl;
    return ;
}
int main()
{
    IO;
    // #ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    // #endif
    int T = 1;
    // cin >> T;
    f(c, 0, T){
        solve();
    }
    return 0;
}//multiset m make_pair make_tuple  tuple<int,int,int> continue resize insert count size else true isValid second first false erase double priority_queue 
//cout<<setprecision(12); push_back pop_back pop_front push_front  lower_bound upper_bound  reverse

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

int main(){
  vector<int> x(3,0);
  REP(i,3) cin>>x.at(i);
  sort(x.begin(), x.end());
  if(x.at(0)==5 && x.at(1)==5 && x.at(2)==7) cout<<"YES";
  else cout<<"NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define all(v) (v).begin(),(v).end()
#define vsort(v) sort(all(v))
#define mod 1000000007
using data=pair<ll,ll>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

typedef struct unionfind{
  vector<int> par,treesize;
  unionfind(int N) :par(N){
    for(int i=0;i<N;i++)par[i]=i;
    treesize.resize(N);
    for(int i=0;i<N;i++)treesize[i]=1;
  }
  int root(int x){
    int r;
    if(par[x]==x)return x;
    r=root(par[x]);
    if(par[x]!=r){
      treesize[r]+=treesize[x];
      treesize[x]=0;
      par[x]=r;
    }
    return r;
  }
  void unite(int x,int y){
    int px=root(x);
    int py=root(y);
    if(px!=py){
      par[px]=py;
      treesize[py]+=treesize[px];
      treesize[px]=0;
    }
  }
  bool parcheck(int x,int y){
    int px=root(x);
    int py=root(y);
    return px==py;
  }
  int size(int x){
    int px=root(x);
    return treesize[px];
  }
};



int main(){
  ll i,j,N,M,x,tr=0,A,B,k;
  cin>>N>>A>>B;
  if(A+2>B||N<A+1){cout<<N+1<<endl;return 0;}
  N=N-A-1;
  k=N/2;
  tr=B+N-2*k;
  tr+=k*(B-A);
  cout<<tr<<endl;
  return 0;
}

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)
typedef long long ll;

const int MAX_N=1e5,MAX_A=1e5;

int N,A[MAX_N];

int cnt[MAX_A+1];

int main(){
	cin>>N;
	int ans=0;
	REP(i,N){
		cin>>A[i];
		if (cnt[A[i]]++==0){
			ans++;
		}
	}
	bool flg=false;
	REP(i,MAX_A+1){
		if (cnt[i]==0){
			continue;
		}
		if (cnt[i]%2==0){
			flg=!flg;
		}
	}
	if (flg){
		ans--;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int n;
int a[105];
int main() {
    ios_base::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    int bal = 0;
    for (int i = 1; i <= n; i++) {
        if (i % 2) {
            bal += a[n + 1 - i];
        }
        else bal -= a[n + 1 - i];
    }
    cout << bal;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int a, b, c, flag = 0;
	
	scanf("%d %d %d", &a, &b, &c);
	
	if (a < b){
		if (b < c){
			flag = 1;
		}
	}
	
	if (flag == 1){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return (0);
}

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

bool qry(int x, int y) {
	(std::cout << "? " << x << ' ' << y << '\n').flush();
	static char buf[10]; std::cin >> buf;
	return *buf == 'Y';
}
const int MAXN = 4010;
int A, B, n, li[MAXN], bak;
char out[MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> A >> B; n = A + B;
	if (A <= B) return std::cout << "Impossible" << std::endl, 0;
	for (int i = 0; i < n; ++i)
		if (bak && !qry(li[bak], i)) --bak;
		else li[++bak] = i;
	for (int i = 0; i < n; ++i)
		out[i] = qry(li[bak], i) + '0';
	std::cout << "! " << out << std::endl;
	return 0;
}


Measured memory_bytes: 724
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

struct Node{
  int key;
  Node* parent;
  Node* left;
  Node* right;
  Node(){
    parent = left = right = NULL;
  }
};

class Tree{
  Node* root = NULL;
  public:
  void insert(Node* n){
    Node* y = NULL;
    Node* x = root;
    while(x!=NULL){
      y = x;
      if(n->key < x->key){
        x = x->left;
      }else{
        x = x->right;
      }
    }
    if(y==NULL){
      root = n;
    }else if(n->key < y->key){
      y->left = n;
      n->parent = y;
    }else{
      y->right = n;
      n->parent = y;
    }
  }

  void print(){
    print_inorder(root);
    printf("\n");
    print_preorder(root);
    printf("\n");
  }

  void print_preorder(Node* n){
    if(n==NULL) return;
    printf(" %d",n->key);
    print_preorder(n->left);
    print_preorder(n->right);
  }
  void print_inorder(Node* n){
    if(n==NULL) return;
    print_inorder(n->left);
    printf(" %d",n->key);
    print_inorder(n->right);
  }

  bool has(int val){
    if(find(val)!=NULL){
      return true;
    }else{
      return false;
    }
  }

  Node* find(int val){
    Node* x;
    x = root;
    while(1){
      if(x == NULL){
        return NULL;
      }else if(x->key == val){
        return x;
      }else if(val < x->key){
        x = x->left;
      }else{
        x = x->right;
      }
    }
  }

  void del(Node* x){
    if(x->left == NULL && x->right == NULL){
      if(x->parent->left == x){
        x->parent->left = NULL;
        delete x;
      }else{
        x->parent->right = NULL;
        delete x;
      }
    }else if(x->left == NULL){
      if(x->parent->left == x){
        x->parent->left = x->right;
        x->right->parent = x->parent;
        delete x;
      }else{
        x->parent->right = x->right;
        x->right->parent = x->parent;
        delete x;
      }
    }else if(x->right == NULL){
      if(x->parent->left == x){
        x->parent->left = x->left;
        x->left->parent = x->parent;
        delete x;
      }else{
        x->parent->right = x->left;
        x->left->parent = x->parent;
        delete x;
      }
    }else{
      Node* y = x->right;
      while(y->left!=NULL){
        y = y->left;
      }
      x->key = y->key;
      del(y);
    }
  }

  void del(int val){
    Node* x = find(val);
    del(x);
  }
};

int main(){
  int n;cin>>n;
  Tree t;
  for(int i=0;i<n;i++){
    string ope; cin>>ope;
    if(ope=="insert"){
      int k; cin>>k;
      Node* node = new Node();
      node->key = k; 
      t.insert(node);
    }else if(ope=="print"){
      t.print(); 
    }else if(ope=="find"){
      int v; cin>>v;
      if(t.find(v)){
        cout<<"yes"<<endl;
      }else{
        cout<<"no"<<endl;
      }
    }else if(ope=="delete"){
      int v; cin>>v;
      t.del(v);
    }
  }
  return 0;
}

Measured memory_bytes: 22032
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    string S, T;
    in2(S, T);

    ll ans = INF;

    rep(i, S.size() - T.size() + 1)
    {
        ll count = 0;

        rep(j, T.size())
        {
            if (S[i + j] != T[j]) count++;
        }

        chmin(ans, count);
    }

    outl(ans);

    return 0;
}

Measured memory_bytes: 3648
import { readFileSync } from 'fs'

function main(input: string) {
  const lines = input.split('\n').map(Number)
  const antennas = lines.slice(0, 5)
  const k = lines[5]

  const max = Math.max(...lines)
  const min = Math.min(...lines)

  console.log((max - min) <= k ? 'Yay!' : ':(')
}

main(readFileSync('/dev/stdin', 'utf8').trim())


Measured memory_bytes: 7500
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<62;
const int INF = 1<<30;
const double PI=acos(-1);
const ll mod=1000000007;
long long modpow(long long a, long long n, long long mod=(1LL<<62)){
	long long res = 1;
	while (n > 0){
		if (n & 1)
		res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main(){
	ll m,n;
	ll ans=0;
	cin >>m>>n;
	cout<<modpow(m,n,mod)<<endl;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
typedef long long ll;
#define iof ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pi 3.1415926535897
const ll mod =1000000007;
#define inf 100000
using namespace std;

int main()
{

    ll n; cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    sort(arr,arr+n);
    cout<<arr[n/2]-arr[n/2 -1];

}



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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  ll n, a, b, c, ans = 0;
  cin >> n >> a >> b;
  if (a == 0) {
    cout << 0 << endl;
    return 0;
    }
  if (b == 0) {
    cout << n << endl;
    return 0;
  }

  c = a + b;
  ll cnt = (n / c) * a;
  ans = cnt;
  if (n % c != 0) ans += min(n % c, a);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int i,x[5],e;
	for(i=1;i<=5;i++){
		scanf("%d",&x[i]);
	}
	for(i=1;i<=5;i++){
		if(x[i]==0){
			e=i;
		}
	}
	printf("%d",e);
	return 0;
}

Measured memory_bytes: 1708
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define fi first
//#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  i64 h;
  cin >> h;

  i64 result = 0;
  i64 a = 1;
  while (h) {
    result += a;
    a <<= 1;
    h >>= 1;
  }
  cout << result;
}
#endif


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

int main() {
  string T;
  cin >> T;
  
  for(int i = 0; i < T.size(); i++){
    if(T.at(i) == '?'){
      T.at(i) = 'D';
    }
  }
  cout << T << endl;
  
  
}


Measured memory_bytes: 3724
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<string>
long long  INF=1'0000'0000'0000'0000'00;
using namespace std;

int main(){

int N;
cin >> N;
map<string,int>ana;
long long ans=0;
string s;
int t;
for(int k=0;k<N;k++){
    cin>>s;
    sort(s.begin(),s.end());
    auto iter=ana.find(s);
    if(iter!=ana.end()){
        iter->second++;
        t=iter->second;
    }
    else{
        t=0;
        ana.insert(make_pair(s,t));
        continue;
    }
    ans+=t;
    
}

cout<<ans<<endl;

    

 return 0;
}

Measured memory_bytes: 11136
n,y = map(int,input().split())
d = 0

for a in range(n+1):#10000
    for b in range(n+1):#5000
        c = n - a - b
        x = 10000*a + 5000*b + 1000*c
        if x == y and c >=0:
            print("{} {} {}".format(a,b,c))
            d =1
            break
    else:
        continue
    break



if d == 0:
    print("-1 -1 -1")

Measured memory_bytes: 40684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

template<class T>
struct Dijkstra {
    const T inf = numeric_limits<T>::max() / 2 - 1;
    vector<T> dist;
    vector<int> path;
    
    Dijkstra() {}
    Dijkstra(int n) {
        graph.resize(n);
        dist.resize(n);
        prev.resize(n);
    }
    
    void add_edge(int from, int to, T cost) {
        graph[from].emplace_back(to, cost);
    }
    
    void get_distance(int from) {
        priority_queue<pair<T, int>, vector<pair<T, int>>, greater<pair<T, int>>> pq;
        fill(dist.begin(), dist.end(), inf);
        fill(prev.begin(), prev.end(), -1);
        dist[from] = 0;
        pq.push(make_pair(0, from));
        while(!pq.empty()) {
            pair<T, int> p = pq.top(); pq.pop();
            if (dist[p.second] < p.first) continue;
            for (auto e : graph[p.second]) {
                if (dist[e.first] > (dist[p.second] + e.second)) {
                    dist[e.first] = dist[p.second] + e.second;
                    prev[e.first] = p.second;
                    pq.push(make_pair(dist[e.first], e.first));
                }
            }
        }
    }
    
    void get_path(int to) {
        path = vector<int>(0);
        for (; to != -1; to = prev[to]) {
            path.push_back(to);
        }
        reverse(path.begin(), path.end());
    }
    
private:
    vector<vector<pair<int, T>>> graph;
    vector<T> prev;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n, m, s, t;
    cin >> n >> m >> s >> t;
    s--; t--;
    Dijkstra<ll> yen(n), snk(n);
    rep(i, m) {
        ll u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        yen.add_edge(u, v, a);
        yen.add_edge(v, u, a);
        snk.add_edge(u, v, b);
        snk.add_edge(v, u, b);
    }
    yen.get_distance(s);
    snk.get_distance(t);
    vector<ll> ans(n);
    ll tmp = LONG_LONG_MIN;
    rrep(i, n) {
        tmp = max(tmp, (ll)1e15 - (yen.dist[i] + snk.dist[i]));
        ans[i] = tmp;
    }
    rep(i, n) printf("%lld\n", ans[i]);
    return 0;
}


Measured memory_bytes: 20552
N, K = map(int, input().split())
N = N%K
history = []
min_num = 0
while True:
  if (N==0):
    min_num = N
    break
  elif N in history:
    min_num = min(history)
    break 
  history.append(N)
  N = abs(N-K)

print(min_num)

      


Measured memory_bytes: 9108
#include<bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define mp make_pair
#define ll long long
using namespace std;
const int N=20;
int n,d,x[N][N],ans;
int main()
{
	cin>>n>>d;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<d;j++)
		{
			cin>>x[i][j];
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			int sum=0;
			for(int k=0;k<d;k++)
			{
				sum+=(x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
			}
			int lc=sqrt(sum);
			if(lc*lc==sum)
				ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main(){
    string S, T;
    cin >> S >> T;
    rep(i, S.size()){
        if(S==T){
            cout << "Yes" << endl;
            return 0;
        }
        S = S.back() + S.substr(0, S.size()-1);
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import sys

def print_arr(arr):
	for i in range(len(arr)):
		sys.stdout.write(str(arr[i]))
		if i != len(arr) - 1:
			sys.stdout.write(' ')
	print()

n = int(input())
arr = list(map(int, input().split()))

swap_count = 0
for i in range(n):
	mini = i
	for j in range(i, n):
		if arr[j] < arr[mini]:
			mini = j
	if mini != i:
		temp = arr[i]
		arr[i] = arr[mini]
		arr[mini] = temp
		swap_count += 1

print_arr(arr)
print(swap_count)



Measured memory_bytes: 5612
import java.io.*;
import java.util.*;
import java.util.Collections;
  
class Main{
    public static void main(String[] a) throws Exception{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        Integer[] mountains=new Integer[10];
        for(int i=0;i<10;i++){
            mountains[i]=Integer.valueOf(br.readLine());
        }
        Arrays.sort(mountains, Collections.reverseOrder());
        for(int i=0;i<3;i++){
            System.out.println(mountains[i]);
        }       
    }
}


Measured memory_bytes: 24332