akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <queue>
using namespace std;

#define INF (1<<29)

struct Edge {
  int to, cost;
  Edge(int t, int c) : to(t), cost(c) {}
};

typedef pair<int, int> Pii;
typedef pair<int, Pii> Piii; // cost, cnum, node

vector<Edge> G[100];
int memo[100][10];

int dijkstra(int src, int dst, int cnum) {
  
  fill(memo[0], memo[0]+1000, INF);
  
  priority_queue<Piii> pq;
  memo[src][cnum] = 0;
  pq.push(Piii(0, Pii(-cnum, src)));
  while(!pq.empty()) {
    const Piii get = pq.top(); pq.pop();
    int cost = get.first;
    int cn = -get.second.first;
    int now = get.second.second;
    
    for(int i=0; i<G[now].size(); i++) {
      int next = G[now][i].to;
      int add_c = G[now][i].cost;
      if(memo[next][cn] > cost + add_c) {
	pq.push(Piii(cost+add_c, Pii(-cn, next)));
	memo[next][cn] = cost + add_c;
      }
      if(cn-1<0) continue;
      add_c /= 2;
      if(memo[next][cn-1] > cost + add_c) {
	pq.push(Piii(cost+add_c, Pii(-(cn-1), next)));
	memo[next][cn-1] = cost + add_c;
      }
    }
  }
  
  return *min_element(memo[dst], memo[dst]+10);
}

int main() {
  int C, N, M, S, D;
  while(cin >> C >> N >> M >> S >> D && (N|M)) {
    for(int i=0; i<N; i++) {
      G[i].clear();
    }
    for(int i=0; i<M; i++) {
      int a, b, c; cin >> a >> b >> c; a--, b--;
      G[a].push_back(Edge(b, c));
      G[b].push_back(Edge(a, c));
    }
    
    S --, D --;
    cout << dijkstra(S, D, C) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1232
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[])=>{for(let i=0;i<a.length;i+=2)if(s==a[i])return a[i+1]};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};
const main = ()=>{
  let a=nin();
  out(floor((a/2)*(a/2)));
}
main();

Measured memory_bytes: 7372
#include <stdio.h>

int main(){

	int t;
	int n;
	int h[100];
	int d_max=0;
	int u_max=0;
	int tmp = 0;

	while(1){	
		scanf("%d",&t);
		if(0<t && t<=100){
			break;
		}
	}
	for(int i=0; i<t; i++){
		while(1){
			scanf("%d",&n);
			if(2<=n && n<=100){
				break;
			}
		}

		for(int j=0; j<n; j++){
			while(1){
				scanf("%d",&h[j]);
				if(0<h[j] && h[j]<=1000){
					break;
				}
			}
		}

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

			if(u_max < (h[k]-h[k-1]) ){
				u_max = h[k]-h[k-1];
			}

			if(d_max < (h[k-1]-h[k]) ){
				d_max = h[k-1]-h[k];
			}
		}
		printf("%d %d\n",u_max, d_max);
		u_max=0;
		d_max=0;
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vel;
typedef vector<int> vei;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> ve_vel;
typedef vector<vector<int>> ve_vei;
typedef vector<vector<char>> ve_vec;
typedef vector<vector<bool>> ve_veb;
typedef vector<vector<string>> ve_ves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pub push_back
#define puf push_front
#define pob pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
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 (a>b) { a=b; return 1; } return 0; }

//約数の総和O(√n)
ll div_sum(ll n) {
  ll s = 0;
  ll k;
  for ( k = 1; k * k <= n; k++ ) { 
    if(k * k == n) s += k;
    else if ( n % k == 0 ) { s += k + n / k; } 
  }
  return s;
}

//素因数分解
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

int main() {
  ll N; cin >> N;
  vel part;
  for(auto p : prime_factor(N)) while(p.sc--) part.pub(p.fs);
  cout << N << ": ";
  rep(i,part.size()-1) cout << part[i] << " " ;
  cout << part[part.size()-1] << endl;
}


Measured memory_bytes: 3164
n,m = map(int, input().split())
nums = [int(i) for i in input().split()]
tot = 0
for i in nums:
  tot+= i
cons = tot/(4*m)
count = 0
for i in nums:
  if i>= cons:
    count+=1
if count>= m:
  print('Yes')
else:
  print("No")

Measured memory_bytes: 3060
#

import sys
input=sys.stdin.readline

def main():
    A,V=map(int,input().split())
    B,W=map(int,input().split())
    T=int(input())
    y=0
    d=abs(A-B)
    if V!=W:
        t=d/(V-W)
        if 0<=t<=T:
            y=1
    
    if y==1:
        print("YES")
    else:
        print("NO")
    
    
    
if __name__=="__main__":
    main()


Measured memory_bytes: 61880
n, m = map(int, input().split())

xyz = [list(map(int, input().split())) for _i in range(n)]

r = []
for i in range(2**3):
    checker = []
    num = i
    for _i in range(3):
        if num%2==1:
            checker.append(1)
        else:
            checker.append(-1)
        num >>= 1
    _xyz = []
    for j in range(n):
        _abc = [checker[s]*xyz[j][s] for s in range(3)]
        _xyz.append([sum(_abc)]+_abc)
    _xyz.sort(reverse=True)
    _r = abs(sum(i[1] for i in _xyz[:m]))
    _r += abs(sum(i[2] for i in _xyz[:m]))
    _r += abs(sum(i[3] for i in _xyz[:m]))
    r.append(_r)

print(max(r))

Measured memory_bytes: 74888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;cin >> s;
	int k;cin >> k;
	int x;
	rep(i,s.size()){
		x=26-(s.at(i)-'a');
		if(x==26) continue;
		if(x<=k){
			s.at(i)='a';
			k-=x;
		}
	}
	s.at(s.size()-1)='a'+(s.at(s.size()-1)-'a'+k%26)%26;
	cout << s << endl;
}

Measured memory_bytes: 592
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]

def solve():
    ans = 0
    return - (- N // 2) / N

if __name__ == "__main__":
    print(solve())

Measured memory_bytes: 3816
import Control.Monad
import Control.Applicative
import Data.Functor
import Data.List
import Data.List.Split
import Data.Char

readInt = read :: String -> Int
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
-- end of templete

g  = 9.8 :: Double
height n = 5 * n - 5 :: Int
v x = sqrt $ 2 * g * x :: Double
vf = v . fromIntegral . height :: Int -> Double

f :: Double -> Int
f v0 = head . dropWhile ((<v0) . vf) $ [1..]

main = map read . lines <$> getContents >>= mapM_ (print . f)

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

typedef long long ll;
const ll INF = 1e9, MOD = 1e9 + 7;
const double EPS = 1e-9, PI = 3.141592653589793;
#define Cin(x) cin >> x
#define Cin2(x,y) cin >> x >> y
#define Cin3(x,y,z) cin >> x >> y >> z
#define Cin4(w,x,y,z) cin >> w >> x >> y >> z
#define Cout(x) cout << x << "\n"
#define Cout2(x,y) cout << x << y << "\n"
#define Cout3(x,y,z) cout << x << y << z << "\n"
#define Cout4(w,x,y,z) cout << w << x << y << z << "\n"
#define Kaigyou cout << "\n"
#define REP(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define REPR(i,a,b) for(ll i=b;i>=a;i--)
#define repr(i,n) REPR(i,0,n)
#define Size(n) (n).size()
#define All(v) (v).begin(), (v).end()

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

    string w; Cin(w);
    ll cnt[101],size;
    rep(i,101) cnt[i] = 0;
    size = Size(w);
    rep(i,size){
        cnt[w[i]-'a']++;
    }
    rep(i,101){
        if(cnt[i]%2 != 0){
            Cout("No");
            return 0;
        }
    }
    Cout("Yes");
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/












int N; ll A[401];
//---------------------------------------------------------------------------------------------------
ll B[404];
void init() {
    B[0] = A[0];
    rep(i, 1, N) B[i] = B[i - 1] + A[i];
}
ll get(int L, int R) {
    ll res = B[R];
    if (L) res -= B[L - 1];
    return res;
}
//---------------------------------------------------------------------------------------------------
ll memo[404][404];
int vis[404][404];
ll dp(int L, int R) {
    if (L == R) return 0;
    if (vis[L][R]) return memo[L][R];
    vis[L][R] = 1;

    ll res = infl;
    rep(c, L, R) chmin(res, dp(L, c) + dp(c + 1, R) + get(L, R));
    return memo[L][R] = res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> A[i];
    init();
    cout << dp(0, N - 1) << endl;
}


Measured memory_bytes: 2176
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int N;
  int A[100];
  cin >> N;
  for (int i = 0; i < 100; i++) { A[i] = -1; }
  for (int i = 0; i < N; i++) { cin >> A[i]; }
  std::sort(A, A + N);

  int alice = 0, bob = 0;
  int count = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (count % 2 == 0) {
      alice += A[i];
    } else {
      bob += A[i];
    }
    count++;
  }
  cout << (alice - bob) << endl;
}


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

//#define int long long
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* cpp template {{{ */

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REPS(i, 0, n)
#define REP0(i,n) for (ll i = 0; i <= (ll)(n); ++i)
#define REP1(i,n) for (ll i = 1; i <= (ll)(n); ++i)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {rep(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
  for(T& x: vec) is >> x;
  //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいいです。
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : " " );
  }
  return os;
}
/* }}} */

signed main() 
{
  int n,d,x;
  cin>>n>>d>>x;
  int a[n];
  int ans=0;
  rep(i,n) 
  {
    cin>>a[i];
    ans++;
    ans+=d/a[i];
    if(a[i]==1||d%a[i]==0) ans--;
  }
  print(ans+x);
  
  

  return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <math.h>
#include <set>
#include <map>
using namespace std;
#define rep(i,n) for(int i = 0; i < n ; i++)
#define pb push_back
static const int INF = 1000000;
static const int MAX = 100001;

typedef pair<int, int> P;
typedef pair<P, int> PP;


int main(void){
  int N; cin >> N;
  int cnt[MAX];
  set<int> st;
  rep(i,MAX){
    cnt[i] = 0;
  }
  int odd = 0;
  long int  b;
  rep(i,N){
    cin >> b;
    st.insert(b);
    cnt[b] += 1;
    if(cnt[b] % 2 == 1 && cnt[b] >= 2) {
      odd -= 1;
    }else if(cnt[b] % 2 == 0)  {
      odd += 1;
    }
  }

  if(odd % 2 == 0){
    cout << N - (N - st.size()) << endl;
  }else{
    cout << N - (N - st.size()) - 1 << endl;
  }


  return 0;
}

Measured memory_bytes: 5376
import sys

input = sys.stdin.readline


def main():
    A, B = [int(x) for x in input().split()]

    C = []
    for i in range(100):
        if i < 50:
            C.append(["#"] * 100)
        else:
            C.append(["."] * 100)

    whitecnt = 1
    blackcnt = 1

    for i in range(1, 50, 2):
        if whitecnt == A:
            break
        for j in range(1, 100, 2):
            C[i][j] = '.'
            whitecnt += 1
            if whitecnt == A:
                break
    for i in range(51, 100, 2):
        if blackcnt == B:
            break
        for j in range(1, 100, 2):
            C[i][j] = '#'
            blackcnt += 1
            if blackcnt == B:
                break

    print(100, 100)
    for c in C:
        print("".join(c))




if __name__ == '__main__':
    main()


Measured memory_bytes: 9312
x,y=map(int,input().split())
if x==y==2:
    print("Yes")
elif x==4:
    if y==6 or y==9 or y==11:
        print("Yes")
    else:
        print("No")
elif x==6:
    if y==4 or y==9 or y==11:
        print("Yes")
    else:
        print("No")
elif x==9:
    if y==6 or y==4 or y==11:
        print("Yes")
    else:
        print("No")
elif x==11:
    if y==6 or y==9 or y==4:
        print("Yes")
    else:
        print("No")


else:
    if y!=2 and y!=4 and y!=6 and y!=9 and y!=11:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 61944
# coding: utf-8
# Your code here!
def solv1():
    n=int(input())
    
    a=[[]for i in range(n)]
    a[0]=[[0]]
    
    for i in range(n-1):
        b=[]
        for pa in a[i]:
    #        print(pa)
            el=[j for j in set(pa)]
    #        print(el)
            el.append(max(pa)+1)
            for l in el:
                b+=[pa+[l]]
    #    print(i,b)
        a[i+1]=b
    ans=[j for j in a[n-1]]
        #print(i)
    #ans=sorted(ans)
    for i in ans:
        print(''.join([chr(j+97) for j in i]))

solv1()


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

#define rep(i, a, n)  for(ll i=a; i<n; i++)
#define per(i, a, n)  for(ll i=n-1; i>=a; i--)
#define fill0(n)  setfill('0') << right << setw(n)
#define all(x)  (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define LONGMAX 1e18
#define INTMAX 1000000000
using namespace std;
typedef long long ll;
typedef pair<int,int> p;

int a,b,c,d,e,f;
int water, sugar;

int main(){
  cin >> a >> b >> c >> d >> e >> f;
  int a100 = 100*a;
  int b100 = 100*b;
  double temp_dense = 0.0;
  double temp_sugar = 0;
  double temp_water = 0;
  double max_dense = (double)100*e/(100+e);
  // cout << "MAX_DENSE: " << max_dense << endl;
  rep(i,0,50){
    rep(j,0,50){
      if(i==0 && j==0)continue;
      rep(k,0,200){
        rep(l,0,200){
          double water = a100*i+b100*j;
          double sugar = k*c+l*d;
          if(water+sugar <= f){
            double dense = (double)100*sugar/(water+sugar);
            if(dense >= temp_dense && dense <= max_dense){
              temp_dense = dense;
              temp_sugar = sugar;
              temp_water = water;
              // cout << dense << ' ' << sugar <<' '<< water << endl;
            }
          }
        }
      }
    }
  }
  std::cout << temp_water+temp_sugar <<' '<<temp_sugar << '\n';
}


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

int main(){
    int W, H, x, y, r;

    cin >> W >> H >> x >> y >> r;

    // cout << "x - r = " << x - r << endl;
    // cout << "x + r = " << x + r <<  endl;
    // cout << "y - r = " << y - r <<  endl;
    // cout << "y + r = " << y + r <<  endl;

    if(x - r >= 0 && x + r <= W && y - r >= 0 && y + r <= H){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: 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 (b<a) { a=b; return 1;} return 0;}
struct init{init(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}}init_;

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

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

    ll ans = 0;
    vvc<ll> dp(N + 1, vl(N + 1));
    rep(i, N) repe(j, i + 1, N){
        if(S[i] == S[j]){
            chmax(dp[i + 1][j + 1], dp[i][j] + 1);
            chmax(ans, min(j - i, dp[i + 1][j + 1]));
        }
    }

    cout << ans << endl;
}   

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

#define what_is(x) cout << #x << " is " << x << endl;
#define PI acos(-1)
#define hell 1000000007
#define HELL 998244353
#define io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define fix(n) cout << fixed << setprecision(n)
#define mset(a,n) memset(a,n,sizeof a)
#define rep(i,a,b) for (__typeof((b)) i=(a);i<(b);i++)
#define repp(i,a,b,p) for(__typeof((b)) i=(a);i<(b);i+=p)
#define ren(i,a,b) for(__typeof((a)) i=(a);i>=(b);i--)
#define renn(i,a,b,p) for(__typeof((a) i=(a);i>=(b);i-=p)
#define ADD(a,b,c) ((a)%c+(b)%c)%c
#define SUB(a,b,c) ((a)%c-(b)%c+c)%c
#define MUL(a,b,c) (((a)%c)*((b)%c))%c
#define lbd lower_bound
#define ubd upper_bound
#define ll long long
#define ld long double
#define pb push_back
#define fi first
#define se second
#define vll vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(v) (v).begin(), (v).end()
#define sz(x) (ll)x.size()
// #define out(n) cout<<n<<" "
#define outl(n) cout<<n<<endl
#define bug(n) {outl(n);return;}
#define pii pair<int,int>
#define lim 1000000000000000000
#define ninf -9223372036854775802
#define M 1000000007
#define eps 1e-9
#define MAX 5
#define N 200001
#define db(a) for(auto it:a) {cout<<it<<" ";}cout<<endl;
ll prime[MAX];
ll fact[MAX];

const long long INF64 = 1e18;
ll vpow(ll a, ll b, ll p) {
    if (b == 0)
        return 1;
    if (b == 1)
        return a;
    ll temp = vpow(a, b / 2, p);
    temp *= temp;
    temp %= p;
    if (b % 2 == 0)
        return temp;
    temp = temp * a;
    temp %= p;
    return temp;
}

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


ll inverseMod(ll a, ll b, ll p) {
    if (b == 0)
        return 1;
    ll temp = vpow(b, p - 2, p);
    ll ans = temp * a;
    ans %= p;
    return ans;
}
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (int j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}

void factorial() {
    fact[0] = 1;
    fact[1] = 1;
    rep(i, 2, MAX) {
        fact[i] = (fact[i - 1] * i);
        // fact[i]%=M;
    }
}
void solve(ll ttt) {
	ll n;
    cin>>n;
    vpll a(n);
    rep(i,0,n){
        cin>>a[i].fi>>a[i].se;
    }
    bool ok=false;
    rep(i,0,n){
        pll cur=a[i];
        ll cnt=0;
        while(i<n && a[i].fi==a[i].se){
            i++;
            cnt++;
            //done=true;
        }
        if(cnt)
			i--;
        if(cnt>2)
            ok=true;
    }
    if(ok)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}

int main() {
    io;
    // sieve();
    // factorial();
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    // freopen("output1.txt","w",stdout);
#endif

    ll t = 1;
    // cin >> t;
    fix(12);
    rep(q, 1, t + 1) {
        // cout<<"Test case : "<<q<<endl;
        solve(q);
        //solve2();
    }
    return 0;

}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int main()
{
  ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
  int a, b;
  char op;
  cin >> a >> op >> b;
  
  if(op == '-')
    cout << a-b << endl;
  else
    cout << a+b << endl;
  
  return 0;
}


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

using namespace std;

const int N = 2e5 + 2;

struct Fenwick {
    int n;
    long long node[N];
    void update(int u, long long val)
    {
        for (; u <= n; u += u & -u)
            node[u] = max(node[u], val);
    }
    long long query(int u)
    {
        long long max_pref = 0;
        for (; u > 0; u -= u & -u)
            max_pref = max(max_pref, node[u]);
        return max_pref;
    }
    void set_n(int _n)
    {
        n = _n;
    }
} tree;

int main()
{
    int n;
    cin >> n;
    vector<int> h(n), a(n);
    for (int& x : h)
        cin >> x;
    for (int& x : a)
        cin >> x;

    tree.set_n(n);

    long long res = 0;
    for (int i = 0; i < n; ++i) {
        long long max_pref = tree.query(h[i] - 1);
        long long val = max_pref + a[i];
        res = max(res, val);
        tree.update(h[i], val);
    }
    cout << res;
    return 0;
}


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

namespace ITP1_7_B
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while(true)
            {
                int[] line = ReadIntAr();
                if (line.All(x => x == 0)) return;

                int rlt = 0;
                for(int i = 1; i <= line[0]; i++)
                {
                    for (int j = i+1; j <= line[0]; j++)
                    {
                        for (int k = j+1; k <= line[0]; k++)
                        {
                            if (i + j + k == line[1]) rlt++; 
                        }
                    }
                }
                Console.WriteLine(rlt.ToString());
            }
        }

        static string ReadSt() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Console.ReadLine()); }
        static long ReadLong() { return long.Parse(Console.ReadLine()); }
        static double ReadDouble() { return double.Parse(Console.ReadLine()); }
        static string[] ReadStAr(char sep = ' ') { return Console.ReadLine().Split(sep); }
        static int[] ReadIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => int.Parse(e)); }
        static long[] ReadLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => long.Parse(e)); }
        static double[] ReadDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Split(sep), e => double.Parse(e)); }

    }

}



Measured memory_bytes: 18204
#!/usr/bin/env python3
import sys
import itertools
INF = float("inf")


def solve(N: int, s: "List[str]"):

    ABcount = 0
    Aend = 0
    Bstart = 0
    AendBstart = 0
    for i in range(N):
        ABcount += s[i].count("AB")
        if s[i][0] == "B" and s[i][-1] == "A":
            AendBstart += 1
        elif s[i][0] == "B":
            Bstart += 1
        elif s[i][-1] == "A":
            Aend += 1

    # if AendBstart == 0:
    #     ABcount += min(Aend, Bstart)
    # else:
    #     if Aend + Bstart > 0:
    #         ABcount += min(Aend, Bstart) + AendBstart
    #     else:
    #         ABcount += AendBstart - 1
    # print(ABcount)
    if AendBstart > 1:
        ABcount += AendBstart - 1
        AendBstart = 1
    if Aend > 0 or Bstart > 0:
        ABcount += min(Aend, Bstart)+AendBstart
    print(ABcount)

    # 愚直
    # print("愚直")
    # ans = []
    # for kumi in itertools.permutations(s, N):
    #     ans.append("".join(kumi).count("AB"))
    # print(max(ans))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == '__main__':
    main()


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

int main(){
    
    int n,y;
    cin >> n >> y;
    bool a=false;
    for(int i=0; i<=n; i++){
        for(int j=0; j<=n-i; j++){
            if(y==10000*i+5000*j+1000*(n-i-j)){
                cout << i << ' ' << j << ' ' << n-i-j << endl;
                a=true;
            }
            if(a) break;
            if(i==n) cout << -1 << ' ' << -1 << ' ' << -1 << endl;
        }
        if(a) break;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
long long dfs(long long a)
{
	if(a==1)
	{
		return 1;
	}
	long long ans=1;
	ans+=dfs(a/2)*2;
	return ans;
}
int main()
{
    long long h;
    cin>>h;
    long long num=dfs(h);
	cout<<num;
	return 0;
}

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

int main(){

int a,b;
cin >> a >> b;

if(a>b){
 cout << "a > b" << endl;
}else if(a<b){
 cout << "a < b" << endl;
}else{
 cout << "a == b" << endl;
}
return 0;
}


Measured memory_bytes: 3084
#include <cstdio>
int main(){
	int a[33] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51}, k;
	scanf("%d", &k);
	printf("%d\n", a[k]);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

const int mod=1e9+7;
const int inf=-1;
const int sz=2e5;

#define pi acos(-1)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define gap ' '
#define lb lower_bound
#define ub upper_bound
#define clr(x) memset(x,0,sizeof(x))
#define all(x) sort(x.begin(),x.end())
#define rall(x) reverse(x.begin(),x.end())
#define dbg puts("finding wrong")
#define case(x,y) printf("Case %lld: %lld\n",++x,y)
#define fastio ios::sync_with_stdio(false);cin.tie(0)


int ar[sz];

int main()
{
  fastio;
  ll t, a, b, c, ans=0, i, n;
  string s;
  cin>>s;
  n=s.size();
  
  for(i=0; i<n; i++)
  {
      ans=(ans+(s[i]-'0'));
  }
  if(ans%9==0)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


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

int main(){
    int n, x, m_sub, min_m, rem, cnt;
    vector<int> m;
    cin >> n >> x;
    for(int i=0; i<n; i++){
        cin >> m_sub;
        m.push_back(m_sub);
    }
    rem = x;
    cnt=0;
    min_m = 100000;
    for(int i=0; i<n; i++){
        rem -= m[i];
        min_m = min(min_m, m[i]);
        cnt++;
    }
    while(rem-min_m >= 0){
        cnt++;
        rem -= min_m;
    }
    cout << cnt << endl;
    return 0;
}

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

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void f(ll x, ll d, vector<ll>& v, vector<ll>& s) {
  if(d==5)
    return;
  for(auto val: v) {
    s.push_back(x*10+val);
    f(x*10+val, d+1, v, s);
  }
}

void solve(long long N, long long K, std::vector<long long> D){
  vector<ll> v;
  vector<ll> x;
  for(ll i=0; i<10; i++) {
    auto res = find(D.begin(), D.end(), i);
    if(res == D.end())
      v.push_back(i);
  }
  f(0, 0, v, x);

  sort(x.begin(), x.end());
  ll n = N;
  while(n!=0) {
    ll y = n % 10;
    n = n / 10;

    if(find(D.begin(), D.end(), y) != D.end()) {
      auto it = lower_bound(x.begin(), x.end(), N);
      std::cout << *it << std::endl;
      return;
    }
  }
  std::cout << N << std::endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> D(K);
    for(int i = 0 ; i < K ; i++){
        scanf("%lld",&D[i]);
    }
    solve(N, K, std::move(D));
    return 0;
}


Measured memory_bytes: 1400
import java.util.Arrays;
import java.util.Scanner;

class Main{

	static	int count = 0;
	public static void main(String[] args) {



		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int[] A = new int[N];		

		int ans = 1;
		for(int i = 0;i < N;i++){
			A[i] = scanner.nextInt();

		}
		Arrays.sort(A);			

		int c= 0;
		for(int i = 0;i < N-1;i++){
			if(A[i] != A[i+1]){
				if(c % 2 == 0){
					ans++;
				}
				c = 0;
				
			}else{
				c++;
				if(i == N-2){
					if(c % 2 == 1){
						ans--;
					}
				}
			}
			
			
		}
		if(N == 1){
			ans++;
		}

		System.out.println(ans);



	}

}

class Pair implements Comparable{
	int from;
	int middle;
	int end;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}




Measured memory_bytes: 51812
import numpy as np
from collections import defaultdict
from collections import Counter
from collections import OrderedDict


#a, b, c, d = (int(i) for i in input().split())  
#a = [int(i) for i in input().split()] 

#N =  int(input())

#print(180*(N-2))

S = input()
o_count = 0
x_count = 0
for s in S:
    if s == 'o':
        o_count += 1
    else:
        x_count += 1
if x_count >= 8:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 21484
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>

#include <climits>
#include <cmath>
#include <cstring>

#include <iomanip>

using namespace std;

#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL); 
#define endl "\n"

typedef long long int  ll;
typedef unsigned long long int ull;


int main()
{
	FAST;
	int n;
	cin >> n;
	string str[n];
	for(int i=0 ; i<n ; i++)
		cin >> str[i];

	int mat[50][26] = {0};

	for(int i=0 ; i<n ; i++)
	{
		for(int j=0 ; j<str[i].size() ; j++)
			mat[i][str[i][j]-'a']++;
	}

	int ans[26] = {0};
	for(int i=0 ; i<26 ; i++)
	{
		int m = INT_MAX;
		bool flag = false;
		for(int j=0 ; j<n ; j++)
		{
		    if(mat[j][i] == 0)
		        flag = true;
			m = min(m , mat[j][i]);
		}
        if(flag == false)
		ans[i] = m;
	}

	bool flag = false;
	for(int i=0 ; i<26 ; i++)
	{
		if(ans[i] != 0)
			flag = true;

		for(int j=0 ; j<ans[i] ; j++)
			cout << (char)('a'+i);
	}

	if(!flag)
	{
		cout << " ";
	}
	return 0;
}

Measured memory_bytes: 256
def cal(a, b)
  sum = 0
  a.each_with_index do |n,i|
    sum += (n - (b+i+1)).abs
  end
  sum
end

a = $stdin.read.split("\n")[1].split(" ").map(&:to_i)
a1 = []
a.each.with_index(1) do |b, i|
  a1 << (b.to_i - i )
end
a1.sort!
if a1.size % 2 == 0
  i = a1.size / 2
else
  i = a1.size / 2 + 1
end
puts cal(a, a1[i - 1])

Measured memory_bytes: 21752
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i=0;i<(n);++i)
#define RANGE(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(n)-1;i>= 0;--i)

#define endl '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define BIG 2000000000
#define VERYBIG 1000000000000000ll
#define PI 3.141592653589793238
#define dcout cout<<fixed<<setprecision(50)
#define _popcnt __builtin_popcount

const long long dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
const long long MOD = 1e9+7;

// typedef long long ll;
#define int long long
#define double long double

template<typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

typedef pair<int, int> INTP;
typedef vector<int> INTV;
struct edge2 {int to, cost;};
struct edge3 {int from, to, cost;};

int powmod(int a, int p, int m){
	int res = 1, tmp = a;
	while(p != 0){
		if(p % 2)
			res = (res*tmp) % m;
		tmp = (tmp*tmp) % m;
		p /= 2;
	}
	return res;
}
int invmod(int a, int p){ // a^-1 mod p
	int b = p, u = 1, v = 0;
	while(b){
		int t = a / b;
		a -= t*b; swap(a, b);
		u -= t*v; swap(u, v);
	}
	u %= p;
	if(u < 0) u += p;
	return u;
}

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

	int n, a, b; cin >> n >> a >> b;
	int comb[200010];
	for(int i = 0; i <= 200000; i++){
		if(i == 0) comb[i] = 1;
		else {
			comb[i] = ((comb[i-1] * (n+1-i)) % MOD) * invmod(i, MOD) % MOD;
		}
	}
	int ans = powmod(2ll, n, MOD) - 1;
	ans -= comb[a]+comb[b];
	ans += 2*MOD; ans %= MOD;
	cout << ans << endl;
}

Measured memory_bytes: 1792
#ifdef _MSC_VER
#  define _CRT_SECURE_NO_WARNINGS
#  define _USE_MATH_DEFINES
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#include <bits/stdc++.h>
using namespace std;
using i32 = int; using i64 = long long int; using f64 = double;
using u32 = unsigned int; using u64 = unsigned long long int; using str = string;
template <typename T> using vec = vector<T>; void in() { }
template <typename T, typename...TS> void in(T &&x, TS &&...xs) { cin >> x; in(move(xs)...); }
template <typename T> void out(T &&x) { cout << x << "\n"; }
template <typename T, typename...TS> void out(T &&x, TS &&...xs) { cout << x << " "; out(move(xs)...); }
#define indef(t, ...) t __VA_ARGS__; in(__VA_ARGS__)
#define get(t) []{ t x; cin >> x; return x; }()
#define times(n, i) for (i32 i = 0; i < (n); ++i)
#define range(a, b, i) for (i32 i = (a); i < (b); ++i)
#define upto(a, b, i) for (i32 i = (a); i <= (b); ++i)
#define downto(a, b, i) for (i32 i = (a); i >= (b); --i)
#define all(xs) (xs).begin(), (xs).end()
#define sortall(xs) sort(all(xs))
#define reverseall(xs) reverse(all(xs))
#define even(x) ((abs(x) & 1) == 0)
#define odd(x) ((abs(x) & 1) == 1)
#define bit(x, i) (((x) >> i) & 1)
#define append emplace_back
#define bisect_left lower_bound
#define bisect_right upper_bound
#define bound(a, x, b) (a <= x && x <= b)
const i64 MOD = 1000000007ll;
const f64 EPS = 1e-10;

i32 n, q, k;
vec<pair<i32, i64>> d[100001];
i64 dd[100001];

void solve() {
    in(n);
    times(n-1, i) {
        indef(i32, a, b, c);
        d[a].append(make_pair(b, c));
        d[b].append(make_pair(a, c));
    }

    in(q, k);
    times(100001, i) dd[i] = LLONG_MAX;
    set<pair<i64, i32>> s;
    s.insert(make_pair(0, k));
    while (s.size()) {
        i64 a = s.begin()->first;
        i32 i = s.begin()->second;
        s.erase(s.begin());
        if (a > dd[i]) continue;
        dd[i] = a;

        times(d[i].size(), dii) {
            i32 j = d[i][dii].first;
            i64 c = d[i][dii].second;
            if (dd[j] > a+c) {
                s.insert(make_pair(a+c, j));
            }
        }
    }

    times(q, _) {
        indef(i32, x, y);
        out(dd[x] + dd[y]);
    }
}

i32 main()
{
    ios::sync_with_stdio(false);

#ifdef _MSC_VER
    /**
    ifstream fin("input.txt"); cin.rdbuf(fin.rdbuf()); assert(fin);
    ofstream fout("output.txt"); cout.rdbuf(fout.rdbuf()); assert(fout);
    /**/
#endif

    //cout << fixed << setprecision(9);
    solve();

#ifdef _MSC_VER
    /**/
    /**/
#endif
    return 0;
}

Measured memory_bytes: 15344
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>

using namespace std;

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

const ll mod = 1000000007;

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

  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (auto &x: s) cin >> x;

  ll ans = 1000000007;
  for (int i = 0; i < (1 << (h - 1)); i++) {
    ll part = 0;
    vector<Pii> section;
    int low = 0;
    int high = 1;
    int mask = i;
    while (mask > 0) {
      if (mask & 1) {
        section.emplace_back(low, high);
        low = high;
        part++;
      }
      mask >>= 1;
      high++;
    }
    section.emplace_back(low, h);
    vector<int> white(section.size());
    for (int j = 0; j < w; j++) {
      vector<int> whiteone(section.size());
      bool partneed = false;
      for (int p = 0; p < (int) section.size(); p++) {
        for (int r = section[p].first; r < section[p].second; r++) {
          if (s[r][j] == '1') whiteone[p]++;
        }
        if (white[p] + whiteone[p] > k) partneed = true;
        if (whiteone[p] > k) part += 1000000007;
        white[p] += whiteone[p];
      }
      if (partneed) {
        part++;
        white = whiteone;
      }
    }
    if (part < ans) ans = part;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int a=100000,n;
	cin>>n;
	for(int i=0;i<n;i++){
		if((a*21/20)%1000==0)a=a*21/20;
		else a=((a*21/20)/1000)*1000+1000;
	}
	cout<<a<<endl;
	return 0;
	}


Measured memory_bytes: 3024
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
 
namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			string s = cin.Next();
			int n = s.Length;
			int ans = 0;
			int temp = 0;
			for (int i = 0; i < n; i++) {
				if (s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T') {
					++temp;
				} else {
					ans = Math.Max(ans, temp);
					temp = 0;
				}
			}
 
			ans = Math.Max(ans, temp);
 
			Console.WriteLine(ans);
		}
	}
 
	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;
 
		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}
 
		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}
 
			string st = reader_();
			while (st == "") {
				st = reader_();
			}
 
			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}
 
			index_ = 0;
			return buf_[index_++];
		}
 
		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());
 
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}
 
		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}
 
		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
 
		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}
 
			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}

Measured memory_bytes: 11220
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
int n,k,a[200005],b[200005];
int main(){
	n=read(),k=read();
	for(int i=0;i<n;i++)
		a[i]=read();
	for(int i=0;i<k;i++){
		for(int j=0;j<n;j++)
			b[j]=0;
		for(int j=0;j<n;j++){
			int l=max(j-a[j],0);
			int r=min(j+a[j]+1,n);
			b[l]++,b[r]--;
		}
		bool y=(b[0]==n);
		for(int j=1;j<n;j++){
			b[j]+=b[j-1];
			if(b[j]!=n)y=false;
		}
		if(y){
			for(int j=0;j<n;j++)
				printf("%d ",n);
			return 0;
		}
		for(int j=0;j<n;j++)
			swap(a[j],b[j]);
	}
	for(int i=0;i<n;i++)
		printf("%d ",a[i]);
	return 0;
}

Measured memory_bytes: 5296
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		final long A = sc.nextLong();
		final long B = sc.nextLong();
		final long C = sc.nextLong();
		final long K = sc.nextLong();
		sc.close();
		long ans = Math.min(A, K);
		ans -= (K-A-B)>0?(K-A-B): 0;
		System.out.println(ans);
	}
}


Measured memory_bytes: 35588
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#include <bits/stdc++.h>
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define debug  freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define pb push_back
#define all(x) x.begin(),x.end()
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int maxn = 1e6+10;
const int maxM = 1e6+10;
const int inf = 0x3f3f3f3f;
const ll inf2 = 0x3f3f3f3f3f3f3f3f;

template<class T>void read(T &x){
    T s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
    x = s*w;
}
template<class H, class... T> void read(H& h, T&... t) {
    read(h);
    read(t...);
}
int N;
void solve(){
	
}	
int main(){
	// debug;
	read(N);
	int t = 0,ok = 0;
	for(int i =1;i<=N;i++){
		int c,d;read(c,d);
		if(c == d) {
			if(++t == 3) ok = 1; 
		}else{
			t = 0;
		}
	}
	if(ok) cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 3668
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))

d=[]
l={}
for i in range(n):
  x=h[i]
  avg_t= t - x * 0.006
  d.append(abs(avg_t - a))
  l[d[i]]=i+1

min=min(d)
print (l[min])


Measured memory_bytes: 3188
#dictでよかったかも？
import bisect

s=input()
t=input()

#a,b,cの出てきたところを小さい順にメモ
alp=[[] for i in range(26)]

for i in range(len(s)):
    alp[ord(s[i])-ord("a")].append(i)

#alp[w]の中からnow以降のものを探す．なければ一番手前を．
def bi_search(now,w):
    r=0
    if now>=alp[w][-1]:
        now=-1
        r=1
    ne_i=bisect.bisect_right(alp[w],now)
    ne=alp[w][ne_i]
    return ne,r

    
ans=0
rep=0
now=-1#s上の何文字目か
for i in range(len(t)):
    num=ord(t[i])-ord("a")
    if len(alp[num])==0:
        ans=-1
        break
    now,r=bi_search(now,num)
    rep+=r
if ans==-1:
    print(ans)
else:
    ans=rep*len(s)+now+1
    print(ans)

Measured memory_bytes: 46188
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

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


using namespace std;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define dump(x)  cout << #x << " = " << (x) << endl;

#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
//             0123456789 - digits. check the limits, int vs long
const int MX = 100001;

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(6);
    cout << std::fixed;
    // freopen("ex.in","r",stdin);
    // freopen("ex.out","w",stdout);
    long a, b;
    cin >> a >> b;
    long d;
    d = __gcd(a, b);
    int rootD = sqrt(d);
    int ans = 1;
    for (int i = 2; i <= rootD; i++) {
        if (d % i == 0) ans++;
        while(d % i == 0) {
            d /= i; 
        }
    }
    if (d != 1) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys, math
from functools import lru_cache
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    x, y = i2(N)

    Mw = max(x[i]+y[i] for i in range(N))
    mw = min(x[i]+y[i] for i in range(N))
    Mz = max(x[i]-y[i] for i in range(N))
    mz = min(x[i]-y[i] for i in range(N))

    print(max(Mz-mz, Mw-mw))
    


if __name__ == '__main__':
    main()


Measured memory_bytes: 63204