akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define PB push_back
#define FO(i,a,b) for (int i = a; i <= b; i++)
#define FOb(i,a,b) for(int i=b;i>=a;i--)
#define vi vector<int>
#define vulli vector<unsigned long long int>
using namespace std;
typedef unsigned long long int ulli;
void solve()
{ 
  int a,b,res=-1;
  cin >> a >> b;
  for(int i=1;i<=1010;i++)
  {
      if( ( (i*8/100) == a )&& ( (i*10/100) == b ) ) 
            {
                res = i;
                break;
            }
  }
  cout << res;
}
int main()
{
    std::ios_base::sync_with_stdio(false);
    ulli t=1;
   // cin>>t;   
    while(t--){ solve(); cout<<"\n"; }
    return 0;
}

Measured memory_bytes: 3628
n, m = map(int, input().split())
mod = 10**9+7
"""
abs(n-m)>1の時、必ず隣り合ってしまうので0
n>mとしても一般性を失わない
if n<m: n, m = m, n
n==mnの時は、どちらを左端に置くか選べるので2倍
"""

if abs(n-m)>1: print(0)
else:
    if n<m: n, m = m, n
    n_parm = 1
    for i in range(n, 0, -1):
        n_parm = (n_parm*i)%mod
    m_parm = 1
    for i in range(m, 0, -1):
        m_parm = (m_parm*i)%mod
    ans = (n_parm * m_parm)%mod
    if m==n:
        ans = (ans*2)%mod
    print(ans)

Measured memory_bytes: 9140
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
const int N = int(2e5 + 7);
const int inf = int(1e18);

struct TEdge {
    int u, v, w;
    TEdge() {}
    TEdge(int u, int v, int w): u(u), v(v), w(w) {}
    bool operator < (const TEdge& o) const& {
        return w < o.w;
    }
};
int n, d, x, res, lab[N], f[N], g[N];
vector<TEdge> e;

int Find(int x) {return lab[x] < 0? x: lab[x] = Find(lab[x]);}
void Union(int r, int s) {
    if(lab[r] > lab[s]) swap(r, s);
    lab[r] += lab[s], lab[s] = r;
}

void Divide(int l, int r) {
    if(l == r) return;
    int mid = (l + r) >> 1, wf = inf, vf, wg = inf, vg;
    for(int i = l; i <= mid; ++i)
        if(wf > f[i]) wf = f[i], vf = i;
    for(int i = mid + 1; i <= r; ++i) {
        if(wg > g[i]) wg = g[i], vg = i;
        e.pb(vf, i, wf + g[i]);
    }
    for(int i = l; i <= mid; ++i) e.pb(vg, i, wg + f[i]);
    Divide(l, mid), Divide(mid + 1, r);
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> d;
    for(int i = 1; i <= n; ++i) {
        cin >> x;
        f[i] = x - d * i;
        g[i] = x + d * i;
    }
    Divide(1, n);
    sort(e.begin(), e.end());
    memset(&lab, -1, sizeof lab);
    for(TEdge& ed: e) {
        int r = Find(ed.u), s = Find(ed.v);
        if(r != s) res += ed.w, Union(r, s);
    }
    cout << res;
}


Measured memory_bytes: 104800
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>

using namespace std;

int saiki(vector<vector<pair<int,int> > > &cards,int ind,int m,int moku,int x){
    if(m > moku)return 0;
    if(ind==cards.size() && m==moku) return x;
    if(ind==cards.size()) return 0;

    int t = 0;
    for(int i=0;i<cards[ind].size();i++){
        t += saiki(cards,ind+1,m+cards[ind][i].first,moku,x*1);
    }
    return t;
}
int sub(vector<vector<pair<int,int> > >cards,int x){
    return saiki(cards,0,0,x,1);
}
int cnk(int n,int k){
    int x = 1;
    for(int i=0;i<k;i++) x *= (n-i);
    for(int i=0;i<k;i++) x /= (k-i);
    return x;
}
int solve(int m){
    vector<pair<int,int> > cards(m);
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        cards[i] = make_pair(a,b);
    }
    vector<vector<pair<int,int> > > cards2(m);
    for(int i=0;i<m;i++){
        for(int j=0;j<cards[i].second+1;j++){
            cards2[i].push_back(make_pair(cards[i].first*j,cnk(cards[i].second,j)));
        }
    }
    int g;
    cin >> g;
    for(int i=0;i<g;i++){
        int x;
        cin >> x;
        cout << sub(cards2,x) << endl;
    }
}

int main(){
    while(true){
        int m;
        cin >> m;
        if(m==0)break;
        solve(m);
    }
    return 0;
}

Measured memory_bytes: 912
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>

using namespace std;

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,j,k) for(int i=j;i<(k);i++)
int sx,sy, t, n;
int dx[6] = {0,0,1,1,-1,-1};
int dy[6] = {1,-1,0,1,0,-1};
struct P{
	int x,y,a;
	P(int x, int y){
		this->x = x;
		this->y = y;
		a = 0;
	}
	P(int x, int y,int a){
		this->x = x;
		this->y = y;
		this->a = a;
	}
	
};

int bfs(vector< vector<int> > &d){
	int sum = 1;
	queue<P> que;
	que.push(P(sx,sy));
	d[sx][sy] = -1;
	while(que.size()){
		P p = que.front(); que.pop();
		if(p.a>=t){ continue; }
		rep(i,6){
			int nx = p.x+dx[i],ny = p.y+dy[i];
			if(0<=nx&&0<=ny&&ny<200&&nx<200&&d[nx][ny]==0){
				d[nx][ny] = -1;
				que.push(P(nx,ny,p.a+1));
				sum++;
			}
		}
	}
	return sum;
	
}

int main(){
	while(1){
		vector< vector<int> > d(200,vector<int>(200,0));
		cin >> t >> n;
		if(t==0&&n==0){ return 0;}
		rep(i,n){
			int x,y;
			cin >> x >> y;
			d[x+100][y+100] = -1;
		}
		cin >> sx >> sy;
		sx += 100;
		sy += 100;
		cout << bfs(d) << endl;
	}
	
	return 0;
	
}

Measured memory_bytes: 1080
import numpy as np

N = int(input())
A = np.zeros(N).astype(int)
B = np.zeros(N).astype(int)

for i in range(N):
    A[i], B[i] = map(int, input().split())

ans = 0
for i in reversed(range(N)):
    A[i] = A[i] + ans
    if A[i] % B[i] == 0:
        continue
    else:
        ans += B[i] - (A[i] % B[i])
    
print(ans)

Measured memory_bytes: 14168
#include<bits/stdc++.h>
using namespace std;
#pragma region Macros
#define ios\
    ios::sync_with_stdio(false);\
    cin.tie(nullptr);
#define VEC(type, name, size)\
    V<type> name(size);\
    IN(name)
#define VVEC(type, name, h, w)\
    VV<type> name(h, V<type>(w));\
    IN(name)
#define INT(...)\
    int __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LL(...)\
    ll __VA_ARGS__;\
    IN(__VA_ARGS__)
#define STR(...)\
    string __VA_ARGS__;\
    IN(__VA_ARGS__)
#define CHAR(...)\
    char __VA_ARGS__;\
    IN(__VA_ARGS__)
#define DOUBLE(...)\
    DOUBLE __VA_ARGS__;\
    IN(__VA_ARGS__)
#define LD(...)\
    LD __VA_ARGS__;\
    IN(__VA_ARGS__)
template <class T> void scan(T &a) { cin >> a; }
template <class T> void scan(vector<T> &a) { for(auto &i : a) scan(i); }
template <class T, class L> void scan(pair<T, L> &p){ scan(p.first); scan(p.second); }
void IN() {}
template <class Head, class... Tail> void IN(Head &head, Tail &... tail) { scan(head); IN(tail...); }
template <class T> inline void print(T x){ cout << x << '\n';}
#define ll long long
#define ld long double
#define FOR(i,l,r) for(ll i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define REPS(i,n) FOR(i,1,n+1)
#define RFOR(i,l,r) for(ll i=(l);i>=(r);--i)
#define RREP(i,n) RFOR(i,n-1,0)
#define RREPS(i,n) RFOR(i,n,1)
#define pb push_back
#define eb emplace_back
#define SZ(x) ((ll)(x).size())
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
template<class T = ll> using V = vector<T>;
template<class T = ll> using VV = V<V<T>>;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true; }return false; }
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true; }return false; }
inline void Yes(bool b = true) {cout << (b ? "Yes" : "No") << '\n';}
inline void YES(bool b = true) {cout << (b ? "YES" : "NO") << '\n';}
inline void err(bool b = true) {if(b) {cout << -1 << '\n'; exit(0);}}
template<class T> inline void fin(bool b = true, T e = 0) {if(b) {cout << e << '\n'; exit(0);}}
template<class T> T Roundup_div(T x, T y) {return (x+(y-1))/y;}
template <typename T> T pow(T a, long long n, T e = 1) {T ret = e; while (n) {if (n & 1) ret *= a; a *= a; n >>= 1; } return ret; }
const ll INF = 1e18;
#pragma endregion

int main(){
    ios;
    LL(n, d);
    ll cnt = 0;
    REP(i, n){
        LL(x, y);
        if(x * x + y * y <= d * d) cnt++;
    }
    print(cnt);
}

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

typedef long long ll; 
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

#define repa(i, a, b) for (auto i = (a); i <= (b); i++)
#define repd(i, a, b) for (auto i = (a); i >= (b); i--)
#define rep(i, n) for (int i = 0; i < n; i++)
#define aLL(x) (x).begin(), (x).end()
#define zero(a)  memset((a), 0, sizeof (a))
#define sz(x) (int)(x).size()
#define debug(x) cout << (x) << "\n";
#define mp make_pair
#define pb push_back

void solve() {
    ll n;
    cin >> n;
    auto a = n / 3, b = n / 5, c = n / 15;
    auto p = 3LL * a * (a + 1LL) / 2LL;
    auto q = 5LL * b * (b + 1LL) / 2LL;
    auto r = 15LL * c * (c + 1LL) / 2LL;
    auto s = n * (n + 1LL) / 2LL;
    auto t = s - (p + q - r);
    cout << t;
	cout << "\n";
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
template <typename T>
using V = std::vector<T>;
#define REP(i, n) for (int i = 0; (i64)(i) < (i64)(n); ++i)

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  i64 a = 0;
  int i = 1;
  for (i = 1;; ++i) {
    a += i;
    if (a >= N) break;
  }
  for (int j = 1; j <= i; ++j) {
    if (j != a - N) {
      cout << j << '\n';
    }
  }
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>

int main()
{
    const long long MAX_N = 200000;
    long long n, k;
    std::cin >> n >> k;
    long long *a = new long long[n];
    long long *f = new long long[n];

    for (long long i = 0; i < n; ++i)
    {
        std::cin >> a[i];
    }
    for (long long i = 0; i < n; ++i)
    {
        std::cin >> f[i];
    }

    std::sort(a, a + n);
    std::sort(f, f + n, std::greater<long long>());
    long long *af = new long long[n];
    long long maxAf = 0;
    for (long long i = 0; i < n; ++i)
    {
        af[i] = a[i] * f[i];
        maxAf = af[i] > maxAf ? af[i] : maxAf;
    }

    long long l = 0;
    long long r = maxAf;
    long long med;
    long long ans = -1;
    while (r - l >= 1)
    {
        med = (l + r) / 2;
        long long kc = k;
        for (long long j = 0; j < n; ++j)
        {
            if (af[j] > med)
            {
                kc -= (af[j] - med + f[j] - 1) / f[j];
            }
        }
        if (kc < 0)
        {
            l = med + 1;
            if (ans < med)
            {
                ans = med;
            }
        }
        else
        {
            r = med;
        }
    }

    std::cout << ans + 1;

    return 0;
}

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

const int    INF = 1000000000;
const ll     MOD = 1000000007LL;
const double EPS = 1E-12;

template<typename T> T extgcd(T a, T b, T& x, T& y)
{
  T d = a;
  if(b != (T)0){
    d = extgcd(b, a % b, y, x);
    y -= (a / b) * x;
  }
  else{
    x = (T)1;
    y = (T)0;
  }
  return d;
}

template<typename T> T modInverse(T a, T m)
{
  T x, y;
  extgcd(a, m, x, y);
  return (m + x % m) % m;
}

template<class T> T gcd(T a, T b)
{
  T tmp;

  while(b){
    tmp = a;
    a = b;
    b = tmp%b;
  }

  return a;
}

template<class T> inline T lcm(T a, T b){ return a * (b / gcd(a, b)); }

ll a[3], m[3];

int main()
{
  while((cin >> a[0] >> m[0] >> a[1] >> m[1] >> a[2] >> m[2])){
    if(!a[0]) break;

    ll cnt[3], h[3];
    rep(i, 3) cnt[i] = 0LL;
    rep(i, 3) h[i] = a[i];
    rep(i, 3){
      while(h[i] > 1){
        cnt[i] += 1LL;
        h[i] = (h[i] * a[i]) % m[i];
      }
    }

    ll res = 1LL;
    rep(i, 3) res = lcm(res, cnt[i] + 1);
    cout << res << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>

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

int main()
{
    int64_t n, k, ans;
    cin >> n >> k;
    ans = k;

    rep(i, n-1) {
        ans *= k - 1;
    }
    cout << ans << endl;
}

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

int main(){
  int N; cin>>N;
  int d[110];
  for(int i=0;i<N;i++) cin>>d[i];
  int count=0;

  for(int i=1;i<N;i++){
    for(int j=0;j<i;j++){
      if(d[i]==d[j]){
        count++;
        d[j]=0;        
      }
    }
  }

  cout<<N-count<<endl;

  return 0;
}

Measured memory_bytes: 256
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fucking interest
*******************************
Higher, higher, even higher, to the point you won’t even be able to see me
https://www.a2oj.com/Ladder16.html
*******************************
NEVER DO 300IQ CONTESTS EVER
300IQ AS WRITER = EXTRA NONO
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      static long MOD = 1000000007L;
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int N = Integer.parseInt(st.nextToken());
         int M = Integer.parseInt(st.nextToken());
         int[] arr = new int[M];
         for(int i=0; i < M; i++)
            arr[i] = Integer.parseInt(infile.readLine());
         HashSet<Integer> set = new HashSet<Integer>();
         for(int x: arr)
            set.add(x);
         long[] dp = new long[N+1];
         dp[0] = 1L;
         for(int i=1; i <= N; i++)
         {
            long sum = dp[i-1];
            if(i >= 2)
               sum += dp[i-2];
            sum %= MOD;
            dp[i] = sum;
            if(set.contains(i))
               dp[i] = 0L;
         }
         System.out.println(dp[N]);
      }
   }

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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){ a=max(a,b);}

ll a[300030];


int main() {
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	rep(i, n) cin >>a[i];
	
	ll ans = 0;
	rep(i, 61){
		ll sm1=0;
		rep(j, n)  if(a[j]>>i & 1) sm1++; 
		ans +=((1LL<<i)%MD * sm1 % MD) * (n- sm1)%MD;
		ans %=MD;
	}
	cout << ans <<"\n";

	return 0;
}


Measured memory_bytes: 2560
while 1:
    try:
        n = int(input())
    except:break
    
    if(n == 0):break

    sum = 0
    arr = []
    isPlus = True
    maxValue = -100000
    for i in range (n):
        try:
            arr.append(int(input()))  
        except:break
           
        if arr[i] < 0:
            # 合計が0以下になってしまった場合はこれ以上計算しても意味がないのでスルーする
            if sum > 0:
                # plusが連続して続いていた場合
                if(isPlus):
                    # 最大値を更新
                    maxValue = max(maxValue,sum)
                    isPlus = False
                sum += arr[i]
                # 0未満になったら、1から計算し直す
                if sum < 0 :
                    sum = 0
        else :
            sum += arr[i]
            isPlus = True
    if sum != 0 :
        maxValue = max(maxValue,sum)
    # 入力値が全てminusなので、入力値から最大のものを探す    
    else :
        for i in arr:
            maxValue = max(maxValue,i)
    print(maxValue)


Measured memory_bytes: 5636
import bisect
n, d, a = map(int, input().split())
xh = [list(map(int, input().split())) for _ in range(n)]

xh.sort()
xs = [x for x, h in xh]

memo = [0 for _ in range(n)]

ans = 0

for j, (x, h) in enumerate(xh):
    memo[j] +=  memo[j-1]
    b = h - memo[j]
    if b > 0:
        c = (b + a - 1) // a
        memo[j] += c * a
        ans += c
        i = bisect.bisect_right(xs, x + 2 * d)
        if i < n:
            memo[i] -= c * a

print(ans)


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

template <class T, class Op> struct SegmentTree {
  const Op op;
  const T e;
  const int n;
  vector<T> t;
  SegmentTree(int _n, Op _op, T _e) : op(_op), e(_e), n(_n), t(2 * n, e) {}
  T& operator[](int i) { return t[n + i]; }
  void build() { for (int i = n; i-- > 1; ) t[i] = op(t[2 * i], t[2 * i + 1]); }
  T fold(int l, int r) const {
    T a = e, b = e;
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) {
      if (l & 1) a = op(a, t[l++]);
      if (r & 1) b = op(t[--r], b);
    }
    return op(a, b);
  }
  void set(int i, T a) {
    t[i += n] = a;
    while (i >>= 1) t[i] = op(t[2 * i], t[2 * i + 1]);
  }
};
template <class T, class Op> auto make_segment_tree(int n, Op op, T e) {
  return SegmentTree<T, Op>(n, op, e);
}
auto minimum = [](auto l, auto r) { return r < l ? r : l; };
auto maximum = [](auto l, auto r) { return l < r ? r : l; };

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  auto st = make_segment_tree<pair<int, int>>(n, maximum, {-1, -1});
  for (int i = 0; i < n; ++i) {
    st[i] = {0, i};
  }
  for (auto&& e : a) {
    cin >> e;
    --e;
    ++st[e].first;
  }
  st.build();
  set<int> se;
  for (int i = 0; i < n; ++i) {
    se.insert(i);
  }
  vector<int> v;
  while (not se.empty()) {
    int x = -1;
    if (st.fold(0, n).first >= n - 1 - (int)v.size() and se.count(st.fold(0, n).second)) {
      x = st.fold(0, n).second;
    } else {
      auto it = begin(se);
      if (next(it) != end(se) and not v.empty() and a[v.back()] == *it) {
        ++it;
      }
      x = *it;
    }
    v.push_back(x);
    se.erase(x);
    st.set(a[x], {st[a[x]].first - 1, a[x]});
  }
  int k = min(n, 3);
  sort(end(v) - k, end(v));
  do {
    bool ok = true;
    for (int i = 0; i < n - 1; ++i) {
      if (v[i + 1] == a[v[i]]) {
        ok = false;
        break;
      }
    }
    if (ok) {
      for (int i = 0; i < n; ++i) {
        cout << v[i] + 1 << " \n"[i == n - 1];
      }
      return 0;
    }
  } while (next_permutation(end(v) - k, end(v)));
  cout << "-1\n";
}


Measured memory_bytes: 7424
/* A */

#include <iostream>
#include <string>
using namespace std;

int main(){
    string str;
    int n, k;
    cin >> n >> k >> str;
    if(str[k-1] == 'A') str[k-1] = 'a';
    if(str[k-1] == 'B') str[k-1] = 'b';
    if(str[k-1] == 'C') str[k-1] = 'c';
    cout << str << endl;
}

Measured memory_bytes: 256
fn main() {
    let v = read_vec::<u32>();
    let _n = v[0];
    let _m = v[1];
    let x = v[2];

    let masu = read_vec::<u32>();

    let to_0 = masu.iter().filter(|&y| *y < x).count();
    let to_n = masu.iter().filter(|&y| *y > x).count();

    println!("{}", std::cmp::min(to_0, to_n));
}

#[allow(dead_code)]
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()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9

int main(){
    int n; cin >> n;
    vector<ll> l(n+1);
    l[0] = 2;
    l[1] = 1;
    for (int i = 2; i <= n; i++) {
        l[i] = l[i-1] + l[i-2];
    } 
    cout << l[n] << endl;

    return 0;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int x = sc.nextInt();
        int[] c = new int[n];
        int[][] a = new int[n][m];
        int[] sum = new int[m];
        int min = 0;
        for (int i = 0; i < n; i++) {
            c[i] = sc.nextInt();
            min += c[i];
            for (int j = 0; j < m; j++) {
                a[i][j] = sc.nextInt();
                sum[j] += a[i][j];
            }
        }

        // NG case
        if (!check(sum, m, x)) {
            System.out.println(-1);
            return;
        }

        for (int i = 0; i < Math.pow(2, n); i++) {
            int[] score = new int[m];
            int cost = 0;
            for (int j = 0; j < n; j++) {
                if ((1&i>>j) == 1) {
                    for (int k = 0; k < m; k++) {
                        score[k] += a[j][k];
                    }
                    cost += c[j];
                }
            }

            //System.out.println("i="+i);
            //System.out.println("cost="+cost);


            if (check(score, m, x) && min > cost) {
                min = cost;
            }
        }

        System.out.println(min);
    }

    public  static boolean check(int[] score, int m, int x) {
        for (int i = 0; i < m; i++) {
            if (score[i] < x) {
                return false;
            }
        }

        return true;
    }
}

Measured memory_bytes: 37284
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int a,b,c;
signed main(){
	cin>>a>>b>>c;
	cout<<min(c,b/a)<<endl;
	return 0;
}

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

#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;

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

    int n; cin >> n;
    cout << (n >= 30 ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 3636
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

long long int gcd(long long int a, long long int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

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

	cin >> N >> M;
	vector<long long int>v(N);
	for (auto &i : v)cin >> i;
	long long int g = v[0];
	for (int i = 1; i < N; i++) {
		g = g / gcd(g, v[i])*v[i];
		if (g > M * 2) {
			cout << 0 << endl;
			return 0;
		}
	}
	for (int i = 0; i < N; i++) {
		if ((g / 2) % v[i] == 0) {
			cout << 0 << endl;
			return 0;
		}
	}
	if (M%g >= g / 2) {
		cout << M / g + 1 << endl;
	}
	else {
		cout << M / g << endl;
	}
}


Measured memory_bytes: 1024
x, k, d = map(int, input().split())
if x >= 0:
    if x//d >= k:
        print(abs(x - k*d))
    else:
        if (k - x//d)%2 == 0:
            print(abs(x%d))
        else:
            print(abs(x%d - d))
else:
    if abs(x)//d >= k:
        print(abs(x + k*d))
    else:
        if (k - abs(x)//d)%2 == 0:
            print(abs(x)%d)
        else:
            print(d - abs(x)%d)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vector<ll> > vvl;
typedef vector<vector<P> > vvp;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n,k;
  cin >> n >> k;
  if(k>(n-1)*(n-2)/2){
    cout << -1 << endl;
    return 0;
  }
  vector<P>vec;
  rep(i,n-1){
    vec.push_back(P(i+1,n));
  }
  k=(n-1)*(n-2)/2-k;
  int a=1,b=2;
  rep(i,k){
    vec.push_back(P(a,b));
    b++;
    if(b==n){
      a++;
      b=a+1;
    }
  }
  cout << vec.size() << endl;
  for(auto p:vec){
    cout << p.first << " " << p.second << endl;
  }
    
  return 0;     
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC115
{
    class Program
    {
        static void Main(string[] args)
        {
            int D = int.Parse(Console.ReadLine());

            if (D == 25)
                Console.WriteLine("Christmas");

            else if (D == 24)
                Console.WriteLine("Christmas Eve");

            else if (D == 23)
                Console.WriteLine("Christmas Eve Eve");

            else if (D == 22)
                Console.WriteLine("Christmas Eve Eve Eve");

            Console.ReadKey();

        }
    }
}


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

Measured memory_bytes: 600
#include <iostream>
#include <utility>
using namespace std;
#define ll long long

int main () {
  ll n;
  cin >> n;
  ll pm = -1;
  ll pi, mi;
  ll mm = -1;
  ll a[n];
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] >= 0 && pm < a[i]) {
      pm = a[i];
      pi = i;    
    } 
    if (a[i] <= 0 && mm < a[i] * -1) {
      mm = a[i] * -1;  
      mi = i;
    }
  }
  // all +判定
  for (ll i = 0; i < n; i++) {
    if (a[i] < 0) {
      break;  
    }  
    if (i == n - 1) {
      cout << n - 1 << endl;
      for (ll i = 2; i <= n; i++) {
        cout << (i - 1) << " " << i << endl;   
      }  
      return 0;
    }
  }
  for (ll i = 0; i < n; i++) {
    if (a[i] > 0) {
      break;  
    }  
    if (i == n - 1) {
      cout << n - 1 << endl;  
      for (ll i = n - 1; i >= 1; i--) {
        cout << (i + 1) << " " << i << endl;  
      }
      return 0;
    }
  }
  pi++;
  mi++;
  if (pm >= mm) {
    cout << (n - 1) * 2 << endl;
    for (ll i = 1; i <= n; i++) {
      if (i != pi) {
        cout << pi << " " << i << endl;    
      }  
    }  
    for (ll i = 2; i <= n; i++) {
      cout << (i - 1) << " " << i << endl;  
    }
  }
  else {
    cout << (n - 1) * 2 << endl;
    for (ll i = 1; i <= n; i++) {
      if (i != mi) {
        cout << mi << " " << i << endl;  
      }
    }  
    for (ll i = n - 1; i >= 1; i--) {
      cout << (i + 1) << " " << i << endl;  
    }
  }

}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 61;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

template<class T>
inline bool chmax(T &a, const T b) { return a < b && (a = b, true); }

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];

	vector<vector<lint>> dp(N + 4, vector<lint>(2, -LINF));
	dp[0][0] = -A[0];
  	dp[0][1] = dp[1][1] = 0;
  	dp[1][0] = -A[1];

	for (int i = 0; i < N; i++) {
		
		chmax(dp[i + 2][0], dp[i][0] + A[i]);
		chmax(dp[i + 2][0], dp[i][1] + 0   );
		chmax(dp[i + 2][1], dp[i][1] + A[i]);

		if (i & 1) {
			chmax(dp[i + 3][0], dp[i][1] + A[i]);
		}
		else {
			chmax(dp[i + 3][0], dp[i][0] + A[i]);
			chmax(dp[i + 3][0], dp[i][1] + 0);
			chmax(dp[i + 3][1], dp[i][1] + A[i]);
          	chmax(dp[i + 4][0], dp[i][1] + A[i]);
		}

	}

	lint ans = -LINF;
  	bool offset = N & 1;
	chmax(ans, dp[N + 0 - offset][1]);	
  	chmax(ans, dp[N + 1 - offset][1]);	
  	chmax(ans, dp[N + 2 - offset][0]);	
  	chmax(ans, dp[N + 3 - offset][0]);

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 15092
/*program from Wolfycz*/
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
inline char gc(){
	static char buf[1000000],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;
}
inline int frd(){
	int x=0,f=1; char ch=gc();
	for (;ch<'0'||ch>'9';ch=gc())	if (ch=='-')	f=-1;
	for (;ch>='0'&&ch<='9';ch=gc())	x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}
inline int read(){
	int x=0,f=1; char ch=getchar();
	for (;ch<'0'||ch>'9';ch=getchar())	if (ch=='-')	f=-1;
	for (;ch>='0'&&ch<='9';ch=getchar())	x=(x<<3)+(x<<1)+ch-'0';
	return x*f;
}
inline void print(int x){
	if (x<0)	putchar('-'),x=-x;
	if (x>9)	print(x/10);
	putchar(x%10+'0');
}
const int N=2e6,p=1e9+7;
int fac[N+10],inv[N+10];
int X[10],Y[10],Ans;
void prepare(){
	fac[0]=inv[0]=inv[1]=1;
	for (int i=1;i<=N;i++)	fac[i]=1ll*i*fac[i-1]%p;
	for (int i=2;i<=N;i++)	inv[i]=1ll*(p-p/i)*inv[p%i]%p;
	for (int i=1;i<=N;i++)	inv[i]=1ll*inv[i-1]*inv[i]%p;
}
struct S1{
	int x,y,k;
	void insert(int _x,int _y,int _k){x=_x,y=_y,k=_k;}
}A[4],B[4];
int F(int x1,int y1,int x2,int y2){return 1ll*fac[x2-x1+y2-y1]*inv[x2-x1]%p*inv[y2-y1]%p;}
int solve(const S1 &a,const S1 &b){
	int x1=a.x,y1=a.y,x2=b.x,y2=b.y,res=0;
	for (int i=X[3];i<=X[4];i++)	res=(res+1ll*F(x1,y1,i,Y[3]-1)*F(i,Y[3],x2,y2)%p*(-i-Y[3])%p)%p;
	for (int i=Y[3];i<=Y[4];i++)	res=(res+1ll*F(x1,y1,X[3]-1,i)*F(X[3],i,x2,y2)%p*(-i-X[3])%p)%p;
	for (int i=X[3];i<=X[4];i++)	res=(res+1ll*F(x1,y1,i,Y[4])*F(i,Y[4]+1,x2,y2)%p*(i+Y[4]+1)%p)%p;
	for (int i=Y[3];i<=Y[4];i++)	res=(res+1ll*F(x1,y1,X[4],i)*F(X[4]+1,i,x2,y2)%p*(i+X[4]+1)%p)%p;
	return res;
}
int main(){
	prepare();
	for (int i=1;i<=6;i++)	X[i]=read();
	for (int i=1;i<=6;i++)	Y[i]=read();
	A[0].insert(X[1]-1,Y[1]-1,1),A[1].insert(X[1]-1,Y[2],-1),A[2].insert(X[2],Y[1]-1,-1),A[3].insert(X[2],Y[2],1);
	B[0].insert(X[6]+1,Y[6]+1,1),B[1].insert(X[6]+1,Y[5],-1),B[2].insert(X[5],Y[6]+1,-1),B[3].insert(X[5],Y[5],1);
	for (int i=0;i<4;i++)	for (int j=0;j<4;j++)	Ans=(Ans+1ll*A[i].k*B[j].k*solve(A[i],B[j])%p)%p;
	printf("%d\n",(Ans+p)%p);
	return 0;
}

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

using namespace std;

const int MAX = 2e5 + 9;
int white[MAX], black[MAX];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	for (int i = 1; i <= n; i++) {
		if (s[i - 1] == '.') {
			white[i] = white[i - 1] + 1;
			black[i] = black[i - 1];
		} else {
			black[i] = black[i - 1] + 1;
			white[i] = white[i - 1];
		}
	}
	int ans = MAX;
	for (int i = 0; i < n; i++) {
		if (s[i] == '#') {
			ans = min(ans, black[i] + white[n] - white[i + 1]);
		}
	}
	if (white[n] == n) ans = 0;
	ans = min(ans, black[n]);
	cout << ans << '\n';
	return 0;
}

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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n;
	cin >> n;
	Vec<int> h(n);
	int higher = 0, ans = 0;
	for (auto&& i : h) {
		cin >> i;
		if (higher <= i) {
			ans++;
			higher = i;
		}
	}
	cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include <iostream>

using namespace std;
int par[100010],sz[100010];
int init(int n){
	for(int i=0;i<n;i++){
		par[i] = i; sz[i] = 1;
	}
}

int find(int x){
	if(par[x]==x) return x;
	return par[x] = find(par[x]);
}

void unite(int x, int y){
	x = find(x); y = find(y);
	if(x==y) return;
	if(sz[x]<sz[y]) swap(x,y);
	sz[x] += sz[y]; par[y] = x;
}

bool same(int x, int y){
	return find(x)==find(y);
}

int main(){
	int i,n,m;
	cin >> n >> m;
	init(n);
	for(i=0;i<m;i++){
		int x,y,z;
		cin >> x >> y >> z;
		unite(x,y);
	}
	int cnt = 0;
	for(i=0;i<n;i++){
		if(par[i]==i){
			cnt++;
		}
	}
	cout << cnt << endl;
}
			

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main() {
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d) {
    cout << "Left" << endl;
  }else if(a+b == c+d){
    cout << "Balanced" << endl;
  }else{
    cout << "Right" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#define MAX 100000007
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;

ll ans=0;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  int a[1000]={0},b[1000]={0},c[1000]={0};
  int dist[100][100];
  cin >> N >> M;
  for(int i=0;i<M;i++){
    cin >> a[i] >> b[i] >> c[i];
    a[i]--,b[i]--;
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      if(i==j){
        dist[i][j]=0;
      }else {
        dist[i][j]=1000000000;
      }
    }
  }
  for(int i=0;i<M;i++){
    dist[a[i]][b[i]]=min(dist[a[i]][b[i]],c[i]);
    dist[b[i]][a[i]]=min(dist[b[i]][a[i]],c[i]);
  }
  for(int k = 0; k < N; ++k){
    for(int i = 0; i < N; ++i){
      for(int j = 0; j < N; ++j){
        dist[i][j]=min(dist[i][j],dist[i][k]+dist[k][j]);
      }
    }
  }
  int ans=M;
  for(int i = 0; i < M; ++i){
    bool shortest=false;
    for(int j = 0; j < N; ++j) if(dist[j][a[i]]+c[i]==dist[j][b[i]]) shortest=true;
    if(shortest==true){
    ans=ans-1;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
	
	#define 	ll 						long long int
	#define 	REP(i,a,b)				for(i=a;i<=b;i++)
	#define 	REPr(i,b,a)				for(i=b;i>=a;i--)
	#define 	pb 						push_back
    #define 	mp 						make_pair
    #define 	f  						first
   	#define 	s  						second
   	#define 	umap(type1,type2)		unordered_map<type1,type2>

int mod = pow(10,9)+7;

void solve(){
	int n,i;	cin>>n;
	int ans=0;
	char arr[n];
	REP(i,0,n-1)	cin>>arr[i];
	int w=-1,r=-1;
	REP(i,0,n-1){
		if(arr[i]=='W'){
			w=i;
			break;
		}
	}
	REPr(i,n-1,0){
		if(arr[i]=='R'){
			r=i;
			break;
		}
	}
	if(w==-1 || r==-1 || w>r){
		cout<<0<<endl;
		return;
	}
	while(w<r){
		ans++;
		arr[w]='R';
		arr[r]='W';
		REP(i,w+1,n-1){
			if(arr[i]=='W'){
				w=i;
				break;
			}
		}
		REPr(i,r-1,0){
			if(arr[i]=='R'){
				r=i;
				break;
			}
		}
	}

	cout<<ans<<endl;
}

void pb_18(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif

	/***************************

		FuCk RATINGS I am in love with EXPERIENCE.

	***************************/

	int t;	t=1;
	while(t--)	solve();
}

int main(){
	pb_18();
}

Measured memory_bytes: 3776
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

def main():
    G = [[0 for _ in range(3)] for _ in range(3)]
    for i in range(3):
        G[i] = [int(e) for e in input().split()]

    for a0 in range(0, 100+1):
        b0 = G[0][0] - a0
        b1 = G[0][1] - a0
        b2 = G[0][2] - a0

        a1 = G[1][0] - b0
        a2 = G[2][0] - b0

        if a0 + b0 == G[0][0] and \
           a0 + b1 == G[0][1] and \
           a0 + b2 == G[0][2] and \
           a1 + b0 == G[1][0] and \
           a1 + b1 == G[1][1] and \
           a1 + b2 == G[1][2] and \
           a2 + b0 == G[2][0] and \
           a2 + b1 == G[2][1] and \
           a2 + b2 == G[2][2]:
               print("Yes")
               return
    print("No")


main()


Measured memory_bytes: 3064
from itertools import product

N=int(input())
F=[ [[0 for _ in range(2)] for _ in range(5)] for _ in range(N)]
P= [[0] for _ in range(N)]
total= [[0 for _ in range(5)] for _ in range(2)]

for i in range(N):
  tmp=list( map(int,input().split()) )
  for j in range(5):
    for k in range(2):
      F[i][j][k]=tmp[2*j+k]
for i in range(N):
  P[i]=list(map(int,input().split()))
  
maxi=float("-inf")
combi=product([1,0],repeat=10)

for kumi in combi:
  mini=float("-inf")
  if sum(kumi)==0:
    pass
  else:      
    tmp=0
    for i in range(N):
      summ=0
      for k,open in enumerate(kumi):
        m,n = k//2, k%2
        summ += open * F[i][m][n]
      tmp += P[i][summ]
  maxi=max(maxi,tmp)
      
print(maxi)

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;

int ans[26];

int main(){
    string St;
    cin>>St;
    char a = St[0];
    int l = St.length();
    char b = St[l-1];
    cout<<a<<l-2<<b<<endl;
    return 0;
}


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

int main() {
  int N,l,r;
  
  cin>>N;
  
  int sum=0;
  for(int i=0;i<N;i++){
    
    cin>>l>>r;
    
    sum+=r-l+1;
  }
  cout<<sum<<endl;
  

}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]A - Restaurant
            int n = int.Parse(Console.ReadLine());

            int x = n * 800;
            int y = n / 15 * 200;

            Console.WriteLine(x - y);
        }
    }
}


Measured memory_bytes: 11092
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m,a[100005];
vector<ll>vec;
int main(){
	cin >> n >> m;
	ll cur = 1;
	rep(i,n){
		cin >> a[i];
		vec.pb(a[i]/2);
		cur = cur / __gcd(cur,vec[i]) * vec[i];
		if(cur > m){
			puts("0"); return 0;
		}
	}
  	rep(i,n){
    	rep(j,30){
			if( a[0]%(1<<j) !=0 && a[i]%(1<<j) == 0 ){
              		puts("0"); return 0;
			}
          	if( a[0]%(1<<j) ==0 && a[i]%(1<<j) != 0 ){
              		puts("0"); return 0;
			}
        }
    }
	ll ans = m / cur;
	cout << (ans+1)/2 << endl;
}


Measured memory_bytes: 1656
# import sys
# sys.setrecursionlimit(10**5)
# from collections import defaultdict
geta = lambda fn: list(map(fn, input().split()))
gete = lambda fn: fn(input())

N, K = geta(int)
h = geta(int)

INF = 1 << 60
dp = [INF] * N
dp[0], dp[1] = 0, abs(h[0] - h[1])

for i in range(2, N):
    lb = i - K if i > K else 0
    dp[i] = min([dp[j] + abs(h[j] - h[i]) for j in range(lb, i)])

print(dp[N - 1])


Measured memory_bytes: 52576
N=int(input())
s=input()
 
dicX={s[0]:1}
dicY={}
for i in range(1,N):
    if s[i] in dicY: dicY[s[i]]+=1
    else: dicY[s[i]]=1
 
ans=0
for i in range(1,N-1):
    if s[i] in dicX: dicX[s[i]]+=1
    else: dicX[s[i]]=1
    
    if dicY[s[i]]>1: dicY[s[i]]-=1
    else: dicY.pop(s[i])
    
    tmp=0
    for j in dicX:
         if j in dicY: tmp+=1
    ans=max(tmp,ans)
 
print(ans)

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

int main(){
  int n;
  cin>>n;
  vector<tuple<string,int,int> > A(n);
  for(int i=0;i<n;i++){
    cin>>get<0>(A[i]);
    int ss;
    cin>>ss;
    get<1>(A[i])=100-ss;
    get<2>(A[i])=i+1;
  }
  sort(A.begin(),A.end());
  for(int i=0;i<n;i++){
    printf("%d\n",get<2>(A[i]));
  }
}

Measured memory_bytes: 3736
#include <cstring>
#include <cstdlib>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define ABS(a) ((a)<0?(-(a)):(a))
#define CS while(cases())
#define I(n) int n = gi()
#define II(n) n = gi()
#define L(n) ll n = gli()
#define LL(n) n = gli()
#define F(i, n) for (int i = 0; i < n; i++)
#define Fa(n, a) for (int i = 0; i < n; i++) a[i] = gi()
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

template<class T>
T gcd(T a, T b) {
    return (b == 0 ? a : gcd(b, a%b));
}

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int cases() {
    static int t = gi();
    return t--;
}

#define MD 1000000007
char a[4];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    scanf("%s", a);
    if (a[1] == 'S') {
        printf("%d\n", (a[0] == 'R' || a[2] == 'R' ? 1 : 0));
    } else {
        int r = 1;
        r += (a[0] == 'R' ? 1 : 0);
        r += (a[2] == 'R' ? 1 : 0);
        printf("%d\n", r);
    }

    return 0;
}


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

int main() {
  	int a,b;
  std::cin>> a >> b ;
  int c,d,e;
  c=a+b;
  d=a-b;
  e=a*b;
  int x[3]={c,d,e};
  int ma=-99999999;
  for(int i=0;i<3;i++){
  if(ma<x[i]){ma=x[i];}
  }
  std::cout<< ma << std::endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

class Simple {
    int R, G;
    void Solve() {
        //input
        R = io.Int;
        G = io.Int;
        //cal
        var ans = 2 * G - R;
        //ret
        Console.WriteLine(ans);
    }


    SimpleIO io = new SimpleIO();
    public static void Main(string[] args) { new Simple().Stream(); }
    void Stream() { Solve(); io.writeFlush(); }
}
class SimpleIO {
    string[] nextBuffer;
    int BufferCnt;
    char[] cs = new char[] { ' ' };
    StreamWriter sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
    public SimpleIO() {
        nextBuffer = new string[0];
        BufferCnt = 0;
        Console.SetOut(sw);
    }
    public string Next() {
        if (BufferCnt < nextBuffer.Length)
            return nextBuffer[BufferCnt++];
        string st = Console.ReadLine();
        while (st == "")
            st = Console.ReadLine();
        nextBuffer = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        BufferCnt = 0;
        return nextBuffer[BufferCnt++];
    }
    public string String => Next();
    public char Char => char.Parse(String);
    public int Int => int.Parse(String);
    public long Long => long.Parse(String);
    public double Double => double.Parse(String);
    public void writeFlush() { Console.Out.Flush(); }
}


Measured memory_bytes: 11092
import numpy as np

def main():
    H, W, K = map(int, input().split())
    S = []
    for _ in range(H):
        S.append(list(map(int, list(input()))))
    S = np.array(S)
    if S.sum() <= K:
        print(0)
        exit(0)
    answer = float('INF')
    for i in range(0, 2 ** (H - 1)):
        horizons = list(map(int, list(bin(i)[2:].zfill(H - 1))))
        result = greedy(W, S, K, horizons, answer)
        answer = min(answer, result)
    print(answer)

# ex. horizons = [0, 0, 1, 0, 0, 1]
def greedy(W, S, K, horizons, current_answer):
    answer = sum(horizons)
    # ex.
    # S  = [[1, 1, 1, 0, 0],
    #       [1, 0, 0, 0, 1],
    #       [0, 0, 1, 1, 1]]
    # horizons = [0, 1]のとき,
    # S2 = [[2, 1, 1, 0, 0],
    #       [0, 0, 1, 1, 1]]
    # となる
    top = 0
    bottom = 0
    S2 = []
    for h in horizons:
        if h == 1:
            S2.append(S[:][top:(bottom + 1)].sum(axis=0).tolist())
            top = bottom + 1
        bottom += 1
    S2.append(S[:][top:].sum(axis=0).tolist())
    # ブロック毎の累積和を計算する
    h = len(S2)
    partial_sums = [0] * h
    for right in range(W):
        current = [0] * h
        for idx in range(h):
            current[idx] = S2[idx][right]
            partial_sums[idx] += S2[idx][right]
        # 1列に含むホワイトチョコの数がkより多い場合
        if max(current) > K:
            return float('INF')
        # 無理な(ブロックの中のホワイトチョコの数をk以下にできない)場合
        if max(partial_sums) > K:
            answer += 1
            if answer >= current_answer:
                return float('INF')
            partial_sums = current
    return answer

if __name__ == '__main__':
    main()


Measured memory_bytes: 12564
N=int(input())
As=[0]+list(map(int, input().split()))+[0]

Sum=0
for i in range(0,N+1):
    Sum+=abs(As[i+1]-As[i])

for i in range(1,N+1):
    Si=Sum+abs(As[i-1]-As[i+1])-(abs(As[i-1]-As[i])+abs(As[i]-As[i+1]))
    print(Si)

Measured memory_bytes: 14048
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main()
{
	cin>>a>>b;
	bool ok=true;
	for(int i=b-a+1;i<=b+a-1;i++)
	{
		if(ok==false)
		{
			cout<<" ";
		}
		ok=false;
		cout<<i;
	}
	puts("");
	return 0;
}

Measured memory_bytes: 256
using System;

class A{
	public static void Main(){

		string[] input = Console.ReadLine ().Split (' ');
		int a = int.Parse (input [0]);
		int b = int.Parse (input [1]);
		int c = int.Parse(input[2]);
		int count = 0;

		for (int i=a; i<=b; i++) {
			if ((c % i) == 0) {
				count++;
			}
		}
		Console.WriteLine (count);
	}
}

Measured memory_bytes: 9172