akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

using namespace std;
using ll = long long;

int main(void) {
  vector<int> vec(3);
  rep(i, 3) {
    cin >> vec[i];
  }
  sort(all(vec));
  cout << abs(vec[1] - vec[0]) + abs(vec[2] - vec[1]) << endl;
	return 0;
}



Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
#print(a)
#print(b)
left = b[int(n/2)-1]
right = b[int(n/2)]
if left == right:
  for i in range(n):
    print(right)
else:
  for i in range(n):
    if a[i] <= left:
      print(right)
    else:
      print(left)
      

Measured memory_bytes: 25620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var b = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        var answer = b[0] + b[n - 2];

        for (int i = 0; i < n - 2; i++)
        {
            answer += Math.Min(b[i], b[i + 1]);
        }

        Console.WriteLine(answer);
    }
}

Measured memory_bytes: 13268
#include <math.h>
#include <stdio.h>
int main(int argc, const char * argv[])

{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(a<b&&b<c){
       printf("Yes\n");
    }else{
       printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
import java.util.*;
import java.util.Arrays;
public class Main{
    
    
    public static void main(String[] args){
       Scanner sc = new Scanner(System.in);
       int n =  sc.nextInt();
       int r=10;
       while(r>0){
           r = n/10;
           n = n-10*r;
           
       }
       if(n==3){
           System.out.println("bon");
       }
       else if(n==0 || n==1 || n== 6|| n==8){
           System.out.println("pon");
       }
       else{
        System.out.println("hon");
       }
    }
   
    
       
    
}

Measured memory_bytes: 27040
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b) a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b) a=b;};

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  Int r,s,n;
  cin>>r>>s>>n;
  vector<Int> y(n),x(n);
  for(Int i=0;i<n;i++) cin>>y[i]>>x[i];

  vector<Int> v;
  for(Int i=0;i<n;i++){
    if(x[i]<=s) v.emplace_back((r-y[i]+1)+(s-x[i]+1));
    else v.emplace_back((r-y[i]+1)+(x[i]-s));
  }

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

  
  Int ans=0;
  for(Int i=0;i<n;i++)
    ans=max(ans+1,v[i]);
  
  cout<<ans<<endl; 
  return 0;
}



Measured memory_bytes: 14788
H, W = gets.split(' ').map(&:to_i)

grid = Array.new
H.times do
  grid.push(gets.split(''))
end

H.times do |i|
	W.times do |j|
		mine = 0
		next if grid[i][j] == '#'
		(-1..1).each do |k|
			(-1..1).each do |l|
				if i+k >= 0 && i+k <= H-1 && j+l >= 0 && j+l <= W-1 && grid[i+k][j+l] == '#'
					mine += 1
				end
			end
		end
		grid[i][j] = mine.to_s
	end
end

H.times do |i|
	puts grid[i].inject(:+)
end

Measured memory_bytes: 2172
#!/usr/bin/env python


def read():
    return input()


def work(x):
    ans = (x / 11) * 2
    
    if 0 < x % 11 <= 6:
        ans += 1
    elif 7 <= x % 11:
        ans += 2
        
    print ans


if __name__ == "__main__":
    work(read())


Measured memory_bytes: 2568
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>

using namespace std;

typedef long long LL;
typedef double db;
#define FAST ios::sync_with_stdio(false);
const int MaxN = 105;
const int mod = 1e9 + 7;
int main()
{
	LL n , ans = 0;
	cin >> n;
	ans += (LL)2*(n / 11);
	if((n % 11) >= 1 && (n % 11) <= 6)ans++;
	else if(n % 11 == 0);
	else ans += 2;
	cout << ans << endl;
	return 0;
	}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
using namespace std;
const int maxn = 200100;

const ld inf = 1e18;

struct cht {
	struct line {
		ll k, b; ld x;
		ll val; bool isquery;

		line(ll _k = 0, ll _b = 0):
			k(_k), b(_b), x(-inf), val(0), isquery(0) {}

		ll eval(ll x) const { return k*x+b; }
		bool parallel(const line &l) const { return k == l.k; }
		ld intersection(const line &l) const { 
			if(parallel(l)) return inf;
			return (1.0*l.b - b) / (1.0*k - l.k);
		}

		bool operator < (const line &l) const {
			if(l.isquery) return x < l.val;
			else return k < l.k;
		}
	};

	set<line>hull;
	typedef set<line>::iterator iter;

	bool cPrev(iter it) { return it!=hull.begin(); }
	bool cNext(iter it) { return it!=hull.end() && next(it)!=hull.end(); }

	bool bad(const line &l1, const line &l2,const line &l3) {
		return l1.intersection(l3) <= l1.intersection(l2);
	}
	bool bad(iter it) {
		return cPrev(it) && cNext(it) && bad(*prev(it), *it, *next(it));
	}

	iter update(iter it) {
		if(!cPrev(it)) return it;

		line tmp(*it); tmp.x = tmp.intersection(*prev(it));

		it = hull.erase(it);
		return hull.insert(it, tmp);
	}

	void addLine(ll k, ll b) {
		line l(k, b);

		iter it = hull.lower_bound(l);

		if(it != hull.end() && l.parallel(*it)) {
			if(it -> b < b) it = hull.erase(it);
			else return;
		}

		it = hull.insert(it, l);
		if(bad(it)) return (void) hull.erase(it);

		while(cPrev(it) && bad(prev(it))) hull.erase(prev(it));
		while(cNext(it) && bad(next(it))) hull.erase(next(it));

		it = update(it);
		if(cPrev(it)) update(prev(it));
		if(cNext(it)) update(next(it));
	}

	ll query(ll x) {
		if(hull.empty()) return -inf;

		line tmp; 
		tmp.val = x; tmp.isquery = true;
		iter it = --hull.lower_bound(tmp);

		return it -> eval(x);
	}
}ds;

ll n, c;
ll h[maxn];
ll dp[maxn];

int main() {
	cin>>n>>c;
	for(int i=1;i<=n;i++) {
		cin>>h[i];
	}

	dp[1] = 0LL;
	ds.addLine(2*h[1], -(h[1]*h[1] + dp[1]));

	// dp[i] = min(dp[j] + (h[i] - h[j])^2 + C)
	// dp[i] = min(dp[j] + h[i]^2 - 2*h[i]*2[j] + h[j]^2 + C)
	// slope: -2*h[j], extra = h[j]^2 + dp[j] 

	for(int i=2;i<=n;i++) {
		ll curr = -ds.query(h[i]);
		dp[i] = curr + c + h[i] * h[i];

		ds.addLine(2*h[i], -(h[i]*h[i] + dp[i]));
	}


	cout<<dp[n]<<"\n";

}

Measured memory_bytes: 22144
#include<bits/stdc++.h>
using namespace std;
string s,t,a="keyence";
int i;
bool fl;
int main(){
	cin>>s;
	fl=s==a;
	for(int i=0;i<a.size();++i){
		t=s;t.erase(i,s.size()-a.size());
		if(t==a)fl=1;
	}
	puts(fl?"YES":"NO");
	return 0;
}

Measured memory_bytes: 256
n, A = map(int,input().split())
x = list(map(int,input().split()))

dp = [list( [0 for _ in range(3000)] for _ in range(n+1)) for _ in range(n+1)]
dp[0][0][0] = 1


for i in range(n):
    for k in range(n):
        for s in range(sum(x)+1):
                dp[i+1][k][s] += dp[i][k][s]
                dp[i+1][k+1][s+x[i]] += dp[i][k][s]

ans = 0
for i in range(1,n+1):
    ans += dp[n][i][A*i]
print(ans)



Measured memory_bytes: 136828
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 60;

pair<map<ll, ll>, set<ll>> prime_factor(ll n){
    map<ll, ll> res;
    set<ll> primes;
    for(ll i = 2; i*i <= n; ++i) {
        if(n%i==0) primes.insert(i);

        while(n%i == 0){
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) {
        res[n] = 1;
        primes.insert(n);
    }
    return make_pair(res, primes);
}

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

    ll a, b;
    cin >> a >> b;
    
    pair<map<ll, ll>, set<ll>> pfpair_a = prime_factor(a);
    pair<map<ll, ll>, set<ll>> pfpair_b = prime_factor(b);

    map<ll, ll> pf_a = pfpair_a.first;
    map<ll, ll> pf_b = pfpair_b.first;

    int res = 1; // 1: not prime number but common divisor
    for(auto prime: pfpair_a.second){
        if(pf_a[prime]>0 && pf_b[prime]>0) ++res;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#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++)
using namespace std;
using P = pair<int, int>; 
using ll = long long;

int main()
{
  string s;
  cin >> s;
  rep(i,s.size()) cout << "x";
  cout << endl;

  return 0;
}


Measured memory_bytes: 3596
#include<stdio.h>
#define N 500000

void merge(int *, int, int, int);
void mergeSort(int *, int, int);

int count=0;

int main()
{
  int i, n, S[N];

  scanf("%d", &n);

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

  mergeSort(S, 0, n);

  for(i = 0; i < n-1; i++){
    printf("%d ", S[i]);
  }
  printf("%d\n", S[n-1]);
  printf("%d\n", count);

  return 0;
}

void merge(int *S, int left, int mid, int right)
{
  
  int n1, n2, i, j, k;
  int L[N], R[N];
  
  n1 = mid-left;
  n2 = right-mid;

  for(i = 0; i < n1; i++) L[i] = S[left + i];
  for(i = 0; i < n2; i++) R[i] = S[mid + i];

  L[n1] = 1000000000;
  R[n2] = 1000000000;
  i = j = 0;

  for(k = left; k < right; k++){
    if(L[i] <= R[j]){
      S[k] = L[i];
      i++;
    }
    else{ 
      S[k] = R[j];
      j++;
    }
    count++;
  }
}

void mergeSort(int *S, int left, int right)
{

  int mid;

  if(left+1 < right){
    mid = (left + right)/2;
    mergeSort(S, left, mid);
    mergeSort(S, mid, right);
    merge(S, left, mid, right);
  }
}

Measured memory_bytes: 4516
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
string s;
int n;
int dp[maxn][2];
int main()
{
	cin>>s;
	n = s.length();
	dp[0][0] = 0;
	dp[0][1] = 1;
	for(int i = 1; i <= n; i++)
	{
		int num = s[i - 1] - '0';
		int bor = 10 - num;
		dp[i][0] = min(num + dp[i - 1][0], bor + dp[i - 1][1]);
		dp[i][1] = min(num + 1 + dp[i - 1][0], bor + dp[i - 1][1] - 1);
	}
	cout<<dp[n][0]<<endl;
	return 0;
}
/*
36

8


91

3


314159265358979323846264338327950288419716939937551058209749445923078164062862089986280348253421170

243
*/

Measured memory_bytes: 9220
#include<bits/stdc++.h>
using namespace std;
     
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 999999999999999999
#define endl "\n"
#define MOD 1000000007
 
 
 
void func(){
 
ll n,k;
cin>>n>>k;
ll i=0,j=n,lsum=0,rsum=0,ans=0;
lsum = i;
rsum = j;
for(int a=1;a<k;a++){
  i++;
  j--;
  lsum=(lsum%MOD + i)%MOD;
  rsum=(rsum%MOD+j)%MOD;
}
for(int a=k;a<=n+1;a++){
  ans= (ans%MOD + MOD + rsum%MOD-lsum%MOD+1)%MOD;
  i++;
  j--;
  lsum=(lsum%MOD + i)%MOD;
  rsum=(rsum%MOD+j)%MOD;
}
cout<<ans<<endl;
}
 
 
 
 
    
int main(){
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
     
         /* #ifndef ONLINE_JUDGE
          freopen("input.txt", "r" , stdin);
          freopen("output1.txt", "w" , stdout);
          #endif*/
     
       ll t=1;
       //cin>>t;
       while(t--)
       func();
}

Measured memory_bytes: 3652
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
// ぜったいあきらめない
#if defined(DAIJOBU)
#include "/home/ichigo/includes.hpp"
#include "PP.hpp"
#define deb(x...) cerr << "[" << #x << "] = " << x << "\n";
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long lint;
typedef vector<lint> vlint;
typedef vector<vlint> vvlint;
typedef pair<lint, lint> plint;
typedef double ld;

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

int main() {
    ios::sync_with_stdio(false);
	cin.tie(0);
	
	int a, b;
	cin >> a >> b;
	if(a <= 5)cout << 0 << '\n';
	else if(a >= 13)cout << b << '\n';
	else cout << b / 2 << '\n';
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b)a^=b^=a^=b;
    if(a>c)a^=c^=a^=c;
    if(b>c)b^=c^=b^=c;
    printf("%d %d %d\n",a,b,c);
    return 0;
}


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

constexpr int64_t MOD = 1e9 + 7, S = 1e5 + 100;
vector<int64_t> fac(S), ifac(S);

int64_t mpow(int64_t x, int64_t n) {
    int64_t res = 1;
    while (n) {
        if (n & 1) res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}

int64_t combi(int64_t n, int64_t k) {
    return fac[n] * (ifac[k] * ifac[n-k] % MOD) % MOD;
}

int main() {
    int64_t n, m;
    cin >> n >> m;

    fac[0] = ifac[0] = 1;
    for (int i = 0; i + 1 < S; i++) {
        fac[i+1] = fac[i] * (i+1) % MOD;
        ifac[i+1] = ifac[i] * mpow(i+1, MOD-2) % MOD;
    }

    map<int64_t, int64_t> f;
    for (int i = 2; m != 1; i++) {
        while (m % i == 0) {
            f[i]++, m /= i;
        }
    }

    int64_t ans = 1;
    for (auto e : f) {
        ans = ans * combi(e.second + n - 1, e.second) % MOD;
    }

    cout << ans << endl;
}


Measured memory_bytes: 1792
N=int(input())
S=set()
B=input()
S.add(B)
for i in range(N-1) :
  A=input()
  if A not in S and A[0]==B[-1]  :
    S.add(A)
    B=A
  else :
    print("No")
    break
else :
  print("Yes")

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)1e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;

string s;
ll DP[maxn][13];
int n;
ll solve(int pos, int val){


    if(pos==n){
        return (val==5);
    }

    ll &res = DP[pos][val];
    if(res!=-1) return res;

    res=0;
    if(s[pos]!='?'){
        int c = s[pos]-'0';
        res = solve(pos+1, (val*10+c)%13);
        return res;
    }

    f0(i, 10){
        res+= solve(pos+1,(val*10+i)%13);
        res%=MOD;
    }

    return res;

}


int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    cin >> s;

    n=SZ(s);
    memset(DP, -1 , sizeof(DP));
    ll ans = solve(0,0);

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



Measured memory_bytes: 16848
#include<bits/stdc++.h>
using namespace std;
//#pragma region atcoder
//using mint = modint998244353;
//These are for segment tree
/*int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n - 1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion

const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;

template<class T>bool chmax(T &a, const T b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T b) { if (b<a) { a=b; return 1; } return 0; }
ll modpow(ll a, ll p){ll ret = 1; while(p){if(p & 1){ret = ret * a % mod;} a = a * a % mod; p >>= 1;} return ret;}

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

/*-----------------------------------------------------------------------------------------------------*/
vector<int> Zalgo(const string &s){
    int N = s.size();
    vector<int> A(N);
    A[0] = N;
    // i is the current position and j is the range in consideration
    int i = 1, j = 0;
    while(i < N){
        while(i + j < N && s[j] == s[i + j]) j++;
        A[i] = j;
        if(j == 0){i++; continue;}
        int k = 1;
        while(k < j && k + A[k] < j){
            A[i + k] = A[k];
            k++;
        }
        i += k, j -= k;
    }
    return A;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	for(int i = 0; i < n; i++){
		string t = s.substr(i, n - i);
		int tmp = 0;
		vi res = Zalgo(t);
		for(int j = 1; j < sz(res); j++){
			if(res[j] <= j) tmp = max(tmp, res[j]);
		}
		ans = max(tmp, ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 3680
n = int(input())
w = [int(i) for i in input().split()]

ans = 10000

for t in range(n):
    s1 = 0
    s2 = 0 
    for i in range(n):
        if i <= t:
            s1 += w[i]
        else:
            s2 += w[i]
    if abs(s1 - s2) < ans:
        ans = abs(s1 - s2)
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <functional>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <algorithm>

using namespace std;

const int N = 200000;

using i64 = long long;

int n;

struct Ele {
    i64 a, b;
    int operator<(const Ele &o) const {
        return (a + b) < (o.a + o.b);
    }
} e[N];

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) scanf("%lld %lld", &e[i].a, &e[i].b);
    sort(e, e + n);
    i64 ans = 0, tag = 1;
    for (int i = n - 1; i >= 0; i--) {
        if (tag == 1) {
            ans += e[i].a;
            tag = -1;
        } else {
            ans -= e[i].b;
            tag = 1;
        }
    } 
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
    auto val = table(args...);
    return vector<decltype(val)>(n, move(val));
}
const ll INF = 1e10;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200005;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    PRINT((n-1)/2+1);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define vv vector<lli>
#define vp vector<pair<lli,lli>>
#define vpp vector<pair<lli,pair<lli,lli>>>
#define lims(w) (w).begin(),(w).end()
#define rlims(w) (w).rbegin(),(w).rend()
#define pb push_back
#define mp make_pair
#define f(i,a,b) for(lli i=a;i<b;i++)
#define ff first
#define ss second
#define sz(a) (lli)(a.size())
lli inf = (1e18 + 2);

int main()
{
	lli n,k;
	cin>>n>>k;
	lli a[n+1];

	f(i,1,n+1)
	{
		cin>>a[i];
	}

	f(i,k+1,n+1)
	{	
		if(a[i] > a[i-k])
			cout<<"Yes"<<endl;
		else
			cout<<"No"<<endl;
	}

	return 0;
}


Measured memory_bytes: 5084
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    set<int> s;
    FOR(i, 0, 3) {int x; cin >> x; s.insert(x);}
    if (SZ(s) == 2)
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

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

  if (a >= 3200)
    cout << s << endl;
  else
    cout << "red" << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
#define fi first
#define se second
#define co(a) cout<<a<<endl
#define sz size()
#define bgn begin()
#define en end()
#define pb(a) push_back(a)
#define pop pop_back
#define V vector
#define P pair
#define V2(a,b,c) V<V<int>> a(b,V<int>(c))
#define V2a(a,b,c,d) V<V<int>> a(b,V<int>(c,d))
#define incin(a) int a; cin>>a
#define yuko(a) setprecision(a)
//#define min min<int>
//#define max max<int>
template<class T>
 void cou(vector<vector<T>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}
/*template<>
 void cou(vector<vector<char>> a){
  int b=a.size();
  int c=a[0].size();
  fo(i,b){
    fo(j,c){
      cout<<a[i][j];
      if(j==c-1)
        cout<<endl;
      else
        cout<<' ';
    }
  }
}*/
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
struct Union{
  vector<int> par;
  Union(int n){
	par= vector<int>(n, -1);
  }
  int find(int x){
    if(par[x]<0)
      return x;
    else
      return par[x]=find(par[x]);
  }
  bool same(int a,int b){
    return find(a)==find(b);
  }
  int Size(int a){
    return -par[find(a)];
  }
  void unite(int a,int b){
    a=find(a);
    b=find(b);
    if(a==b)
      return;
    if(Size(b)>Size(a))
      swap<int>(a,b);
    par[a]+=par[b];
    par[b]=a;
  }
};
int ketas(int a){
  string b=to_string(a);
  int c=0;
  fo(i,keta(a)){
    c+=b[i]-'0';
  }
  return c;
}
/*struct aa{
	vector<int> gt;
  aa(int n){
	gt= vector<int>(n, 1);
  }
	void c(V<int> d,int b){
	if(d[b]==0){
		gt[d[b]-1]++;
		gt[gt.sz-1]++;
	}
	else{
		gt[d[b]-1]++;
		c(d,d[d[b]]-1);
	}
}
void cok(int a){
	cout<<gt[a-1]<<endl;
	fo(i,a-1)
	cout<<gt[i]<<endl;
}
};
*/
signed main(){
	int a,b;
  cin>>a>>b;
	if(a>=b*2-1)
		cout<<"YES"<<endl;
	else
		cout<<"NO"<<endl;
}

Measured memory_bytes: 256
n = int(input())

def gcd(a,b):
  ma = max(a,b)
  mb = min(a,b)
  jy = ma % mb
  if jy == 0 :
    return mb
  else:
    return gcd(mb,jy)
sum = 0
for i in range(n):
  for j in range(n):
    for k in range(n):
      sum += gcd(i+1,gcd(j+1,k+1))

print(sum)

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

int main()
{
    std::string S;
    std::cin >> S;
    std::vector<int64_t> sign;

    char prev = S[0];
    int64_t continuous = 0;
    for (int64_t i = 0; i < S.size(); ++i)
    {
        if (S[i] == '<')
        {
            if (prev != S[i])
            {
                sign.emplace_back(continuous);
                prev = S[i];
                continuous = 0;
            }
            ++continuous;
        }
        else
        {
            if (prev != S[i])
            {
                sign.emplace_back(continuous);
                prev = S[i];
                continuous = 0;
            }
            --continuous;
        }
    }
    sign.emplace_back(continuous);

    int64_t num = 0, sum = 0;
    for (int64_t i = 0; i < sign.size(); ++i)
    {
        int64_t tmp = sign[i];
        if (tmp > 0)
        {
            sum += tmp * (tmp - 1) / 2;
            num = tmp;
        }
        else
        {
            tmp = -tmp;
            sum += tmp * (tmp - 1) / 2;
            if (num < tmp)
                num = tmp;
            sum += num;
        }
    }
    if (sign.at(sign.size() - 1) > 0)
        sum += num;

    std::cout << sum;
}

Measured memory_bytes: 3068
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define PI 				acos(-1)
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define MOD1			998244353
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
using namespace __gnu_pbds;

typedef long long 		ll;
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1e9+7;
const double EPS = 1e-9;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("qwe.txt", "r", stdin);
	//freopen("asd.txt", "w", stdout);
	int a, b, c;
	cin>>a>>b>>c;
	int res = 0;
	if(a % 2 != b % 2 && a % 2 != c % 2)
	{
		b++;
		c++;
		res++;
	}
	if(a % 2 != b % 2 && b % 2 != c % 2)
	{
		a++;
		c++;
		res++;
	}
	if(c % 2 != b % 2 && a % 2 != c % 2)
	{
		a++;
		b++;
		res++;
	}
	int maxi = max(a, max(b, c));
	cout<< res + (3 * maxi - a - b - c) / 2<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2

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

struct BIT{
    int size;
    vector<int> bit;
    void init(int n){
        size = n;
        bit.assign(size+1, 0);
    }

    // from 1 to x (inclusive)
    int sum(int x){
        int res = 0;
        while(x > 0){
            res += bit[x];
            x -= (x & -x);
        }
        return res;
    }

    void add(int x, int y){
        while(x <= size){
            bit[x] += y;
            x += (x & -x);
        }
    }
};

long long inv_num(int n, vector<int> array){
    long long res = 0;
    vector<int> v;
    BIT b;
    b.init(n);
    v.assign(array.begin(), array.end());
    sort(v.begin(), v.end());
    auto tmp = unique(v.begin(), v.end());
    v.erase(tmp, v.end());
    for(int i=0;i<n;i++){
        int val = (int)(lower_bound(v.begin(), v.end(), array[i]) - v.begin()) + 1;
        res += i - b.sum(val);
        b.add(val, 1);
    }
    return res;
}

bool judge(long long n, int *ar, int x){
    vector<int> v;
    v.push_back(0);
    for(int i=0;i<n;i++){
        int t = 1;
        if(*(ar+i) < x)t = -1;
        v.push_back(v[i] + t);
    }
    long long y = n*(n+1)/2 - inv_num(n+1, v);
    /*cout << n << " " << x << " " << inv_num(n+1, v) << endl;
    for(int i=0;i<v.size();i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;*/
    return (y >= (n*(n+1)/2+1)/2);
}

int main(void){
    int n, left, right;
    int ar[100000];
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> ar[i];
    }
    left = 1;
    right = 1e9+1;
    while(left + 1 < right){
        int mid = (left + right) / 2;
        if(judge(n, ar, mid)){
            left = mid;
        }else{
            right = mid;
        }
    }
    cout << left << endl;
}


Measured memory_bytes: 2380
fn read<T: std::str::FromStr>() -> T {
  let mut s = String::new();
  std::io::stdin().read_line(&mut s).ok();
  s.trim().parse().ok().unwrap()
}

fn main() {
  let n: u64 = read();
  let ans = ((n - 1) * n) / 2;

  println!("{}", ans);
}


Measured memory_bytes: 4352
#include <iostream>
#include <map>


using namespace std;

int main(){
  int k, ans=0, t=0;
  map<int, int> cnt;
  for(int i=0; i < 5; i++){
    cin >> k;
    if (k % 10 == 0){
      cnt[k] = k;
      ans += cnt[k];
    }else {
      cnt[k] = 10 - (k % 10);
      ans += cnt[k] + k;
      if(t <= cnt[k]) t = cnt[k];
    }
  }

  cout << ans - t << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;
int gcd(int a, int b) {
  if(a < b)
    return gcd(b, a);
  
  int r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main(){
int a, b, k, i, j=0, c;

cin >> a >> b >> k;
  c=gcd(a, b);
  for(i=c;;i--){
  if(a%i==0&&b%i==0)
    j++;
    if(j==k)
      break;
  }
cout <<i;
return 0;
}

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

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    sort(A.begin(), A.end());
    int amin = A[0], amax = A[N-1];
    // int l = 0, r = N-1;

    vector<P> ans;
    repr(i, 1, N-1) {
        if (A[i] < 0) {
            ans.emplace_back(amax, A[i]);
            amax -= A[i];
        } else {
            ans.emplace_back(amin, A[i]);
            amin -= A[i];
        }
    }
    cout << abs(amax - amin) << endl;
    ans.emplace_back(amax, amin);
    rep(i, ans.size()) {
        cout << ans[i].first << " " << ans[i].second << endl;
    }
    return 0;
}

Measured memory_bytes: 3188
#include <iostream>
#include <cstdio>
#include <cstring>
#include <math.h>

using namespace std;

int main()
{
    long long x,y,sum;
    scanf("%lld %lld",&x,&y);
    //cin>>x>>y;
    sum=y;
    int i=1;
    while(sum>=x)
    {
        sum=sum/2;
        i++;
    }
    printf("%d\n",i-1);
    return 0;
}


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

using namespace std;

const int INF = 1e9;

int k,i,j,dist[100005];
vector <pair<int, int> > edge[100005];

priority_queue <int, vector<int>, greater<int> > pq;

int main(){
	scanf("%d", &k);
	
	for(i = 0; i < k; i++){
		edge[i].push_back({(i + 1) % k, 1});
		edge[i].push_back({(i * 10) % k, 0});
		dist[i] = INF;
	}
	
	dist[1] = 1;
	pq.push(1);
	
	while(pq.size()){
		int now = pq.top();
		pq.pop();
		
		for(int k = 0; k < edge[now].size(); k++){
			int to = edge[now][k].first;
			int cost = edge[now][k].second;
			
			if(dist[to] > dist[now] + cost){
				dist[to] = dist[now] + cost;
				pq.push(to);
			}
		}
	}
	
	printf("%d\n", dist[0]);
}


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

using namespace std;
using ll = long long;
using edge = struct {int to; ll cost;};

#define mod 1000000007
#define REP(i, n) for (int i = 0; i < n; i++)
#define INF (1 << 29)


//long C(long n, long r);
//long long gcd(long long a, long long b);
//long long lcm(long long a, long long b);


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

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

Measured memory_bytes: 256
sx, sy, tx, ty = gets.split.map(&:to_i)

dx = tx - sx
dy = ty - sy

# path1
path = 'U' * dy + 'R' * dx
# path2
path += 'D' * dy + 'L' * dx
# path3
path += 'L' + 'U' * (dy + 1) + 'R' * (dx + 1) + 'D'
# path4
path += 'R' + 'D' * (dy + 1) + 'L' * (dx + 1) + 'U'

puts path


Measured memory_bytes: 1916
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int M = stdIn.nextInt();
        int D = stdIn.nextInt();
        int answer = 0;
        for(int j = 1; j <= M; j++){
            for(int i = 22; i <= D; i++){
                int[] a = new int[2];
                a[0] = i/10;
                a[1] = i%10;
                if( a[0] >= 2 && a[1] >= 2){
                    if(a[0] * a[1] == j) answer++;
                }
            }
        }
        System.out.println(answer);
    }
}

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

int main(){ 
    int n;
    cin >> n;
    int dare[n][n];
    int judge[n][n];
    int shougen[n];
    for(int i = 0; i < n; i++){
        cin >> shougen[i];
        for(int j = 0; j < shougen[i]; j++){
            int x,y;
            cin >> x >> y;
            dare[i][j] = x-1;
            judge[i][j] = y;
        }
    }
    int ans = 0;
    for(int bit = 0; bit < (1 << n); bit++){
        bool flag = true;
        int temp = 0;
        for(int j = 0; j < n; j++){            
            if(bit & (1 << j)){//もしj番目の人間が正直なら
                temp++;
                for(int k = 0; k < shougen[j]; k++){
                    int x = dare[j][k];
                    int y = judge[j][k];
                    if(bit & (1 << x)){
                        //bit上でxが正直なとき
                        if(y == 1){
                            //問題なし
                        }else{
                            flag = false;
                            break;
                        }
                    }else{
                        if(y == 0){

                        }else{
                            flag = false;
                            break;
                        }
                    }
                }
            }
        }
        if(flag){
            ans = max(ans,temp);   
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 256
/*
Problem 0047 : Cup Game
*/
#include <stdio.h>

int main(void){
	int cup[3] = {1 , 0 , 0};
	char x , y;
	int x2 , y2 , buf , i;
	while(scanf("%c,%c%*c" , &x , &y)!=EOF){
		x2 = x - 'A';
		y2 = y - 'A';
		buf = cup[x2];
		cup[x2] = cup[y2];
		cup[y2] = buf;		
	}
	for(i=0;;i++){
		if(cup[i]==1){
			printf("%c\n" , i + 'A');
			break;
		}
	}
return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <algorithm>
#include <map>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;
typedef queue<int> qi;
typedef queue<ii> qii;
typedef vector<string> vs;
typedef pair<ll, ll> iil;
typedef vector<iil> viil;
typedef vector<vi> vvi;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)
#define INF 1000000000

void solve() {
    int n;
    cin >> n;
    vi a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    int i = 0;
    vi b;
    
    b.pb(a[0]);
    
    ll ssm = 0;
    for (int i = 1 ; i < n ; i++) {
        ssm += b[i-1];
        b.pb(a[i]);
        b.pb(a[i]);
    }
    //rep(i, b.size()) cout << b[i] << " ";
    //cout << endl;
    cout << ssm << '\n';
}

void querySolve() {
    int n;
    cin >> n;
    while (n--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();

}


Measured memory_bytes: 6144
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){ 
    int n,c=0,i,j,s=0;
    cin>>n;
    for (int i=1;i<=n;i++){
        s += i;
        c++;
        if (s>=n) break;
    }
    cout << c << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<string> vs;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e9 + 5;
int main(){
    int n;
    cin >> n;
    string s;
    vs firstv; // для того чтобы сохранять туда strings
    FOR(i, 0, n){
        cin >> s;
        sort(all(s)); // каждый стринг делаю сорт по буквам чтобы, потом найти равных
        firstv.pb(s); // в этом векторе стринги сортированы, но не стоят по порядку
    }
    sort(all(firstv)); // сортировка в векторе по алфавиту и еще каждый стринг сортирован по буквам
    int quantity = 0;
    vi secondv; // вектор для чтобы узнать количество равных стрингов
    for(int i = 1; i < n; i++){
        if(firstv[i-1]==firstv[i]){
            quantity++; // если будут одинаковые то будут суммироваться
            if(i == (n-1) && quantity != 0){
                secondv.pb(quantity);
            }
        }
        else{
            if(quantity!=0){
                secondv.pb(quantity);
            }
            quantity = 0;
        }
    }
    /*for(int i = 0; i < secondv.size(); i++){
        cout << secondv[i] << " ";
    }*/ 
    vl thirdv;
    ll sum = 0;
    for(int i = 0; i < secondv.size(); i++){
        for(int j = 1; j <= secondv[i]; j++){
            sum+=(ll)j;
        }
        thirdv.pb(sum);
        sum = 0;
    }
    /*for(int i = 0; i < thirdv.size(); i++){
        cout << thirdv[i] << " ";
    }*/
    ll finish = 0;
    for(int i = 0; i < thirdv.size(); i++){
        finish+=(ll)thirdv[i];
    }
    cout << finish;
    return 0;
}

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

int main() {
  int a,b,sum = 0;
  cin >> a >> b;
  if (a > b){
    sum += a;
    a--;
    if (a > b)
      sum += a;
    else
      sum += b;
  }
  else{
    sum += b;
    b--;
    if (a > b)
      sum += a;
    else
      sum += b;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
//
// Created by karayuu on 2018-12-24.
//

int main() {
    while (true) {
        int h, w;
        cin >> h >> w;

        if (h == 0 && w == 0) {
            break;
        }

        for (int i = 1; i <= h; i++) {
            string s;
            if (i % 2 == 1) {
                //奇数行
                for (int j = 1; j <= w; j++) {
                    if (j % 2 == 1) {
                        //奇数行の奇数番目
                        s += '#';
                    } else {
                        //奇数行の偶数番目
                        s += ".";
                    }
                }
            } else {
                //偶数行
                for (int j = 1; j <= w; j++) {
                    if (j % 2 == 1) {
                        //偶数行の奇数番目
                        s += ".";
                    } else {
                        //偶数行の偶数番目
                        s += "#";
                    }
                }
            }
            cout << s << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3184
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<climits>
#include<map>

using namespace std;

int main(){

	int X,Y,Z;

	cin >> X >> Y >> Z;

	int size = X - 2*Z;

	int amari = size%(Y+Z);

	int count = size/(Y+Z);

	if(amari >= Y){
		count++;
	}

	cout << count << endl;


    return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define loop(i, a, n) for(int i = (a); i < (n); i++)
#define sorn(i, n) char((i == n-1)?'\n':' ')
#define dd(x) cout << #x << " : " << x << endl
using namespace std;
using ll = int64_t;
using P = pair<int, int>;

struct DisjointSet
{
    int g;
    vector<int> rank, p, size;
    DisjointSet(){}
    DisjointSet(int len){
        rank.resize(len, 0);
        p.resize(len, 0);
        size.resize(len, 0);
        rep(i, len) make_set(i);
    }
    void make_set(int x){
        p[x] = x;
        rank[x] = 0;
        size[x] = 1;
    }
    bool same(int x, int y){
        return find_set(x) == find_set(y);
    }
    int find_set(int x){
        if(x != p[x]) p[x] = find_set(p[x]);
        return p[x];
    }
    void unite(int x, int y){
        link(find_set(x), find_set(y));
    }
    void link(int x, int y){
        if(rank[x] > rank[y]) {
            p[y] = x;
            size[x] += size[y];
        } else {
            p[x] = y;
            if(rank[x] == rank[y]) rank[y]++;
            size[y] += size[x];
        }
    }
    int get_parent(int i){
        return p[i];
    }
    int get_rank(int i){
        return rank[i];
    }
    int get_size(int i){
        return size[i];
    }
};

int main(){
    int n, m, k; cin >> n >> m >> k;
    P fpair[m];
    vector<int> fg[n], bg[n];
    DisjointSet friends(n);
    rep(i, m) {
        int a, b; cin >> a >> b;
        --a; --b;
        fg[a].push_back(b);
        fg[b].push_back(a);
        if(!friends.same(a, b)) friends.unite(a, b);
    }
    rep(i, k) {
        int c, d; cin >> c >> d;
        --c; --d;
        bg[c].push_back(d);
        bg[d].push_back(c);
    }
    rep(u, n){
        int cntf = 0, cntb = 0;
        for(int v : fg[u]) if(friends.same(u, v)) cntf++;
        for(int v : bg[u]) if(friends.same(u, v)) cntb++;
        int p = friends.get_parent(u);
        int s = friends.get_size(p);
        cout << (s - cntf - cntb - 1) << sorn(u, n);
    }

    return 0;
}

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

if H%2==0:
    if W%2==0:
        ans=W//2*H
    else:
        ans=H//2*W
else:
    if W%2==0:
        ans=W//2*H
    else:
        ans=(W//2+1)*H-H//2

if H==1 or W==1:
    ans=1
    
print(ans)

Measured memory_bytes: 9076
#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <complex>
#include <fstream>
#include <functional>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using std::cin;
using std::cout;
using std::endl;

//#define _DEBUG_ 7

void run() {
	int x; cin >> x;

	int n;
	for (int i = 0; i < 1000000000; i++) {
		if (i * (i + 1) >= 2 * x) {
			n = i;
			break;
		}
	}

	cout << n << endl;
	

}

int main() {
#ifdef _DEBUG_
	using std::chrono::system_clock;
	using std::chrono::duration_cast;
	system_clock::time_point  start, end;
	std::ifstream in("input.txt");
	cin.rdbuf(in.rdbuf());
	for (int i = 0; i < _DEBUG_; i++) {
		cout << "-------------------------- (cnt:" << i << ")" << endl;
		start = system_clock::now();
		run();
		end = system_clock::now();
		int elapsed = duration_cast<std::chrono::milliseconds>(end - start).count();
		cout << "-------------------------- (time:" << elapsed << "ms)" << endl << endl;
	}
#else
	run();
#endif
	return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int m = sc.nextInt();
	String[] a = new String[n];
	String[] b = new String[m];
	for(int i = 0; i < n; i++) {
		a[i] = sc.next();
	}
	for(int i = 0; i < m; i++) {
		b[i] = sc.next();
	}
	boolean exist = false;
	for(int i = 0; i <= n - m; i++) {
		for(int j = 0; j <= n - m; j++) {
			boolean match = true;
			for(int k = 0; k < m; k++) {
				for(int l = 0; l < m; l++) {
					if(a[i + k].charAt(j + l) != b[k].charAt(l)) {
						match = false;
					}
				}
			}
			if(match) {
				exist = true;
			}
		}
	}
	if(exist) {
		System.out.println("Yes");
	} else {
		System.out.println("No");
	}
}
}


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

int main() {
  int A, P;
  cin >> A >> P;
  int piece = P+3*A;
  cout << piece/2 << endl;
  return 0;
}


Measured memory_bytes: 256