akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define _GLIBCXX_DEBUG
const ll MOD = 1000000007;
const ll Mod = 998244353;
const int MAX = 510000;
const double PI = 3.14159265358979;

int main() {
  int n, k; cin >> n >> k;
    vector<long long> num(k, 0);
    for (int i = 1; i <= n; ++i) num[i%k]++; // num[x] = kで割ってxあまる数が1以上N以下に何個あるか
    long long res = 0;
    for (int a = 0; a < k; ++a) {
        int b = (k-a) % k;
        int c = (k-a) % k;
        if ((b+c) % k != 0) continue;
        res += num[a] * num[b] * num[c];
    }
    cout << res << endl;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <iostream>
#include<map>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    if (a == b && b != c) {
        cout << "Yes" << endl;
    }
    else if(b == c && b != a) {
        cout << "Yes" << endl;
    }
    else if(c == a && a != b) {
        cout << "Yes" << endl;
    }
   else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a,b,c,d,s,t;
	cin>>a>>b>>c>>d;
	s=a+b+c+d;
	cin>>a>>b>>c>>d;
	t=a+b+c+d;
	cout<<max(s,t)<<endl;
}

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

int main(){
  int n;
  cin>>n;
  int A[n+1];
  for(int i=1;i<=n;i++)cin >> A[i];
  map<int,vector<int>> m;
  for(int i=1;i<=n;i++) m[A[i]+i].push_back(i);
  for(auto &it:m) sort(it.second.begin(),it.second.end());
  long long ans=0;
  for(int i=1;i<=n;i++){
     if(m.count(i-A[i])){
        auto it=lower_bound(m[i-A[i]].begin(),m[i-A[i]].end(),i);
        ans+=it-m[i-A[i]].begin();
     }
  }
   cout<< ans;
}
        


Measured memory_bytes: 26232
using System;
using System.Collections.Generic;
using System.Linq;

namespace Volumen0
{
    class Program
    {
        static void Main()
        {
            var list = new int[5];
            string line;
            var cd = new Card();
            while ((line = Console.ReadLine()) != null)
            {
                list = line.Split(',').Select(int.Parse).ToArray();
                Array.Sort(list);
                Console.WriteLine(cd.GetaHand(list));
            }
        }
    }
    class Card
    {
        internal string GetaHand(int[] num)
        {
            if (IsFC(num))
                return "four card";
            else if (IsFH(num))
                return "full house";
            else if (IsTC(num))
                return "three card";
            else if (Pairs(num) == 2)
                return "two pair";
            else if (Pairs(num) == 1)
                return "one pair";
            else
            {
                if (IsStrt(num))
                    return "straight";
                else
                    return "null";
            }
        }
        internal bool IsFC(int[] num)
        {
            return (num[0] == num[3] | num[1] == num[4]);
        }
        internal bool IsFH(int[] num)
        {
            return ((num[0] == num[2] && num[3] == num[4]) | (num[0] == num[1] && num[2] == num[4]));
        }
        internal bool IsStrt(int[] num)
        {
            if (num[0] == 1 && num[1] == 10 && num[2] == 11 && num[3] == 12 && num[4] == 13)
                return true;
            for (int i = 1; i < 5; ++i)
            {
                if (num[i] - num[i - 1] != 1)
                    return false;
            }
            return true;
        }
        internal bool IsTC(int[] num)
        {
            return (num[0] == num[2] | num[1] == num[3] | num[2] == num[4]);
        }
        public static int Pairs(int[] num)
        {
            var tmp = num.ToList();
            tmp = tmp.Distinct().ToList();
            return 5 - tmp.Count();
        }
    }
}


Measured memory_bytes: 14276
n, m = list(map(int,input().split()))
kinds = [0]*m
for i_n in range(n):
  likes = list(map(int,input().split()))
  if likes[0] != 0:
    for j_likes in likes[1:]:
      kinds[j_likes-1]+=1
print(sum([ 1 if kind==n  else 0 for kind in kinds]))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

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

	string S; cin >> S;

	bool ok = false;
	for (int i = 0; i < (int)S.length() - 1; ++i){
		string T = S.substr(i, 2);
		ok |= (T == "AC");
	} // end for

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

	return 0;
}

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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){ 
  int N, C, K;
  cin >> N >> C >> K;
  vector<int> T(N);
  REP(i, N){
    cin >> T[i];
  }
  sort(T.begin(), T.end());
  int ans = 0, time = 0, cnt = 0;
  REP(i, N){
    ans++;
    time = T[i]+K;
    cnt = 1;
    while(i+1 < N && cnt < C){
      if(T[i+1] <= time){
        cnt++;
        i++;
      }
      else{
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 640
nd = $stdin.gets.chomp.split(" ")
nd.map! do |a_j|
    a_j.to_i
end

n = nd[0]
d = nd[1]

arr = []
n.times do
    tmp = $stdin.gets.chomp.split(" ")
    tmp.map! do |a_j|
        a_j.to_i
    end
    arr << tmp
end

def isSquare(x)
    lim = 40 * 40 * 10
    for i in 0..lim
        if x == i * i 
            return true
        end
    end
    return false
end

ans = 0
for i in 0..n-2
    for j in i + 1..n-1
        dist = 0
        for k in 0..d-1
            dist += (arr[i][k] - arr[j][k])**2
        end
        if isSquare(dist)
            ans += 1
        end
    end
end 
puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef long long ll;
int main(void){
   int n;
   ll d,a;cin>>n>>d>>a;
   vector<pair<ll,ll>> p(n);
   rep(i,n)cin>>p[i].first>>p[i].second;
   sort(p.begin(),p.end());
   d*=2;
   ll tot=0;
   queue<pair<ll,ll>> q;
   ll ans=0;
   rep(i,n){
       ll x=p[i].first;
       ll h=p[i].second;
       while(q.size()&&q.front().first<x){
           tot-=q.front().second;
           q.pop();
       }
       h-=tot;
       if(h>0){
           ll num=(h+a-1)/a;
           ans+=num;
           ll damage=num*a;
           tot+=damage;
           q.emplace(x+d, damage);
       }
   }
   cout<<ans<<endl;
}

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

#define endl '\n'

int n,m,k, a[6][6], c[6][6], mask[12];

int solve(int p, int cur){
    mask[p] = cur;
    if (p == n + m - 1){
        int cnt = 0;
        for (int i=0; i<n; i++) for (int j=0; j<m; j++) c[i][j] = a[i][j];
        for (int i=0; i<n; i++){
            if (mask[i]){
                for (int j=0; j<m; j++) c[i][j] = 0;
            }
        }
        for (int j=0; j<m; j++){
            if (mask[n+j]){
                for (int i=0; i<n; i++) c[i][j] = 0;
            }
        }
        for (int i=0; i<n; i++) for (int j=0; j<m; j++) cnt += c[i][j];
        return cnt == k;
    }
    return solve(p+1, 0) + solve(p+1, 1);
}

void solvetask(){
    cin >> n >> m >> k;
    for (int i=0; i<n; i++){
        for (int j=0; j<m; j++){
            char c; cin >> c;
            if (c == '#') a[i][j] = 1;
        }
    }
    cout << solve(0, 0) + solve(0, 1) << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t=1;// cin >> t;
    while(t--) solvetask();
}

Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main() { 
  int n;  
  while(cin >> n) {   
    int count=0;   
    for(int i=0; i<10; i++) {  
      for(int j=0; j<10; j++) {   
	for(int k=0; k<10; k++) {   
	  for(int l=0; l<10; l++) {    
	    if(i+j+k+l == n) count++;   
	  }  
	}  
      } 
    }    
    cout << count << endl; 
  } 
  return 0;
}


Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define jaldi ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
bool isequal(double x, double y) {
    return (abs(x-y) < 1e-9);
}
int main() {

    jaldi

    int d;
    cin>>d;
    int t;
    cin>>t;
    int s;
    cin>>s;
    int dist = s*t;
    if(dist>=d) {
        cout<<"Yes"<<'\n';
    }
    else {
        cout<<"No"<<'\n';
    }

}


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

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> h(N);
	for (int i = 0; i < N; i++) {
		cin >> h.at(i);
	}
	sort(h.begin(), h.end());

	int h_min = h.at(K - 1) - h.at(0);
	for (int i = 1; i + K - 1 < N; i++) {
		int tmp = h.at(i + K - 1) - h.at(i);
		h_min = min(h_min, tmp);
	}
	cout << h_min << endl;
}

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

using namespace std;

int main()
{	
	int n, k;
	string s;

	cin >> n >> s >> k;
	
	for (int i = 0; i < n; i++)
	{
		if (s[i] != s[k - 1])s[i] = '*';
	}

	cout << s << endl;
}

Measured memory_bytes: 256
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

//↑template↑




int k[10005];
int main() {
	while (1) {
		bool ok = 0;
		int n, mon = 1;
		cin >> n;
		if (n == 0) { break; }
		for (int i = 0; i < n; ++i) { cin >> k[i]; if (0 < k[i]) { ++mon; }if (2 <= k[i]) { ok = 1; } }
		if (ok) { cout << mon << endl; }
		else { cout << "NA" << endl; }
	}
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<ll,ll>;
using PP=pair<ll,P>;
using vp=vector<P>;
using vpp=vector<PP>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
int main(){
    int n;
    cin>>n;
    vi x(3);
    REP(i,3){
        cin>>x[i];
    }
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    sort(all(vec));
    int ans=INF;
    do{
        int a=0;
        FOR(i,0,n){//[0,i]
            a+=vec[i];
            int b=0;
            FOR(j,i+1,n){//[i+1,j]
                b+=vec[j];
                int c=0;
                FOR(k,j+1,n){//[j+1,k]
                    c+=vec[k];
                    chmin(ans,abs(x[0]-a)+abs(x[1]-b)+abs(x[2]-c)+(k-2)*10);
                }
            }
        }
    }while(next_permutation(all(vec)));
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
//おまじない
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない



int main() {

	bool key = true;
	ll n;
	ll ans = 1;
	ll dif[100000] = { 0 };

	cin >> n;
	rep(i, 0, n) {
		int a;
		cin >> a;
		dif[a]++;
	}

	if (n % 2 == 1) {
		rep(i, 0, n) {
			if ((i % 2 == 1 && dif[i] > 0) || (i % 2 == 0 && dif[i] == 0)) {
				key = false;
				break;
			}
			else if ((i % 2 == 0 && dif[i] == 2) || (i == 0 && dif[i] == 1) || (i % 2 == 1 && dif[i] == 0)) {
				continue;
			}
			else {
				key = false;
				break;
			}
		}
	}
	else {
		rep(i, 0, n) {
			if (i % 2 == 0 && dif[i] > 0) {
				key = false;
				break;
			}
			else if (i % 2 == 1 && dif[i] == 2||(i%2==0&&dif[i]==0)) {
				continue;
			}
			else {
				key = false;
				break;
			}
		}
	}


	if (!key) {
		cout << 0 << endl;
	}
	else {
		rep(i, 0, n/2) {
			ans = (ans * 2) % 1000000007;
		}
		cout << ans << endl;
	}

	return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb emplace_back
#define sz(x) (ll)x.size()
typedef long long ll;
using namespace std;

const int N = 500001;

int ft[N];

void upd(int i, int x){
	for(; i < N; i += i&(-i)){
		ft[i] += x;
	}
}

int get(int i){
	int val = 0;
	for(; i > 0; i -= i&(-i)){
		val += ft[i];
	}
	return val;
}

int n, q, c[N];
int last[N];
vector<int> vl[N], vi[N]; 
int ans[N];

int main(){
    IOS

    cin >> n >> q;
    for(int  i = 1; i <= n; i++){
    	cin >> c[i];
    }
    for(int i = 1; i <= q; i++){
    	int l, r;
    	cin >> l >> r;
    	vl[r].pb(l);
    	vi[r].pb(i);
    }
    for(int i = 1; i <= n; i++){
    	if(last[c[i]] != 0)
    		upd(last[c[i]], -1);
    	upd(i, 1);
    	last[c[i]] = i;
    	for(int j = 0; j < sz(vl[i]); j++){
    		ans[vi[i][j]] = get(i) - get(vl[i][j] - 1);
    	}
    }
    for(int i = 1; i <= q; i++){
    	cout << ans[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 52956
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  double N, K;
  cin >> N >> K;
  vector<double> p(N);
  rep(i, N) {
    cin >> p[i];
    p[i] = (p[i] + 1.0) / 2.0;
  }
  vector<double> sum(N + 1);
  rep(i, N) {
    sum[i + 1] = sum[i] + p[i];
  }


  double ans = 0.0;
  rep(i, N - K + 1) {
    chmax(ans, sum[i + K] - sum[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3456
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))

a = list(input())

x = a[0]
co = 1
flag = False
for i in range(1,len(a)):
    if flag:
        co += 1
        x = [a[i-1],a[i]]
        flag = False
        continue
    if a[i] == x:
        flag = True
        continue
    else:
        x = a[i]
        co += 1
print(co)

Measured memory_bytes: 5344
#include <cstdio>
#include <algorithm>
#include <climits>

typedef long long LL;
const LL Inf = LLONG_MAX / 3;
const int MN = 400005;

int N, A[MN], buk[MN];
LL K, L, Dis[MN][61]; int Bit;
int stk[MN], tp;

int main() {
	scanf("%d%lld", &N, &K), L = N * K;
	for (int i = 1; i <= N; ++i) scanf("%d", &A[i]), A[N + i] = A[i];
	for (int i = N + N; i >= 1; --i) {
		if (i <= N) Dis[i][0] = buk[A[i]] - i + 1;
		buk[A[i]] = i;
	}
	for (int j = 0; j < 59; ++j) {
		LL Mn = Inf;
		for (int i = 1; i <= N; ++i)
			Dis[i][j + 1] = std::min(Inf, Dis[i][j] + Dis[(i + Dis[i][j] - 1) % N + 1][j]),
			Mn = std::min(Mn, Dis[i][j]);
		Bit = j + 1;
		if (Mn > L) break;
	}
	LL S = 1;
	for (int j = Bit; ~j; --j)
		if (S + Dis[(S - 1) % N + 1][j] <= L)
			S += Dis[(S - 1) % N + 1][j];
	for (int i = 1; i <= N; ++i) buk[A[i]] = 0;
	int p = N + N - L + S;
	for (int i = p; i <= N + N; ++i) {
		if (!buk[A[i]]) stk[++tp] = A[i], buk[A[i]] = 1;
		else {
			while (stk[tp] != A[i]) buk[stk[tp--]] = 0;
			buk[stk[tp--]] = 0;
		}
	}
	for (int i = 1; i <= tp; ++i) printf("%d%c", stk[i], " \n"[i == tp]);
	return 0;
}

Measured memory_bytes: 103808
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	vector<int>ivec;
	cin>>a;
	for(int i=0;i<a;i++)
	{
		cin>>b;
		ivec.push_back(b);
	 } 
	int cnt=0,ans=1000000000;
	for(int i=0;i<a;i++)
	{
		while(ivec[i]%2==0)
		{
			ivec[i]/=2;
			cnt++;
		}
		if(ans>cnt)ans=cnt;
		cnt=0;
	}
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 256
let min (x : int) y = if x < y then x else y

let levenshtein_distance (x, y) =
  if x = y then 0
  else
    let m = String.length x in
    let n = String.length y in
    if m = 0 then n
    else if n = 0 then m
    else begin
      let s = Array.init (n + 1) (fun i -> i) in
      let t = Array.make (n + 1) 0 in
      for i = 0 to m - 1 do
        t.(0) <- i + 1;
        for j = 0 to n - 1 do
          t.(j+1) <- min
            (s.(j) + if x.[i] = y.[j] then 0 else 1)
            (min t.(j) s.(j+1) + 1);
        done;
        Array.iteri (fun i e -> s.(i) <- e) t
      done;
      t.(n)
    end

let () =
  Scanf.scanf "%s %s " (fun x y -> x, y)
  |> levenshtein_distance
  |> Printf.printf "%d\n"

Measured memory_bytes: 2456
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
// *テンプレート*
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define EPS (1e-10)
// aよりbの方が小さかったら、aの値をbの値に置き換える。(swapではない！)
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
// aよりbの方が大きかったら、aの値をbの値に置き換える。
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
//最大公約数
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
//最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
// 素数かどうか判定
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
// *テンプレートここまで*

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	vector<int>h(n); rep(i, n)cin >> h[i];
	int ans = 0;
	int now = 0;
	rep(i, n - 1) {
		if (h[i] >= h[i + 1])now++;
		else {
			chmax(ans, now);
			now = 0;
		}
	}
	chmax(ans, now);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
using namespace std;
#define MODULO 1000000007
#define PI 3.14159265359
typedef long long int ll;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
     string s,t;
     cin>>s>>t;
     int ct=0;
     for(int i=0;i<s.length();++i)
     {
     	if(s[i]!=t[i])
     	ct++;
	 }
	 cout<<ct<<endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < n; i++)

void solve();

void init() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main(void) {
    init();
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    ll count = 0;
    for (int i = 1; i < n + 1; i++) {
        ll countt = 0;
        if (i % 2 == 0) {
            continue;
        }
        for (int j = 1; j < i + 1; j++) {
            if (i % j == 0) {
                countt++;
            } 
        }
        if (countt == 8) {
            count++;
        }
    }
    cout << count << "\n";
}


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

ll gcd(ll a, ll b){
  if(b == 0) return a;
  return gcd(b,a%b);
}

ll lcm(ll a, ll b){
  ll g = gcd(a,b);
  return a/g *b;
}

int main(){
  int n;
  long long kekka;
  cin >> n;
  vector<long long> t(n);

  rep(i,n) cin >> t.at(i);

  ll ans = 1LL,k;

  rep(i,n){
    ans = lcm(ans,t.at(i));
  }

  cout << ans << endl;
  
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
#define pb push_back
#define For(i,s,e) for (ll i=(s); i<(e); i++)
#define Debug_array(a,n) for (ll i=(0); i<(n); i++) cout<<a[i]<<" "
#define Foe(i,s,e) for (ll i=(s); i<=(e); i++)
#define Fod(i,s,e) for (ll i=(s)-1; i>=(e); i--)
#define Mod 1000000007
#define pii pair<ll,ll>
#define fi first
#define se second
#define endl "\n"
#define mp make_pair
#define big_prime 15486277
#define bigger_prime 179424697
#define biggest_prime 32416188691
//#define random_shuffle(indices.begin(), indices.end());
//std::random_device rd;
//std::mt19937 g(rd());
//std::shuffle(v.begin(), v.end(), g);
using namespace __gnu_pbds; 
using namespace std;

typedef long long ll;
typedef tree<ll, null_type, less<ll>, rb_tree_tag,tree_order_statistics_node_update> ordered_set; 

#define MAX 5002

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	string s;cin>>s;
	ll k = s.size();
	ll count = 15-k;
	For(i,0,s.size()) if(s[i]=='o') count++;
	if(count>=8){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}











	
}

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, char>> data;
    for (int i = 0; i < m; i++) {
        int s;
        char c;
        cin >> s >> c;
        s--;
        data.emplace_back(s, c);
    }
    
    vector<string> res;
    for (int i = 0; i < 1000; i++) {
        string s = to_string(i);
        if (s.size() != n) continue;
        bool ok = true;
        for (const auto& e : data) {
            int id;
            char c;
            tie(id, c) = e;
            if (s[id] != c) ok = false;
        }
        if (ok) res.emplace_back(s);
    }
    
    if (res.size() == 0) {
        cout << -1 << endl;
    } else {
        sort(res.begin(), res.end());
        cout << res[0] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let kx = readInts()
    if kx[0] * 500 >= kx[1] {
        print("Yes")
    } else {
        print("No")
    }
}

main()


Measured memory_bytes: 8184
#include <iostream>
#include <string>
using namespace std;
string s;
bool c,f;
int main()
{
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='C')
            c=1;
        if(s[i]=='F' && c){
            f=1;
            break;
        }
    }
    if(c&&f)
        cout<<"Yes"<<'\n';
    else
        cout<<"No"<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

char rev(char c){
	return (c == 'S' ? 'W' : 'S');
}

int N;
string s,t;

bool check(string str){
	bool ok = true;
	rep (i, N){
		char cl = str[(N-1+i)%N];
		char cr = str[(i+1)%N];
		if (s[i] == 'o'){
			if (str[i] == 'S'){
				ok &= (cl == cr);
			}else{ // if (str[i] == 'W')
				ok &= (cl != cr);
			} // end if
		}else{ // if (s[i] == 'x')
			if (str[i] == 'S'){
				ok &= (cl != cr);
			}else{ // if (str[i] == 'W')
				ok &= (cl == cr);
			} // end if
		} // end if
	} // end rep
	return ok;
}

bool process(string str){
	t = str;
	t.resize(N);
	for (int i = 1; i < N - 1; ++i){
		if (t[i] == 'S'){
			if (s[i] == 'o'){
				t[i+1] = t[i-1];
			}else{ // if (s[i] == 'x')
				t[i+1] = rev(t[i-1]);
			} // end if
		}else{ // if (t[i] == 'W')
			if (s[i] == 'o'){
				t[i+1] = rev(t[i-1]);
			}else{ // if (s[i] == 'x')
				t[i+1] = t[i-1];
			} // end if
		} // end if
	} // end for
	return check(t);
}


int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> N;
	cin >> s;
	
	bool ok = false;
	rep (i,1<<2){
		string str = "";
		rep (j, 2){
			if (i & (1<<j)){
				str += 'S';
			}else{
				str += 'W';
			} // end if
		} // end rep
		ok = process(str);
		if (ok){
			cout << t << endl;
			return 0;
		} // end if
	} // end rep
	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 752
N = int(input())
def dfs(s):
  if int(s)>N:
    return 0
  else:
    if "3" in s and "5" in s and "7" in s:
      ret=1
    else:
      ret=0
  
    for i in "357":
      ret+=dfs(s+i)
    return ret
  
print(dfs("0"))

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

using namespace std;

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

	while (n != 0) {
		vector<int> point(n);
		for (int i = 0; i < n; i++) cin >> point[i];

		sort(point.begin(), point.end());
		int sum = 0;
		for (int i = 1; i < n - 1; i++) sum += point[i];

		cout << sum / (n - 2) << endl;

		cin >> n;
	}

	return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
#define REP(i,x,y) for(ll i=x; i<=y; i++)
#define BIT(t) ((long long 1) << t)
#define PER(i,y,x) for(ll i=y; i>=x; i--)
#define vll vector<ll>
#define vvll vector<vector<ll>>
using namespace std;
typedef long long ll;

ll const MAX = 303;
ll dp[MAX][MAX][MAX] = {};

ll const MOD = 1e9 + 7;
ll mod_p(ll x, ll y) {
	   x %= MOD;
	   y %= MOD;
	   return (x + y + MOD) % MOD;
}

ll mod_m(ll x, ll y) {
	   x %= MOD;
	   y %= MOD;
	   return x * y%MOD;
}

ll mod_pow(ll x, ll t) {
	   x %= MOD;
	   if (t == 0) {
			   return 1;
	   }
	   else {
			   ll v = mod_pow(x, t / 2);
			   if (t % 2 == 0) {
					   return v * v % MOD;
			   }
			   else {
					   return v * v%MOD * x %MOD;
			   }
	   }
}

ll mod_inv(ll x) {
	   return mod_pow(x, MOD - 2);
}

int main(){
	ll n, m;
	cin >> n >> m;
	dp[0][1][1] = 1;
	REP(i,0,m-1){
		REP(j,1,n){
			REP(k,1,j){
				dp[i+1][j+1][k] = mod_p(dp[i+1][j+1][k], mod_m(dp[i][j][k], n-j));
				dp[i+1][j][k] = mod_p(dp[i+1][j][k], mod_m(dp[i][j][k], j-k));
				dp[i+1][j][j] = mod_p(dp[i+1][j][j], mod_m(dp[i][j][k], k));
			}
		}
	}
	cout << dp[m][n][n] << endl;
}

Measured memory_bytes: 216576
#!/usr/bin/env python3

import collections

def color(r):
    for i, (p, q) in enumerate([
            (1, 399),
            (400, 799),
            (800, 1199),
            (1200, 1599),
            (1600, 1999),
            (2000, 2399),
            (2400, 2799),
            (2800, 3199),
            (3200, 4800)
    ]):
        if p <= r <= q:
            return i

input()
a = collections.Counter([color(int(x)) for x in input().split()])
m = len(a) - (1 if 8 in a and len(a) > 1 else 0)
print(m, m + a[8] - (1 if 8 in a and len(a) == 1 else 0))


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int ll
#define pb push_back
#define setbits(x)          __builtin_popcountll(x)
#define endl "\n"
typedef long long ll;
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
    cin>>arr[i];
int dp[n+1][2]={};
dp[0][0]=0;
dp[0][1]=0;
dp[1][0]=arr[0];
dp[1][1]=arr[1];
for(int i=2;i<n;i++)
{if(i%2==0)
{
    dp[i][0]=max(dp[i-1][1],dp[i-1][0]);
    dp[i][1]=max(dp[i-2][0],dp[i-2][1])+arr[i];
    }
    else
    {
        dp[i][1]=dp[i-1][0]+arr[i];
        dp[i][0]=arr[i-1]+dp[i-2][0];
    }
}
int ans=max(dp[n-1][1],dp[n-1][0]);
cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 8300
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)

	n := len(s) - 1
	for {
		if s[n] == 'r' && s[n-1] == 'e' && s[n-2] == 'm' && s[n-3] == 'a' && s[n-4] == 'e' && s[n-5] == 'r' && s[n-6] == 'd' {
			n -= 7
		} else if s[n] == 'm' && s[n-1] == 'a' && s[n-2] == 'e' && s[n-3] == 'r' && s[n-4] == 'd' {
			n -= 5
		} else if s[n] == 'r' && s[n-1] == 'e' && s[n-2] == 's' && s[n-3] == 'a' && s[n-4] == 'r' && s[n-5] == 'e' {
			n -= 6
		} else if s[n] == 'e' && s[n-1] == 's' && s[n-2] == 'a' && s[n-3] == 'r' && s[n-4] == 'e' {
			n -= 5
		} else {
			fmt.Println("NO")
			return
		}

		if n == -1 {
			fmt.Println("YES")
			return
		}
	}
}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll x,ll n)
{
    KAKA
    vector<ll> v(n);
    map<ll,bool> mp;
    pragi(0,n)
    {
        cin>>v[i];
        mp[v[i]] = true;
    }
    ll ele = -1;
   for(ll diff = 0;diff <= 101;diff++)
   {
       ll a = x - diff,b = x + diff;
       
       {
         if(!mp[a])
         {
             ele = a;
             break;
         }
       }
       
       {
           if(!mp[b])
           {
               ele = b;
               break;
           }
       }
   }
   if(ele == -1)
   {
       ll mn = *min_element(v.begin(),v.end());
       ll mx = *max_element(v.begin(),v.end());
       ll a1 = mn - 1,a2 = mx + 1;
       ll diff1 = (llabs)(x - a1),diff2 = (llabs)(x - a2);
       if(diff1 <= diff2) cout<<a1<<"\n";
       else cout<<a2<<"\n";
   }
   else cout<<ele<<"\n";
    
}
int main()
{
    KAKA
    ll x,n;
    cin>>x>>n;
    Compute(x,n);
}

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

int main(void){
    long long N;
    int X, M;
    cin >> N >> X >> M;
    vector<long long> PowerX;
    vector<int> Loop(M, -1);
    long long powerXbuf = X;
    int loopstart, looplength;
    for(int i=0; i<=M; i++){
        PowerX.push_back(powerXbuf);
        Loop[powerXbuf] = i;
        powerXbuf *= powerXbuf;
        powerXbuf %= M;
        if(Loop[powerXbuf] != -1){
            loopstart = Loop[powerXbuf];
            looplength = i-loopstart+1;
            break;
        }
    }
    long long numLoop = (N-loopstart) / looplength;
    long long numSurplus = (N-loopstart) % looplength;
    long long res = 0;
    if(loopstart > N){
        for(int i=0; i<N; i++){
            res += PowerX[i];
        }
    }else{
        for(int i=0; i<M; i++){
            if(i >= N)break;
            if(i > loopstart + looplength)break;
            if(i < loopstart){
                res += PowerX[i];
            }else if(i < loopstart + numSurplus){
                res += PowerX[i] * (numLoop + 1);
            }else{
                res += PowerX[i] * numLoop;
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4312
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <numeric>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;


int main() {
	string str1, str2;
	cin >> str1 >> str2;
	list<PAIR> pl;

	vector<set<int>> t('z' - 'a' + 1);
	vector<set<int>> answer('z' - 'a' + 1);
	list<PAIR> m;

	REP(i, str1.size()) {
		t[str1[i] - 'a'].emplace(i);
	}
	REP(i, str2.size()) {
		answer[str2[i] - 'a'].emplace(i);
	}

	REP(i, str1.size()) {
		int c1 = str1[i] - 'a';
		int c2 = str2[i] - 'a';

		REP(c, 'z' - 'a' + 1) {
			if (t[c].find(i) != t[c].end()) {
				if (c+'a' != str2[i]) {
					t[c].swap(t[c2]);
				}
			}
		}
	}

	REP(i, t.size()) {
		if (t[i] != answer[i]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Measured memory_bytes: 19336
import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        init();
        String s = next(), t = next();
        int a = nextInt(), b = nextInt();
        String u = next();
        a -= (u.equals(s) ? 1 : 0);
        b -= (u.equals(t) ? 1 : 0);
        System.out.println(a + " " + b);
    }

    //Input Reader
    private static BufferedReader reader;
    private static StringTokenizer tokenizer;

    private static void init() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    private static String next() throws IOException {
        String read;
        while (!tokenizer.hasMoreTokens()) {
            read = reader.readLine();
            if (read == null || read.equals(""))
                return "-1";
            tokenizer = new StringTokenizer(read);
        }

        return tokenizer.nextToken();
    }

    private static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

Measured memory_bytes: 21076
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define pi 3.14159265359
using namespace std;
const long long INF=1e9+7;
const string alp="abcdefghijklmnopqrstuvwxyz"; //26
const string ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
//const ll MOD=998244353LL;
//const ll MOD=1777777777LL;


int main() {
  ll N;
  cin>>N;
  vl a(N);
  rep(i,N) cin>>a[i];
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  ll ans=0;
  for(int i=0;i<N;i++){
    ans+=a[i/2];
  }
  ans-=a[0];
  cout<<ans<<endl;
}

Measured memory_bytes: 4796
#include<stdio.h>
int main()
{
    int a,b,c,d,e,f,h;
    scanf("%d %d",&a,&b);
    c=a+b;
    d=a-1;

     h=a+d;
    e=b-1;

    f=b+e;
    if(c>=h&&c>=f)
    {
        printf("%d",c);
    }
    else if(h>=c&&h>=f)
    {
        printf("%d",h);
    }
    else if(f>=c&&f>=h)
    {
        printf("%d",f);
    }
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,l;
    cin>>n>>l;
    if(n==1){
        if(n*2==l or n*4==l) cout<<"Yes";
        else cout<<"No";
    }else{
        if(l>=n*2 and l<=n*4){
            int r = l%2;
            if(r>0) cout<<"No";
            else cout<<"Yes";
        }else cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <set>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>

using namespace std;

const long long mod = 1000000007;
int n;

long long fac[100002];
long long ifac[100002];

int b[100001];
long long pos1, pos2;

long long mod_pow(long long n, int step) {
  long long r = 1;

  while (step) {
    if (step & 1) {
      r = r*n % mod;
    }
    n = n*n % mod;
    step >>= 1;
  }

  return r;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cin >> n;
  long long u, v ,x;
  for (int i = 0; i <= n; i++) {
    cin >> x;
    if (b[x]) {
      u = b[x] - 1;
      v = i;
      break;
    } else {
      b[x] = i + 1;
    }
  }

  fac[0] = fac[1] = 1;

  for (int i = 2; i <= n+1; i++) {
    fac[i] = fac[i-1] * i % mod;
  }

  for (int i = 0; i <= n+1; i++) {
    ifac[i] = mod_pow(fac[i], mod - 2);
  }
  long long d;
  long long p = u + (n - v);
  cout << n << "\n";
  for (long long k = 2; k <= n; k++) {
    d = fac[n+1] * ifac[k] % mod * ifac[n+1-k] % mod;
    if (p >= k-1) {
      d -= fac[p] * ifac[k-1] % mod * ifac[p-k+1] % mod;
      if (d < 0) {
        d += mod;
      }
    }
    cout << d << "\n";
  }
  cout << 1;
  return 0;
}


Measured memory_bytes: 3200
#include <cstdio>
#include <string>
#include <queue>
using namespace std;

int main() {
  char com[20];
  priority_queue<int> PQ;

  while (1) {
    scanf("%s", com);
    if (com[0] == 'i') {
      int key; scanf("%d", &key);
      PQ.push(key);
    } else if (com[1] == 'x') {
      printf("%d\n", PQ.top());
      PQ.pop();
    } else if (com[0] == 'e') {
      break;
    }
  }
  return 0;
}



Measured memory_bytes: 6528
n = int(input())
a = list(map(int, input().split()))
ans = 0

def judge(i, nums):
    global ans
    if i == n:
        m = 1
        for j in range(n):
            m *= nums[j]
        
        if m % 2 == 0:
            ans += 1
    else:
        nums[i] = a[i] - 1
        judge(i + 1, nums)
        nums[i] = a[i]
        judge(i + 1, nums)
        nums[i] = a[i] + 1
        judge(i + 1, nums)
        
nums = [0] * n
judge(0, nums)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define INF 1000000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print(""); 
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

const int mod = 1000000007;
class mint {
public:
    ll x;
    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 {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }
    mint inv() const {
        return pow(mod - 2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res /= a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

ll modpow(ll a, ll n){
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}

void Main(){
	
	string S, T, U;
	ll A, B;
	cin >> S >> T >> A >> B >> U;
	if(S == U) A -= 1;
	else B -= 1;
	print2(A, B);
		
}

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	Main();
	return 0;
	
}





Measured memory_bytes: 3624
n = int(input())
s = [0] + list(map(int, input().split()))
s.append(0)
forward = []
backward = []
jump = []
for a, b, c in zip(s, s[1:], s[2:]):
    forward.append(abs(b - a))
    backward.append(abs(c - b))
    jump.append(abs(c - a))
res = sum(forward) + backward[-1]
for i in range(n):
    print(res + jump[i] - forward[i] - backward[i])


Measured memory_bytes: 101024
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int INF=1e9;
const double eps=1e-9;
const int maxn=1e5+10;
ll a[maxn],b[maxn],c[maxn],dp[maxn][3],sum[maxn];
inline ll read(){
	ll x=0,flag=1;
	char ch=getchar();
	while(!isdigit(ch) && ch!='-')ch=getchar();
	if(ch=='-')flag=-1,ch=getchar();
	while(isdigit(ch))x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return x*flag;
}
int main(){
	ll i,j,k,m,n;
	n=read();
	for(i=1;i<=n;i++)a[i]=read();
	for(i=1;i<=n;i++)b[i]=read();
	for(i=1;i<=n;i++)c[i]=read();
	sort(a+1,a+n+1);sort(b+1,b+n+1);sort(c+1,c+n+1);
	for(i=1;i<=n;i++)dp[i][1]=1;
	ll pos=0;
	for(i=1;i<=n;i++){
		while(b[i]>a[pos+1] && pos<n)pos++;
		dp[i][2]=pos;
		sum[i]=sum[i-1]+dp[i][2];
	}
	pos=0;ll ans=0;
	for(i=1;i<=n;i++){
		while(c[i]>b[pos+1] && pos<n)pos++;
		dp[i][3]=sum[pos];
		ans+=dp[i][3];
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 5760
import java.util.*;

class Main{

    int solve(int src, int dst) {
        int answer = 0;
        if (src == dst) return 0;
        if (src % 2 != 0) { answer++; src++; }
        if (dst % 2 != 0) { answer++; dst--; }
        answer += solve(src / 2, dst / 2);
        return answer;
    }

    void _solve(){
        int N, s, d;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();

        for ( int i = 0; i < N; i++ ){
            s = sc.nextInt();
            d = sc.nextInt();
            System.out.println(solve(s, d));
        }
    }

    public static void main(String[] args){ new Main()._solve();}
}





Measured memory_bytes: 26560
### main

n = gets.strip.to_i
m = gets.strip.to_i

nbrs = n.times.map{[]}
prvs = n.times.map{0}

m.times do
  a, b = gets.strip.split(' ').map{|s| s.to_i - 1}
  nbrs[a] << b
  prvs[b] += 1
end
#p nbrs
#p prvs

src = (0...n).select{|i| prvs[i] == 0}
#p src
tos = []
multi = false


while ! src.empty?
  u = src.shift
  tos << u
  multi = true if ! src.empty?

  for v in nbrs[u]
    prvs[v] -= 1
    if prvs[v] == 0
      src << v
    end
  end
end

tos.each{|i| puts (i + 1)}
puts (multi ? 1 : 0)

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

int cnt = 0;

void Merge(vector<int> &A, int n, int left, int mid, int right, vector<int> &R, vector<int> &L){
    int SENTINEL = 2000000000;
    int n1 = mid - left;
    int n2 = right - mid;
    for (int i = 0; i < n1; i++)    L[i] = A[left + i];
    for (int i = 0; i < n2; i++)    R[i] = A[mid + i];
    L[n1] = SENTINEL;
    R[n2] = SENTINEL;
    int i = 0, j = 0;
    for (int k = left; k < right; k++){
        cnt++;
        if (L[i] <= R[j])   A[k] = L[i++];
        else    A[k] = R[j++];
    }
    return;
}

void mergeSort(vector<int> &A, int n, int left, int right, vector<int> &R, vector<int> &L){
    if (left+1 < right){
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid, L, R);
        mergeSort(A, n, mid, right, L, R);
        Merge(A, n, left, mid, right, L, R);
    }
    return;
}

int main(void){
    int MAX = 500000;
    vector<int> A(MAX), L(MAX/2+2), R(MAX/2+2);
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> A[i];
    mergeSort(A, n, 0, n, L, R);
    for (int i = 0; i < n; i++){
        if (i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << cnt << endl;
    return 0;
}



Measured memory_bytes: 6612
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
void ins() {}
template<class T,class... Rest>void ins(T& v,Rest&... rest){cin>>v;ins(rest...);}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rrep(i,n) for(long long i=(n);i>=0;--i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))

// === debug ===
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif
// === end ===

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

  int l = 0, r = N-1;
  int ans = 0;
  while (l < r) {
    while (l < N && S[l] == 'R') ++l;
    while (r >= 0 && S[r] == 'W') --r;
    if (l >= r)
      break;
    ++ans;
    ++l, --r;
  }
  cout << ans << endl;


  return 0;
}


// 赤を左、白を右に固める


Measured memory_bytes: 3732
s = gets.chomp

h = Hash.new {[-1, 0]}
s.each_char.with_index do |c, i|
    x, y = h[c]
    h[c] = [i, [y, i - x - 1].max]
end

puts h.values.map{|x, y| [y, s.size - x - 1].max}.min

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

using namespace std;

long sum_of_onbit(vector<long> vec, long n, long i)
{
  long result = 0;
  long bitOne = 1;
  for (long j = 0; j < n; j++)
  {
    if (i & (1L << j))
    {
      result += vec[j];
    }
  }
  return result;
}

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

  string s;
  cin >> s;

  if (s == "AAA" || s == "BBB")  {
      cout << "No" << endl;
      exit(0);
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
using namespace std;
vector<vector<int> >a(11,vector<int>(331));
void r(int n,int u,int s,int d){
a[n][s]++;
for(int i=10;i-->0;)
if(!(u>>i&1))r(n+1,u^1<<i,s+d*i,d+1);
}
main(){
r(0,0,0,1);
for(int n,s;cin>>n>>s;)cout<<a[n][s]<<endl;
}

Measured memory_bytes: 0