akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long a;
    double b;
    cin >> a >> b;
    double c = b * 100;
    long long d = lround(c);
    long long product = d * a;
    cout << product / 100;
}


Measured memory_bytes: 3796
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmin(T& a, T b) {if(a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if(a < b) {a = b; return true;} return false;}

int main(){
  int n,a,b;
  string s;
  cin>>n>>a>>b>>s;
  int tmpa=0;
  int tmpb=0;

  rep(i,n){
    if(s[i]=='c')cout<<"No"<<endl;
    if(s[i]=='a'){
      if(tmpa+tmpb<a+b){
	tmpa++;
	cout<<"Yes"<<endl;
      }else cout<<"No"<<endl;
    }
    if(s[i]=='b'){
      if(tmpa+tmpb<a+b&&tmpb<b){
	tmpb++;
	cout<<"Yes"<<endl;
      }else cout<<"No"<<endl;
    }
  }
    
    
  return 0;
}


Measured memory_bytes: 3760
import java.math.*;
import java.util.*;

public class Main {
    static int solve(int x, int i) {
        return (int) Math.pow(Math.abs(x - i), 2);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] x = new int[n];
        for (int i = 0; i < n; i++)
            x[i] = sc.nextInt();
        Arrays.sort(x);
        int ans = 0;
        int tmp = 0;
        for (int i = 0; i <= x[n - 1]; i++) {
            for (int xi : x) {
                tmp += solve(xi, i);
            }
            if (i == 0)
                ans = tmp;
            if (tmp < ans)
                ans = tmp;
            tmp = 0;
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23380
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const ll MOD = 1000000007;

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

    N %= 10;
    if(N == 3){
        cout << "bon" << endl;
    }else if(N == 0 || N == 1 || N == 6 || N == 8){
        cout << "pon" << endl;
    }else{
        cout << "hon" << endl;
    }
    return 0;
}

Measured memory_bytes: 3596
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cmath>
#include <iomanip>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cassert>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

char dif = 'A' - 'a';
int mod = 1e9 + 7;
ll inf = 1e18;

int main()
{
   string s;
    cin >> s;
    int a = s[0] - '0', b = s[1] - '0', c = s[2] - '0', d = s[3] - '0';
    int x = 10 * a + b;
    int y = 10 * c + d;
    if(0<x&&x<=12&0<y&&y<=12){
        cout << "AMBIGUOUS" << endl;
    }
    else if(x>12||x==0){
        if(0<y&&y<=12)
        cout << "YYMM" << endl;
        else
            cout << "NA" << endl;
    }
    else if(y>12||y==0){
        if(0<x&&x<=12)
        cout << "MMYY" << endl;
        else
            cout << "NA" << endl;
    }
    else
        cout << "NA" << endl;
    return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(H: int, W: int):
    if H > 1 and W > 1:
        print(W // 2 * H + (H // 2 + H % 2) * (W % 2))
    else:
        print(1)


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    solve(H, W)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
N, X, Y = map(int, input().split())
X -= 1
Y -= 1
D = [0] * N

for i in range(N):
    for j in range(i + 1, N):
        m = min(abs(j - i), abs(i - X) + 1 + abs(j - Y))
        D[m] += 1

for v in D[1:N]:
    print(v)

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



// mod p （pは素数）の下でのべき乗を求める
ll mod_pow(ll a, ll n, ll p) {
		ll result = 1;
		while (n > 0) {
			if (n & 1) result = result * a % p;
			a = a * a % p;
			n >>= 1;
		}
		return result;
	};

// mod p （pは素数）の下での逆元を求める（フェルマーの小定理を利用）
ll mod_inverse(ll a, ll p) {
	return mod_pow(a, p-2, p);
}

// mod p （pは素数）の下での除算 (a / b)
ll mod_devide(ll a, ll b, ll p) {
	return a * mod_inverse(b, p) % p;
}

// mod p （pは素数）の下での組み合わせ（nCk）を計算
ll mod_comb(ll n, ll k, ll p) {
	ll numerator = 1;
	for (int i=n; i>n-k; i--) {
		numerator *= i;
		numerator %= p;
	}

	ll denominator = 1;
	for (int i=k; i>0; i--) {
		denominator *= i;
		denominator %= p;
	}

	return mod_devide(numerator, denominator, p);
}




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

  for (int i=1;i<=k;i++){
  ll ans=mod_comb(n-k+1,i,MOD);
  ans=ans*mod_comb(k-1,i-1,MOD);
  ans=ans%MOD;
  cout<<ans<<endl;
}
}


Measured memory_bytes: 256
n = int(input())
if n <= 599:
    print(8)
elif 600 <= n <= 799:
    print(7)
elif 800 <= n <= 999:
    print(6)
elif 1000 <= n <= 1199:
    print(5)
elif 1200 <= n <= 1399:
    print(4)
elif 1400 <= n <= 1599:
    print(3)
elif 1600 <= n <= 1799:
    print(2)
elif 1800 <= n <= 1999:
    print(1)

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

int n,k;
double imos[200001],ans;

signed main() {
    cin >> n >> k;
    rep1(i,n) {
        double p;
        cin >> p;
        imos[i] = (p+1.0)/2.0;
    }
    rep1(i,n) imos[i] += imos[i-1];
    rep(i,n-k+1) ans = max(ans, imos[i+k]-imos[i]);
    cout << setprecision(20) << ans << endl;
}




Measured memory_bytes: 1792
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


n = ini()
res = []
for i in range(n):
    s, p = ins().split()
    p = int(p)
    res.append((s, -p, i))
res.sort()


def solve():
    return [i + 1 for s, p, i in res]


print(*solve(), sep="\n")


Measured memory_bytes: 9140
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
  int n; cin>>n;
  int a[n], b[n];
  rep(i,n) cin>>a[i]; rep(i,n) cin>>b[i];

  ll cnt = 0;
  rep(i,n){
    if(b[i]==a[i]) continue;
    ll d = abs(a[i]-b[i]);
    if(a[i]<b[i]){
      cnt += d/2;
    }else{
      cnt -= d;
    }
  }
  if(cnt<0) cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;


int main() {
	LL N, A, B, C, D;
	cin >> N >> A >> B >> C >> D;
	if (A > B)
		swap(A, B);
	FOR (i, N) {
		LL a1 = A - i * C, a2 = A - i * D;
		LL m = N - 1 - i;
		LL b1 = a1 + m * D, b2 = a2 + m * C;
		if (b1 >= B && B >= b2) {
			cout << "YES" << endl;
			return 0;
		}
	}
	cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
A = [input().strip() for _ in range(H)]
cnt_row = 0
for i in range(H):
    cnt_row += A[i].count("#")-1
cnt_col = 0
for j in range(W):
    cnt = 0
    for i in range(H):
        if A[i][j]==("#"):
            cnt += 1
    cnt_col += cnt-1
if cnt_row==W-1 and cnt_col==H-1:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 38384
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int l, r;
	int ans = 0;
	rep(i,n){
		cin >> l >> r;
		ans += r - l + 1;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
from collections import deque
n=int(input())
v=[[] for _ in range(n)]
dist=[n+1]*n
dist[0]=0
for i in range(n):
    l=list(map(int,input().split()))
    if l[1]==0:
        continue
    else:
        for j in l[2:]:
            v[l[0]-1].append(j-1)

flg=1
q=deque()
while flg==1:
    flg=0
    q=deque()
    for i in range(n):
        q.append(i)
        chk=[0]*n
        while q:
            x=q.popleft()
            chk[x]=1
            d=dist[x]
            for j in v[x]:
                if chk[j]==1:
                    continue
                else:
                    if dist[j]>d+1:
                        flg=1
                        dist[j]=d+1
                        q.append(j)

for i in range(n):
    if dist[i]==n+1:
        print(i+1,-1)
    else:
        print(i+1,dist[i])


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

int main(){
  int N, X;
  cin >> N >> X;

  vector<int> m(N);

  for (int i = 0; i < N; i++)
  {
    cin >> m.at(i);
  }

  int cnt = 0;

  for (int i = 0; i < N; i++)
  {
    X -= m.at(i);
    cnt += 1;
  }

  sort(m.begin(),m.end());

  cnt += X / m.at(0);
  
  cout << cnt << endl;  
}

Measured memory_bytes: 3580
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007

using namespace std;
using ll = long long int;
using ull = unsigned long long;

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) {
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

int main() {
	int sx, sy, tx, ty, i;
	cin >> sx >> sy >> tx >> ty;
	int dx = tx - sx;
	int dy = ty - sy;

	// Path 1
	cout << string(dy, 'U') << string(dx, 'R');
	// Path 2
	cout << string(dy, 'D') << string(dx, 'L');
	// Path 3
	cout << 'L' << string(dy+1, 'U') << string(dx+1, 'R') << 'D';
	// Path 4
	cout << 'R' << string(dy+1, 'D') << string(dx+1, 'L') << 'U';
	return 0;
}

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

#define FOR(a,b,c) for (int a=(b);a<(c);++a)
#define REP(i,n) FOR(i,0,n)
#define ll long long
#define pii pair<int,int>
#define x first
#define y second
#define pb push_back
#define lf double

using namespace std;

const int MAX = (int)1e6 + 5;

int main(){
	ll a;
	int b,c;
	scanf ("%lld",&a);
	scanf ("%d.%d",&b,&c);
	a=a*b*100+c*a;
	printf ("%lld\n",a/100);
	
	
	return 0;
}


Measured memory_bytes: 3828
package main

import "fmt"

func main() {
	var n int
	var s string
	fmt.Scan(&n, &s)

	cnt := 1
	for i := 1; i < n; i++ {
		if s[i] != s[i-1] {
			cnt++
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 1280
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rrep(i,n) for(ll i##_len=(n) ,i=i##_len-1;i>=0;--i)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define printd(val) std::cout<< #val" = " <<val<<"\n";
#include<bits/stdc++.h>
using ll = long long;
using pii = std::pair<ll,ll>;
using namespace std;
template<class T>T chmin(T& a,T b){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}
template<class T>T chmax(T& b,T a){if(a>b){a^=b;b^=a;a^=b;return 1;}return 0;}

ll L,R;
void input(){
    cin>>L>>R;
}
void src(){
    vector<ll> pk;
    rep(i,min(R-L+1,2019ll)){
        pk.push_back((L+i)%2019ll);
    }
    ll mins=2019ll;
    rep(i,pk.size()){
        repi(j,i+1,pk.size()){
            chmin(mins,(pk[i]*pk[j])%2019ll);
        }
    }
    cout<<mins;
    return;
}

int main(int argc,char* argv[]){
    ios::sync_with_stdio(false);
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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





int main(){
	int n;
	cin >> n;
	int Ph = 0, Pt = 0;
	for (int i = 1; i <= n; i++){
		string Wh, Wt;
		cin >> Wt >> Wh;
		if (Wh == Wt){
			Ph++;
			Pt++;
		}
		if (Wh < Wt){
			Pt += 3;
		}
		if (Wh > Wt){
			Ph += 3;
		}
	}

	cout <<  Pt <<  " " <<  Ph <<  endl;

	return 0;
}



Measured memory_bytes: 3208
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
using ll = long long;

const long double PI = acos(-1.0);
const int MOD = 1e9 + 7;

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

    int ans = 1000 - (n % 1000);
    if (n % 1000 == 0) ans = 0;
    cout << ans << endl;

    return 0;
}

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

int main() {
  int64_t N, K;
  cin >> N >> K;
  int64_t n = 0;
  int64_t mul = 1;
  while(N>=mul){
    mul*=K;
    n++;
  }
  cout << n << endl;
}

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

#ifdef LOCAL
#define DEBUG(...) debug(#__VA_ARGS__, __VA_ARGS__);
#else
#define DEBUG(...) 6;
#endif

template<typename T, typename S> ostream& operator << (ostream &os, const pair<T, S> &p) {return os << "(" << p.first << ", " << p.second << ")";}
template<typename C, typename T = decay<decltype(*begin(declval<C>()))>, typename enable_if<!is_same<C, string>::value>::type* = nullptr>
ostream& operator << (ostream &os, const C &c) {bool f = true; os << "["; for (const auto &x : c) {if (!f) os << ", "; f = false; os << x;} return os << "]";}
template<typename T> void debug(string s, T x) {cerr << s << " = " << x << "\n";}
template<typename T, typename... Args> void debug(string s, T x, Args... args) {cerr << s.substr(0, s.find(',')) << " = " << x << " | "; debug(s.substr(s.find(',') + 2), args...);}

const long long INF = 1e18;

struct SegmentTree {
    int n;
    vector<long long> st, lazy;

    SegmentTree(int _n) : n(_n), st(4*n, INF), lazy(4*n) {}

    void push(int p, int l, int r) {
        if (lazy[p]) {
            st[p] += lazy[p];
            if (l != r) {
                lazy[2*p] += lazy[p];
                lazy[2*p+1] += lazy[p];
            }
            lazy[p] = 0;
        }
    }

    long long query(int p, int l, int r, int i, int j) {
        push(p, l, r);

        if (i > r || j < l)
            return 0;
        if (i <= l && r <= j)
            return st[p];

        int m = (l + r) / 2;
        return min(query(2*p, l, m, i, j), query(2*p+1, m+1, r, i, j));
    }

    long long query(int i, int j) {
        return query(1, 0, n-1, i, j);
    }

    void update(int p, int l, int r, int i, int j, long long val) {
        push(p, l, r);

        if (i > r || j < l)
            return;
        if (i <= l && r <= j) {
            st[p] += val;
            if (l != r) {
                lazy[2*p] += val;
                lazy[2*p+1] += val;
            }
            return;
        }

        int m = (l + r) / 2;
        update(2*p, l, m, i, j, val);
        update(2*p+1, m+1, r, i, j, val);
        st[p] = min(st[2*p], st[2*p+1]);
    }

    void update(int i, int j, long long val) {
        update(1, 0, n-1, i, j, val);
    }
};

vector<pair<int, int>> interval[200005];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, m;
    cin >> n >> m;
    long long tot = 0;
    for (int i=0; i<m; i++) {
        int l, r, a;
        cin >> l >> r >> a;
        tot += a;
        interval[r].emplace_back(l, a);
    }

    SegmentTree st(n + 1);
    st.update(0, 0, -INF);
    for (int i=1; i<=n; i++) {
        st.update(i, i, st.query(0, i - 1) - INF);
        for (auto &p : interval[i])
            st.update(0, p.first - 1, p.second);
    }

    cout << tot - st.query(0, n) << "\n";

    return 0;
}


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

#define endl "\n"
#define int int64_t
#define ll long long

void solve()
{
int n,m;
cin>>n>>m;
if(n<m)
{
	for(int i=0;i<m;i++)
	cout<<n;
}else{
	for(int i=0;i<n;i++)
	cout<<m;
}
cout<<endl;


}

int32_t main()
{

	// int test;
	// cin >> test;
	// while (test--)
	{
		solve();
	}
	return 0;
}


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

typedef long long ll;

int main()
{
    ll X, Y;
    cin >> X >> Y;
    ll ans = 1;
    ll temp = Y;
    while (true)
    {
        temp /= 2;
        if (temp < X)
        {
            break;
        }
        ++ans;
    }
    cout << ans << endl;
}


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

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define REP(i,n) for(int _n=n, i=0;i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)
#define FORD(i,a,b) for(int i=(a),_b=(b);i>=_b;--i)
#define trav(a, x) for (auto& a : x)
using ull = uint64_t;
using ll = int64_t;
using PII = pair<int, int>;
using VI = vector<int>;
#define INF (1ll<<60)

string to_string(string s) { return '"' + s + '"'; }
string to_string(const char* s) { return to_string((string) s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B> string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; }
template <typename A> string to_string(A v) {
bool first = true; string res = "{";
for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); }
res += "}"; return res; }
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H); debug_out(T...); }
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

ll maxx(ll a, ll b) {
    return a > b ? a : b;
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    ll N, x;
    cin >> N >> x;
    vector<ll> V(N);
    vector<ll> V1;
    REP(i, N) {
        cin >> V[i];
    }
    V1 = V;
    ll cost = 0;
    FOR(i, 1, N-1) {
        ll sum = V[i] + V[i-1];
        if (sum > x) {
            int k = V[i];
            V[i] = maxx(0LL, V[i] - (sum - x));
            sum = V[i-1] + V[i];
            cost += k - V[i];
            if (sum > x) {
                k = V[i-1];
                V[i-1] = V[i-1] - (sum - x);
                cost += k - V[i-1];
            }
        }
    }
    cout << cost << endl;
    // V = V1;
    // ll cost1 = 0;
    // FORD(i, N-2, 0) {
    //     ll sum = V[i] + V[i+1];
    //     if (sum > x) {
    //         int k = V[i];
    //         V[i] = maxx(0LL, V[i] - (sum - x));
    //         sum = V[i+1] + V[i];
    //         cost1 += k - V[i];
    //         if (sum > x) {
    //             k = V[i+1];
    //             V[i+1] = V[i+1] - (sum - x);
    //             cost1 += k - V[i+1];
    //         }
    //     }
    // }
    // cout << min(cost, cost1) << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define MM 1000000000;
#define mod MM + 7;
#define INF (ll)1e18
#define pi acos(-1.0)
#define MAX 1000000005
#define NIL -1
int main(){
    ll n, k; cin >> n >> k;
    ll ans = k;
    ll s = k-1;
    for(ll i = 0; i < n-1; i++){
        ans *= s;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <deque>
#include <queue>
#include <assert.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n; cin >> n;
    //n--;
    string s="";
    while(n){
    	s+=(char)('a'+(n%26>0?n%26-1:25));
    	n-=(n%26>0?n%26:26);
    	n/=26;
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}




Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())
#define endl "\n"

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<ll> a(n), b(n), c(n - 1);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n - 1) cin >> c[i];
    ll ans = 0;
    rep(i, n) {
        ans += b[a[i] - 1];
        if ((i > 0) && ((a[i - 1] + 1) == a[i])) {
            ans += c[a[i] - 2];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.HashSet;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {
	static int h,w;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		h=sc.nextInt();
		w=sc.nextInt();
		char[][] array = new char[h][w];
		for(int i=0;i<h;i++) 	array[i] = sc.next().toCharArray();
		sc.close();
		int max=0;
		int[] dx={-1,0,1,0}, dy={0,1,0,-1};
		for(int i=0;i<h;i++) {
			for(int j=0;j<w;j++) {
				if(array[i][j]=='#') continue;
				Queue<Integer> q = new ArrayDeque<>();
				Set<Integer> closed = new HashSet<>();
				int[][] distarray = new int[h][w];
				int distance=0;
				q.add(id(i,j));
				distarray[i][j]=0;
				while(!q.isEmpty()) {
					int now = q.poll();
					closed.add(now);
					int y = now%w;
					int x = (now-y)/w;
					for(int k=0;k<4;k++) {
						if(x+dx[k]>=0 && x+dx[k]<h && y+dy[k]>=0 && y+dy[k]<w) {
							if(array[x+dx[k]][y+dy[k]]!='#') {
								int id = id(x+dx[k],y+dy[k]);
								if(!closed.contains(id)) {
									q.add(id);
                                    closed.add(id);
									distarray[x+dx[k]][y+dy[k]]=distarray[x][y]+1;
									if(distarray[x][y]+1>distance) distance=distarray[x][y]+1;
								}
							}
						}
					}
				}
				if(distance>max) max = distance;
			}
		}
		System.out.println(max);
	}
	static int id(int x, int y) {
		return x*w+y;
	}
}


Measured memory_bytes: 40732
def resolve():
    n, x = map(int, input().split())
    a = list(map(int, input().split()))
    ans = 0
    a = sorted(a)
    for i in range(n):
        if x < 0:
            break
        x -= a[i]
        ans += 1
    if x != 0:
        ans -= 1
    print(ans)
resolve()

Measured memory_bytes: 9052
#include <bits/stdc++.h>
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)

using ll = long long;
using ull = unsigned long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const ll mod = 1e9+7;
void chmod(ll &M){
  if(M >= mod) M %= mod;
  else if(M < 0){
     M += (abs(M)/mod + 1)*mod;
    M %= mod;
}
}
ll modpow(ll x, ll n){
   if(n==0) return 1;
  ll res=modpow(x, n/2);
 if(n%2==0) return res*res%mod;
else return res*res%mod*x%mod;
}
int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };
long long GCD(long long a, long long b) {
  if (b == 0) return a;
  else return GCD(b, a % b);
}

using namespace std;
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */

int main()
{
    string N;
    cin >> N;
    
    int sum = 0;
    int n = N.length();
    for (int i = 0; i < n; i++) {
        int a = N[i] - '0';
        sum += a;
    }

    if (sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;


}

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

int main(){
  long n;
  cin >> n;
  queue<long> num;
  long ans[n+1];
  rep(i,n+1)ans[i] = 0;
  num.push(0);
  ans[0] = 0;
  while(num.size()){
    long now = num.front();
    num.pop();
    if(now==n)break;
    if(ans[now+1]==0){
      num.push(now + 1);
      ans[now+1] = ans[now] + 1;
    }
    rep(i,6){
      long tmp = now + pow(6,i+1);
      if(tmp > n || ans[tmp] != 0)continue;
      num.push(tmp);
      ans[tmp] = ans[now] + 1;
    }
    rep(i,5){
      long tmp = now + pow(9,i+1);
      if(tmp > n || ans[tmp] != 0)continue;
      num.push(tmp);
      ans[tmp] = ans[now] + 1;
    }
  }
  cout << ans[n] << endl;
  return 0;
}

Measured memory_bytes: 4848
W, H, x, y = map(int, input().split())
center_x, center_y = W / 2, H / 2
ans = []

if x == center_x and y == center_y:
    ans.append(W * H / 2)
    ans.append(1)
elif x == center_x or y == center_y:
    ans.append(W * H / 2)
    ans.append(0)
else:
    a = (center_y - y) / (center_x - x)
    b = center_y - a * center_x

    if b == 0:
        s1 = 0
    else:
        s1 = - b / a
    s2 = (H - b) / a
    s3 = b
    s4 = a * W + b

    area = 0
    if 0 <= s1 <= W:
        area1 = (s1 + s2) * H / 2
        area2 = (2*H - s1 - s2) * H / 2
        area = min(area1, area2)
    else:
        area1 = (s3 + s4) * W / 2
        area2 = (2*W - s3 - s4) * W / 2
        area = min(area1, area2)
        
    ans.append(area)
    ans.append(0)
print("{:.6f} {:d}".format(*ans))

Measured memory_bytes: 3064
#include  <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string t;
  cin>>t;
  string s;
  for(int i=0;i<t.size();i++){
    if(t[i]=='?') s+='D';
    else s+=t[i];
  }
  cout<<s<<endl;
  
  return 0;
}

Measured memory_bytes: 3924
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    
    int area = a * b;
    int road = a + b - 1;
    System.out.println(area - road);
  }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
using namespace std;
#define s second
#define f first
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define reset(a,b) memset(a,b,sizeof a)
#define ll long long
#define MOD 30013
#define MID (l+r)/2
#define ALL(x) x.begin(),x.end()
#define dalam fl<=l && r<=fr
#define kiwo 2*(idx),l,MID
#define tengen 2*idx+1,MID+1,r
#define debug(x) cout<<#x<<" = "<<(x)<<endl
#define mx 100000
#define pc(x) putchar_unlocked(x);

int a[40004],n,dua=10,tiga=15;
bool ada[40004];

void cmp(int ke){
	if(ke+3>n || tiga+6>30000){
		int now=30000;
		if((n-ke+1)%2==1){
			a[ke]=30000;
			now-=6;
			ke++;
		}
		for(int i=ke;i<=n;i+=2){
			if(now-6<=0){
				for(int j=i;j<=n;j++){
					a[j]=dua;
					dua+=2;
					while(dua%3==0)dua+=2;
				}
				return;
			}
			a[i]=now;
			a[i+1]=now-6;
			now-=12;
		}
		return;
	}
	a[ke]=dua;
	dua+=2;
	while(dua%3==0)dua+=2;
	a[ke+1]=dua;
	dua+=2;
	while(dua%3==0)dua+=2;
	a[ke+2]=tiga;
	tiga+=6;
	a[ke+3]=tiga;
	tiga+=6;
	cmp(ke+4);
}

int main(){
	cin>>n;
	if(n==3){
		cout<<"2 3 25\n";
		return 0;
	}
	if(n==4){
		cout<<"2 5 20 63\n";
		return 0;
	}
	// 2 sama 30002 dikurang ditambah sama 5 dan 35
	// 16 sama 30002 ditukar 5 sama 25
	a[1]=2;
	a[2]=4;
	a[3]=3;
	a[4]=9;
	cmp(5);
	long long sum=0;
	if(n==20000){
		a[1]=5;
		a[20000]=35;
	}
	if(n==19999){
		for(int i=1;i<=n;i++){
			if(a[i]==16){
				a[i]=5;
			}
		}
		a[19999]=25;
	}
	for(int i=1;i<=n;i++){
		sum+=a[i];
	}
	for(int i=1;i<=n;i++){
		ada[a[i]]=true;
	}
	for(int i=1;i<=n;i++){
		if(a[i]<=0 || a[i]>30000 || __gcd(sum,(ll)a[i])==1){
			assert(false);
		}
	}
	for(int i=1;i<=n;i++){
		if(i!=1)cout<<' ';
		cout<<a[i];
	}
	cout<<endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cctype>
#include <ctime>
#include <set>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <string>
#include <map>
#define ll long long

using namespace std;

const int M = 1000000007;

ll n, a, sol;
string c, h[10];
set <string> s;
map <string, ll> m;


int main() {

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	cin >> n;
	
	for (int i = 0; i < n; i++){
		cin >> c;
		for (int i = 0; i < 10; i++) h[i] = c.substr(i, 1);
		sort(h, h+10);
		c = "";
		for (int i = 0; i < 10; i++) c += h[i];
		s.insert(c);
		m[c]++;	
	}
	
	for (set <string> :: iterator it = s.begin(); it != s.end(); it++){
		a = m[*it];
		if (a == 2) sol++;
		if (a > 2) sol += (a*(a-3))/2 + a;
	}
	
	cout << sol;
	
return 0;
}




Measured memory_bytes: 17408
#include <stdio.h>

int main()
{
	int N, M, X, Y;
	scanf("%d %d %d %d", &N, &M, &X, &Y);
	int i, x, y, max = X, min = Y;
	for (i = 1; i <= N; i++) {
		scanf("%d", &x);
		if (x > max) max = x;
	}
	for (i = 1; i <= M; i++) {
		scanf("%d", &y);
		if (y < min) min = y;
	}
	if (min > max) printf("No War\n");
	else printf("War\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int k;
char r[100];

void dfs(int n, int d, int c) {
    r[d] = '0' + c;
    if (d + 1 == n) {
        k--;
        if (k == 0) {
            r[n] = 0;
            cout << r << endl;
            exit(0);
        }
        return;
    }
    for (int i = 0; i < 10; i++) {
        if (abs(c - i) <= 1) {
            dfs(n, d + 1, i);
        }
    }
}

int main() {
    cin >> k;

    for (int n = 1;; n++) {
        for (int c = 1; c < 10; c++) {
            dfs(n, 0, c);
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdint>
#include <iostream>
 
using namespace std;
 
int main() {
  int64_t S, W;
  cin >> S >> W;
  
  if (S > W) {
    cout << "safe" << endl;
  } else {
    cout << "unsafe" << endl;
  }
  return 0;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define SZ(x) ((int)x.size())
#define L(i,u) for (register int i=head[u]; i; i=nxt[i])
#define rep(i,a,b) for (register int i=(a); i<=(b); i++)
#define per(i,a,b) for (register int i=(a); i>=(b); i--)
using namespace std;
typedef long long ll;
typedef unsigned int ui;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x){
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
template<class T> inline void umin(T &x, T y){x=x<y?x:y;}
template<class T> inline void umax(T &x, T y){x=x>y?x:y;}
inline ui R() {
	static ui seed=416;
	return seed^=seed>>5,seed^=seed<<17,seed^=seed>>13;
}
const int N = 505;
int n;vector<Pii>a;
int e[N][N],s[N];
int main() {
	read(n);
	rep(i,1,n)rep(j,i+1,n)e[i][j]=1;
	if(n%2==0){rep(i,1,n/2)e[i][n-i+1]=0;}
	else{rep(i,1,n/2)e[i][n-i]=0;}
	rep(i,1,n)rep(j,i+1,n)if(e[i][j]){
		a.pb(Pii(i,j));s[i]+=j;s[j]+=i;
	}
	rep(i,2,n)assert(s[i]==s[1]);
	printf("%d\n",SZ(a));
	rep(i,0,SZ(a)-1)printf("%d %d\n",a[i].fi,a[i].se);
	return 0;
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
// const int MOD = 1000000007;

int main() {
  int n;
  cin >> n;
  if (n == 1)
    cout << "Hello World" << endl;
  else {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
  }
}


Measured memory_bytes: 256
/*
    問題をよく読もう！
    論理的に考えよう！
    サンプルを確認しよう!
    絶対に諦めるな！
    工夫をしろ！
    配列は少し多めにとっておく

    Twitterは終わるまでログアウト！
    （間違えて解法をツイートしてはいけないから）

*/
//include
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include<cstring>
//namespace
using namespace std;
//繰り返し
#define REP(i, m, n) for(int i=(int)m; i<(int)n; ++i)
#define rep(i, n) REP(i, 0, n)
//イテレータ
#define all_range(C) begin(C), end(C)
//簡略化
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
typedef pair<string,int> pst;

const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
//最大最小
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) {if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) {if(a<b) a=b;}

//関数

//最大公約数を求める
ll my_gcd(ll x, ll y) {
  ll r;

  while(y!=0) {
    r = x%y;
    x = y;
    y = r;
  }

  return x;
}

//最小公約数を求める
ll my_lcm(ll x, ll y) {

  return (x*y)/my_gcd(x,y);
}

//xのy乗を求める ※参考：10^18乗まで
ll my_pow(ll x, ll y) {
  ll sum = 1;

  while(y>0) {
    sum *= x;
  }

  return sum;
}

//main.cpp----------------------------


void solve();
ll dfs(ll i, ll sum);

ll n;
ll s[110];
ll dp[110][100000];

int main() {
  cin >> n;
  rep(i, n) cin>> s[i];

  memset(dp, -1, sizeof(dp));

  solve();

  return 0;
}

void solve() {

  cout << dfs(0, 0) << endl;

  return;
}


ll dfs(ll i, ll sum) {

  if(dp[i][sum]>=0) return dp[i][sum];

  if(i==n) {
    return dp[i][sum] = sum;
  }

  int res1 = dfs(i+1, sum+s[i]);
  int res2 = dfs(i+1, sum);

  if(res1%10==0&&res2%10==0) {
    return dp[i][sum] = 0;
  }else if(res1%10==0) {
    return dp[i][sum] = res2;
  }else if(res2%10==0) {
    return dp[i][sum] = res1;
  }else {
    return dp[i][sum] = max(res1, res2);
  }
}


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

ll ans = 0;

const int N = pow(10,5)/2 + 5;
ll x[N] = {},y[N] = {};

int main(){
    int n;
    cin >> n;
    if(n == 2){
        int a,b;
        cin >> a >> b;
        cout << a + b << endl;
    }else{
        cout << "Hello World" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int H,W;
    while(1){
        int k=0;
        cin>>H>>W;
        if(H==0&&W==0){
            break;
        }
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                k += 1;
                if(k%2==1){
                    cout<<"#";
                }else{
                    cout<<".";
                }
            }
            if(W%2==0){
            k -= 1;
            }
            cout<<endl;
        }
        cout<<endl;
    }
}


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>

using namespace std;
typedef long long ll;

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

    priority_queue<ll, vector<ll>, greater<ll>> que;
    for (int i=0; i<N; i++) {
        ll a; 
        cin >> a; 
        que.push(a);
    }

    ll res = que.top();
    while (!que.empty()) {
        ll ms = que.top();  // 最小の数
        que.pop();

        vector<ll> mem;
        while (!que.empty()) {
            ll cnd = que.top() % ms;
            que.pop();
            if (cnd == 0) continue;
            mem.emplace_back(cnd);
        }

        if (mem.size() == 0) {
            res = ms;
            break;
        } else {
            que.push(ms);
            for (ll m: mem) que.push(m);
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 2548
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <set>

using namespace std;
typedef long long LL;
static const double EPS = 1e-9;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n) 
void decode(vector<string> &words)
{
  int s=0;
  REP(i,words.size()){
    REP(j,26){
      REP(k,words[i].size()){
        if(words[i][k] >= 'a' && words[i][k] <= 'z' )
        words[i].replace(k, 1, 1,
              'a' + ( words[i][k] + 1 - 'a')%26 );
        
        if(words[i] == "the"||words[i] == "this" || words[i] == "that" ||
           words[i] == "the." || words[i] == "this." || words[i] == "that." )
          s = j;
      }
    }
  }
  REP(i,words.size())
    REP(j,words[i].size())
      if(words[i][j] >= 'a' && words[i][j] <= 'z' )
        words[i].replace(j, 1, 1, 'a' + (words[i][j] + s+1 - 'a')%26 );
}

int main(void){  
  vector<string> words;
  string bf;

  while(true){
    if(!(cin >> bf)) break;
    words.push_back(bf);
    int c = getchar();
    if(c=='\n'){
      decode(words);
      cout << words[0];
      FOR(i,1,words.size())
        cout << " " << words[i];
      cout << endl;
      words.clear();
    }
  }
  return 0;
}

Measured memory_bytes: 0
/*
  #問題：
  


  #分析：
  #オブジェクト：
  
  #条件：
  

  #要求：
  

  #解法：
  
*/

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>        //do setprecision
#include <ctime>
#include <complex>
#include <initializer_list>
#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define uLL unsigned LL
#define LD long double

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
const int mod=1000000007;


const unsigned int BIT_FLAG_0 = (1<<0);
const unsigned int BIT_FLAG_1 = (1<<1);
const unsigned int BIT_FLAG_2 = (1<<2);
const unsigned int BIT_FLAG_3 = (1<<3);
const unsigned int BIT_FLAG_4 = (1<<4);
const unsigned int BIT_FLAG_5 = (1<<5);
const unsigned int BIT_FLAG_6 = (1<<6);
const unsigned int BIT_FLAG_7 = (1<<7);


#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
namespace mp = boost::multiprecision;

using Bint = mp::cpp_int;



int main(void){
  int cnt1=0,cnt2=0;

  string S;
  cin>>S;

  
  FOR(i,0,S.length() ){
    if(i%2==0){
      if(S[i]=='0'){
        cnt1++;
        // cerr<<"S[i]: "<<S[i]<<"   i:"<<i<<"  cnt1:"<<cnt1<<endl;
      }else{
        cnt2++;
        // cerr<<"S[i]: "<<S[i]<<"   i:"<<i<<"  cnt1:"<<cnt1<<endl;
      }
    }else{                      // if(i%2==1){}
      if(S[i]=='1'){
        cnt1++;
        // cerr<<"S[i]: "<<S[i]<<"   i:"<<i<<"  cnt1:"<<cnt1<<endl;
      }else{
        // cerr<<"S[i]: "<<S[i]<<"   i:"<<i<<"  cnt1:"<<cnt1<<endl;
        cnt2++;
      }
    }
  }
  // cerr<<"cnt1: "<<cnt1<<endl;
  
  // FOR(i,0,S.length() ){
  //   if(i%2==1){
  //     if(S[i]=='0'){
  //       cnt2++;
  //     }
  //   }else{                      // if(i%2==0){}
  //     if(S[i]=='1'){
  //       cnt2++;
  //     }
  //   }
  // }
  // // cerr<<"cnt2: "<<cnt2<<endl;
  cout<<min(cnt1,cnt2)<<endl;
  return 0;
}



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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

bool nagomi(ll n){
    set<int> set1;
    while(n!=0){
        set1.insert(n%10);
        n /= 10;
	}
    if(set1.size()==3) return true;
    else return false;
}

int main(){
    int n,m;
    cin >> n >> m;
    if(abs(n-m)>1){
        COUT(0);
        return 0;
    }
    ll ans=1;
    if(n==m)ans*=2;
    while(n!=0){
        ans*=n;
        n--;
        if(ans>MOD)ans%=MOD;
    }
    while(m!=0){
        ans*=m;
        m--;
        if(ans>MOD)ans%=MOD;
    }
    COUT(ans);
    return 0;
} 


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

#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

const int N=1e5 + 5;

int32_t main()
{
	IOS;
	double w,h,x,y;
	cin >> w >> h >> x >> y;
	std::cout << std::fixed;
   	std::cout << std::setprecision(10);
	double area = (w*h)/2;
	double midx = w/2;
	double midy = h/2;
	if(midx==x && midy==y)
	{
		cout << area << " " << 1 << endl;
	}
	else
	{
		cout << area << " " << 0 << endl;
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n)  for (int i = 0; i < (int) (n); i++)
#define REP1(i, n) for (int i = 1; i <= (int) (n); i++)
#define all(x)     (x).begin(), (x).end()
#define SZ(x)      ((int) (x).size())
using ll = long long;

int main() {
  ll a;
  double b;
  cin >> a >> b;
  ll b2 = round(b * 100);
  cout << a * b2 / 100 << endl;
  return 0;
}


Measured memory_bytes: 3740
// Christmas Eve Eve

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
    int n;
    cin >> n;
    int p[n];

    int max_price = 0;
    int max_price_index = -1;

    for (int i = 0; i < n; i++) {
        cin >> p[i];
        if (p[i] > max_price) {
            max_price_index = i;
            max_price = p[i];
        }
    }

    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (i == max_price_index) {
            sum += (p[i] / 2);
            continue;
        }
        sum += p[i];
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    pair<int,int> p[m];
    for(int i=0;i<m;i++){
        int b,c;
        cin>>b>>c;
        p[i]={c,b};
    }
    sort(p,p+m,greater<pair<int,int>>());
    int crt=0;
    int cnt[m];
    for(int i=0;i<m;i++){
        int c=p[i].first;
        int b=p[i].second;
        int it=lower_bound(a+crt,a+n,c)-a;
        if(it-crt<=b){
            cnt[i]=it-crt;
            crt=it;
        }else{
            cnt[i]=b;
            crt=crt+b;
        }
    }
    ll ans=0;
    for(int i=crt;i<n;i++){
        ans+=a[i];
    }
    for(int i=0;i<m;i++){
        ans+=(ll)cnt[i]*p[i].first;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1792
#include <cstdio>
using namespace std;
const int maxn = 1e5+5;
const int mod = 1e9+7;
typedef long long ll;
ll x[maxn], y[maxn];
int n, m;
int main(){
    scanf("%d %d",&n, &m);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &x[i]);
    for(int i = 1; i <= m; i++)
        scanf("%lld", &y[i]);
    ll sx = 0, sy = 0;
    for(int i = n; i >= 1; i--)
    {
        sx = (sx+(2*i-n-1) * x[i]) % mod;
    }

    for(int i = m; i >= 1; i--)
    {
        sy = (sy+(2*i-m-1) * y[i]) % mod;
    }
    printf("%lld\n", ((sx % mod)* (sy % mod)) % mod);

    return 0;
}

Measured memory_bytes: 1664
#include <iostream>

using namespace std;

int main()
{
	int n, x;
	int i, j, k;
	int count;

	while (1)
	{
		count = 0;
		cin >> n >> x;

		if (n == 0 && x == 0)
			break;
		else
		{
			for (i = 1; i <= n; i++)
			{
				for (j = i + 1; j <= n; j++)
				{
					for (k = j + 1; k <= n; k++)
					{
						if (x == i + j + k)
							count++;
					}
				}
			}
			cout << count << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1160
#include<math.h>
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define    ll   long long int
#define    py   printf("Yes\n")
#define    pn   printf("No\n")
#define    in   cin>>
using namespace std;

int main()
{
  int d,n;
  in d>>n;
  if(n==100)n++;

  for(int i=0;i<d;i++)
  {
    n=n*100;
  }
  cout<<n<<endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys


def max_heapify(index):
    left, right, largest = 2 * index, 2 * index + 1, -1

    if left <= array_length and array[left] > array[index]:
        largest = left
    else:
        largest = index

    if right <= array_length and array[right] > array[largest]:
        largest = right

    if largest != index:
        array[index], array[largest] = array[largest], array[index]
        max_heapify(largest)

    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    array_length = int(_input[0])
    array = list(map(int, _input[1].split()))
    # assert len(array) == array_length

    # array.insert(0, None)
    array = [None] + array
    for j in range(array_length // 2, 0, -1):
        max_heapify(j)
    print('', end=' ')
    print(*array[1:])

Measured memory_bytes: 62412