akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

// 方針
//   nが与えられて、それより小さい数を列挙するときには、
//   nを2進数表記して、任意の1のbitを0に変えてそれより下は自由に選択可能になる。
//   今回はn以下という問題だったので、最初に1を足しておいて、その方針を使う。

ll dp[62][2];     // dp[i][0] = 2進数でi桁(最上位は0もOK)のvに対してのuの選び方の合計 (ただし和が上位に繰り上がらない）
                  // dp[i][1] = 2進数でi桁(最上位は0もOK)のvに対してのuの選び方の合計 (ただし和が上位に繰り上がる）

void prepare()
{
    dp[0][0]=1;
    dp[0][1]=0;

    long i;
    for(i=1; i<60; i++) {
         dp[i][0] = (dp[i][0] + 2 * dp[i-1][0]) %MOD;
         dp[i][0] = (dp[i][0] + dp[i-1][1]) %MOD;
         dp[i][1] = (dp[i][1] + dp[i-1][0]) %MOD;
         dp[i][1] = (dp[i][1] + 2 * dp[i-1][1]) %MOD;
    }
}

ll calc( ll n, long i )    // 桁i(下からi+1番目)が1なのを0に変えて、それより下位は自由に選ぶ
{
    ll val[2]= {dp[i][0], dp[i][1]};

    long p;
    for(p=i; p<60; p++) {
        ll valnew[2] = {0, 0};

        bool curr = (p==i? 0: ((n & ((ll)1<<p)) != 0));
        if ( curr ) {
            valnew[0] = (valnew[0] + val[0]) %MOD;
            valnew[0] = (valnew[0] + val[1]) %MOD;
            valnew[1] = (valnew[1] + val[1]) %MOD;
        }
        else {
            valnew[0] = (valnew[0] + val[0]) %MOD;
            valnew[1] = (valnew[1] + val[0]) %MOD;
            valnew[1] = (valnew[1] + val[1]) %MOD;
        }

        val[0] = valnew[0];
        val[1] = valnew[1];
    }

    return val[0];
}

long solve( ll n )
{
    n ++;    // nより小さい数だけを考えればよい形にするため
    
    ll ans=0;
    long i;
    for(i=60; i>=0; i--) {
        if(n & ((ll)1<<i)) {   // 桁i(下からi+1番目)が1のとき、0に変えた場合を計算
            ans = (ans + calc(n, i)) %MOD;
        }
    }
    printf("%lld\n", ans);

    return 0;
}

int main(int argc, char* argv[])
{
    ll n;
    scanf("%lld", &n);

    prepare();

    return solve( n );
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
 
int main()
{
    int w,n;
 
    char c;
 
    std::cin >> w >> n;
 
    std::vector<int> a(n);
 
    std::vector<int> b(n);
 
    std::vector<int> x(w);
 
    for(int i=0;i<n;++i)
    {
        std::cin >> a[i] >> c >> b[i];
    }
 
    for(int i=0;i<w;++i)
    {
        x[i]=i+1;
    }
 
    for(int i=0;i<n;++i)
    {
        int temp = x[a[i]-1];
 
        x[a[i]-1]=x[b[i]-1];
 
        x[b[i]-1]=temp;
    }
 
    for(int i=0;i<w;++i)
    {
        std::cout << x[i] << '\n';
    }
}

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

int main(){
    int n,a[5];

    for(int i=0;i<5;i++){
        cin>>a[i];
    }   
    sort(a,a+5);
    for(int i=4;i>=0;i--){
        cout<<a[i];

        if(i==0){
            cout<<endl;
        }else{
            cout<<" ";
        }
    }   
    return 0;
}

Measured memory_bytes: 0
//created by Ruchir Mehta
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<cmath>
#include<iomanip>
#define fast ios_base::sync_with_stdio(0)
#define fast_in cin.tie(0)
#define fast_out cout.tie(0)
#define ll long long
#define MAX 1000000
#define MAX_MAX 10000000000
#define pb push_back
#define ppbk pop_back
#define mp make_pair
#define precise(i) cout<<fixed<<setprecision(i)
#define f first
#define s second
#define in insert
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,k,n) for(ll i=k;i<n;i++)
#define pll pair<ll,ll>
#define V vector<ll>
#define VV vector<V>
#define Mll map<ll,V>
#define Vpll vector<pll>
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define Sll set<ll>
#define MAXN 105
#define MOD 998244353
#define dg(x) cerr<<#x<<':'<<x<<endl;
#define dg2(x,y) cerr<<#x<<':'<<x<<' '<<#y<<':'<<y<<endl;
#define dg3(x,y,z) cerr<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<endl;
#define dg4(x,y,z,zz) cerr<<#x<<':'<<x<<' '<<#y<<':'<<y<<' '<<#z<<':'<<z<<' '<<#zz<<':'<<zz<<endl;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const double PI = 3.141592653589;
const char nl = '\n';
//ll random=uniform_int_distribution<int>(start,end)(rng);

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */
 


ll binpow(ll a, ll b, ll m) 
{
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

//void dfs(ll a,vector<ll> adj[])
//{
//static unordered_set<ll> bag;
//if(bag.find(a)==bag.end())
//{
//bag.insert(a);
//cout<<a<<"\n";
//for(auto it:adj[a])
//dfs(it,adj);
//}
//}

void solve()
{
//	   clock_t time_req;
//    time_req = clock();
	ll x,n;
	cin>>x>>n;
	unordered_set<ll> se;
	rep(i,n)
	{ll temp;
	cin>>temp;
	se.in(temp);
	}
//	cin>>p[i];
	rep(i,105)
	{if(se.find(x-i)==se.end())
	{cout<<x-i<<endl;
	return;
	}
	if(se.find(x+i)==se.end())
	{cout<<x+i<<endl;
	return;
	}
	}
//	time_req = clock()-time_req;
//    cout<<"Time taken: "<<(float)time_req/CLOCKS_PER_SEC<<"s"<<endl;
}

int main()
{
fast;
fast_in;
fast_out;
ll no=1;

// cin>>no;
while(no--){
	solve();
}
return 0;
}

//Don’t keep debug print statements while submitting :stuck_out_tongue:

Measured memory_bytes: 3636
program am
implicit none
integer(16)::N
integer(16)::ANS,SUM3,SUM5,SUM15
read*,N
SUM3=3_16*sigma(N/3_16)
SUM5=5_16*sigma(N/5_16)
SUM15=15_16*sigma(N/15_16)
ANS=sigma(N)-SUM3-SUM5+SUM15
print"(I0)",ANS
contains
pure integer(16) function sigma(i)
integer(16),intent(in)::i
sigma=(i*(i+1))/2
end function
end program am

Measured memory_bytes: 2836
<?php

$a=explode(' ',trim(fgets(STDIN)));
if($a[2]<$a[4]||$a[3]<$a[4]||$a[0]-$a[2]<$a[4]||$a[1]-$a[3]<$a[4]){
        echo "No".PHP_EOL;
}else{
        echo "Yes".PHP_EOL;
}

Measured memory_bytes: 6556
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

int main() {
	int64_t N, M;
	cin >> N >> M;

	cout << abs(N - 2) * abs(M - 2) << endl;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    int N;
    cin >> N;
    ll a = 0;
    rep(i,N){
        int l,r;cin>>l>>r;
        a += (r-l+1);
    }
    cout << a << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i=0; i<(ll)n; i++)
#define REPR(i, n) for(ll i=(ll)n-1; i>=0; i--)
#define FOR(i, m, n) for(ll i=(ll)m; i<(ll)n; i++)
#define FORR(i, m, n) for(ll i=(ll)m-1; i>=(ll)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
vector<string> split(string s, char p){vector<string>v;stringstream m(s);string b;while(getline(m,b,p))v.push_back(b);return v;}
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 (a>b) { a = b; return 1; } return 0; }
struct nya{ nya(){ cin.tie(0); ios::sync_with_stdio(false); } }nyan;

int main(){
    char a; cin >> a;
    if(a>95) cout << "a\n";
    else cout << "A\n";
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
 
#define int long long
#define MOD 1000000007
 
using namespace std;
 
template <class T> ostream &operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for (auto v : V)
        os << v << " ";
    os << "]";
    return os;
}
template <class T> ostream &operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for (auto s : S)
        os << s << " ";
    return os << "}";
}
template <class L, class R> ostream &operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for (auto m : M)
        os << "(" << m.first << ":" << m.second << ") ";
    return os << "}";
}
template <class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}

int getMax(int n) {
    int count = 0;
    while(n % 2 == 0) {
        count ++;
        n /= 2;
    }
    return count;
}
  
void solve() {
    int n, k;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    int sum = 0;
    for(int i = 0;i < k; i++) {
        sum += a[i];
    }
    cout << sum << endl;
}
 
int32_t main() {
    int t;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    // cin >> t;
    // while(t--) {
    //     solve();
    // }
    return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>

int main(void) {
	int k, a, b;
	
	
	scanf("%d", &k);
	scanf("%d %d", &a,&b);

	for (int i = a;i <= b;i++)
	{
		if (i % k == 0)
		{
			printf("OK\n");
			return 0;
		}
		
	}
	printf("NG");
	
	return 0;
}

Measured memory_bytes: 1684
//raja1999

//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string> 
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16)a; cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 <<endl;prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define int ll

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

//std::ios::sync_with_stdio(false);

set<pair<int,int> > se;
set<pair<int,int> >::iterator it;
int dp[200005],nxt[200005];
string s;
main(){
	std::ios::sync_with_stdio(false); cin.tie(NULL);
	int t,t1;
	//cin>>t;
	t=1;
	t1=t;
	while(t--){
		int n,m,i,cur,val;
		cin>>n>>m;
		n++;
		cin>>s;
		dp[n-1]=0;
		nxt[n-1]=-1;
		se.insert(mp(dp[n-1],n-1));
		fd(i,n-2,0){
			if(i+m+1<n){
				val=0;
				if(s[i+m+1]=='1'){
					val=inf;
				}
				se.erase(se.find(mp(dp[i+m+1]+val,i+m+1)));
			}
			it=se.begin();
			dp[i]=it->ff+1;
			nxt[i]=it->ss;
			val=0;
			if(s[i]=='1'){
				val=inf;
			}
			se.insert(mp(val+dp[i],i));
		}
		if(dp[0]>n+5){
			cout<<-1<<endl;
			return 0;
		}
		cur=0;
		while(nxt[cur]!=-1){
			cout<<nxt[cur]-cur<<" ";
			cur=nxt[cur];
		}
		cout<<endl;
	}
	return 0;
} 
	

Measured memory_bytes: 7936
#今回は行列を使用します。
#行列演算に完全勝利したコード
n = int(input())
dp = [[0, 0, 0] for i in range(n)]
h = [list(map(int, input().split())) for i in range(n)]
#print(h)
#print(dp)
for j in range(3):
    dp[0][j] = h[0][j]
for i in range(1,n):
    dp[i][0] = h[i][0]+max(dp[i-1][1], dp[i-1][2])
    dp[i][1] = h[i][1]+max(dp[i-1][2], dp[i-1][0])
    dp[i][2] = h[i][2]+max(dp[i-1][0], dp[i-1][1])
print(max(dp[-1]))


Measured memory_bytes: 50292
#include <bits/stdc++.h>
using namespace std;
int b,c,e;
int main() {
    int n1, n2;
    cin >> n1;
    set<int> s;
    for (int i = 0; i < n1; i++) {
        cin >> n2;
        s.insert(n2);
    }
    int f = 0;
    for (int i:s) {
        if (f) cout << " ";
        else f++;
        cout << i;
    }
    cout << endl;
    return 0;
}


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

typedef long long int ll;

using namespace std;

char lowCaseAlpha[] = {' ', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
void fast()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int main()
{
    fast();

    //freopen("out.txt", "w", stdout);

    string str, n;
    cin >> str;
    ll m = -1, num;
    for (ll i = 0; i < str.size() - 2; i++)
    {
        n = str.substr(i, 3);
        stringstream geek(n);
        geek >> num;
        if (abs(num - 753) >= 0)
        {
            if (m == -1)
            {
                m = abs(num - 753);
            }
            else
            {
                m = min(m, abs(num - 753));
            }
        }
    }
    cout << m;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define pb push_back
#define f first
#define s second
#define int long long
#define N 100000
using namespace std;
int a[N + 5],dp[N + 5];
main (){
    int n;
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i],dp[i] = INT_MAX;
    dp[1] = 0;
    for (int i=2;i<=n;i++){
        dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]),dp[i]);
        if (i > 2) dp[i] = min(dp[i - 2] + abs(a[i] - a[i - 2]),dp[i]);
    }
    cout<<dp[n];
}



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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define whole(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bit(n) (1LL<<(n))
// functions
template <typename T> void unique(T& c){c.erase(std::unique(c.begin(), c.end()), c.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(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << "(" << p.first << ", " << p.second << ")"; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << "(" << itr->first << ", " << itr->second << ")"; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  string s; cin >> s;
  if(s[2] == s[3] && s[4] == s[5])cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *

S = input()

A = set(S)

for x in ascii_lowercase:
	if not x in A:
		print(S+x)
		break
else:
	if S == ascii_lowercase[::-1]:
		print(-1)
	else:
		S = S[::-1]
		for i in range(len(S)-1):
			if S[i+1] < S[i]:
				for char in sorted(S[:i+1]):
					if char > S[i+1]:
						print(S[::-1][:-i-2]+char)
						exit()



Measured memory_bytes: 5840
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int a, b;
    cin >> a >> b;
    string s;
    if (a < b) {
        rep(i,b) s.push_back('0' + a);
    } else {
        rep(i,a) s.push_back('0' + b);
    }
    cout << s << endl;
}

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

int main(void){
    string s;
    cin>>s;
    set<char> dict;
    for(int i=0;i<s.size();i++){
        dict.insert(s[i]);
    }
    if(dict.size()==3){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N; cin >> N; 
	int A[262144] = {}; 
	int INF = 1145141919; 
	multiset<int> S[18]; 
	for(int i = 0; i < (1 << N); i++) cin >> A[i]; 
	sort(A, A + (1 << N), greater<int>()); 	
	for(int i = 0; i < N; i++){
		S[i].insert(A[0]); S[i].insert(INF); 
	}
	for(int i = 1; i < (1 << N); i++){
		bool ok = false; 
		for(int j = N-1; j >= 0; j--){
			auto t = S[j].upper_bound(A[i]); 
			if(*t != INF){
				S[j].erase(t); 
				for(int k = 0; k < j; k++){
					S[k].insert(A[i]); 
				}
				ok = true; 
				break; 
			}
		}
		if(!ok){
			cout << "No" << endl; return 0; 
		}
	}
	cout << "Yes" << endl; 
}

Measured memory_bytes: 7424
//BISMILLAH
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int i=0,j,temp=5,a,b,n,x,flag=0,even,odd;
    while(temp--)
    {
        i++;
        cin>>x;
        if(x==0)
        {
            flag=i;

        }

    }
    cout<<flag<<endl;


}


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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

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

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }


struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


int main() {
    i64 N; cin >> N;
    vector<i64> A(N);
    REP(i, N) cin >> A[i];
    sort(A.rbegin(), A.rend());

    i64 a = A[0];
    i64 minv = 1152921504606846976;
    i64 b;
    for (i64 i = 1; i < N; i++) {
        i64 c = A[i];
        if (c > a - A[i]) {
            c = a - A[i];
        }
        if (chmin(minv, a - c)) {
            b = A[i];
        }
    }
    cout << a << " " << b << endl;
    return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

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

    ll N;
    cin >> N;
    vector<ll> A(N);
    REP(i, N) cin >> A[i];
    ll res = 0;
    ll tmp = (1ll << 60);
    ll mi = 0;
    ll ze = 0;
    REP(i, N){
    	res += abs(A[i]);
    	tmp = min(tmp, abs(A[i]));
    	if(A[i] < 0) mi++;
    	if(A[i] == 0) ze++;
    }
    //dump(tmp)
    //dump(mi)
    if(mi == 0){
    	cout << res << endl;
    }else if(ze > 0){
    	cout << res << endl;
    }else{
    	if(mi%2 == 0){
    		cout << res << endl;
    	}else{
    		cout << res - 2*tmp << endl;
    	}
    }
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long A;
  string b;
  cin>>A>>b;
  long long B=(b.at(0)-'0')*100+(b.at(2)-'0')*10+(b.at(3)-'0');
  cout<<A*B/100<<endl;
}

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

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

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define MP make_pair
#define sz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)
#define nl "\n"
typedef pair<int, int> pii;
typedef vector <int> vi;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

const int inf = (1LL << 60), mod = 1e9+7, nn = 2e5+5;

void solve(){
    int n, k;
    cin >> n >> k;
    int p[n];
    fr(i, 0, n) cin >> p[i];
    double e[n], ans = 0, temp = 0;
    fr(i, 0, n){
        double c = (p[i] * (p[i]+1))/2;
        c = 1.0 * c/p[i];
        e[i] = c;
    }

    fr(i, 0, k) temp += e[i];
    ans = temp;
    fr(i, k, n){
        temp = temp + e[i] - e[i-k];
        ans = max(ans, temp);
    }
    cout << fixed << setprecision(10) << ans;
}

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int T = 1;
    // cin >> T;
    for(int tc = 1; tc <= T; tc++){
        // cout << "Case #" << tc << ": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3456
#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(){
	int a,b; cin>>a>>b;
	int s = a+b;
	if(s%2==1){
		cout << "IMPOSSIBLE" << endl;
	}else{
		cout << s/2 << endl;
	}
}

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


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

#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll MOD = 1000000007;
const long long INF = 1LL << 60;
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

signed main()
{   
    gearup;
    int a,b; cin >> a >> b;
    if(a <= 9 && b <= 9)cout << a*b << endl;
    else cout << -1 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m,i,j,d[1000],c[1000],t[1000][1000]={0};
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%d",&d[i]);
  for(i=0;i<m;i++)scanf("%d",&c[i]);
  for(i=0;i<m;i++){
    for(j=0;j<=i&&j<=n;j++){
      if(t[i+1][j  ]==0||t[i+1][j  ]>t[i][j])t[i+1][j]=t[i][j];
      //printf("%d %d %d\n",i,j,t[i][j]+d[j]*c[i]);
      if(t[i+1][j+1]==0||t[i+1][j+1]>t[i][j]+d[j]*c[i])
	                 t[i+1][j+1]=t[i][j]+d[j]*c[i];
    }
  }
  //for(i=0;i<n;i++)printf("%d ",d[i]);printf("\n");
  //for(i=0;i<m;i++)printf("%d ",c[i]);printf("\n"); 
  /*for(i=0;i<=m;i++){
    for(j=0;j<=n;j++)printf("%4d ",t[i][j]);
    printf("\n");
    }//*/
  printf("%d\n",t[m][n]);
  return 0;
}

Measured memory_bytes: 4516
#include <iostream>
#include <vector>
#include <stdio.h>
#include <math.h>
#include <cstdio>
#include <string>
#include <algorithm>

//コンパイラ最適化
#pragma GCC optimize("Ofast")

//マクロ
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
//FORAは範囲for文(使いにくかったら消す)
#define REP(i, n) for (ll i = 0; i < ll(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= ll(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= ll(b); i--)
#define FORA(i, I) for (const auto &i : I)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(), x.end()
#define SIZE(x) ll(x.size())
//定数
#define INF 1000000000000 //10^12:∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange
//略記
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
#define F first      //pairの一つ目の要素
#define S second     //pairの二つ目の要素

typedef long long ll;

using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }
    int ans = *max_element(A.begin(), A.end()) - *min_element(A.begin(), A.end());
    cout << ans;
    return 0;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  sort(h.begin(), h.end());
  int min_d = 1e9 + 7;
  for (int i = 0; i + k - 1 < n; ++i) {
    int h_max = -1;
    int h_min = 1e9 + 7;
    rep(j, k) {
      h_max = max(h_max, h[i+j]);
      h_min = min(h_min, h[i+j]);
    }
    min_d = min(min_d, h_max - h_min);
  }
  cout << min_d << endl;
  return 0;
}

Measured memory_bytes: 3788
// 2020-07-17 03:38:11
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
struct mint {
  ll divisor = 1000000007;
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % divisor) {
    if (val < 0) val += divisor;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = divisor, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += divisor;
    u %= divisor;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= divisor) val -= divisor;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += divisor;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % divisor;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % divisor;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
  friend std::string debug_s (mint a) noexcept {
    return std::to_string(a.val);
  }
};

void answer() {
  string s;
  cin >> s;
  int sz = s.size();
  vector<mint> dp(2);
  dp[0] = 1;
  rep(i, sz) {
    vector<mint> p(2);
    swap(p, dp);
    int d = s[i]-'0';
    rep(smaller, 2) rep(x, 2) {
      if(!smaller && d < x) continue;
      dp[smaller || x < d] += p[smaller] * (x + 1);
    }
  }
  cout << dp[0] + dp[1] << '\n';
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 3772
q=int(input())
p=10**5+9 
isp=[1]*p 
i=2 
while i*i<=p: 
    if isp[i]:
        for j in range(i*i,p,i):
            isp[j]=0 
    i+=1 
isp[1]=isp[0]=0 
pre=[0]*p 

for i in range(2,p):
    if isp[i] and isp[(i+1)//2]:
        pre[i]=pre[i-1]+1 
    else:
        pre[i]=pre[i-1]
#print(pre[3])
#print(pre[7])
for i in range(q):
    a,b=map(int,input().split())
    print(pre[b]-pre[a-1])

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

int main() {
  int N;
  long long K;

  scanf("%d", &N);
  scanf("%lld", &K);

  int A[N];
  for (int i = 0; i < N; i++) scanf("%d", &A[i]);

  int F[N];
  for (int i = 0; i < N; i++) scanf("%d", &F[i]);

  sort(A, A + N);
  sort(F, F + N);
  reverse(F, F + N);

  long long left = -1, right = 1e12;
  while (left + 1 < right) {
    long long mid = (left + right) / 2;
    long long sum = 0;

    for (int i = 0; i < N; i++) {
      if ((long long)A[i] * F[i] > mid) {
        sum += A[i] - (int)((double)mid / F[i]);
      }
      if (sum > K) break;
    }

    if (sum > K)
      left = mid;
    else
      right = mid;
  }

  printf("%lld", right);
  return 0;
}


Measured memory_bytes: 1792
fun main(arg: Array<String>) {
    val (N, X) = listOfInt()
    val A = listOfLong()
    fun p(v: Int): Int = if (v >= 0) v else N+v-1
    val M = Array<Array<Long>>(N) { Array<Long>(N) { 0 }}
    for (k in 0 until N) {
        for (n in 0 until N) {
            if (k == 0) M[k][n] = A[n]
            else M[k][n] = Math.min(M[k-1][n], A[(N + n - k) % N])
        }
    }
//repeat(N) { System.err.println(M[it].joinToString()) }
    var ans = Long.MAX_VALUE
    for (k in 0 until N) {
        var min = (X.toLong() * k) + M[k].sum()
        if (min < ans) ans = min
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { it.toInt() }
fun listOfLong() = listOfString().map { it.toLong() }

Measured memory_bytes: 205732
// Problem : A - Beginner
// Contest : AtCoder Beginner Contest 156
// URL : https://atcoder.jp/contests/abc156/tasks/abc156_a
// Memory Limit : 1024.000000 MB 
// Time Limit : 2000.000000 milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define y1 y114514
#define y2 y1919810
typedef pair <int, int> PII;
#define all(x) (x.begin(),  x.end())
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define repn(i, n) for (int (i) = 1; (i) <= (int)n; (i)++)
#define rep(i, n) for (int (i) = 0; (i) < (int)n; (i)++)
#define range(i, s, t)  for (int (i) = s; (i) <= (int)t; (i)++)
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
long long qread() {
	char c = getchar();
	int neg = 1;
	long long val = 0;
	while (c != '-' && !isdigit(c)) c = getchar();
	if (c == '-') c = getchar(), neg = -1;
	while (isdigit(c)) val = (val << 3) + (val << 1) + c - '0', c = getchar();
	return neg * val;
}
int main() {
	int n = qread(), m = qread();
	if (n >= 10) {
		cout << m << endl;
		return 0;
	}
	else cout << m + 100 * (10 - n) << endl;
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++) 
#define ll long long
#define ld long double
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)  
#define outdeb(fir, sec, thr) cout << fir << ":" << sec << ":" << thr << endl

template <typename T>
void inputList(vector<T>* list, int n, int sortType = 0)
{
  repl(i, n)
  {
    T tmp;
    cin >> tmp;
    list->push_back(tmp);
  }
  if(sortType == 0)
  {
    sort(list->begin(), list->end());
  }
  else if(sortType == 1)
  {
    sort(list->begin(), list->end(), greater<T>());
  }
}

void greatFirst(ll& a, ll& b)
{
  if(a < b)
  {
    ll tmp = a;
    a = b;
    b = tmp;
  }
}

int main()
{
  int n;
  cin >> n;
  set<string> v;
  int ans = 0;
  
  rep(i,n)
  {
    string s;
    cin >> s;
    v.insert(s);
  }
  ans = (int)v.size();
  
  cout << fixed << ans << endl;
  return 0;
}

Measured memory_bytes: 19128
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <chrono>
#include <random>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define tisic 47
#define soclose 1e-8
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
using uint = unsigned int;
using cat = long long;
using dbl = long double;
constexpr dbl pi = 3.14159265358979323846;
using namespace std;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout << fixed << setprecision(10);
	string S;
	cin >> S;
	string ans;
	for(int i = 0; i < (int)S.length(); i++) ans += (S[i] == '?') ? 'D' : S[i];
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 3840
/** 
If comrades that you trust gather around you, hope can take physical form and become visible. That’s what I believe.
*/
#include <bits/stdc++.h>
using namespace std;
/**
(▀̿Ĺ̯▀̿ ̿) (ง ͠° ͟ل͜ ͡°)ง
*/
#define debug(x) cerr << #x << "  ->> " << x << endl
auto solve() -> void {
    int64_t n, x, m; cin >> n >> x >> m;
    int64_t res = x, ct = 1LL, last = x;

    vector<int64_t> so_far(m);
    deque<int64_t> seq; seq.emplace_back(x);
    so_far[x]++;
    while (ct < n) {
        ++ct;
        last = (last * last) % m;
        res += last;
        // debug(last);
        seq.emplace_back(last);
        if (so_far[last]++) {
            // found cycle
            break;
        }
        
    }
    if (ct < n) {

        // for (auto &v : seq) cerr << v << ' ';
        // cerr << '\n';
        while (seq.front() != last) seq.pop_front();
        seq.pop_front();
        // debug((int64_t) seq.size());
        auto cyc_tot = accumulate(seq.begin(), seq.end(), 0LL);
        int64_t left = n - ct;
        int64_t cyc_left = left / (int64_t) seq.size();
        res += cyc_left * cyc_tot;
        ct += cyc_left * (int64_t) seq.size();
        // debug(res);
        // debug(ct);
        int now = 0;
        while (ct < n) {
            res += seq[now++];
            ++ct;
        }
    }
    cout << res << '\n';

}
auto main() -> int {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int tc = 1;
    while (tc--) {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 4496
d = list(map(int, input().split()))
op = list(input())

for o in op:
    b = [x for x in d]
    if o == "S":
        b[0] = d[4]
        b[1] = d[0]
        b[4] = d[5]
        b[5] = d[1]
    elif o == "E":
        b[0] = d[3]
        b[2] = d[0]
        b[3] = d[5]
        b[5] = d[2]
    elif o == "W":
        b[0] = d[2]
        b[2] = d[5]
        b[3] = d[0]
        b[5] = d[3]
    elif o == "N":
        b[0] = d[1]
        b[1] = d[5]
        b[4] = d[0]
        b[5] = d[4]
    for i in range(6):
        d[i] = b[i]

print(d[0])



Measured memory_bytes: 5616
k,n = map(int,input().split())
a_list = list(map(int,input().split()))

dif_list = []

for i in range(len(a_list)):
    if i != 0:
        dif_list.append(a_list[i]-a_list[i-1])
    else:
        dif_list.append(k-a_list[-1]+a_list[0])

print(k-max(dif_list))

Measured memory_bytes: 26060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,ba=1,ma=0;
	cin>>a>>b;
	for(;;)
	{
		//cout<<ba<<" ";
		if(ba>=b)
		{
			cout<<ma;
			return 0;
		}
		ba=ba-1+a;
		ma=ma+1;
	}
} 

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll hig[100009], TK[100009], AO[100009];

bool conf[100009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    rep(i,N) cin>>TK[i];
    rep(i,N) cin>>AO[i];
    
    rep(i,N){
        hig[i]=TK[i];
        if(i==0||TK[i]>TK[i-1]){
            conf[i]=true;
        }
    }
    
    rrep(i,N-1){
        if(conf[i]){
            if(AO[i]<hig[i]){
                cout1(0);
                return 0;
            }
        }
        if(i==N-1||AO[i]>AO[i+1]){
            conf[i]=true;
            if(hig[i]<AO[i]){
                cout1(0);
                return 0;
            }
        }
        hig[i]=min(hig[i],AO[i]);
    }
    
    ll res=1;
    rep(i,N)if(!conf[i]){
        res=(res*hig[i])%MOD;
    }
    cout1(res);
}

Measured memory_bytes: 2688
#n = int(input())
d, n = map(int,input().split())
#ls = list(map(int,input().split()))
#ls = [list(map(int,input().split())) for i in range(n)]
#ls = [input() for i in range(h)]
#n = input()
if n == 100: n+= 1
print(100 ** d * n)

Measured memory_bytes: 2940
console.log((args=>{
  const tmp = args.trim().split`\n`;
  const S = tmp[0].split``.map(v=>v|0);
  const K = tmp[1]|0;
  for ( let i = 0;; i++ ) {
    if ( i+1 === K || S[i] !== 1 ) return `${S[i]}`
  }
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


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

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#include <bitset>
#include <array>
#include <deque>
#include <queue>
#include <map>
#include <set>
#define all(x) (x).begin(),(x).end()

const int MOD = 1e9 + 7;

void solve(){

}
int main(){
    int r,g;
    cin >> r >> g;

    cout << g + (g - r) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for(ll i=(ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
constexpr ll INF = 1LL<<60;

int main() {
    ll l;
    cin >> l;
    long double a = l/3.0l;
    cout << fixed << setprecision(9) << a*a*a << endl;

    return 0;
}


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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 2e5 + 10;

int n, r = 0;
int a[maxN];

int fr[maxN];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for1(i, n)
    {
        cin >> a[i];
    }
    for1(i, n)
    {
        if (a[i] == 1)
        {
            fr[a[i]] = 1;

        }
        else
        {
            if (fr[a[i] - 1])
            {
                uax(fr[a[i]], fr[a[i] - 1] + 1);
            }
        }
        uax(r, fr[a[i]]);
    }
    if (r == 0)
    {
        cout << -1;
    }
    else
    {
        cout << n - r;
    }
    return 0;
}


Measured memory_bytes: 1792
n = int(input())
r3 = 3 ** 0.5
A = (0.0, 0.0)
B = (100.0, 0.0)

def koch(n, A, B):
    if n == 0:
        return

    C1 = ((2 * A[0] + B[0]) / 3, (2 * A[1] + B[1]) / 3)
    C3 = ((A[0] + 2 * B[0]) / 3, (A[1] + 2 * B[1]) / 3)
    X, Y = C3[0] - C1[0], C3[1] - C1[1]
    C2 = (C1[0] + (X - Y * r3) / 2, C1[1] + (X * r3 + Y) / 2)

    koch(n - 1, A, C1)
    print("{:.5f} {:.5f}".format(C1[0], C1[1]))
    koch(n - 1, C1, C2)
    print("{:.5f} {:.5f}".format(C2[0], C2[1]))
    koch(n - 1, C2, C3)
    print("{:.5f} {:.5f}".format(C3[0], C3[1]))
    koch(n - 1, C3, B)

print("{:.5f} {:.5f}".format(A[0], A[1]))
koch(n, A, B)
print("{:.5f} {:.5f}".format(B[0], B[1]))

Measured memory_bytes: 7928
m,d = map(int, input().split())
count=0
for i in range(m+1):
  for k in range(d+1):
    if k < 21 :
      pass
    elif int(str(k)[1]) < 2:
      pass
    else:
      if int(str(k)[0])*int(str(k)[1]) == i:
        count += 1
print(count)

Measured memory_bytes: 3060