akhauriyash/Code-Regression huggingface dataset:
import std.stdio,std.conv, std.algorithm, std.container,std.array,std.range,std.string,std.typecons;
const dx = [1,0,-1,0];
const dy = [0,1,0,-1];
void read(T...)(auto ref T args){ 
	auto line = readln().split(); 
	foreach(i,ref arg; args) arg = line[i].to!(typeof(arg));
}
int sum(int n){return n * (n + 1)/ 2;}
int tax(int per,int yen) {return yen * (100 +per) / 100;}
void main(){
	int x,y,s;
	while(read(x,y,s),x|y|s){
		int ans ;
		auto taxed= iota(s).map!(i => tax(x,i)).array;
		foreach(i;1..s){
			foreach(j;i..s){
				if (taxed[i] + taxed[j] == s ){
					ans = max(ans,tax(y,i) + tax(y,j));break;
				}
			}
		}
		ans.writeln;
	}
}

Measured memory_bytes: 2892
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)

using hash_t = unsigned long long;

template<hash_t MOD>
struct rolloing_hash {
    int n, b;
    vector<hash_t> pow, hash;
    
    rolloing_hash() {}
    
    rolloing_hash(const string &s, hash_t b_ = 100) {
        set(s, b_);
    }
    
    void set(const string &s, hash_t b_ = 100) {
        n = s.size();
        b = b_;
        calc_pow();
        calc_hash(s.c_str());
    }

    void calc_pow() {
        pow.resize(n + 1); pow[0] = 1;
        for (int i = 0; i < n; i++) {
            pow[i + 1] = (1LL * pow[i] * b) % MOD;
        }
    }
    
    void calc_hash(const char *s) {
        hash.resize(n + 1);
        hash[0] = 0;
        for (int i = 0; i < n; i++) {
            hash[i + 1] = (s[i] + 1LL * hash[i] * b) % MOD;
        }
    }
    
    hash_t get(int i) const {
        return hash[i]; 
    }
    
    hash_t get(int i, int j) const {
        return (get(j) - (get(i) * pow[j - i] % MOD) + MOD) % MOD;
    }
};

using RH = rolloing_hash<1000000007>;

int main() {
    string s;
    
    while (cin >> s) {
        int n = s.size();
        int a = n % 2 == 0 ? 2 : 1;
        int b = n % 2 == 0 ? n / 2 - 1 : n / 2;
        int c = b + a;
        int d = n - a;
        RH rh(s);
        int ans = n;
        while (a < b) {
            hash_t A = rh.get(0, a);
            if (rh.get(b, c) == A && rh.get(d, n) == A && rh.get(a, b) == rh.get(c, d)) {
                ans = min(ans, b);
            }
            a += 2;
            b -= 1;
            c += 1;
            d -= 2;
        }
        if (ans != n) {
            cout << "Love " << s.substr(0, ans) << '!';
        } else {
            cout << "mitomerarenaiWA";
        }
        cout << '\n';
    }
}

Measured memory_bytes: 20036
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000001


int main(){
	
	int N;
	cin>>N;
	
	vector<vector<int>> V(N);
	for(int i=0;i<N;i++){
		int w,s,v;
		cin>>w>>s>>v;
		
		V[i] = {w+s,w,s,v};
	}
	
	sort(V.begin(),V.end());
	
	vector<vector<long long>> dp(N+1,vector<long long>(20001,-Inf));
	dp[0][0] = 0;
	
	for(int i=0;i<N;i++){
		for(int j=0;j<=20000;j++){
			if(dp[i][j]==-Inf)continue;
			dp[i+1][j] = max(dp[i+1][j],dp[i][j]);
			if(j>V[i][2])continue;
			int to = j + V[i][1];
			if(to<=20000)dp[i+1][to] = max(dp[i+1][to],dp[i][j]+V[i][3]);
		}
	}
	
	long long ans = 0;
	for(int i=0;i<dp.back().size();i++)ans = max(ans,dp.back()[i]);
	
	cout<<ans<<endl;
		
	return 0;
}


Measured memory_bytes: 160640
//#include "SaveFuncs.cpp"

/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

int Main()
{
	int N;
	cin >> N;
	vector<int> A(N), B(N), C(N - 1);
	rep(i, N)		cin >> A.at(i);
	rep(i, N)		cin >> B.at(i);
	rep(i, N - 1)	cin >> C.at(i);

	int ret = 0;
	int back = -10;
	for (int i = 0; i < N; i++)
	{
		//debug_cout(i);
		//debug_tabCout(1, ret);
		int a = A.at(i);
		//debug_tabCout(1, a);
		ret += B.at(a - 1);
		if (back + 1 == a - 1)
			ret += C.at(a - 2);
		back = a - 1;
	}

	cout << ret;

	return 0;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	Main();

	return 0;
}


Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>){
    val sc = Scanner(System.`in`)
    val s = sc.nextLine()

    
    val ARC  ="ARC"
    val ABC = "ABC"
    
    if(s.equals(ARC)){
        println(ABC)
    } else {
        println(ARC)
    }
}


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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }



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

    ll N;
    string S;
    cin >> S;

    ll ans = 0;
    vector<ll> W;
    REP(i, S.size())
    {
        if(S.at(i)=='W'){
            W.push_back(i + 1);
        }
    }
    ll tmp;
    REP(i, W.size())
    {
        tmp = W.at(i)-(i+1);
        ans += tmp;

    }
    cout << ans << endl;
}


Measured memory_bytes: 2700
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        boolean count[] = new boolean[100001];
        int N = in.nextInt();

        int prev = 0;
        int act = 0;
        for (int i = 0 ; i < N; i++) {
            int inp = in.nextInt();

            if (count[inp]) {
                if (prev == 0) {
                    prev = inp;
                } else {
                    act += 1;
                    prev = 0;
                }
            }

            count[inp] = true;
        }
        if (prev != 0) {
            act += 1;
        }

        out.print(N - act * 2);
    }
    public static final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    public static final PrintStream out = System.out;
}


Measured memory_bytes: 31652
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

string yn(bool x){
    return x ? "YES" : "NO";
}



signed main(){
    int n , m; cin >> n >> m;
    vector<pair<int,int>> a;

    rep(i,n){
        int x,y; cin >> x >> y;
        a.emplace_back(x,y);
    }

    Sort(a);

    int ans = 0;
    rep(i,n){
        int cost = a[i].first;
        int store = a[i].second;

        if(m <= 0) break;
        if(m - store < 0) ans += m*cost;
        else ans += cost*store;

        m -= store;

    }

    cout << ans << endl;

}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
int v[100000 + 100];
void gen(int n) {
  fill(v, v + n + 10, 1);
  v[0] = v[1] = 0;
  for (int i = 2; i < sqrt(n) + 1; ++i) {
    if (!v[i]) continue;
    for (int j = i * 2; j <= n; j += i) {
      v[j] = 0;
    }
  }
}
int Q;
int main() {
  ios::sync_with_stdio(false);
  gen(100000 + 2);
  vector<int> dd;
  for(int i = 1; i <= 100000; i += 2) {
    if (v[i] && v[(i + 1) / 2]) {
      dd.push_back(i);
    }
  }
  cin >> Q;
  for(int i = 0; i < Q; ++i) {
    int l, r;
    cin >> l >> r;
    auto it1 = lower_bound(dd.begin(), dd.end(), l);
    auto it2 = upper_bound(dd.begin(), dd.end(), r);
    cout << it2 - it1 << '\n';
  }
}

Measured memory_bytes: 1024
while True:
    m,f,r=map(int,input().split(" "))
    if m+f+r==-3:
        break
    else:
        if m==-1 or f==-1:
            print("F")
        elif m+f>=80:
            print("A")
        elif m+f>=65:
            print("B")
        elif m+f>=50:
            print("C")
        elif m+f>=30:
            if r>=50:
                print("C")
            else:
                print("D")
        else:
            print("F")


Measured memory_bytes: 5592
import sys

stdin = sys.stdin
def na(): return map(int, stdin.readline().split())
def ns(): return stdin.readline().strip()

n,m = na()
g = [[0]*n for _ in range(n)]
for i in range(m):
    x,y = na()
    g[x-1][y-1] += 1
    g[y-1][x-1] += 1

import itertools

ct = 0
for a in itertools.permutations(range(n)):
    if a[0] != 0: break
    plus = 1
    for i in range(n-1):
        plus = plus * g[a[i]][a[i+1]]
    ct += plus
print(ct)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int n,L;
string s[110];
int main(){
    cin>>n>>L;
    for (int i=1;i<=n;i++)
        cin>>s[i];
    sort(s+1,s+n+1);
    for (int i=1;i<=n;i++)
        cout<<s[i];
    cout<<endl;
    return 0;
}

Measured memory_bytes: 256
package main

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

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	x := nextInt()

	flag := false
	for i := 0; i < 2*n-1; i++ {
		if flag == true {
			_, _ = fmt.Fprint(writer, " ")
		}
		flag = true
		_, _ = fmt.Fprintf(writer, "%d", x-n+1+i)
	}
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 640
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<limits.h>
#include<cmath>
#include<queue>
#include<stack>

#include<stdio.h>
#include<stdlib.h>

#define rep(i,n) for(ll i = 0; i < (ll)n; i++)
#define swap(a,b) a^=b;b^=a;a^=b;
#define chmax(a,b) {if(a < b) a = b;}
#define chmin(a,b) {if(a > b) a = b;}

using namespace std;
typedef long long ll;
ll gcd(ll, ll);
vector<bool> to_binary(int);
ll nCr(ll n, ll r);

const ll INF = 1LL << 60;

typedef tuple<ll, ll> mtupl;

/*

bool mycomp(mtupl x, mtupl y) {
	return get<1>(x) < get<1>(y);
}

int vsum(vector<int> v) {
	int res = 0;
	for (auto it = v.begin(); it != v.end(); it++)
		res += *it;
	return res;
}

int vmin(vector<int> v) {
	int min = INT32_MAX;
	for (auto it = v.begin(); it != v.end(); it++)
		min = std::min(min, *it);
	return min;
}

int vmax(vector<int> v) {
	int max = INT32_MIN;
	for (auto it = v.begin(); it != v.end(); it++)
		max = std::max(max, *it);
	return max;
}

ll gcd(ll A, ll B) {
	if (A == 0 || B == 0) return max(A, B);
	int r = A % B;
	while (r != 0) {
		A = B;
		B = r;
		r = A % B;
	}
	return B;
}

vector<ll> prime_factor(int64_t n) {
	//map< ll, ll > ret;
	vector<ll> ret;
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			//ret[i]++;
			ret.push_back(i);
			n /= i;
		}
	}
	if (n != 1)ret.push_back(n);// ret[n] = 1;
	return ret;
}

const int MAX = 1000000;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
ll COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

struct edge {
	ll to;
	ll cost;
};

*/

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//Program Start	

	string s;
	cin >> s;
	if (s[0] == s[1] && s[0] == s[2]) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}

ProgramEndPointLabel:;

	//Program End
#ifndef DEBUG
	system("pause");
#endif // !DEBUG


	return 0;
}




Measured memory_bytes: 504
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int inf{int(1e9)};

struct UnionFind {
    //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
    //そうでなければ親のid
    vector<int> r;

    UnionFind(int N) {
        r = vector<int>(N, -1);
    }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) {
        return -r[root(x)];
    }
};

int main(void){
  int N, M;
  cin >> N >> M;

  UnionFind UF(N);
  rep(i,M){
    int A, B;
    cin >> A >> B;
    A --; B --;
    UF.unite(A, B);
  }

  int ans = 0;
  rep(i,N) ans = max(ans, UF.size(i));


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


Measured memory_bytes: 4040
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
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;}

const long long INF = 1LL << 60;

struct Edge {
    long long from;
    long long to;
    long long cost;
    Edge(int s, int d) : to(s),cost(d) {}
};

using Graph = vector<vector<Edge>>;
using Edges = vector<Edge>;
 
/* dijkstra(G,s,dis)
    入力：グラフ G, 開始点 s, 距離を格納する dis
    計算量：O(|E|log|V|)
    副作用：dis が書き換えられる
*/
void dijkstra(const Graph &G, int s, vector<long long> &dis) {
    int N = G.size();
    dis.resize(N, INF);
    priority_queue<P, vector<P>, greater<P>> pq;  // 「仮の最短距離, 頂点」が小さい順に並ぶ
    dis[s] = 0;
    pq.emplace(dis[s], s);
    while (!pq.empty()) {
        P p = pq.top();
        pq.pop();
        int v = p.second;
        if (dis[v] < p.first) {  // 最短距離で無ければ無視
            continue;
        }
        for (auto &e : G[v]) {
            if (dis[e.to] > dis[v] + e.cost) {  // 最短距離候補なら priority_queue に追加
                dis[e.to] = dis[v] + e.cost;
                pq.emplace(dis[e.to], e.to);
            }
        }
    }
}    
 
/* bellman_ford(Es,s,t,dis)
    入力: 全ての辺Es, 頂点数V, 開始点 s, 最短経路を記録するdis
    出力: 負の閉路が存在するなら ture
    計算量：O(|E||V|)
    副作用：dis が書き換えられる
*/
bool bellman_ford(const Edges &Es, int V, int s, vector<long long> &dis) {
    dis.resize(V, INF);
    dis[s] = 0;
    int cnt = 0;
    while (cnt < V) {
        bool end = true;
        for (auto e : Es) {
            if (dis[e.from] != INF && dis[e.from] + e.cost < dis[e.to]) {
                dis[e.to] = dis[e.from] + e.cost;
                end = false;
            }
        }
        if (end) break;
        cnt++;
    }
    return (cnt == V);
}


int main() {
    ll n;
    cin >> n;
    string ans = "";
    while(n) {
        n--;
        ans += 'a' + n%26;
        n /= 26;
    }
    reverse(ans.begin(),ans.end());
    cout << ans << endl;
}


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

using namespace std;

int main(int argc, char* argv[]) {
  string s;
  cin >> s;

  string t = "keyence";

  // check removing last
  if (s.substr(0, t.size()) == t) {
    cout << "YES" << endl;
    return 0;
  }

  // check removing head
  if (s.substr(s.size() - t.size()) == t) {
    cout << "YES" << endl;
    return 0;
  }


  // check removing intermeditate
  if (s[0] != 'k') {
    cout << "NO" << endl;
    return 0;
  }

  // forward until diff
  int pivot = 1;
  int cursor = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == t[pivot])
      ++pivot;
    else {
      cursor = i;
      break;
    }
  }
  int rest_length = t.size() - pivot;
  if (s.substr(s.size() - rest_length) == t.substr(pivot)) {
    cout << "YES" << endl;
    return 0;
  }

  cout << "NO" << endl;

  return 0;
}

Measured memory_bytes: 256
N, A, B = map(int, input().split())

num = [i for i in range(1,N+1)]
li = [sum(list(map(int, str(i)))) for i in range(1,N+1)]

result = 0
for i, j in zip(num, li):
    result += i if (j>=A and j <= B) else 0
print(result)

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

class RangeAddTree{
public:
  // data[i] := orig[i] - orig[i - 1], data[0] := orig[0].
  // orig[i] = data[0] + ... + data[i].
  vector<long long> data;
  int size;
  int height; // the number of edges between the root and leaves
  long long sum_util(int bidx, int eidx, int data_idx, int dbi, int dei){
    if((bidx <= dbi) && (dei <= eidx)){
      return data[data_idx];
    }
 
    if((eidx <= dbi) || (dei <= bidx)){
      return 0;
    }
 
    int dmi = (dbi + dei) / 2;
    return sum_util(bidx, eidx, 2 * data_idx + 1, dbi, dmi) +
      sum_util(bidx, eidx, 2 * data_idx + 2, dmi, dei);
  }
  void add_util(int idx, long long val){
    int data_idx = (1 << height) - 1 + idx;
    while(data_idx > 0){
      data[data_idx] += val;
      data_idx = (data_idx - 1) / 2;
    }
    data[0] += val;
  }

  RangeAddTree(int size){
    this->size = size;
    for(height = 0; (1 << height) < size; height++){
    }
    data = vector<long long>((1 << (height + 1)) - 1);
  }
  long long at(int idx){
    return sum_util(0, idx + 1, 0, 0, 1 << height);
  }
  void add_range(int begin, int end, long long val){
    add_util(begin, val);
    add_util(end, -val);
  }
};

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

  // char_cnt_sum[c][0] := 0
  // char_cnt_sum[c][i] := in S[0, i), char c appears _ times.
  vector<RangeAddTree> char_cnt_sum(26, RangeAddTree(S.length() + 2));
  for(int i = 0; i < S.length(); i++){
    char_cnt_sum[S[i] - 'a'].add_range(i + 1, S.length() + 1, 1);
  }

  int Q;
  cin >> Q;
  for(int q = 0; q < Q; q++){
    int query_type;
    cin >> query_type;
    if(query_type == 1){
      int i;
      char c;
      cin >> i >> c;
      i--;
      char_cnt_sum[S[i] - 'a'].add_range(i + 1, S.length() + 1, -1);
      char_cnt_sum[c - 'a'].add_range(i + 1, S.length() + 1, 1);
      S[i] = c;
    }else{ // query_type == 2
      int l, r;
      cin >> l >> r;
      l--; // [l, r)
      int ans = 0;
      //cout << "***" << q << ' ' << endl;
      for(int i = 0; i < 26; i++){
        //cout << char(i + 'a') << ' ' << char_cnt_sum[i].at(l) << ' ' << char_cnt_sum[i].at(r) << endl;
        if(char_cnt_sum[i].at(r) != char_cnt_sum[i].at(l)){
          ans++;
        }
      }
      cout << ans << endl;
    }
  }
}



Measured memory_bytes: 222200
N=int(input())
H=list(map(int,input().split()))
dp = [10**6]*N
dp[0]=0
dp[1]=abs(H[1]-H[0])
for i in range(2,N):
    dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
print(dp[-1])

Measured memory_bytes: 13924
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; ++i)
typedef long long ll;
using namespace std;
const int INF = 1e9;

int main() {
    int n;
    cin >> n;
    map<string, int> mp;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }

    string t[] = {"AC", "WA", "TLE", "RE"};
    rep(i, 4) {
        cout << t[i] << " x " << mp[t[i]] << endl;
    }

    return 0;
}

Measured memory_bytes: 3636
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
#define rep(i,n) for(int i=0;i<n;i++)
#define repl(i,s,e) for(int i=s;i<e;i++)
#define reple(i,s,e) for(int i=s;i<=e;i++)
#define revrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()

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; }

void rec(int d, ll val, vector<ll>& v)
{
	v.push_back(val);

	if (d == 10) return;

	for (int i = -1; i <= 1; i++)
	{
		int next = (val % 10) + i;

		if (next >= 0 && next <= 9) rec(d + 1, 10 * val + next, v);
	}
}

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

	vector<ll> v;

	reple(i, 1, 9) rec(1, i, v);

	sort(all(v));

	cout << v[K - 1] << endl;

	return 0;
}

Measured memory_bytes: 2420
import collections

N = int(input())
A = list(map(int,input().split()))

A_count = collections.Counter(A)

mod = 10**9+7
if N%2 == 1:
    for i in range(0,N,2):
        if (i == 0) and (A_count[i]==1):
            ans = 1
        elif (i!=0) and (A_count[i]==2):
            ans = (ans * 2) % mod
        else:
            ans = 0
            break
else:
    for i in range(1,N,2):
        if (i == 1) and (A_count[i]==2):
            ans = 2
        elif (i!=1) and (A_count[i]==2):
            ans = (ans * 2) % mod
        else:
            ans = 0
            break
print(ans)

Measured memory_bytes: 93384
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left != NIL){
    x = x->left;
  }
  return x;

}

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
    if(k < u->key){
      u = u->left;
    }
    else u = u->right;
  }
  /*if(u == NIL) printf("no\n");
    else printf("yes\n");*/
  return u;

}

Node treeSuccessor(Node x){
  if(x->right != NIL){
    return treeMinimum(x->right);
  }
  Node y = x->parent;
  while(y != NIL && x == y->right){
    x = y;
    y = y->parent;
  }
  return y;

}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left == NIL){
    Transplant(z,z->right);
  }
  else if(z->right == NIL){
    Transplant(z,z->left);
  }
  else{
    y = treeMinimum(z->right);
    if(y->parent != z){
      Transplant(y,y->right);
      y->right = z->right;
      y->right->parent =y;
    }
    Transplant(z,y);
    y->left = z->left;
    y->left->parent = y;
  }


}

void Transplant(Node u, Node v){
  if(u->parent == NIL){
    root = v;
  }
  else if(u == u->parent->left){
    u->parent->left = v;
  }
  else u->parent->right = v;
  if(v != NIL){
    v->parent = u->parent;
  }

}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x; // set parent
    if(z->key < x->key){
      x = x->left; // shift to left child
    }
    else{
      x = x->right; // shift to right child
    }
  }
  z->parent = y;

  if(y == NIL){
    root = z; // Tree is empty
  }
  else if(z->key < y->key){
    y->left = z; 
  }
  else{
    y->right = z;
  }

}

void inorder(Node u){
  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }

}
void preorder(Node u){
  if(u != NIL){
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }

}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

Measured memory_bytes: 19360
S = input()
targets = ['dream', 'dreamer', 'erase', 'eraser']

i = len(S)
while True:
    if i == 0:
        print('YES')
        exit()
    for tg in targets:
        if S[i - len(tg):i][::-1] == tg[::-1]:
            i -= len(tg)
            break
    else:
        print('NO')
        exit()


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

using i64 = int64_t;

struct Crop{
    string name;
    double efficiency;
    bool operator<(const Crop &obj)const{
        if(efficiency == obj.efficiency)return name > obj.name;
        return efficiency < obj.efficiency;
    }
};

int main(){
    int n;
    while(cin >> n, n != 0){
        vector<Crop> v;
        for(int i=0;i<n;++i){
            string l;
            int p, a, b, c, d, e, f, s, m;
            cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
            int leaf = a + b + c, seed = d + e;
            int earnings = f*m*s - p;
            double tm = leaf + seed * m;
            double efficiency = earnings / tm;
            v.push_back((Crop){l, efficiency});
        }
        sort(v.rbegin(), v.rend());
        for(auto e: v){
            cout << e.name << endl;
        }
        cout << '#' << endl;
    }

    return 0;
}



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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

template<class T,class U>bool chmax(T &a, const U &b){if(a<b){a=b;return 1;}return 0;}
template<class T,class U>bool chmin(T &a, const U &b){if(b<a){a=b;return 1;}return 0;}

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=LINF,sum=0;

    int n,m;
    cin>>n;
    vector<int> a(n);

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

    bool same=true;
    rep(i,n-1)if(a[i+1]!=a[i])same=false;
    if(same){cout<<0<<endl;return 0;}

    for(int i=-100;i<=100;++i){
        int y=i;
        int tmp=0;

        rep(j,n)tmp+=(a[j]-y)*(a[j]-y);
        chmin(ans,tmp);
    }

    cout<<ans<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


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

int a[2005];
int n,cnt;

int main(void)
{
	cin>>n;
	for (int i=0; i<n; i++)
		cin>>a[i];
	sort(a,a+n);
	for (int i=2; i<n; i++)
	{
		int l=0;
		int r=i-1;
		int c=a[i];
		while (l<r)
		{
			if (a[l]+a[r]<=c)
				l++;
			else
			{
				cnt+=r-l;
				r--;
			}
		}
	}
	cout<<cnt;
	return 0;
}

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

int main(){
	int n,S;
	while(cin >> n>>S&&(n||S)){
		int w[101]={};
		int ans = 0;	
		for(int i = 0 ; i < n ; i++){ int a; cin >> a;  for(int j = 0 ; j <= 100 ; j++) if(a+j>S)ans+=w[j]; w[a]++;}
		cout << ans << endl;
	}
}

Measured memory_bytes: 868
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(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-'0'+c,c=getchar(); x*=f;
}
const int N=1e6+10,mod=998244353;
inline void Add(int &x,int y) { x+=y; if(x>=mod) x-=mod; }
inline void Dec(int &x,int y) { x-=y; if(x<0) x+=mod; }
int Pow(int x,int y) {
	int res=1;
	while(y) {
		if(y&1) res=res*(ll)x%mod;
		x=x*(ll)x%mod,y>>=1;
	}
	return res;
}
int a[N],b[N],c[N],e[N],m,n;
int main() {
	rd(m);
	for(int x,i=1;i<=m;++i) {
		rd(x);
		a[x]++,n=max(n,x);
	}
	for(int d=1;d<=n;++d) {
		for(int i=d;i<=n;i+=d) if(a[i]) {
			Add(b[d],a[i]*(ll)i%mod);
			Add(c[d],a[i]*(ll)i%mod*i%mod);
		}
		e[d]=((b[d]*(ll)b[d]-c[d])%mod+mod)%mod;
	}
	int ans=0;
	for(int i=n;i>=1;--i) {
		for(int j=i*2;j<=n;j+=i)
			Dec(e[i],e[j]);
		ans=(ans+e[i]*(ll)Pow(i,mod-2))%mod;
	}
	ans=ans*(ll)Pow(2,mod-2)%mod;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <vector>

using namespace std;
const int X = 1000;
const int Y = 10;
bool g[Y][X][Y][X];

struct State {
    int x;
    int y;
    int dir;
};
int dirx[] = {1, 0, -1, 0};
int diry[] = {0, 1, 0, -1};
string ans = "";

vector<int> inputLine() {
    string s;
    vector<int> a;
    cin >> s;
    for(char c : s) {
        a.push_back(c - '0');
    }
    return a;
}

string toString(int dir) {
    switch(dir) {
    case 0:
        return "R";
    case 1:
        return "D";
    case 2:
        return "L";
    case 3:
        return "U";
    }
}

struct State at(struct State st) {
    for(int i=0;i<4;i++) {
        int ndir = (st.dir + i) % 4;
        int nx = st.x + dirx[ndir];
        int ny = st.y + diry[ndir];
        if(0 <= nx && 0 <= ny && g[st.y][st.x][ny][nx]) {
            // printf("nx: %d, ny: %d, ndir: %d\n", nx, ny, ndir);
            ans += toString(ndir);
            int nndir = (ndir+3)%4;
            int nnx = nx + dirx[nndir];
            int nny = ny + diry[nndir];
            if(0 <= nnx && 0 <= nny && g[ny][nx][nny][nnx]) {
                // print("dirx: %d, diry: %d\n", dirx[ndir
                // printf("nnx: %d, nny: %d, nndir: %d\n", nnx, nny, nndir);
                return (State){nx, ny, nndir};
            }else {
                return (State){nx, ny, ndir};
            }
        }
    }
}

int main() {
    vector<vector<int>> a;
    for(int i=0;i<9;i++) {
        a.push_back(inputLine());
    }
    for(int i=0;i<Y;i++) {
        for(int j=0;j<X;j++) {
            for(int k=0;i<Y;i++) {
                for(int l=0;j<X;j++) {
                    g[i][j][k][l] = false;
                }
            }
        }
    }
    for(int i=0;i<4;i++) {
        for(int j=0;j<a[0].size();j++) {
            if(a[2*i][j] == 1) {
                g[i][j][i][j+1] = true;
                g[i][j+1][i][j] = true;
            }
        }
        for(int j=0;j<a[1].size();j++) {
            if(a[2*i+1][j] == 1) {
                g[i][j][i+1][j] = true;
                g[i+1][j][i][j] = true;
            }
        }
    }
    for(int j=0;j<a[0].size();j++) {
        if(a[8][j] == 1) {
            g[4][j][4][j+1] = true;
            g[4][j+1][4][j] = true;
        }
    }
    auto st = at((State){0, 0, 0});
    while(st.x != 0 || st.y != 0) {
        // printf("x: %d, y: %d, dir: %d\n", st.x, st.y, st.dir);
        st = at(st);
        // cout << st.dir << endl;
    }
    // printf("x: %d, y: %d, dir: %d\n", st.x, st.y, st.dir);
    cout << ans << endl;
}

Measured memory_bytes: 7276
#include <bits/stdc++.h>
#define repl(i, l, r) for (ll i = l; i < r; i++)
#define rep(i, n) repl(i, 0, n)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int, int>;

int main()
{
    ll a, b, c, k;
    cin >> a >> b >> c >> k;
    if(k % 2 == 0) cout << a - b << endl;
    else cout << b - a << endl;
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.util.*
import kotlin.math.abs
import kotlin.math.max
import kotlin.math.min
import kotlin.math.sqrt

val MOD = 1_000_000_007L

class Solver(stream: InputStream, private val out: java.io.PrintWriter) {
  fun solve() {
    val A = nl()
    val B = nl()
    out.println(A * B)
  }













































  private val isDebug = try {
    // なんか本番でエラーでる
    System.getenv("MY_DEBUG") != null
  } catch (t: Throwable) {
    false
  }

  private var tokenizer: StringTokenizer? = null
  private val reader = BufferedReader(InputStreamReader(stream), 32768)
  private fun next(): String {
    while (tokenizer == null || !tokenizer!!.hasMoreTokens()) {
      tokenizer = StringTokenizer(reader.readLine())
    }
    return tokenizer!!.nextToken()
  }

  private fun ni() = next().toInt()
  private fun nl() = next().toLong()
  private fun ns() = next()
  private fun na(n: Int, offset: Int = 0): IntArray {
    return map(n) { ni() + offset }
  }
  private fun nal(n: Int, offset: Int = 0): LongArray {
    val res = LongArray(n)
    for (i in 0 until n) {
      res[i] = nl() + offset
    }
    return res
  }

  private fun na2(n: Int, offset: Int = 0): Array<IntArray> {
    val a  = Array(2){IntArray(n)}
    for (i in 0 until n) {
      for (e in a) {
        e[i] = ni() + offset
      }
    }
    return a
  }

  private inline fun map(n: Int, f: (Int) -> Int): IntArray {
    val res = IntArray(n)
    for (i in 0 until n) {
      res[i] = f(i)
    }
    return res
  }

  private inline fun debug(msg: () -> String) {
    if (isDebug) System.err.println(msg())
  }

  private fun debug(a: LongArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: IntArray) {
    debug { a.joinToString(" ") }
  }

  private fun debug(a: BooleanArray) {
    debug { a.map { if (it) 1 else 0 }.joinToString("") }
  }

  private fun debugDim(A: Array<LongArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }
  private fun debugDim(A: Array<IntArray>) {
    if (isDebug) {
      for (a in A) {
        debug(a)
      }
    }
  }

  /**
   * 勝手にimport消されるのを防ぎたい
   */
  private fun hoge() {
    min(1, 2)
    max(1, 2)
    abs(-10)
  }
}

fun main() {
  val out = java.io.PrintWriter(System.out)
  Solver(System.`in`, out).solve()
  out.flush()
}

Measured memory_bytes: 34672
import java.io.*
import java.util.*
import java.lang.*
import java.lang.Math.*


fun solve() {
    val (N, K, S) = rd.readIntArray()

    val NONE = if (S == 1_000_000_000) 999_999_999
                   else 1_000_000_000

    val A = IntArray(N){NONE}
    for (i in 0 until K) {
        A[i] = S
    }

    println(A.joinToString(" "))
}


//val rd = debug.Reader("etc", "keyence2020", "c", "sample-1")
val rd = Reader()


fun main(args: Array<String>) {
    try {
        var exception: Throwable? = null
        val sth = Thread(null, SolveThread(), "solveThread", 128 * 1024 * 1024)
        sth.setUncaughtExceptionHandler { _, e -> exception = e }
        sth.start(); sth.join()
        if (exception != null) throw exception!! }
    catch (e: Exception) { throw e }
    finally { rd.close() }
}
const val MOD = 1_000_000_007L; const val INF = Int.MAX_VALUE/2; const val LINF = Long.MAX_VALUE/2
const val EPS = 1e-9; fun DBLEQ(a: Double, b: Double): Boolean {return abs(a - b) < EPS}
data class IntPair(val first: Int, val second: Int)
data class To(val idx: Int, val cost: Long)
typealias ALI = ArrayList<Int>
fun <T>edge(V: Int): Array<ArrayList<T>> { return Array(V){ArrayList<T>()} }
val errPrintln: (Any) -> Unit = { msg -> System.err.println(msg) }
fun rAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("EAssert Error: $msg"); throw Error(msg) }
}
fun tAssert(exp: Boolean, lazyMsg: () -> String = {""}) {
    if (!exp) { val msg = lazyMsg(); errPrintln("TAssert Error: $msg"); Thread.sleep(3000) }
}
class SolveThread : Runnable {
    override fun run() { solve() }
}
class Reader {
    private val br = BufferedReader(InputStreamReader(System.`in`))
    val readString: () -> String = { br.readLine() }
    val readInt: () -> Int = { br.readLine().toInt() }
    val readLong: () -> Long = { br.readLine().toLong() }
    val readIntArray: () -> IntArray = { br.readLine().split(' ').map { it.toInt() }.toIntArray() }
    val readLongArray: () -> LongArray = { br.readLine().split(' ').map { it.toLong() }.toLongArray() }
    val readListInt: () -> List<Int> = { br.readLine().split(' ').map { it.toInt() } }
    val readListLong: () -> List<Long> = { br.readLine().split(' ').map { it.toLong() } }
    val readListIntCol: (Int) -> List<Int> = { N -> (0 until N).map { readInt() } }
    val readListLongCol: (Int) -> List<Long> = { N -> (0 until N).map { readLong() } }
    val close: () -> Unit = { br.close() }
    protected fun finalize() { close() }
}


Measured memory_bytes: 50344
#include<iostream>
#include<algorithm>
using namespace std;
int n, i;
int v[100005];
int main(){
    cin>> n;
    for(i = 1; i <= n; i++){
        cin>> v[i];
    }
    sort(v + 1, v + n + 1);
    cout<< v[n / 2 + 1] - v[n / 2];
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;


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

	int A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;

	if (A == B)
	{
		cout << "YES" << endl;
	}
	else if (A < B)
	{
		if (B + W * T <= A + V * T)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}
	else
	{
		if (A - V * T <= B - W * T)
		{
			cout << "YES" << endl;
		}
		else
		{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  string s;
  int n, k;
  cin >> n >> k;
  cin >> s;
  s[k - 1] += 'a' - 'A';
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int a, b, cake[16];
	cin>>a;
	cin>>b;
	if((a+b)>16)
		cout<<":("<<endl;
	if(a>8||b>8){
		cout<<":("<<endl;
	}
	
	else{
		cout<<"Yay!"<<endl;
	}


return 0;
}

Measured memory_bytes: 384
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N, M = map(int, input().split())

AB = [list(map(int, input().split())) for _ in range(M)]
AB.sort()

q = []
for ab in AB:
    heapq.heappush(q, ab)

ans = 0
cnt = M
visited = -1
while cnt > 0:
    ab = heapq.heappop(q)
    cnt -= 1

    # print(ab, visited, cnt)

    if ab[1] > ab[0]:
        heapq.heappush(q, [ab[1], ab[0]])
        cnt += 1
    else:
        if visited <= ab[1]:
            visited = ab[0]
            ans += 1
        else:
            pass

print(ans)

Measured memory_bytes: 32824
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
const int INF = 1001001001;

int main(){
  int n;
  cin >> n;
  vector<ll> A(n);
  rep(i,n) cin >> A[i];
  sort(A.begin(),A.end());
  rep(i,n-1){
    if(A[i]!=A[i+1])continue;
    cout << "NO" <<endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=0x3f3f3f3f3f3f3f3f;

int n,m;
ll d[105][105];
bool v[105][105];

int main() {
	cin>>n>>m;
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) 
		if (i==j) {
			d[i][j]=0;
			v[i][j]=1;
		}
		else d[i][j]=INF;
	for (int i=0;i<m;i++) {
		int s,t,l; cin>>s>>t>>l;
		d[s][t]=l;
		v[s][t]=1;
	}
	for (int k=0;k<n;k++)
	  for (int i=0;i<n;i++)
	  for (int j=0;j<n;j++)
	    if (v[i][k] && v[k][j]) {
	    	d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	    	v[i][j]=1;
	    }
	for (int i=0;i<n;i++) 
		if (d[i][i]<0) {
			cout<<"NEGATIVE CYCLE"<<'\n';
			return 0;
		}
	for (int i=0;i<n;i++) for (int j=0;j<n;j++) {
		if (d[i][j]==INF) cout<<"INF";
		else cout<<d[i][j];
		cout<<" \n"[j+1==n];
	}
}


Measured memory_bytes: 3180
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> d_people(N);

    for(int i=0; i<N; i++){
        cin >> d_people[i];
    }
    int ans=1;
    sort(d_people.begin(), d_people.end());
    if(N%2==0){
        for(int i=0; i<N/2; i++){
            if(d_people[i*2]!=d_people[i*2+1] || d_people[i*2]!=i*2+1){
                ans=0;
            }
        }
    }else{
        if(d_people[0]!=0){
            ans=0;
        }else{
            for(int i=0; i<N/2; i++){
                if(d_people[i*2+1]!=d_people[i*2+2] || d_people[i*2+1]!=i*2+2){
                    ans=0;
                }
            }
        }
    }
    int mod=1000000007;
    for(int i=0; i<N/2; i++){
        ans*=2;
        ans%=mod;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 640
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		long n = long.Parse(Console.ReadLine());
    long h = long.Parse(Console.ReadLine());
    long w = long.Parse(Console.ReadLine());
		
		long answer = (n-h+1) * (n-w+1);
		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 13140
import java.io.*;
import java.util.*;
 
/**
 * Only By Abhi_Valani
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Unstoppable solver = new Unstoppable();
	//	int t=in.nextInt();
	//	while(t-->0)
        solver.solve(in, out);
        out.close();
    }
 
    static class Unstoppable {
        public void solve(InputReader in, PrintWriter out) {
          //from here...
		  //int[] a = readArray(in, n);
		  int n=in.nextInt();
		  int a[]=new int[n];
		  for(int i=0;i<n;i++)
		       a[i]=in.nextInt();
		       int sum=0;
		       for(int i=0;i<n-1;i++){
		           
		      for(int j=i+1;j<n;j++)
		      {
		        int  mul=a[i]*a[j];
		          sum+=mul;
		      }
		  }
		 
		 out.println(sum);
        }
 
    }
 
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;
 
        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
 
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }
 
        public int nextInt() {
            return Integer.parseInt(next());
        }
 
    }
}
 

Measured memory_bytes: 21460
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int r,g,b;
	cin>>r>>g>>b;
	int ans = r*100+g*10+b;
	if (ans%4==0)
	{
		printf("YES");
	}
	else {
		printf("NO");
	}
	return 0;
}

Measured memory_bytes: 256