akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int main(void){
    int a,b; cin>>a>>b;
    if(2*b-1<=a){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    
}


Measured memory_bytes: 3624
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include <iomanip>
#include<map>
#include<limits>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int memo[100010];

int main()
{
	int n;cin>>n;
	
	vector<int> v;
	REP(i,n)
	{
		int a;cin>>a;
		memo[a]++;
	}
	
	int a=0,b=0;
	REP(i,100001)
	{
		if(memo[i] > 0)
		{
			a++;
			if(memo[i] > 1 && memo[i] % 2 == 0)
			{
				b++;
			}
		}
	}
	
	if(b % 2 == 1)a--;
	
	cout << a << endl;
	
	
	return 0;
}

Measured memory_bytes: 640
#pragma GCC optimize ("-O3")
#include <bits/stdc++.h>  
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
#define forn(i,e) for(ll i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(ll i = s; i >= 0; i--)
#define rforsn(i,s,e) for(ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 1e18
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
 
ll mpow(ll a, ll b){
	if(b >= (MOD-1)) b %= (MOD-1);
	if(b==0) return 1;
	ll t1 = mpow(a,b/2);
	t1 *= t1;
	t1 %= MOD;
	if(b%2) t1 *= a;
	t1 %= MOD;
	return t1;
}
 
ll mpow(ll a, ll b, ll p){
	if(b==0) return 1;
	ll t1 = mpow(a,b/2,p);
	t1 *= t1;
	t1 %= p;
	if(b%2) t1 *= a;
	t1 %= p;
	return t1;
}
 
ll modinverse(ll a, ll m){
	ll m0 = m; 
    ll y = 0, x = 1; 
    if (m == 1) return 0; 
    while (a > 1){
        ll q = a / m; 
        ll t = m; 
        m = a % m, a = t; 
        t = y; 
        y = x - q * y; 
        x = t; 
    }
    if (x < 0) x += m0; 
    return x; 
}
 
ll range(ll l, ll r){
	return l + rand()%(r-l+1);
}
 
ll rev(ll v){
	return mpow(v,MOD-2);
}
 
void solve(){
	ll n,a,b;
	cin >> n >> a >> b;
	if(abs(a-b)%2){
		cout << min((a+b-1)/2,(2*n-a-b+1)/2) << ln;
	}
	else cout << abs(a-b)/2 << ln;
}
 
int main()
{
	fast_cin();
    ll t=1;
    // cin>>t;
    forn(i,t) {
    	// cout << "Case #" << i+1 << ": ";
    	solve();
    }
    return 0;
}

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

int gcd(int a, int b) { return (b == 0) ? a : gcd(b, a % b); }

#define CIN(T, x) T x; cin >> x;
#define CINS(T, x, N) vector<T> x(N); for(int i = 0; i < (N); i++) { cin >> x[i]; }
#define SHOW(x) for(int i = 0; i < x.size(); i++) { cout << x[i] << " "; } cout << "\n";
#define SHOW2(x) for(int j = 0; j < x.size(); j++) { SHOW(x[j]); } cout << "\n";


int main() {

    CIN(int, N);
    CINS(ll, A, N);

    ll sum = 0;
    for (int i = 0; i < N; i++) {
        sum += A[i];
    }

    ll temp = 0;
    for (int i = 0; i < N / 2; i++) {
        temp += 2 * A[2 * i];
    }

    vector<ll> X(N);
    int indexX = N - 1;
    int indexS = 0;
    int indexE = N - 1;

    for (int i = 0; i < N; i++) {
        X[indexX] = sum - temp;

        temp = temp - 2 * A[indexS] + 2 * A[indexE];

        indexX = (indexX + 2) % N;
        indexE = (indexE + 2) % N;
        indexS = (indexS + 2) % N;
    }

    for (int i = 0; i < N - 1; i++) {
        cout << X[i] << " ";
    }

    cout << X[N-1] << "\n";
    return 0;
}

Measured memory_bytes: 2944
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String... args) throws IOException {
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final StringBuilder sb = new StringBuilder();
        while (true) {
            final String line = br.readLine();
            final int index = line.indexOf(" ");
            final int x = Integer.parseInt(line.substring(0, index));
            final int y = Integer.parseInt(line.substring(index+1, line.length()));
            if (x == 0 && y == 0) break;
            sb.append(x < y ? x + " " + y : y + " " + x).append("\n");
        }
        System.out.print(sb);
    }
}

Measured memory_bytes: 22776
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

int main(){
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    vector<ll> a(N,0);
    for(ll i=0;i<N;i++){
        cin>>a[i]
    ;}

    //dp[i]は残りi個でどっちが勝つか　先手:1 後手:2
    vector<ll> dp(K+1,0);
    dp[0]=2;
    for(ll i=1;i<=K;i++){
        bool Twin=0;
     for(ll j=0;j<N;j++){
         if(i-a[j]>=0&&dp[i-a[j]]==2){Twin=1;break;}
     ;}
        if(Twin){dp[i]=1;}
        else dp[i]=2;
    ;}
    if(dp[K]==1)cout<<"First"<<endl;else
    cout<<"Second"<<endl;


    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll w[205];
ll v[205];
ll x[20000005];
ll dp[105][100005];
typedef pair<int, int> P;

ll u(ll h) {
	ll count = 0;
	while (h) {
		h = h / 2;
		count++;
	}
	count--;
	return count;

}


int main() {
	ll h,ans,sum=0;
	cin >> h;
	ans = u(h);
	ll j=1;
	
	for (int i = 0; i <= ans; i++) {
		sum += j;
		j *= 2;
	}
	cout << sum << endl;
	return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;

int n, m;
vector<int> edges[51];
int visited[51] = {};
int visit_cnt = 0;

bool all_visited(){
    FOR(i, 1, n)if(!visited[i]) return false;
    return true;
}

void dfs(int i, int end, int start){
    visited[i] = true;
    visit_cnt++;
    if(all_visited()) return;
    if(visit_cnt > 100) return;
    for(auto e : edges[i]){
        if(i == start && e == end) continue;
        if(visited[e]) continue;
        dfs(e, end, start);
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<pair<int, int>> ev;
    cin >> n >> m;
    REP(i, m){
        int a, b;
        cin >> a >> b;
        ev.push_back(make_pair(a, b));
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    int ans = 0;
    for(auto e : ev){
        fill_n(visited, 51, false);
        visit_cnt = 0;
        dfs(e.first, e.second, e.first);
        if(!visited[e.second]) ans++;
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;
 
alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");
 
T lread(T = long)()
{
    return readln.chomp.to!T();
}
 
T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}
 
void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void main()
{
    auto r = lread();
    if(r < 1200)
    {
        writeln("ABC");
    }
    else if(r < 2800)
    {
        writeln("ARC");
    }
    else
    {
        writeln("AGC"); 
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using uint = unsigned int;
template <typename T>
using Graph = vector<vector<T>>;
const int MOD = 998244353;
const ld PI = acosl(-1);

inline pii func(string &s) {
    pii res = {0, 0};
    int N = s.length();

    stack<char> stk;
    for (int i = 0; i < N; ++i) {
        if (!stk.empty() && stk.top() == '(' && s[i] == ')') {
            stk.pop();
            res.first--;
            continue;
        }
        (s[i] == '(' ? res.first : res.second)++;
        stk.push(s[i]);
    }
    return res;
}

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

    int N;
    cin >> N;
    vector<pii> cnt(N);
    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;
        cnt[i] = func(s);
    }

    auto cmp = [](pii &a, pii &b) {
        int atmp = a.first - a.second;
        int btmp = b.first - b.second;
        if (atmp * btmp >= 0) {
            if (atmp >= 0)
                return a.second < b.second;
            else
                return a.first > b.first;
        } else
            return atmp > btmp;
    };

    sort(cnt.begin(), cnt.end(), cmp);
    bool isok = true;
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        if (sum < cnt[i].second) {
            isok = false;
            break;
        }
        sum += cnt[i].first - cnt[i].second;
    }
    if (sum != 0)
        isok = false;

    cout << (isok ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 11120
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int W,H;//長方形の幅W,高さH
	int x,y,r;//円の(x,y)座標,半径r

	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	//x=abs(x);
	//y=abs(y);
	if(((x+r)>W || (x-r)<0) || ((y+r)>H || (y-r)<0)){//長方形と円の条件式
		printf("No\n");//はみ出た
	}else{
		printf("Yes\n");//収まっている
	}
	return 0;
}


Measured memory_bytes: 2112
#include<stdio.h>
int main() {
    int n;
    scanf("%d", &n);
    long long ans = 0;
    for (int i = 0; i <= n; i++)
    {
        if (i % 3 != 0 && i % 5 != 0)
        {
            ans = ans + i;
        }

    }
    printf("%lld\n", ans);
    return 0;

}

Measured memory_bytes: 1716
N = int(input())
L = {}
for i in range (N):
	a = input()
	if a in L :
		L[a] += 1
	else :
		L[a] = 1
M = int(input())
for i in range (M):
	a = input()
	if a in L and L[a] > 0:
		L[a] -= 1
	else :
		pass
maximum = 0
for i in L :
	if L[i] > maximum :
		maximum = L[i]
	else :
		pass
print (maximum)

Measured memory_bytes: 3064
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner num = new Scanner(System.in);
        while(true) {
            int n = num.nextInt();
            int m = num.nextInt();
            if (n == 0 && m == 0) break;
            for(int i = 1; i <= n; i++){
                for(int j = 1; j <= m; j++){
                    if(i == 1 || j == 1 || i == n || j == m ){
                        System.out.print("#");
                    }
                    else {
                        System.out.print(".");
                    }
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
        }
    }
}


Measured memory_bytes: 36660
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	"strings"
)

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	index := make(map[string]string)
	keys := []string{}
	for stdin.Scan() {
		l := strings.Split(stdin.Text(), " ")
		if l[0] == "0" {
			break
		}
		if index[l[0]] == "" {
			keys = append(keys, l[0])
		}
		index[l[0]] += l[1] + " "
	}
	sort.Strings(keys)
	for _, k := range keys {
		fmt.Println(k)
		p := strings.Split(strings.TrimRight(index[k], " "), " ")
		pages := []int{}
		for _, v := range p {
			i, _ := strconv.Atoi(v)
			pages = append(pages, i)
		}
		sort.Ints(pages)
		for i, v := range pages {
			if i > 0 {
				fmt.Printf(" ")
			}
			fmt.Printf("%d", v)
		}
		fmt.Println()
	}
}



Measured memory_bytes: 1160
#include "bits/stdc++.h"

using namespace std;
using ll = long long int;

template<typename It>
vector<int> Solve(int k, int c, It it)
{
	vector<int> result;

	int day = 0;
	for (int i = 0; i < k; i++)
	{
		while (*it == 'x')
		{
			it++;
			day++;
		}

		result.push_back(day);
		if (i + 1 < k)
			it += c + 1;
		day += c + 1;
	}

	return result;
}

int main()
{
	int n, k, c;
	cin >> n >> k >> c;
	string s;
	cin >> s;

	auto first = Solve(k, c, s.begin());
	auto last = Solve(k, c, s.rbegin());
	for (size_t i = 0; i < last.size(); i++)
	{
		last[i] = n - last[i] - 1;
	}
	reverse(last.begin(), last.end());

	for (size_t i = 0; i < first.size(); i++)
	{
		if (first[i] == last[i])
		{
			cout << (first[i] + 1) << endl;
		}
	}
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

const int MOD = 1000000007;

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

    ll maxnum = a * c;
    if(a * d > maxnum) maxnum = a * d;
    if(b * c > maxnum) maxnum = b * c;
    if(b * d > maxnum) maxnum = b * d;

    cout << maxnum << endl;
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
typedef long long  ll;

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
int main()
{
	char s[100001]; cin >> s;
	int i = 0;
	while (s[i]) {
		if (i % 2 == 0) cout << s[i];
		i++;
	}
	cout << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	string ss, tt;
	int64 ans = 10000, tmp;
	cin >> ss >> tt;
	for(int64 ii = 0;ii <= ss.length() - tt.length();ii++)
	{
		tmp = 0;
		for(int64 jj = 0;jj < tt.length();jj++)
		{
			if(ss[ii + jj] == tt[jj])
			{
				continue;
			}
			else
			{
				tmp++;
			}
		}
		ans = min(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}

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

int main(){

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

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

	for (int i = 1; i < n; ++i) {
		arr[i][0] += max(arr[i-1][1], arr[i-1][2]);
		arr[i][1] += max(arr[i-1][0], arr[i-1][2]);
		arr[i][2] += max(arr[i-1][1], arr[i-1][0]);
	}

	printf("%lld\n", max(max(arr[n-1][0], arr[n-1][1]), arr[n-1][2]));

	return 0;
}

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

int main() {

	string s;

	cin >> s;

	int counter = 0;

	if (s[0] == 'o') {
		++counter;
	}
	if (s[1] == 'o') {
		++counter;
	}
	if (s[2] == 'o') {
		++counter;
	}

	cout << 700 + (counter * 100) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main() {
    string s1, s2;
    cin >> s1 >> s2;
    string s3 = s2.substr(0, s2.size() - 1);
    if (s3 == s1) {
        cout << "Yes\n";
    }
    else cout << "No\n";
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

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

int main(){
    string s;
    cin >> s;
    sort(s.begin(),s.end());
    if(s.size()%2==1){
        cout << "No" << endl;
        return 0;
    }
    bool flg=true;
    for(int i=0;i<s.size()-1;i+=2){
        if(s[i]!=s[i+1]) flg=false;
    }
    puts(flg?"Yes":"No");
}

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

int gcd(int x, int y);

const int INF = 1001001001;

/*struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }*/


int main() {
    int n, a, b;
    cin >> n >> a >> b;
    ll ans = 0;

    for (int i = 1; i <= n; i++) {
        int num = i / 10000 + (i / 1000) % 10 + ((i / 100) % 10) + ((i / 10) % 10) + (i % 10);
        if (a <= num && b >= num)
            ans += i;
    }
    cout << ans << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
int gcd(int x, int y) {
    int num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

Measured memory_bytes: 256
n=int(input())
a=[]
for i in range(2):
  a.append(list(map(int,input().split())))
dp=[[0]*(n) for _ in range(2)]
dp[0][0]=a[0][0]
dp[1][0]=a[1][0]+a[0][0]
for i in range(1,n):
  dp[0][i]=a[0][i]+dp[0][i-1]
  dp[1][i]=a[1][i]+max(dp[1][i-1],dp[0][i])
print(dp[1][n-1])

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	char a[n],b[n];
	cin>>a>>b;
	int i,j=0,z=0;
	for(i=0;i<2*n;i++){
		if(i%2==0)
			cout<<a[j++];
		else
			cout<<b[z++];
	}
} 

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
t = list(input())

"""
if t[0] == '?' and len(t) == 1:
    print('D')
    exit()

if len(set(t)) <= 2 and not 'P' in t:
    ans = ''
    for i in range(len(t)):
        ans += 'D'
    print(ans)
    exit()

if t[0] == '?' and t[1] == 'D':
    t[0] = 'P'
if t[0] == '?' and t[1] == 'P':
    t[0] = 'D'
if t[0] == '?' and t[1] == '?':
    t[0] = 'P'
if t[-1] == '?':
    t[-1] = 'D'
for i in range(len(t) - 1):
    if t[i] == 'P' and t[i+1] == '?':
        #print('A')
        t[i+1] = 'D'
    elif t[i] == 'D' and t[i+1] == '?':
        #print('B')
        t[i+1] = 'P'
print(''.join(t))
"""
ans = ''
for i in t:
    if i == '?' or i == 'D':
        ans += 'D'
    if i == 'P':
        ans += 'P'
print(ans)

Measured memory_bytes: 10920
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(int argc, char **argv)
{
	int N, K;
	scanf("%d %d", &N, &K);
	int R, S, P;
	scanf("%d %d %d", &R, &S, &P);
	static char T[100001];
	scanf("%s", T);
	int P0, P1, P2;
	char c0, c1, c2;
	P0 = R; c0 = 's';
	P1 = S; c1 = 'p';
	P2 = P; c2 = 'r';
	// sort
#if 0
	if (R >= S) {
		if (R >= P) {
			P0 = R;
			c0 = 's';
			if (S >= P) {
				P1 = S;
				P2 = P;
				c1 = 'p';
				c2 = 'r';
			} else {
				P1 = P;
				P2 = S;
				c1 = 'r';
				c2 = 'p';
			}
		} else {
			P0 = P;
			P1 = R;
			P2 = S;
			c0 = 's';
			c1 = 'p';
			c2 = 'r';
		}
	} else {
		if (S >= P) {
			P0 = S;
			c0 = 'r';
			if (R >= P) {
				P1 = R;
				P2 = P;
				c1 = 'p';
				c2 = 's';
			} else {
				P1 = P;
				P2 = R;
				c1 = 's';
				c2 = 'p';
			}
		} else {
			P0 = P;
			P1 = S;
			P2 = R;
			c0 = 's';
			c1 = 'r';
			c2 = 'p';
		}
	}
	fprintf(stderr, "%d %c %d %c %d %c\n", P0, c0, P1, c1, P2, c2);
#endif

	static int hands[100001];
	uint64_t score = 0;
	for (int i = 0; i < N; i++) {
		if (T[i] == c0) {
			if (i >= K) {
				if (hands[i - K] == c0)
					continue;
			}
			score += P0;
			hands[i] = c0;
		}
	}
	for (int i = 0; i < N; i++) {
		if (T[i] == c1) {
			if (i >= K) {
				if (hands[i - K] == c1)
					continue;
			}
			score += P1;
			hands[i] = c1;
		}
	}
	for (int i = 0; i < N; i++) {
		if (T[i] == c2) {
			if (i >= K) {
				if (hands[i - K] == c2)
					continue;
			}
			score += P2;
			hands[i] = c2;
		}
	}
	for (int i = 0; i < N; i++) {
		fprintf(stderr, "%c", hands[i] ? hands[i] : '*');
	}
	fprintf(stderr, "\n");
	printf("%ld\n", score);
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    int H[N];
    for (int i = 0; i < N; i++)
    {
        cin >> H[i];
    }
    int ans = 0;
    int MaxHeight = -1;
    for (int i = 0; i < N; i++)
    {
        if (MaxHeight <= H[i])
        {
            ans++;
            MaxHeight = H[i];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def f(t,_t):
    h,m=[int(_t[i:i+2])-int(t[i:i+2])for i in[0,3]]
    return 60*h+m
n,t=map(int,input().split())
prv=input().split()
a=[]
for _ in [0]*(n-1):
    now=input().split()
    d=f(prv[2],now[0])
    if d>=t:
        a+=[[now[1],d]]
    prv=now
print(len(a))
for x in a:print(*x)

Measured memory_bytes: 7676
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define repd(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>; // グラフ型
using pint = pair<int, int>;

int main()
{
    int A, B;
    cin >> A >> B;
    cout << (B - 1 + (A - 2)) / (A - 1) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
#define int long long
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 5000 + 5 ; 
const int inf = 1e15 + 5 ; 
int n, A, B, p[N], dp[N][N] ; 
signed main()
{
	n = gi(), A = gi(), B = gi() ; 
	rep( i, 1, n ) p[i] = gi() ; 
	memset( dp, 63, sizeof(dp) ), dp[0][0] = 0 ; 
	rep( i, 1, n ) rep( j, 0, i - 1 ) {
		if( p[j] < p[i] ) 
			dp[i][i] = min( dp[i][i], dp[i - 1][j] ),
			dp[i][j] = dp[i - 1][j] + A ; 
		if( p[j] > p[i] ) 
			dp[i][j] = dp[i - 1][j] + B ; 
	}
	int ans = inf ; 
	rep( i, 1, n ) ans = min( ans, dp[n][i] ) ;
	cout << ans << endl ; 
	return 0 ;
}

Measured memory_bytes: 199348
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int N, M, K;
vector<int> A, B;
string S, T;

void input() {
  int x, y, z;
  cin >> N >> M >> K;
  ;
}
void solve() {
  ;
  if (N == M)
    cout << K << endl;
  else if (N == K)
    cout << M << endl;
  else
    cout << N << endl;
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	int sum = 0;
	for(int i = 0; i < n; i++) for(int j = i + 1; j < n; j++) sum += a[i] * a[j];
	cout << sum << endl;
	return 0;
}


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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9+7)
#define INF numeric_limits<int>::infinity()
#pragma endregion


int main()
{
    rep(i,4) {
        int a, b;
        cin >> a >> b;
        if(a==1) P(6000*b);
        if(a==2) P(4000*b);
        if(a==3) P(3000*b);
        if(a==4) P(2000*b);
    }
    return 0;
}

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

using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long                           //del this if TLE or MLE
#define ll long long
#define pr pair<int,int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fow(i,a,b,c) for(int i=a;i<=b;i+=c)
#define bck(i,a,b,c) for(int i=a;i>=b;i-=c)
#define F first
#define S second
#define loop int tests;cin>>tests;while(tests--)

const int mod=1e9+7;
const int N=3005;

int dp[N][N];

signed main() 
{
    fastio;
    int n;
    cin>>n;
    string s;
    cin>>s;
    dp[1][1]=1;
    fow(len,2,n,1) 
	{
        fow(i,1,n,1)
			dp[len-1][i]=(dp[len-1][i]+dp[len-1][i-1])%mod;
        fow(a,1,len,1)
		{
			int l,r;
			if(s[len-2]=='<')
				l=1,r=a-1;
			else
				l=a,r=len-1;
            if(l<=r)
				dp[len][a]=(dp[len][a]+(dp[len-1][r]-dp[len-1][l-1]+mod)%mod)%mod;
        }
    }
    int ans=0;
    fow(i,1,n,1)
		ans=(ans+dp[n][i])%mod;
    cout<<ans<<"\n";
}



Measured memory_bytes: 70656
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair < int , pair < int , int > > mp;

#define rep(i , j , n) for(long long i = j ; i <= n ; i++)
#define per(i , j , n) for(long long i = j ; i >= n ; i--)
 
const ll N = 353456;
const ll mod = 1e18 + 7;
const ld eps = 1e-6;
const ld pi = 3.1415926535;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    cout << fixed << setprecision(12);

    int n;
    cin >> n;
    
    rep(i , 1 , 9) {
        rep(j , 1 , 9) {
            if(i * j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }    

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
if __name__ == '__main__':
  n = int(input())
  p = list(map(int, input().split(" ")))
  count = 0
  for i in range(1, n - 1):
    if p[i - 1] < p[i] and p[i] < p[i+1]:
      count += 1
    elif p[i - 1] > p[i] and p[i] > p[i+1]:
      count += 1
  print(count)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <cstdint>
#include <string>
using namespace std;
using i64 = int64_t;

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

    if (p == 2 || p == 5) {
        i64 ans = 0;
        for (int i = 0; i < n; ++i) {
            char c;
            cin >> c;

            int x = c - '0';
            if (x % p == 0)
                ans += i + 1;
        }

        cout << ans << endl;
        return 0;
    }

    string s;
    cin >> s;

    vector<int> count(p);
    count[0] = 1;

    int cum = 0, dig = 1;
    i64 ans = 0;
    for (int i = n - 1; i >= 0; --i) {
        int x = s[i] - '0';

        cum = (cum + x * dig) % p;
        ans += count[cum];
        ++count[cum];

        dig = (dig * 10) % p;
    }

    cout << ans << endl;
}

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

int main() {

    int n; cin >> n;

    int oddNum = 0;
    int fourModZeroNum = 0;
    for (int i = 0; i < n; i++) {
        int a; cin >> a;
        if (a % 4 == 0) {
            fourModZeroNum++;
        }
        else if(a % 2 != 0) {
            oddNum++;
        }
    }
    if (n % 2== 0 && oddNum <= fourModZeroNum) cout << "Yes" << endl;    
    else if (n % 2 == 1 && oddNum <= fourModZeroNum + 1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int c[50010];

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

	int t = 0;
	long long ans = 0;
	for(int i = 0; i < s.size(); ++i){
		if(s[i] == '('){	++t;	}
		else{	--t;	}
		ans += c[t]++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 1508
#include <iostream>
#include <string>
using namespace std;
int main(void){
    int siz,time;
    string name;
    while(true){
        cin>>name;
        if(name[0]=='-')break;
        cin>>time;
        for(int abc=0;abc<time;abc++){
            cin>>siz;
            name=name.substr(siz)+name.substr(0,siz);
        }
        cout<<name<<endl;
    }
      
}


Measured memory_bytes: 3152
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(int i=(int)(st),i##end=(int)(ed);i<=i##end;++i)
#define DREP(i,st,ed) for(int i=(int)(st),i##end=(int)(ed);i>=i##end;--i)
template<typename T>bool chkmin(T &x,const T &y){return x>y?x=y,1:0;}
template<typename T>bool chkmax(T &x,const T &y){return x<y?x=y,1:0;}
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
template<typename T>T read(){
	T x=0,f=1;
	char c=getchar();
	while((c<'0')||(c>'9')){if(c=='-')f=-1;c=getchar();}
	while((c>='0')&&(c<='9'))x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return x*f;
}
#define read() read<int>()
template<typename T>void write(T x,char c){
	static char t[25];
	static int tlen;
	t[tlen=1]=c;
	if(x<0)putchar('-'),x=-x;
	do t[++tlen]=(x%10)^48;
	while(x/=10);
	while(tlen)putchar(t[tlen--]);
}
const int maxn=8005;
int n,m,p[2][2*maxn];
char s[maxn];
vector<int>ve[2];
bool check(const vector<int>&c,int x){
	memset(p,0,sizeof(p));
	int tmp=0;
	REP(i,0,c.size()-1)tmp+=c[i];
	p[0][tmp]=1;
	REP(i,0,c.size()-1){
		bool t=i&1;
		memset(p[t^1],0,sizeof(p[t^1]));
		REP(j,0,2*tmp)
			if(p[t][j])p[t^1][j-c[i]]=1;
		DREP(j,2*tmp,0)
			if(p[t][j])p[t^1][j+c[i]]=1;
	}return (x>=-tmp)&&(x<=tmp)&&(p[c.size()&1][tmp+x]);
}
int main(){
	int x,y,t=0,cur=0,flag=0,cnt=0;
	scanf("%s",s+1);
	n=strlen(s+1),s[++n]='T';
	REP(i,1,n){
		if(s[i]=='F'){
			if(!flag)++t;
			else ++cnt;
		}else{
			if(cnt)ve[cur].push_back(cnt);
			cur^=1,cnt=0,flag=1;
		}
	}
/*
	REP(j,0,1){
		REP(i,0,ve[j].size()-1)
			write(ve[j][i],i==iend?' ':' ');
		puts("");
	}
*/
	x=read()-t,y=read();
	if(!check(ve[0],x))puts("No");
	else if(!check(ve[1],y))puts("No");
	else puts("Yes");
	return 0;
}

Measured memory_bytes: 384
H, W = list(map(int, input().split()))

SL = []
for i in range(H):
	SL.append(list(input()))

dh = [-1, -1, -1, 0, 0, 1, 1, 1]
dw = [-1, 0, 1, -1, 1, -1, 0, 1]

for i in range(H):
	for j in range(W):
		if SL[i][j] == "#":
			pass
		elif SL[i][j] == ".":
			c = 0
			for k in range(8):
				if 0 <= i + dh[k] and i + dh[k] <= H - 1 and 0 <= j + dw[k] and j + dw[k] <= W - 1:
					if SL[i + dh[k]][j + dw[k]] == "#":
						c += 1
			SL[i][j] = str(c)
		else:
			pass

for i in range(H):
	print("".join(SL[i]))

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <stack>
#include <math.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int, int> pii;
int main(){
string s;
cin>>s;
int n=s.length();
for(int i=0;i<n;i++){
  if(i%2==0&&s[i]=='L'){//posição ímpar
    cout << "No"<<endl;
    return 0;
  }
  if(i%2==1&&s[i]=='R'){//posição ímpar
    cout << "No"<<endl;
    return 0;
  }
}

cout << "Yes"<<endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define x first
#define y second
#define MAX_N 1000
using namespace std;
typedef long long lnt;
typedef pair<int,int> pii;
template <class T> inline void read(T &x) {
	x = 0; int c = getchar(), f = 1;
	for (; !isdigit(c); c = getchar()) if (c == 45) f = -1;
	for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0');
}
int n, f;
pii p[MAX_N+5];
char s[MAX_N+5][32];
bool chk() {
	for (int i = 1; i <= n; i++)
		if (((p[i].x+p[i].y)&1) ^ f) return false;
	return true;
}
lnt dis(pii u, pii v) {return 1LL*abs(u.x-v.x)+1LL*abs(u.y-v.y);}
bool chkL(int d, pii u, pii v) {u.x -= (1<<d); return dis(u, v) < (1LL<<d);}
bool chkR(int d, pii u, pii v) {u.x += (1<<d); return dis(u, v) < (1LL<<d);}
bool chkD(int d, pii u, pii v) {u.y -= (1<<d); return dis(u, v) < (1LL<<d);}
bool chkU(int d, pii u, pii v) {u.y += (1<<d); return dis(u, v) < (1LL<<d);}
int main() {
//	freopen("in.txt", "r", stdin);
//	freopen("D.txt", "w", stdout);
	read(n);
	for (int i = 1; i <= n; i++)
		read(p[i].x), read(p[i].y);
	f = (p[1].x+p[1].y)&1;
	if (!chk()) return puts("-1"), 0;
	if (f) {
		puts("31");
		for (int i = 0; i <= 30; i++)
			printf("%d ", (1<<i));
		puts("");
	} else {
		puts("32");
		for (int i = 0; i <= 30; i++)
			printf("%d ", (1<<i));
		puts("1");
		for (int i = 1; i <= n; i++)
			p[i].x++, s[i][31] = 'L';
	}
	for (int id = 1; id <= n; id++) {
		pii c = pii(0, 0);
		for (int i = 30; ~i; i--) {
			if (chkL(i, c, p[id])) c.x -= (1<<i), s[id][i] = 'L';
			else if (chkR(i, c, p[id])) c.x += (1<<i), s[id][i] = 'R';
			else if (chkD(i, c, p[id])) c.y -= (1<<i), s[id][i] = 'D';
			else if (chkU(i, c, p[id])) c.y += (1<<i), s[id][i] = 'U';
		}
	}
	for (int i = 1; i <= n; i++, puts(""))
		for (int j = 0; j <= 30+(!f); j++) putchar(s[i][j]);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
      Stamps();
	}

	public static void Stamps() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		String str = sc.next();
		String[] stamps = new String[N];
		for (int i = 0; i < str.length(); i++) {
			stamps[i] = String.valueOf(str.charAt(i));
		}
		int marubatu = 0;
		int mark = 1;
		while (mark <= stamps.length-1) {
			if (!(stamps[mark - 1].equals(stamps[mark])))  {
				marubatu++;
				mark += 2;
			}
			else {
				mark++;
			}
		if(mark>stamps.length-1) {
			break;
		}
		}
        sc.close();
		System.out.println(marubatu);
	}
}



Measured memory_bytes: 34736
use std::io::*;

fn main() {
    let i = stdin();
    solve(&mut i.lock(), &mut stdout());
}

fn solve(i: &mut BufRead, o: &mut Write) {
    let mut c = Vec::new();
    for _ in 0..3 {
        let mut line = String::new();
        i.read_line(&mut line).unwrap();
        c.push(
            line.trim()
                .split(' ')
                .map(|x| x.parse().unwrap())
                .collect::<Vec<isize>>(),
        );
    }
    let y = (c[2][2] - c[2][0] - c[1][2] + c[1][0] == 0)
        && (c[2][2] - c[2][0] - c[1][2] + c[1][1] - c[0][1] + c[0][0] == 0)
        && (-c[2][1] + c[2][0] + c[0][1] - c[0][0] == 0)
        && (-c[2][2] + c[2][0] + c[0][2] - c[0][0] == 0);
    writeln!(o, "{}", if y { "Yes" } else { "No" }).unwrap();
}

Measured memory_bytes: 4352
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include<cmath>
using namespace std;
using ll=long long;

int main(){
    int n; cin >> n;
    ll p[n];
    int res=0; ll ans=0;
    for(int i=0;i<n;i++){
        cin >> p[i];
        ans+=abs(p[i]);
        if(p[i]<=0) res++;
    }
    if(res % 2 == 0)  cout << ans <<endl;   
    else{
       ll mii=10e10;
       for(int i=0;i<n;i++){
        mii=min(mii,abs(p[i]));
       }
      cout << ans-mii*2 <<endl;
    }
    return 0;
}

Measured memory_bytes: 1024
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
        x[i],y[i]=list(map(int,input().split()))
dic={}
if n==1:
        print(1)
        exit()
dic={}
for i in range(n):
        for j in range(n):
                if i!=j:
                        dx=x[i]-x[j]
                        dy=y[i]-y[j]
                        if (dx,dy) in list(dic.keys()):
                                dic[(dx,dy)]+=1
                        else:
                                dic[(dx,dy)]=1
print(n-max(list(dic.values())))


Measured memory_bytes: 3440
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(2e5) + 17;

int n, m;
pair<int, int> a[MAXN];

bool read() {
    if (!(cin >> n >> m))
        return false;

    forn (i, m)
        cin >> a[i].first >> a[i].second;

    return true;
}

void solve() {
    multiset<int> rs;

    forn (i, m)
        rs.insert(a[i].second);

    sort(a, a + m);
    int l = 0, ans = 0;

    while (!rs.empty()) {
        auto r = *rs.begin();

        for (; l < m && a[l].first < r; ++l)
            rs.erase(rs.find(a[l].second));

        while (rs.count(r))
            rs.erase(rs.find(r));

        ++ans;
    }

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

#ifdef SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 5760
/**
Make it happen now, not tomorrow.
Tomorrow is a loser's excuse.
**/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef map<int, int> mi;
typedef map<ll, ll> ml;
typedef unordered_map<int, int> umi;
typedef unordered_map<ll, ll> uml;

const int mod = 1e9 + 7; // 998244353;

ll power(ll x, ll y) {ll xx = x, ans = 1; while (y > 0) {if (y & 1)ans = (ans * xx); xx = (xx * xx); y = y >> 1;} return ans;}
ll nCr(ll n, ll r) {ll p = 1, k = 1; if (n - r < r) r = n - r;  if (r != 0) {while (r) {p *= n; k *= r; ll m = __gcd(p, k); p /= m; k /= m; n--; r--;}} else p = 1; return p;}
void printv(vl v) {cout << "Vector is \n"; for (auto x : v)cout << x << " "; cout << "\nVector End\n";}
void printa(int a[], int n) {cout << "Array is\n"; for (int i = 0; i < n; i++) {cout << a[i] << " ";} cout << "\nVector End\n";}
int day(int date, int month, int year) {if (month == 1) {month = 13; year--;} if (month == 2) {month = 14; year--;} int q = date, m = month, k = year % 100, j = year / 100; int day = q + (13 * (m + 1)) / 5 + k + (k / 4) + (j / 4) + 5 * j; day = day % 7; return day;}
ll ston(string s) {ll val = 0, bs = 1; ll sl = s.length(); sl--; while (sl >= 0) {val += ((s[sl] - 48) * bs); bs *= 10; sl--;} return val;}
ll lcm(ll a, ll b) {return (a * b) / __gcd(a, b);}

#define F first
#define S second
#define mp make_pair
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(v) v.begin(),v.end()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


int main() {
	int n;
	cin>>n;
	int a[n];
	map<int,int>m;
	for (int i=0;i<n;i++)cin>>a[i];
	int ans=0;
	sort(a,a+n);
	set<vi>s;
	for (int i=0;i<n;i++){
        for (int j=i+1;j<n;j++){
            for (int k=j+1;k<n;k++){
                if((a[i]+a[j]>a[k]&&a[k]+a[j]>a[i]&&a[i]+a[k]>a[j])&&a[k]!=a[j]&&a[k]!=a[i]&&a[j]!=a[i]){
                    vi v={i,j,k};
                    //cout<<a[i]<<" "<<a[j]<<" "<<a[k]<<endl;
                    sort(all(v));
                    s.insert(v);
                }
            }
        }
	}
	cout<<s.size()<<endl;

}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


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

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  int ans=0;
  for(int i=1;i<=N;i++){
    ans+=((int)(log10(i)+1)%2==1);
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
H, W = map(int, raw_input().split())
s = [raw_input() for y in range(H)]

T = [[0]*W for y in range(H)]
for y in range(H):
  for x in range(W):
    if (x, y)==(0, 0):
      T[y][x] = 0 if s[y][x]=="." else 1
    elif x==0:
      T[y][x] = T[y-1][x] + (1 if s[y-1][x]=="." and s[y][x]=="#" else 0)
    elif y==0:
      T[y][x] = T[y][x-1] + (1 if s[y][x-1]=="." and s[y][x]=="#" else 0)
    else:
      T[y][x] = min(
        T[y-1][x] + (1 if s[y-1][x]=="." and s[y][x]=="#" else 0),
        T[y][x-1] + (1 if s[y][x-1]=="." and s[y][x]=="#" else 0))
print T[H-1][W-1]


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

int main() {
	vector<int> a(3);
	int k;
	for (int i = 0; i < 3; i++) cin >> a[i];
	cin >> k;
	sort(a.begin(), a.end());
	for (int i = 0; i < k; i++) a[2] *= 2;
	cout << a[0] + a[1] + a[2] << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

const int MAX = 20000000;

int n, tree[MAX + 1];

void maxHeapify(int i)
{
  int l = 2 * i;
  int r = 2 * i + 1;

  // Select the node which has the maximum key value
  int maximum_i = i;
  if (l <= n && tree[l] > tree[maximum_i])
    maximum_i = l;
  if (r <= n && tree[r] > tree[maximum_i])
    maximum_i = r;

  if (maximum_i != i)
  {
    // Call recursively
    std::swap(tree[i], tree[maximum_i]);
    maxHeapify(maximum_i);
  }
}

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

  for (int i = 1; i <= n; ++i)
    scanf("%d", &tree[i]);

  for (int i = n / 2; i >= 1; --i)
    maxHeapify(i);

  for (int i = 1; i <= n; ++i)
    printf(" %d", tree[i]);
  printf("\n");

  return 0;
}


Measured memory_bytes: 4532
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int p[100001];
int main(){
	ll a,b,c,i,sum=0;
	cin>>a>>b>>c;
	for(i=1;i<=a;i++) cin>>p[i];
	for(i=1;i<a;i++)
	{
		if(0<c-b*(p[i+1]-p[i])) sum+=(p[i+1]-p[i])*b;
		else sum+=c;
	}
	cout<<sum;
	return 0;
}


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

using namespace std;

#define ll long long
#define pb push_back
#define vi vector<int>
#define bn(n) (n).begin(), (n).end()
#define FOR(n) for(int i = 0; i < (int)n; i++)
#define MX 1e5

const int mod = 1e9 + 7;
ll f(ll x) {
    ll a = 1;
    for (int i = 2; i <= x; i++) {
        a = a * i % mod;
    }
    return a;
}

void solve() {
    ll a, b;
    cin >> a >> b;
    if (abs(a-b)>1) {
        cout << 0 << "\n";
    } else if (a == b) {
        cout << f(a)*f(b)%mod * 2%mod << "\n";
    } else if (a != b) {
        cout << f(a) * f(b)%mod<< "\n";
    }
}

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

    int t = 1, i = 1;
    //cin >> t;
    while(t--) {
        //cout << "Case #" << i << ": ";
        solve();
        //i++;
    }
    return 0;
}


Measured memory_bytes: 3624
# include <stdio.h>
# include <string.h>

int main(){

	char str1[101];
	char str2[101];
	char str3[101];


	scanf("%s %s %s", str1, str2, str3);

	int one = strlen(str1);
	int two = strlen(str2);
	int tre = strlen(str3);

	if ((str2[0] == str1[one-1]) && (str2[two-1] == str3[0])){
		printf("YES\n");
	}
	else {
		printf("NO\n");
	}



	return 0;
}


Measured memory_bytes: 128
/**
 * File              : c.cpp
 * Author            : recurze
 * Date              : 21:16 18.01.2019
 * Last Modified Date: 21:19 18.01.2019
 */
#include <stdio.h>
#include <limits.h>
#include <algorithm>

void readInput();
void solve();
void printAns();

int main() {
    int t = 1;
    //scanf("%d", &t);

    for (int tc = 1; tc <= t; ++tc) {
        readInput();
        solve();
        printAns();
    }
}

const int N = 1010101;

int n = 0, k = 0;
int a[N];
void readInput() {
    scanf("%d%d", &n, &k);
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
    }
}

int ans = INT_MAX;
void solve() {
    std::sort(a, a + n);
    for (int i = 0; i < n - k + 1; ++i) {
        ans = std::min(ans, a[i + k - 1] - a[i]);
    }
}

void printAns() {
    printf("%d\n", ans);
}


Measured memory_bytes: 512