akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

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

    ll n;cin>>n;
    for(ll i=0;i<=n;i++){
        if(floor(i*1.08)==n){
            cout<<i<<endl;
            return 0;
        }
    }
    cout<<":("<<endl;
    return 0;
}


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

using namespace std;
#define ll long long int
#define rep(i,n) for(i=0;i<(n);i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
typedef pair< ll, ll > lpair;

bool sortbysec(const pair<int,int> &a, const pair<int,int> &b)
{
    if(a.ff == b.ff)
        return (a.ss < b.ss);
    return (a.ff < b.ff);
}

vector< ll > prime(1000005,1);
void p()
{
    ll i,j;
    for(i=2;i<=1000000;i++)
    {
        if(prime[i] == 1)
        {
            for(j = 2*i;j<=1000000;j+=i) prime[j] = 0;
        }
    }
}

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

    ll n,i;
    cin>>n;

    vector< ll > dp(n+1),h(n+1);
    for(i = 1;i<=n;i++) cin>>h[i];
    dp[1] = 0;
    dp[2] = abs(h[1]-h[2]);

    for(i = 3;i<=n;i++)
    {
        dp[i] = min(dp[i-2] + abs(h[i-2] - h[i]) , dp[i-1] + abs(h[i-1] - h[i]));
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 9600
#include <algorithm>
#include <climits>
#include <cstdio>
#include <iostream>
#include <vector>

int main() {
  int N = 0;
  std::cin >> N;

  int F[100][10];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 10; j++) {
      std::cin >> F[i][j];
    }
  }

  int64_t P[100][11];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 11; j++) {
      std::cin >> P[i][j];
    }
  }

  int64_t ans = -INT_MAX;
  for (uint32_t mask = 1; mask < (1 << 10); mask++) {
    int64_t sum = 0;
    for (int i = 0; i < N; i++) {
      int cnt = 0;
      for (int j = 0; j < 10; j++) {
        if ((mask >> j & 1) && F[i][j]) cnt++;
      }
      sum += P[i][cnt];
    }
    ans = std::max(ans, sum);
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  char c[6][7];
  int h,w,i,j,k,x,y,t=0,b;
  scanf("%d%d%d",&h,&w,&k);
  for(i=0;i<h;i++)scanf("%s",c[i]);
  for(i=0;i<1<<h;i++)for(j=0;j<1<<w;j++){
    b=0;
    for(x=0;x<h;x++)if(i&(1<<x))for(y=0;y<w;y++)b+=j&(1<<y)&&c[x][y]=='#';
    t+=b==k;
  }
  printf("%d",t);
}


Measured memory_bytes: 1728
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}

void solve() {
    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    REP(i, s.length()) {
        cout << s[i] << t[i];
    }
    cout << endl;

}

int main() {
    init();
    solve();
}

Measured memory_bytes: 888
#include <cstdio>

int main() {

  for (int i = 0; i < 9; ++i) {
    for (int j = 0; j < 9; ++j) {
      printf("%dx%d=%d\n", i + 1, j + 1, (i + 1) * (j + 1));
    }
  }

  return 0;
}

Measured memory_bytes: 924
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int main() 
{ 
	SPEED
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; ++i)
        cin >> arr[i];
    int count = 0;
    for (int i = 0; i < n; ++i)
    {
        if (arr[i]!=(i+1))
            count++;
    }
    if (count==2 || count==0)
        cout << "YES";
    else
        cout << "NO";
    return 0;      
} 

Measured memory_bytes: 256
/*Stay true to yourself, yet always be open to learn. Work hard, and never give up on your dreams, 
even when nobody else believes they can come true but you. These are not cliches but real tools you 
need no matter what you do in life to stay focused on your path.
*/
 
 /*Pppppppp    UU      UU     CCCCCCCC    CCCCCCCC     HH     HH     UU      UU
   pp    pp    UU      UU     CC          CC           HH     HH     UU      UU
   pp    pp    UU      UU     CC          CC           HHHHHHHHH     UU      UU
   pppppppp    UU      UU     CC          CC           HHHHHHHHH     UU      UU
   pp          UU      UU     CC          CC           HH     HH     UU      UU
   pp          UUUUUUUUUU     CCCCCCCC    CCCCCCCC     HH     HH     UUUUUUUUUU
   */
 
#include <bits/stdc++.h>
using namespace std;

#define int long long
typedef long long ll;
#define loop(i,n)  for(int i=0;i<n;i++)
#define ford(i,a,b) for(int i=b;i>=a;i--)
#define read(a) int a; cin >>a;
#define readarr(a,n) int a[n] ; for(int i=0;i<n;i++) cin >> a[i];
#define readmat(a,n,m) int a[n][m]; for(int i=0;i<n;i++) for(j=0;j<m;j++) cin >> a[i][j];
#define pb push_back
#define fi first
#define se second
#define vi vector<int>
#define pi pair<int,int>
#define vii vector<vector<int>>
#define sti set<int>
#define vpi vector<pair<int,int>>
#define print(a,n) for(int i=0;i<n;i++) cout<<a[i]<<" "; cout<<endl;
#define printmat(a,n,m) for(int i=0;i<n;i++) {for(j=0;j<m;j++) cout<<a[i][j]<<" "; cout<<endl;}
#define fast ios_base::sync_with_stdio(false);  cin.tie(NULL);
const ll inf = 1e18;
const ll mod = 1e9 + 7;

signed main()
{
    fast;
    read(h);
    read(w);
    read(n);
    int m = max(h,w);
    if(n%m==0)
    cout<<n/m<<endl;
    else
    cout<<n/m+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  ll x;
  cin >> x;
  ll count = x / 11;
  count *= 2;
  int remain = x % 11;
  if (remain != 0) {
    if (remain <= 6) count++;
    else count+= 2;
  }
  P(count);
  return 0;
}

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

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

	if (a > b) { t = a; a = b; b = t; }
	if (b > c) { t = b; b = c; c = t; }
	if (a > b) { t = a; a = b; b = t; }

	cout << a << " " << b << " " << c << endl;

	return 0;
}

Measured memory_bytes: 3044
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long int ll;

int main()
{
	ll m,n;
	cin>>m>>n;
	ll ans;
	if( m == 1 && n == 1){
		ans = 1;
	}else if( m == 1 || n == 1){
		ll l = min(m,n);
		ll k = max(m,n);
		ans = k - 2;
	}else if( m > 1 && n > 1){
		ans = m*n - 2*(m + n - 2);
	}
	cout<<ans<<endl;
	return 0;
}



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

using namespace std;
int main(){
    long r,d,x,ans;
    cin >> r >> d >> x;
    for(int i=0; i<10; i++){
       ans = (r*x)-d;
       cout << ans << endl;
       x=ans;
    }
    return 0;
}

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

using namespace std;

#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

const int N = 3005;

int n;
int a[N];
int memo[N][N];

int dp(int l, int r) {
	if (l == r) return a[l];
	if (l > r) return -1e18;
	int &ans = memo[l][r];
	if (ans != -1e18) return ans;
	ans = -dp(l + 1, r) + a[l];
	ans = max(ans, -dp(l, r - 1) + a[r]);
	return ans;
}

void solve() {
	int i, j, k, m, ans = 0, cnt = 0, sum = 0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	for (i = 0; i < N; i++) {
		for (j = 0; j < N; j++) {
			memo[i][j] = -1e18;
		}
	}
	cout << dp(0, n - 1);
	return ;
}

int32_t main()
{
	ios_base:: sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	// int t; cin >> t; while (t--)
	solve();
	return 0;
}

Measured memory_bytes: 70912
#include<stdio.h>
int main()
{
  int i,j,k,v,N;
  int A[1000];
  scanf("%d",&N);
  if(N>=1 && N<=100)
    {
      for(i=0;i<N;i++)
	{
	  scanf("%d",&A[i]);
	}
      for(i=0;i<N;i++)
	{
	  printf("%d",A[i]);
	  if(i<N-1)
	    printf(" ");
	}
      printf("\n");
   for(i=1;i<=N-1;i++)
    {
      v=A[i];
      j=i-1;
   
      while(j>=0 && A[j]>v)
	{
	  A[j+1]=A[j];
	  j--;
	}
	  A[j+1]=v;
	  for(k=0;k<N;k++)
	    {
  printf("%d",A[k]);
	      if(k<N-1)
    printf(" ");
	    }
	  printf("\n");    	
    }

       }
  return 0;
	}



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

using namespace std;
using ll = long long;

int main() {
  string s, t;
  cin >> s;
  vector<int> v{0};
  for (int i = 0, n = s.size(); i != n; ++i) {
    if (s[i] != 'x')
      t.push_back(s[i]), v.emplace_back();
    else
      ++v.back();
  }
  if (!equal(begin(t), end(t), rbegin(t))) {
    cout << -1 << endl;
    return 0;
  }

  int ans{};
  for (int i = 0, n = v.size(); i != n / 2; ++i) {
    ans += abs(v[i] - v[n - i - 1]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3956
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...)
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fls(x) (64 - __builtin_clzll(x))
#define pcnt(x) __builtin_popcountll(x)
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

constexpr int MOD = 1000000007;

// + - * / ^
int mod(int a)
{
    int res = a % MOD;
    if(res < 0) {
        return res + MOD;
    }
    return res;
}
int mul_mod(int a, int b)
{
    ll res = ((ll)a * (ll)b) % MOD;
    return mod((int)res);
}
int pow_mod(int a, int b)
{
    ll res = 1;
    while (b > 0) {
        if(b & 1) {
            res = res * (ll)a % (ll)MOD;
        }
        a = mul_mod(a, a);
        b >>= 1;
    }
    return (int)res;
}
int inv_mod(int a)
{
    return pow_mod(a, MOD - 2);
}
int div_mod(int a, int b)
{
    return mul_mod(a, inv_mod(b));
}

// ! C
constexpr int FAC_MAX = 3000001;
ll fac[FAC_MAX], finv[FAC_MAX], inv[FAC_MAX];
void com_init()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < FAC_MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll com_mod(int a, int b){
    if (a < b) return 0;
    if (a < 0 || b < 0) return 0;
    return fac[a] * (finv[b] * finv[a - b] % MOD) % MOD;
}

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

    int h, w, a, b; cin >> h >> w >> a >> b;
    h--; w--; a--; b--;
    int h_ = h - a, w_ = w - b;
    ll ans = com_mod(h + w, h);
    rep (i, b + 1) {
        ans = mod(ans - mul_mod(com_mod(h_ + i, h_), com_mod(a + (w - i), a)));
    }
    rep (i, 1, b + 1) {
        ans = mod(ans + mul_mod(com_mod(h_ + i - 1, h_), com_mod(a + (w - i), a)));
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 73964
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
	private static final int MOD = (int)Math.pow(10, 9) + 7;
	public static void main(String[] args) {
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		int m = sc.nextInt();
		
		if (Math.abs(m - n) > 1) {
			System.out.println(0);
			System.exit(0);
		}
		int max = Math.max(m, n);
		
		long[] dp = new long[max + 1];
		dp[1] = 1;
		
		for (int i = 2; i <= max; i++) {
			dp[i] = (dp[i - 1] % MOD) * (i % MOD);
			dp[i] %= MOD;
		}
		int times = 1;
		// //同数なら猿犬猿犬と犬猿犬猿が可能なので2倍。
		if (m == n) { times = 2; }
		System.out.println(((dp[m]*dp[n]*times) % MOD));
	}
  
    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;
	      }
	  }
}


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

int ret(int x){
	int sum = 0;
	while(x){
		sum += x % 10;
		x /= 10;
	}

	return sum;
}

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

	int sum=0;
	for(int i=0; i<=n; i++){
		int t = ret(i);
		if(a<=t && t<=b){
			sum += i;
		} 
	}

	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define repl(i, l, r) for (ll i = (l); i < (r); i++)
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define CST(x) cout << fixed << setprecision(x)
using ll = long long;
const ll MOD = 1000000007;
const int inf = 1e9 + 10;
const ll INF = 4e18;
const int dx[9] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[9] = {0, 1, 0, -1, 1, 1, -1, -1, 0};
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);

	string s;
	cin >> s;
	int n = s.size();
	string t = "keyence";
	rep(i, 8) {
		if (s.substr(0, i) + s.substr(n - 7 + i) == t) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/rope>

using namespace __gnu_pbds; 
using namespace __gnu_cxx;
using namespace std;
using ll = long long;

#define eb emplace_back
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define len(v) ((int)v.size())
#define all(v) v.begin(), v.end()
#define precision(n) fixed<<setprecision(n)

#ifdef LOCAL
    #include "debug.h"
#else
    #define debug(...) 42
#endif

void io(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);    
    #ifdef LOCAL
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
}

template<typename T> using oset = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update >;
template<typename T> using MinPriorityQueue = priority_queue <T, vector <T>, greater <T> >;
template<typename T> void done(T ans) {cout << ans << "\n"; exit(0);}


template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
  for(auto& i:x)
    input>>i;
  return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
  for(auto& i:x)
    output<<i<<' ';
  return output;
}

 

const int mod = 1e9;
const int N = 3e5 + 5;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937_64 mt(seed);

template <typename T>
long long myrand(T m) {
    long long mod = m;
    long long x = mt()%mod;

    return x;
}
ll tot = 0;
ll states = 0, sum = 0;
vector<array<int, 4>> v;
int n, m, q;
void solve(int idx, int last, vector<int>& ans) {
    if(idx == n) {
        states++;
        sum = 0;
        for(auto ar : v) {
            if(ans[ar[2]] - ans[ar[1]] == ar[3])
                sum += ar[0];
        }
        tot = max(tot, sum);
        return;
    }
    
    for(int i = last; i <= m; i++) {
        ans.push_back(i);
        solve(idx + 1, i, ans);
        ans.pop_back();
    }

}
int main() {
    io();
    cin >> n >> m >> q;
    while(q--) {
        int a, b, c, d;
        cin >> a >> b >> c >> d;
        a--; b--;
        v.push_back({d, a, b, c});
    }
    sort(v.begin(), v.end());
    reverse(v.begin(), v.end());
    vector<int> ans;
    solve(0, 1, ans);
    debug(states);
    cout << tot;
    // q = v.size();
    // for(int i = 0; i < q; i++) {
    //     ans[v[i][2]]
    // }
}




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

using namespace std;

#define ll long long int
#define ld long double
#define MAX 100000000001
#define MOD 998244353
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pi 3.14159265358979323846

int main(){

    fast;

    ll i,j,n,k;
    cin >> n >> k;
    ll w[n+1],v[n+1];
    for(i=1;i<=n;i++){
        cin >> w[i] >> v[i];
    }

    ll dp[n+1][k+1];

    for(i=0;i<=n;i++){
        for(j=0;j<=k;j++){
            dp[i][j]=0;
        }
    }

    for(i=1;i<=n;i++){
        for(j=1;j<=k;j++){
            if(j-w[i]>=0){
                dp[i][j] = max(dp[i-1][j-w[i]] + v[i],dp[i-1][j]);
            }
            else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }

    cout << dp[n][k] << endl;

}

//    cout << fixed << setprecision(12);


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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x, y;
string s,t;
// < ----------- func eh ---------------- ? //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>s>>t;
	cout<<t+s;newl;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


Measured memory_bytes: 3664
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	int r;
	cin >> r;
	cout << 3 * r * r;
	return 0;
}

Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

#include <iostream>
#include <vector>
#include <string> 
#include <algorithm> 
using namespace std;

struct arr{
    string name;  // 名前
    int    point; // 価格
    int num;
};

vector<arr> arrs;
int main(){
    int n = 0;
    int b;
    string a;
    cin  >> n;
    rep(i,n){
        cin >> a >> b;
        arrs.push_back({a,b,i+1});
    }
    sort(arrs.begin(), arrs.end(), 
     [](const arr& x, const arr& y) { return x.name < y.name||(x.name==y.name)&(x.point > y.point);});
    rep(i,n){
        cout << arrs[i].num << endl;
    }
}

Measured memory_bytes: 888
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}

int main(){
    int n;scanf("%d",&n);
    int d[n];for(int i=0;i<n;i++)scanf("%d",&d[i]);
    int m;scanf("%d",&m);
    int t[m];for(int i=0;i<m;i++)scanf("%d",&t[i]);

    qsort(d,n,sizeof(int),asc_cmp);
    qsort(t,m,sizeof(int),asc_cmp);

    int cnt=0,t_i=0;
    for(int i=0;i<n;i++){
        if(t[t_i]==d[i]){
            cnt++;
            t_i++;
        }
    }
    printf("%s\n",cnt==m?"YES":"NO");
}

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

void Main() {
    // input
    int N;
    cin >> N;


    // process
    int count = 0;
    for (int i = 0; i < N; i++) {
        int D_1, D_2;
        cin >> D_1 >> D_2;
        if (D_1 == D_2) {
            count++;
            if (count >= 3) {
                cout << "Yes" << endl;
                return;
            }
        } else {
            count = 0;
        }
    }
    cout << "No" << endl;

    // output

}

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


Measured memory_bytes: 3672
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a, b, c;
    cin >> a >> b >> c;
    int res = 0;
    for (int i = 1; i < b; i++) {
        if (a * i % b == c) res++;
    }
    if (res) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}
import Control.Applicative((<$>))
import Control.Monad
import qualified Data.Map as M
-- import qualified Data.Char as C
import qualified Data.List as L
-- import qualified Data.IntSet as I
-- import Debug.Trace
--------------------------------------------
readInt    = read :: String -> Int
readFloat  = read :: String -> Float
getInt     = readInt <$> getLine
getIntList = map readInt . words <$> getLine
int2bin 0 =  []
int2bin n =  n `mod` 2 : int2bin (n `div` 2)
----------------------------------------------

main :: IO ()
main = do
  n  <- getInt
  s1 <- getLine
  s2 <- getLine
  print $ (solve Initial s1 s2 1) `mod` 1000000007

data Status = Initial | Tate | Yoko deriving Show

solve :: Status -> String -> String -> Int -> Int
solve _ [] [] cur = cur
solve Tate [x] [y] cur = cur*2
solve Yoko [x] [y] cur = cur
solve Initial [x] [y] cur = cur*3
solve s (x:x':xs) (y:y':ys) cur
  | x == y    =
    case s of
      Initial -> solve Tate (x':xs) (y':ys) cur*3
      Tate    -> solve Tate (x':xs) (y':ys) cur*2
      Yoko    -> solve Tate (x':xs) (y':ys) cur
  | otherwise =
    case s of
      Initial -> solve Yoko xs ys cur*6
      Tate    -> solve Yoko xs ys cur*2
      Yoko    -> solve Yoko xs ys cur*3


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

typedef long long ll;

int main(int argc, char* argv[])
{
  ll N, L;
  std::cin >> N >> L;
  std::string str(L, 'a');
  std::vector< std::string > vs(N, str);

  for (ll i = 0; i < N; i++) {
    std::cin >> vs[i];
  }

  std::sort(vs.begin(), vs.end());
  for (std::vector< std::string >::iterator it = vs.begin(); it != vs.end(); it++) {
    std::cout << *it;
  }
  std::cout << std::endl;
  
  return 0;
}


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

namespace agc14
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int A = int.Parse(str[0]);
            int B = int.Parse(str[1]);
            int C = int.Parse(str[2]);
            int ans = 0;
            int oA = A;
            int oB = B;
            int oC = C;
            while (A % 2 == 0 && B % 2 == 0 && C % 2 == 0)
            {
                int tempa = A;
                int tempb = B;
                A = B / 2 + C / 2;
                B = C / 2 + tempa / 2;
                C = tempa / 2 + tempb / 2;
                if (A == oA && B == oB && C == oC)
                {
                    ans = -1;
                    break;
                }             
                ans++;
            }

            Console.WriteLine(ans);
        }
    }
}


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


// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef complex<int> ci;
typedef complex<double> cd;
typedef complex<long double> cld;

// macros
#define rep(i, a, b) for(int i=a; i<b; i++)
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define tr(c, it) for(auto it=(c).begin(); it!=c.end(); it++)
#define pb push_back
#define mp make_pair
#define bitcount __builtin_popcount
#define ispresent(c, x) ((c).find(x) != (c).end())
#define watch(x) cout<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// template functions
template <typename T>
inline void printV(vector<T>& a) { rep(i, 0, sz(a)) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void printV(vector<T>& a, int n) { rep(i, 0, n) { cout<<a[i]<<" "; } cout<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a)
{
	rep(i, 0, sz(a)) {
		printV(a[i]);
	}
	cout<<"\n";
}

template <typename T>
inline void clearVV(vector<vector<T>>& a)
{
	for(auto& x:a) {
		x.clear();
	}
	a.clear();
}
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val)
{
	for(int i=0; i<sz(a); i++) {
		for(int j=0; j<sz(a[i]); j++) {
			a[i][j]=val;
		}
	}
}


// constants
const long double eps = 1e-9;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;

typedef long double ld;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
    cout<<fixed<<setprecision(10);
	int n;
	cin>>n;
	vector<ld> p(n);
	rep(i,0, n) cin>>p[i];
	vector<vector<ld>> dp(n, vector<ld>(n));
	assignVV(dp, (ld)-1);
	
	function<ld(int, int)> solve=[&](int i, int no)
	{
		if(i==n-1) {
			if(no==0) return 1-p[i];
			else if(no<0) return (ld)0;
			else return (ld)1;
		}
		if(no<0) return (ld)0;
		if(no>=n-i+1) return (ld)1;
		
		if(fabs(dp[i][no]+1)>eps) return dp[i][no];
		ld &memo=dp[i][no];
		memo=p[i]*solve(i+1, no-1);
		memo+=(1-p[i])*solve(i+1, no);
		return memo;
	};
	cout<<1-solve(0, n/2)<<"\n";
	//~ printVV(dp);
    return 0;
}



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

using namespace std;
typedef long long ll;

const int mod = 1e9 + 7, MaxN = 205;

int n, m, k, ans = 1, pk[MaxN], c[MaxN][MaxN];
vector<int> edge[MaxN];

void preprocess() {
  int n = MaxN - 1;
  for (int i = 0; i <= n; i++) {
    pk[i] = i ? (ll) pk[i - 1] * k % mod : 1;
    for (int j = c[i][0] = 1; j <= i; j++)
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
  }
} 

int s[MaxN], s_n;
int dfn[MaxN], low[MaxN], bel[MaxN], dfs_n, c_n;

void exgcd(int a, int b, int &x, int &y) {
  if (!b) x = 1, y = 0; else exgcd(b, a % b, y, x), y -= (a / b) * x;
}
int mod_inv(int a) {
  int x, y; exgcd(a, mod, x, y); return (x % mod + mod) % mod;
}
int cal(const vector<int> &v) {
  int total_edge = 0, n = v.size(); 
  for (int x : v) 
    for (int y : edge[x])
      if (bel[y] == c_n)
        ++total_edge;
  total_edge >>= 1;
  if (total_edge == 1)
    return k;
  if (total_edge == n) {
    int sum = 0;
    for (int i = 1; i <= n; i++) {
      sum = (sum + pk[__gcd(i, n)]) % mod;
    }
    sum = (ll) sum * mod_inv(n) % mod;
    return sum;
  }
  return c[total_edge + k - 1][k - 1];
}

void dfs(int x, int fa) {
  s[++s_n] = x;
  dfn[x] = low[x] = ++dfs_n; 
  for (int y : edge[x]) {
    if (y == fa) continue;
    if (dfn[y]) {
      low[x] = min(low[x], dfn[y]);
    } else {
      dfs(y, x);
      if (low[y] >= dfn[x]) {
        vector<int> tmp = {x}; bel[x] = ++c_n; int t = -1;
        while (t != y) bel[t = s[s_n--]] = c_n, tmp.push_back(t);
        ans = (ll) ans * cal(tmp) % mod;
      } else low[x] = min(low[x], low[y]); 
    }
  }
}
int main() {
  cin >> n >> m >> k;
  preprocess(); 
  
  for (int i = 1, u, v; i <= m; i++) {
    cin >> u >> v;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  
  for (int i = 1; i <= n; i++)
    if (!dfn[i])
      dfs(i, 0);
       
  cout << ans << "\n";
  return 0;
}



Measured memory_bytes: 384
#include <cstdio>
#include <cstdint>

int main() {
  int n, m;
  scanf("%d %d", &n, &m);

  constexpr intmax_t mod=1e9+7;

  intmax_t res_x=0;
  for (int i=0; i<n; ++i) {
    intmax_t x;
    scanf("%jd", &x);
    res_x = (res_x + (2*i-n+1)*x) % mod;
  }

  intmax_t res_y=0;
  for (int j=0; j<m; ++j) {
    intmax_t y;
    scanf("%jd", &y);
    res_y = (res_y + (2*j-m+1)*y) % mod;
  }

  printf("%jd\n", res_x*res_y%mod);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
const int N=2e5+5;
const int P=998244353;
pii robs[N];
int n,cop[N],ner[N];
ll dp[N],sum[N],bb[N];
struct eff{
    int l,r,id;
    bool operator < (const eff a)const{
        return id<a.id;
    }
};
priority_queue<eff>q;
int findd(int x){return upper_bound(cop+1,cop+n+2,x)-cop;}
int main()
{
    sc(n);
    rep(i,1,n)sc2(robs[i].fi,robs[i].se);
    sort(robs+1,robs+n+1);
    rep(i,1,n)cop[i]=robs[i].fi;
    cop[n+1]=inf;
    rep(i,1,n){
        while(!q.empty()){
            auto u=q.top();
            if(i>u.r)q.pop();
            else if(i>=u.l&&i<=u.r&&!ner[i]){
                ner[i]=u.id;
                break;
            }else break;
        }
        int nx=robs[i].fi+robs[i].se-1,pos=findd(nx);
        q.push({i+1,pos-1,i});
    }
    bb[1]++;sum[0]=1;dp[0]=1;
    rep(i,1,n){
        bb[i]=(bb[i]+bb[i-1])%P;
        dp[i]=(dp[i]+bb[i])%P;
        if(ner[i]>0)dp[i]=((dp[i]-sum[ner[i]-1])%P+P)%P;
        bb[i+1]=(bb[i+1]+dp[i])%P;
        sum[i]=(dp[i]+sum[i-1])%P;
        //cout<<dp[i]<<" "<<sum[i]<<endl;
    }
    cout<<sum[n]<<endl;
    return 0;
}


Measured memory_bytes: 10992
#include <bits/stdc++.h>
#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 sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    vector<int> f,b;
    rep(i,n){
        int a;cin>>a;
        if(i%2==0){
            b.push_back(a);
        }else{
            f.push_back(a);
        }
    }
    if(n%2==0){
        reverse(f.begin(),f.end());
        rep(i,f.size())cout<<f[i]<<" ";
        rep(i,b.size())cout<<b[i]<<" ";
        cout<<endl;
    }else{
        reverse(b.begin(),b.end());
        rep(i,b.size())cout<<b[i]<<" ";
        rep(i,f.size())cout<<f[i]<<" ";
        cout<<endl;
    }
    
}

Measured memory_bytes: 4324
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
long long A[101000], AA[101000], B[101000], BB[101000], L, X[101000], w[101000], M, MM, res;
int main() {
	int i;
	scanf("%d%lld", &n, &L);
	for (i = 1; i <= n; i++) {
		scanf("%lld%lld", &X[i],&w[i]);
		A[i] = A[i - 1] - (X[i] - X[i - 1]) + w[i];
		AA[i] = AA[i - 1] - (X[i] - X[i - 1]) * 2 + w[i];
	}
	X[n + 1] = L;
	for (i = n; i >= 1; i--) {
		B[i] = B[i + 1] - (X[i + 1] - X[i]) + w[i];
		BB[i] = BB[i + 1] - (X[i + 1] - X[i])*2 + w[i];
	}
	for (i = n; i >= 0; i--) {
		res = max(res, M + AA[i]);
		res = max(res, MM + A[i]);
		if (!i)break;
		M = max(M, B[i]);
		MM = max(MM, BB[i]);
	}
	printf("%lld\n", res);
}

Measured memory_bytes: 4864
#include<iostream>
//#include<vector>
#include<algorithm>
#include<string>
#include<tuple>
using namespace std;
int main(){
	int a;
	cin>>a;
	tuple<string,int,int> b[a];
	string c;
	int d;
	for(int i=0;i<a;i++){
		cin>>c>>d;
		d=100-d;
		b[i]=make_tuple(c,d,i+1);
	}
	sort(b,b+a);
	for(int i=0;i<a;i++){
		cout<<get<2>(b[i])<<endl;
	}
	return 0;
}

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

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

	vector<char> S(N);

	for (int i = 0; i < N;i++) {
		cin >> S[i];
	}

	sort(S.begin(), S.end());

	if (S[N - 1] == 'Y') {
		cout << "Four" << endl;
	}
	else cout << "Three" << endl;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    double r;
    cin >> r;
    cout << fixed << setprecision(6) << 2.0 * acos(-1) * r;
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

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

using namespace std;

int main()
{
    string s,sub;
    cin>>s;
    int digit,arr[10],n=s.length();
    for(int i=0;i<n-1;i++){
        sub=s.substr(i,3);
        digit=(sub[0]-'0')*100+(sub[1]-'0')*10+(sub[2]-'0');
        arr[i]=abs(digit-753);
    }
    sort(arr,arr+n-2);
    cout<<arr[0];
    return 0;
}


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

int	main()
{
  int	N;
  int	i;
  int	n;
  
  cin >> N;
  
  n = 32;  
  while (N-- > 0)
  {
    int	A;
    cin >> A;

    i = 0;
    while (A % 2 == 0)
    {
      A /= 2;
      i++;
    }
    if (n > i)
      n = i;
  }
  cout << n << endl;
  return (0);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll p=pow(10,9)+7;
ll phi(ll n) {
    ll result = n;
    for (ll i = 2; i * i <= n; i++) {
        if(n % i == 0) {
            while(n % i == 0)
                n /= i;
            result -= result / i;
        }
    }
    if(n > 1)
        result -= result / n;
    return result;
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      
    x = x % p;  
   while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; 
        x = (x*x) % p; 
    } 
    return res; 
} 

ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
}


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    ll x,n,i,j;
    ll ans=0;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++)
    cin>>arr[i];
    sort(arr,arr+n);
    ans=arr[n/2]-arr[(n/2)-1];

    cout<<ans;
}
    


Measured memory_bytes: 1024
import math
def merge(A, left, mid, right):
    global cnt
    L = A[left:mid] + [math.inf]
    R = A[mid:right] + [math.inf]

    i = 0
    j = 0
    for k in range(left, right):
        cnt += 1
        if L[i] <= R[j]:
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1


def mergeSort(A, left, right):
    if left+1 < right:
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)


n = int(input())
A = list(map(int, input().split()))
cnt = 0
mergeSort(A, 0, n)

print(' '.join(str(a) for a in A))
print(cnt)





Measured memory_bytes: 70752
#include<bits/stdc++.h>
#pragma GCC optimize("O2")
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(c) c.begin(), c.end()
#define endl "\n"
#define sz(u) (int)(u.size())
#define L(x)(2*x)
#define R(x)(2*x+1)
#define M(x,y)((x+y)/2)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
void solve(){
    string s;
    cin>>s;
    for(int i=0;i<sz(s);i++){
        if(s[i]=='?'){
        cout<<'D';
        }
        else{
            cout<<s[i];
        }
    }
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
}


Measured memory_bytes: 3780
# https://atcoder.jp/contests/abc097/tasks/abc097_a
a, b, c, d = [int(x) for x in input().split()]
if abs(a - c) <= d:
    print("Yes")
elif (a < b and b < c) or (a > b and b > c):
    print("Yes") if (abs(a - b) <= d and abs(b - c) <= d) else print("No")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#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 MP make_pair

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;

int n;

int fac[1000005], ifac[1000005];
int power(int x, int t)
{
	int ret = 1;
	while(t > 0) {
		if(t & 1) ret = 1LL * ret * x % MOD;
		x = 1LL * x * x % MOD;
		t >>= 1;
	}
	return ret;
}

int main()
{
	scanf("%d", &n);
	
	fac[0] = 1;
	rep1(i, n) fac[i] = 1LL * fac[i - 1] * i % MOD;
	ifac[n] = power(fac[n], MOD - 2);
	for(int i = n; i >= 1; i --) ifac[i - 1] = 1LL * ifac[i] * i % MOD;
	
	int ans = 0;
	rep1(i, n) ans = (ans + 1LL * fac[n] * ifac[i] % MOD * ifac[n - i] % MOD *
	(power(2, i) + power(MOD - 1, i + 1)) % MOD * power(1LL * n * i % MOD, MOD - 2)) % MOD;
	
	ans = 1LL * ans * power(3, MOD - 2 - n) % MOD;
	
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <vector>

using namespace std;

#define debug(x) cout << #x << "==" << x << endl;

const int inf = 100000000;

const int dif = 30000;

typedef long long ll;

int main() {
  ios::sync_with_stdio(false);

  int N;
  cin >> N;

  vector<int> p(N);
  for(int i = 0; i < N; i++) { cin >> p[i]; }

  vector<int> a(N);
  vector<int> b(N);
  for(int i = 0; i < N; i++) {
    a[i] = dif * i + 1;
    b[N-i-1] = dif * i + 1;
  }

  for(int i = 0; i < N; i++) {
    a[p[i]-1] += i+1;
  }

  for(int i = 0; i < N; i++) {
    cout << a[i] << " ";
  }
  cout << "\n";
  for(int i = 0; i < N; i++) {
    cout << b[i] << " ";
  }
  return 0;
}


Measured memory_bytes: 896
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        boolean flag = true;
        for(int i =0;i < N;i++){
            int num = Integer.parseInt(sc.next());
            if(num %2 == 0){
                if(num %3 == 0 || num %5 == 0){
                }else{
                    flag = false;
                }
            }
        }
        if(flag){
            System.out.println("APPROVED");
        }else{
            System.out.println("DENIED");
        }
    }
}

Measured memory_bytes: 35420
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
  int K; cin>>K;
  int i=0, j, k;
  vector<ll> ans = {0,1,2,3,4,5,6,7,8,9};
  for(;i<K;){
    j = i + 1;
    i = ans.size() - 1;
  for(j;j<=i;j++){
    if((ans[j]*10 + ans[j] % 10 - 1)%10 != 9)ans.push_back(ans[j]*10 + ans[j] % 10 - 1);
    ans.push_back(ans[j]*10 + ans[j] % 10);
    if((ans[j]*10 + ans[j] % 10 + 1)%10 != 0)ans.push_back(ans[j]*10 + ans[j] % 10 + 1);
  }
  }
  AA(ans[K]);
  return 0;
}

Measured memory_bytes: 8508
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i, n) ;for (lli i = 0;i < (lli)(n);i++)
#define rep2(i, s, n) ;for (int i = s; i < (int)(n);i++)
#define ALL(vec)  (vec).begin(),(vec).end()
#define pi 3.1415926535897932384626433832795
#define MAX_INF 9223372036854775807
#define MIN_INF (922337203685477587+1)
#define sosuu 1000000007

int main() {
string S;
  cin >> S;
  vector<char> s(S.size());
  rep(i, S.size())
    s[i]=S[i];
  
  lli Q;
  cin >> Q;
  int t,f,check=0;
  char c;
  rep(i, Q){
    cin >> t;
    if(t==1){
    check++;
    }
    
    else{
      cin >> f>>c;
    if(check%2==0)
    {
    if(f==1)
      s.insert(s.begin(), c);
      else
        s.push_back(c);
    }    
      else
    {
    if(f==2)
      s.insert(s.begin(), c);
      else
        s.push_back(c);
    }
    
    }
    
  }
      if(check%2==1)
        reverse(ALL(s));
  rep(i, s.size()){
  cout << s[i];
    
  }
  cout << endl;
}

Measured memory_bytes: 1084
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>

typedef signed char        int8;
typedef short              int16;
typedef int                int32;
typedef long long          int64;
typedef unsigned char      uint8;
typedef unsigned short     uint16;
typedef unsigned int       uint32;
typedef unsigned long long uint64;

int main(void) {
  int n;
  std::cin >> n;
  std::map<std::string, int> m;
  for (int i = 0; i < n; i++) {
    std::string s;
    std::cin >> s;
    m[s]++;
  }
  std::cout << m.size() << std::endl;
  return 0;
}


Measured memory_bytes: 19224
#include <stdio.h>

int main(){
    int s[10] = {0}, n, i = 0;
    
    while (scanf("%d", &n) != -1) {
        if (n == 0)
            printf("%d\n", s[--i]);
        else
            s[i++] = n;
    }
    return 0;
}

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

#define MOD 1000000007

using namespace std;

int main() {
	int n, x;
	cin >> n;
	vector<int> b;
	b.push_back(0);
	for (int i = 0; i < n; i++) {
		cin >> x;
		b.push_back(x);
	}
	vector<int> a;
	a.push_back(0);
	for (int i = 1; i <= n; i++) {
		int last = 0;
		for (int j = 1; j <= n - i + 1; j++) {
			if (b[j] == j) {
				last = j;
			}
		}
		if (!last) {
			cout << -1 << endl;
			return 0;
		}
		a.push_back(last);
		for (int j = last; j < n - i + 1; j++) {
			b[j] = b[j + 1];
		}
	}
	for (int i = n; i >= 1; i--) {
		cout << a[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define MOD 1000000007
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define print(a, n) for(LL e=0; e<n; e++) cout<<a[e]<<" "; cout<<endl
#define read(a, n) for(LL e=0; e<n; e++) cin>>a[e];
using namespace std;

int main()
{
	fastio;
	LL x;
	cin>>x;
	for(LL i=0; i<=1000; i++){
		for(LL j=0; j<=1000; j++){
			LL a = (LL)i*i*i*i*i;
			LL b = (LL)j*j*j*j*j;

			if((a-b)==x){
				cout<<i<<" "<<j<<"\n";
				return 0;
			}

			if((a+b)==x){
				cout<<i<<" "<<-j<<"\n";
				return 0;
			}

			if((-a+b)==x){
				cout<<-i<<" "<<-j<<"\n";
				return 0;
			}

			if((-a-b)==x){
				cout<<-i<<" "<<j<<"\n";
				return 0;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 3644
N,K = map(int, input().split())
p = list(map(int, input().split()))

sum_memo = [0]*1001
x_memo = [0] * 1001
x_list = [0]*N

for i in range(1,1001):
    sum_memo[i] = sum_memo[i-1] + i

for i in range(N):
    if x_memo[p[i]] == 0:
        x_memo[p[i]] = sum_memo[p[i]]/p[i]
    x_list[i] = x_memo[p[i]]


ans = 0
tmp = sum(x_list[:K])
#print(tmp)
#print(x_list)
if N==K:
    print(tmp)
    exit()
for l in range(N-K):
    r = l+K
    tmp = tmp -  x_list[l] + x_list[r]
#    print(l,r,x_list[l], x_list[r], tmp)
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 25604
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
using namespace std;
const int SIZE = 64;
const int INF = 1<<29;
int main() {
  bool a[SIZE][SIZE];
  int d[SIZE][SIZE];
  for(int i = 0; i < SIZE; i++)
    for(int j = 0; j < SIZE; j++) {
      a[i][j] = false;
      d[i][j] = INF;
    }
  int H, W;
  cin>>H>>W;
  int ans = 0;
  for(int h = 1; h <= H; h++) {
    string s; cin>>s;
    for(int w = 1; w <= W; w++) {
      if(s[w-1] == '.') {
	a[h][w] = true;
	ans++;
      }
    }
  }
  d[0][0] = 0;
  deque<int> Y, X, D;
  Y.push_back(1);
  X.push_back(1);
  D.push_back(0);
  while(!D.empty()) {
    int y = Y.front(); Y.pop_front();
    int x = X.front(); X.pop_front();
    int dd = D.front(); D.pop_front();
    for(int dir = 0; dir < 4; dir++) {
      const int xx[] = {0, 1, 0, -1};
      const int yy[] = {1, 0, -1, 0};
      int nx = x+xx[dir], ny = y+yy[dir];
      //	  cout << ny << " " << nx << " " << d[ny][nx] << endl;
      if(a[ny][nx]) {
	if(d[ny][nx] > dd+1) {
	  d[ny][nx] = dd + 1;
	  Y.push_back(ny);
	  X.push_back(nx);
	  D.push_back(dd+1);
	}
      }
    }
  }
  //  cout << ans << endl;
  //  cout << d[H][W] << endl;
  if(d[H][W] >= INF) ans = -1;
  else {
    ans -= d[H][W]; ans--;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256