akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;
int a[1010];

string changes(int num) {
	stringstream ss;
	ss << num;
	return ss.str();
}

bool ok(string s) {
	if (s.size() == 1)return true;
	rep(i, s.size() - 1) {
		if (s[i + 1] - s[i] != 1)return false;
	}
	return true;
}

int main() {
	cin >> n;
	rep(i, n)cin >> a[i];
	int ans = -1;
	rep(i, n) {
		FOR(j, i + 1, n) {
			string s = changes(a[i] * a[j]);
			if (ok(s))ans = max(ans, a[i] * a[j]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3208
using System;

namespace AOJ.Volume3
{
    public class RectangleMade
    {
        public static int Main()
        {
            var input = Console.ReadLine().Split(' ');
            var len = new int[12];
            for(int i = 0; i < 12; i++) { len[i] = int.Parse(input[i]); }
            Array.Sort(len);

            bool success = true;
            for (int i = 0; i <= 8; i = i + 4)
            {
                if (len[i] == len[i + 1] &&
                    len[i] == len[i + 2] &&
                    len[i] == len[i + 3]) { continue; }
                else
                {
                    success = false;
                    break;
                }
            }
            Console.WriteLine(success ? "yes" : "no");

            return 0;
        }
    }
}

Measured memory_bytes: 9132
/**
 *    author:  Mohamad Milhem
**/

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

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)
vector<int> adj[200005];
int sz;
bool visited[200005];


void dfs(int v){
	visited[v] = true;
	sz++;

	for (int i : adj[v]){
		if (visited[i] == false){
			dfs(i);
		}
	}

}

void solve(){
	int n, m;
	cin >> n >> m;

	for (int i = 0 ; i < m ; i++){
		int v,u;
		cin >> v >> u;
		adj[v].push_back(u);
		adj[u].push_back(v);
	}

	int maxx = 0;

	for (int i = 1 ; i <= n ; i++){
		sz = 0;
		if (visited[i] == false	)dfs(i);
		maxx = max(maxx , sz);
	}

	cout << maxx << endl;


}



int main()
{
    FAST;
    int t;
    t = 1;

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


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

using ll=long long;
using vll=vector<ll>;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
using vpii=vector<pii>;

const int MOD = 1e9+7;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    string s;
    cin >> n >> s;
    vi cnts(26);
    for (char c: s)
        ++cnts[c-'a'];

    vi mem(1<<26);
    mem[0] = 1;
    int sum = 0;
    for (unsigned mask=1; mask<(1<<26); ++mask) {
        int i=__builtin_ctz(mask);
        unsigned mc = mask ^ (1<<i);
        ll prod=mem[mc];
        prod = prod * ll(cnts[i]) % MOD;
        mem[mask] = prod;
        sum = (sum + prod) % MOD;
    }
    cout << sum % MOD << "\n";
}


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

int main() {
    string s;
    cin >> s;
    vector<int> v(s.size(), 0);
    int r = 0, l = 0;
    for (int i = 0; i < s.size(); i++) {
        int idx = i;
        while (i + 1 < s.size() && s[i] == s[i + 1]) i++;
        int len = i - idx + 1;
        if (s[i] == 'L') {
            v[idx] += (len + 1) / 2;
            v[idx - 1] += len / 2;
        } else {
            v[i] += (len + 1) / 2;
            v[i + 1] += len / 2;
        }
    }
    for(int i = 0; i < s.size(); i++){
        cout << v[i] << " \n"[i == s.size() - 1];
    }
    return 0;
}



Measured memory_bytes: 1024
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
	int A, B;
	cin >> A >> B;

	if (A < 10 && B < 10) {
		cout << A * B << endl;
	}
	else {
		cout << -1 << endl;
	}
	
}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

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

    ld ave = 0;

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

    ave /= (ld)n;

    ld best = 1e9;
    int ans = 0;

    for(int i = 0; i < n; i++){
        ld diff = abs(ave - (ld)a[i]);
        if(diff < best){
            best = diff;
            ans = i;
        }
    }

    cout << ans << endl;


}

Measured memory_bytes: 256
use std::io::{self, BufRead};

fn main() {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let n: i32 = lines.next().unwrap().unwrap().parse().unwrap();

    let mut digit: Vec<Vec<i64>> = vec![vec![0; 10]; 10];
    for i in 1..n + 1 {
        let begin: usize = i.to_string().chars().next().unwrap().to_digit(10).unwrap() as usize;
        let end: usize = (i % 10) as usize;
        if end == 0 {
            continue;
        }
        digit[begin][end] += 1;
    }

    let mut ans = 0;
    for i in 1..10 {
        for j in 1..10 {
            ans += digit[i][j] * digit[j][i];
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; ll k; cin >> n >> k;
  vector<ll> A(n); rep(i, n) cin >> A[i];
  vector<ll> cnt(n);
  rep(i, n) REP(j, i+1, n) if(A[i]>A[j]) cnt[i]++;
  map<ll, ll> mp;
  mp[0] = 0;
  rep(i, n) mp[A[i]]++;
  ll prev = 0;
  for(auto& ele: mp) {
    ele.second += prev;
    prev = ele.second;
  }
  ll ans = 0;
  rep(i, n) {
    (ans += cnt[i]*k%mod + (k-1)*k/2%mod*(--mp.upper_bound(A[i]-1))->second%mod) %= mod;
  }
  cout << ans << "\n";
  return 0;
}


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

void swap (int *a, int *b) {
  int x;
  x = *a;
  *a = *b;
  *b = x;
  return;
}

int main (int argc, char **argv) {
  int n[3];
  cin >> n[0] >> n[1] >> n[2];

  // sort
  if (n[0] > n[1]) swap(&(n[0]), &(n[1]));
  if (n[1] > n[2]) swap(&(n[1]), &(n[2]));
  if (n[0] > n[1]) swap(&(n[0]), &(n[1]));

  cout << n[0] << " " << n[1] << " " << n[2] << endl;
}

Measured memory_bytes: 1164
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<math.h>
#include<ctype.h>

typedef long long ll;

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

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

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

ll min(ll a, ll b) { return (a < b) ? a : b; }

ll asc(const void* a, const void* b) { return *(ll*)a - *(ll*)b; }

ll dsc(const void* a, const void* b) { return *(ll*)b - *(ll*)a; }

bool flag;

int main() {
	char s[201];
	scanf("%s", s);
	for (int i=strlen(s)-2; i; i-=2) {
		if (strncmp(s, s + i / 2, i / 2) == 0){printf("%d", i); return 0;}
	}

	return 0;
}

Measured memory_bytes: 2216
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
#define pb push_back;
#define sz(v) ((int)(v).size())
#define ll long long;
int main()
{
    int n,k;
    cin>>n>>k;
    int a[n];
    int x=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int u;
    for(int i=0;i<n-1;i++)
    {
        if(a[i]>=a[i+1])
        {
                u=a[i+1];
        }
        else
        {
                u=a[i];
        }
    }
    for(int i=0;i<n;i++)
    {
        if(a[i]==u)
        {
                x++;
        }
    }
    cout<<((n-x)+(k-1)-1)/(k-1)<<endl;
    //system("pause");
    return 0;
}
    

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
#include <ctime>
using namespace std;
typedef long long int ll;

int main(){
	int a,b,k; cin >> a >> b >> k;
	for(int i=0;i<k;i++){
		if(i%2==0)b+=a/2,a/=2;
		else a+=b/2,b/=2;
	}
	cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define DAU  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define PLEC exit(0);
using namespace std;
#define int long long
int x;
string s;
int32_t main() {
    DAU
    cin >> x;
    while (x) {
      	--x;
     	s += char(x % 26 + 'a');
        x /= 26;
    }
    reverse(s.begin(), s.end());
    cout << s;
    PLEC
}

Measured memory_bytes: 3688
N = int(input())

table = [[0] * 10 for _ in range(10)]

for i in range(1, N+1):
    head = int(str(i)[0])
    tail = int(str(i)[-1])
    table[head][tail] += 1

ans = 0
for i in range(10):
    for j in range(10):
        ans += table[i][j] * table[j][i]
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <utility>
#include <tuple>

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
using namespace std;
using ll = long long int;
using P = pair<ll, ll>;

// clang-format off
#ifdef _DEBUG_
#define dump(...) do{ cerr << __LINE__ << ":\t" << #__VA_ARGS__ << " = "; PPPPP(__VA_ARGS__); cerr << endl; } while(false)
template<typename T> void PPPPP(T t) { cerr << t; }
template<typename T, typename... S> void PPPPP(T t, S... s) { cerr << t << ", "; PPPPP(s...); }
#else
#define dump(...) do{ } while(false)
#endif
template<typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template<typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }
template<typename T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template<typename T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }
template<typename T> void print(T a) { cout << a << endl; }
template<typename T, typename... Ts> void print(T a, Ts... ts) { cout << a << ' '; print(ts...); }
template<typename T> istream &operator,(istream &in, T &t) { return in >> t; }
class Range {
    using T = long long;
    class Iterator {
        T val, step, diff;
    public:
        Iterator(T v, T s, T d): val(v), step(s), diff(d) {}
        T operator*() { return val + diff; }
        bool operator!=(const Iterator &itr) { return step > 0 ? val < itr.val : val > itr.val; }
        Iterator operator++() { val += step; return *this; }
    };
    Iterator _begin, _end;
public:
    Range(T b, T e, T s, T d): _begin(b, s, d), _end(e, s, d) {
        if (s < 0) { _begin = Iterator(e - 1, s, d); _end = Iterator(b - 1, s, d); }
    }
    Range(T b, T e, T s): Range(b, e, s, 0) {}
    Range(T b, T e): Range(b, e, 1, 0) {}
    Range(T e): Range(0, e, 1, 0) {}
    Iterator begin() { return _begin; }
    Iterator end() { return _end; }
};
// clang-format on

#include <map>

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin, n;
    map<ll, ll> m;
    ll ans = 0;
    for (ll i : Range(n)) {
        ll t;
        cin, t;
        ans += m[i - t];
        m[t + i]++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 26352
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <numeric>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;

typedef pair<long long, string> pls;


#define ll long long




/*
class UnionFind {
public:
	vector <ll> par; 
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i; 
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e,H, W,Q;
long long A[200000]= {};
long long B[200005] = {};
long long C[20][200] = {};
bool f;
bool ff;
string S[200];
set <long long>sll;
pl buf;
pls bufls;
vector <long long>vl;
vector <pl>vpl;
vector <pls>vpls;
vector <string> vs;

struct ST
{
	long long hajime;
	long long owari;
	long long zahyou;
	int bangou;

	bool operator<(const ST& another) const
	{
		return hajime < another.hajime;//年齢を比較
	};

};



vector <ST> vst;
ST st[200005];

int main() {

	cin >> N>>K;

	a = 0;

	for (int i = K + 1; i <= N; i++) {

		a += (N / i) * (i - K);
		a += max((N - i * (N / i)) - K+1, (ll)0);
		if (K == 0) {
			a--;
		}
	}
	cout << a << endl;

	return 0;

}


Measured memory_bytes: 2304
import java.io.*;

public class Main {
	public static void main(String args[]) {
		try {
			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			String t[], s;
			double x[] = new double[8];
			while((s = reader.readLine()) != null) {
				t = s.split(" ");
				for(int i = 0;i < 8;i++) {
					x[i] = Double.parseDouble(t[i]);
				}
				Point x1 = new Point(x[0], x[1]);
				Point x2 = new Point(x[2], x[3]);
				Point x3 = new Point(x[4], x[5]);
				Point z = new Point(x[6], x[7]);
				if(z.isLeft(x1, x2) && z.isLeft(x2, x3) && z.isLeft(x3, x1)
						|| z.isLeft(x1, x3) && z.isLeft(x3, x2) && z.isLeft(x2, x1)
						|| z.isLeft(x2, x1) && z.isLeft(x1, x3) && z.isLeft(x3, x2)
						|| z.isLeft(x2, x3) && z.isLeft(x3, x1) && z.isLeft(x1, x2)
						|| z.isLeft(x3, x1) && z.isLeft(x1, x2) && z.isLeft(x2, x3)
						|| z.isLeft(x3, x2) && z.isLeft(x2, x1) && z.isLeft(x1, x3))
					System.out.println("YES");
				else
					System.out.println("NO");
			}
		}
		catch(IOException e) {
			System.out.println(e);
		}
	}
}
class Point {
	double x, y;
	Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
	boolean isLeft(Point p, Point q) {
		double x1, x2, y1, y2, s;
		x1 = this.x-p.x;
		y1 = this.y-p.y;
		x2 = q.x-p.x;
		y2 = q.y-p.y;
		s = signedArea(x2, y2, x1, y1);
		return s>0.0;
	}
	double signedArea(double x1, double y1, double x2, double y2) {
		return x1 * y2 - x2 * y1;
	}
}

Measured memory_bytes: 17872
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
//#include <utility>
#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}]

const int MAX = 2000000 ;

//宣言するときはstaticをつけて静的変数にするかグローバル変数として宣言
//initのときに関数の種類を決定する（0:sum,1:min,2:max）
class SGT{
public :
	int n = 1;
	ll d ;
	ll num[MAX] ;
	int fan ;

//	指定された関数を実行する
	ll f(ll a,ll b){
		if(fan==0) return a+b ;
		else if(fan==1) return min(a,b) ;
		else if(fan==2) return max(a,b) ;
		else return d ;
	}

	void d_set(int b){
		fan = b ;
		if(fan==0) d = 0 ;
		else if(fan==1) d = INF ;
		else if(fan==2) d = -INF ;
	}

//	初期化する、bは関数の種類を指定する
	void init(vector<ll> &a,int b){
		d_set(b) ;
		while(a.size()>n) n *= 2 ;
		for(int i=0;i<n;i++){
			if(i<a.size()) num[n-1+i] = a.at(i) ;
			else num[n-1+i] = d ;
		}
		for(int i=n-2;i>=0;i--){
			num[i] = f(num[i*2+1],num[i*2+2]) ;
		}
	}

	void init(ll a,ll sz,int b){
		d_set(b) ;
		while(sz>n) n *= 2 ;
		for(int i=0;i<n;i++){
			if(i<sz) num[n-1+i] = a ;
			else num[n-1+i] = d ;
		}
		for(int i=n-2;i>=0;i--){
			num[i] = f(num[i*2+1],num[i*2+2]) ;
		}
	}

//	内容次第でwhile内の計算式を書き換える→書き換えなくて良くなった
	void update(int i,ll a){
		i += n-1 ;
		num[i] = a ;
		while(i>0){
			i = (i-1)/2 ;
			num[i] = f(num[i*2+1],num[i*2+2]) ;
		}
	}

//	最初に呼び出すときは[a,b)だけで十分
	ll query(int a,int b,int l=0,int r=-1,int now=0){
		if(r==-1) r = n ;
		if(r<=a||b<=l) return d ;
		if(a<=l&&r<=b) return num[now] ;
		ll r1 = query(a,b,l,(l+r)/2,now*2+1) ;
		ll r2 = query(a,b,(l+r)/2,r,now*2+2) ;
		return f(r1,r2) ;
	}
};

int main(){
	int n ; cin >> n ;
	int q ; cin >> q ;
	vector<int> a(n) ;
	for(auto &i:a) cin >> i ;
	vector<int> last(n+1,-1) ;
	static SGT sgt ;
	sgt.init(0,n,0) ;
	vector<pair<pair<int,int>,int>> que(q) ;
	for(int i=0;i<q;i++){
		int l,r ;
		cin >> l >> r ;
		l-- ; r-- ;
		que.at(i).first.first = r ;
		que.at(i).first.second = l ;
		que.at(i).second = i ;
	}
	vector<int> ans(q) ;
	sort(all(que)) ;
	int pos = -1 ;
	for(int i=0;i<q;i++){
		while(que.at(i).first.first!=pos){
			pos++ ;
			if(last.at(a.at(pos))!=-1) sgt.update(last.at(a.at(pos)),0) ;
			sgt.update(pos,1) ;
			last.at(a.at(pos)) = pos ;
		}
		ans.at(que.at(i).second) = sgt.query(que.at(i).first.second,que.at(i).first.first+1,0,sgt.n,0) ;
	}
	for(int i=0;i<q;i++) cout << ans.at(i) << endl ;
}


Measured memory_bytes: 23648
#python3
n=int(input())
h=[int(i) for i in input().split()]

def solve():
  h[0]-=1
  for i in range(1,n):
    if h[i] > h[i-1]:
      h[i]-=1
    elif h[i] == h[i-1]:
      pass
    else :
      return 0
  return 1
    

if solve():
  print('Yes')
else:
  print('No')


Measured memory_bytes: 14252
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

//#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

typedef long long LL; 
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int N;
    cin >> N;
    VI L(N);
    REP(i,N)
    {
        cin >> L[i];
    }

    sort(L.begin(), L.end());
    REP(i,N) dump(L[i])

    int maxl = L[N-1];
    int sum = 0;

    REP(i,N-1)
    {
        sum += L[i];
    }
    if(maxl < sum) cout << "Yes" << endl;
    else cout << "No" << endl;

}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.IntStream;

/**
 * 解説どおりに作成したソースコード
 */
public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt(), m = scanner.nextInt(), q = scanner.nextInt();
			int[][] x = new int[n][n], c = new int[n + 1][n + 1];
			IntStream.range(0, n).forEach(i -> Arrays.fill(x[i], 0));
			IntStream.range(0, m).forEach(i -> {
				int l = scanner.nextInt() - 1, r = scanner.nextInt() - 1;
				x[l][r]++;
			});
			Arrays.fill(c[0], 0);
			IntStream.rangeClosed(1, n).forEach(i -> c[i][0] = 0);
			IntStream.rangeClosed(1, n)
					.forEach(i -> IntStream.rangeClosed(1, n).forEach(j -> c[i][j] = c[i][j - 1] + x[i - 1][j - 1]));
			IntStream.range(0, q).forEach(i -> {
				int s = scanner.nextInt(), t = scanner.nextInt();
				System.out.println(IntStream.rangeClosed(s, t).map(j -> c[j][t] - c[j][s - 1]).sum());
			});
		}
	}
}


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

int A[200000];

int main(){
  int N;
  cin >> N;
  int first=1;
  int second=0;
  for(int i=0; i<N; i++){
    cin >> A[i];
    if(A[i]>first){
      second = first;
      first = A[i];
    }else if(A[i]>second){
      second = A[i];
    }
  }
  for(int i=0; i<N; i++){
    if(A[i]==first){
      cout << second << endl;
    }else{
      cout << first << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<bitset>
#include<cmath>
#include<queue>
#include<map>
#include<set>

using namespace std;

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

int n,ans;

inline int gcd(int a,int b);

int main()
{
	n=read();
	for(int i=1;i<=n;++i)
		for(int j=1;j<=n;++j)
			for(int k=1;k<=n;++k)
				ans+=gcd(i,gcd(j,k));
	printf("%d",ans);
	return 0;
}

inline int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

Measured memory_bytes: 3764
n = int(input())
p = list(map(int, input().split()))
temp = []

for i in range(n):
    # print(i, p[i])
    if p[i] == i+1:
        temp.append('y')
        continue

    temp.append(p[i])

a = []

idx = 1
while True:
    if idx > len(temp) - 1:
        break

    if temp[idx] == 'y' and temp[idx-1] == 'y':
        temp[idx-1] = 'x'
        temp[idx] = 'x'
        #del temp[idx]
        # del temp[idx-1]
        # temp.append('x')

    idx += 1


#print(a)
ans = temp.count('x')//2 + temp.count('y')
print(ans)


'''
9
1 2 4 9 5 8 7 3 6
'''


Measured memory_bytes: 58220
#include <iostream>
#include <limits>
#include <iomanip>
using namespace std;

class Point{
public:
    long double x;
	long double y;
	Point(long double x=0,long double y=0) :x(x),y(y){ }
	Point operator +(Point &p) {
		return Point(x + p.x, y + p.y);
	}
	Point operator-(Point &p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator *(long double a) {
		return Point(x*a, y*a);
	}
};

typedef struct {
	Point p1, p2;
}Line;

int main() {

    
	Line s;
	cin >> s.p1.x; cin >> s.p1.y; cin >> s.p2.x; cin >> s.p2.y;
	int q;
	cin >> q;
	for (int i = 0;i < q;i++) {
		Point p,q;
		cin >> p.x; cin >> p.y;
		 double prod = ((s.p2.x - s.p1.x)*(p.x - s.p1.x)) + ((s.p2.y - s.p1.y)*(p.y - s.p1.y));
		q.x = s.p1.x +(s.p2.x - s.p1.x)*(prod/((s.p1.x-s.p2.x)*(s.p1.x - s.p2.x)+ (s.p1.y - s.p2.y)*(s.p1.y - s.p2.y)));
		q.y = s.p1.y + (s.p2.y - s.p1.y)*(prod / ((s.p1.x - s.p2.x)*(s.p1.x - s.p2.x) + (s.p1.y - s.p2.y)*(s.p1.y - s.p2.y)));
		cout << fixed << setprecision(10)<< q.x << " " << q.y << endl;
	}

}

Measured memory_bytes: 3260
#include <iostream>
#include <string>
#include <algorithm> 
#include <cstdlib>
#include <map>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
#include <numeric>
#define ll long long
#define INF INT_MAX 
using namespace std;
int main(){
    int N,M;
    cin >> N >> M;
    pair<ll,ll> P[N];
    for(int i=0;i<N;i++){
        cin >> P[i].first >> P[i].second;
    }
    sort(P,P+N);
    ll ans=0,count=0;
    for(int i=0;i<N;i++){
        if(M>count){
            count=count+P[i].second;
            ans = ans + P[i].first*P[i].second;
            if(M<=count){
                ans = ans - P[i].first*(count-M);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){return "";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var t = next();
  var s = [];
  
  for(var i = 0; i < t.length; i++){
    switch(t[i]){
      case "p":
        s.unshift("q");
        break;
      case "q":
        s.unshift("p");
        break;
      case "b":
        s.unshift("d");
        break;
      case "d":
        s.unshift("b");
        break;
               }
  }
  s = myconv(s,0);
  if(s == t){
     myout("Yes");
  }else{
    myout("No");
  }
}


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

int main() {
  int N,count;
  cin >> N;
  count = 1;
  vector<int> h(N,0);
  for(int i=0;i<N;i++){
    cin >> h.at(i);
  }
  sort(h.begin(),h.end());
  reverse(h.begin(),h.end());
  for(int j=1;j<N;j++){
    if(h.at(j-1) > h.at(j)){
      count += 1;
    }
  }
  
  cout << count << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>

using namespace std;

long long MOD = 1000000007;

vector<int> primes(0);
void prime_number(int N){
    vector<int> tmp(N+1,1);
    tmp[0]=tmp[1]=0;
    for(int i=2; i<=N; i++){
        if(tmp[i]==1){
            primes.push_back(i);
        }
        for(long long j= (long long) i*i; j<=N; j+=i){
            tmp[j]=0;
        }
    }
}

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

    prime_number(1000000);
    for(int i=0; i<(int)primes.size(); i++){
        if(primes[i]>=X){
            cout << primes[i] << endl;
            break;
        }
    }
}

Measured memory_bytes: 4732
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;

int main() {

    // 頂点数と辺数
    int N, M; cin >> N >> M;    
    
    vector<int> a(M), b(M);
    for (int i = 0; i < M; i++) {
        cin >> a[i] >> b[i];
    }

    int ans = 0;
    for (int k = 0; k < M; k++) {
        
        // グラフ入力受取 (ここでは無向グラフを想定)
        Graph G(N);
        for (int i = 0; i < M; ++i) {
            if (i == k) continue;
            G[a[i]-1].push_back(b[i]-1);
            G[b[i]-1].push_back(a[i]-1);
        }

        // BFS のためのデータ構造
        vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
        queue<int> que;

        // 初期条件 (頂点 0 を初期ノードとする)
        dist[0] = 0;
        que.push(0); // 0 を橙色頂点にする

        // BFS 開始 (キューが空になるまで探索を行う)
        while (!que.empty()) {
            int v = que.front(); // キューから先頭頂点を取り出す
            que.pop();

            // v から辿れる頂点をすべて調べる
            for (int new_v : G[v]) {
                if (dist[new_v] != -1) continue; // すでに発見済みの頂点は探索しない

                // 新たな白色頂点 new_v について距離情報を更新してキューに追加する
                dist[new_v] = dist[v] + 1;
                que.push(new_v);
            }
        }

        // 結果出力 (各頂点の頂点 0 からの距離を見る)
        bool existNotVisit = false;
        for (int v = 0; v < N; ++v) {
            if (dist[v] == -1) {
                existNotVisit = true;
            }
        }
        if (existNotVisit) ans++;

    }

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
       Scanner s = new Scanner(System.in);
       long n = s.nextLong();
       int rem=0;
       String name = "";
       char c;
       while(n>0) {
           rem =(int) ((n-1) % 26);
           c = (char)('a'+rem);
           name+=c;
           n= (n-1) /26;
       }
       for(int i=name.length()-1;i>=0;i--) {
           System.out.print(name.charAt(i));
       }
   }
}


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

int main() {
    char s[11] = { 0 };
    char t[11] = { 0 };
    int p = 0;

    scanf("%s", s);

    for (int i = 0; i < strlen(s); i++) {
        if (s[i] == 'B') {
            if (p != 0) {
                p--;
            }
        } else {
            t[p++] = s[i];
        }
    }
    t[p] = '\0';
    printf("%s\n", t);
    return 0;
}

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

int main () {
    char S[101];
    scanf("%s", S);
    int len = strlen(S);
    for (int i = 0; i < len; i++) {
        if ((i + 1) % 2 == 0 && S[i] != 'R') {
            continue;
        } else if ((i + 1) % 2 == 1 && S[i] != 'L') {
            continue;
        } else {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");

    return 0;
}


Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using static System.Console;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        string s = ReadLine();
        string t = ReadLine();
        int[] charCountS = new int[26];
        for(int i = 0; i < s.Length; i++)
            charCountS[s[i] - 'a']++;
        int[] charCountT = new int[26];
        for (int i = 0; i < t.Length; i++)
            charCountT[t[i] - 'a']++;

        Array.Sort(charCountS);
        Array.Sort(charCountT);
        for(int i = 0; i < 26; i++)
            if(charCountS[i] != charCountT[i])
            {
                WriteLine("No");
                return;
            }

        WriteLine("Yes");

    }
}

Measured memory_bytes: 13140
N = int(input())
inputs = [int(i) for i in input().split()]

start = inputs[0]
flag = 0
ans = 1

for i in range(1, N):
    if flag == 0:
        if start < inputs[i]:
            flag = 1
        elif start > inputs[i]:
            flag = -1
    elif flag == 1:
        if start > inputs[i]:
            flag = 0
            ans += 1
    else:
        if start < inputs[i]:
            flag = 0
            ans += 1
    start = inputs[i]

print(ans)


Measured memory_bytes: 14252
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<vector>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const int N=1e5+5;
template<class T>inline void read(T &res)
{
char c;T flag=1;
while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;res=c-'0';
while((c=getchar())>='0'&&c<='9')res=res*10+c-'0';res*=flag;
}
int n;
int main(){	
	read(n);
	int ans=0,mi=INF,x;
	for(int i=1;i<=n;i++){
		read(x);
		if(x<mi)ans++,mi=x;
	}
	cout<<ans<<endl;
	return 0;
}


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

int main () {
    int a, b;
    cin >> a >> b;
    if (a - 2 * b <= 0) cout << 0 << endl;
    else cout << a - 2 * b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long n, long long m, long long d)
{
    double ans = 0;
    if (d == 0)
    {
        ans = (double)((double)n / (double)(n * n));
    }
    else
    {
        ans = (double)((double)(n - d) * 2 / (double)(n * n));
    }

    cout << fixed << setprecision(10) << ans * (m - 1) << endl;
}

int main()
{
    long long n;
    scanf("%lld", &n);
    long long m;
    scanf("%lld", &m);
    long long d;
    scanf("%lld", &d);
    solve(n, m, d);
    return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : ProjG.cpp
// Author      : Yong Kiat
// Version     :
// Copyright   : By Algotae.
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>

using namespace std;

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

	int weights[N];
	int values[N];
	for (int i = 0; i < N; i++) {
		cin >> weights[i] >> values[i];
	}

	int dp[100001];
	for (int i = 0; i < 100000; i++) {
		dp[i] = W + 1;
	}

	int res = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 100000 - values[i]; j >= 0; j--) {
			dp[j + values[i]] = min(dp[j + values[i]], dp[j] + weights[i]);

			if (dp[j] + weights[i] <= W) {
				dp[j + values[i]] = min(dp[j + values[i]], dp[j] + weights[i]);
				res = max(res, j + values[i]);
			}
		}

		dp[values[i]] = min(dp[values[i]], weights[i]);
		res = max(res, values[i]);
	}

	cout << res;

	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

typedef long long int llint;

void get_vals(llint& a, llint& b) {
	do {
		cin >> a;
	} while (a < 0 || a>100);
	do {
		cin >> b;
	} while (b < 0 || b>100);

	if (a + b < 2) {
		get_vals(a, b);
	}

}


int main() {
	llint n, m;
	get_vals(n, m);
	llint balls{ n + m };

	if (n <= 1) {
		llint top, down;
		top = m * (m - 1);
		down = 2;
		cout << top / down;
		return 0;
	}
	if (m <= 1){
		llint top, down;
		top = n * (n - 1);
		down = 2;
		cout << top / down;
		return 0;
	}

	llint top[2]{n*(n-1), m*(m-1)};
	llint down{2};
	cout << (top[0] / 2) + (top[1] / 2);

	return 0;
}

Measured memory_bytes: 3120
#include <cstdio>

int main(void) {
	while(true) {
		int n;
		scanf("%d", &n);
		if(n == 0)
			break;
		for(int i = 0; i < n; i++) {
			int m, e, j;
			char level = 'C';
			scanf("%d%d%d", &m, &e, &j);
			if(m == 100 || e == 100 || j == 100)
				level = 'A';
			if((m + e) / 2 >= 90)
				level = 'A';
			if((m + e + j) / 3 >= 80)
				level = 'A';
			if((m + e + j) / 3 >= 70 && level == 'C')
				level = 'B';
			if((m + e + j) / 3 >= 50 && level == 'C' && (m >= 80 || e >= 80))
				level = 'B';
			printf("%c\n", level);
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<numeric>
using namespace std;

int gcd(int a, int b){
  int x = max(a, b);
  int y = min(a, b);
  int t;
  while( (t=(x%y)) > 0 ){
    x = y;
    y = t;
  }
  return y;
}

int main(){
  int N, X, m, t;
  vector<int> x;
  set<int> db;
  cin >> N >> X;
  x.resize(N+1);
  for( int i = 0; i < N; i++ ){
    cin >> x[i];
  }
  x[N] = X;
  sort(x.begin(), x.end());
  for( int i = 0; i < N; i++ ){
    db.insert(x[i+1]-x[i]);
  }
  m = numeric_limits<int>::max();
  for( auto &v1 : db ){
    for( auto &v2 : db ){
      t = gcd(v1, v2);
      if( t < m ){ m = t; }
    }
  }
  cout << m << endl;
  return 0;
}

Measured memory_bytes: 640
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
  
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <assert.h>
#include <memory.h>
#include <time.h>
#include <bitset>

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = (l); i < (r); i++)
#define repb(i, r, l) for (int i = (r); i > (l); i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)
#define rank qwertyuio
#define next dfghjk
#define prev fhsgfhjf
#define plus fsghsf
#define minus ytryr
  
using namespace std;
  
inline bool setmin(int &x, int y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(int &x, int y) { return (y > x) ? x = y, 1 : 0; }
inline bool setmin(ll &x, ll y) { return (y < x) ? x = y, 1 : 0; }
inline bool setmax(ll &x, ll y) { return (y > x) ? x = y, 1 : 0; }
  
const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int P1 = 31;
const int P2 = 57;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const int MOD2 = 998244353;
const ld eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("circus.in", "r", stdin);
    //freopen("circus.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    cout << fixed;
    //ll TL = 10.95 * CLOCKS_PER_SEC;
    //clock_t time = clock();
    ll A, V, B, W, T;
    cin >> A >> V >> B >> W >> T;
    if (W >= V) {
        cout << "NO\n";
    } else {
        cout << (abs(A - B) <= T * abs(V - W) ? "YES\n" : "NO\n");
    }
    return 0;
}



Measured memory_bytes: 3664
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-9;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	long long int ans = 1;
	while (N--) {
		cin >> M;
		if (M == 0) {
			cout << 0 << endl;
			return 0;
		}
		if (ans == -1)continue;
		if (1000000000000000000 / M < ans) {
			ans = -1;
		}
		else {
			ans *= M;
		}
	}
	cout << ans << endl;
}


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

# In[27]:


N,M = map(int, input().split())
xy = []
b = [1]*N
p = [False]*N
p[0] = True
for _ in range(M):
    x,y = map(int, input().split())
    b[x-1] -= 1
    b[y-1] += 1
    if p[x-1]:
        p[y-1] = True
    if b[x-1] == 0:
        p[x-1] = False


# In[28]:


ans = 0
for j in p:
    if j:
        ans += 1
print(ans)


# In[ ]:






Measured memory_bytes: 10316
/*
[agc038] A - 01 Matrix
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define ALL(c) (c).begin(), (c).end()

int H, W, A, B;

void solve() {
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cout << (((i < B) != (j < A)) ? 1 : 0);
        }
        cout << endl;
    }
}

int main() {
    cin >> H >> W >> A >> B;

    solve();

    return 0;
}


Measured memory_bytes: 1280
/*
~Like a small boat
~On the ocean
~Sending big waves
~Into motion
!Like how a single word
!Can make a heart open
!I might only have one match
!But I can make an explosion
#And all those things I didn't say
#Wrecking balls inside my brain
#I will scream them loud tonight
#Can you hear my voice this time?
@This is my fight song
@Take back my life song
@Prove I'm alright song
@My power's turned on
$Starting right now I'll be strong
$I'll play my fight song
$And I don't really care if nobody else believes
$'Cause I've still got a lot of fight left in me!!!
*/

#include "bits/stdc++.h"
using namespace std;

#define  F  first
#define  S  second
#define  pb push_back
#define  mp make_pair
#define  sz(s) (int)s.size()
typedef long long int ll;
const int N = 3e3+5;

string toString(int n)
{
    string str;
    stringstream ss;
    ss << n;
    ss >> str;
    return str;
}
string toNegativeBase(ll n, int negBase)
{
    if (n == 0)
        return "0";
    string converted = "";
    while (n != 0)
    {
        int remainder = n % negBase;
        n /= negBase;
        if (remainder < 0)
        {
            remainder += (-negBase);
            n += 1;
        }
        converted = toString(remainder) + converted;
    }

    return converted;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    ll n;cin>>n;
    cout<<toNegativeBase(n,-2)<< "\n";



    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
 
#define MAX 1000
 
int main(void)
{
    int i;
 
    while (1) {
        int n_students;
        scanf("%d", &n_students);
 
        if (n_students == 0) {
            break;
        } else {
            int points[MAX];
            for (i = 0; i < n_students; i++) {
                scanf(" %d", &points[i]);
            }
 
            double ave = 0;
            for (i = 0; i < n_students; i++) {
                ave += points[i];
            }
            ave /= n_students;
 
            double variance = 0;
            for (i = 0; i < n_students; i++) {
                variance += pow(points[i] - ave, 2);
            }
            variance /= n_students;
 
            double deviation = sqrt(variance);
 
            printf("%f\n", deviation);
        }
    }
 
    return 0;
}

Measured memory_bytes: 636
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 2e5 + 10;

char s[N], t[N];
int pref_di[N], pref_dj[N];
int l[N], r[N];
map<char, int> di, dj;

bool in(int x, int y, int h, int w);

int main() {
	di['D'] = dj['R'] = 1;
	di['U'] = dj['L'] = -1;
	int h, w, n, si, sj;
	cin >> h >> w >> n >> si >> sj;
	cin >> (s + 1) >> (t + 1);
	vector<char> all_dir = {'U', 'L', 'D', 'R'};
	for (int j = 0; j < 4; ++j) {
		char d = all_dir[j];
		char o = all_dir[(j + 2) % 4];
		int ti = si, tj = sj;
		for (int i = 1; i <= n; ++i) {
			if (s[i] == d) {
				ti += di[d];
				tj += dj[d];
			}
			if (!in(ti, tj, h, w)) {
				cout << "NO\n";
				return 0;
			}
			if (t[i] == o) {
				ti += di[o];
				tj += dj[o];
				if (!in(ti, tj, h, w)) {
					ti -= di[o];
					tj -= dj[o];
				}
			}
		}
	}
	cout << "YES\n";
}

bool in(int x, int y, int h, int w) {
	return (1 <= x and x <= h and 1 <= y and y <= w);
}

Measured memory_bytes: 640