akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

void printNumbers(int A[], int N){
    int i;
    for( i=0; i<N; i++){
        if(i>0) printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}

void swap(int *a, int *b){
    int temp;
    temp = *a;
    
    *a =*b;
    *b = temp;
}


int selectionSort(int A[],int N){
    int i;
    int j;
    int minj;
    int count=0;
    
    for(i=0; i<N; i++){
        minj=i;
        for(j=i; j<N; j++){
            if(A[j]<A[minj]){
                minj=j;
            }
        }
        if(minj != i){
            swap(&(A[i]),&(A[minj]));
            count++;
        }
    }
    return count;
}


int main() {
    int N;
    int i;
    int count;
    int A[100];
    scanf("%d",&N);
    
    for(i=0; i<N; i++){
        scanf("%d",&A[i]);
    }
    
    count = selectionSort(A, N);
    printNumbers(A,N);
    printf("%d\n",count);
    
    return 0;
}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<n;i++)
int main(){
	while(1){
		int n,m;
		cin>>n>>m;
		if(n==0&&m==0) break;
		vector<pair<int,int>> a;
		int ans=0;
		lp(i,n){
			int b,c;
			cin>>b>>c;
			ans+=b*c;
			a.push_back(make_pair(c,b));
		}
		sort(a.begin(),a.end());
		reverse(a.begin(),a.end());
		int i=0;
		while(1){
			if(m>a[i].second){
				m-=a[i].second;
				ans-=a[i].first*a[i].second;
			}
			else{
				ans-=m*a[i].first;
				break;
			}
			if(ans==0) break;
			i++;
		}
		cout<<ans<<endl;
	}

	return 0;
}


Measured memory_bytes: 3200
#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 x;
  cin >> x;
  if (x < 1200) {
    cout << "ABC" << endl;
  } else {
    cout << "ARC" << endl;
  }
}

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll X, t;
  cin >> X >> t;
  cout << max(0LL, X - t) << endl;
  return 0;
}


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

  int N , T , A ;
  cin >> N >> T >> A ;
  vector<int> B(N) ;
  rep(i,N) cin >> B.at(i) ;
  double ans = T+B.at(0)*0.006;
  int count = 0 ;
  rep(i,N){
    if( abs( (double) A-T+B.at(i)*0.006) < abs( A-ans ) ){
      ans = T-B.at(i)*0.006 ;
      count = i ;
    }
  }
  //rep(i,N){
    //double X = A-T+B.at(i)*0.006 ;
    //cout << X << endl;
  //}
  cout << count+1 << endl;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

s = list(input())
t = list(input())
s.sort()
t.sort(reverse = True)
for i in range(len(s)):
    if i >= len(t):
        break
    if s[i] > t[i]:
        print('No')
        quit()
    elif s[i] < t[i]:
        print('Yes')
        quit()
if len(s) < len(t):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 38256
n, m, x, y = map(int, input().split())
xa = list(map(int, input().split()))
ya = list(map(int, input().split()))

xa.sort()
ya.sort()

if xa[-1] < ya[0] and (x < xa[-1] + 1 <= y or x < ya[0] <= y):
    print('No War')
else:
    print('War')


Measured memory_bytes: 3060
import random
n,m = map(int,input().split())
s = input()

#s[i:j]のハッシュ値:(hash1[j]-hash1[i]*power1[j-i]%mod1)%mod1,(hash2[j]-hash2[i]*power2[j-i]%mod2)%mod2
#長さnの文字列s
base1 = 1007
mod1 = 10**9+7

base2 = 2009
mod2 = 10**9+9

modTank1 = [3000012541,3000012553,3000012563,3000012649,3000012683,3000012709]
mod1 = modTank1[random.randint(0,5)]
modTank2 = [3000014753,3000014783,3000014833,3000014839,3000014891,3000015433]
mod2 = modTank2[random.randint(0,5)]


hash1 = [0]*(n+1)
power1 = [1]*(n+1)

hash2 = [0]*(n+1)
power2 = [1]*(n+1)


for i,e in enumerate(s):
    hash1[i+1] = (hash1[i]*base1 + ord(e))%mod1
    power1[i+1] = (power1[i]*base1)%mod1

    hash2[i+1] = (hash2[i]*base2 + ord(e))%mod2
    power2[i+1] = (power2[i]*base2)%mod2

res = 0

tank1 = set()
L = 0
R = 1
for _ in range(m):
    q = input()
    if q == 'L++':
        L += 1
    elif q == 'L--':
        L -= 1
    elif q == 'R++':
        R += 1
    else:
        R -= 1
    hashData1 = ((hash1[R]-hash1[L]*power1[R-L]%mod1)%mod1)*(10**10) + (hash2[R]-hash2[L]*power2[R-L]%mod2)%mod2

    if hashData1 in tank1:
        res += 1
    
    tank1.add(hashData1)
print(len(tank1))


Measured memory_bytes: 75924
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
constexpr ll INF = (1LL << 60);

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int res = 0;
  string t = s.substr(0, 1);
  for (int i = 0; i < n - 1; i++) {
    int j = 1;
    string cur = s.substr(i + 1, j);
    if (cur == t) {
      while (cur == t) j++, cur = s.substr(i, j);
      i += j - 1;
    }
    t = cur;
    res++;
    if (i == n - 2) res++;
  }
  cout << res << endl;
  return 0;
} 

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

using ll = long long;
using ld = long double;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define sz(v) (int)v.size()
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;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
const char EOL = '\n';

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

template<typename D> class BinarySearchR {
    D left;
    D right;
    function<bool(D)> func;

    public:
        BinarySearchR(D l, D r, function<bool(D)> f) {
            left = l;
            right = r;
            func = f;
        }

        D calc() {
            while (abs(right - left) > 1) {
                D m = (left + right) / 2;
                if (func(m)) {
                    right = m;
                } else {
                    left = m;
                }
            }
            return right;
        }
};

void solve() {
    ll n, m, v, p;
    cin >> n >> m >> v >> p;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    sort(ALL(a));

    function<bool(ll)> f = [&](int mid) {
        ll mx = a[mid] + m;
        ll r = max(0LL, ((n - p - mid) - (n - v)) * m);
        // cout << mid << "___" << n - p << "/" << n - v << EOL;
        // cout << r << EOL;
        ll x = 0;
        for (ll i = mid + 1; i < n - p + 1; i++) {
            if (mx < a[i]) return false;
            x += mx - a[i];
            // cout << i << ":" << mx << "-" << a[i] << ">>" << r << EOL;
        }
        return r <= x;
    };

    BinarySearchR<ll> bs(-1LL, n - p, f);
    // cout << bs.calc() << EOL;
    cout << n - bs.calc() << EOL;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
	while(true){
		int n, m;
		cin >> m >> n;
		if(n == 0 && m == 0){ break; }
		int iw[100];
		cin >> iw[0];
		for(int i = 1; i < n; i++){
			cin >> iw[i];
			iw[i] += iw[i - 1];
		}
		int left = 0, right = 1500000, answer = 0;
		while(left < right){
			int center = (left + right) / 2;
			bool flag = false;
			for(int i = 0, f = 0, p = 0; i < m; i++){
				for(; f < n; f++){
					if(iw[f] - p > center){ break; }
				}
				if(f == n){ flag = true; break; }
				if(f == 0 || iw[f] == p){ break; }
				p = iw[f - 1];
			}
			if(flag){
				answer = center;
				right = center;
			}else{
				left = center + 1;
			}
		}
		cout << answer << endl;
	}
	return 0;
}

Measured memory_bytes: 0
#標準偏差を求めるプログラム（Standard Deciation）
while
    inputtimes = gets.to_i do

    break if inputtimes == 0

        inputnumbers = gets.split.map(&:to_f)
        countadd = inputnumbers.
                   inject{|e,f|e+f}
               
        count2=countadd/inputtimes
    
        finalcount= inputnumbers.
                    inject(0){|sum, i| sum + (i - count2) ** 2 }
        sum =Math.sqrt(finalcount / inputtimes)
    puts sum


end
#https://en.wikipedia.org/wiki/Standard_deviation


Measured memory_bytes: 6932
#include <iostream>
#include <cstdio>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <vector>
#include <memory.h>
#include <algorithm>
#define case        printf("Case %d: ",++tc);
#define read        freopen("tst.txt","r",stdin)
#define write       freopen("out.txt","w",stdout)
typedef long long ll;
using namespace std;
#define pi acos(-1)
#ifndef mx
#define mx 100005
#endif

int ar[mx],dp[mx],n,k;

void fn(){

	for(int i = 0 ;  i<=k ; i++) {
		if(dp[i]==-1)
		for(int j = 0 ;  j<n ; j++) {
			if(ar[j]+i>k)	break;
			dp[ar[j]+i] = 1;
		}
	}

}


int main(){
int t,tc = 0;

// read;	
// write;

memset(dp, -1, sizeof dp);
scanf("%d%d",&n,&k);

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

sort(ar,ar+n);

fn();


if(dp[k]==1)	puts("First");
else puts("Second");

return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

public class Main {
//test2
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		
		long[] a = new long[n];
		
		int dirright = -1;
		int dirleft = -1;
		for(int i = 0; i < n; i++)
		{
			a[i] = sc.nextLong();
			if(a[i] == 0)k--;
			
			if(a[i] > 0)
			{
				if(dirright == -1)dirright=i;
			}
			else if(a[i] < 0)
				dirleft = i;
		}
		if(k==0)
		{
			System.out.println(0);
			return;
		}
		
//		long[] costl = new long[k+1];
//		long[] costr = new long[k+1];
		long an = 99999999999999l;
		int curcan = 0;
		
		if(dirleft != -1)
		for(int i = dirleft; i >= 0 && curcan < k; i--)
		{ //assume we go here first... then go back
			curcan++;
			long curd = -a[i];
			if(curcan < k)
			{
				curd += -a[i];
				if(dirright != -1 && dirright + (k-curcan) - 1 < n)
				{
					curd += a[dirright + (k-curcan) - 1];
					an = Math.min(an, curd);
				}
			}
			else an = Math.min(an, curd);
		}
		curcan = 0;
		
		if(dirright != -1)
		for(int i = dirright; i < n && curcan < k; i++)
		{ //assume we go here first... then go back
			curcan++;
			long curd = a[i];
			if(curcan < k)
			{
				curd += a[i];
				if(dirleft != -1 && dirleft - (k-curcan) + 1 >= 0)
				{
					curd += -a[dirleft - (k-curcan) + 1];
					an = Math.min(an, curd);
				}
			}
			else an = Math.min(an, curd);
		}
		System.out.println(an);
	}

}


Measured memory_bytes: 50740
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
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;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    cout << n / 3 << "\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
using namespace std;
 
const int maxN = 2e5+10;
int N, A[maxN];
 
int main()
{
cin >> N;
for (int i=1; i <= N; i++) cin >> A[i];
int x = N;
while (x > 0)
{
cout << A[x] << " ";
x -= 2;
}
if (x == -1) x += 3;
else x += 1;
while (x <= N)
{
cout << A[x] << " ";
x += 2;
}
}

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

char F[102][102];

void DFS(int y, int x, char a){
  if(F[y][x]!=a){
    return;
  }
  F[y][x]='.';

  DFS(y-1,x,a);
  DFS(y,x+1,a);
  DFS(y+1,x,a);
  DFS(y,x-1,a);
}

int main(){
  int n,m;
  while(1){
    cin >> n >> m;
    if(n==0&&m==0){
      break;
    }
    for(int y=1; y<=n; y++){
      for(int x=1; x<=m; x++){
        cin >> F[y][x];
      }
    }

    int cnt=0;
    for(int y=1; y<=n; y++){
      for(int x=1; x<=m; x++){
        if(F[y][x]=='#'){
          cnt++;
          DFS(y,x,'#');
        }
        if(F[y][x]=='*'){
          cnt++;
          DFS(y,x,'*');
        }
        if(F[y][x]=='@'){
          cnt++;
          DFS(y,x,'@');
        }
      }
    }
    cout << cnt << endl;
  }

  return 0;
}


Measured memory_bytes: 3376
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const H1 = parseInt(arg[0].split(" ")[0]);
    const M1 = parseInt(arg[0].split(" ")[1]);
    const H2 = parseInt(arg[0].split(" ")[2]);
    const M2 = parseInt(arg[0].split(" ")[3]);
    const K  = parseInt(arg[0].split(" ")[4]);
    
    const first = 60 - M1;
    const time1 = H2 - (H1 + 1);
    const rest = M2;
    
    let answer = first + (60 * time1) + M2 - K;
    
    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

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

int m,f,r;

int main() {
    while(cin>>m>>f>>r) {
        if(m==-1 && f==-1 && r==-1) return 0;
        if(m==-1 || f==-1) cout<<"F"<<endl;
        else if(m+f>=80) cout<<"A"<<endl;
        else if(m+f<80 && m+f>=65) cout<<"B"<<endl;
        else if((m+f<65 && m+f>=50) || (r>=50)) cout<<"C"<<endl;
        else if(m+f<50 && m+f>=30) cout<<"D"<<endl;
        else if(m+f<30) cout<<"F"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3108
#define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef vector<xy_t> polygon;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, n) for(int i = n; i >= 0; i--)

int nums[10];
int main(){
	int n;
	int type;
	while(cin >> n && n){
		memset(nums, 0, sizeof(nums));
		rep(i, n){
			cin >> type;
			nums[type]++;
		}
		rep(i, 10){
			if(nums[i] == 0) cout << '-' << endl;
			else{
				rep(j, nums[i]) cout << '*';
				cout << endl;
			}
		}
	}
	return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, k, n) for (int i = (int)(k); i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define rREP(i, k, n) for (int i = (int)(n)-1; i >= k; i--)

#define fi first
#define se second

#define vi vector<int>
#define pb push_back
#define mp make_pair

#define pcnt __builtin_popcount

typedef long long ll;

const int inf = 100100100;
const int MOD = (int) 1e9 + 7;
const double EPS = 1e-9;

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; }
int main() {
    int n,i;
    cin >> n >> i;
    cout << n-i+1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#define MAX_N 105

char field[MAX_N][MAX_N];
int H,W;
bool visited[MAX_N][MAX_N];

void DFS(int i,int j,char fruit){
	//printf("i=%d ,j=%d fruit = %c \n",i,j,fruit);
	visited[i][j] = true;
	if(j+1<W && field[i][j+1]==fruit && !visited[i][j+1])
		DFS(i,j+1,fruit);
	if(i+1<H && field[i+1][j]==fruit && !visited[i+1][j])
		DFS(i+1,j,fruit);
	if(j-1>=0 && field[i][j-1]==fruit && !visited[i][j-1])
		DFS(i,j-1,fruit);
	if(i-1>=0 && field[i-1][j]==fruit && !visited[i-1][j])
		DFS(i-1,j,fruit);
	return;
}	


int main()
{
	//freopen("in","r",stdin);
	while(~scanf("%d %d ",&H,&W) && !(H==0 && W==0) ){
		int ans=0;
		memset(visited,false,sizeof(visited));
		memset(field,0,sizeof(field));
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				scanf("%c ",&field[i][j]);
			}
		}
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(!visited[i][j]){
					//printf("f = %c\n",field[i][j]);
					DFS(i,j,field[i][j]);
					ans++;
				}
			}
		}
		printf("%d\n",ans);
		/*
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				printf("%c",field[i][j]);
			}
			puts("");
		}
		*/
	}

	return 0;
}

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

int main()
{

	int n;
	cin >> n;
	const string suffix[10]={ "pon", "pon", "hon", "bon", "hon", "hon",
		"pon", "hon", "pon", "hon", };

	cout << suffix[n%10] << endl;
}






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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  ll L, R, d;
  IN(L,R,d);

  ll ans = 0;
  for(ll i=L; i<=R; ++i){
    if(i%d==0) ans++;
  }

  OUT(ans);

  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    string s;
    cin>>s;
    int n = s.size();
    s+='d';
    string a = "dreamer", b="dream", c="eraser",d="erase";
    int sInd=0;
    while(sInd<n){
        // error(sInd);
        if(s.find(a+'d',sInd)==sInd || s.find(a+'e',sInd)==sInd) sInd+=a.size();
        else if(s.find(b+'d',sInd)==sInd || s.find(b+'e',sInd)==sInd) sInd+=b.size();
        else if(s.find(c+'d',sInd)==sInd || s.find(c+'e',sInd)==sInd) sInd+=c.size();
        else if(s.find(d+'d',sInd)==sInd || s.find(d+'e',sInd)==sInd) sInd+=d.size();
        else break;
    }
    //error(sInd);
    if(sInd==n) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 512
# import sys
# sys.stdin = open('a2.in')

n, c, k = map(int, input().split())
arrivals = [int(input()) for i in range(n)]
arrivals.sort()

res = 0
room = c
bus_start = None

for t in arrivals:

    if room == c:
        bus_start = t

    has_left_because_angry_passenger = bus_start + k < t
    if has_left_because_angry_passenger:
        res += 1
        room = c
        bus_start = t

    room -= 1

    if room == 0:
        res += 1
        room = c

if room < c:
    res += 1

print(res)


Measured memory_bytes: 7384
k,a,b = map(int,input().split())
if a+1 >= b:
    print(1+k)
else:
    if k // (a+1) == 0:
        print(1+k)
    else:
        k -= a+1
        ans = b
        if k%2 == 0:
            print(ans+k//2*(b-a))
        else:
            print(ans+k//2*(b-a)+1)


Measured memory_bytes: 2940
fun main(args: Array<String>) {
    val (H, W) = readLine()!!.split(" ").map{it.toInt()}

    val S = Array(H + 2) {
        if (it == 0 || it == H + 1) {
            String(CharArray(W + 2) {'#'} )
        } else {
            "#" + readLine()!! + "#"
        }
    }

    val h = Array(H + 2) { LongArray(W + 2) {0L} }
    val v = Array(H + 2) { LongArray(W + 2) {0L} }

    for (i in 1..H) for(j in 1..W) {
        if (S[i][j] == '.') {
            h[i][j] = h[i][j - 1] + 1
            v[i][j] = v[i - 1][j] + 1
        }
    }

    for (i in H downTo 1) for (j in W downTo 1) {
        if (S[i][j] == '.') {
            h[i][j] = Math.max(h[i][j], h[i][j + 1])
            v[i][j] = Math.max(v[i][j], v[i + 1][j])
        }
    }

    var r = 0L
    for (i in 1..H) for (j in 1..W) {
        if (S[i][j] == '.') {
            r = Math.max(r, h[i][j] + v[i][j] - 1)
        }
    }
    println(r)
}


Measured memory_bytes: 129260
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
	int N;
	string S;
	cin >> N;
	cin >> S;
	vector<int> a(N);
	for (int i = 0; i < N; i++) {
		if (S[i] == 'R') a[i] = 0;
		if (S[i] == 'G') a[i] = 1;
		if (S[i] == 'B') a[i] = 2;
	}
	vector<long long> count(3, 0);
	for (int i = 0; i < N; i++) {
		count[a[i]]++;
	}
	long long ans = count[0] * count[1] * count[2];

	//条件を満たさないもの引く
	for (int j = 0; j < N; j++) {
		for (int i = 0; i < j; i++) {
			int k = j + (j - i);
			if (k < N) {
				//判定
				if (a[i] == a[j]) continue;
				if (a[j] == a[k]) continue;
				if (a[k] == a[i]) continue;
				ans--;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3152
import std.stdio, std.conv, std.string, std.bigint;
import std.math, std.random, std.datetime;
import std.array, std.range, std.algorithm, std.container, std.format;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	long a = read.to!long;
	long b = read.to!long;
	
	long x, y;
	if(a + b < n) x = 0; else x = (a + b) - n;
	y = min(a, b);
	
	writeln(y, " ", x);
	
	
}


Measured memory_bytes: 256
import copy
height, width = map(int, input().split())
field = []
for i in range(height):
    e = list(input())
    field.append(e)

dir = ((0, 1), (1, 0), (-1, 0), (0, -1))

ans = 0

for start_y in range(height):
    for start_x in range(width):
        if field[start_y][start_x] == "#":
            pass
        else:
            new_field = copy.deepcopy(field)
            que1 = [(start_y, start_x)]
            cnt = 0
            new_field[start_y][start_x] = 0
            while True:
                que2 = []
                cnt += 1
                for y, x in que1:
                    for i, j in dir:
                        if y + i >= 0 and y + i < height and x + j >= 0 and x + j < width:
                            if new_field[y + i][x + j] == ".":
                                que2.append((y + i, x + j))
                                new_field[y + i][x + j] = cnt
                que1 = que2
                if len(que2) == 0:
                    ans = max(ans, cnt - 1)
                    break
print(ans)


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

const ll up = 1000000000000000000;

int bitCheck(ll x) {
  int ans = 0;
  while (x != 0) {
    x /= 10;
    ans++;
  }
  return ans;
}

int main() {
  int n;
  cin >> n;
  ll ans = 1;
  vector<ll> a(n);
  rep(i,n) {
    cin >> a[i];
    if (a[i] == 0) ans = 0;
  }

  if (ans == 0) {
    cout << ans << endl;
    return 0;
  }
  
  rep(i,n) {
    if (a[i] <= up / ans) {
      ans *= a[i];
    } else {
      ans = -1;
      break;
    }
  }
  cout << ans << endl; 
  return 0;
}

Measured memory_bytes: 4004
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include<cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include<iostream>
#include<set>
#include<string>
#include <vector>

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

using namespace std;

/*
1 selectionSort(A, N) // N個の要素を含む0-オリジンの配列A
2   for i が 0 から N-1 まで
3     minj = i
4     for j が i から N-1 まで
5       if A[j] < A[minj]
6         minj = j
7     A[i] と A[minj] を交換
*/

int SELECTION_SORT(int A[], int N){
	int c = 0;
	int minj, tmp;
	REP(i, N){
		minj = i;
		FOR(j, i, N){
			if (A[j] < A[minj]){
				minj = j;
			}
		}
		tmp = A[i];
		A[i] = A[minj];
		A[minj] = tmp;
		if (minj != i){
			c++;
		}
	}
	return c;
}

int main(){
	int A[100], N, k;
	scanf("%d", &N);
	REP(i, N){
		scanf(" %d", &A[i]);
	}

	k = SELECTION_SORT(A, N);

	REP(i, N - 1){
		printf("%d ", A[i]);
	}
	printf("%d\n%d\n", A[N - 1], k);


	return 0;
}




Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
string A,B;
int dp[3009][3009];
int main(){
	cin>>A>>B;
	string a=" "+A;
	string b=" "+B;
	for(int i=1;i<b.size();i++){
		for(int j=1;j<a.size();j++){
			if(a[j]==b[i]){
				dp[i][j]=dp[i-1][j-1]+1;
			}
			else dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
		}
	}
	string ans;
/*	for(int i=0;i<b.size();i++){
		for(int j=0;j<a.size();j++){
			cout<<dp[i][j]<<" ";
		}
		cout<<endl;
	}*/
	int i=b.size()-1,j=a.size()-1;
	while(dp[i][j]!=0){	
	//	cout<<i<<" "<<j<<endl;;
		if(dp[i][j]-1==dp[i-1][j-1] && dp[i][j]>dp[i-1][j] && dp[i][j]>dp[i][j-1]){
			ans+=a[j];
			i--;j--;
		//	if(dp[i][j]==0) ans+=a[j];
			continue;
		}
		int x=dp[i-1][j];
		int y=dp[i][j-1];
		if(x>y){
			i--;
		}
		else j--;
	}
	reverse(ans.begin(),ans.end());
	cout<<ans<<endl;
//	cout<<dp[i][j]<<endl;
}


Measured memory_bytes: 35584
import java.util.*;
public class Main {
    public static void main(String[] args) {
    
    Scanner sc = new Scanner(System.in);
 
      //入力
      int N =sc.nextInt();
      List<Integer>d = new ArrayList<>();
      
      //難易度list作成
      for(int i =0; i<N; i++){
      		d.add(sc.nextInt());
      }  
      //昇順に並び替え
      Collections.sort(d);
      
      //真ん中の値が存在しないとき
      if(d.get(N/2)==d.get((N/2)-1)){
        	System.out.println(0);
      }
      //listの真ん中の2つの整数の差を求める
      else {
        	System.out.println(d.get(N/2)-d.get((N/2)-1));
      }
    }
}

Measured memory_bytes: 61632
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#define rip(i,n) for(int i=0;i<n;i++)
#define ll long long
#define ld long double
#define pi 3.1415926535897932384626433832795028841971693993
#define MOD 998244353
#define sec setprecision
using namespace std;
ll gcd(ll a, ll b)
{
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
ll pow(ll x, ll n) {
	if (n == 0)
		return 1;
	else if (x == 1)return(1);
	else if (n % 2 == 0)
		return pow(x * x, (n / 2));
	else
		return x * pow(x, n - 1);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < 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;
	}
}

// 二項係数計算
long long com(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
	int n; cin >> n;
	vector<int>a(n);
	vector<int>b(n);
	rip(i, n)cin >>a[i] >>  b[i];
	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	if (n % 2 == 1) {
		int kotae = b[((n + 1) / 2) - 1] - a[((n + 1) / 2) - 1];
			cout << kotae + 1 << endl;
	}
	else {
		int bb = b[(n / 2) - 1] + b[n / 2];
		int aa = a[(n / 2) - 1] + a[n / 2];
		cout << bb - aa + 1 << endl;
	}
}


Measured memory_bytes: 4844
N = int(input())
A = list(map(int,input().split()))

l = [0,0]
cnt = {}

for a in A:
    if a in cnt:
        cnt[a] += 1
    else:
        cnt[a] = 1
    
    if cnt[a] >= 2:
        if a > l[0]:
            l[1] = l[0]
            l[0] = a
        elif cnt[a] >= 4 and a == l[0]:
            l[1] = a
        elif a < l[0] and a > l[1]:
            l[1] = a

print(l[0]*l[1])

Measured memory_bytes: 18216
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	string haiku;
	cin >> haiku;
	haiku[5] = ' ';
	haiku[13] = ' ';
	cout << haiku << endl;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}


signed main(void) {
    string s;
    cin >> s;
    if(s == "A")cout << "T" << endl;
    if(s == "C")cout << "G" << endl;
    if(s == "G")cout << "C" << endl;
    if(s == "T")cout << "A" << endl;
}


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

#define pb push_back
#define pf push_front
#define pp pop_back
#define sz(a) (int)(a.size())
#define mp make_pair
#define F first
#define S second
#define next _next
#define prev _prev
#define left _left
#define right _right
#define y1 _y1
#define all(x) x.begin(), x.end()
#define what_is(x) #x << " is " << (x)

using namespace std;

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

const int N = (int)1e6 + 123;
const ll INF = (ll)1e18 + 123;
const int inf = (int)1e9 + 123;
const int MOD = (int)1e9 + 7;

void megaRandom() {
	unsigned int FOR;
 	asm("rdtsc" : "=A"(FOR));
  srand(FOR);
}

int n, p[N];
int A[N], B[N];
int pos[N];

int main() {
	megaRandom();
	scanf("%d", &n);
	for(int i = 1; i <= n;i ++) {
		scanf("%d", &p[i]);
		pos[p[i]] = i;
	}
	A[1] = B[1] = 1;	
	for(int i = 2; i <= n; i ++) {
		int diff = pos[i] - pos[i - 1];
		assert(diff);
		if(diff > 0) {
			B[i] = B[i - 1] - 1;
			A[i] = A[i - 1] + diff + 1;
		} else {
			B[i] = B[i - 1] + diff - 1;
			A[i] = A[i - 1] + 1;
		}
	}
	int mn = inf;
	for(int i = 1; i <= n; i ++) 
		mn = min(mn, A[i]);
	if(mn <= 0) 
		for(int i = 1; i <= n; i ++)
			A[i] += abs(mn) + 1;	

	mn = inf;
	for(int i = 1; i <= n; i ++) 
		mn = min(mn, B[i]);
	if(mn <= 0) 
		for(int i = 1; i <= n; i ++)
			B[i] += abs(mn) + 1;	
	for(int i = 1; i <= n; i ++)
		cout << A[i] << ' ';
	cout << "\n";
	for(int i= 1; i <= n;i ++)
		cout << B[i] << ' ';
	return 0;  
}


Measured memory_bytes: 6784
N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print('Yes')
    exit()

for i in reversed(list(range(N-1))):
    if H[i]-H[i+1] <= 0:
        pass
    elif H[i]-H[i+1] == 1:
        H[i] -= 1
    else:
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 14396
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

typedef tuple<ll, ll, ll> T;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    n < 1200 ? cout<<"ABC" : cout<<"ARC";
    cout<<endl;
}

Measured memory_bytes: 256
<?php
$s = trim(fgets(STDIN));
$s = str_replace(array("\r\n","\r","\n"), '', $s);
$s = explode(" ", $s);

$count = $s[0];
$n = $s[1];

$ponints = array();

for ($i = 0; $i < $count; $i++) {
    $s = trim(fgets(STDIN));
    $s = str_replace(array("\r\n","\r","\n"), '', $s);
    $s = explode(" ", $s);
    $ponints[] = $s;
}


function kyori($a, $b, $n) {
    $sum = 0;
    for ($i = 0; $i < $n; $i++) {
        $sum += ($a[$i] - $b[$i]) * ($a[$i] - $b[$i]);
    }
    return sqrt((int)$sum);
}

function is_decimal($value) {
    return filter_var($value, FILTER_VALIDATE_INT) !== false;
}

$seisuu_num = 0;
for ($i = 0; $i < $count; $i++) {
    for ($j = $i + 1; $j < $count; $j++) {
        $kyori = kyori($ponints[$i], $ponints[$j], $n);
        if (is_decimal($kyori)) {
            $seisuu_num++;
        }
    }
}

echo $seisuu_num;

?>

Measured memory_bytes: 4728
#include<bits/stdc++.h>
#define ll long long
using namespace std;
char c[10]; 
inline int read()
{
	int x=0,ff=1;
	char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-') ff=-1;ch=getchar();}
	while(isdigit(ch)) {x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*ff;
}
int main()
{
	//freopen("1.in","r",stdin);
	scanf("%s",c);
	if(c[0]==c[1]&&c[1]==c[2]) puts("No");
	else                 puts("Yes");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <set>

#define ll long long
#define pll pair<ll, ll>

#define reps(i, f, n) for (int i = (f); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

const int INF = 1111111111;
const double EPS = 1e-9;

using namespace std;

const int N = 222222;
const int A = 1111111;
int n;
int a[N];

void init()
{
	cin >> n;
	rep(i, n)
	{
		cin >> a[i];
	}
}

int m[A];

void solve()
{
	sort(a, a + n);

	rep(i, n)
	{
		if (m[a[i]] != 0)
		{
			m[a[i]] = 2;
			continue;
		}

		for (int j = a[i]; j < A; j += a[i])
		{
			m[j] = max(m[j], 1);
		}
	}

	int ans = 0;

	rep(i, n)
	{
		if (m[a[i]] == 1)
		{
			ans++;
		}
	}
	cout << ans << endl;
}

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


Measured memory_bytes: 8312
R, C = map(int, input().split())

if R == 1 or C == 1:
  print(1)
  raise SystemExit

first = C // 2 if C % 2 == 0 else C // 2 + 1
second = C - first

if R % 2 == 0:
  print(C * (R // 2))
else:
  print(C * (R // 2) + first)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    string s, t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    if (s < t)
        cout << "Yes"
             << "\n";
    else
        cout << "No"
             << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>

using namespace std;  //このネームスペースを使う

int main(){
  string b;
  cin >> b;
  

  if(b=="A"){
  	cout << "T" << endl;
  }
  else if(b=="T"){
  	cout << "A" << endl;
  }
  else if(b=="C"){
  	cout << "G" << endl;
  }
  else{
  	cout << "C" << endl;
  }

  return 0;
}



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


int main() {

    int n;

    cin>>n;
    vector<int>v(n);

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

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

    int pos,sum,ans;
    ans = 1000000000;
    pos = v[0];

    while(pos<=v[n-1]){

        sum = 0;
        for(int j=0;j<n;j++){
            sum += (v[j]-pos)*(v[j]-pos);
        }
        if(sum<ans){
            ans = sum;
        }
        pos++;
    }

    cout<<ans<<endl;



    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;

public class Main{
	static long[] fact;
	static long[] inv;
	static long mod=1000000007;
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();
		String s=sc.next();
		fact=new long[s.length()+k+1];
		fact[0]=1;
		fact[1]=1;
		for(int i=2; i<=s.length()+k; i++){
			fact[i]=(fact[i-1]*i)%mod;
		}
		inv=new long[s.length()+k+1];
		inv[s.length()+k]=pow(fact[s.length()+k],mod-2);
		for(int i=s.length()+k-1; i>=0; i--){
			inv[i]=(inv[i+1]*(i+1))%mod;
		}
		long ans=0;
		for(int i=0; i<=k; i++){
			ans=(ans+(((pow(26,k-i)*pow(25,i))%mod)*comb(s.length()+i-1,i)%mod))%mod;
		}
		System.out.println(ans);
	}
	static long comb(int t,int y){
		long re=1;
		re*=fact[t];
		re*=inv[y];
		re%=mod;
		re*=inv[t-y];
		return re%mod;
	}
	
	static long pow(long p,long q){
		long res=1;
		while(q>0){
			if((q & 1)==1){
				res*=p;
				res%=mod;
			}
			q>>=1;
			p*=p;
			p%=mod;
		}
		return res;
	}
}


Measured memory_bytes: 75332
#include <bits/stdc++.h>
using namespace std;
#define rapido ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long

int32_t main()
{
    rapido;
  int n;cin>>n;
  vector<int>arr(n);
 
  int x=0;
  for(int i=0;i<n;i++)
  {
      cin>>arr[i];
      x=x^arr[i];
  }
 for(int i=0;i<n;i++)
 {
     int ans=x^arr[i];
     cout<<ans<<" ";
 }
 cout<<endl;
    
  
}


Measured memory_bytes: 4784
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stdlib.h>
#include<vector>
#include<stack>
#include<bitset>
#include<set>
#define maxn 300005
using namespace std;
typedef long long ll;
int n;
char s[maxn];
int cnt[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%s",s);
		if(strcmp(s,"AC")==0)
		{
			cnt[1]++;
		}
		if(strcmp(s,"WA")==0)
		{
			cnt[2]++;
		}
		if(strcmp(s,"TLE")==0)
		{
			cnt[3]++;
		}
		if(strcmp(s,"RE")==0)
		{
			cnt[4]++;
		}
	}
	printf("AC x %d\n",cnt[1]);
	printf("WA x %d\n",cnt[2]);
	printf("TLE x %d\n",cnt[3]);
	printf("RE x %d\n",cnt[4]);
}


Measured memory_bytes: 3836
N=int(input())
if N==1:
    print(0)
elif N==2:
    print(2)
else:
    b,c=1,1
    for _ in range(N):
        b*=9
        c*=8
        if b>=(10**9+7):
            b%=(10**9+7)
        if c>=(10**9+7):
            c%=(10**9+7)
        

    #print(10**N - 2*(9**N) + 8**N)
    print((10**N - 2*b + c)%(10**9+7))

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

int perm(int n){
  if(n==0){
    return 1;
  }else{
    return n*perm(n-1);
  }
}


int main(){
  int N;
  cin>>N;
  vector<int> P(N),Q(N);
  for(int i=0;i<N;i++){
    cin>>P.at(i);
  }
  for(int i=0;i<N;i++){
    cin>>Q.at(i);
  }
  int a,b;
  
  set<int> A,B;
  for(int i=0;i<N;i++){
    A.insert(i+1);
    B.insert(i+1);
  }
  
  int sum1=0;
  int sum2=0;
  for(int i=0;i<N;i++){
    int count1=0;
    int count2=0;
    for(int n:A){
      if(n<P.at(i)){
        count1++;
      }
    }
    for(int n:B){
      if(n<Q.at(i)){
        count2++;
      }
    }
    sum1+=count1*perm(N-1-i);
    sum2+=count2*perm(N-1-i);
    A.erase(P.at(i));
    B.erase(Q.at(i));
  }
  if(sum1-sum2>0){
    cout<<sum1-sum2<<endl;
  }else{
    cout<<sum2-sum1<<endl;
  }
}
  

  
      

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long X;
  scanf("%lld", &X);
  X = abs(X);
  long long K;
  scanf("%lld", &K);
  long long D;
  scanf("%lld", &D);

  if (X / D > K)
    cout << X - D * K << endl;
  else
  {
    K -= X / D;
    X -= X / D * D;
    if (K % 2 == 0)
      cout << X << endl;
    else
      cout << abs(X - D) << endl;
  }

  return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a * b / gcd(a, b);}

ll pow_kai(ll a, ll n) {
    ll x = 1;
    while(n > 0) {
        if(n&1) {
            x = x*a;
        }
        a = a*a;
        n >>= 1;
    }
    return x;
}

int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i,n) {
        cin >> A[i];
    }
    bool h = true;
    rep(i,n) {
        if (A[i]%2 == 0) {
            if (A[i]%3 != 0 && A[i]%5 != 0) {
                h = false;
            }
        }
    }
    if (h==false) {
        cout << "DENIED" << "\n";
    } else {
        cout << "APPROVED" << "\n";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 using namespace std;
 
 // #define  int           long long
 #define pb                push_back
 #define ppb               pop_back
 #define pf                push_front
 #define ppf               pop_front
 #define all(x)            (x).begin(),(x).end()
 #define uniq(v)           (v).erase(unique(all(v)),(v).end())
 #define sz(x)             (int)((x).size())
 #define fr                first
 #define sc                second
 #define pint              pair<int,int>
 #define rep(i,a,b)        for(int i=a;i<b;i++)
 #define mem1(a)           memset(a,-1,sizeof(a))
 #define mem0(a)           memset(a,0,sizeof(a))
 #define ppc               __builtin_popcount
 #define ppcll             __builtin_popcountll
 #define vint			   vector<int>
 #define vpint			   vector<pair<int,int>>
 #define mp                make_pair


 void reader() 
 { 
 #ifndef ONLINE_JUDGE 
 freopen("input.txt","r",stdin);
 freopen("output.txt","w",stdout); 
 #endif
 }
 
 void fastIO() {ios_base::sync_with_stdio(false); cin.tie(NULL);}
 
 
 
 void solve()
 {
 int n;
 cin>>n;
 n-=400;
int i=n/200;
cout<<8-i;
 
 
 
 cout<<"\n";
 }
 
 
 
 signed main()
 {
 	reader(); fastIO();
 	long long t=1;
 	//cin>>t;
 	while(t--) solve();
 	return 0;
 }

Measured memory_bytes: 3664