akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args){
    	try {
    		InputStreamReader isr = new InputStreamReader(System.in);
    		BufferedReader br = new BufferedReader(isr);
    		String buf = br.readLine();
    		int S = Integer.parseInt(buf);
    		if(0 <= S && S < 86400){
    		
    		int h=S/3600;
    		
    		int m=(S%3600)/60;
    		
    		int s=(S%3600)%60;
    		
    		System.out.println(h+":"+m+":"+s);
    		}
    	} catch(IOException e) {
		    System.err.println(e);
		}
    }
}

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

#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() 
{
	FASTIO
	
	int x, n;
	cin >> x >> n;
	vector<int> p(n);
	for(int i=0; i<n; i++) cin >> p[i];
	sort(p.begin(), p.end());
 
	int l = x, h = x;
	while(true)
	{
		if(find(p.begin(), p.end(), l) == p.end())
		{
			cout << l;
			break;
		}
		l--;
		if(find(p.begin(), p.end(), h) == p.end())
		{
			cout << h;
			break;
		}
		h++;
	}
 
	return 0;
}

Measured memory_bytes: 3652
#import math
from functools import reduce

n = int(input())
a = [int(input()) for _ in range(n)]

def gcd(x, y):
    while y:
        x, y = y, x%y
    return x

def lcm_base(x, y):
    return (x*y)//gcd(x, y)

def lcm(nums):
    #3つ目は初期値
    return reduce(lcm_base, nums, 1)

print(lcm(a))



Measured memory_bytes: 3572
def main():
  M=10**9+7
  r1,c1,r2,c2=map(int,input().split())
  n=r2+c2+2
  fac=[0]*(n+1)
  fac[0]=val=1
  for i in range(1,n+1):fac[i]=val=val*i%M
  pr1=pow(fac[r1],M-2,M)
  pc1=pow(fac[c1],M-2,M)
  pr2=pow(fac[r2+1],M-2,M)
  pc2=pow(fac[c2+1],M-2,M)
  print((fac[r2+c2+2]*pr2*pc2-fac[r2+c1+1]*pr2*pc1-fac[r1+c2+1]*pr1*pc2+fac[r1+c1]*pr1*pc1)%M)
main()

Measured memory_bytes: 54128
#include<bits/stdc++.h>
using namespace std;
int N,W;
int w[101],v[101];
long long int memo[101][100001];
int main()
{
	scanf("%d %d",&N,&W);
	for(int i=0;i<N;i++)
		for(int j=0;j<=W;j++)
			memo[i][j]=0LL;
	
	for(int i=0;i<N;i++)
		scanf("%d %d",&w[i],&v[i]);
	
	for(int j=1;j<=W;j++)
	{
		if(j<w[0])	continue;
		memo[0][j]=v[0];
	}
	
	for(int i=1;i<N;i++)
	{
		for(int j=1;j<=W;j++)
		{
			if(j<w[i])
			{
				memo[i][j]=memo[i-1][j];
				continue;
			}
			memo[i][j]=max(memo[i-1][j],v[i]+memo[i-1][j-w[i]]);
		}
	}
	cout<<memo[N-1][W]<<endl;
}

Measured memory_bytes: 78336
// 基本テンプレート
 
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
using namespace std;
 
#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
vector< pair<int, int> > find_minmax(vector<int> &vec, int l, int r) {
    int sum = vec[r] - vec[l];

    int idx = upper_bound(vec.begin(), vec.end(), vec[l] + sum / 2) - vec.begin();

    vector< pair<int, int> > ret;
    for(int k=-1; k<=1; k++) {
        int x = idx + k;

        int vl = vec[x] - vec[l];
        int vr = vec[r] - vec[x];

        if(vl > vr) swap(vl, vr);
        ret.push_back(make_pair(vl, vr));
    }
    return ret;
}

signed main() {
    int N; cin >> N;

    vector<int> A(N), acc(N+1);
    for(int i=0; i<N; i++) {
        cin >> A[i];
        acc[i+1] = acc[i] + A[i];
    }

    int ans = INF;
    for(int i=0; i<N; i++) {
        if(i < 1 || N - i - 1 < 2) continue;
        auto va = find_minmax(acc, 0, i+1);
        auto vb = find_minmax(acc, i+1, N);

        for(auto x : va) {
            for(auto y : vb) {
                // printf("i = %lld, x = (%lld, %lld), y = (%lld, %lld)\n", i, x.first, x.second, y.first, y.second);
                int ma = max(x.second, y.second);
                int mi = min(x.first, y.first);
                chmin(ans, ma - mi);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
/*      西江月·证明
	即得易见平凡，仿照上例显然。
   留作习题答案略， 读者自证不难。

	反之亦然同理，推论自然成立。
	略去过程QED，由上可知证毕。*/
# pragma GCC optimize (1)
# pragma GCC optimize (2)
# pragma GCC optimize (3)
# pragma GCC optimize ("Ofast")
#define mod 10
#include<iostream>
#include<queue>
#include<algorithm>
#include<cstdio>
#define kkk register
#define ll long long
#define inf 2147098934832ll
using namespace std;
ll read(){ll ans=0,f=1;char a=getchar();while(a>'9'||a<'0'){if(a=='-')f=-1;a=getchar();}while(a>='0'&&a<='9')ans=(ans<<3)+(ans<<1)+a-'0',a=getchar();return ans*f;}
//一条long long的黄金分割线-----------------------------------------------------------------------------------------------------------------------------------
ll n,ans;
int main(){
	string a,b;
	cin>>a>>b;
	n=a.size();
	for(int i=0;i<n;i++)ans+=(a[i]!=b[i]);
	cout<<ans;
	return 0; 
} 

Measured memory_bytes: 3852
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll in()
{
    ll res=0,p=1;
    char c=getchar();
    while(c<'0'||c>'9') {if(c=='-') p=-1; c=getchar();}
    while(c>='0'&&c<='9') res=res*10+c-48,c=getchar();
    return p*res;
}
void out(ll x)
{
    if (x>9) out(x/10);
    putchar(x%10+48);
}
void outn(ll x)
{
    if (x<0){
        putchar('-');
        out(-x);
    }else out(x);
    putchar(10);
}
const double eps = 1e-9;
const int mod = 1e9 + 7, inf = 0x3f3f3f3f;
//const double pi = acos(-1.0);
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};

ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll quickpow(ll x, ll k)
{
    ll res = 1;
    while(k){
        if(k & 1) res = (res * x) % mod;
        k >>= 1, x = (x * x) % mod;
    }
    return res;
}
//ll C(int n, int m){return (fac[n] * quickpow((fac[m] * fac[n - m]) % mod, mod - 2)) % mod;}
const int maxn = 1e6 + 5;
char s[maxn];
int main()
{
    s[0] = '0';
    scanf("%s", s + 1);
    int ls = strlen(s + 1), ans = 0;
    for (int i = ls; i > 0; --i){
        if (s[i] > '5' || (s[i] == '5' && s[i - 1] >= '5')){
            ++ans;
            int p = i - 1;
            while (p > 0 && s[p] == '9') s[p--] = '0';
            ++s[p];
            s[i] = '0' + ('9' - s[i]);
        }
    }
    //printf("%s\n", s + 1);
    for (int i = ls; i >= 0; --i) ans += (s[i] - '0');
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
int main(){
  long int x,p,q,r;
   cin>>x;
   p=x/11;
   r=2*p;
   q=x%11;
   if(q>=7){
     r=r+2;
   }else if(q>=1){
     r=r+1;
   }
   cout<<r<<endl;
   return 0;
}

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    int n, m;
    cin >> n >> m;

    vi a(n,0);
    rep(i,0,n) cin >> a[i];

    int sum = accumulate(all(a), 0);
    sort(a.rbegin(), a.rend());

    if(a[m-1] < (sum+4*m-1)/(4*m)) cout << "No\n";
    else cout << "Yes\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long S;
    cin >> S;
    vector<ll> dp(S+1);
    for(int i=3;i<=S; i++)
    {
        dp[i]=1;
    }
    for(int j=1;j<=S; j++)
    {
        for(int i=3;i<=j-3; i++)
        {
            dp[j]+=dp[i];
        }
        dp[j]%=DIV;
    }
    cout << dp[S] << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, A, x;
  cin >>N>>A;
  x=N%500;
  
  if(x<=A){
    cout<<"Yes"<<endl;
  }
  else if(x>A){
    cout<<"No"<<endl;
  }
  
}

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

using namespace std;

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

	int count = 0;
	int len = s.length();

	for (int i = 0; i < len / 2; i++) {
		if (s.at(i) == s.at(len - i - 1)) {
			continue;
		}
		count ++;
	}
	cout << count << endl;
 
	return 0;
}


Measured memory_bytes: 888
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
const int MAX = (int)2e5 + 5;

string s;

int main() {
	while (getline(cin,s)) {
		for (auto c : s) cout << (char)toupper(c);
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3184
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;

ll N, D;

int main(){
  cin >> N >> D;
  ll x, y;
  int ans = 0;
  rep(i, N){
    cin >> x >> y;
    if (x*x + y*y <= D * D) ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3556
#include<stdio.h>
#include<stdio.h>
int main()
{
    int a,b,x;
    scanf("%d%d",&a,&b);
    if((a>=0&&a<=9)&&(b>=0&&b<=9))
    {
        x=a*b;
        printf("%d",x);
    }
    else
    {
        printf("-1");
    }
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	ll n, m;
	cin >> n >> m;
	
	vector< pair<ll, ll> > p(n);
	for(int i = 0; i < n; ++i) {
		int a, b;
		cin >> a >> b;
		p[i] = make_pair(a, b);
	}
	
	sort(p.begin(), p.end());
	
	ll ans = 0;
	for(int i = 0; i < n; ++i) {
		ll buy = min(m, p[i].second);
		
		ans += p[i].first * buy;
		m -= buy;
		
		if( m <= 0 ) break;
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
typedef long long LL;
LL n,a[55],sum;
inline void Swap(int &A,int &B){
	int t=A;
	A=B;
	B=t;
}
inline int stupid(){
	int cnt=0,xb,pos;
	while(a[0]>=n){
		a[0]-=n;
		for(xb=1;xb<n;xb++) a[xb]++;
		pos=0;
		while(pos<n-1 && a[pos]<a[pos+1]) {
			swap(a[pos],a[pos+1]);
			pos++;
		}
		cnt++;
	}
	return cnt;
}
inline LL getto(int pre,LL nn){
	LL opr=MIN(((LL)a[pre]/nn)-1,(a[pre]-(LL)nn)/(LL)(nn)+1);
	return MAX(0,opr);
}
int main(){
	scanf("%lld",&n);
	int xb,x2;
	for(xb=0;xb<n;xb++) {
		scanf("%lld",&a[xb]);
		sum+=a[xb];
	}
	sort(a,a+n);
	reverse(a,a+n);
	if(sum>=0 && sum<=100000){
		printf("%d",stupid());
		return 0;
	}
	LL cnt=0,pos;
	while(a[0]>=n && a[0]-a[n-1]>=n){
		LL rch=0;
		while(rch<n && a[0]-a[rch]<n) rch++;
		LL getv=getto(rch-1,n-rch+1);
		for(xb=0;xb<rch;xb++) a[xb]-=getv*(n-rch+1);
		for(xb=rch;xb<n;xb++) a[xb]+=getv*rch;
		sort(a,a+n);
		reverse(a,a+n);
		cnt+=getv*rch;
	}
	LL opr=a[n-1]-n-15LL;
	if(opr<=0) cnt+=(LL)stupid();
	else{
		cnt+=opr*n;
		for(xb=0;xb<n;xb++) a[xb]-=opr;
		cnt+=(LL)stupid();
	}
	printf("%lld",cnt);
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
result = 1
delta = 0
for i in range(1, n):
    if a[i - 1] < a[i]:
        ndelta = +1
    elif a[i - 1] > a[i]:
        ndelta = -1
    else:
        ndelta = 0
    if delta and ndelta and delta != ndelta:
        result += 1
        delta = 0
    elif not delta:
        delta = ndelta
print(result)


Measured memory_bytes: 14224
h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

ret = 0

for i in range(1 << h):
    for j in range(1 << w):
        cnt = 0
        for x in range(h):
            for y in range(w):
                if c[x][y] == '#' and (i >> x) & 1 and (j >> y) & 1:
                    cnt += 1
        if cnt == k:
            ret += 1

print(ret)

Measured memory_bytes: 9120
#include<iostream>
#include <algorithm> 
#include<queue>
#include<stack>

using namespace std;

int main() {
	int count = 0;
	char one[3];
	char two[3];

	for (int i = 0; i < 3; i++)cin >> one[i];
	
	for (int k = 0; k < 3; k++)cin >> two[k];

	for (int l = 0; l < 3; l++) {
		if (one[l] == two[l])count++;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb emplace_back
#define ll long long
#define mp make_pair
#define PI acos(-1)
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll i,j,k,x,y,z,m,t,n,b,c,d,a,l,r;
    cin>>n;
    vector<ll>v(n);
    for(i=0; i<n; i++)
        cin>>v[i];
    ll cnt=0;
    for(i=1; i<n; i++)
    {
        if(v[i-1]>v[i])
        {
            cnt+=abs(v[i]-v[i-1]);
            v[i]=v[i-1];
        }
    }
    cout<<cnt<<'\n';
}

Measured memory_bytes: 4700
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

vint a;
int calc(int n) {
    int res = 0;
    for (int ai : a) res += pow((n-ai), 2);
    return res;
}

int main() {
    int n;
    cin >> n;
    a.resize(n);
    rep(i, n) cin >> a[i];

    int ans = INF;
    rep(i, 201) {
        ans = min(ans, calc(i-100));
    }

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

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

d = {}
for i in range(n):
    x = 0
    s = input()
    if (s in d) == True:
        x = d[s]
        d[s] = x + 1
    else:
        d[s] = 1

max_val = max(d.values())
keys_of_max_val = [key for key in d if d[key] == max_val]
#print(keys_of_max_val)

l = sorted(keys_of_max_val)
for i in l:
    print(i)


Measured memory_bytes: 32988
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String[] split = line.split(" ");
		int a = Integer.parseInt(split[0]);
		int b = Integer.parseInt(split[1]);
		String output = null;
		if (a == b) {
			output = "a == b";
		} else if (a > b) {
			output = "a > b";
		} else if (a < b) {
			output = "a < b";
		}
		System.out.println(output);
		sc.close();
	}
}

Measured memory_bytes: 26072
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

bool check(string s){
    rep(i,0,s.size())if(s[i]!=s[0])return false;
    return true;
}

int main (){
    string ss;
    cin>>ss;
    if(check(ss)){
        cout<<0<<endl;
        return 0;
    }
    int ans=100000000;
    rep(lp,0,26){
        string s=ss;
        int count=0;
        while(1){
            count++;
            string temp="";
            rep(i,0,s.size()-1){
                if(s[i]==('a'+lp) || s[i+1]==('a'+lp))temp.push_back('a'+lp);
                else temp.push_back(s[i]);
            }
            if(check(temp)){
                ans=min(ans,count);
                break;
            }
            s=temp;

        }
    }
    cout<<ans<<endl;

}

/*

*/


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <sstream>
#include <string>

using namespace std;

void solve(int k, int x) {
  int l, r;
  l = max(-1000000, x - k + 1);
  r = min(1000000, x + k - 1);
  for (int i = l; i < r; i++) {
    printf("%d ", i);
  }
  printf("%d\n", r);
}

int main() {
  int k, x;
  cin >> k >> x;
  solve(k, x);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	map<string, int> cnt;
	string s;
	cin>>n;
	while (n--) {
		cin>>s;
		cnt[s]++;
	}

	cout<<"AC x "<<cnt["AC"]<<endl;
	cout<<"WA x "<<cnt["WA"]<<endl;
	cout<<"TLE x "<<cnt["TLE"]<<endl;
	cout<<"RE x "<<cnt["RE"]<<endl;
}

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

#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 ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
#define LINF 1e18
typedef long long ll;


int main() {
    int N; cin >> N;
    cout << (N+1)*N/2 << endl;
    return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>
#include <random>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

template<class T, class F = plus<T>>
struct Fenwick {
  i64 n;
  vector<T> c;
  F f;
  Fenwick(i64 n, F f = plus<T>(), T init = T())
    : n(n), c(n + 1, init), f(f) {}
  T sum(i64 i) {
    return i > 0 ? f(sum(i - (i & -i)), c[i]) : T();
  }
  void add(i64 i, i64 x) {
    if (i <= n) {
      c[i] = f(c[i], x);
      add(i + (i & -i), x);
    }
  }
};
template<class T, class F = plus<T>>
Fenwick<T, F> make_fenwick(i64 n, F f = plus<T>(), T init = T()) {
  return Fenwick<T, F>(n, f, init);
}

template<class F>
i64 bisect(i64 l, i64 r, F f) { // (l, r]
  if (r - l <= 1) return r;
  i64 m = l + (r - l) / 2;
  return f(m) ? bisect(l, m, f) : bisect(m, r, f);
}

template<class F>
i64 bisect_left(i64 l, i64 r, F f) {
  return bisect(l, r, [=](i64 x) { return !f(x); }) - 1;
}

i64 n;
vector<int> a;
int main() {
  cin >> n;
  read_n(a, n);
  auto sa = a;
  sort(begin(sa), end(sa));

  cerr << (n + 1) * n / 2 << endl;
  auto test = [&](int k) {
    int x = sa[k];
    cerr << x << endl;
    vector<int> b(n + 1);
    for (int i = 1; i <= n; ++i) b[i] = a[i - 1] >= x ? 1 : -1;
    // for (int i = 1; i <= n; ++i) cerr << b[i] << ' '; cerr << '\n';
    for (int i = 1; i <= n; ++i) b[i] += b[i - 1];
    // for (int i = 1; i <= n; ++i) cerr << b[i] << ' '; cerr << '\n';
    for (int i = 0; i <= n; ++i) b[i] += n + 1;
    auto fen = make_fenwick<i64>(2 * n + 2);
    i64 cnt = 0;
    for (int i = n; i > 0; --i) {
      fen.add(b[i], 1);
      cnt += fen.sum(2 * n + 1) - fen.sum(b[i - 1] - 1);
    }
    cerr << cnt << '\n';
    return cnt >= (n + 1) * n / 4;
  };

  int ans = sa[bisect_left(0, sa.size(), test)];
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3040
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define VS vector<string>
#define VB vector<bool>
#define VP vector<pair<ll,ll>>
#define VVL vector<vector<ll>>
#define VVP vector<vector<pair<ll,ll>>>
#define PL pair<ll,ll>
#define ALL(v) (v).begin(), (v).end()


int main() {
    ll N,K;
    cin>>N>>K;
    VL h(N);
    ll ans=0;
    rep(i,0,N){
        cin>>h[i];
        if(h[i]>=K)ans++;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
function Main(input) {
    var N = parseInt(input[0], 10);
    var S = input.slice(1);

    var freebie = new Map();

    for (var i = 0; i < N; i++) {
        freebie.set(S[i], true);
    }

    console.log(freebie.size);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 67508
#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t n,m,k,p=0,s,ans=0;
  cin>>n>>m>>k;
  int64_t a[n+1],b[m+1];
  a[0]=0,b[0]=0;
  for(int i=1;i<n+1;i++){
    int aa;
    cin>>aa;
    a[i]=a[i-1]+aa;
  }  
  for(int i=1;i<m+1;i++){
  	int bb;
    cin>>bb;
    b[i]=b[i-1]+bb;
  }  
  int t=m;
  while(p<=n&&a[p]<=k){
    for(int i=t;i>=0;i--){
    	if(b[i]+a[p]<=k){
          s=i;
          break;
        }
    }
    t=s;
    ans=max(ans,p+s);
    p++;
  }
  cout<<ans;
}

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

int main() {
    int n;
    double arr[55];

    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> arr[i];
    }
    sort(arr, arr+n);

    double ans = (arr[0] + arr[1])/2;
    for (int i=2; i<n; i++) {
        ans = (ans + arr[i]) / 2;
    }

    cout << fixed << setprecision(5) << ans;

    return 0;
}


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

int main(){
    string s;
    cin >> s;
    int len=s.length();
    int a,z;
   for(int i=0;i<len;i++){
       if(s[i]=='A'){
           a=i;
           break;
       }
   }
    for(int i=len-1;i>=0;i--){
        if(s[i]=='Z'){
            z=i;
            break;
        }
    }
    cout << z-a+1 << endl;
    return 0;
}

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

int main() {
    int a,b;
    cin>>a>>b;
    string s;
    cin>>s;
    bool flag = 1;
    rep(i,a){
        if(s[i]<'0' || s[i]>'9') flag = 0;
    }
    if(s[a]!='-') flag = 0;
    for(int i=a+1;i<s.size();i++){
        if(s[i]<'0' || s[i]>'9') flag = 0;
    }
    if(s.size()!= a+b+1) flag = 0;
    
    cout << (flag ? "Yes":"No") <<endl;
    
    
    return 0;
}


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

a = 0
for i in range(0,x):
    if i in a_L:
        a += 1
b = 0
for i in range(x,n):
    if i in a_L:
        b += 1

print(min(a,b))

Measured memory_bytes: 38736
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    string s,t;cin>>s>>t;
    int k=0;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]!=t[i])
            k++;
    }
    cout<<k<<endl;
}


Measured memory_bytes: 3912
awk '{
    a = $1
    b = $2
    x = $3
    if(a*a*b<x*2) {
        printf("%0.10f", 90 - atan2(a*a*a, 2*(a*a*b-x))*180/3.141592653589793)
    } else {
        printf("%0.10f", 90 - atan2(2*x, a*b*b)*180/3.141592653589793)
    }
}'


Measured memory_bytes: 676
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <bitset>
typedef long long ll;
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
};


int main(int argc, const char * argv[]) {
    ll N;   cin >> N;
    vector<ll> L(N);
    for(ll i=0;i<N;i++) cin >> L[i];
    
    sort(L.begin(),L.end());
        
    ll sum = 0;
    
    for(ll i=N-1;i>1;i--){
        for(ll j=i-1;j>0;j--){
            ll X = L[i] - L[j];
            auto iter = upper_bound(L.begin(), L.end(),X);
            ll sum_temp =  L.end() - iter;
            sum += max(0LL, sum_temp - (N  - j));
        }
    }
    
    cout << sum << endl;
    
    return 0;
    
}




Measured memory_bytes: 256
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

N = int(input())

import math
lower = math.floor(N / 1.08)
upper = math.ceil(N / 1.08)
if math.floor(lower * 1.08) == N:
    print(lower)
elif math.floor(upper * 1.08) == N:
    print(upper)
else:
    print(":(")

Measured memory_bytes: 3060
import java.util.*;

public class Main {

	static int p[];

	public static void inip(int n) {
		int tmp[] = new int[n + 1];
		tmp[0] = tmp[1] = -1;
		tmp[2] = 1;
		for (int i = 0; i <= n; ++i) {
			if (tmp[i] != -1) {
				tmp[i] = 1;
				for (int j = 2; j * i <= n; ++j) {
					tmp[i * j] = -1;
				}
			}
		}
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 3; i <= n; ++i) {
			if (tmp[i] == 1)
				list.add(i);
		}
		p = new int[list.size()];
		for (int i = 0; i < list.size(); ++i) {
			p[i] = list.get(i);
		}
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		inip(n);
		sc.close();
		int cnt = 0;
		for (int i = 0; i < p.length; ++i) {
			int tmp = (int) Math.pow(p[i], 3);
			if (tmp < n) {
				int tmp2 = (int) Math.pow(p[i], 7);
				if (tmp2 <= n)
					++cnt;
			}
			for (int j = i + 1; j < p.length; ++j) {
				if (tmp < n) {
					if (tmp * p[j] <= n)
						++cnt;
				}
				if (p[i] * p[j] < n) {
					int tmp2 = p[i] * p[j];
					for (int k = j + 1; k < p.length; ++k) {
						if (tmp2 * p[k] <= n)
							++cnt;
					}
				}
			}
		}
		System.out.println(cnt);
	}

}


Measured memory_bytes: 22484
#include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int a,b;
        cin>>a>>b;
        if(a>b)
            cout<<a+(a-1)<<endl;
            else if(b>a)
        cout<<b+(b-1)<<endl;
        else
            cout<<a+b<<endl;
    }


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

Measured memory_bytes: 580
N, T = (int(i) for i in input().split())
t = [int(i) for i in input().split()] 

t.append(1145141919810)
ans = 0

for i in range(N):
	if (t[i+1]-t[i]) >= T:
		ans += T
	else:
		ans += t[i+1] - t[i]

print(ans)

Measured memory_bytes: 25196
private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints

fun main(args: Array<String>) {
    val n = readInt()
    println(if (readInts().toSet().size == n) "YES" else "NO")
}

Measured memory_bytes: 78548
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main()
{
	int a;
	scanf("%d", &a);
	printf("%d\n", a + a * a + a * a * a);
	return 0;
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  int h,w; cin >> h >> w;
  vector<string> s(h); rep(i,h) cin >> s[i];
  vector<int> dx = {1,0,-1,0}, dy = {0,1,0,-1};

  if(h == 1 && w == 1){
    cout << "Yes" << endl;
    return 0;
  }
  
  bool can_all = true;
  rep(i,h){
    rep(j,w){
      if(s[i][j] == '#'){
	//cout << "here" << endl;
	vector<bool> can(4,false);
	rep(k,4){	  
	  int x = i,y = j;
	  //printf("k: %d dx: %d dy: %d\n",k,x+dx[k],y+dy[k]);
	  if(x+dx[k]>=h || x+dx[k]<0 || y+dy[k]>=w || y+dy[k]<0) continue;
	  //cout << "here2" << endl;
	  x += dx[k];
	  y += dy[k];
	  if(s[x][y] == '#')  can[k] = true;
	}
	rep(k,4){
	  if(can[k]){
	    can_all = true;
	    break;
	  }
	  else can_all = false;
	}
	if(!can_all) goto rem;
      }
    }
  }
 rem:
  if(!can_all) cout << "No" << endl;
  else cout << "Yes" << endl;
  
  return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define fo(i,n)         for(int i=0;i<n;i++)
#define Fo(i,k,n)       for(int i=k;i<n;i++) 
#define endl            "\n"
#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define vec(x)          vector<x>
#define matrix(x)       vector<vector<x>>
#define mem(a,b)        memset(a, b, sizeof a)
#define vii             vector<pair<int,int>>
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define MOD             998244353
#define deb(x)          cerr <<#x<<" = "<<x<<"\n"
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define rep(i,a,b)      for (int i = a; i<b; ++i)
#define len(s)          s.length()
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
 
 
int power(int a,int b,int m=mod)
{int ans=1;while(b>0){if(b&1)ans=(ans*a)%m;a=(a*a)%m;b>>=1;}
return ans;}

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

const int N = 1e5+1;
const double pi = acos(-1);

void solve(){    

    double l;
    cin>>l;
    l /= 3;
    cout<<ps(l*l*l,9);
}

 
int32_t main()
{
    angshuGod();

    int t;

    t = 1;
    //cin>>t;

    while(t--){
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3768
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
/************************************************/
#define rep(i,n) for(int i=0;i<n;i++)
#define m_p make_pair
#define pb push_back
#define fr first
#define se second
#define forn(i,a,n) for(int i=a;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin())i=(c.begin());i!=(c).end();i++)
#define pii pair<int,int>
#define vi vector<int>
#define ll long long
#define sz(s) s.size()
#define all(s) s.begin(),s.end()
#define zero(x) memset(x,0,sizeof(x))
#define vii vector<pair<int,int> >
#define mpis map<int,string>
#define mpii map<int,int>
#define mpsi map<string,int>
#define re return
#define mod 1000000007
/************************************************/
using namespace std;

long long get(){
	char c=getchar();
	long long x=0LL;
	while(c<'0'||c>'9')
	c=getchar();
	while(c>='0'&&c<='9'){
		x*=10LL;
		x+=(c-'0');
		c=getchar();
	}
	return x;
}
string s;
int main(){
	ios::sync_with_stdio(0);
	cin>>s;
	rep(i,sz(s)){
		forn(j,i-1,sz(s)){
			string t="";
			rep(k,sz(s)){
				if(k<i||k>j)
				t+=s[k];
			}
			if(t=="keyence"){
				cout<<"YES";
				re 0;
			}
		}
	}
	cout<<"NO";
	re 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>

using namespace std;
//#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n;cin>>n;
  vector<int> h(n);
  rep(i,n)cin>>h[i];
  int res=0;h.push_back(0);
  int min=inf;
  rep(x,n){
    int left=0;int right=inf;
    min=inf;
    rep(i,n+1){
      if(h[i]>0&&min>h[i])min=h[i];
      if(h[i]<=0){
        right=i;
        int num=0;
        for(int j=left;j<right;j++){
          h[j]-=min;
          num++;
          if(h[j]<0){
            h[j]=0;
            num--;
          }
        }
        if(num>0)res+=min;
        left=i+1;
        min=inf;
      }
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
ll MOD = 1000000007;
ll INF = 2147483647;
double EPS = 1e-12;
double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

struct SegmentTree{
    vector<ll> value;
    ll N;
    SegmentTree(ll n):value(2*n-1){
        N = n;
    }
    void input(ll i,ll x){
        value[i] = x;
    }
    void update(ll i,ll x){
        i += N-1;
        value[i] = x;
        while(i > 0){
            i = (i-1)/2;
            value[i] = min(value[i*2+1],value[i*2+2]);
        }
    }
    ll query(ll a,ll b,ll k,ll l,ll r){
        //[a,b)のクエリに
        //ノードk,[l,r)のクエリが答える
        if(r <= a || b <= l) return INF;
        if(a <= l && r <= b){
            return value[k];
        }else{
            ll cl = query(a,b,2*k+1,l,(l+r)/2);
            ll cr = query(a,b,2*k+2,(l+r)/2,r);
            return min(cl,cr);
        }
    }
};

int main(){
    ll N,Q;
    cin >> N >> Q;
    ll m = N;
    ll n = 1;
    while(n < N){
        n *= 2;
    }
    N = n;
    SegmentTree ST(N);
    rep(i,N*2-1) ST.input(i,INF);
    rep(i,Q){
        ll t,x,y;
        cin >> t >> x >> y;
        if(t == 0){
            ST.update(x,y);
        }else{
            cout << ST.query(x,y+1,0,0,N) << endl;
        }
    }
}


Measured memory_bytes: 4900
#include<stdio.h>
int main()
{
  int n;
  int score[2]={0,0};
  int i,j,first=0;
  char taro[100],hanako[100];

  scanf("%d",&n);
  for(j=0;j<n;j++)
    {
      for(i=0;;i++)
	{
	  scanf("%c",&taro[i]);
	  if(first==0)
	    {
	      i--;
	      first++;
	    }
	  if(taro[i]==' ') break;
	}
      for(i=0;;i++)
	{
	  scanf("%c",&hanako[i]);
	  if(hanako[i]=='\n') break;
	}
      for(i=0;;i++)
	{
	  if((taro[i]==' ')&&(hanako[i]=='\n'))
	    {
	      score[0]+=1;
	      score[1]+=1;
	      break;
	    }
	  if((taro[i]==' ')&&(hanako[i]!='\n'))
	    {
	      score[1]+=3;
	      break;
	    }
	  if((taro[i]!=' ')&&(hanako[i]=='\n'))
	    {
	      score[0]+=3;
	      break;
	    }
	  if(taro[i]>hanako[i])
	    {
	      score[0]+=3;
	      break;
	    }
	  if(taro[i]<hanako[i])
	    {
	      score[1]+=3;
	      break;
	    }
	}
    }
  printf("%d %d\n",score[0],score[1]);
  return 0;
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
int isPalindrome(long long int n)
{
    long long int rev = 0;
    for (long long int i = n; i > 0; i /= 10)
        rev = rev*10 + i%10;
    return (n==rev);
}
void countPal(long long int min,long long int max)
{
	long long int c=0;
    for (long long int i = min; i <= max; i++)
        if (isPalindrome(i))
          c++;
    cout<<c;
}
int main()
{
	long long int i,j,k,c=0,n,m;
	cin>>n>>m;
	countPal(n,m);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <limits.h>

using namespace std;

int d[1000][1000];

int search(string* field, int w, int h, int sx, int sy, int n)
{
    static const int dx[] = {-1, 0,  0, 1};
    static const int dy[] = { 0, 1, -1, 0};
    int ans = 0;

    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < h; j++) {
            for (int k = 0; k < w; k++) {
                d[j][k] = INT_MAX;
            }
        }

        d[sy][sx] = 0;
        queue<pair<int, int> > q;
        q.push(pair<int, int>(sx, sy));
        while (!q.empty()) {
            pair<int, int> coord;
            coord = q.front();
            q.pop();

            if (i == field[coord.second][coord.first] - '0') {
                ans += d[coord.second][coord.first];
                sx = coord.first;
                sy = coord.second;
                break;
            }

            for (int j = 0; j < 4; j++) {
                int nx = coord.first + dx[j];
                int ny = coord.second + dy[j];

                if (nx >= 0 && nx < w && ny >= 0 && ny < h &&
                        field[ny][nx] != 'X' && (d[coord.second][coord.first] + 1) < d[ny][nx]) {
                    d[ny][nx] = d[coord.second][coord.first] + 1;
                    q.push(pair<int, int>(nx, ny));
                }
            }
        }
    }
    return ans;
}

int main(int argc, char **argv)
{
    int w, h, n;
    string field[1000];

    cin >> h >> w >> n;
    for (int i = 0; i < h; i++) {
        cin >> field [i];
    }

    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (field[i][j] == 'S') {
                cout << search(field, w, h, j, i, n) << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 6176
n,m,x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]
anytassei = False

# bit = [0 for _ in range(n)]
mincost = 0
cost = 0
learn = [0 for _ in range(n)]
for i in range(n):
	mincost += ca[i][0]

for cnt in range(2**n):
	cost = 0
	learn = [0 for _ in range(m)]

	# bit膳探索
	for i in range(n):
		# bit[i] = (cnt//2**i)%2
		if (cnt//2**i)%2 == 1:
			cost += ca[i][0]
			for j in range(m):
				learn[j] += ca[i][1+j]
	# print(bit)

	# 理解度達成しているか判定
	tassei = True
	for j in range(m):
		if learn[j] < x: tassei = False

	# 達成している and 最小コスト更新している
	if tassei and cost <= mincost:
		mincost = cost
		anytassei = True

if anytassei: print(mincost)
else: print(-1)


Measured memory_bytes: 68836
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>

using namespace std;

int main(){
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++){
		if(s[i]==','){
			s[i]=' ';
		}
		cout << s[i];
	}
	cout << endl;
	return 0;
}


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

int main()
{
 int n,k;
  cin >> n >> k;
  
  int cnt = 0;
  for (int i = 0; i < n; i++)    
  {
   int tmp;
    cin >> tmp;
  	if (tmp >= k)
      cnt++;
  }
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
int dx[4] = {0,1,0,-1};
int dy[4] = {1, 0, -1, 0};

int main(){
  int H, W;
  cin >> H >> W;
  char ch[H][W];
  
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      cin >> ch[i][j];
    }
  }
  
  bool judge = true;

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(ch[i][j]=='#'){
        bool check = false;
        for(int k=0;k<4;k++){
          if(0<=i+dy[k] && i+dy[k]<H && 0<=j+dx[k] && j+dx[k]<W){
            if(ch[i+dy[k]][j+dx[k]]=='#') check = true;
          }
        }
        if(!check){
          judge = false;
          break;
        }  
      }
    }
  }

  if(judge) cout <<"Yes" <<endl;
  else cout << "No" <<endl;

  return 0;
}

Measured memory_bytes: 256
/*
.....   .   .   .   .
  .    . .   . .   . .
  .   .....   .   .....
  .  .     .  .  .     .
*/
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
   
using namespace std;
   
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
   
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}



#define left left228
#define right right228
#define set set228


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    long long res = 0;
    reverse(s.begin(), s.end());
    int W = 0;
    for (char c : s) {
        if (c == 'W') {
            ++W;
        } else {
            res += W;
        }
    }
    cout << res << '\n';
    return 0;
}
  
  
  
  


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



int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;

    for (auto i:s)
        if (i-'0'==7) {cout<<"Yes\n"; return 0;}
    cout<<"No\n";
    return 0;
}

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

namespace AtCoder.Abc
{
    //https://atcoder.jp/contests/abc141/tasks/abc141_a
    public class QuestionA
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            // 整数配列の入力
            var nr = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            if(nr[0] >= 10) {
                Console.WriteLine(nr[1]);
            } else {
                Console.WriteLine(nr[1] + 100 * (10 - nr[0]));
            }

            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 13396