akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = b - 1; i >= a; i--)
#define ALL(a) a.begin(), a.end()
#define pii pair<int,int>
#pragma GCC optimize("Ofast")
#define pcnt __builtin_popcount
#define buli(x) __builtin_popcountll(x)
#define pb push_back
#define mp make_pair
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define isSquare(x) (sqrt(x)*sqrt(x) == x)
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; };
inline void IN(void){return;}
template <typename First, typename... Rest> void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
inline void OUT(void){cout << "\n";return;}
template <typename First, typename... Rest> void OUT(First first, Rest... rest){cout << first << " ";OUT(rest...);return;}
const double EPS = 1e-9;
const int mod = 1e9 + 7;
const int INF = 1e9;
const long long LLINF = 1e18;
long long lcm(ll a, ll b){return a * b / __gcd(a,b);}
struct IoSetup { IoSetup() {
    cin.tie(nullptr);ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
} } iosetup;
template< int mod > struct ModInt {
    int x; ModInt() : x(0) {}
    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) {if((x += p.x) >= mod) x -= mod;return *this;}
    ModInt &operator-=(const ModInt &p) {if((x += mod - p.x) >= mod) x -= mod;return *this;}
    ModInt &operator*=(const ModInt &p) {x = (int) (1LL * x * p.x % mod);return *this;}
    ModInt &operator/=(const ModInt &p) {*this *= p.inverse();return *this;}
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); }return ModInt(u);}
    ModInt pow(int64_t n) const {ModInt ret(1), mul(x); while(n > 0) {if(n & 1) ret *= mul;mul *= mul;n >>= 1;}return ret;}
    friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x;}
    friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt< mod >(t); return (is); }
    static int get_mod() { return mod; }
}; using modint = ModInt< mod >;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main(){
    iosetup;
    int N, A, B; IN(N, A, B);
    if((B - A) % 2 == 0) puts("Alice");
    else puts("Borys");
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

int main(){
    double a,b,c,d,e,f;
    while(scanf("%lf %lf %lf %lf %lf %lf", &a,&b,&c,&d,&e,&f)+1){
        double x = (c*e-b*f)/(a*e-b*d);
        double y = (c*d-a*f)/(b*d-a*e);
        if( x == 0 ) x = 0;
        if( y == 0 ) y = 0;
        //x = ((int)(x*1000+0.5))/1000;
        //y = ((int)(y*1000+0.5))/1000;
        printf("%.3lf %.3lf\n", x, y);
        //printf("%.3lf %.3lf\n", x+0.0005, y+0.0005);
    }

   // double dd = 1.3335;
   // printf("%.3lf\n", dd);
   // //dd = ((int)(dd*1000+0.5))/1000;
   // printf("%.3lf\n", dd*1000);
   // printf("%.3lf\n", dd*1000+0.5);
   // printf("%.3lf\n", ((int)(dd*1000+0.5))/1000);
   // printf("%.3lf\n", dd);
    

    return 0;
}

Measured memory_bytes: 1080
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	var n int
	fmt.Scanf("%d", &n)

	adj := make([][]string, n)
	for i := 0; i < n; i++ {
		adj[i] = make([]string, n)
		for j := 0; j < n; j++ {
			adj[i][j] = "0"
		}
	}

	sc := bufio.NewScanner(os.Stdin)
	for i := 0; i < n; i++ {
		sc.Scan()
		adjList := strings.Split(sc.Text(), " ")
		outDegree, _ := strconv.Atoi(adjList[1])

		if outDegree > 0 {
			for k := 0; k < outDegree; k++ {
				j, _ := strconv.Atoi(adjList[k+2])
				adj[i][j-1] = "1"
			}
		}
	}

	for i := 0; i < len(adj); i++ {
		fmt.Println(strings.Join(adj[i], " "))
	}

}



Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <utility>
#include <queue>
#include <map>
 
#define fir first
#define sec second
#define sz(s) (s).size();
#define pb push_back
#define get(n) scanf("%d",&n);
#define gets(s) string s;cin >> (s);
#define prfi(n) printf("%d", &n);
#define prfd(n) printf("%lf", &n);
#define All(s) (s).begin(), (s).end()
#define rep(i,j,k) for(int (i)=(j);(i)<=(k);(i)++)
#define repdown(i, j, k) for(int (i)=(j);(i)>=(k);(i)--)
#define dump(x)  std::cout << #x << " = " << (x) << std::endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
 
using ll = long long;
using vi = std::vector<int> ;
using vvi = std::vector<vi> ;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vd = std::vector<double> ;
using vvd = std::vector<vd> ;
using qi = std::queue<int> ;
using vpii = std::vector<std::pair<int, int> >;
using namespace std;
 
const int Mod = (1e9) + 7;
const int max_n = 3 * (1e5) + 1;
const int max_m = 83 * (1e5) + 1;
const int INF = 10241024;
long double INFD = 100100100;
 
//_____________________________________Templates_________________________________________//
 
template<class T1, class T2> inline void chmin(T1 &a, T2 b){if(a > b) a = b;}
template<class T1, class T2> inline void chmax(T1 &a, T2 b){if(a < b) a = b;}
 
//mainly use for dynamic prog
template<class T1, class T2>
void update(T1 &a, T2 b){
  a += b;
  if(a > Mod) a %= Mod;
}
 
inline void IN(void){
  return;
}
 
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}
 
inline void OUT(void){
  cout << "\n";
  return;
}
 
template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}
 
//_____________________array calc____________________________________//
/*
vvi mul(vvi &A, vvi &B){
  vvi C(A.size(), vi(B.size()))
  rep(i,A.size()){
    rep(j,B.size()){
      rep(k,B[0].size()){
        C[i][j] = (C[i][j] A[i][k] + B[k][j]) % Mod;
      }
    }
  }
 
  return C;
}
 
vvi pow(vvi A, ll n){
  vvi B(A.size(), vi(A.size()));
  rep(i=0;i<A.size();i++){
    B[i][i] = 1;
  }
 
  while (n >0){
    if (n & 1) B = mul(B, A);
    A = mul(A, A);
    n = n >> 1;
  }
  return B;
}
*/
//_____________________Bynary Indexed Tree __________________________//
/*
const max_st = (1 << 15) - 1;
int bit[max_st];
int sum (int i){
  int s = 0;
  while(i > 0){
    s += bit[i];
    i -= i & -i;
  }
  return s;
}
 
void add(int i, int x){
  while(i <= n){
    bit[i] += x;
    i += i & -i;
  }
}
*/
//_____________________　following sorce code_________________________//
vll dp(100100);
vll dp2(100100);
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  ll N, W;IN(N, W);
  rep(i,0,N-1){
    int a,b;IN(a,b);
    rep(j,a,W){
      chmax(dp[j], dp2[j-a]+b);
    }
    dp2 = dp;
  }
  OUT(dp[W]);
  return 0;
}

Measured memory_bytes: 1792
import Data.List
main=interact$show.f.map read.words
f(n:k:l)=maximum[sum$map(max 0)x++y|i<-[0..k],j<-[0..k-i],i+j<=n,let(x,y)=splitAt(k-i-j).sort$take i l++drop(n-j)l]

Measured memory_bytes: 1020
#include <bits/stdc++.h>
#include <iostream>
#include <numeric>
#include <string>
#include <list>
#include <limits>
#include <type_traits>
#include <vector>

using namespace std;

int main(void) {

    int a , b, c, k;
    int sum = 0;

    cin >> a;
    cin >> b;
    cin >> c;
    cin >> k;

    if ( a >= k ) {
        cout << k;
        return 0;
    }
    
    sum += a;
    k -= a;

    if ( b >= k) {
        cout << sum;
        return 0;
    }

    k -= b ;

    if ( c >= k  ) {
        sum -= k;
    }
    else {
        sum -= c;
    }
    

    cout << sum;

}

Measured memory_bytes: 3636
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>

int main(){
	long long int n,a,b;
	scanf("%lld %lld %lld",&n,&a,&b);
	long long int x[n];
	int i;
	long long int hiroudo=0;
	
	for(i=0;i<n;i++){
		scanf("%lld",x+i);
	}
	
	for(i=0;i<n-1;i++){
		if((x[i+1]-x[i])*a<b){
			hiroudo+=(x[i+1]-x[i])*a;
		}else{
			hiroudo+=b;
		}
	}
	
	printf("%lld\n",hiroudo);
	
    return 0;
}


Measured memory_bytes: 896
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<vector>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define LL long long int
#define REP(i,n) for (int i = 1; i <= (n); i++)
#define Redge(u) for (int k = h[u],to; k; k = ed[k].nxt)
#define cls(s,v) memset(s,v,sizeof(s))
#define mp(a,b) make_pair<int,int>(a,b)
#define cp pair<int,int>
using namespace std;
const int maxn = 100005,maxm = 100005,INF = 0x3f3f3f3f;
inline int read(){
	int out = 0,flag = 1; char c = getchar();
	while (c < 48 || c > 57){if (c == '-') flag = 0; c = getchar();}
	while (c >= 48 && c <= 57){out = (out << 1) + (out << 3) + c - 48; c = getchar();}
	return flag ? out : -out;
}
int main(){
	int a = read(),b = read(),c = read(),k = read();
	while (a >= b && k--) b <<= 1;
	while (k--) c <<= 1;
	if (a < b && b < c) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3632
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
#define N 500005
using namespace std;
int nxt[N],num[N*8];char s[N*8],t[N];
void getnxt(char s[]){
    nxt[0]=nxt[1]=0;
    int l=strlen(s);
    for(int i=1;i<l;++i){
        int j=nxt[i];
        while(j && s[i]!=s[j]) j=nxt[j];
        nxt[i+1]= s[i]==s[j] ? j+1 : 0 ;
    }
}
int kmp(char s1[],char s2[]){
    getnxt(s1);
    int ans=0;
    int n=strlen(s1),m=strlen(s2);
    for(int i=0,j=0;i<m;++i){
    	num[i]=0;
        while(j && s1[j]!=s2[i]) j=nxt[j];
        if(s1[j]==s2[i]) ++j;
        if(j==n) num[i]=1+num[i-n],ans=max(ans,num[i]);
    }
    return ans;
}
int main(){
	scanf("%s%s",&s,&t);
	int n=strlen(s),m=strlen(t);
	if(n>=m){
		for(int i=n;i<4*n;++i) s[i]=s[i%n];
		int ans1=kmp(t,s);
		for(int i=4*n;i<8*n;++i) s[i]=s[i%n];
		int ans2=kmp(t,s);
		if(ans1<ans2) printf("-1\n");
		else printf("%d\n",ans1);
	}
	else{
		int len=(m/n+1)*n*2;
		for(int i=n;i<len;++i) s[i]=s[i%n];
		int ans1=kmp(t,s);
		for(int i=len;i<2*len;++i) s[i]=s[i%n];
		int ans2=kmp(t,s);
		if(ans1<ans2) printf("-1\n");
		else printf("%d\n",ans1);
	}
	return 0;
}

Measured memory_bytes: 22272
#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(s) scanf("%s", s)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(s) printf("%s\n", s)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
int mpow(int base, int exp);
void ipgraph(int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N;
//=======================

vi g[N];
int a[N];

int main()
{
    ios_base::sync_with_stdio(0);
    int t, i, j, k, p, q, r, x, y, u, v, n, m;
    cin >> n;
    // vi ar(n);
    vi hash(n + 1, 0);
    fo(i, n - 1)
    {
        cin >> x;
        hash[x]++;
    }
    for (int i = 1; i < n + 1; ++i)
    {
        cout << hash[i] << '\n';
    }
    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int i, u, v;
    while (m--)
    {
        cin >> u >> v;
        g[u - 1].pb(v - 1);
        g[v - 1].pb(u - 1);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


Measured memory_bytes: 11084
#include <iostream>
using namespace std;
int main(){
    int a,b;
    char c;
    cin>>a>>c>>b;
    if(c=='+')cout<<a+b;
    if(c=='-')cout<<a-b;
    if(c=='/')cout<<a/b;
    if(c=='*')cout<<a*b;
    return 0;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C &a4, C b4) { a4 = min(a4, b4); }
template<class C> void maxi(C &a4, C b4) { a4 = max(a4, b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream &operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto vv : V) os << vv << ","; return os << "]";
}
template<class L, class R> ostream &operator<<(ostream &os, pair<L,R> P) {
  return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif

int n;
vector<int> t;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  cin >> n;
  t.resize(n);
  R(i,n){
    cin >> t[i];
  }
  reverse(ALL(t));
  int mi = 2;
  int ma = 2;
  R(i,n){
    mi = (mi + t[i] - 1) / t[i] * t[i];
    ma = ma / t[i] * t[i] + t[i] - 1;
    if(mi > ma){
      cout << "-1\n";
      return 0;
    }
  }
  cout << mi << " " << ma << "\n";
}


Measured memory_bytes: 1024
package main
import (
	"fmt"
	"math"
)

type floats []float64
func (f floats)find(key float64)bool{
	for _, v := range f{
		if v==key{
			return true
		}
	}
	return false
}

func main(){
	var n int
	fmt.Scan(&n)
	cnt := 0
	// 既出の素数を保存しておく

	for i:=0; i<n; i++{
		var x float64
		var primes floats
		fmt.Scan(&x)
		if !primes.find(x) && check(x){
			cnt++
			primes = append(primes, x)
		}
	}
	fmt.Println(cnt)
}


func check(x float64)bool{
	for i:=2; i<int(math.Sqrt(x))+1; i++{
		if int(x)%i==0{
			return false
		}
	}
	return true
}


Measured memory_bytes: 1768
#include <bits/stdc++.h>
#define optimize ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
#define ll long long
#define ld long double
#define vi vector<int>
#define si set<int>
#define vc vector<char>
#define vb vector<bool>
#define vll vector<ll>
#define vd vector<double>
#define lb(v,x) lower_bound(v.begin(), v.end(), x) - v.begin()
#define up(v,x) upper_bound(v.begin(), v.end(), x) - v.begin() - 1
#define pb push_back
#define lp(i,a,b) for(int i = a ; i <= b ; i ++)
#define rlp(i,a,b) for(int i = b ; i >= a ; i --)
#define a_sort(v) sort(v.begin(), v.end())
#define d_sort(v) sort(v.rbegin(), v.rend())
#define vin(v) for(auto &x : v) cin >> x
#define vout(v) for(auto x : v) cout << x << ' ' ; cout << endl
#define pii pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define pi 3.14159265358979323846264338327950
using namespace std ;
// #define debug

const int MOD = 1E9 + 7 ;
const int N = 1E5 ;

int main() {
    #ifdef debug
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif // debug
    optimize

    string s ; cin >> s ;
    string t ; cin >> t ;
    int cnt = 0 ;
    lp(i, 0, s.size() - 1) if(s[i] != t[i]) cnt ++ ;
    cout << cnt << endl ;
}


Measured memory_bytes: 3796
<?php
$sum = [0 => PHP_INT_MAX];
$ans = 0;
$mmax = 0;
fscanf(STDIN, "%d %d", $N, $M);
$arr = array_fill(1, $M, []);
for ($i = 0; $i < $N; $i++) {
    fscanf(STDIN, "%d %d", $A, $B);
    $arr[$A][] = $B;
}

for ($i = 1; $i <= $M; $i++) {
    foreach ($arr[$i] as $dummy => $v) {
        if (!isset($sum[$v])) {
            $sum[$v] = 1;
        } else {
            $sum[$v]++;
        }
        $mmax = max($mmax, $v);
    }

    $ans += $mmax;
    if ($sum[$mmax] === 1) {
        unset($sum[$mmax]);
        $mmax = max(array_keys($sum));
    } else {
        $sum[$mmax]--;
    }
}
echo $ans;

Measured memory_bytes: 47608
n,x=map(int,input().split())
a=list(map(int,input().split()))
b=a.copy()
ans=sum(a)
for k in range(1,n):
  for i in range(n):
    if b[i]>a[i-k]:b[i]=a[i-k]
  d=sum(b)+x*k
  if d<ans:ans=d
print(ans)

Measured memory_bytes: 3188
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll mod = 998244353;



ll N, R, G, B,ans;
string S;

int main() {
	
	cin >>R>>G>>B>> N;

	FOR(i, 0, 3001) {
		FOR(j, 0, 3001) {
			if ((N - i * R - j * G) >= 0 && (N - i * R - j * G) % B == 0)ans++;
		}
	}
	cout << ans << endl;
	
	return 0;
}

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


int main() {
  int X;
  cin >> X;
  
  if(X>=1800){
    cout << 1<<endl;
  }
  else if(X>=1600){
    cout << 2 <<endl;
  }
  else if(X>=1400){
    cout << 3 <<endl;
  }
  else if(X>=1200){
    cout << 4 <<endl;
  }
  else if(X>=1000){
    cout << 5 <<endl;
  }
  else if(X>=800){
    cout << 6 <<endl;
  }
  else if(X>=600){
    cout << 7 <<endl;
  }
  else{
    cout << 8 <<endl;
  }
}


Measured memory_bytes: 3620
n, W = map(int, input().split())
items = [list(map(int, input().split())) for i in  range(n)]  #[v, w]

dp = [[0 for i in range(W+1)] for j in range(n+1)]
for i in range(n):
    for w in range(W+1):
        if w >= items[i][1]:
            dp[i+1][w] = max(dp[i][w], dp[i][w - items[i][1]] + items[i][0])
        else:
            dp[i+1][w] = dp[i][w]

print(dp[n][W])


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

int ctoi(char c) {
	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}
int main(){
  string s;
  cin>>s;
  int n = s.length();
  int diff = 1000;
  for(int i=0;i<n-2;++i){
    int a;
    a = ctoi(s[i])*100+ctoi(s[i+1])*10+ctoi(s[i+2]);
    diff = min(diff,abs(753-a));
  }
cout << diff<<endl;
}

Measured memory_bytes: 256
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int const N = 1e5 + 20 ;
int n , a[N] ;

inline bool get (int x) {
	if (!((a[x] - x) & 1)) return 1 ;
	int low = x , high = n ;
	while (high - low > 1) {
		int mid = (low + high) >> 1 ;
		if (a[mid] == x + 1) low = mid ;
		else high = mid ;
	}
	if (!((low + 1 - x) & 1)) return 1 ;
	return 0 ;
}

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

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

	sort(a , a + n , greater<int>()) ;

	for (int i = 0 ; i < n ; i ++) {
		if (i == n - 1 || a[i + 1] <= i + 1) return cout << (get(i) ? "First" : "Second") << '\n' , 0 ;
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long lint;

const int MAX_N = 1005;
int N, M;
lint x[MAX_N], y[MAX_N], z[MAX_N], pt[MAX_N];

int main(){
    cin >> N >> M;
    for(int i=0;i<N;i++) cin >> x[i] >> y[i] >> z[i];

    lint ans = 0;
    for(int i=0;i<8;i++){
        for(int j=0;j<N;j++){
            if((i&1)) pt[j] = x[j];
            else pt[j] = -x[j];
            if((i>>1) & 1) pt[j] += y[j];
            else pt[j] -= y[j];
            if((i>>2) & 1) pt[j] += z[j];
            else pt[j] -= z[j];
        }

        sort(pt, pt+N); reverse(pt, pt+N);

        lint cur = 0;
        for(int j=0;j<M;j++) cur += pt[j];
        ans = max(ans, cur);
    }

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

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

void trace(int A[],int N){
	int i;
	for(int i=0;i<N;i++){
		if(i>0)	printf(" ");
		printf("%d",A[i]);
	}
	printf("\n");
}

void insertionSort(int A[],int N){
	int j,i,v;
	for(i=1;i<N;i++){
		v=A[i];
		j=i-1;
		while(j>=0&&A[j]>v){
			A[j+1]=A[j];
			j--;
		}
		A[j+1]=v;
		trace(A,N);
	}
}

int main(){
	int N,i,j;
	int A[100];
	
	scanf("%d",&N);
	for(i=0;i<N;i++){
		scanf("%d",&A[i]);
	}
	
	trace(A,N);
	insertionSort(A,N);
	
	return 0;
}




Measured memory_bytes: 3180
#include <iostream>

using namespace std;
void trace(int a[],int n){
    for(int i=0;i<n;++i){
        if(i>0){
            cout << " ";}
            cout <<a[i];


    }
    cout << endl;
}
void isort(int a[],int n){
    int j,v;
    for (int i=1;i<n;++i){
        v=a[i];
        j=i-1;
        while(j>=0&&a[j]>v){
            a[j+1]=a[j];
            j--;
        }
        a[j+1]=v;
        trace(a,n);
    }
}

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

        trace(a,n);
        isort(a,n);

    return 0;

}



Measured memory_bytes: 3076
import java.io.*;

public class Main{
    public static void main(String[] args){
        String line;
        int x;
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        try{
            line = reader.readLine();
            x = Integer.parseInt(line);
            System.out.println(x*x*x);
        }catch(NumberFormatException e){
            System.out.println(e);
        }catch(IOException e){
            System.out.println(e);
        }
    }
}


Measured memory_bytes: 24128
def resolve():
    N, K = list(map(int, input().split()))
    A = list(map(lambda x: int(x)-1, input().split()))
    routes = [0]
    current = 0
    visited = [False for _ in range(N)]
    visited[0] = True
    while visited[A[current]] is False:
        current = A[current]
        routes.append(current)
        visited[current] = True
    leftlen = routes.index(A[current])
    repeat = routes[leftlen:]
    # print(leftlen)
    # print(routes)
    # print(repeat)
    print(repeat[(K-leftlen)%len(repeat)]+1 if K > leftlen else routes[K]+1)


if '__main__' == __name__:
    resolve()


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


#define INF 1000000000000
int n,m,q;
vector<int>a(50);
vector<int>b(50);
vector<int>c(50);
vector<int>d(50);

int ans=0;
vector<int>h(10);
void dfs(int pos,int last){
  if(pos==n){
    int temp=0;
    rep(j,q){
     if(h.at(b.at(j)-1)-h.at(a.at(j)-1)==c.at(j)){temp+=d.at(j);}
   }
   ans=max(ans,temp);
  return;
}

  h.at(pos)=last;

  for(int k=last;k<=m-1;k++){
    dfs(pos+1,k);
  }
}

signed main()
 {
   cin>>n>>m>>q;

   rep(i,q){
     cin>>a.at(i)>>b.at(i)>>c.at(i)>>d.at(i);
   }

    dfs(0,0);

   cout<<ans;
}


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

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

    vector<int> p(m);
    vector<string> s(m);
    rep(i, m) {
        cin >> p[i] >> s[i];
        p[i]--;
    }

    vector<int> ac(n, 0), wa(n, 0);
    rep(i, m) {
        if (ac[p[i]] != 0) continue;
        if (s[i] == "AC") {
            ac[p[i]]++;
        } else {
            wa[p[i]]++;
        }
    }

    long long ac_cnt = 0, wa_cnt = 0;
    rep(i, n) {
        ac_cnt += ac[i];
        if (ac[i] != 0 ) wa_cnt += wa[i];
    }

    cout << ac_cnt << " " << wa_cnt << endl;
    
    return 0;
}

Measured memory_bytes: 6912
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long LL;

const int MOD=1000000007;

int n,m,bin[205],g[20][40005],f[40005],q[40005];

int read()
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

int lowbit(int x) {return x&(-x);}

int main()
{
	n=read();m=read();
	bin[0]=1;
	for (int i=1;i<=max(n,m);i++) bin[i]=bin[i-1]*2%MOD;
	for (int i=1;i<=m;i++)
	{
		int x=read()-1,y=read()-1;
		g[x][bin[y]]=1;
	}
	for (int i=0;i<n;i++)
		for (int j=1;j<bin[n];j++)
			g[i][j]=g[i][j-lowbit(j)]+g[i][lowbit(j)];
	for (int i=1;i<bin[n];i++)
	{
		if ((i&1)!=(i&2)/2) continue;
		f[i]=1;int h=0;
		for (int s=i;s;s=(s-1)&i) q[++h]=s;
		while (h--)
		{
			int s1=q[h+1],s2=s1^i,w=f[s1];
			if ((s1&1)!=(s1&2)/2) continue;
			for (int j=0;j<n;j++)
				if (s1&bin[j]) w=(LL)w*(bin[g[j][s2]]-1)%MOD;
				else if (s2&bin[j]) w=(LL)w*bin[g[j][s1]]%MOD;
			f[i]+=w;f[i]-=f[i]>=MOD?MOD:0;
		}
	}
	printf("%d",(bin[m]+MOD-f[bin[n]-1])%MOD);
	return 0;
} 

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

public class ALDS1_10_B
{
    public static void Main(string[] args)
    {
        //var exStdIn = new System.IO.StreamReader( "input.txt" );
        //System.Console.SetIn( exStdIn );

        int d = int.Parse(Console.ReadLine());
        List<Tuple<int, int>> m = new List<Tuple<int, int>>();
        for (int i = 0; i < d; i++)
        {
            int[] line = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            m.Add(new Tuple<int, int>(line[0], line[1]));
        }
        Solve(m);
    }

    private static void Solve(List<Tuple<int, int>> m)
    {
        List<List<int>> dp = new List<List<int>>();
        for (int i = 0; i < m.Count; i++)
        {
            dp.Add(new List<int>());
            for (int j = 0; j < m.Count; j++)
            {
                if (i == j)
                {
                    dp[i].Add(0);
                }
                else
                {
                    dp[i].Add(-1);
                }
            }
        }
        for (int count = 2; count <= m.Count; count++)
        {
            for (int i = 0; i < m.Count - count + 1; i++)
            {
                int j = i + count - 1;
                Cul(i, j, m, dp);
            }
        }
        Console.WriteLine(dp[0][m.Count-1].ToString());
    }

    private static void Cul(int i, int j, List<Tuple<int, int>> m, List<List<int>> dp)
    {
        for (int k = i; k < j; k++)
        {
            int val = dp[i][k] + dp[k+1][j] + m[i].Item1 * m[k].Item2 * m[j].Item2;
            if (dp[i][j] == -1 || val < dp[i][j])
            {
                dp[i][j] = val;
            }
        }
    }
}



Measured memory_bytes: 18292
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n;
    cin>>n;
    vector<ll> vadd;
    vector<ll> vminus;
    for(ll i=1;i<=n;i++){
        ll h;
        cin>>h;
        vadd.pb(i+h);
        vminus.pb(i-h);
    }
    sort(vadd.begin(),vadd.end());
    sort(vminus.begin(),vminus.end());
    ll ans=0;
    ll pointadd=0;
    ll pointminus=0;
    while(pointadd<n && pointminus<n){
        while(vminus[pointminus]<=0){
            pointminus++;
        }
        if(vminus[pointminus]<vadd[pointadd]){
            pointminus++;
        }
        else if(vminus[pointminus]>vadd[pointadd]){
            pointadd++;
        }
        else if(vminus[pointminus]==vadd[pointadd]){
            ll a=1,b=1;
            for(ll i=pointminus+1;i<n;i++){
                if(vminus[pointminus]==vminus[i]){
                    a+=1;
                }
                else{
                    pointminus=i;
                    break;
                }
            }
            for(ll i=pointadd+1;i<n;i++){
                if(vadd[pointadd]==vadd[i]){
                    b+=1;
                }
                else{
                    pointadd=i;
                    break;
                }
            }
            ans+=a*b;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 6696
//

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) int n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
#define cout15(a) printf("%.15f\n",a)
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<ll,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    ll a,b,c,d;cin>>a>>b>>c>>d;
    ll gd = lcm(c,d);
    cout<<b-a+1-((b/c+b/d-b/gd)-((a-1)/c+(a-1)/d-(a-1)/gd))<<nnn;
    return 0;
}

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

int main() {
	int d; scanf("%d", &d);
	rep(i, d) {
		int x1, y1, w, h, n; scanf("%d%d%d%d%d", &x1, &y1, &w, &h, &n);
		int x2 = x1 + w, y2 = y1 + h;
		int cnt = 0;
		rep(j, n) {
			int x, y; scanf("%d%d", &x, &y);
			if (x1 <= x&&x <= x2&&y1 <= y&&y <= y2)cnt++;
		}
		printf("%d\n", cnt);
	}
}

Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<typename T1, typename T2> inline bool chmin(T1& a, T2 b) { if (a > b) { a = b; return 1; }return 0; }
template<typename T1, typename T2> inline bool chmax(T1& a, T2 b) { if (a < b) { a = b; return 1; }return 0; }
template<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline ostream& operator << (ostream& out, const vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }


int main() {
	IOS;
	int n;
	cin >> n;
	double eps = 0.00001;
	int m = floor((double)n / 1.08+eps);
	bool flag = false;
	if (floor((double)(m - 1) * 1.08) == n) {
		put(m - 1);
		return 0;
	}
	if (floor((double)m * 1.08) == n) {
		put(m);
		return 0;
	}
	if (floor((double)(m + 1) * 1.08) == n) {
		put(m + 1);
		return 0;
	}
	put(":(");
	return 0;
}


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

using namespace std;
long long dp[1000000];
long long solve(long long u){
     if(u==0)return 2;
     if(u==1)return 1;
     if(dp[u]!=-1)return dp[u];
     else return dp[u]=solve(u-1)+solve(u-2);
}
int main(){
    long long n; cin>> n;
    memset(dp,-1,sizeof dp);
    cout<<solve(n)<<endl;
    return 0;
}


Measured memory_bytes: 8064
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <unordered_map>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;




int main() {
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n;
	cin >> n;
	vi a(n + 1);
	vi b(n);
	for (int i = 0; i < n + 1; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++)
		cin >> b[i];
	long long res = 0;
	int last = 0;
	for (int i = 0; i < n + 1; i++) {
		res += min(last, a[i]);
		a[i] -= min(last, a[i]);
		if (i == n)
			break;
		res += min(a[i], b[i]);
		b[i] -= min(a[i], b[i]);
		last = b[i];
	}
	cout << res << endl;

	return 0;
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
map<ll,ll> mp;
ll dp(ll h){
	if(h==1) {
		return 1;
	}
	return 2*dp(h/2)+1;
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	ll h;
	cin>>h;
	cout<<dp(h)<<endl;



	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int N;
int S[26] = {0};


int main()
{
    cin >> N;
    char c;
    for (int i = 0;i < N; i++)
    {
        cin >> c;
        S[c-97]++;
    }

    long long int ans = 1;
    for (int i = 0; i < 26; i++)
    {
        if (S[i])
            ans = ans * (S[i]+1);

        if (ans >= 1000000007)
            ans %= 1000000007;
    }

    cout << ans -1;




    return 0;
}


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

int digit (int no) {
    int ans = 0;
    while (no > 0) {
        ans += no % 10;
        no /= 10;
    }

    return ans;
}

int main(void) {
    int n, a, b;
    cin >> n >> a >> b;

    int ans = 0;
    int sum;

    for (int i = 1; i <= n; i++) {
        sum = digit (i);
        if (a <= sum && sum <= b) {
            ans += i;
        }
    }

    cout << ans;
    cout << "\n";
}

Measured memory_bytes: 256
import java.util.Scanner;;

class Main{
    public static void main(String[] args){
    	Scanner scan = new Scanner(System.in);
    	
    	try {
			while(scan.hasNextInt()){
				System.out.println(Integer.toString(scan.nextInt() + scan.nextInt()).length());
			}
		} catch (NumberFormatException e) {
			System.out.println("数字を入力してください");
		}
    }
}

Measured memory_bytes: 20412
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

using namespace std;

typedef long long LL;
typedef vector<LL> VL;
#define REPD(i,a,b) for (LL i=(a);i<(b);i++)
#define REP(i,n) REPD(i,0,n)

LL inputValue(){
  LL a;
  cin >> a;
  return a;
};

vector<LL> inputVector(LL a){
  vector<LL> rv;
  REP(i, a){
    LL input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}

vector<string> inputVectorString(LL a){
  vector<string> rv;
  REP(i, a){
    string input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}
vector<vector<LL>> inputVector2D(LL a, LL b){
  vector<vector<LL>> rv;
  REP(i, a){
    rv.push_back(vector<LL>());
    REP(j, b) {
      LL input;
      cin >> input;
      rv.at(i).push_back(input);
    }
  }
  return rv;
}

#if 1
#define debug(d) debug1(__LINE__,#d, d)
void debug1(LL line, const char* name, vector<LL>& v) {
  cout << line << ":" << name << ":vector<LL>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, LL i) {
  cout << line << ":" << name << ":LL " << i << endl;;
}
void debug1(LL line, const char* name, vector<string>& v) {
  cout << line << ":" << name << ":vector<string>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, vector<vector<LL>>& v) {
  cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    REP(j, (LL)v.at(i).size()) {
      cout << v.at(i).at(j) << " ";
    }
    cout << ", ";
  }
  cout << endl;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
	cout.precision(16);
  // source code
  int n = inputValue();
  VL as = inputVector(n);
  double t = 0;
  REP(i, n) {
    t += 1.0 / as.at(i);
  }
  cout << (1.0 / t) << endl;


  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e15;
using namespace std;
typedef long long ll;
int main() {
  ll a, b;
  cin >> a >> b;
  if (b == 1) {
    cout << 0 << endl;
    return 0;
  }
  FOR(i, 1, 40) {
    ll now = 1;
    now += a * i - i;
    if (now >= b) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 256
n=int(input())
s=input()
a=[0 for _ in range(n)]
a[0]=s[1:].count('E')
for i in range(1,n):
  a[i]=a[i-1]
  if s[i]=="E":
    a[i]-=1
  if s[i-1]=="W":
    a[i]+=1
print(min(a))

Measured memory_bytes: 15504
//#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,t;
	cin >> n >> t;
	ll arr[n];
	for(int i=0 ; i<n ; i++)
		cin >> arr[i];

	ll ans = t;
	ll end = arr[0]+t;
	for(int i=1 ; i<n ; i++)
	{
		if(end <= arr[i])
		{
			end = arr[i] + t;
			ans += t;
		}
		else
		{
			ans += (arr[i]+t-end);
			end = arr[i]+t;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1920
#include<stdio.h>
#include<string.h>

typedef struct D
{
	int n,r,l,d,p,dep,h,sub,deg;
}D;

D node[30];
int i,j,N,r,l,n;

int dfs(int p,int d)
{
	int a,b;
	if(p==-1)return -1;
	node[p].dep=d;
	a=dfs(node[p].r,d+1);
	b=dfs(node[p].l,d+1);
	if(a==-1&&b==-1)
		node[p].h=0;
	else
		node[p].h=(a>b?a:b)+1;
	return node[p].h;
}

int main()
{
	memset(node,-1,sizeof(node));
	scanf("%d",&N);
	for(i=0;i<N;i++)
	{
		scanf("%d%d%d",&n,&l,&r);
		node[n].l=l;
		node[n].r=r;
		node[n].deg=(r!=-1)+(l!=-1);
		node[l].sub=r;
		node[r].sub=l;
		if(l!=-1)node[l].p=n;
		if(r!=-1)node[r].p=n;
	}
	for(i=0;i<N;i++)
		if(node[i].p==-1)
			dfs(i,0);

	for(i=0;i<N;i++)
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n",
		i,node[i].p,node[i].sub,node[i].deg,node[i].dep,node[i].h,node[i].p==-1?"root":node[i].l==-1&&node[i].r==-1?"leaf":"internal node");
	return 0;
}



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

int main() {
  string s, t; cin >> s >> t;
  for (int i = 0; i < 3; i++) {
    if (s.at(i) != t.at(2 - i)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vout(v) VOUT(v,z);
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
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 string YES = "Yes";
const string NO = "No";
#define judge(f) cout<<((f)?YES:NO)<<"\n";

void solve(long long H, long long N, std::vector<long long> A){
    bool f=false;
    if(H<=vsum(A)) f=true;
    judge(f);
}

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


Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <utility>
#include <string>

#define loop(n) for(ll i=0;i<n;i++)

using namespace std;

typedef long long int ll;

int main() {
    ll b[100000],n,t,x,y;
    memset(b,0,sizeof(ll[100000]));
    cin >> n;
    x = 0;
    y = 100000;
    loop(n) {
        cin >> t;
        x = max(x,t);
        y = min(y,t);
        b[t]++;
    }
    if(x-y == 0) {
        if(x+1 == n || x*2 <= n) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else if(x-y == 1) {
        if(b[y] + 1 <= x && x <= b[y] + b[x] / 2) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 1024
import math
n,k=map(int,input().split())
a=list(map(int,input().split()))

def is_ok(arg):
  cnt=0
  for i in a:
    cnt+=(i-1)//arg
  return k>=cnt
  
def binsearch(ng,ok):
  while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if is_ok(mid):
      ok=mid
    else:
      ng=mid
      
  return ok

print(binsearch(0,10**9+1))

Measured memory_bytes: 31092
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

struct Item {
  int value;
  int weight;
};

int main () {
  for( int case_n = 1; ; case_n++  ) {
    int w, n;
    vector< Item >items;
    vector< vector<int> >dp;
    vector< vector<int> >dpw;
    cin >> w;
    if( !w ) { return EXIT_SUCCESS; }
    cin >> n;
    
    for( int i = 0; i < n; i++ ) {
      string line;
      cin >> line;
      replace( line.begin(), line.end(), ',', ' ' );
      istringstream iss( line );
      
      Item item;
      iss >> item.value >> item.weight;
      items.push_back( item );
    }
    for( int i = 0; i <= n; i++ ) {
      vector<int> dpline;
      vector<int> dpwline;
      for( int j = 0; j <= w; j++ ) {
        int opt, optw;
        if( i == 0 || j == 0 ) {
          opt = 0;
          optw = 0;
        } else if( j < items[ i - 1 ].weight ) {
          opt = dp[ i - 1 ][ j ];
          optw = dpw[ i - 1 ][ j ];
        } else { 
          if( 
            dp[ i - 1 ][ j ] <
            dp[ i - 1 ][ j - items[ i - 1 ].weight ] + items[ i - 1 ].value
          ) {
            opt  =  dp[ i - 1 ][ j - items[ i - 1 ].weight ] + items[ i - 1 ].value;
            optw = dpw[ i - 1 ][ j - items[ i - 1 ].weight ] + items[ i - 1 ].weight;
          } else if(
            dp[ i - 1 ][ j ] ==
            dp[ i - 1 ][ j - items[ i - 1 ].weight ] + items[ i - 1 ].value
          ) {
            opt  =  dp[ i - 1 ][ j - items[ i - 1 ].weight ] + items[ i - 1 ].value;
            optw = min(
              dpw[ i - 1 ][ j ],
              dpw[ i - 1 ][ j  - items[ i - 1 ].weight ] + items[ i - 1 ].weight
            );
          } else {
            opt = dp[ i - 1 ][ j ];
            optw = dpw[ i - 1 ][ j ];
          }
        }
        dpline.push_back( opt );
        dpwline.push_back( optw );
      }
      dp.push_back( dpline );
      dpw.push_back( dpwline );
    }
    cout << "Case " << case_n << ":"<<endl;
    cout << dp[ n ][ w ] << endl;
    cout << dpw[ n ][ w ] << endl;
  }
  return 0;
}

Measured memory_bytes: 9016
#include <bits/stdc++.h>
using namespace std;
int main() { 
  int n;
  cin>>n;
  vector<int>a(n);
  int b=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    if(i>=2){
    if(a.at(i-2)<a.at(i-1)&&a.at(i-1)<a.at(i)||
       a.at(i-2)>a.at(i-1)&&a.at(i-1)>a.at(i)){
    b++;
    }
    }
  }
  cout<<b;
}

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

ll x, a, b;
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> x >> a >> b;
	if (a >= b) cout << "delicious";
	else if (b - a <= x) cout << "safe";
	else cout << "dangerous";
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define inf 1e+9
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b){ a>b?:a=b; }
template<class T, class C> void chmin(T& a, C b){ a<b?:a=b; }

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

    int n,k,ans=0;
	// stirng n;
	cin >> n;

	

	for(int i=1;i<=n;i++){
		if(((int)log10(i)+1)%2!=0){
			ans++;
		}
		//cout << (int)log10(i)+1 << endl;
	}

	cout << ans << endl;
}

Measured memory_bytes: 512