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

using namespace std;
#define ll long long
#define ld long double

#define endl '\n'
#define FAST                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN = 1e5 + 5;
ll fastPow(ll x, ll b)
{
    if (b == 0)
        return 1;
    else if (!(b & 1))
    {
        return fastPow(x * x, b / 2);
    }
    else
        return x * fastPow(x * x, (b - 1) / 2);
}
    //__builtin_popcount ();
    int main()
{
    FAST
    string a,b;
    cin>>a>>b;
    int x,y;
    cin>>x>>y;
    map<string,int>m;
    m[a]=x;
    m[b]=y;
    string u;
    cin>>u;
    m[u]--;
    cout<<m[a]<<" "<<m[b]<<endl;
    return 0;
}

Measured memory_bytes: 256
n,a,b = map(int,input().split())
s = input()
cnt = 0
kaigai = 0
for i in range(n):
    if s[i] == "a":
        if a+b > cnt:
            print("Yes")
            cnt += 1
        else:
            print("No")
    elif s[i] == "b":
        if a+b > cnt and kaigai < b:
            print("Yes")
            kaigai += 1
            cnt += 1
        else:
            print("No")
    else:
        print("No")


Measured memory_bytes: 53336
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
struct BIT
{
	int bit[105];
	BIT(){memset(bit,0,sizeof(bit));}
	void add(int i,int x)
	{
		while(i<=100)
		{
			bit[i]+=x;
			i+=i&-i;
		}
	}
	int sum(int i)
	{
		int res=0;
		while(i>0)
		{
			res+=bit[i];
			i-=i&-i;
		}
		return res;
	}
};
int main()
{
	while(1)
	{
		int n;
		cin >> n;
		if(n==0)break;
		vector<int> v(n),zip;
		for(int i=0;i<n;i++)cin >> v[i];
		zip=v;
		sort(all(zip));
		for(int i=0;i<n;i++)v[i]=lower_bound(all(zip),v[i])-zip.begin()+1;
		int ans=0;
		BIT bit;
		for(int i=n-1;i>=0;i--)
		{
			ans += bit.sum(v[i]-1);
			bit.add(v[i],1);
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 1196
#include<bits/stdc++.h>
using namespace std; 
using   ll=long long;
#define fast           ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define endl           "\n"
#define F(i,n)         for(ll i=0;i<n;i++)
#define rep(i,a,b)     for(ll i=a;i<b;i++)
#define repp(i,a,b)    for(ll i=a;i>=b;i--)
#define pb             push_back
#define mp             make_pair
#define vll            vector<ll>
#define f              first
#define s              second
#define pll            pair<ll,ll>
#define ALL(v)         v.begin(),v.end()
#define ALLR(v)        v.rbegin(),v.rend()
#define pii            3.14159265358979323
#define MAX            1000001
 
void solve(){
 
    ll a,b,c;

    cin>>a>>b>>c;

    ll temp=min(c,a-b);

    cout<<c-temp;
    
 
}
 
signed main(){
 
    fast;
 
    solve();
 
    return 0;
}

Measured memory_bytes: 256
class Binary_Indexed_Tree:
    def __init__(self, n):
        """
        :param n: 最大の要素数
        """
        self.n = n
        self.tree = [0] * (n + 1)
        self.depth = n.bit_length() - 1

    def sum(self, i):
        """ 区間[0,i) の総和を求める """
        s = 0
        i -= 1
        while i >= 0:
            s += self.tree[i]
            i = (i & (i + 1)) - 1
        return s

    def built(self, array):
        """ array を初期値とするBITを構築 """
        for i, a in enumerate(array):
            self.add(i, a)

    def add(self, i, x):
        """ i 番目の要素に x を足す """
        while i < self.n:
            self.tree[i] += x
            i |= i + 1

    def get(self, i, j):
        """ 部分区間和 [i, j) """
        if i == 0:
            return self.sum(j)
        return self.sum(j) - self.sum(i)

    def lower_bound(self, x, equal=False):
        """ (a0+a1+...+ai < x となる最大の i, その時の a0+a1+...+ai )
             a0+a1+...+ai <= x としたい場合は equal = True
             二分探索であるため、ai>=0 を満たす必要がある"""
        sum_ = 0
        pos = -1    # 1-indexed の時は pos = 0
        if not equal:
            for i in range(self.depth, -1, -1):
                k = pos + (1 << i)
                if k < self.n and sum_ + self.tree[k] < x:  # 1-indexed の時は k <= self.n
                    sum_ += self.tree[k]
                    pos += 1 << i
        if equal:
            for i in range(self.depth, -1, -1):
                k = pos + (1 << i)
                if k < self.n and sum_ + self.tree[k] <= x:  # 1-indexed の時は k <= self.n
                    sum_ += self.tree[k]
                    pos += 1 << i
        return pos, sum_

    def __getitem__(self, i):
        """ [a0, a1, a2, ...] """
        return self.get(i, i + 1)

    def __iter__(self):
        """ [a0, a1, a2, ...] """
        for i in range(self.n):
            yield self.get(i, i + 1)

    def __str__(self):
        text1 = " ".join(["element:            "] + list(map(str, self)))
        text2 = " ".join(["cumsum(1-indexed):  "] + list(str(self.sum(i)) for i in range(1, self.n + 1)))
        return "\n".join((text1, text2))


def str2int(s):
    return ord(s) - ord("a")


n = int(input())
s = [str2int(i) for i in input()]
B = [Binary_Indexed_Tree(n) for i in range(26)]

for i in range(n):
    B[s[i]].add(i, 1)

for _ in range(int(input())):
    t, a, b = input().split()
    if t == "1":
        a = int(a) - 1
        b = str2int(b)
        B[s[a]].add(a, -1)
        B[b].add(a, 1)
        s[a] = b
    else:
        a, b = int(a) - 1, int(b)
        ans = 0
        for v in B:
            ans += v.get(a, b) > 0
        print(ans)


Measured memory_bytes: 178516
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int ll;
int main(){
  ll a[3];
  int e=0,o=0;
  for(int i=0;i<3;i++){
    cin >>a[i];
    if(a[i]%2==1) o++;
    else e++;
  }
  sort(a,a+3);
  if(e==3||o==3) {// 2 4 6
    cout <<(a[2]*2-(a[1]+a[0]))/2<<endl;
  return 0;
}
  if(e==2){//2 3 6
    if(a[2]%2==0){
      cout <<((a[2]+1)*2-(a[1]+a[0]+1))/2+1<<endl;
      return 0;
    }
    else{//2 4 5
      cout <<(a[2]*2-(a[1]+1+a[0]))/2+1<<endl;
      return 0;
    }
  }
  if(o==2) {//3 5 8
    if(a[2]%2==1){
    cout <<((a[2]+1)*2-(a[1]+a[0]+1))/2+1<<endl;
    return 0;
   }
   else{//1 5 6
     cout <<(a[2]*2-(a[1]+1+a[0]))/2+1<<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 ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	ll k , a , b;
	cin >> k >> a >> b;
	ll ans = 1;
	if(k<a)
	{
		cout<<k<<endl;
		return 0;
	}
	ans += a-1;
	k -= a-1;
	if(2<b-a&&k>=2)
	{
		ans += (b-a)*(k/(1LL*2));
		ans += k%(2*1LL);
	}
	else
	{
		ans += k;
	}
	cout<<ans<<endl;
	
	return 0;
}

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

int main() {
 int n;
 cin >> n;
 vector<int> v(n);
 for(int i=0;i<n;i++)
   cin >> v.at(i);
  int ans =0;
  for(int i=0;i<n;i++){
    int x=v.at(i);
    while(x%2==0){
      ans ++ ;
      x/=2;
    }
  }
  cout <<ans ;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define ZERO (1e-10)
#define INF int(1e9+1)
#define CL(A,I) (memset(A,I,sizeof(A)))
#define DEB printf("DEB!\n");
#define D(X) cout<<"  "<<#X": "<<X<<endl;
#define EQ(A,B) (A+ZERO>B&&A-ZERO<B)
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
#define IN(n) int n;scanf("%d",&n);
#define FOR(i, m, n) for (int i(m); i < n; i++)
#define F(n) FOR(i,0,n)
#define FF(n) FOR(j,0,n)
#define FT(m, n) FOR(k, m, n)
#define aa first
#define bb second
void ga(int N,ll*A){F(N)scanf("%lld",A+i);}
#define MX (1<<18)
#define SM(S,B,E) (B<=E?(S[E]-(B?S[B-1]:0)):0)
#define SA(B,E) SM(A,B,E)
#define SB(L,R) SM(B,L,R)
int N,M;
ll A[MX],B[MX],X,t,f=1,K[MX];
int main(void){
    scanf("%d%d",&N,&M),ga(M,A);
    F(M)K[i]=A[i];
    GOW:
    F(M)B[i]=N-A[i];
    FT(1,M)B[k]+=B[k-1],A[k]+=A[k-1];
    F(M){
        t=SA(i,i);
        int l=i,r=M-i-1;
        if(l<r+1)t+=2*SA(0,i-1)+2*SB(i+1,min(M-1,i+l+1));
        else t+=2*SA(i-r,i-1)+2*SB(i+1,M-1);
        X=max(X,t);
    }
    if(f){
        f=0;
        F(M)A[i]=N-K[M-i-1];
        goto GOW;
    }
    printf("%lld\n",X);
    return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
	int a,b;
	cin>>a>>b;
	vector<int> c(b);
	for(int i=0;i<b;i++)
		cin>>c.at(i);
	bool d[100010];
	for(int i=0;i<100010;i++)
		d[i]=true;
	for(int i = 0;i < b;i++) {
		d[c.at(i)] = false;
	}
	int dp[100020];
	dp[0]=1;
	if(d[1]==true){
		dp[1]=1;
	}
	else
		dp[1]=0;
for (int i = 2; i <= a; i++)
{
	if (d[i]==false)
	{
		dp[i] = 0;
	}
	else{
		dp[i]=(dp[i-2]+dp[i-1])%1000000007;
	}
}
	cout<<dp[a]<<endl;
}


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

fn main() {
    input! {
        n: usize,
        a: [u64; n],
        b: [u64; n],
        c: [u64; n]
    }

    let mut am = a;
    let mut cm = c;
    am.sort();
    cm.sort();

    let mut ret = 0u64;
    for i in 0..n {
        let p = lower(&am, &b[i]) + 1;
        let q = n - greater(&cm, &b[i]);
        ret += p as u64 * q as u64;
    }
    println!("{}", ret);
}

#[allow(dead_code)]
fn greater<T: Ord>(arr: &[T], x: &T) -> usize {
    let mut ok = arr.len() as i64;
    let mut ng = -1i64;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if &arr[mid as usize] > x {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    ok as usize
}

#[allow(dead_code)]
fn lower<T: Ord>(arr: &[T], x: &T) -> usize {
    let mut ng = arr.len() as i64;
    let mut ok = -1i64;
    while (ok - ng).abs() > 1 {
        let mid = (ok + ng) / 2;
        if &arr[mid as usize] < x {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    ok as usize
}

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

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18 * 2;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };

#define H 55
#define W 55
vector<vector<char> > s(H, vector<char>(W, '#'));
vii a(H, vi(W, -1));
int h, w;

void bfs() {
	a[1][1] = 0;
	queue<pii> que;
	que.push(pii(1, 1));
	while (!que.empty()) {
		pii now = que.front();
		int i = now.first, j = now.second;
		int d = a[i][j];
		que.pop();
		rep(k, 4) {
			if (d + 1 < a[i + dy[k]][j + dx[k]]) {
				a[i + dy[k]][j + dx[k]] = d + 1;
				que.push(pii(i + dy[k], j + dx[k]));
			}
		}
	}
	return;
}

int main() {
	int i, j;
	cin >> h >> w;
	int cnt = 0;
	rep1(i, h) {
		rep1(j, w) {
			cin >> s[i][j];
			if (i == 1 && j == 1) {
				s[i][j] = 'S';
				a[i][j] = inf;
			}
			else if (i == h && j == w) {
				s[i][j] = 'G';
				a[i][j] = inf;
			}
			else if(s[i][j] == '.') {
				a[i][j] = inf;
				cnt++;
			}
		}
	}
	bfs();
	if (a[h][w] == inf) {
		cout << -1 << endl;
	}
	else {
		cout << cnt - (a[h][w] - 1) << endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD =  1000000007 ;
const int INF = 2000000000;


    ll X,A,B;

int main(){
    cin>>X>>A>>B;

    abs(X-A)>abs(X-B)?cout<<"B":cout<<"A";
    return 0;

}


Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    A = LI()

    counter_add = cl.Counter()
    counter_sub = cl.Counter()
    for i in range(N):
        add = i + 1 + A[i]
        sub = i + 1 - A[i]
        counter_add.update({str(add): 1})
        counter_sub.update({str(sub): 1})

    ans = 0
    for key, val in counter_add.items():
        ans += val * counter_sub[key]

    print(ans)


main()


Measured memory_bytes: 193940
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CSameIntegers {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            int[] n = in.ints(3);
            Arrays.sort(n);
            int x = (n[1] - n[0] + 1) / 2;
            n[0] += x * 2;
            int y = n[2] - n[0];
            n[0] += y;
            n[1] += y;
            out.println(x + y + (n[1] == n[2] ? 0 : 2));
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

        public int[] ints(int length) {
            return IntStream.range(0, length).map(x -> ints()).toArray();
        }

    }
}



Measured memory_bytes: 27220
# coding: utf-8

S = input()

isACGT = [s in "ACGT" for s in S]
cnt = 0
length = [0]

for f in isACGT:
    if f:
        cnt += 1
    else:
        length.append(cnt)
        cnt = 0
length.append(cnt)

print(max(length))


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>

using namespace std;

int const INT_MAX = 10000000;

int main(){
	
	while(true){
		
		int n, y;
		
		cin >> n;
		
		if(n == 0){
			break;
		}
		
		cin >> y;
		
		int index[100];
		double ref[100];
		
		for(int i = 0; i < n; i++){
			cin >> index[i];
			double r;
			int t;
			cin >> r >> t;
			r /= 100;
			if(t == 1){
				ref[i] = 1 + r * y;
			}else{
				ref[i] = pow(1 + r, (double)y);
			}
		}
		
		double max = 0;
		int max_index;
		
		for(int i = 0; i < n; i++){
			if(max < ref[i]){
				max = ref[i];
				max_index = index[i];
			}
		}
		
		cout << max_index << endl;
		
	}
	return 0;
}

Measured memory_bytes: 3508
def solve(A, B, C):
    if (A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
        return 0
    elif (A == B == C):
        return -1
    else:
        return solve((B/2 + C/2), (A/2 + C/2), (A/2 + B/2)) + 1

A, B, C = map(int, input().split())
ans = solve(A, B, C)
print(ans)


Measured memory_bytes: 3060
class UnionFind:
    def __init__(self, size):
        self.data = [-1] * size

    def find(self, x):
        if self.data[x] < 0:
            return x
        else:
            self.data[x] = self.find(self.data[x])
            return self.data[x]

    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x != y:
            if self.data[y] < self.data[x]:
                x, y = y, x
            self.data[x] += self.data[y]
            self.data[y] = x
        return (x != y)

    def same(self, x, y):
        return (self.find(x) == self.find(y))

    def size(self, x):
        return -self.data[self.find(x)]


N, M = map(int, input().split())
uf = UnionFind(M + 1)
used = set()
for _ in range(N):
    K, *L = map(int, input().split())
    for l in L:
        uf.union(L[0], l)
    used.update(L)

if uf.size(used.pop()) == 1 + len(used):
    print("YES")
else:
    print("NO")


Measured memory_bytes: 9148
#include <iostream>

using namespace std;
typedef long long LL;

int main() {
    int N;
    string S;
    cin >> N >> S;
    LL R = 0, G = 0, B = 0;
    for (int i = 0; i < N; i++) {
        if (S[i] == 'R') {
            R += 1;
        }
        if (S[i] == 'G') {
            G += 1;
        }
        if (S[i] == 'B') {
            B += 1;
        }
    }
    LL cnt = R * G * B;
    for (int i = 0; i < N; i++) {
        for (int j = 1; i + 2 * j < N; j++) {
            if ((S[i] ^ S[i + j] ^ S[i + 2 * j]) == ('R' ^ 'G' ^ 'B')) {
                cnt -= 1;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3588
import java.io.*;

public class Main {

    public static void main(String[] args){
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        try{
            String st = br.readLine();
            int n = Integer.parseInt(st);
            int x = 100000;
            for(int i = 0; i < n; i ++){
                x = 1000*(int)Math.ceil(x*1.05/1000);
            }
            System.out.println(x);
        }catch(IOException ex){
            
        }
    }
}

Measured memory_bytes: 24160
#include<stdio.h>
int main(void)
{
	int n,k,p[1001],m,i,j,cnt=0;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;i++){
		scanf("%d",&p[i]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(p[i]<p[j]){
				m=p[i];
				p[i]=p[j];
				p[j]=m;
			}
		}
	}
	for(i=0;i<k;i++){
		cnt+=p[i];
	}
	printf("%d\n",cnt);
	return 0;
}

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

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

  for( int i = 1; i <= n; i++ ) {
    if( i % 3 == 0 ) {
      cout << " " << i;
    }
    else {
      string buf = to_string( i );
      int x = buf.find( "3" );
      if( x >= 0 ) {
        cout << " " << i;
      }
    }
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 3272
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

inline ll cube(const ll &x) {return x * x * x;}

int N, K, c;

int main(){
	getint(N), getint(K), c = N / K;
	if(K & 1) printf("%lld\n", cube(c));
	else printf("%lld\n", cube(c) + cube(c + (N % K >= (K >> 1))));
	return 0;
}

Measured memory_bytes: 256
import sys

input = sys.stdin.readline

def main():
    ans = 0
    H,W,K = map(int, input().split())
    l = []
    for _ in range(H):
        l.append(list(input().rstrip('\n')))
    for i in range(2**H):
        for j in range(2**W):
            b = 0
            for h in range(H):
                for w in range(W):
                    if i>>h & 1 and j>>w & 1 and l[h][w] == '#':
                        b += 1
            if b == K:
                ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 9116
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#pragma warning( disable:4996 )
using namespace std;
typedef long long ll;
typedef long long Int;
#define MOD 1000000007

#define SWAP(a,b) (a += b,b = a - b,a -= b)
#define MIN(a, b) ((a) < (b) ? (a) : (b))


int main(void) {
	int x, y;
	scanf("%d %d", &x, &y);
	if (x == 1 && y == 1) {
		printf("1000000\n");
		return 0;
	}
	else {
		printf("%d\n", ((4 - ((x>=4)?4:x)) + (4 - ((y>=4)?4:y))) * 100000);
	}
	return 0;
}

Measured memory_bytes: 128
//  ######    ##   ######    ##   ##    ##
//  ##  ##   ###   ##  ##   ###   ###   ##
//  ######  ####   ######  ####   ##### ##
//  ##     ## ##   ##     ## ##   ## #####
//  ##    ##  ##   ##    ##  ##   ##   ###
#include<bits/stdc++.h>
using namespace std;
typedef long long lo;
typedef pair<lo,lo> ll;//pair
typedef vector<lo> vl;  //vector of long
typedef vector<ll > vll;   //vector of pair
typedef priority_queue<lo>p_q;
#define mp(a,b) make_pair((a),(b))
#define REP(a,b) for(lo i=(a);i<(b);i++)//no need to declare variable i
#define REPE(a,b,c,d) REP(a,b)for(lo j=(c);j<(d);j++)//no need to declare vaiables i,j
#define REPV(a,b,c) for((a)=b;(a)<(c);(a)++)//a is the variable
#define IREP(a,b) for(lo i=(a);i>=(b);i--)
#define IREPV(a,b,c) for((a)=b;(a)>=(c);(a)--)
#define all(v) (v).begin(),(v).end()
#define TRvl(c) for (vl::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvll(c) for (vll::iterator it = (c).begin(); it != (c).end(); it++)
#define mod 1000000007
#define gc getchar_unlocked
#define pc putchar_unlocked3
#define pb(a) push_back((a))
 
int arr[100005];

void solve()
{
    arr[100]=arr[101]=arr[102]=arr[103]=arr[104]=arr[105]=1;
    int X;
    cin>>X;
    for(int i=0;i<=X;i++)
    {
        for(int j=100;j<=105;j++)
        {
            if(i-j>=0&&arr[i-j])arr[i]++;
        }
    }
    if(arr[X])cout<<1;
    else cout<<0;
}


int main()
{
    /*
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    */
    
    lo t;
    //cin>>t;
    //while(t--)
        solve();




}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;




int main(){
    vector<bool> S(4,1);
    int A;
    cin >> A;
    S[A]=0;
    int B;
    cin >> B;
    S[B]=0;
    for(int i=1;i<4;i++){
        if(S[i]==1)
        cout<<i<<endl;
    ;}


    

return 0;


}  



Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int k;
	int x;
	int i;
	while(1){
		scanf("%d",&k);
		if(k==0)return 0;
	for(i=0;i<9;i++){
		scanf("%d",&x);
		k-=x;
	}
	printf("%d\n",k);
	}
}

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

using namespace std;

int main(){
	string s;
	int p1,p2;
	cin >> s;
	p1=atoi(s.substr(0,2).c_str());
	p2=atoi(s.substr(2).c_str());
	if(p1<=12 && p2<=12 && p1>0 && p2>0){
		cout << "AMBIGUOUS" << endl;
	}
	else if(p1<=12 && p1>0){
		cout << "MMYY" << endl;
	}
	else if(p2<=12 && p2>0){
		cout << "YYMM" << endl;
	}
	else{
		cout << "NA" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const long long mod = 1e9 + 7;

int n, k;
int arr[MAXN];
pair<int, int> queries[MAXN];
void solve(){
    vector<int> freq(MAXN);
    int i = 0;
    long long sum = 0;
    for(i = 0; i < n; i++) {
        freq[arr[i]]++;
        sum += arr[i];
    }
    for(i = 0; i < k; i++){
        int b = queries[i].first;
        int c = queries[i].second;
        sum -= freq[b] * 1LL * b;
        sum += freq[b] * 1LL * c;
        freq[c] += freq[b];
        freq[b] = 0;
        cout << sum << "\n";
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i = 0;
    cin >> n;
    for(i = 0; i < n; i++)
        cin >> arr[i];
    cin >> k;
    for(i = 0; i < k; i++){
        int x, y;
        cin >> x >> y;
        queries[i] = {x, y};
    }
    solve();
    return 0;
}


Measured memory_bytes: 5292
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
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; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    if(b >= a) cout << a << endl;
    else cout << a-1 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  double res = 0;
  for(int i = 0; i < n; i++){
    double x;
    string u;
    cin >> x >> u;
    if(u == "JPY") res += x;
    else res += x*380000;
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
N,M = map(int, input().split())
chl = [[] for _ in range(N)]
par = [[] for _ in range(N)]
for _ in range(N+M-1):
    a, b = map(int, input().split())
    chl[a-1].append(b-1)
    par[b-1].append(a-1)

for i in range(N):
    if len(par[i]) == 0:
        root = i
        break

from collections import deque
rnk = [-1]*N
q = deque([root])
rnk[root] = 0
while q:
    temp = q.popleft()
    for v in chl[temp]:
        if rnk[v] < 0:
            rnk[v] = rnk[temp]+1
            q.append(v)

ans = [-1]*N
ans[root] = 0
q = deque([root])
while q:
    temp = q.popleft()
    for v in chl[temp]:
        if len(par[v]) == 1:
            ans[v] = temp+1
            q.append(v)
        else:
            par[v].remove(temp)

for a in ans:
    print(a)

Measured memory_bytes: 83760
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
using namespace std;
int main () {
	int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q;
	scanf("%d", &a);
	c = 0; d = 0;
	for (i = 1; i <= a; i++) {
		scanf("%d", &b);
		if (i == b) {
			c++;
		} else {
			d += (c >> 1) + (c & 1);
			c = 0;
		}
	}
	d += (c >> 1) + (c & 1);
	printf("%d\n", d); 
	return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;

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

	string a;

	cin>>a;

	for(auto x : {-1,1}){
		for(auto y : {-1,1}){
			for(auto z : {-1,1}){
				int curr = (a[0]-'0');
				curr+=x*(a[1]-'0');
				curr+=y*(a[2]-'0');
				curr+=z*(a[3]-'0');
				if(curr == 7){
					char op1 = x==-1 ? '-' : '+'; 
					char op2 = y==-1 ? '-' : '+';
 					char op3 = z==-1 ? '-' : '+';
 					cout<<a[0]<<op1<<a[1]<<op2<<a[2]<<op3<<a[3]<<"=7";
 					return 0;
				}	
			}
		}
	}

}


Measured memory_bytes: 384
import numpy as np
N, x = map(int, input().split())
A = list(map(int, input().split()))
A += A
A = np.array(A, int)
INF = 10 ** 18
ans = INF
B = np.ones(N, int) * INF
for cnt in range(N):
    np.minimum(A[N-cnt:2*N-cnt], B, B)
    ans = min(ans, cnt * x + np.sum(B))

print(ans)

Measured memory_bytes: 14540
import heapq
n,t = map(int,input().split())
ai = [int(i) for i in input().split()]


rev_ai = [ai[n-1]*(-1)]

ans = [0,0]

heapq.heapify(rev_ai)
#print(rev_ai)
for i in range(1,n):
    #print(ai[n-1-i])
    dif = rev_ai[0]*(-1) - ai[n-1-i]
    if dif > ans[0]:
        ans = [dif,1]
    elif dif == ans[0]:
        ans[1] += 1
    #print(rev_ai[0])
    heapq.heappush(rev_ai,ai[n-1-i]*(-1))

print(ans[1])

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int a,b,c;

signed main() {
    cin >> a >> b >> c;
    cout << max(0LL,c-(a-b)) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;


void solve(){
	string S; cin >> S;
	ll dp[100005][13] = {};
	int n = S.size();
	dp[0][0] = 1;

	rep(i,n){
		int s;
		if(S[i]=='?') s = -1;
		else s = S[i] - '0';

		rep(j,10){
			if(s!=-1 && s!=j) continue;
			rep(k,13){
				dp[i+1][(k*10+j)%13] += dp[i][k];
			}
		}

		rep(j,13) dp[i+1][j] %= MOD;
	}
	cout << dp[n][5] << endl;
}


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


Measured memory_bytes: 10704
X = int(input())
if (400<=X and X<=599):
    print(8)
elif (600<=X and X<=799):
    print(7)
elif (800<=X and X<=999):
    print(6)
elif (1000<=X and X<=1199):
    print(5)
elif (1200<=X and X<=1399):
    print(4)
elif (1400<=X and X<=1599):
    print(3)
elif (1600<=X and X<=1799):
    print(2)
elif (1800<=X and X<=1999):
    print(1)

Measured memory_bytes: 9196
N = int(input())
#S = str(input())
#N, K= map(int, input().split())
A = list(map(int, input().split()))

money = 1000
book = 0
for i in range(1, N):
  if A[i] > A[i - 1]:
    book2 = int(money / A[i - 1])
    book += book2
    money -= book2 * A[i - 1]
  elif A[i] < A[i - 1]:
    money += book * A[i - 1]
    book = 0
  #print(i, money, book)  

money += book * A[-1]  
print(money)    
    
    
    
  
  
  




Measured memory_bytes: 9188
main = do
  getLine
  h <- map read . words <$> getLine
  print . subtract 1 . length . takeWhile (/= []) $ iterate shower h

shower h = hnext ++ dropWhile (/= 0) htrim
  where
    htrim = dropWhile (== 0) h
    hnext = map (subtract 1) $ takeWhile (/= 0) htrim

Measured memory_bytes: 1276
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
  int i, j;
  int n, m;
  char **a, **b;
  int col;
  char *search;
  int flag;

  scanf("%d %d", &n, &m);

  a = (char**)malloc(sizeof(char*)*n);
  for (i = 0; i < n; i++) {
    a[i] = (char*)malloc(sizeof(char)*(n + 1));
    scanf("%s", a[i]);
  }
  b = (char**)malloc(sizeof(char*)*m);
  for (i = 0; i < m; i++) {
    b[i] = (char*)malloc(sizeof(char)*(m + 1));
    scanf("%s", b[i]);
  }

  flag = 0;
  for (i = 0; i < n; i++) {
    search = strstr(a[i], b[0]);
    if (search != NULL) {
      col = search - a[i];
      for (j = 1; j < m && i + j < n; j++) {
        search = strstr(a[i + j] + col, b[j]);
        if (search != a[i + j] + col)break;
      }
      if (j == m) {
        flag = 1;
        break;
      }
    }
  }

  printf(flag ? "Yes\n" : "No\n");

  for (i = 0; i < n; i++)free(a[i]);
  for (i = 0; i < m; i++)free(b[i]);
  free(a);
  free(b);
  return(0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_ll.hpp>
//typedef boost::multiprecision::cpp_ll ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
//#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

ll hpow(ll x,ll y){
    ll ans=1;
    ll i=x;
    if(y==0)return 1;
    while(y>0){
        if(y%2==1){
            ans=(ans*i)%i_7;
        }
        i=(i*i)%i_7;
        y=y/2;
        
    }
    return ans;
}
ll comb(ll n,ll k){
    ll a=1;
    ll b=1;
    for(ll i=n;i>=n-k+1;i--){
        a=mod(a*i);
    }
    rep(i,1,k){
        b=mod(b*i);
    }
    b=hpow(b,i_7-2);
    return mod(a*b);
}
ll hoge(ll r,ll c){
    return mod(comb(r+1+c+1,c+1)-1);
}

int main(){fastio
    ll r[2],c[2];
    rep(i,0,1){
        cin>>r[i]>>c[i];
    }
    ll ans=0;
    ans=hoge(r[1],c[1])+hoge(r[0]-1,c[0]-1)-hoge(r[1],c[0]-1)-hoge(r[0]-1,c[1]);
    ans=mod(ans);
    cout<<ans<<endl;
    
    return 0;
}





Measured memory_bytes: 256
import std.stdio;
import std.conv;
import std.string;
void main() {
  int[] a;
  for (int i=0; i<10; ++i) {
    a ~= readln.chomp.to!int;
  }
  a.sort;
  for (int i=0; i<3; ++i) {
    writeln(a[9-i]);
  }
}

Measured memory_bytes: 1040
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut s = s.split_whitespace();
	let a: i64 = s.next().unwrap().parse().unwrap();
	let b: i64 = s.next().unwrap().parse().unwrap();
	let c: i64 = s.next().unwrap().parse().unwrap();
	let d: i64 = s.next().unwrap().parse().unwrap();
	let x = (a - c).abs();
	let y = (b - d).abs();
	let g = num::integer::gcd(x, y);
	let x = x / g;
	let y = y / g;
	println!("{}", g * (x + y - 1));
}


Measured memory_bytes: 2144
#include <stdio.h>

int main(void) {
    long long n, min, max, sum;
    scanf("%lld", &n);
    long long arr[n];
    
    min = 1000001;
    max = -1000001;
    sum = 0;

    for (int i = 0; i < n; i++) {
        scanf("%lld", &arr[i]);
    }

    for (int i = 0; i < n; i++) {
        if (arr[i] < min) min = arr[i];
        if (arr[i] > max) max = arr[i];
        sum += arr[i];
    }

    printf("%lld %lld %lld\n", min, max, sum);

    return 0;
}


Measured memory_bytes: 2144
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<utility>//swapでaとbの値を入れ替える
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
using namespace std;


int main() {
	int  a, b,c;
	int  ans = 0;
	cin >> a;
	rep(i, a + 1) {
		if (i < 10 && 0 < i)ans++;
		if (i < 1000 && 99 < i)ans++;
		if (i < 100000 && 9999 < i)ans++;
	}
    cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  long i,l=0,r=0,N,K,ans=0;
  string s;cin>>s;
  cin>>K;
  N=s.size();
  while(l<N&&s[l]==s[0])l++;
  if(l==N){
    /*aa...aa*/
    cout<<N*K/2<<endl;
    return 0;
  }
  if(s[0]!=s[N-1]){
    /*a...b*/
    for(i=1;i<N;i++){
      if(s[i]==s[i-1]){
        ans++;
        i++;
      }
    }
    cout<<ans*K<<endl;
    return 0;
  }
  /*aa..aab...caa..aa*/
  /* l=left a length,r=right a length */
  while(s[N-1-r]==s[N-1])r++;
  for(i=l;i<N-r;i++){
    if(s[i]==s[i-1]){
      ans++;
      i++;
    }
  }
  /*b..c*/
  ans*=K;
  /*outside a length*/
  ans+=l/2+r/2;
  /*inside sum a length*/
  ans+=(l+r)/2*(K-1);
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  string t;
  cin >> t;
  for (int i = 0; t[i] != '\0'; i++) {
    if (t[i] == '?') {
      t[i] = 'D';
    }
  }
  cout << t << endl;
}

Measured memory_bytes: 3752
/*
  ID: oodt
  PROG:
  LANG:C++
*/
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<set>

using namespace std;

const int maxx=10005;
int n,m,k;
char ch[100050];
int ans = 0,cnt = 0,pos = 0;
int l = 0,r = 0;
int a[27];

int main()
{
#ifdef LOCAL
//    freopen("","r",stdin);
#endif
    scanf("%s",ch);
    int n = strlen(ch);
    memset(a,0,sizeof(a));
    for(int i = 0; i < n; i++)
    {
        a[ch[i]-'a']++;
    }
    int ma = 0,mi = 0x3f3f3f3f;
    for(int i = 0; i < 27; i++)
    {
        if(a[i] != 0) {
            cnt++;
        ma = max(ma,a[i]);
        mi = min(mi,a[i]);
        }
    }
//    printf("%d %d %d",cnt,ma,mi);
    if(cnt > 2)
    {
        if(ma - mi > 1)
        {
            printf("NO\n");
        }
        else printf("YES\n");
    }
    else{
        if(cnt == 2 && n == 2) printf("YES\n");
        else if(n == 1) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 384
#include <stdio.h>
typedef long long int ll;
const int MOD=1e9+7;
const int N=2e3+10;
ll fac[N];
ll pow(ll a,ll t){
    if(t==0)return 1;
    ll temp=pow(a,t/2);
    temp*=temp;
    temp%=MOD;
    if(t&1){
        temp*=a;
        temp%=MOD;
    }
    return temp;
}
ll rev(ll n){return pow(n,MOD-2);}
ll C(int n,int k){return (fac[n]*((rev(fac[k])*rev(fac[n-k]))%MOD))%MOD;}
ll H(int n,int k){return C(n+k-1,k);}
void init(){
    fac[0]=fac[1]=1;
    for(int i=2;i<N;i++)fac[i]=(fac[i-1]*i)%MOD;
    return ;
}
int main(){
    int n,k,now=1;
    ll ans=0;
    scanf("%d%d",&n,&k);
    if(k<n){
        printf("0\n");
        return 0;
    }
    init();
    printf("%lld\n",C(k,n));
    
}


Measured memory_bytes: 2720
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <functional>
#include <limits.h>
#include <set>
#include <map>
#include <tuple>
using namespace std;

#define ll long long
#define ull unsigned long long
#define rep(i,N) for (ll i=0;i<N;i++)
#define loop(i,N,M) for(ll i=N;i<M;i++)
#define MAX(v) *max_element(v.begin(),v.end())
#define MIN(v) *min_element(v.begin(),v.end())
#define SORTL2S(type,v) sort(v.begin(),v.end(),greater<type>())
#define SORTS2L(type,v) sort(v.begin(),v.end())
#define SORTMF(v,func) sort(v.begin(),v.end(),func)

template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll A,B,C,N,M,K,X,Y;
string S;
vector<ll> vec;

void solve() {
	cin >> N;
	vec.resize(N);
	rep(i, N) cin >> vec[i];

	SORTS2L(ll,vec);

	ll tmpM = vec[N / 2];
	ll tmpm = vec[N / 2 - 1];

	cout << tmpM - tmpm;
}

int main() {
	solve();
	cout << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;

template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a/b; a -= t*b; swap(a, b); u -= t*v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if (e%2 == 0) { p = (p*p)%mod; e /= 2; }
            else { a = (a*p)%mod; e--; }
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

using modint = ModInt<MOD>;

int main() {
    int n, m;
    cin >> n >> m;
    vector<modint> dp(n+1, 0);
    vector<bool> step(n+1, 1);
    for (int i = 0; i < m; i++) {
        int a;
        cin >> a;
        step[a] = 0;
    }
    
    dp[0] = 1;
    if (step[1]) dp[1] = 1;
    
    for (int i = 2; i <= n; i++) if (step[i]) {
        dp[i] = dp[i-1] + dp[i-2];
    }
    
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int cnt[2][N];
int main(){
  int n,v;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>v;
    cnt[i&1][v]++;
  }
  pair<int,int> mx[2][2];
  for(int i=1;i<N;i++){
    for(int p=0;p<2;p++){
      if(cnt[p][i]!=0){
        pair<int,int> c=make_pair(cnt[p][i],i);
        if(c.first>mx[p][1].first){
          swap(c,mx[p][1]);
        }
      if(mx[p][1].first>mx[p][0].first){
        swap(mx[p][0],mx[p][1]);
      }
    }
  }
}
int ans;
if(mx[0][0].second==mx[1][0].second)ans=n-max(mx[0][1].first+mx[1][0].first,mx[0][0].first+mx[1][1].first);
else ans=n-mx[0][0].first-mx[1][0].first;
cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

long long int ps(long long int x , long long int n){
    if(n==0) return 1;
    if(n==1) return x ;
    if(n%2) return ((x* ps(x,n-1)));
    else {
        long long int z=ps(x,n/2);
        return (z*z) ;
    }
}

bool ssort(const pair<int,int> &a,
              const pair<int,int>  &b)
{
    return (a.first < b.first);
}
bool ssort3(const pair<int,int> &a,
              const pair<int,int>  &b)
{
    if(a.first == b.first) return (a.second < b.second);
    return (a.first < b.first);
}

long long int a,b,c,d,n;
string s,t;
#define mo 998244353

#define pair<int , int > pi

int main()
{
    IOS;
    cin >> s;
    int ok=1;
    for(int i=0;i<s.size();i++){
        if(i%2==1 && s[i]=='R') ok=0;
        else if(i%2==0 && s[i]=='L') ok=0;
     }
     if ( ok ) cout <<"Yes";
     else cout << "No";



}


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

# define rep(i, n) for(int(i)=0;(i)<(n);(i)++)
# define reps(i, n) for(int(i)=1;(i)<=(n);(i)++)
# define rrep(i, n) for(int i=((int)(n)); i>0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>=0; --i)
# define ALL(v) v.begin(), v.end()
template<class T>inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<typename T> void dump(T e){std::cout << e << std::endl;}
template<typename T> void dump(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void dump(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ dump(v); } }
template <typename T>
void dump_stack(std::stack<T>& stack) {
  std::stack<T> temp;
  while (!stack.empty()) {
    T top = stack.top(); stack.pop();
    std::cout << top << " ";
    temp.push(top);
  }
  std::cout << endl;
  while (!temp.empty()) {
    T top = temp.top(); temp.pop();
    stack.push(top);
  }
}
template <typename T>
void dump_queue(std::queue<T>& queue) {
  std::queue<T> temp;
  while (!queue.empty()) {
    T top = queue.front(); queue.pop();
    std::cout << top << " ";
    temp.push(top);
  }
  std::cout << endl;
  while (!temp.empty()) {
    T top = temp.front(); temp.pop();
    queue.push(top);
  }
}

typedef long long ll;




int main(){
  int n,q,a; cin >>n;
  vector<int> S(n+1);
  rep(i,n) {
    cin >> S[i];
  }
  cin >> q;
  int c=0;
  rep(i,q) {
    cin >> a;
    //S[n]=a;
    rep(j,S.size()) {
      if(a == S[j]) {
        c++;
        break;
      }
    }
    //for(int j=0;S[j]!=a;j++){
    //  dump(S[j]);
      //if(j!=n) c++;
    //}
    //dump("===");
  }
  
  cout << c << endl;
}



Measured memory_bytes: 3156
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define up_b upper_bound
#define low_b lower_bound
#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()

#define boost ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;

const ll INF=1e18;
const ll inf = 1e9;
const ld eps=1e-7;
const ld pi = acos(-1);
const int dx[4]={0,0 ,1,-1};
const int dy[4]={1,-1,0,0};
const int N=1e3+11;
const int M=803;
const int mod=998244353;

int main(){

  ll s;
  cin>>s;
  ll x=(inf-s%inf)%inf;
  ll y=(s+x)/inf;
  cout<<"0 0 1000000000 1 "<<x<<" "<<y;

}


Measured memory_bytes: 256