akhauriyash/Code-Regression huggingface dataset:
/*       _________
        /|______/ \
        ||  _|_|\  |
        || |_|   | /
        ||    _ / |
        ||  _| \\  \    
        ||_|_|\ || |
        |/_|/ | /|_/
              /__/      Written by: Rishabh Roshan
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define int            	long long
#define tree 			ped
#define integer        	int32_t
#define mod         	1000000007
#define vint        	vector<int>
#define pint        	pair<int, int>
#define umint        	unordered_map<int, int>
#define mint        	map<integer, integer>
#define in(x)        	int x; cin>>x
#define setbits(x)    	__builtin_popcountll(x)
#define zerobits(x)    	__builtin_ctzll(x)
#define w(x)        	int x; cin>>x; while(x--)
#define sp(x, y)    	fixed<<setprecision(y)<<x
#define poll(x)        	x.front(); x.pop()
#define f(x)        	for(int i=0; i<x; i++)
#define fj(x)			for(int j=0; j<x; j++)
#define fn(n, x)		for(int i=n; i<x; i++)
#define endl         	'\n'
#define inf         	1e9 
#define order_set     	tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

// #include "functions.h"

void om_shree_ganeshaya_namah(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}

void print(vector<vint> arr){
	f(arr.size()){
		fj(arr[i].size()) cout<<arr[i][j]<<" ";
		cout<<endl;
	}
	cout<<endl;
}

void multiply(vector<vint> &arr, vector<vint> mat){
	int n = arr.size(), a=0;
	vector<vint> ans(n, vint(n));

	for(int k=0; k<n; k++){
		for(int i=0; i<n; i++){
			for(int j=0; j<n; j++){
				a += (arr[k][j]*mat[j][i])%mod;
				a%=mod;
			}
			ans[k][i] = a;
			a=0;
		}
	}
	arr = ans;
}

int32_t main() {

    om_shree_ganeshaya_namah();

    in(n); in(k);
    vector<vint> arr(n, vint(n)), dp(n, vint(n));
    f(n) fj(n) cin>>arr[i][j];

    f(n) dp[i][i]=1;

    while(k){
    	if(k&1)
    		multiply(dp, arr);
    	multiply(arr, arr);
    	k>>=1;
    }
    
    int ans=0;
    f(n) fj(n){
    	ans+=dp[i][j];
    	ans%=mod;
    }
    cout<<ans;
}

Measured memory_bytes: 3740
#include <bits/stdc++.h>
#include "atcoder/all"
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
using namespace atcoder;
#define all(a) a.begin(),a.end()
typedef long long ll;
#define vi vector<ll>
typedef pair<ll,ll>P;
const ll inf=1ll<<61;
int x[200006],y[200006];
int X[200006],Y[200006];
signed main(){
	int n;cin>>n;
	rep(i,n){
		cin>>x[i]>>y[i];
		x[i]--;y[i]--;
		Y[x[i]]=y[i];
		X[y[i]]=x[i];
	}
	dsu d(n);
	set<int>S;
	rep(i,n){
		if(S.empty()){
			S.insert(Y[i]);
		}
		else{
			auto j=S.begin();
			if(*j>Y[i])S.insert(Y[i]);
			else{
				int z=1e9;
				while(S.size()){
					auto itr=S.begin();
					if(*itr>Y[i])break;
					d.merge(i,X[*itr]);
					z=min(z,*itr);
					S.erase(itr);
				}
				S.insert(z);
			}
		}
	}

	rep(i,n){
		cout<<d.size(x[i])<<endl;
	}
}

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

using namespace std;
#define ll long long
#define FOR(i, a, b) for (ll i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define PRINT(item) cout << (item) << endl;
#define PRINT_VEC(V) \
    for (auto v : (V)) cout << v << ' ';
/* cout << fixed << setprecision(10) << decimal << endl; */

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

template <int MOD>
struct ModInt {
    static const int Mod = MOD;
    unsigned x;
    ModInt() : x(0) {}
    ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
    int get() const { return (int)x; }
    ModInt &operator+=(ModInt that) {
        if ((x += that.x) >= MOD) x -= MOD;
        return *this;
    }
    ModInt &operator-=(ModInt that) {
        if ((x += MOD - that.x) >= MOD) x -= MOD;
        return *this;
    }
    ModInt &operator*=(ModInt that) {
        x = (unsigned long long)x * that.x % MOD;
        return *this;
    }
    ModInt &operator/=(ModInt that) { return *this *= that.inverse(); }
    ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
    ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
    ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
    ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
    ModInt inverse() const {
        long long a = x, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            std::swap(a, b);
            u -= t * v;
            std::swap(u, v);
        }
        return ModInt(u);
    }
    bool operator==(ModInt that) const { return x == that.x; }
    bool operator!=(ModInt that) const { return x != that.x; }
    ModInt operator-() const {
        ModInt t;
        t.x = x == 0 ? 0 : Mod - x;
        return t;
    }
};
template <int MOD>
ostream &operator<<(ostream &st, const ModInt<MOD> a) {
    st << a.get();
    return st;
};
template <int MOD>
ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
    ModInt<MOD> r = 1;
    while (k) {
        if (k & 1) r *= a;
        a *= a;
        k >>= 1;
    }
    return r;
}
using mint = ModInt<1000000007>;

mint count(int n, int k) {
    mint res = 1;
    REP(i, k) { res *= n - i; }
    FOR(i, 1, k + 1) { res /= i; }
    return res;
}

int main() {
    /* code */
    ll n, a, b;
    cin >> n >> a >> b;
    mint ans = (mint(2) ^ n) - 1;
    ans -= count(n, a);
    ans -= count(n, b);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*
	f(v, d, d1):- d = d + w(P[v], v), d1

*/
#include <bits/stdc++.h>

using namespace std;
const int maxv = 100001;
vector< pair<int, int> > A[maxv], T[maxv];
int P[maxv], solve;
int a, b, c, N, root;


void tree_build( const int &v, const int &parent ){

	vector< pair<int, int> >::iterator x = A[v].begin();

	for( ; x != A[v].end(); ++x ){
	    if( x->first == parent )
	    	continue;
		T[v].push_back( *x ),
		tree_build( x->first, v );
	}
}

void sol( const int &v, int &len ){

    vector< pair<int, int> >::iterator x = T[v].begin();

    int tplen = 0;
    int ch1 = 0;
    int ch2 = 0;
    for( ; x != T[v].end(); ++x ){
		tplen = x->second;
		sol( x->first, tplen );
		if( ch1 <= tplen ){
			ch2 = ch1;
			ch1 = tplen;
		}else
		if( ch2 < tplen )
			ch2 = tplen;
	}

	solve = max( solve, ch1 + ch2 );
	len += ch1;
}

int main( void ){

	//freopen("input.in", "r", stdin);
	scanf( "%d", &N );

	for( int i = 1; i < N; ++i )
		scanf( "%d%d%d", &a, &b, &c ), 
		++a, 
		++b,
		P[b] = a,
		A[a].push_back( make_pair( b, c ) ),
		A[b].push_back( make_pair( a, c ) );


	for( int i = 1; i <=N && !root; ++i )
		root = ( !P[i] )?i:root;	

	tree_build( root, solve );
	int len = 0;
	sol( root, len );

	printf("%d\n", solve);

	return 0;
}

Measured memory_bytes: 18756
fun main(args: Array<String>) {
    sumitrust2019b()
}

fun sumitrust2019b() {
    val n = readLine()!!.toLong()

    for (i in 1..n) {
        val price = Math.floor(i.toDouble() * 1.08).toLong()
        if (price == n) return println(i)
    }

    println(":(")
}


Measured memory_bytes: 31680
//Bismillahir rahmanir rahim
#include<bits/stdc++.h>
#define ll long long
#define eps 0.000000001
using namespace std;


int main()
{   //freopen("in.txt","r",stdin);

    std::ios_base::sync_with_stdio(0);cin.tie(NULL);
    int r,d,x;
    cin>>r>>d>>x;
    int t =10;
    while(t--){
        int ans = r*x -d;
        cout<<ans<<endl;
        x = ans;

    }

}


Measured memory_bytes: 256
;; -*- coding: utf-8 -*-
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defmacro dbg (&rest forms)
  #+swank
  (if (= (length forms) 1)
      `(format *error-output* "~A => ~A~%" ',(car forms) ,(car forms))
      `(format *error-output* "~A => ~A~%" ',forms `(,,@forms)))
  #-swank (declare (ignore forms)))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(declaim (inline println))
(defun println (obj &optional (stream *standard-output*))
  (let ((*read-default-float-format* 'double-float))
    (prog1 (princ obj stream) (terpri stream))))

(defconstant +mod+ 1000000007)

;; Body

(defun main ()
  (let* ((n (read))
         (k (read))
         (s (read-line)))
    (setf (aref s (- k 1)) (char-downcase (aref s (- k 1))))
    (write-line s)))

#-swank(main)


;; For Test
#+swank
(defun io-equal (in-string out-string &optional (func #'main))
  (labels ((ensure-last-lf (s)
             (if (and (> (length s) 0)
                      (eql (char s (- (length s) 1)) #\Linefeed))
                 s
                 (uiop:strcat s uiop:+lf+))))
    (equal (ensure-last-lf out-string)
           (with-output-to-string (out)
             (let ((*standard-output* out))
               (with-input-from-string (*standard-input* (ensure-last-lf in-string))
                 (funcall func)))))))

#+swank
(defun get-clipbrd ()
  (with-output-to-string (out)
    (run-program "C:/msys64/usr/bin/cat.exe" '("/dev/clipboard") :output out)))

#+swank (defparameter *this-pathname* (uiop:current-lisp-file-pathname))
#+swank (defparameter *dat-pathname* (uiop:merge-pathnames* "test.dat" *this-pathname*))

#+swank
(defun run (&optional thing (out *standard-output*))
  (let ((*standard-output* out))
    (etypecase thing
      (null ; Runs #'MAIN with the string on clipboard
       (with-input-from-string (*standard-input* (delete #\Return (get-clipbrd)))
         (main)))
      (string
       (with-input-from-string (*standard-input* (delete #\Return thing))
         (main)))
      (symbol (5am:run! thing))
      (pathname ; Runs #'MAIN with the string in a text file
       (with-open-file (*standard-input* thing)
         (main))))))

#+swank
(defun gen-dat ()
  (uiop:with-output-file (out *dat-pathname* :if-exists :supersede)
    (format out "")))

#+swank
(defun bench (&optional (out (make-broadcast-stream)))
  (time (run *dat-pathname* out)))


Measured memory_bytes: 15460
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a = 0, b, c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> s;
  rep(i, 0, s.size())
  {
    if (s[i] == '9')
      a++;
  }
  // cout << a << endl;
  if (s.size() != 1)
  {
    if (a == s.size() - 1 && s[0] != '9')
    {
      ans = (s.size() - 1) * 9 + ((s[0] - '0'));
      cout << ans << endl;
    }
    else if (a == s.size())
    {
      ans = (s.size()) * 9;
      cout << ans << endl;
    }
    else
    {
      ans = (s.size() - 1) * 9 + ((s[0] - '0') - 1);
      cout << ans << endl;
    }
  }
  else
  {
    cout << s << endl;
  }
}

Measured memory_bytes: 256
s = input().split()
sa,sb = s[0],s[1]
a,b = int(sa),int(sb)
ap = int(sa[0]+sa[1]+sa[2]+sa[1]+sa[0])
bp = int(sb[0]+sb[1]+sb[2]+sb[1]+sb[0])
da = int(a/100)
db = int(b/100)
if ap < a:
    da += 1
if b < bp:
    db -= 1

print(db-da + 1)

Measured memory_bytes: 3064
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<string>
#include<algorithm>
#include<iostream>
#include<bitset>
#include<functional>
#include<numeric>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<cmath>
#include<iomanip>
#include<random>
#include<ctime>
#include<complex>
using namespace std;
typedef long long LL;
typedef double D;
#define all(v) (v).begin(), (v).end()
mt19937 gene(233);
typedef complex<double> Complex;
#define fi first
#define se second
#define ins insert
#define pb push_back
inline char GET_CHAR(){
	const int maxn = 131072;
	static char buf[maxn],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,maxn,stdin),p1==p2)?EOF:*p1++;
}
inline int getInt() {
	int res(0);
	char c = getchar();
	while(c < '0') c = getchar();
	while(c >= '0') {
		res = res * 10 + (c - '0');
		c = getchar();
	}
	return res;
}

inline LL fastpo(LL x, LL n, LL mod) {
	LL res(1);
	while(n) {
		if(n & 1) {
			res = res * (LL)x % mod;
		}
		x = x * (LL) x % mod;
		n /= 2;
	}
	return res;
}
LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }

inline string itoa(int x, int width = 0) {
  string res;
  if(x == 0) res.push_back('0');
  while(x) {
    res.push_back('0' + x % 10);
    x /= 10;
  }
  while((int)res.size() < width) res.push_back('0');
  reverse(res.begin(), res.end());
  return res;
}
const int _B = 131072;
char buf[_B];
int _bl = 0;
inline void flush() {
	fwrite(buf, 1, _bl, stdout);
	_bl = 0;
}
__inline void _putchar(char c) {
	if(_bl == _B) flush();
	buf[_bl++] = c;
}
inline void print(LL x, char c) {
	static char tmp[20];
	int l = 0;
	if(!x) tmp[l++] = '0';
	else {
		while(x) {
			tmp[l++] = x % 10 + '0';
			x /= 10;
		}
	}
	for(int i = l - 1; i >= 0; i--) _putchar(tmp[i]);
	_putchar(c);
}
struct P {
	D x, y;
};
const int N = 300033;
const int LOG = 20;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
int n, m;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int calc(int l, int d) {
	return l / d;
}
int main() {
	int l, r, d;
	cin >> l >> r >> d;
	cout << calc(r, d) - calc(l - 1, d) << endl;
}






Measured memory_bytes: 3628
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = list(iss())
    B = list(iss())
    print('YES' if A[2] == B[0] and A[1] == B[1] and A[0] == B[2] else 'NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define MAX 1000000000000000
#define all(v) v.begin(),v.end()
#define rep(i,a,b) for(i=(ll)a;i<(ll)b;i++)
#define revrep(i,a,b) for(i=(ll)a;i>=(ll)b;i--)
#define ii pair<ll,ll>
#define MP make_pair
#define pb push_back
#define f first
#define se second
#define ll long long int
#define vi vector<ii>
ll modexp(ll a,ll b){ ll res = 1; while(b > 0){  if(b & 1) res = (res * a);  a = (a * a);  b/=2;  }  return res; }
#define rs resize
long long readLI(){  register char c;  for(c = getchar(); !(c>='0' && c<='9'); c = getchar());  register long long a=c-'0';
    for(c = getchar(); c>='0' && c<='9'; c = getchar())
        a = (a<<3)+(a<<1)+c-'0';
    return a;
}
const ll N = 10,M = 209;
ll a,b,n,i,m,st=1,j,ans;
ll d[N][N],visit[N],v[M][M],c[N][N];
priority_queue<ii,vector<ii>,greater<ii> > pq;
int main()
{
    std::ios_base::sync_with_stdio(false); cin.tie(NULL);
    cin>>n>>m;
    rep(i,0,N){
        rep(j,0,N) d[i][j] = MAX,cin>>c[i][j];
        d[i][i] = 0;
    }
    rep(i,0,n) rep(j,0,m) cin>>v[i][j];
    rep(i,0,N){
      pq.push({0,i});
      while(!pq.empty()){
          ii u = pq.top();
          a = u.f; b = u.se;
          pq.pop();
          if(visit[b] == st) continue;
          visit[b] = st;
          rep(j,0,N) if(visit[j] != st and d[i][j] > a + c[b][j]){
              d[i][j] = a + c[b][j];
              pq.push({d[i][j],j});
          }
       }
       st++;
    }
    rep(i,0,n) rep(j,0,m) if(v[i][j] != -1) ans += d[v[i][j]][1];
    cout<<ans;
    return 0;
}

Measured memory_bytes: 640
n, L = map(int, raw_input().split())
dp = [0] * (n+2)
l = [0]
for i in range(n):
    l += [input()]
    dp[i+1] = L - l[i+1]
l += [0]
for i in range(1,n+1):
    if l[i] < l[i-1]: dp[i] = dp[i-1] + (L - l[i])
ans = 0
for i in range(n,0,-1):
    if l[i] < l[i+1]:
        dp[i] = max(dp[i], dp[i+1] + (L - l[i]))
    ans = max(ans, dp[i])
print ans

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

int abs(int k) {
	return k>0?k:-k;
}
int dd(int q, int w, int e) {
	return abs(w-q) + abs(e-w);
}
int main() {
	int a,b,c;
	cin>>a>>b>>c;
	int ans1 = min(dd(a,b,c), dd(a,c,b));
	int ans2 = min(dd(b,a,c), dd(b,c,a));
	int ans3 = min(dd(c,a,b), dd(c,b,a));
	cout<<min(ans1, min(ans2, ans3))<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ff        first
#define ss        second
#define ll        long long
#define int       long long
#define inf       ((ll)1e18)
#define mod       1000000007
#define double    long double
#define ull       unsigned long long
#define vi        vector<ll>
#define ppi       pair<int,int>
#define pii       pair<pair<int,int>,int>
#define pb        push_back
#define pi        2*acos(0.0)
#define rev       greater<int>()
#define pr(a,x,y) for(int i=x;i<y;i++){cout<<a[i]<<" ";}
#define sp(x,y)   fixed<<setprecision(y)<<x
#define w(x)      ll x; cin>>x; while(x--)
#define all(v)    v.begin(), v.end()
#define rall(v)   v.rbegin(), v.rend()
#define test      cout<<"This is test"<<endl;
#define str       string
#define endl      '\n'
#define e         cout<<'\n';
void kehsihba(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif*/
}
bool get(int a,int b,int c){
	if(a==b or b==c or c==a){return 0;}
	if(a+b>c and b+c>a and a+c>b){return 1;}
	return 0;
}
void solve(){
	ll n;cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++){cin>>arr[i];}
	ll ans=0;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n;j++){
			for(int k=j+1;k<n;k++){
				if(get(arr[i],arr[j],arr[k])){ans+=1;}
			}
		}
	}
	cout<<ans;
}
int32_t main() {
	kehsihba();
	ll t=1;
	//cin>>t;
	for(int k=1;k<=t;k++){
		solve();
	}
}


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

int INF = 1000000000;

class SegmentTree {
public:
	vector<int>dat; int size_ = 1;
	
	void init(int sz) {
		while (size_ < sz) size_ *= 2;
		dat.resize(size_ * 2, INF);
	}
	void update(int pos, int a) {
		pos += size_;
		dat[pos] = a;
		while (pos >= 2) {
			pos /= 2;
			dat[pos] = min(dat[pos * 2], dat[pos * 2 + 1]);
		}
	}
	vector<int>query_(int a, int u) {
		if (dat[u] > a) return vector<int>{};
		if (u >= size_) return vector<int>{u - size_};
		vector<int>V1 = query_(a, u * 2);
		vector<int>V2 = query_(a, u * 2 + 1);
		vector<int>V3 = V1;
		for (int i = 0; i < V2.size(); i++) V3.push_back(V2[i]);
		return V3;
	}
	vector<int>query(int a) {
		return query_(a, 1);
	}
};

int N, A[100009], C[100009], E[300009]; string S;

int solve(int U) {
	for (int i = 1; i <= N; i++) {
		if (A[i] >= U) C[i] = 1; else C[i] = 0; E[i] = 0;
	}
	SegmentTree X1, X2; set<int> L1, R1, L2, R2;
	X1.init(N + 3); X2.init(N + 3);

	int s = -1;
	for (int i = 1; i <= N + 1; i++) {
		if (C[i] == 1 && s == -1) s = i;
		if (C[i] == 0 && s != -1) {
			X1.update(s, i - s); L1.insert(-s); R1.insert(s);
			s = -1;
		}
	}
	int ss = (1 << 30);
	for (int i = 1; i <= N; i++) {
		if (C[i] == 0 && ss == -1) ss = i;
		if (C[i] == 1 && ss != -1) {
			if (ss != (1 << 30)) { X2.update(ss, i - ss); L2.insert(-ss); R2.insert(ss); }
			ss = -1;
		}
	}
	int len = 0, sum = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'M') {
			len++; sum++;
			vector<int>F = X2.query(len);
			for (int j = 0; j < F.size(); j++) {
				int pos = F[j];
				X2.update(pos, INF); L2.erase(-pos); R2.erase(pos);
				auto itr1 = L1.lower_bound(-pos);
				auto itr2 = R1.lower_bound(pos);
				if (R1.size() >= 1 && itr2 != R1.end()) {
					int V2 = *itr2;
					int S = X1.dat[V2 + X1.size_];
					X1.update(V2, INF); L1.erase(-V2); R1.erase(V2);
					if (L1.size() >= 1 && itr1 != L1.end()) {
						int V1 = *itr1; V1 *= -1;
						X1.update(V1, V2 - V1 + S);
					}
				}
			}
		}
		if (S[i] == 'm') {
			len--;
			vector<int>F = X1.query(-len);
			for (int j = 0; j < F.size(); j++) {
				int pos = F[j];
				X1.update(pos, INF); L1.erase(-pos); R1.erase(pos);
				auto itr1 = L2.lower_bound(-pos);
				auto itr2 = R2.lower_bound(pos);
				if (R2.size() >= 1 && itr2 != R2.end()) {
					int V2 = *itr2;
					int S = X2.dat[V2 + X2.size_];
					X2.update(V2, INF); L2.erase(-V2); R2.erase(V2);
					if (L2.size() >= 1 && itr1 != L2.end()) {
						int V1 = *itr1; V1 *= -1;
						X2.update(V1, V2 - V1 + S);
					}
				}
			}
		}
	}
	for (int i = 1; i <= N; i++) {
		int G = X1.dat[i + X1.size_];
		if (G < INF) {
			for (int j = i; j < i + G + len; j++) E[j] = 1;
		}
	}
	return E[sum + 1];
}

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> A[i];
	cin >> S;
	int L = 0, R = (1 << 17), M, maxn = 0;
	for (int i = 0; i < 20; i++) {
		M = (L + R) / 2;
		if (solve(M) == 1) { L = M; maxn = max(maxn, M); }
		else { R = M; }
	}
	cout << maxn << endl;
	return 0;
}

Measured memory_bytes: 9156
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

s = ns()
n = len(s)
for i in range(n):
    print("1" if s[i] == '9' else "9", end="")
print()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
char ax[200005];
int dp[200005];
int len;
map<int,int> m;

int main()
{
    scanf("%s",ax);
    int i,j,a,b,now=0;
    len = strlen(ax);
    m[0]=len;
    for(i=len-1;i>=0;i--){
        now ^= (1<<(ax[i]-'a'));
        dp[i]=len-i;
        if(m.count(now))dp[i]=min(dp[i],dp[m[now]]+1);
        for(j=0;j<26;j++){
            a = now^(1<<j);
            if(!m.count(a))continue;
            dp[i]=min(dp[i],dp[m[a]]+1);
        }
       if(!m.count(now))m[now]=i;
       else if(dp[i]<dp[m[now]])m[now]=i;
    }
    printf("%d",dp[0]);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  int i;
  while(N > 1000*i){
  i++;
  }
  
  cout <<1000*i  - N << endl;
  
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String n = sc.next();
    int a = 0;
    if (n.length() == 3) {
      a = Integer.parseInt(n.substring(2));
    } else if (n.length() == 2){
      a = Integer.parseInt(n.substring(1,2));
    } else {
      a = Integer.parseInt(n);
    }

    if (a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
      System.out.println("hon");
    } else if (a == 3) {
      System.out.println("bon");
    } else {
      System.out.println("pon");
    }
  }
}

Measured memory_bytes: 35688
#include <bits/stdc++.h>
#define ll long long 
#define pb push_back
using namespace std;

const ll mod = 1e9+7;

int main() {
    string s,t;
    cin >> s >> t;
    int x = s.size(), y = t.size(),count = 0,mn = 1e5+1;
    for(int i = 0; i <= x - y; i++){
        count = 0;
        string tmp = s.substr(i,y);
        // cout << s.substr(i,y) << " " ;
        for(int i = 0; i < tmp.size(); i++){
            if(t[i] != tmp[i])
                count++;
        }
        // cout << count << "\n";
        mn = min(mn,count);
    }
    cout << mn << "\n";
}






Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;

ll a[3000];

int main(){
    ll n, z, w;
    cin >> n >> z >> w;
    rep(i, n) cin >> a[i];
    if (n == 1) cout << abs(a[0]-w) << endl;
    else cout << max(abs(a[n-1]-w), abs(a[n-2]-a[n-1])) << endl;

    return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;
  cin>>n>>m;
  if(n>1 & m==0){
    cout<<pow(10,n-1)<<endl;
    exit(0);
  }
  else if(n==1 & m==0){
    cout<<0<<endl;
    exit(0);
  }
  vector<vector<int>> v(m,vector<int>(2));
  for(int i=0;i<=m-1;i++){
    int s,c;
    cin>>s>>c;
    if(s==1 & c==0 & n>=2){
      cout<<-1<<endl;
      exit(0);
    }
    else if(s==1 & c==0 & n==1){
      cout<<0<<endl;
      exit(0);
    }
    v[i][0]=s;
    v[i][1]=c;
  }
  sort(v.begin(),v.end());
  vector<int> ans(m,0);
  bool flag=true;
  for(int i=0;i<=m-2;i++){
    if(v[i][0]==v[i+1][0]){
      if(v[i][1]==v[i+1][1]){
        continue;
      }
      else{
        flag=false;
        cout<<-1<<endl;
      }
    }
  }
  if(flag){
    for(int i=0;i<=m-1;i++){
      ans[v[i][0]-1]=v[i][1];
    }
  }
  if(flag){
    for(int i=0;i<=n-1;i++){
      if(i==0 &ans[0]==0){
        cout<<1;
      }
      else{
        cout<<ans[i];
      }
    }
  }
  return 0;
}

Measured memory_bytes: 3692
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 
#define int ll
using namespace std;

const int N = 3e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const long double eps = 1e-9 ;

using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    int n;
    cin >> n ;
    int a[n][n];
    rep(i , n) rep(j , n) cin >> a[i][j] ;
    int vis[n][n] = {} ;    
    rep(i , n) rep(j , n) rep(k , n){
        if(a[i][k] + a[k][j] < a[i][j]){
            cout << -1;
            return ;
        }
        if(i == j || j == k || k == i) continue ;
        if( a[i][k] + a[k][j] == a[i][j] ){
            vis[i][j] = true; 
        }
    }
    int ans = 0 ;
    rep(i , n) rep(j , n) if(!vis[i][j]){
        ans += a[i][j] ; 
    }
    cout << ans/2 ;
}
     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}


Measured memory_bytes: 5104
package main

import "fmt"

func main() {
	var r, g, b, n int
	fmt.Scan(&r, &g, &b, &n)

	ans := 0
	for i := 0; i <= n/r; i++ {
		for j := 0; j <= n/g; j++ {
			if (n-(i*r+j*g))/b >= 0 && (n-(i*r+j*g))%b == 0 {
				ans++
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define rep(i,n)	for(int i=0;i<n;i++)
#define srep(i,a,n)	for(int i=a;i<n;i++)
#define REP(i,n)	for(int i=0;i<=n;i++)
#define SREP(i,a,n)	for(int i=a;i<=n;i++)
#define rrep(i,n)	for(int i=n-1;i>=0;i--)
#define all(a)	(a).begin(),(a).end()
#define mp(a,b)	make_pair(a,b)
#define fst	first
#define scn second

const ll inf = (ll)1e18;
const ll mod = (ll)1e9 + 7;
const ld eps = 1e-9;

int main() {
	ll m = 0, n = 0;	cin >> m >> n;
	ll ret = 1;
	while (n) {
		if (n & 1)	ret = (ret*m) % mod;
		m = (m*m) % mod;
		n >>= 1;
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3092
#include <cstdio>
#include <cstring>

inline void CMax(int &a,int b){a<b?a=b:0;}
int n,m,G[15][15],g[1<<15],f[1<<15][15],Sum;

int main()
{
    scanf("%d%d",&n,&m),memset(f,-1,sizeof f),f[1][0]=0;
    for(int i=1,x,y,z;i<=m;++i)
    {
        scanf("%d%d%d",&x,&y,&z),--x,--y,Sum+=z,G[x][y]=G[y][x]=z;
        for(int j=0;j<(1<<n);++j)if((j>>x)&(j>>y)&1)g[j]+=z;
    }
    for(int i=1;i<(1<<n);++i)
        for(int j=0;j<n;++j)
            if(~f[i][j])
            {
                for(int k=0;k<n;++k)
                    if(!(i>>k&1)&&G[j][k])
                        CMax(f[1<<k|i][k],f[i][j]+G[j][k]);
                for(int U=((1<<n)-1)^i,k=U;k;k=(k-1)&U)
                    CMax(f[i|k][j],f[i][j]+g[1<<j|k]);
            }
    return printf("%d\n",Sum-f[(1<<n)-1][n-1]),0;
}

Measured memory_bytes: 2176
local DBG = true
local function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end
local function dbgpr_t(tbl, use_pairs)
    if DBG then
        local enum = ipairs
        if use_pairs then
            enum = pairs
        end
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in enum(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end
local H, W = io.read("n", "n")
local INF = 99999999999
local function vert()
    local m = W % 3
    if m == 0 then
        return 0
    else
        return H
    end
end

local function horiz()
    local m = H % 3
    if m == 0 then
        return 0
    else
        return W
    end
end

local function maxmindiff(a,b,c)
    local max = math.max(a,b,c)
    local min = math.min(a,b,c)
    return max - min
end

local function vh()
    local d = W // 3
    local dd = H // 2
    local ans = INF
    for w=math.max(d-3,0),math.min(d+3,W) do
        local area1 = w * H
        for h=math.max(dd-3,0),math.min(dd+3,H) do
            local area2 = (W - w) * h
            local area3 = (W - w) * (H - h)
            ans = math.min(ans, maxmindiff(area1,area2,area3))
        end
    end
    return ans
end


local function hv()
    local d = H // 3
    local dd = W // 2
    local ans = INF
    for h=math.max(d-3,0),math.min(d+3,H) do
        local area1 = h * W
        for w=math.max(dd-3,0),math.min(dd+3,W) do
            local area2 = (H - h) * w
            local area3 = (H - h) * (W - w)
            ans = math.min(ans, maxmindiff(area1,area2,area3))
        end
    end
    return ans
end

local answers = {vert(), horiz(), vh(), hv()}
--dbgpr_t(answers)
print(math.min(table.unpack(answers)))



Measured memory_bytes: 760
#include<stdio.h>

int main(){
	double a;
	while(scanf("%lf", &a) != EOF){
		if(a <= 48){
			printf("light fly\n");
		}else if(a <= 51){
			printf("fly\n");
		}else if(a <= 54){
			printf("bantam\n");
		}else if(a <= 57){
			printf("feather\n");
		}else if(a <= 60){
			printf("light\n");
		}else if(a <= 64){
			printf("light welter\n");
		}else if(a <= 69){
			printf("welter\n");
		}else if(a <= 75){
			printf("light middle\n");
		}else if(a <= 81){
			printf("middle\n");
		}else if(a <= 91){
			printf("light heavy\n");
		}else{
			printf("heavy\n");
		}
	}
	return 0;
}

Measured memory_bytes: 608
S=int(input())
x=10**9+7
a=[0 for i in range(2001)]
a[3]=1
a[4]=1
a[5]=1
a[6]=2
for i in range(7,S+1):
    a[i]=(a[i-1]+a[i-3])%x
print(a[S])

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

 int main(){
   int n;

   cin >> n;
   int a[n];

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

   }

   long int sum = a[0];
   long int min = a[0];
   long int max = a[0];

   for (int i=1; i<n; i++){

       if(min > a[i]){
           min = a[i];
       }   
       if(max < a[i]){
           max = a[i];
       }
       sum += a[i];
   }
    
    cout << min << " " << max << " " << sum << endl;
   
    return 0;
   }


Measured memory_bytes: 3128
character(2*10**5) S
integer(16) cntA
integer(16) ans
logical BC
read*,S
cntA=0
ans=0;BC=.false.
do i=1,len_trim(S)
  if(BC)then
    BC=.false.
    cycle
  endif
  if(S(i:i)=="A")cntA=cntA+1
  if(S(i:i)=="B")then
    if(S(i+1:i+1)=="C")then
      ans=ans+cntA
      BC=.true.
    else
      cntA=0
    endif
  endif
  if(S(i:i)=="C")cntA=0
end do

print"(I0)",ans

end

Measured memory_bytes: 1084
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>


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

	std::vector<int> number(n);
	for (int i = 0; i < n; i++)
	{
		std::cin >> number[i];
	}

	auto min_max = std::minmax_element(number.cbegin(), number.cend());
	long long sum = std::accumulate(number.cbegin(), number.cend(), 0LL);

	std::cout << *min_max.first << " " << *min_max.second << " " << sum << std::endl;
	return 0;
}


Measured memory_bytes: 3108
//ColorfulTransceivers.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        int d=sc.nextInt();
        int sum0=Math.abs(c-a);
        int sum1=Math.abs(b-a);
        int sum2=Math.abs(c-b);

        if(sum0<=d){
            System.out.println("Yes");
        }
        else{
            if(sum1<=d&&sum2<=d){
                System.out.println("Yes");
            }
            else{
                System.out.println("No");
            }
        }
        sc.close();
    }
}

Measured memory_bytes: 21716
n = int(input())
guide = []
for i in range(n):
   restaurant = []
   s, p = input().split()
   p_1 = int(p)
   restaurant.append(s)
   restaurant.append(p_1)    
   x = i+1
   restaurant.append(x)
   guide.append(restaurant) 
sort_guide = sorted(guide, key=lambda x:(x[0],-x[1]))
for i in range(len(sort_guide)):
    print(sort_guide[i][2])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+10;
typedef long long ll;
ll a[N];
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		scanf("%lld",&a[i]);
	}
	sort(a,a+n);
	ll ans=0,temp=0;
	for (int i=n-1;i>=0;i--)
	{
		if (temp==0) 
		{
			temp++;
			ans+=a[i];
		}
		else
		{
			if (temp==n-1)   break;
			if (temp+2>n-1)
			{
				temp++;
				ans+=a[i];
				break;
			}
			else
			{
				temp+=2;
				ans+=2*a[i];
			}
		}
	}
	printf("%lld",ans);
	return 0;
}

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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;
#define gcda(x,y) gcd(abs(x),abs(y))

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    char A;
    cin >> A;
    char a=A;
    A = toupper(a);
    if(A==a) cout << "A" << endl;
    else cout << "a" << endl;
}


Measured memory_bytes: 3616
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
cnt = 0
ans = 0
for i in range(n):
  if len(set(s[i])) == 1:
    cnt += 1
  else:
    cnt = 0
  if cnt == 3:
    ans = 1

if ans == 1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 9080
#include<stdio.h>
int main()
{
    int n,a[100],i,A,B,t,j;
    while(scanf("%d",&n)==1)
    {
        A=0;B=0;
        for(i=0;i<n;i++)
        {
            scanf("%d",&a[i]);
        }
        for(i=0;i<n;i++)
        {
            for(j=i+1;j<n;j++)
            {
                if(a[i]<a[j])
                {
                    t=a[i];
                    a[i]=a[j];
                    a[j]=t;
                }
            }
        }
        for(i=0;i<n;i++)
        {
            if(i%2==0)
                A=A+a[i];
            else
                B=B+a[i];
        }
        printf("%d\n",A-B);
    }
    return 0;
}


Measured memory_bytes: 128
package main

import (
	"fmt"
)
func main() {
	var n,a int
	fmt.Scan(&n)
	
	for i := 0; i < n; i++ {
		fmt.Scan(&a)
		if a % 2 == 0 && a % 3 != 0 && a % 5 != 0 {
			fmt.Println("DENIED")
			return
		} 
	}
	fmt.Println("APPROVED")
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#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++)
typedef long long int ll;
typedef unsigned long long int ull;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c;
  string s,t;
  cin >>a;
  a++;
  cout <<a/2;
}

Measured memory_bytes: 3508
#include <iostream>

using namespace std;

int main()
{
	int N, M, answer = 0;
	cin >> N >> M;
	if (N < 2 && M < 2)
	{
		answer = 0;
	}
	else if (N < 2)
	{
		answer = (M * (M - 1)) / 2;
	}
	else if (M < 2)
	{
		answer = (N * (N - 1)) / 2;
	}
	else
	{
		answer = (N * (N - 1) + (M * (M - 1))) / 2;
	}
	cout << answer << endl;
}

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

void solve(){
    string s;
    cin >> s;

    // cout << s.substr(0, 2) << endl;
    for (int i = 0; i < s.size(); i++) {
        if (s.substr(i, 2) == "AC") {
            cout << "Yes" << endl;
            return;
        }
    }
    cout << "No" << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


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

using namespace std;
int main()
{
int N,M,C;

cin>>N>>M>>C;
int A[N][M],B[M],i,j;
for(i=0;i<M;i++)
{
    cin>>B[i];
}
for(i=0;i<N;i++)
{
    for(j=0;j<M;j++)
    {
        cin>>A[i][j];
    }
}
int ct = 0, temp;
for(i=0;i<N;i++)
{
    temp = C;
    for(j=0;j<M;j++)
    {
        temp +=A[i][j]*B[j];
    }
    if(temp > 0) ct++;
}
cout<<ct<<endl;

return 0 ;

}

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

using namespace std;
#include <algorithm>
int main()
{

    vector<long int> a;
    int n;
    cin >> n;
    for (int i = 0, f; i < n; i++)
    {
        cin >> f;
        a.push_back(f);

    }
    int o = 0;
    for (int i = 1; i < n - 1; i++)
    {
        if(a[i] > a[i - 1] && a[i] < a[i + 1])
            o++;
        else if (a[i] > a[i + 1] && a[i] < a[i - 1])
            o++;
    }
    cout << o;


}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;scanf("%d",&N);
    vector<long long> a(3*N);
    for(int i=0;i<3*N;i++)scanf("%d",&a[i]);
    priority_queue<long long,vector<long long>,greater<long long>> que;
    long long sum=0;
    for(int i=0;i<N;i++){
        que.emplace(a[i]);
        sum+=a[i];
    }
    vector<long long> left(N+1),right(N+1);
    left[0]=sum;
    for(int i=0;i<N;i++){
        que.emplace(a[i+N]);
        sum+=a[i+N];
        sum-=que.top();
        que.pop();
        left[i+1]=sum;
    }
    priority_queue<long long> Que;
    sum=0;
    for(int i=0;i<N;i++){
        Que.emplace(a[3*N-1-i]);
        sum+=a[3*N-1-i];
    }
    right[N]=sum;
    for(int i=0;i<N;i++){
        Que.emplace(a[2*N-1-i]);
        sum+=a[2*N-1-i];
        sum-=Que.top();
        Que.pop();
        right[N-1-i]=sum;
    }
    long long ans=-1000000000000000;
    for(int i=0;i<N+1;i++){
        ans=max(ans,left[i]-right[i]);
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 6516
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]

if n % 3:
    print('Yes' if len(set(a)) == 1 else 'No')
else:
    d = Counter()
    for x in a:
        d[x] += 1
    if len(d.keys()) == 1:
        print('Yes' if d[0] == n else 'No')
    elif len(d.keys()) == 2:
        print('Yes' if d[0] == n//3 else 'No')
    elif len(d.keys()) == 3:
        p, q, r = d.keys()
        if d[p] == d[q] and d[q] == d[r] and p ^ q ^ r == 0:
            print('Yes')
        else:
            print('No')
    else:
        print('No')


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

int main() {
  int N;
  cin >> N;
  vector<int> H(N);
  for (int &e : H) {
    cin >> e;
  } 
  
  if (N == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  
  H[0] -= 1;
  for (int i = 1; i < N; i++) {
    if (H[i-1] < H[i]) {
      H[i] -= 1;
    }
    if (H[i-1] > H[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 640
def main():

    N = int(input())

    shop_list = []
    for i in range(N):
        Sn, Pn = input().strip().split()
        shop_list.append((i + 1, Sn, int(Pn)))

    shop_list = sorted(shop_list, key=lambda x: (x[1], -x[2]))

    print("\n".join([str(i) for i, _, _ in shop_list]))


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
h, w, k = map(int, input().split())
S = [list(input()) for i in range(h)]

ans = [[0 for i in range(w)] for j in range(h)]
cnt = 1
no_sb = ['.' for i in range(w)]
no_sb_row = []

for i in range(h):
    flag = True
    if S[i] == no_sb:
        no_sb_row.append(i)
    else:
        for j in range(w):
            if S[i][j] == '#' and flag:
                flag = False
            elif S[i][j] == '#':
                cnt += 1
            ans[i][j] = cnt
        cnt += 1

for row in no_sb_row:
    for i in range(row+1, h):
        if i not in no_sb_row:
            ans[row] = ans[i]
            break
    else:
        for j in range(row-1, -1, -1):
            if j not in no_sb_row:
                ans[row] = ans[j]
                break

for a in ans:
    print(*a)


Measured memory_bytes: 8272
import math

s = input()
li = [0 for _ in range(len(s))]

for i in range(len(s)):
    if s[i] == "R":
        t = s[i:].index("L")
        if t % 2 != 0:
            li[i + t - 1] += 1
        else:
            li[i + t] += 1
    else:
        t = s[:i].rfind("R")
        if (i - t) % 2 != 0:
            li[t + 1] += 1
        else:
            li[t] += 1

print(*li)

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

#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define fcin ios::sync_with_stdio(false); cin.tie(nullptr);
#define INF 0x3f3f3f3f
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

int main(){
    fcin;

    int n;
    cin >> n;

    cout << n * n << endl;
    return 0;
}



Measured memory_bytes: 256
#pragma region head
    #include <bits/stdc++.h>
    #include <atcoder/all>
    using namespace atcoder;
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    #define all(x) (x).begin(), (x).end()
    #define rall(x) (x).rbegin(), (x).rend()
    #define bit(n) (1LL<<(n))
    template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
    template<class T> inline bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head

#pragma region library
#pragma endregion library

int main(){
    int n, m; cin >> n >> m;
    vi a(n); rep(i,n) cin >> a[i];
    vi b(m); rep(i,m) cin >> b[i];
    auto ans = convolution(a, b);
    for (auto& _a:ans){
        cout << _a;
        if(&_a != &ans.back()) cout << ' ';
    }
    cout << '\n';
    
}

Measured memory_bytes: 19040
def LunLun(k, count, base):
    nx = []
    n = len(base)
    if count + n >= k:
        ans = base[k - count - 1]
        print(ans)
        exit()

    for x in base:
        count += 1
        p = x % 10
        x *= 10
        a = x + p - 1
        b = a + 1
        c = b + 1
        n = 3
        if p == 0:
            n -= 1
            nx.extend([b, c])
        elif p == 9:
            n -= 1
            nx.extend([a, b])
        else:
            nx.extend([a, b, c])

    LunLun(k, count, nx)


def main():
    k = int(input())
    base = range(1, 10)
    LunLun(k, 0, base)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 18176
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
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; }
const ll INF = 1LL << 60;
int main(){
    int k;
    cin >> k;
    queue<ll> q;
    for(ll i=1; i<=9; i++){
        q.push(i);
    }
    ll ans;
    while(k>0){
        ll now =q.front(); q.pop();
        ll last = now % 10;
        if(last!=0) q.push(now*10+last-1);
        q.push(now*10+last);
        if(last!=9) q.push(now*10+last+1);
        k--;
        ans = now;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1792